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.
Has anyone ever attempted to notify an admin that a completed order contains an item from a wishlist?
It seems it may be fairly easy to add an entry to the order comments or add some text to the admin order notification email, but I'm not sure what is available to pull from.
Anyone have thoughts or experience?
Comments
Comment #1
naveenvalechaUse hook_uc_checkout_complete($order, $account) in your custom module to send email to admin.
Code of the custom module foobar is like :
We will soon add this functionality in module.
For more information about hook_uc_checkout_complete see here http://drupalcontrib.org/api/drupal/contributions%21ubercart%21uc_cart%2...
Comment #2
Poieo CreditAttribution: Poieo commentedRather than adding this to the module, would it be easier to add a rule to check if a product is from a registry?
Comment #3
Poieo CreditAttribution: Poieo commentedWhat I'd really like to do is add the wishlist name to the admin notification. I know the below is wrong, but I can't seem to figure out how to pull the wishlist into the uc-order--admin.tpl template.
Comment #4
jaykainthola CreditAttribution: jaykainthola commentedHi,
I have updated latest Dev version to add rules to check if order contain wishlist product. You need to create rules for the order and there will be condition for the wishlist product in rules.
Thanks
Comment #5
naveenvalechaUse the latest dev release.
Comment #6
Poieo CreditAttribution: Poieo commentedThank you! Would it be possible to make a wishlist title token available? Something like [order:wishlist:title]?
Comment #7
Poieo CreditAttribution: Poieo commentedI've been trying this out and I think the condition that an order contains a wishlist product triggers if the ordered product is in any wishlist. Not, which I think should be the correct method, if the order contains a product that was added to the cart from a wishlist.
In other words, the rule gets triggered when an order contains a product that is listed in any wishlist whether the buyer purchased it from an actual wishlist or not.
Comment #8
berenddeboer CreditAttribution: berenddeboer commentedThis is a patch which properly checks if an order has products ordered from a wish list. Works both for the new views and the existing wish list display.
Does not implement [order:wishlist:title]. Please create a new feature request for this.
Comment #9
naveenvalechaComment #10
Poieo CreditAttribution: Poieo commentedHere is a patch against the latest dev. However, I wasn't sure how to handle this:
That section has changed in the latest dev to this:
However, this checks for uc_wishlist_out_of_stock as FALSE. This doesn't validate if stock is not enabled and prevents the add to wishlist button from being added. We probably need to run a check to see if stock is enabled first.
Aside from that, the purpose of sending the notification email via rules is working great.
Comment #11
Poieo CreditAttribution: Poieo commentedAdded a new issue for the wishlist title token: #2375519: Make Wishlist Tokens Available to Rules
Comment #12
berenddeboer CreditAttribution: berenddeboer commentedPoieo, the proper stock check fix is attached to issue #728550: Disable products on wishlist that are out of stock.
Comment #13
berenddeboer CreditAttribution: berenddeboer commentedThis patch needs #728550: Disable products on wishlist that are out of stock applied first. Then reroll should apply fine I hope. Juggling a lot of patches, so hope I got the order right.
Comment #15
naveenvalechaAdded parent issue.
Comment #16
berenddeboer CreditAttribution: berenddeboer commentedThis is a reroll of the previous patch. Does two things:
The latter is unrelated to number one in some sense but have put it in this patch, as it allows people to create simple wish lists views, and those doing that are probably also interested to keep track of what products where from the wish list.
But happy to split patch if needed.
Comment #17
naveenvalechaRegarding point 2.
I think we should not provide a views handler for the same.Because we are adding the wishlist button to the add to cart form so it seems not right to me.
Comment #18
jaykainthola CreditAttribution: jaykainthola commented@naveen, yes you are right.. We are not using views handler to create a simple add wishlist button.
Comment #19
berenddeboer CreditAttribution: berenddeboer commentedNote that the views handler is optional: it's NOT used. It's an extra feature to allow people who use views to show their wish list. So orthogonal to this issue, and I'm happy to split the patch into two if it's confusing.
Comment #20
berenddeboer CreditAttribution: berenddeboer commentedReroll of patch against latest dev.
Comment #21
Poieo CreditAttribution: Poieo commentedThanks berenddeboer. The latest patch seems to be missing the following from the original and doesn't seem to work without it: