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.
Have written a simple action which returns the original unit price of the product (in integer format) before any prior manipulations by other rules.
My use case was:
- Set the unit price of a class of products to a null value in a previous rule (this makes the products unavailable for purchase),
- Reset the prices to the original values in specific cases with follow-up rule(s).
However I couldn't find any way to get the original price before manipulation using the existing actions - all options I could find returned only the null value. This action gets the original unit price direct from the product entity associated with the line item.
Comment | File | Size | Author |
---|---|---|---|
#1 | add-action-get-original-price-2229509-1.patch | 1.22 KB | mjcarter |
Comments
Comment #1
mjcarter CreditAttribution: mjcarter commentedComment #2
MarcElbichon CreditAttribution: MarcElbichon commentedThanks for your contribution. I will integrate it in next release.
Are you agree to be maintainer of this feature ?
Comment #3
mjcarter CreditAttribution: mjcarter commentedYep, no worries, and thanks for all your work on this useful module
Comment #5
MarcElbichon CreditAttribution: MarcElbichon commentedGreat. I love when other people do the job for me !!!!
I've changed returned key as original_price rather than orig_price.
Your feature has been commited to dev
I've added you as co-maintainer.
Comment #6
mjcarter CreditAttribution: mjcarter commentedThanks a lot, I'm glad to be able to contribute. I agree that original_price is a better name for the variable. Seems it needs to be changed in the _info function too, the action no longer works for me as committed, reports the variable is undefined. Have committed a fix for that line -
Comment #7
MarcElbichon CreditAttribution: MarcElbichon commentedRight. Thanks for your first maintenance !!
Comment #8
MarcElbichon CreditAttribution: MarcElbichon commentedComment #9
joep.hendrix CreditAttribution: joep.hendrix commentedSorry for opening but this patch seems not be in the current dev version.
Please correct me if I am wrong.
Thanks for the good work.
Comment #10
Perignon CreditAttribution: Perignon commentedCorrect. It is not in the dev branch.
Comment #12
Perignon CreditAttribution: Perignon commentedNow it is!
Comment #14
Perignon CreditAttribution: Perignon commentedI did not check that patch before I committed it thoroughly and it did not follow the proper naming convention so I had to update it. It's committed to dev.
Comment #15
joep.hendrix CreditAttribution: joep.hendrix commentedGreat, thanks.