[Skip to main content](#vessel-content)

#   Price-per-unit on product category pages?

##

- **[hkingman](/forum/user/606-hkingman "View hkingman's Profile")**
- [![hkingman's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/606-hkingman "View hkingman's Profile") Topic Author
- [ Offline](/forum/user/606-hkingman)

Less More

- Posts: 34
- Thank you received: 2
-
-

15 years 10 months ago [\#4959](#4959) by [hkingman](/forum/user/606-hkingman "View hkingman's Profile")  *[Price-per-unit on product category pages?](/forum/4-how-to/4959-price-per-unit-on-product-category-pages#4959 "Hello,  Just getting started with Hikashop... enjoyable!  I enabled &quot;price-per-weight-unit&quot; on individual show product pages. Can I also have it on product listing pages?  I tried editing various views, but without success. Apologies if I missed something obvious!  Thanks,  -Henry")* was created by *[hkingman](/forum/user/606-hkingman "View hkingman's Profile")*

Hello,

Just getting started with Hikashop... enjoyable!

I enabled "price-per-weight-unit" on individual show product pages. Can I also have it on product listing pages?

I tried editing various views, but without success. Apologies if I missed something obvious!

Thanks,

-Henry

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQ5NTktcHJpY2UtcGVyLXVuaXQtb24tcHJvZHVjdC1jYXRlZ29yeS1wYWdlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86561
- Thank you received: 14307
-
-

15 years 10 months ago [\#4962](#4962) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Price-per-unit on product category pages?](/forum/4-how-to/4959-price-per-unit-on-product-category-pages#4962 "Hello,  Just getting started with Hikashop... enjoyable!  I enabled &quot;price-per-weight-unit&quot; on individual show product pages. Can I also have it on product listing pages?  I tried editing various views, but without success. Apologies if I missed something obvious!  Thanks,  -Henry")*

Hi,

there is indeed no such option. You need to edit the file listing_price of the view product via the menu Display-&gt;Views. There you can replace the line: Code:

if(!empty($this-&gt;element-&gt;product_id) &amp;&amp; isset($this-&gt;row-&gt;product_weight) &amp;&amp; bccomp($this-&gt;row-&gt;product_weight,0,3)){

by Code:

if(isset($this-&gt;row-&gt;product_weight) &amp;&amp; bccomp($this-&gt;row-&gt;product_weight,0,3)){

So that it will display on the listings as well.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQ5NTktcHJpY2UtcGVyLXVuaXQtb24tcHJvZHVjdC1jYXRlZ29yeS1wYWdlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[hkingman](/forum/user/606-hkingman "View hkingman's Profile")**
- [![hkingman's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/606-hkingman "View hkingman's Profile") Topic Author
- [ Offline](/forum/user/606-hkingman)

Less More

- Posts: 34
- Thank you received: 2
-
-

15 years 10 months ago -  15 years 10 months ago [\#4973](#4973) by [hkingman](/forum/user/606-hkingman "View hkingman's Profile")  Replied by *[hkingman](/forum/user/606-hkingman "View hkingman's Profile")* on topic *[Re: Price-per-unit on product category pages?](/forum/4-how-to/4959-price-per-unit-on-product-category-pages#4973 "Hello,  Just getting started with Hikashop... enjoyable!  I enabled &quot;price-per-weight-unit&quot; on individual show product pages. Can I also have it on product listing pages?  I tried editing various views, but without success. Apologies if I missed something obvious!  Thanks,  -Henry")*

Say, thanks for the quick reply!

That was actually the first thing I tried ![:-(](/media/kunena/emoticons/22.png ":-(") but it wouldn't work.

Caching is not on.

I also tried pasting this whole block of code into various other view files, but I don't know my way around very well yet:
Code:

if($this-&gt;params-&gt;get('show_price_weight')){ if( isset($this-&gt;row-&gt;product_weight) &amp;&amp; bccomp($this-&gt;row-&gt;product_weight,0,3)){ $weight_price = $price-&gt;price_value_with_tax / $this-&gt;row-&gt;product_weight; echo JText::_('PRICE_SEPARATOR').'&lt;span class="hikashop_product_price_per_weight_unit"&gt;('.$this-&gt;currencyHelper-&gt;format($weight_price,$price-&gt;price_currency_id).' / '.JText::_($this-&gt;row-&gt;product_weight_unit).')&lt;/span&gt;'; } }

Any other ideas?

Regards

UPDATE: It does work, if I comment out Code:

if($this-&gt;params-&gt;get('show_price_weight')){

though that sort of hinders the admin screen fucntion I guess

Last edit: 15 years 10 months ago by [hkingman](/forum/user/606-hkingman "View hkingman's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQ5NTktcHJpY2UtcGVyLXVuaXQtb24tcHJvZHVjdC1jYXRlZ29yeS1wYWdlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86561
- Thank you received: 14307
-
-

15 years 10 months ago [\#4975](#4975) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Price-per-unit on product category pages?](/forum/4-how-to/4959-price-per-unit-on-product-category-pages#4975 "Hello,  Just getting started with Hikashop... enjoyable!  I enabled &quot;price-per-weight-unit&quot; on individual show product pages. Can I also have it on product listing pages?  I tried editing various views, but without success. Apologies if I missed something obvious!  Thanks,  -Henry")*

Ah yes of course. That option isn't loaded on the products listing so the code $this-&gt;params-&gt;get('show_price_weight') will always return false on the listing of products. The solution is indeed to remove that check as well. And indeed, the option on the backend will be useless after that modification.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQ5NTktcHJpY2UtcGVyLXVuaXQtb24tcHJvZHVjdC1jYXRlZ29yeS1wYWdlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[hkingman](/forum/user/606-hkingman "View hkingman's Profile")**
- [![hkingman's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/606-hkingman "View hkingman's Profile") Topic Author
- [ Offline](/forum/user/606-hkingman)

Less More

- Posts: 34
- Thank you received: 2
-
-

15 years 10 months ago [\#4983](#4983) by [hkingman](/forum/user/606-hkingman "View hkingman's Profile")  Replied by *[hkingman](/forum/user/606-hkingman "View hkingman's Profile")* on topic *[Re: Price-per-unit on product category pages?](/forum/4-how-to/4959-price-per-unit-on-product-category-pages#4983 "Hello,  Just getting started with Hikashop... enjoyable!  I enabled &quot;price-per-weight-unit&quot; on individual show product pages. Can I also have it on product listing pages?  I tried editing various views, but without success. Apologies if I missed something obvious!  Thanks,  -Henry")*

I tried copying some lines from the show function in views/product/view.html.php into the listing function, but could not get it to work.

So I just edited admin &#124; config &#124; display view from:
Code:

&lt;?php echo JHTML::_('select.booleanlist', 'config[show_price_weight]' , '',$this-&gt;config-&gt;get('show_price_weight')); ?&gt;

to Code:

&lt;?php echo 'Edit Views &#124; product &#124; listing_price'; /*JHTML::_('select.booleanlist', 'config[show_price_weight]' , '',$this-&gt;config-&gt;get('show_price_weight')); */ ?&gt;

Maybe some future release ![:-)](/media/kunena/emoticons/3.png ":-)")

Cheers, thanks again

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQ5NTktcHJpY2UtcGVyLXVuaXQtb24tcHJvZHVjdC1jYXRlZ29yeS1wYWdlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86561
- Thank you received: 14307
-
-

15 years 10 months ago [\#4985](#4985) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Price-per-unit on product category pages?](/forum/4-how-to/4959-price-per-unit-on-product-category-pages#4985 "Hello,  Just getting started with Hikashop... enjoyable!  I enabled &quot;price-per-weight-unit&quot; on individual show product pages. Can I also have it on product listing pages?  I tried editing various views, but without success. Apologies if I missed something obvious!  Thanks,  -Henry")*

If you change the code of the view.html.php it will be overwritten when you update. We will add the two lines loading that option on the listing of products for next release. That way this modification will work while keeping that option usable.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQtaG93LXRvLzQ5NTktcHJpY2UtcGVyLXVuaXQtb24tcHJvZHVjdC1jYXRlZ29yeS1wYWdlcz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.062 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
