Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi
I want to be able to give a role based discount to products with a particular attribute.
In my case, I sell training courses with modules, and for a particular role, one of these modules is free.
Is there a way to do this that I can't see?
Thanks
Glenn
Comments
Comment #1
Anandyrh CreditAttribution: Anandyrh commentedHi
I am also using this module it's relay great module, i am able to give discounts to users in various ways,
But now i am not able to give a role based discount to products with a particular attribute.
Please Help!!!
Thanks & Regards,
AnAnD
Comment #2
glennnz CreditAttribution: glennnz commented@AnAnD
I struggled loooooong and hard to get stuff to work with role based discounts. I wrote code and couldn';t figure out why it wouldn't work. It turned out that another module was interfering with mine, see this thread, the offending module was one which displays tax inclusive prices; I can't find it now :(
My final code was:
This is obviously very specific to my needs, but hopefully you can find your way forward from here. You just need to examine the attributes array to find the $item->data['attributes'][x] that you need.
:-)
Glenn
Comment #3
Anandyrh CreditAttribution: Anandyrh commentedThanks glennnz, it's Great!
Please say me where do i need to use this code?
Thanks & Regards,
AnAnD
Comment #4
glennnz CreditAttribution: glennnz commented@Anandyrh
I put this in a custom module, but you could also use this code in the uc_custom_price module.
Glenn
Comment #5
Anandyrh CreditAttribution: Anandyrh commentedHi Glenn,
Thank you very much! :)
Let me try it out...
Regards,
AnAnD
Comment #6
Prodigy CreditAttribution: Prodigy commentedA godsend!
Also trying to have a different price for a products attributes based on user role. I saw you made your own module, and also mentioned use in the Uc_customprice module.
If using the custom price module, how does your code change?
Any other helpful hints & tips are greatly appreciated!
Comment #7
glennnz CreditAttribution: glennnz commented@Prodigy
If you use the custom price module, use the same if then statements.
e.g.:
Glenn