Coupon for only in stock items

  • Posts: 56
  • Thank you received: 2
10 months 4 days ago #284502

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.6.25
-- Browser(s) name and version -- : Firefox Dev edition
-- Error-message(debug-mod must be tuned on) -- : n.a

HI Hikacrew !!

OK my problem is quite unique as this company manufactures their own clothing, from beginning to end.
So they make the materials (latex sheeting) then cut it up and make clothing out of it.

Now, they do have quite a few clothing items in stock (over a hundred), but it's just impossible to have everything item of clothing they can make in stock (too many styles and colors), so if they don't have it, they will make it - although it can take 4~6 weeks.

So Boxing day is coming and they want to make a coupons that will give a certain percentage off all "In stock" items ONLY.

Now I have read this post , and so that has show me how to fix the view in .../product/quantity.php. So that's all good.
(see attachments)
So I have set the "out of stock" value to 1000 (anything over 1000 means "in stock", as specified in that post).

So I guess I have alter the coupon code and throw in basic conditional statement/ or create a function that I could then add to the coupon function. Soething roughly a long these lines:

If quantity > 1000
   then apply coupon
   don't apply coupon ! (break;)
(sorry haven't looked up the variables yet)

Now my only problem is :
Where would i add such a statement? OR in which file does the code reside?

I know the best way would be to add a new field/params to the coupon/discount section of Hikashop...
But as I'm running out of time quick, I thought a core hack would do for now.

Any help or hint will do.

Thx in advance.



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

  • Posts: 63584
  • Thank you received: 9158
10 months 4 days ago #284507


As a quick fix, you can add that in the check function of the file administrator/components/com_hikashop/classes/discount.php

Better would be the develop a small plugin of the group "hikashop" and implement the onBeforeCouponCheck or onAfterCouponCheck triggers to add your condition thanks to the $do parameter in them:

Last Edit: 10 months 4 days ago by nicolas.

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

Time to create page: 0.076 seconds
Powered by Kunena Forum