Jump to content
nakecorp2

Social sharing v1.3.0 Problem

Recommended Posts

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 : '',
));
}

post-865259-0-34942000-1433950240_thumb.png

Edited by nakecorp2 (see edit history)

Share this post


Link to post
Share on other sites

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 by erotikat (see edit history)

Share this post


Link to post
Share on other sites

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

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

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
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More