wotnots Posted August 28, 2010 Share Posted August 28, 2010 Is it possible to have the weight of a product showing in the product description or somewhere? I have many clients asking what is the weight of the bars of soap. I really do not want to have to add the weight to every description. Link to comment Share on other sites More sharing options...
rocky Posted August 28, 2010 Share Posted August 28, 2010 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 More sharing options...
wotnots Posted August 28, 2010 Author Share Posted August 28, 2010 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 More sharing options...
rocky Posted August 28, 2010 Share Posted August 28, 2010 This one: $smarty->display(_PS_THEME_DIR_.'product.tpl'); Link to comment Share on other sites More sharing options...
wotnots Posted August 29, 2010 Author Share Posted August 29, 2010 That's great, thank you. Sorry to be a numpty but where do I put the second piece of code {$product->weight} {$weightUnit}so that it appears in every product item page such as this one: http://www.passion-savon.fr/product.php?id_product=46 I hope this is clear.Thanks again for your help and support.Clive Link to comment Share on other sites More sharing options...
rocky Posted August 29, 2010 Share Posted August 29, 2010 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 More sharing options...
wotnots Posted August 29, 2010 Author Share Posted August 29, 2010 $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 More sharing options...
rocky Posted August 30, 2010 Share Posted August 30, 2010 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 More sharing options...
wotnots Posted August 30, 2010 Author Share Posted August 30, 2010 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 More sharing options...
wotnots Posted August 30, 2010 Author Share Posted August 30, 2010 I can't get the 3 files to save as attachments. here is another Link to comment Share on other sites More sharing options...
wotnots Posted August 30, 2010 Author Share Posted August 30, 2010 another trySorry they will not save. Link to comment Share on other sites More sharing options...
rocky Posted August 30, 2010 Share Posted August 30, 2010 Try zipping the files before attaching them. Link to comment Share on other sites More sharing options...
wotnots Posted August 30, 2010 Author Share Posted August 30, 2010 Sorry. I should have thought to do that. My brain is not functioning properly yet. I need a caffeine injection product weight.zip Link to comment Share on other sites More sharing options...
rocky Posted August 30, 2010 Share Posted August 30, 2010 It seems the create is in the wrong encoding. It is using { and } instead of { and }. I've attached a corrected version. product weight.zip Link to comment Share on other sites More sharing options...
wotnots Posted August 30, 2010 Author Share Posted August 30, 2010 Thank you Mr. Moderator, sir. I don't know what I would have done without you. I shall try this now.Clive Link to comment Share on other sites More sharing options...
wotnots Posted August 30, 2010 Author Share Posted August 30, 2010 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 More sharing options...
rocky Posted August 30, 2010 Share Posted August 30, 2010 I just checked:http://www.passion-savon.fr/themes/rumahbatik/product.tpl and it doesn't have the weight code in it. Make sure that the modified file uploaded correctly. Link to comment Share on other sites More sharing options...
wotnots Posted August 31, 2010 Author Share Posted August 31, 2010 The modified file you sent me does not have the weight code in it either, so I still have the same problem. Link to comment Share on other sites More sharing options...
rocky Posted September 1, 2010 Share Posted September 1, 2010 I just downloaded the zip and checked and product.tpl does have the weight code below the reference code, though product-ruma.tpl does not. You can simply copy the weight code from product-tpl into product-ruma.tpl if required. Link to comment Share on other sites More sharing options...
wotnots Posted September 1, 2010 Author Share Posted September 1, 2010 Thank you very much. I thought there was something missing. The weight now appears on every product. One final small detail. Look here, please: http://www.passion-savon.fr/product.php?id_product=95How do I get rid of the $smarty->display which appears on the left between the two top menus? Link to comment Share on other sites More sharing options...
rocky Posted September 1, 2010 Share Posted September 1, 2010 Change line 1 of themes/rumahbatik/product.tpl from: $smarty->display{include file=$tpl_dir./errors.tpl} to: {include file=$tpl_dir./errors.tpl} Link to comment Share on other sites More sharing options...
wotnots Posted September 1, 2010 Author Share Posted September 1, 2010 Thank you so much. you are a star. Link to comment Share on other sites More sharing options...
Rich Walker Posted December 9, 2010 Share Posted December 9, 2010 Is there anyway of displaying the weight if there is a value? Some of my products don't have weights and some do. Link to comment Share on other sites More sharing options...
rocky Posted December 19, 2010 Share Posted December 19, 2010 Do you mean display the product weight on the product page only if the weight is greater than 0? That's easy to do with an if statement: {if $product->weight > 0} {l s='Weight :'} {$product->weight} {$weightUnit}{/if} Link to comment Share on other sites More sharing options...
FreshCommerce Posted November 22, 2012 Share Posted November 22, 2012 Any information about implementing this in PS 1.5? Thanks Link to comment Share on other sites More sharing options...
evolution.x Posted March 24, 2014 Share Posted March 24, 2014 Hi, Here is a module which will show the weight of products on the product page, it is also compatible with PS 1.5 http://addons.prestashop.com/en/front-office-features-prestashop-modules/14571-show-weight-on-product-page.html 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