bartman Posted September 22, 2010 Share Posted September 22, 2010 We used to be able to display the price of the product in the meta title on the product page by using the followingmodified header.php in the root directoryas 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 calledin 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 More sharing options...
rocky Posted September 22, 2010 Share Posted September 22, 2010 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 More sharing options...
bartman Posted September 22, 2010 Author Share Posted September 22, 2010 no, nothing in header.php, had a quick look in init.php and can not see anything odd their, I have another prestashop 1.25 site running will apply mod and see if it works, but looking at the code now, I am suprised it worked Link to comment Share on other sites More sharing options...
bartman Posted September 22, 2010 Author Share Posted September 22, 2010 Just modded a 1.25 site with the files, only made the mods mentioned above and it works fineno mod to product.php except the cnage to the call for header.tpl mod in action herehttp://party-nite.co.uk/balloon-weights/13-balloon-weight-black.htmlwill have another look @ init.php and see if anything is different there 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