flexi cart - A comprehensive shopping cart library for CodeIgniter |
[eluser]haseydesign[/eluser]
Hey again koichirose, What I would do in the scenario you have outlined is as follows. 1. Before you call the save_order() function, insert an empty record into your custom order_store table using CI's standard SQL functions. 2. Get the insert_id for the new table row. 3. Call the save_order() function and pass the insert_id to the save_order() functions $custom_item_data parameter - this will save the id of your order_store table to each item row in the order_details table. 4. When the save_order() function has saved the data, use the order_number() function to get the unique id (The order number) of the order_summary table. 5. Update your custom order_store table with the order_number value. This should mean that your custom order_store table now has the unique id of the order_summary table, and the multiple newly added rows in the order_details will have the unique id of your order_store table. Here's a rough example (Not tested) Code: // Insert record to custom order_store table. Function reference: cart_items() - http://haseydesign.com/flexi-cart/user_g...cart_items save_order() - http://haseydesign.com/flexi-cart/user_g...save_order order_number() - http://haseydesign.com/flexi-cart/user_g...der_number --- Without knowing your full scenario, I will point out that it may be better/easier to just associate the order_store_id with the single row in the order_summary table, rather than for each order_details row. Each row within the order_details table could then get the order_store it is assoicated to by using the parent order_summary table. But hey, thats just a suggestion, it may not be suitable for what you're doing. |
Welcome Guest, Not a member yet? Register Sign In |