So, I noticed that coupons don't really go by category, like is sort of implied by the interface. What it actually does is when you click the category control on the coupon code page, it adds all the products from that category that exist at the time into the product list and stores that in a "coupon_product" table in the database. There is no internal processing of categories at all.
The problem with this is that any new products added after the code won't be part of that coupon code, even if they are in the correct category. You'd have to add you product, then go back and re-add the category to the coupon code to "refresh" it. This is a non-starter for me, and must be fixed before I can use opencart, so I'm going to give a shot at writing a vqmod to fix it tonite. Wish me luck. I'll record progress here.
So, here's a list of things that likely should be changed:
If I change the input name to something that doesn't exist, it will sufficiently break the function. I'm just going to have it look for an array called "junk". This step was easy.
Next step is to make it remember what was selected. For that, I'm going to have to make a schema change in the db, add a new table (coupon_category) and add the contents of the control to it. I'll look at how the product scrollbox gets populated and just copy that code.
- 1. Clicking on categories should not populate the products list on the coupon page
2. loading the page should remember what was clicked before
3. referencing the coupon code should refer to the product list AND any products associated with the selected category.
Code: Select all
$('input[name=\'category[]\']').bind('change', function() {
Next step is to make it remember what was selected. For that, I'm going to have to make a schema change in the db, add a new table (coupon_category) and add the contents of the control to it. I'll look at how the product scrollbox gets populated and just copy that code.
Done with making the ui elements work as expected. The category selector is actually more closely related to the product page's category selector than the coupon page's product selector on the front end, but more like the product selector on the backend. Pretty easy to mod, just took me a while to find all the pieces. Ok, so now that the admin pages will let me configure it, I need to figure out how to make it get applied when checking out. I have an idea for this already, or I wouldn't have even started, I am pretty confident.
So I wrote a mod for "catalog/model/checkout/coupon.php", and it is working. Yay! I can't find another place where this code would be used, but if anybody knows any different, I'd love to hear it. It is definitely calculating correctly on the checkout page though. I have checked a category in my coupon code admin ui, and an item in that category reflects the code. awesome. This was easier than I thought.
And, since I don't think this thing is worth ten bucks (the minimum you can charge on the extensions web site on opencart.com, wish I could charge a dollar, beer money), here it is for free:
http://www.opencart.com/index.php?route ... on_id=5166
http://www.opencart.com/index.php?route ... on_id=5166
Hi mondokat,
Awesome work!!
I am facing an issue with coupons, i know it might not be the right place to post this, but i have already started a thread on this with no response! http://forum.opencart.com/viewtopic.php?f=24&t=54253
When I select a category, ALL the products from ALL the categories are getting inserted in the products section...whereas only products from that particular category should be added.
I check my files with OC original ones but no difference...!
I tried with your module to see if this issue could get solved..but nothing! Its working the same way with the above issue.
Could you please suggest something?
Really appreciate any help. Please reply
Thanks
Awesome work!!
I am facing an issue with coupons, i know it might not be the right place to post this, but i have already started a thread on this with no response! http://forum.opencart.com/viewtopic.php?f=24&t=54253
When I select a category, ALL the products from ALL the categories are getting inserted in the products section...whereas only products from that particular category should be added.
I check my files with OC original ones but no difference...!
I tried with your module to see if this issue could get solved..but nothing! Its working the same way with the above issue.
Could you please suggest something?
Really appreciate any help. Please reply
Thanks
WoW! mondokat!!! really awesome work, thanks for your efforts!
This is a great addition to the shop and very much needed!
Going to download and install it right now.
Voting for "mod of the month" if there were such a thing!!
Edit: did anyone get it to work in v1.5.1? I installed it but can't seem to get it to work.
At least I can't see anything different in my coupon section.
This is a great addition to the shop and very much needed!
Going to download and install it right now.
Voting for "mod of the month" if there were such a thing!!
Edit: did anyone get it to work in v1.5.1? I installed it but can't seem to get it to work.
At least I can't see anything different in my coupon section.
Who is online
Users browsing this forum: No registered users and 48 guests