Discount with maximum clients?

  • Posts: 69
  • Thank you received: 5
2 years 10 months ago #338369

-- url of the page with the problem -- : politikchronist.org
-- HikaShop version -- : 4.4.5
-- Joomla version -- : 3.10.3

I found out, that one type of discount is only possible to give to a limited number of clients. In order to give the same discount to more clients, one need to open a copy of the first discount and start with empty customer-list again.
Is this the normal habit?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 10 months ago #338373

Hi,

For performance, the columns of tables in MySQL can be restricted to some type.
For example if you use the type "integer" in a column, you can only use a number in it.
Searching for a number is several orders of magnitude faster that searching for text.
Similarly, by default, the discount_user_id column of the hikashop_discount table uses the "varchar(255)" type, which means that you can only have 255 characters in it.
Since the number of characters is reduced, you can only enter a couple of users in the corresponding setting until you reach the 255 characters limit.
However, MySQL will be able to process the queries much faster than if the type was "text" or "longtext" which allow for more characters.
So to allow more users to be selected there, you can just change the type of the column to "text" via your PHPMyAdmin. Some of the queries will be a bit slower, but for most stores, it won't be noticeable.

However, I don't think this is necessary. What you could do instead is create a specific user group for that discount, restrict the discount to this user group instead of restricting it to users, and then add the user group to the different users for which you want the discount to be usable. This way, you can have as many users as you want for a discount and I don't see any disadvantage of doing it like that.

The following user(s) said Thank You: politikchronist

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

Time to create page: 0.054 seconds
Powered by Kunena Forum