If I understand correctly, the uc_paypernode_products has the quantity of nodes you can create after you purchase the PPN-enabled node.

The problem is that during the order complete action, we're using that number regardless of the amount of products the user bought.

So, your Shopping cart says you are buying, say, 12 items, but then you can only create 1 item (or whatever number you set during the creation of that Pay-Per-Node feature).

This is because we are using $paypernode->qty while totally ignoring $product->qty, in paypernode_user_update() on line 78 of uc_paypernode.module:

function paypernode_action_order_completed($order, $settings) {  
    // Loop through all the products on the order.  
    foreach ($order->products as $product) {    
        // Look for any paypernode features assigned to the product.    
        $query = db_query("SELECT * FROM {uc_paypernode_products} WHERE nid = %d", $product->nid);    
        while ($paypernode = db_fetch_object($query)) {      
            paypernode_user_update($order->uid, $paypernode->type, $paypernode->qty);      
            $comment = t('Customer now can create %qty of type %type.', array('%qty' => $paypernode->qty, '%type' => $paypernode->type));
            uc_order_comment_save($order->order_id, $order->uid, $comment);
        }
     }
}

The amount of nodes the user can create should instead be: PPN quantity * Product quantity (that the user had in his Shopping cart for that order).

So, the code should be:

paypernode_user_update($order->uid, $paypernode->type, $product->qty * $paypernode->qty);
CommentFileSizeAuthor
#1 paypernode-[759826].patch1.23 KBAlexander N
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alexander N’s picture

Status: Active » Needs review
FileSize
1.23 KB

This should work.

maurizio.ganovelli’s picture

Assigned: Unassigned » maurizio.ganovelli

Hello Alexander N,

forgive me for delay, i was out for easter vacation. Thanks for the patch, i'll test & commit it to repository as soon as possible!

Bye!

maurizio.ganovelli’s picture

Status: Needs review » Fixed

Hi Alexander N,

I tested your patch and works like a charm, so I committed it to repository. Thank you for this job!

Bye!

Status: Fixed » Closed (fixed)

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