Jump to content

mod stops working after upgrade to 1.25 to 1.31


bartman

Recommended Posts

We used to be able to display the price of the product in the meta title on the product page by using the following

modified

header.php in the root directory

as follows

$header_tpl = 'header.tpl';

if(file_exists(_PS_THEME_DIR_ . 'header_' . $page_name . '.tpl'))
{
   $header_tpl = 'header_' . $page_name . '.tpl';
}

$smarty->display(_PS_THEME_DIR_. $header_tpl); 



so instead of header.tpl being called on the product page header_product.tpl is called

in header_product.tpl i have the following

    <title>
{$meta_title|escape:'htmlall':'UTF-8'} - {convertPrice price=$product->getPrice(true, $smarty.const.NULL, 2)}
</title>



this works in 1.25 but breaks in 1.31 with the error

 PHP Fatal error:  Call to a member function getPrice() on a non-object in /home/firestri/public_html/tools/smarty/compile/%.^2E6^2E61960E%%header_product.tpl.php on line 11



any pointers would be appreciated

Link to comment
Share on other sites

From the error message, it seems that $product is not defined. It isn't included in header.php by default. Did you modify the file and add code like the following?

$product = new Product($_GET['id_product'], true, intval($cookie->id_lang);
$smarty->assign('product', $product);

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...