Jump to content

Product Comparison page display blank in prestashop 1.6.1.1


Recommended Posts

hi, i have the same problem:

 

On debug mode: Fatal error: Call to undefined method CompareController::getProduct() in /sklep1/modules/socialsharing/socialsharing.php on line 161

public function hookDisplayHeader($params)
	{
		if (!isset($this->context->controller->php_self) || !in_array($this->context->controller->php_self, array('product', 'products-comparison')))
			return;

		$this->context->controller->addCss($this->_path.'css/socialsharing.css');
		$this->context->controller->addJS($this->_path.'js/socialsharing.js');

		$product = $this->context->controller->getProduct();

		if (!Validate::isLoadedObject($product)) {
			return;
		}

		if (!$this->isCached('socialsharing_header.tpl', $this->getCacheId('socialsharing_header|'.(isset($product->id) && $product->id ? (int)$product->id : ''))))
		{
			$this->context->smarty->assign(array(
				'price' => Tools::ps_round($product->getPrice(!Product::getTaxCalculationMethod((int)$this->context->cookie->id_customer), null), _PS_PRICE_COMPUTE_PRECISION_),
				'pretax_price' => Tools::ps_round($product->getPrice(false, null), _PS_PRICE_COMPUTE_PRECISION_),
				'weight' => $product->weight,
				'weight_unit' => Configuration::get('PS_WEIGHT_UNIT'),
				'cover' => isset($product->id) ? Product::getCover((int)$product->id) : '',
				'link_rewrite' => isset($product->link_rewrite) && $product->link_rewrite ? $product->link_rewrite : '',
			));
		}

		return $this->display(__FILE__, 'socialsharing_header.tpl', $this->getCacheId('socialsharing_header|'.(isset($product->id) && $product->id ? (int)$product->id : '')));
	}
Link to comment
Share on other sites

Same here:

 

Strict Standards: Declaration of Dispatcher::loadRoutes() should be compatible with that of DispatcherCore::loadRoutes() in /home/www/griffineffects.com/store/classes/PrestaShopAutoload.php on line 121

Fatal error: Call to undefined method CompareController::getProduct() in /home/www/griffineffects.com/store/modules/socialsharing/socialsharing.php on line 161

Link to comment
Share on other sites

Same error message too on this new 1.6.6.1 with social sharing module 1.4.0 (on the prestashop 1.6.1.0 it was social sharing 1.3.0 I think, have to check)

 

On modules/socialsharing/socialsharing.php

I changed lines 161 to 165 with part of code of the social sharing v 1.3.0 and now it seems to work for me while waiting the new version.

 

I have changed these lines (161 to 165)

        $product = $this->context->controller->getProduct();

        if (!Validate::isLoadedObject($product)) {
            return;
        }

 

to that :

        if (!isset($this->context->controller->php_self) || $this->context->controller->php_self != 'product')
            return;

        $product = $this->context->controller->getProduct();

 

Or if you dont want to modify code, I confirm too that if the "social sharing" module is off, comparison is working back without any code modification. hope that it will help someone with that bug while waiting new version of social sharing module.

 

Someone else could confirm to me if it works too for his new presta 1.6.1.1 ?

 

Elicode

 

  • Like 2
Link to comment
Share on other sites

Same error message too on this new 1.6.6.1 with social sharing module 1.4.0 (on the prestashop 1.6.1.0 it was social sharing 1.3.0 I think, have to check)

 

On modules/socialsharing/socialsharing.php

I changed lines 161 to 165 with part of code of the social sharing v 1.3.0 and now it seems to work for me while waiting the new version.

 

I have changed these lines (161 to 165)

 

to that :

 

Or if you dont want to modify code, I confirm too that if the "social sharing" module is off, comparison is working back without any code modification. hope that it will help someone with that bug while waiting new version of social sharing module.

 

Someone else could confirm to me if it works too for his new presta 1.6.1.1 ?

 

Elicode

Thanks! your code works perfect!

 

prestashop 1.6.1.1

 

David

Edited by dsolsona (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

I'm using this code. Is almost the same, but just I'm making sure that code will not call to getProduct() function when CompareController is the context. However, js and css will load on both pages

public function hookDisplayHeader($params)
	{
		if (!isset($this->context->controller->php_self) || !in_array($this->context->controller->php_self, array('product', 'products-comparison')))
			return;

		$this->context->controller->addCss($this->_path.'css/socialsharing.css');
		$this->context->controller->addJS($this->_path.'js/socialsharing.js');

		if(in_array($this->context->controller->php_self, array('product'))) $product = $this->context->controller->getProduct();

		if (!Validate::isLoadedObject($product)) {
			return;
		}
Edited by comprope (see edit history)
  • Like 1
Link to comment
Share on other sites

Same error message too on this new 1.6.6.1 with social sharing module 1.4.0 (on the prestashop 1.6.1.0 it was social sharing 1.3.0 I think, have to check)

 

On modules/socialsharing/socialsharing.php

I changed lines 161 to 165 with part of code of the social sharing v 1.3.0 and now it seems to work for me while waiting the new version.

 

I have changed these lines (161 to 165)

 

to that :

 

Or if you dont want to modify code, I confirm too that if the "social sharing" module is off, comparison is working back without any code modification. hope that it will help someone with that bug while waiting new version of social sharing module.

 

Someone else could confirm to me if it works too for his new presta 1.6.1.1 ?

 

Elicode

 

Works like a charm bro, thanks!!

Link to comment
Share on other sites

  • 2 weeks later...
×
×
  • Create New...