Skip to content

Importer fails when updating an existing product with custom options #17616

Closed
@simonworkhouse

Description

@simonworkhouse

The importer fails when trying to update products which have a fixed price custom option with a price of zero.
This probably won't happen in production mode as notices would likely be disabled.

It looks like this error might be due to a record for price is expected to exist in the catalog_product_option_type_price table. Is it possible that this record wasn't created due to the zero price?

Preconditions

  1. Magento 2.2.5
  2. PHP 7.1.20
  3. MySQL 5.7.23

Steps to reproduce

  1. composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition {install dir}
  2. cd {install dir}
  3. ./bin/magento setup:install --backend-frontname=? --db-host=? --db-name=? --db-user=? --db-password=? --base-url=? --admin-user=? --admin-password=? --admin-email=? --admin-firstname=? --admin-lastname=?
  4. ./bin/magento deploy:mode:set developer
  5. Import the CSV data (see below) twice. That is once to create the product and the second time to try and update it.
"sku","product_online","website_id","store_view_code","attribute_set_code","product_type","categories","name","description","short_description","visibility","price","special_price","special_price_from_date","special_price_to_date","url_key","meta_title","meta_keywords","meta_description","display_product_options_in","msrp_display_actual_price_type","additional_attributes","qty","out_of_stock_qty","use_config_min_qty","is_qty_decimal","allow_backorders","use_config_backorders","min_cart_qty","use_config_min_sale_qty","max_cart_qty","use_config_max_sale_qty","is_in_stock","use_config_notify_stock_qty","manage_stock","use_config_manage_stock","use_config_qty_increments","qty_increments","use_config_enable_qty_inc","enable_qty_increments","is_decimal_divided","deferred_stock_update","use_config_deferred_stock_update","related_skus","crosssell_skus","upsell_skus","custom_options","bundle_price_type","bundle_sku_type","bundle_price_view","bundle_weight_type","bundle_values","associated_skus","base_image","base_image_label","small_image","small_image_label","thumbnail_image","thumbnail_image_label","swatch_image","swatch_image_label","additional_images","additional_image_labels","configurable_variations"
"some-test-product",1,1,,"Default","simple","Default Category/Some Category","Some test product","This is just some test product",,"Catalog, Search",2999,,,,"some-test-product","Some test product",,,"Block after Info Column","Use config","has_options=0,quantity_and_stock_status=In Stock,required_options=0",100,0,1,0,0,1,1,0,0,1,1,1,0,1,1,0,1,0,0,0,1,,,,"name=Some test custom option,type=drop_down,required=0,price=0,price_type=fixed,sku=123456,option_title=Pick me",,,,,,,,,,,,,,,,,

Expected result

Both import attempts succeed.

Actual result

Import fails with the following error:

General system exception happened
Additional data:
Notice: Undefined offset: 3 in {install dir}/vendor/magento/module-catalog-import-export/Model/Import/Product/Option.php on line 1474

Metadata

Metadata

Assignees

Labels

Component: ImportExportEvent: mm18hrFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentProgress: PR CreatedIndicates that Pull Request has been created to fix issueReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions