Hi,

I use this module a lot but I found a missing feature. What about a checkbox to invert the Filter by role??
This way, I can provide a discount the first time a visitor shops in our site, but then, as they get a assigned the role "shopper", I cannot filter using this role. What we need it to be able to say "apply to users NOT having this role".

What do you think?

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davidburns’s picture

Status: Active » Postponed (maintainer needs more info)

Are your first time visitors logged in?

If not, then you can apply the discount to role -> anonymous.

drubage’s picture

I also could use this feature. We have a role for "wholesale" users on our site. Obviously they are also "authenticated users". We'd like a coupon that can only be used by retail customers and NOT wholesale customers. Is there a way to say "NOT" for the "Qualification by Role(s)." filter? In other words, we'd want to say that this coupon applies to all roles EXCEPT "wholesale". Let me know, thanks!

stockliasteroid’s picture

I second this. I also have the wholesaler situation, and I'd like discounts to only apply to NOT wholesalers.

stockliasteroid’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
8.75 KB

Here's an initial stab at this. Please take a look at it and let me know what you all think...

bruiseviolet’s picture

I agree. We are currently having the same issue. The website this module is on, has many different user accounts. The discount is for all retail customers- however not for customers who get discounts already (like wholesalers). Unfortunately because we have to do the discount for "authenticated users"- since anyone signed up as "wholesale" is by default an authenticated user (and you can't uncheck that) even without having "Wholesale" checked for the discount- wholesale accounts are still able to get the discount.

Obviously in the small print and terms it clearly states wholesale orders are not valid for the discounts- we still get wholesalers who apply the discount, and then we are stuck with the not so fun task of calling them up and informing them that they can only get the discount if they pay full retail for the products. Not fun and turning into a real pain in the butt- as the website is exploding and monthly discounts and promotions for retail customers is a huge driving force behind their marketing.

Would love if there was a reverse- sort of like a conditional action- where even if they are marked "authenticated" as long as they are also checked "wholesale' it WILL NOT allow the discount.

stockliasteroid’s picture

The patch above basically provides for that. You can have a discount require some roles, and disallow others. So you can have a discount apply only to those who don't have the wholesale role... Give it a test and let me know how it works for you.

bruiseviolet’s picture

Sorry, completely didn't see your patch. (Pregnancy brain). I will install it tonight and I'll be able to let you know how it's working within 24 hours or less. LOL Thanks!

pfrilling’s picture

I applied the patch in #4 and it appears to be working correctly for me.

kostajh’s picture

Status: Needs review » Reviewed & tested by the community

This worked great for me. Based on #4 and #8, and my testing I'm going to mark this as RBTC.

hockey2112’s picture

When I apply the patch, I receive this error message:

user warning: Unknown column 'd.role_filter_not' in 'where clause' query: SELECT DISTINCT d.* FROM uc_discounts d LEFT JOIN uc_discounts_products dp ON d.discount_id=dp.discount_id AND dp.grouping = 1 LEFT JOIN uc_discounts_terms dt ON d.discount_id=dt.discount_id AND dt.grouping = 1 LEFT JOIN uc_discounts_skus ds ON d.discount_id=ds.discount_id AND ds.grouping = 1 LEFT JOIN uc_discounts_classes dcl ON d.discount_id=dcl.discount_id AND dcl.grouping = 1 LEFT JOIN uc_discounts_authors dau ON d.discount_id=dau.discount_id AND dau.grouping = 1 WHERE (d.requires_code=0) AND (d.has_role_filter=0 OR (d.role_filter_not = 0 AND d.discount_id IN(SELECT dr.discount_id FROM uc_discounts_roles dr LEFT JOIN users_roles ur ON (dr.role_id=ur.rid AND ur.uid=1931) WHERE ur.uid IS NOT NULL OR dr.role_id=-1 OR dr.role_id=2)) OR (d.role_filter_not = 1 AND d.discount_id NOT IN(SELECT dr.discount_id FROM uc_discounts_roles dr LEFT JOIN users_roles ur ON (dr.role_id=ur.rid AND ur.uid=1931) WHERE ur.uid IS NOT NULL OR dr.role_id=-1 OR dr.role_id=2))) AND (d.filter_type<>1 OR dp.product_id IN(8,-1)) AND (d.filter_type<>2 OR dt.term_id IN(-1,6,36,39,1)) AND (d.filter_type<>3 OR ds.sku IN('','JBKS006')) AND (d.filter_type<>4 OR dcl.class IN('','product')) AND (d.filter_type<>5 OR dau.author_id IN('-1','1')) AND (d.has_activation=0 OR d.activates_on<1371513313) AND (d.has_expiration=0 OR d.expiration>1371513313) AND (d.is_active=1) ORDER BY weight in /home/mysite/public_html/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1348.

Any idea how I can fix it?

hockey2112’s picture

I ended up fixing the issue by manually adding the "role_filter_not" column to the uc_discounts table.