Thanks a bunch Ryan. Let me know the progress.
I've followed your advice in the original post. I've created a node with a module (then added CCK fields to it) for my template node. Once the user submits this node, i add it to my cart on node_insert() with uc_cart_add_item(). I use this instead of uc_cart_links as uc_cart links are not able to add $item->data. After the node is submitted and the item is added to the cart, i redirect the user to "cart" with node_form_submit() and it shows the user their current cart.
I'm using hook_form_alter to edit the cart's form (uc_cart_view_form) to display the image and title from my node instead of the products image and title. I've also edited the link on the "product title" to be "node/$NID/edit".
On my nodes update. If check and see if my node's nid matches any of the node ids which exist in my shopping cart. If it's the same node, I remove that entry from the cart, then re-add it with the edited details. I do this by storing the node reference in $item[data][mynid] and then iterating through the current carts items ( returned by uc_cart_get_contents() ) then using uc_cart_remove_item() to remove them, should a dupe exist.
This is getting rather hackish, but it could all be properly abstracted. At the moment I don't have time to do it myself, but it could be done. I'm interested to see what you've come up with. Posted this so that other know how they can go about doing something similar.
Issues I've run into code digging:
function hook_cart_display aka. uc_product_cart_display
This hook is not accessible from normal modules. This would be useful to change things like the link in the "product title". Also this hook doesn't allow one to change the product cart images.
in function uc_cart_view_form
$form['items'][$i]['image']['#value'] = uc_product_get_picture($display_item['nid']['#value'], 'cart');
imho. uc_product_get_picture should be changed to module_invoke("get_picture", $display_item['nid']['#value'], 'cart');
or even better module_invoke("get_picture", $display_item, 'cart');
This would allow someone who's created their own product module to determine how to display their image and use some logic against variables they've added to their "$items"



Joined: 07/16/2008