Multiple discounts and how the logic works

  • Posts: 153
  • Thank you received: 7
  • Hikashop Business
11 years 3 months ago #119611

-- url of the page with the problem -- : www.wbcmaine.org/events/online-workshops...ss-start-up-planning
-- HikaShop version -- : 2.2.0
-- Joomla version -- : 2.5.14
-- PHP version -- : 5.3.27
-- Browser(s) name and version -- : Chrome 28.0.1500.95
-- Error-message(debug-mod must be tuned on) -- : None

This is mainly a question in how the logic of the discount system works when multiple discounts apply for a specific user and product. Here is the scenario. You have two different discounts. One discount is for 50%, is pointed to a category and all sub-categories, and is tied to Joomla user group "Group A". The other discount is for 100%, is pointed to the same category and all sub-categories, and is tied to Joomla user group "Group B".

I see it working fine when the user is a member of only one of those two groups. What happens though when a user is a member of both groups? What is the logic happening in the discount of HikaShop system for that?

What I am seeing is that the 50% discount is being applied, not the 100%. I would think it would give the greatest discount possible.

Just hoping you could explain what HikaShop is doing and if there is a way I can adjust that.

Thank you for any insight you can give.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 3 months ago #119667

Hi,

Normally it takes the bigger discount available in such case.
I'm thinking that it might be because of the sorting which is done on the percentage and that when you do a sort between the string '100' and '50', 100 is actually lower than 50 as it starts with a 1 and 50 with a 5.

Try to change the code:
$value = (int)$discount->discount_flat_amount.'_'.$discount->discount_percent_amount;

to:
$value = (int)$discount->discount_flat_amount.'_'.sprintf('%09.4f',$discount->discount_percent_amount);

in the file administrator/components/com_hikashop/classes/currency.php
That will pad the percentage value with leading zeros if necessary so that the sorting is correct in any case

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

  • Posts: 153
  • Thank you received: 7
  • Hikashop Business
11 years 3 months ago #120154

Thank you. That fixed it. Will that change be worked into the next version? Or will I need to reapply it each time I upgrade?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 3 months ago #120169

It will be in next version since that's the way it should work.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum