Limit Bug

  • Posts: 7
  • Thank you received: 0
6 years 11 months ago #284621

-- HikaShop version -- : 3.2.1
-- Joomla version -- : 3.6.5
-- PHP version -- : 7.0.22
-- Browser(s) name and version -- : Chrome 63.0.3239.84
-- Error-message(debug-mod must be tuned on) -- : N/A

I've encountered an issue with limits in HikaShop 3.2.1. When I have a quantity limit and leave the currency as the default value (Euros), the limit does not apply if the previous orders to which it should apply are in US dollars. Changing the currency to USD fixes the issue.

For reference, this is a quantity limit being applied to a category. The time period selected does not seem to affect the issue, though the limit in question on my site is quarterly. Using (or not using) start date/end date does not seem to affect the issue either. Selected order statuses are created, confirmed, shipped, and pending.

Thanks!
Ian

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 11 months ago #284626

Hi,

Could you provide:
- a screenshot of the settings of your limit
- a link to your shop
- precise instructions to reproduce the issue on your website
so that we can better understand the situation ?

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

  • Posts: 7
  • Thank you received: 0
6 years 11 months ago #284673

Link to shop: www.ncemsf.org/conference/2018-conferenc...ividual-registration (must have an account and be logged in to view).

Our shop is being used as a Conference registration system. Individuals should only be able to register once in each registration period. A quarterly limit was imposed to handle this, with a limit type of "Quantity," applied to the Conference Registration product category (which includes the three registration types--Early, Regular, and Late). Per the Limits tutorial (and what worked in the previous version of HikaShop we were using, which was 2.6.3), if we set the Period to Quarterly, Type to Quantity, Quantity to One, Category to the appropriate product Category, and order status to "Created," "Confirmed," and "Shipped," that was sufficient to prevent duplicate registrations.

After upgrading to 3.2.1, the limit stopped functioning. When I looked at the query to get past orders in administrator/components/com_hikashop/classes/limit.php, I saw that it was including currency as part of the WHERE clause. Reexamining the Limit settings, I saw that the Currency was set to EUR, even though our shop uses USD. Switching the currency to USD allowed the query to see past orders and apply the limit correctly.

A fix would either be to modify limit.php to not use currency in the WHERE clause unless the limit type is "Price" or update the directions on the Limits Tutorial to state that the currency is needed even if the Limit Type isn't "Price."

The current (functioning) limit settings are attached. The only difference with the non-functioning settings is the Currency Type.

Thanks!
Ian

Attachments:

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 11 months ago #284677

Hi,

Thank you for your feedback.
That is indeed a good point.
Try changing the code:

$limit_rules[$dl]['currency'][(int)$limiter->limit_currency_id ] = (int)$limiter->limit_currency_id;
to:
if($limiter->limit_type == 'price') {
				$limit_rules[$dl]['currency'][(int)$limiter->limit_currency_id ] = (int)$limiter->limit_currency_id;
			}
in the administrator/components/com_hikashop/classes/limit.php file. That should be enough to avoid that issue so that the limit's currency is only taken into account when the limit is in price mode.

The following user(s) said Thank You: ifeldman0

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

Time to create page: 0.047 seconds
Powered by Kunena Forum