I am making some changes to the uc_affiliate module (Drupal 5 setup with latest Ubercart) and I've noticed that when the module is enabled, I can't remove from cart the products I added.
Little digging showed me why:
Using hook_cart_item we add the affiliate field to the data array, so we get $item->data['affiliate'].
Hook_cart_item is not called when adding products to the cart, so it doesn't get saved in data (uc_cart_products table), but when the product is to be removed from the cart (cart update), the whole data (with the affiliate field) is passed to uc_cart_remove_item() in uc_cart, so the removal fails (uc_cart_remove_item uses a SQL query that compairs the passed in $data and the one in the DB. One has the affiliate field, the other doesn't).
Should it be this way (am I missing something), or is this a bug?
How to avoid this, should I say: unpleasant, behaviour?
Thanks!




Joined: 08/07/2008