Price-per-unit on product category pages?

  • Posts: 32
  • Thank you received: 1
  • Hikashop Business
13 years 3 months ago #4959

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 or Create an account to join the conversation.

  • Posts: 81597
  • Thank you received: 13080
  • MODERATOR
13 years 3 months ago #4962

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:

if(!empty($this->element->product_id) && isset($this->row->product_weight) && bccomp($this->row->product_weight,0,3)){
by
if(isset($this->row->product_weight) && bccomp($this->row->product_weight,0,3)){
So that it will display on the listings as well.

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

  • Posts: 32
  • Thank you received: 1
  • Hikashop Business
13 years 3 months ago #4973

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:

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
if($this->params->get('show_price_weight')){
though that sort of hinders the admin screen fucntion I guess

Last edit: 13 years 3 months ago by hkingman.

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

  • Posts: 81597
  • Thank you received: 13080
  • MODERATOR
13 years 3 months ago #4975

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.

  • Posts: 32
  • Thank you received: 1
  • Hikashop Business
13 years 3 months ago #4983

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:

<?php echo JHTML::_('select.booleanlist', 'config[show_price_weight]' , '',$this->config->get('show_price_weight')); ?>
to
<?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.

  • Posts: 81597
  • Thank you received: 13080
  • MODERATOR
13 years 3 months ago #4985

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.063 seconds
Powered by Kunena Forum