TIP: Exporting / Importing Orders, Order items

For those having problems exporting and importing orders and order items within cs-cart, here’s a simple tip that can save you a headache.





Getting problems with “Object not found” while trying to import Order items?



Me too.



EXPORT



cs-cart export Orders and Order items seperately.


  1. Orders - data in cscart_orders, cscart_order_data
  2. Order Items - data in cscart_order_details





    IMPORT


  3. Orders - importing Orders is pretty straightforward.
  4. Order Items - importing Order Items is not straightforward. I get ‘Object not found’.



    Why? Because there’s nothing in the cscart_order_details that matches the ‘item_id’ and ‘order_id’.



    How do you get around the problem? Glad you ask. Or maybe you didn’t? :rolleyes:



    SOLUTION



    Modify the file ‘schemas/exim/order_items.php’



    Change:


'#update_only' => true


to


'#update_only' => false





Now it doesn’t limit you to just updating products in the ‘cscart_order_details’ table. If there are no products associated with the order_id, it will insert a new item.