Jump to content
mmifarook

display weight in prestashop 1.7

Recommended Posts

Hi all,

i need to display weight in product inner page in prestashop 1.7 . please help to solve this.

Share this post


Link to post
Share on other sites
hace 59 minutos, mmifarook dijo:

Hi all,

i need to display weight in product inner page in prestashop 1.7 . please help to solve this.

 

Use variable:

 

{$product.weight}

For example in the file:

 

/themes/classic/templates/catalog/product.tpl

Below the short description of the product
 

Attached image: http://victor-rodenas.com/wp-content/uploads/2018/02/PesoProducto-1024x301.png 

Sorry for my English

Tip tested in Prestashop 1.7.2.4 with the default template
 

----

{$product.weight} -> weight product
{$product.weight_unit} -> Unit of the weight (Kg)

---

{if isset($product.weight) && ($product.weight != 0)}  <div> {l s='Weight' d='Shop.Theme.Catalog'}   {$product.weight|string_format:"%.2f"}  {$product.weight_unit}  </div> {/if}

 

Edited by nadie (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites
On 2/15/2018 at 3:37 PM, nadie said:

 

Use variable:

 


{$product.weight}

For example in the file:

 


/themes/classic/templates/catalog/product.tpl

Below the short description of the product
 

Attached image: http://victor-rodenas.com/wp-content/uploads/2018/02/PesoProducto-1024x301.png 

Sorry for my English

Tip tested in Prestashop 1.7.2.4 with the default template
 

----

{$product.weight} -> weight product
{$product.weight_unit} -> Unit of the weight (Kg)

---


{if isset($product.weight) && ($product.weight != 0)}  <div> {l s='Weight' d='Shop.Theme.Catalog'}   {$product.weight|string_format:"%.2f"}  {$product.weight_unit}  </div> {/if}

 

Thanks for the reply nadie,

 I tried the variable the u specified above it worked , but if the product has two weights, the weight should  change according to the option selected, if the product has large and small option with different weight and prices . the price is changing according to the option selected but weight remains same . please help me to solve this .thank you

Share this post


Link to post
Share on other sites

This is already done with a hook in /blob/develop/themes/classic/templates/catalog/_partials/product-prices.tpl.

I mean, in theory! Because in order to show this weight label, you would have to install the module for complying with European legal requirements called ps_legalcompliance.

And after this you would find another bug here: They forgot to integrate this weight hook file into /modules/ps_legalcompliance/views/templates/hook

My advice: Forget this ill-conceived new development called PrestaShop 1.7x and use the technically mature shop software PrestaShop 1.6.1x instead.

Share this post


Link to post
Share on other sites

This may works with an product which has a weight. But if i using combinations my default weight is zero. I added the information for the combination to add 40 grams. So my display is still zero. How can I get the chosen combinations weight?

Share this post


Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More