He is how I am trying to use node checkout. The site is sales site selling suits. Currently the user will add a suit to their cart and it will redirect them to create a "profile" node type via node checkout. The whole process works great.

What we want however is when they add the suit to the cart, we would like to have them either pick from a list of profiles they have already created or create a new one. My initial goal was to just form alter one of the forms with a select list of created profile nodes from the user and then hook that node into UCNC instead of creating a new one, but after looking at the node checkout schema I see this couldn't work

The uc_node_checkout_order_products table has to fields, nid and order_product_id with a primary key on the nid, which is only allowing that individual node to be associated with a single product in an order. Now I'm not a huge module developer and don't know the implications, but it seems like just adding an id field would allow for nodes to be associated with multiple products in orders.

Is what I'm asking possible and on the roadmap eventually or should I be looking for a new way to accomplish what I need to do?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aidanlis’s picture

Status: Active » Postponed

It could be done, but it's not supported at the moment.

stewart.adam’s picture

Assigned: Unassigned » stewart.adam
Status: Postponed » Needs work
FileSize
2.39 KB

Attached patch gets us half-way there. It removes the primary key on the uc_node_checkout_order_products table, allowing us to store multiple rows associating order products to a NID. This has the implication that the token support for the associated product information will reference whichever order_product_id the database happens to return first. In theory however, if you're re-ordering the node then the associated Ubercart product should remain the same anyways so I don't see much point in changing the code logic there.

It also adds a new function uc_node_checkout_lookup_order_product($nid, $order_id) which will return the corresponding order_product_id for the node checkout governed (i.e. user-created) node $nid on order $order_id.

uc_node_checkout_save_product_association() no longer attempts to update a association, but will insert a new one every time. No other code changes are needed because whenever this function was called, it was always to insert anyways.

This doesn't have any UI integration, so there's no magic one-click button to add a node checkout node back into your card. But with Views and a small amount of custom coding you can do this very easily. I'll update the patch with this code later when I have the time to get to it.