I am not able to restrict the coupon to a specific product class. I have been able to restrict coupons by product, but not by the product class.

I have the following settings:
Discount: 15%
All matching product(s)
Minimum order total $250
Only count applicable products
Applicable product classes - Product taxable

The coupon as being added based on the total value of all the products not just the product class that I have selected.

Thanks!!

CommentFileSizeAuthor
#7 grab.gif85.82 KBjasonabc
#10 Untitled.png45.28 KBtparc

Comments

wodenx’s picture

Status: Active » Postponed (maintainer needs more info)

Can't reproduce. Do you have any other restrictions set on the coupon? Maybe if you can post a screenshot of the coupon settings page, the product settings page, and the cart to which you are applying the coupon, I can spot what's wrong. Also - what version of Ubercart are you running, and what other modules do you have installed?

hozt’s picture

I did have two products that I had setup to be excluded from the coupon. When I removed those two products coupons started to work correctly. Can I allow the coupon for a class of products and exclude specific products too?

Thanks for your help!

wodenx’s picture

Status: Postponed (maintainer needs more info) » Needs work

Not at present. However, the existing logic for combining product restrictions is a bit tortured, and I have been meaning to revisit it.

The way it works now:
Each restriction is tested in turn, in the following order:
Product
Taxonomy
SKU
Class
If any test results in a positive (e.g. your situation - you've listed some products to exclude and a product in the cart is not in the list), the remaining tests are pre-empted. In addition, if an "exclude" rule results in a negative (e.g. you've listed products to exclude, and a product in the cart is on that list) also pre-empts further tests. Note that this is not the case for an "include" rule that results in a negative (e.g you've listed products to include, and a product doesn't appear in that list). In this case, the program moves on to the next rule.

I'm not exactly sure what the correct replacement for this is, but I'm thinking it could be much simpler: if a product fails any test, it is excluded - otherwise it is included. That would allow your use-case. However, it would NOT allow either/or situations (e.g. a product appears in a list of products OR has a particular TERM) - however, I'm not sure how valuable that case would be.

I welcome your (or anyone's) input on this subject.

wodenx’s picture

Title: Applicable product classes issue » Improve logic of
Category: bug » task

Changing to a task, since the module works as advertised.

wodenx’s picture

Title: Improve logic of » Improve logic of combined coupon restrictions
jasonabc’s picture

got a 500 error when posting this. Have reposted below.

jasonabc’s picture

StatusFileSize
new85.82 KB

Hi Chris - posting here per your recommendations. I am not sure I agree this module works as designed (above). I have a very simple condition and it is not working.

To briefly surmise - I have a 25% code set up. I have set this to apply to one single taxonomy term on my store ("Galaxy"). There is one product in this category I do not want the code to apply to so I have entered this product into the "Applicable Products" section and set it to exempt any products listed.

It works fine - except if I also add a product to my cart from any other category, the code applies itself to that product as well. I can't see how this can be "by design".

I have attached a grab of the entire code add/edit screen.

Be grateful for any ideas/advice.

wodenx’s picture

I agree that it shouldn't work this way - but this is how it was originally designed, and I'm worried about changing this behavior since existing sites might depend on it.

As described in #3 - conditions are evaluated in a specific order, and positive matches can pre-empt later conditions. In your case, the product with a disallowed term is considered a match because it doesn't appear in the list of excluded products, so the taxonomy condition is never evaluated.

I definitely plan to change this behavior in D7 - and am hoping for input as to what the correct logic should be. I suppose it might be possible to provide new logic for D6 as an option (e.g. a "use legacy logic" checkbox on the coupon settings form which would default to checked - but at one point @longwave had expressed concern over the complexity such a setting would add, so I'm torn about it.

tparc’s picture

Issue summary: View changes

It would be nice to give the administrator the possibility of AND'ing product restrictions instead of the default OR. This would allow the restrictions to be more restrictive, such as when you'd like to narrow down applicable items by a particular product class and SKU. I don't think that there is a way to do this currently.
Please look into this if you can! I'm not sure if it would be very difficult to implement.
https://drupal.org/node/2196457

tparc’s picture

StatusFileSize
new45.28 KB