Apply Discount to Product in Multiple Categories

  • Posts: 8
  • Thank you received: 0
7 years 4 months ago #274147

-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.3
-- PHP version -- : 5.7
-- Browser(s) name and version -- : Google Chrome Version 59.0.3071.115 (Official Build) (64-bit)

I have a product in multiple categories but need to apply a discount to the product only when viewing it in one specific category.

Category 1: discount
Category 2: no discount
Category 3: no discount

One product is in all three categories.

The discount is currently applied to the product in all three categories even though I selected one specific category for the discount.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
7 years 4 months ago #274168

Hi,

There is no such option. The prices and discounts for a product are loaded the same way regardless from where you access the product.
So when you restrict a discount to a category, the discount will apply to the product as long as it is attached to that category.

If you want to change that behavior, that would require some custom development. It would require changing the getPrices and getListingPrices functions of the file administrator/components/com_hikashop/classes/currency.php in order to load the discounts with custom restrictions, and it would also require modifying the product listing in order to pass the category in the URL when access the product page, or when clicking on the add to cart button. It would also require a custom field of the table "item" to be able to store the category from where the product was accessed in the cart and in the order so that you can store the data in that field to be able to use it in the getPrices and getListingPrices functions.
So it requires quite a bit of knowledge to be able to do that.

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

  • Posts: 8
  • Thank you received: 0
7 years 4 months ago #274215

I understand and thanks for the quick reply.

One solution I found is to have a duplicate product but this does not work well if you need to have inventory.

The other solution would be to use some sort of coupon that is entered by the customer.

I'm open to other solutions if anyone has one.

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

Time to create page: 0.056 seconds
Powered by Kunena Forum