Display two product prices

  • Posts: 1025
  • Thank you received: 11
  • Hikashop Business
3 years 2 months ago #328522

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.24

Hello,

I have two prices in every product, the 1st price (wholesale price) is displayed only in Members group and the 2nd price is displayed in all groups (AND MEMBERS). The problem is, Members group can only see the wholesale price and not both.

Thank you in advance

Attachments:

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

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
3 years 2 months ago #328526

Hi,

Yes, that's normal.
Only one price is displayed since only one price is applicable to the product once in the cart.
I don't have an easy and clean solution here.
If you change the way the prices are loaded, first you have to do it in a core file of HikaShop, and second it will affect everywhere, not just the product page...
Try to change the line:

elementPrices[$price->price_min_quantity] = $price;
to:
elementPrices[] = $price;
in the file administrator/components/com_hikashop/classes/currency.php and it should then load both prices on the product page.
But you might have side effects eslewhere ( checkout / cart / listing ) so it requires proper testing.
Also, that change will be removed when you update your HikaShop so you'll have to reapply it.

The following user(s) said Thank You: verzevoul

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

  • Posts: 1025
  • Thank you received: 11
  • Hikashop Business
3 years 2 months ago #328558

Hi Nicolas!

I did that but it didn't work. Still seeing only one price.

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

  • Posts: 81378
  • Thank you received: 13037
  • MODERATOR
3 years 2 months ago #328563

Hi,

Ah yes, I think you also need to remove the access level filtering on the MySQL query loading the prices from the database:

if(!hikashop_isClient('administrator') || (int)$user_id > 0)
			hikashop_addACLFilters($filters, 'price_access', 'p', 2, false, (int)$user_id);
But then, you'll end up with all the prices all the time for all users, rendering the access level setting of the prices useless.
So it would need some PHP check to do the filtering on the access level, only when needed. You're looking at many hours of development ahead of you.

I don't think that doing it like that is a good solution.
A better solution I think would be to create a view override of product / listing_price.php and add custom code in there to run a MySQL query to load the other price when needed and then display it.

The following user(s) said Thank You: verzevoul

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

Time to create page: 0.059 seconds
Powered by Kunena Forum