killian29 Posted January 22, 2015 Share Posted January 22, 2015 I am in the process of porting over my shop from oscommerce to prestashop. Everything seems to be working fine accept I cannot get the product compare to work. I can select the products to compare, but when I press the compare button I am taken to https://fineartdelivered.com/products-compare It seems to be missing the "?compare_product_list=" that I see on my test version...As you can see the link displayed goes to an error (HTTP 500 Internal Server Error). Also, when I go to the product page in the BO and delete a product I receive the same error page...although when I go back to the product page the product is erased. Any help would be greatly appreciated. I also can not keep the site active for more than a couple of days as I do not want active traffic. Thanks for the help. Link to comment Share on other sites More sharing options...
killian29 Posted January 22, 2015 Author Share Posted January 22, 2015 So I guess I solved the Compare Product issue. Go to Preferences>Themes>Theme then at the bottom of the page, "Appearance of Columns" I needed to enable "product comparison" I hope this helps others as it was driving me crazy. 1 Link to comment Share on other sites More sharing options...
LiTo GaRcIa Posted August 25, 2015 Share Posted August 25, 2015 Hi, I´ve tried to do what you mention, but I don´t have that option "product comparison" . I´m using Prestashop 1.6.1.1 Any suggestion? Thanks for the help Link to comment Share on other sites More sharing options...
Mad Cat Posted August 28, 2015 Share Posted August 28, 2015 Hello - I just upgraded to PrestaShop 1.6.1.1 and am having the same issue with product comparison not working. The error I am receiving is: Fatal error: Call to undefined method CompareController::getProduct() in /home/xxx/xxx/xxx/modules/socialsharing/socialsharing.php on line 161 Line 161 is: $product = $this->context->controller->getProduct(); Could someone provide the fix for those of us who have upgraded to v1.6.1.1 as soon as possible? Many thanks! Link to comment Share on other sites More sharing options...
KCH Posted August 31, 2015 Share Posted August 31, 2015 (edited) I've managed to get it working on PrestaShop 1.6.1.1. The solution is ugly but it works. Comment everything after the addJs() and modify the return statement: 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 : ''))); */ return $this->display(__FILE__, 'socialsharing_header.tpl', null); } Edited August 31, 2015 by KCH (see edit history) Link to comment Share on other sites More sharing options...
ItalianBoutiqueShoes Posted September 2, 2015 Share Posted September 2, 2015 A little better fix: Search $product = $this->context->controller->getProduct(); if (!Validate::isLoadedObject($product)) { return; } replace with: // Exception are managed with Module::registerExceptions() but this is needed in case the merchant added new controllers afterwards if (!isset($this->context->controller->php_self) || $this->context->controller->php_self != 'product') return; $product = $this->context->controller->getProduct(); 2 Link to comment Share on other sites More sharing options...
rubensaid Posted September 18, 2015 Share Posted September 18, 2015 (edited) Yo lo estoy utilizando algo asi: 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 September 18, 2015 by comprope (see edit history) 1 Link to comment Share on other sites More sharing options...
frank_jarle Posted October 18, 2015 Share Posted October 18, 2015 A little better fix: Search $product = $this->context->controller->getProduct(); if (!Validate::isLoadedObject($product)) { return; } replace with: // Exception are managed with Module::registerExceptions() but this is needed in case the merchant added new controllers afterwards if (!isset($this->context->controller->php_self) || $this->context->controller->php_self != 'product') return; $product = $this->context->controller->getProduct(); I edited the following file: /public_html/modules/socialsharing/socialsharing.php with your code but the "Add to compare" is still not showing up. Link to comment Share on other sites More sharing options...
rubensaid Posted October 19, 2015 Share Posted October 19, 2015 that should be a problem with your theme, because that piece of code just fix a problem with logical code no related to visuals or smarty. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now