change per unit into per set, per length, per reel

  • Posts: 25
  • Thank you received: 8
  • Hikashop Multisite
4 years 3 months ago #323412

thank you very much, it's great it works perfectly!

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

  • Posts: 9
  • Thank you received: 2
  • Hikashop Business Hikashop Essential
2 years 1 month ago #346703

Nicolas,

Although this item is quite older, it still is applicable.
I am trying to do this and to get things going I used the exact directions you gave. But I still get the same result:

Warning: Undefined property: stdClass::$product_per in /Users/reijervangalen/Sites/localhost/mea-arte.nl/templates/cassiopeia/html/com_hikashop/product/listing_price.php on line 196

I did make the field and the column exists in the table hikashop_product.

My piece of code:

if($this->element->product_per == 'unit'|| $this->row->product_per == 'unit'){
echo $this->element->product_per;
}

What is wrong here?

And can I use an selection list as field in which I can select per product what unit it goes in?

It is not on line yet, because I am building on localhost, sorry.

Thanks in advance.

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

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
2 years 1 month ago #346851

Hi,

The issue is several folds.
The code should be like this:

if(!empty($this->element->product_per)) {
 echo $this->element->product_per;
}elseif(!empty($this->row->product_per)) {
 echo $this->row->product_per;
} else {
 echo JText::_('PER_UNIT');
}
That should work on the product details page as well as on the listings while still displaying the default "per unit" when nothing is selected in the custom product field in the product, without any error message.

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

  • Posts: 9
  • Thank you received: 2
  • Hikashop Business Hikashop Essential
2 years 4 weeks ago #346927

Thanks, Nicolas.

This was indeed the trick.
Now I can, when needed, add an extra selling unit in a dropdown custom field for any product and show this on the front end.

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

Time to create page: 0.067 seconds
Powered by Kunena Forum