Show product price by different units!

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
6 years 11 months ago #270248

Hi,

You can't restrict custom fields to products and to categories are the same time. If you do. This means that the custom field will only display for the products selected if they are in these categories. So it not logical for you to do that since then you can simply select the products you want.
So in your case, you want to remove the selected products to only have categories selected in your custom field and it should work like you want.

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

  • Posts: 117
  • Thank you received: 6
4 years 1 month ago #316691

This topic is almost 5 years old but helpfull.

We also sell products in different sorts of units and I managed to get the right display... with the 1st price.

But: how to display the right unit in the other prices?
[see attached screenshot]

plz help with code

Greetz,

Attachments:
Last edit: 4 years 1 month ago by Formidog.

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
4 years 1 month ago #316693

Hi,

In the product / listing_price.php view file, you'll fine this line:

echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
You could change it to :
if(isset($this->element->main)) echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf($this->row->salemethod.'_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
elseif(isset($this->row)) echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf($this->row->salemethod.'_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
else echo '<span class="hikashop_product_price_per_unit_x">'.JText::sprintf($this->row->salemethod.'_AT_LEAST_X_BOUGHT',$price->price_min_quantity).'</span>';
And then you can add your translation overrides like:
PER_PACK_AT_LEAST_X_BOUGHT="per pack for buying at least %s"
where you would change "per pack" and "PER_PACK" based on what you have in your salemethod custom product field.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum