[Ubercart D6] Migrate cart

Created on 26 June 2017, over 7 years ago
Updated 14 May 2023, over 1 year ago

Problem/Motivation

Ubercart has a specific table for carts whereas in D8, when a product is added to the cart a new order is made. So, the cart data gets migrated to orders.

In Ubercart, when something is added to the cart an entry is made in uc_cart_product. Then you click, 'checkout' fill in the details and then click 'review order'. At this point there is a row or rows in uc_cart_product and a row in uc_orders for the same transaction. The order has a status of 'in_checkout'. Then is 'submit order' is clicked, the entry or entries in uc_cart_product are removed and the order status changes to 'pending'. The point is that rows in the uc_cart_product may or may not have an order, and if so the order status is 'in_checkout'.

The existing order migration will migrate all orders, including those with a status of 'in_checkout'. So this migration should migrate cart entries that do not have an associated order with a status of 'in_checkout'.

And this is easy when uid>0. But it does assume that there would only ever be one order with a status of 'in_checkout'. If there can be more that one order 'in_checkout' for a given uid then this won't work. Can there be more that one order per uid with a status of 'in_checkout'? I suspect so, since I've managed to do just that in testing, and not as admin.

If these are anonymous orders there isn't a way to check the order table. The uid in the order table is 0 but the id in the cart table is a hashed session token.

Proposed resolution

Ideas?

Remaining tasks

User interface changes

N/A

API changes

N/A

Data model changes

N/A

πŸ“Œ Task
Status

Active

Version

2.0

Component

Ubercart D6

Created by

πŸ‡³πŸ‡ΏNew Zealand quietone

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States mazz Newport Beach, CA

    IMO - in_checkout orders should just be skipped, in Ubercart any in_checkout orders without entries in uc_cart_products are essentially "lost" to anybody except admins. There's no way for a customer to really complete a checkout IIRC with just an in_checkout order...

    Even the review page in Ubercart pulls product data from the cart, and just prior to the review page the order product data is dropped and replaced by the cart contents with every submission. In fact as a rule of thumb you could say the order is write only during checkout, it's never really read from as a data source to generate any of the steps.

    All that to say, if uc_cart_products is migrated, one can safely drop all the in_checkout orders without losing anything of value, there's really no reason to migrate both.

Production build 0.71.5 2024