Hi, thanks for this awesome module!!!

As the title says, I'm having a problem that nodes are not being deleted when a cart expires.

Is there any way to get this to work? Have you seen this before? I'm hoping i've just missed a setting somewhere...

Maybe I could use CA with some php code to achieve this for me?

All the best,

Comments

hihappycats’s picture

subscribing

julient’s picture

Same here, it's not working.
Have you found a work around you could share?

5t4rdu5t’s picture

I've made this fix for uc_node_checkout.module and seems to be working very good so far.

All you need to do is replace the current uc_node_checkout_cart_item function on line #660 with the code below:

/**
 * Implementation of UC hook_cart_item().
 */
function uc_node_checkout_cart_item($op, &$item) {
  switch ($op) {
    case 'load':
      // Load the entire related node into the item array for use in display.
      if (isset($item->data['node_checkout_nid']) && $node = node_load($item->data['node_checkout_nid'])) {
        $item->checkout_node = $node;
      }
      break;
    case 'remove':
      // Remove related node_checkout nodes when cart expires and cart gets emptied by cron.
      $data = unserialize($item->data);
      if(variable_get('cron_semaphore', FALSE) && isset($data['node_checkout_nid'])){
        node_delete($data['node_checkout_nid']);
      }
      break;
  }
}

Please test it on your end guys and post any feedback...

aidanlis’s picture

Status: Active » Fixed

This should be fixed by a documentation change, e.g. you need to give permission to the user to delete the node.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.