magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Configurable product custom options not visible in order summary after order status change

Open ToshiroMifune opened this issue 10 years ago • 9 comments

Hi, There is one configurable product in our shop, which has two extra paid custom options set. Just after payment we can see the custom options for this product in order summary (status Pending payment). When status of the order changes (to cancel, processing, complete etc), the custom options disappear. It does not matter if status change is initialized by hand or as a result of payment confirmation. I understand that it can be expected result when the order is cancelled, but not for other status changes. After all we need those informations to process the order.

Magento ver. 2.0.7

Steps to reproduce

  1. In admin create Configurable Product
  2. Set 2 extra paid custom options for that product
  3. Buy that product with both custom options
  4. Open order summary in admin and check the custom options you ordered for the product
  5. Change order status and again verify custom options

Expected result

  1. Custom options for our product visible in order summary in admin
  2. When status of the order changes custom options are still visible

good

Actual result

  1. Custom options for our product visible in order summary in admin only until status of the order changes. After status change only basic product info is visible

notgood

ToshiroMifune avatar Jul 18 '16 09:07 ToshiroMifune

@ToshiroMifune thank you for your report. I created internal ticket MAGETWO-56694 and linked it to this issue.

veloraven avatar Aug 09 '16 11:08 veloraven

Actual problem is in Order Item Model, It serializes the product_options column data in sales_order_item table every time it saves so the array becomes string next time and Block fails in rendering it.

I created a small snippet to convert the additionally serialized data to serialized array info only for the existing orders, waiting for the fix.

amansrivastava avatar Aug 29 '16 06:08 amansrivastava

@amansrivastava I've noticed this issue as well. Would you be able to share what you did to address the issue?

joshuafredrickson avatar Nov 22 '16 01:11 joshuafredrickson

I'll share it shortly. Currently I don't have it with me.

amansrivastava avatar Nov 22 '16 06:11 amansrivastava

@joshuafredrickson, this might not be pretty but it was quick and fast with the expectation that this will be fixed on the next update, thus no need to go through the hassle of doing an override. (ie. this modifies core code).

On Magento/Sales/Model/Order/Item.php in getProductOptions()

Change

return is_string($data) ? unserialize($data) : $data;

To:

return is_string($data) ? ( is_string(unserialize($data)) ? unserialize(unserialize($data)) : $data ) : $data;

I'm basically just checking if the unserialized data is still a string or not and if so, unserialize it again. I know this is a very dirty way of doing this, but it's fast and there's bigger fish to fry :) It doesn't change the fact that the re-serialized data remains in the database though so whenever the fix is rolled out in Magento's core, a quick update of the product_options field in sales_order_item will be required.

tigerx7 avatar Nov 28 '16 00:11 tigerx7

@tigerx7 I love it! ;) :+1:

I actually had to unserialize it one more time for it to work on my end. Hopefully this issue will get a proper fix from Magento shortly, but this'll keep business moving along in the interim.

joshuafredrickson avatar Nov 28 '16 01:11 joshuafredrickson

@joshuafredrickson I ran into the same issue on some of the order items. Not sure what the correlation is since the number of re-serializations varied from once to several times. Whichever the case, I've updated my dirty code to reflect those situations:

while (is_string($data)){
   $data = unserialize($data);
}
return $data;

tigerx7 avatar Nov 28 '16 01:11 tigerx7

Need help for solve this similar issue: Product custom options is missing in order confirmation mail, just recive correctly product name without selected custom options during checkout.

salelsol avatar Mar 02 '17 18:03 salelsol

@ToshiroMifune, thank you for your report. We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue. We tested the issue on 2.3.0-dev, 2.2.0, 2.1.9

magento-engcom-team avatar Oct 10 '17 11:10 magento-engcom-team