spice_prods Posted August 31, 2010 Share Posted August 31, 2010 Display the declinated weight on product page 1/ changes in "product.php" : add : 'weightUnit' => Configuration::get('PS_WEIGHT_UNIT'), after : 'outOfStockAllowed' => intval(Configuration::get('PS_ORDER_OUT_OF_STOCK')), add : $combinations[$row['id_product_attribute']]['weight'] = floatval($row['weight']); after : $combinations[$row['id_product_attribute']]['ecotax'] = floatval($row['ecotax']); 2/ changes in "product.tpl" : add : var productWeight = '{$product->weight|escape:'htmlall':'UTF-8'}'; after : var productReference = '{$product->reference|escape:'htmlall':'UTF-8'}'; replace : addCombination({$idCombination|intval}, new Array({$combination.list}), {$combination.quantity}, {$combination.price}, {$combination.ecotax}, {$combination.id_image}, '{$combination.reference|addslashes}'); by : addCombination({$idCombination|intval}, new Array({$combination.list}), {$combination.quantity}, {$combination.price}, {$combination.ecotax}, {$combination.id_image}, '{$combination.reference|addslashes}', {$combination.weight}); add the product's weight display where you want : <!-- products weight --><br/> <p>Poids : <span id="product_weight">{$product->weight}</span> {$weightUnit}</p> for example, before : <p{if !$allow_oosp && $product->quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"><input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p> 3/ changes in "product.js" : replace : function addCombination(idCombination, arrayOfIdAttributes, quantity, price, ecotax, id_image, reference) by : function addCombination(idCombination, arrayOfIdAttributes, quantity, price, ecotax, id_image, reference, weight) add : combination['weight'] = weight; after : combination['reference'] = reference; add : selectedCombination['weight'] = combinations[combination]['weight']; after : selectedCombination['price'] = combinations[combination]['price']; add : // Calcul et affichage du poids des produits<br/> var declined_weight = Number(selectedCombination['weight']) + Number(productWeight);<br/><br/> if (selectedCombination['weight'])<br/> $('#product_weight').text(declined_weight);<br/><br/> else if (productWeight)<br/> $('#product_weight').text(productWeight);<br/> $('#product_weight:hidden').show('slow');<br/> after : function updateDisplay()<br/>{<br/> Link to comment Share on other sites More sharing options...
Dave L Posted April 16, 2011 Share Posted April 16, 2011 Hi,This is a great little mod which is just what I was looking for.I have located the field between Reference and quantity.Could anyone advice what I would need to add in the .product.tpl to align the weight: with the other fields please.Image of what I mean is attached.Here is the code in the .tpl reference}style="display:none;"{/if}>{l s='Reference :'} {$product->reference|escape} <!-- products weight --> Weight : {$product->weight} {$weightUnit} <!-- quantity wanted --> quantity == 0) || $virtual} style="display:none;"{/if}> {l s='Quantity :'} <input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" /> Edit: Solved - Just copied the code for the reference part and substituted 'reference' with weight. Link to comment Share on other sites More sharing options...
Dave L Posted July 2, 2011 Share Posted July 2, 2011 Hi,I found this mod very useful for my site.I have now upgraded to 1.4.3 The product.php file is very different than with 1.3.7Could anyone advise how to get the weight on the product page on 1.4.3 please.Thanks. Link to comment Share on other sites More sharing options...
Dave L Posted July 31, 2011 Share Posted July 31, 2011 Could anyone advise please. Thanks. Link to comment Share on other sites More sharing options...
Bejo Posted October 15, 2012 Share Posted October 15, 2012 (edited) it no work with ps1.5!! somebody already did with ps 1.5? pls!! Edited October 15, 2012 by jesen (see edit history) 1 Link to comment Share on other sites More sharing options...
jimmyc Posted January 31, 2013 Share Posted January 31, 2013 yes any way to do this in 1.5 1 Link to comment Share on other sites More sharing options...
vasekcekal Posted June 16, 2013 Share Posted June 16, 2013 Just add {$product->weight} in product.tpl anywhere you wants. Works for me in 1.5.4.1 Link to comment Share on other sites More sharing options...
Bejo Posted June 17, 2013 Share Posted June 17, 2013 Just add {$product->weight} in product.tpl anywhere you wants. Works for me in 1.5.4.1 would you mind give live example. pls. thx for share 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...
tatamimi Posted August 29, 2014 Share Posted August 29, 2014 Hello! I'm looking for the way to show the weight depends on the combination pattern in the product page...I found and tried this topic's method but it don't work in my case (ver 1.6.0.6). Please help me! Link to comment Share on other sites More sharing options...
brzm Posted November 17, 2015 Share Posted November 17, 2015 Any idea to solve this problem on 1.6.1.1? 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