- Posts: 34
- Thank you received: 2
Price-per-unit on product category pages?
15 years 8 months ago #4959
by hkingman
Price-per-unit on product category pages? was created by hkingman
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
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 or Create an account to join the conversation.
15 years 8 months ago #4962
by nicolas
Replied by nicolas on topic Re: Price-per-unit on product category pages?
Hi,
there is indeed no such option. You need to edit the file listing_price of the view product via the menu Display->Views. There you can replace the line:
by
So that it will display on the listings as well.
there is indeed no such option. You need to edit the file listing_price of the view product via the menu Display->Views. There you can replace the line:
Code:
if(!empty($this->element->product_id) && isset($this->row->product_weight) && bccomp($this->row->product_weight,0,3)){
Code:
if(isset($this->row->product_weight) && bccomp($this->row->product_weight,0,3)){
Please Log in or Create an account to join the conversation.
15 years 8 months ago - 15 years 8 months ago #4973
by hkingman
Replied by hkingman on topic Re: Price-per-unit on product category pages?
Say, thanks for the quick reply!
That was actually the first thing I tried
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:
Any other ideas?
Regards
UPDATE: It does work, if I comment out
though that sort of hinders the admin screen fucntion I guess
That was actually the first thing I tried
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->params->get('show_price_weight')){
if( isset($this->row->product_weight) && bccomp($this->row->product_weight,0,3)){
$weight_price = $price->price_value_with_tax / $this->row->product_weight;
echo JText::_('PRICE_SEPARATOR').'<span class="hikashop_product_price_per_weight_unit">('.$this->currencyHelper->format($weight_price,$price->price_currency_id).' / '.JText::_($this->row->product_weight_unit).')</span>';
}
}
Any other ideas?
Regards
UPDATE: It does work, if I comment out
Code:
if($this->params->get('show_price_weight')){
Last edit: 15 years 8 months ago by hkingman.
Please Log in or Create an account to join the conversation.
15 years 8 months ago #4975
by nicolas
Replied by nicolas on topic Re: Price-per-unit on product category pages?
Ah yes of course. That option isn't loaded on the products listing so the code $this->params->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 or Create an account to join the conversation.
15 years 8 months ago #4983
by hkingman
Replied by hkingman on topic Re: Price-per-unit on product category pages?
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 | config | display view from:
to
Maybe some future release
Cheers, thanks again
So I just edited admin | config | display view from:
Code:
<?php echo JHTML::_('select.booleanlist', 'config[show_price_weight]' , '',$this->config->get('show_price_weight')); ?>
Code:
<?php echo 'Edit Views | product | listing_price'; /*JHTML::_('select.booleanlist', 'config[show_price_weight]' , '',$this->config->get('show_price_weight')); */ ?>
Maybe some future release
Cheers, thanks again
Please Log in or Create an account to join the conversation.
15 years 8 months ago #4985
by nicolas
Replied by nicolas on topic Re: Price-per-unit on product category pages?
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 or Create an account to join the conversation.
Time to create page: 0.152 seconds