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.
I'm only implementing anonymous checkout, all works fine. If an anonymous user creates a checkout node, then removes their item from the cart, the checkout node is not deleted. I do have checked "Delete nodes whose creators remove the associated product from their cart". Should this delete the node (with blank status at this point)?
I do have my CA php written so when the same setup successfully goes through checkout, the status is correctly changed to "Completed".
Comments
Comment #1
echoz CreditAttribution: echoz commentedNow I see that this setting works for logged in customers, which ours are not. I'd like to find a way I can have checkout nodes with a field_status of null, be deleted after a period of time. Ideas?
Comment #2
scothiam CreditAttribution: scothiam commentedsubscribing
Comment #3
manuel.adanI also found a similar issue when automatic (cron) cleaning of cart, if anonymous, or even authenticated cart duration is reached. Cart is cleared, but nodes remains then as orphans.
Comment #4
josi123 CreditAttribution: josi123 commentedSubscribing. Is there any support for this module? So many open issues.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedsubscribing
Comment #6
scothiam CreditAttribution: scothiam commentedI've been trying to work around this with Product Trigges http://drupal.org/project/uc_product_triggers
Basically, with this module, you get more triggers to use in CA, like "Trigger: Product node is removed from cart", so we can then add some custom php code to delete the node.
that's were I am now stuck :(
I'm guessing the code would look something like this http://drupal.org/node/376384#comment-2032176 (getting the id of the node from that has just been removed from the cart, with node_load?) except with node_delete instead of node_save being the end result.
Again, more of a workaround than a fix, let me know if you can help or have other ideas.
cheers,
Comment #7
scothiam CreditAttribution: scothiam commentedI've got it working. ugh. Just needed to adjust permissions so users can delete there 'own' node of this type. no work around required (as I mentioned in #6).
Testing to see if this will work when a cart expires, but after seeing it work when a user empties the cart, I'm hopeful.
UPDATE: does not delete the node when the cart expires. Does remove the item, does not delete the node. ugh...
Another thought, I don't think you can give anon users the ability to delete there 'own' nodes... any anon user could then delete any other anon users nodes... just read that somewhere, makes sense no?
Comment #8
hihappycats CreditAttribution: hihappycats commentedsubscribing
Comment #9
julient CreditAttribution: julient commentedHaving the same issue.
Subscribing.
Comment #10
5t4rdu5t CreditAttribution: 5t4rdu5t commentedI've confirmed that the problem for nodes not being deleted when users remove items from their carts is because you need to give them permissions to delete their own (node checkout) related nodes.
About the problem when the cart expires and gets emptied by cron, I've written a fix in http://drupal.org/node/654916#comment-2737854 you can try out.
Comment #11
echoz CreditAttribution: echoz commented@Libriana, Thank you! Giving anonymous users permission to delete their own checkout nodes works, it must use the session id.
Comment #12
jumpfightgo CreditAttribution: jumpfightgo commentedIf the following link is checked, users without the "edit any node" can NOT delete their nodes: "Redirect customers to their cart after adding or editing a node checkout governed node."
The problem is that this settings adds $form['#redirect'] to the node forms but that overrides the delete button, and looking through the Form API I can't figure out how you can get around that :(
I also unchecked "Redirect customers to their cart when they try to view a node governed by node checkout" because it's not fully functional either - when you try to view the node you just created you get an "access denied" page.
The only solution I can find is to set "cart" as the 403 page for drupal. That redirects anyone trying to view a node_checkout node whether they just edited the node or if they are just trying to view the node by itself. Certainly not ideal for obvious reasons but it works for my site.
Does anyone have any better ideas for working with form redirects more appropriately? The module settings are just plain broken.
Comment #13
fletch11 CreditAttribution: fletch11 commented+1
Comment #14
baff CreditAttribution: baff commentedsubscribe
Comment #15
uniquename CreditAttribution: uniquename commentedjust some information in the description of the setting uc_node_checkout_delete_nodes would be helpfull. maybe something like
Comment #16
aidanlis CreditAttribution: aidanlis commentedAdded the extra documentation as suggested by uniquename
Comment #17
baff CreditAttribution: baff commentedThanks
Comment #19
baff CreditAttribution: baff commentedWould be nice if you could write directely on
admin/store/settings/node-checkout/settings
section "Delete nodes whose creators remove the associated product from their cart."
that on has to grant "delete own content type" permission to get it working