Jump to content

[SOLVED] Show weight on Front page


Recommended Posts

Add the following code before the $smarty->display in product.php to make the weight unit available in product.tpl:

$smarty->assign('weightUnit', Configuration::get('PS_WEIGHT_UNIT'));



then add the following to product.tpl wherever you want the product weight to appear:

{$product->weight} {$weightUnit}

Link to comment
Share on other sites

Hi Rocky,
Thanks for your help. I looked at product.php and can see two $smarty->display, which one do I prefix with the code?
Also I need the weight to appear on each product description page ( the pages with everything on about the product), where do I find the folder to do this?
Sorry but I am fairly new to Prestashop and very new to php.
Thanks for your help so far, it is very encouraging.
Clive

Link to comment
Share on other sites

Put it anywhere you want in product.tpl in your theme's directory. I suppose a good place to put it could be after the product reference on line 253 (in PrestaShop v1.3.1). Add the following line after it:


{l s='Weight :'} {$product->weight} {$weightUnit}

Link to comment
Share on other sites

$smarty->assign('weightUnit', Configuration::get('PS_WEIGHT_UNIT')); I posted this in the Prestashop/product.php file and then this

{l s='Weight
:'} {$product->weight}
{$weightUnit}



In the theme product.tpl file in both Prestashop and in Ruma batik files. Is this OK?
Because it has not worked for me. I can't see the product weight anywhere.
Link to comment
Share on other sites

I'm not familiar with that theme. I downloaded it and had a quick look, but the product.tpl has the same reference line as in the default theme. I tested the weight code in the default theme and it works fine. I'm not sure why it wouldn't work in the Rumah Batik theme. Perhaps you need to add some CSS for the product_weight to appear. Editing themes/rumahbatik/product.tpl to add that line should at least add code to the HTML. Try viewing the source of the product page and see whether you can find "Weight :" in there. If it is there, but you can't see it on your site, it must be a CSS issue.

Link to comment
Share on other sites

Hi Rocky,
Thank you for taking so much time for me. Before I try anything else, perhaps you could have a quick look at the attached. These are the files I have changed as per your instructions. I renamed the product file from the Ruma Batik file for ID purposes for you.
I want to be sure that I have done exactly as you told me.
As I said before, I am new to this game but I am learining all of the time.
Thanks again,
Clive

product.php

Link to comment
Share on other sites

Hi again,
I'm sorry, but I copied the files you sent back to me and you can see herehttp://www.passion-savon.fr/product.php?id_product=47 that the weight does not appear only the code $smarty->display appears just above the brown menu to the right.
Can you help again, please?

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...
  • 1 year later...
  • 1 year later...

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...