Skip to main content

Decimal Points and Measurement Symbols

More
15 years 1 week ago #25789 by wonderwilson
Hi Nicolas,

I've added the weight of the product to the front end view for each product, however, I have a couple of questions:

1. I want to have 227 rather than 227.000 - how do remove the decimal point?
2. I want to add the measurement symbol so it will be 227g - what's the PHP code needed to call this, for example: <?php echo $this->row->XXXXXXXXXX;?>?
3. I've managed to edit the front page module to display the weight (product / listing_img_title.php), however I have lots of menus that display product listings - which file do I need to edit to include this?

Thanks

Darren

Please Log in or Create an account to join the conversation.

More
15 years 1 week ago #25792 by nicolas
Hi,

1. You can do like that: www.hikashop.com/fr/support/forum/4-how-...-decimals.html#19315

2. $this->row->product_weight_unit

3. All the listings of products, be it modules or menus, are displayed with the same view files.

Please Log in or Create an account to join the conversation.

More
15 years 1 week ago #25795 by wonderwilson
Hi Nicolas,

These all worked except point three for removing the decimal point…

I changed the following (which sits around line 85) to the following, but it's still showing 227.000g

</span><br />
<?php if(isset(round($this->element->product_weight,X)) && bccomp(round($this->element->product_weight,X),0,3)){ ?>
<span id="hikashop_product_weight_main" class="hikashop_product_weight_main">
<?php echo JText::_('PRODUCT_WEIGHT').': '.rtrim(round($this->element->product_weight,X),',.0').' '.JText::_(round($this->element->product_weight,X)_unit); ?><br />
</span>
<?php
}

I changed them in show.php for both my templates - see attached.

Any ideas?

Thanks

Darren

Please Log in or Create an account to join the conversation.

More
15 years 1 week ago #25797 by nicolas
The show file is for the product page, not products listings. Your screenshot is a the products listing.

You need to use round($this->row->product_weight,0) in your listing_img_title file

Please Log in or Create an account to join the conversation.

More
15 years 1 week ago #25799 by wonderwilson
Great! Thanks for your help today!

Darren

Please Log in or Create an account to join the conversation.

Time to create page: 0.184 seconds
Powered by Kunena Forum