nakecorp2 0 Posted June 10, 2015 Posted June 10, 2015 (edited) I just upgraded Prestashop from v1.6.0.6 to v1.6.0.14 . The Social Sharing module (Social sharing v1.3.0 - by PrestaShop) works on the products page, but on a blog page, for some reason, it kicks out an error. I'm not sure why it's functioning on a blog page, but it seems to be. The code below includes line 169 which the error indicates. Under the module configuration there is only the option to turn it on or off. I've attached a pic. Any ideas? Fatal error: Call to a member function getPrice() on a non-object in /public_html/modules/socialsharing/socialsharing.php on line 169 // 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(); 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 : '', )); } Edited June 10, 2015 by nakecorp2 (see edit history) Share this post Link to post Share on other sites
erotikat 11 Posted June 15, 2015 Posted June 15, 2015 (edited) Hi, Same issue with 1.3.0 on 1.6.0.9, so i replaced "_PS_PRICE_COMPUTE_PRECISION_" with the value "2". This solved the issue but the meta value was not ok (it's blank). <meta property="product:price:amount" content=""> <meta property="product:pretax_price:amount" content=""> The errors was not showed. Be carefull, you have 2 lines : 169 and 170 holpe this help to wait a corrected version Regards https://github.com/PrestaShop/socialsharing Edited June 15, 2015 by erotikat (see edit history) Share this post Link to post Share on other sites
misterpo 1 Posted July 30, 2015 Posted July 30, 2015 Hi, Same problem for me with PS 1.6.1.0 but erotikat's fix didn't help. Any idea ? http://larandonnee.boutique//Arrivage-de-sacs-%C3%A0-dos-d%C3%A9stock%C3%A9s---.html Share this post Link to post Share on other sites
DotMedia 13 Posted August 3, 2015 Posted August 3, 2015 Hi Guys,Please apply these changes and report back here so other people know if it works. It's seems to have fixed the problem for me, everything is working as expected and there are no errors in the log at the moment... thanks Gregory.https://github.com/PrestaShop/socialsharing/pull/17/filesDM Share this post Link to post Share on other sites
misterpo 1 Posted August 4, 2015 Posted August 4, 2015 Hi, Actually this fix removes the error but reading the blog article content still is impossible. Have a look at http://larandonnee.boutique and click on 1 of the 2 articles above the GMap. Share this post Link to post Share on other sites
DotMedia 13 Posted August 4, 2015 Posted August 4, 2015 Misterpo,I think you're having a different problem, this is a fix for the error message about the Social Sharing module on the product pages.DM Share this post Link to post Share on other sites
misterpo 1 Posted August 4, 2015 Posted August 4, 2015 I have the same problem as nakecorp2 ; that is I can't show up my blog posts because of socialsharing errors. What should I do ? Share this post Link to post Share on other sites
misterpo 1 Posted August 4, 2015 Posted August 4, 2015 Thanks for your insight DotMedia. Disabling the Smartblog option "Use .html with clean URLs" fixed the problem. Share this post Link to post Share on other sites
DotMedia 13 Posted August 4, 2015 Posted August 4, 2015 Oh good, glad that problem is now fixed also. Share this post Link to post Share on other sites
Recommended Posts