News:

Looking for documentation? Take a look on our wiki

Main Menu

decimal hide the product weight

Started by antodones, April 11, 2012, 00:59:51 AM

Previous topic - Next topic

antodones

Would it be possible to hide decimal weight of the product?
Sorry for my English

[attachment cleanup by admin]

antodones


Piccolopoeta

Hi, I think I have the same issue..know this topic is old, if you want I can create a new one, but it's the exact same problem

GJC Web Design

this has been asked and I have answered at least twice

last time

simple php for what ever the display is

do

$weight = number_format($weight,2);

echo $weight;
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Piccolopoeta

Yes I read that, but still the same problem as the other user;
I don't understand where I should put this string, have been opening many css but even with firebug can't grasp it

AH

You have to do this in a product details page override

Look in the forum on how to do overrides
Regards
A

Joomla 4.4.5
php 8.1

PRO

views/productdetails/default.php

after this
<div class="productdetails-view productdetails">

add this
<?php
$this->product->product_weight = number_format($this->product->product_weight,2);
?>

Piccolopoeta

Thanks, your help is greatly appreciated. Yet, I keep having the same issue, the numbers keep on showing like this
http://www.toelettaroma.it/index.php/shop2/cani/alimentazione/cuccioli-fino-a-4-5-mesi

Actually I went in
Components/com_virtuemart/views/productdetails/tmpl/default.php
added the string
<?php $weight = number_format($weight,2);
echo $weight;
?>

but nothing changed

tried with this, thought it seems strange, and still nothing happened
<?php
$this->product->product_weight = number_format($this->product->product_weight,2);
?>

tried to change it to
<?php
$this->product->product_weight = number_format(weight,2);
?>

but still unchanged

sorry bothering!

Also in the backend, when I save with "1" as soon as I reopen the product it gives 1.0000 right away!

GJC Web Design

this isn't even the weight!!!!!!

it is your custom fields I assume your talking about..

search for custom fields display
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Piccolopoeta

Yes, it's the weight, and then the custom field is linked to the weight!
Here's the backend screenshot

https://www.dropbox.com/s/fpm9bvxnwcz0fmw/Screenshot%202015-12-23%2012.54.37.png?dl=0

PRO

Quote from: Piccolopoeta on December 23, 2015, 12:02:37 PM
Thanks, your help is greatly appreciated. Yet, I keep having the same issue, the numbers keep on showing like this
http://www.toelettaroma.it/index.php/shop2/cani/alimentazione/cuccioli-fino-a-4-5-mesi

Actually I went in
Components/com_virtuemart/views/productdetails/tmpl/default.php
added the string
<?php $weight = number_format($weight,2);
echo $weight;
?>

but nothing changed

tried with this, thought it seems strange, and still nothing happened
<?php
$this->product->product_weight = number_format($this->product->product_weight,2);
?>

tried to change it to
<?php
$this->product->product_weight = number_format(weight,2);
?>

but still unchanged

sorry bothering!

Also in the backend, when I save with "1" as soon as I reopen the product it gives 1.0000 right away!


thats not the product page.

Its the category

Piccolopoeta

Uh..but it's just the same in the product details, see?
http://www.toelettaroma.it/index.php/shop2/cani/alimentazione/cuccioli-fino-a-4-5-mesi/primi-mesi-bufalo-detail

I get the same problem when i edit the product via administration. Even if I write "1" in the product weight, as soon as I save, it turns to "1.000"!

GJC Web Design

just change the display as above.. it will ALWAYS be stored as 1.0000 .. doesn't need to be displayed as..
enuf info above to achieve this
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

PRO

Quote from: Piccolopoeta on January 14, 2016, 11:38:50 AM
Uh..but it's just the same in the product details, see?
http://www.toelettaroma.it/index.php/shop2/cani/alimentazione/cuccioli-fino-a-4-5-mesi/primi-mesi-bufalo-detail

I get the same problem when i edit the product via administration. Even if I write "1" in the product weight, as soon as I save, it turns to "1.000"!


this is tested for product details page.
This removed the decimals

<?php
$this->product->product_weight = number_format($this->product->product_weight,0);
echo $this->product->product_weight;
?>

THEN: on the category page this is tested and working

<?php
$product->product_weight = number_format($product->product_weight,0);
echo $product->product_weight;

?>