4

i create a product with Customizable Options but sometimes at frontend, the place which custom options should have appeared is now nothing enter image description here

I'm not sure why it happen, but when i resaving the product seems to solve that. Any idea what's the cause? How to prevent that? How to fix that for all products without resaving them all?

asked Mar 14, 2019 at 8:18
2
  • You can refer this issue in Github: github.com/magento/magento2/issues/10469 Commented Mar 14, 2019 at 8:23
  • hi @KirtiNariya i see this, but It has not been resolved yet in your link Commented Mar 14, 2019 at 8:28

3 Answers 3

4

After create or update product attribute programmatically (like tier price , etc..) by mistake product has_option set with false value.

check in "catalog_product_entity" table.

select entity_id, has_options, sku from `catalog_product_entity` where sku = {sky of yourproduct}

So update it if has_options value is zero or null.

UPDATE `catalog_product_entity` set has_options =1 where sku = {sky of yourproduct} 

As describe @Gulshan. find out and update product which has_options column value are false.

SELECT * FROM `catalog_product_entity` WHERE entity_id in (SELECT product_id FROM `catalog_product_option`) and has_options = 0;

And update it with update query. Before update keep backup for table "catalog_product_entity" table.

UPDATE `catalog_product_entity` set has_options =1 where entity_id in (SELECT product_id FROM `catalog_product_option`) and has_options = 0 ;

Refresh cache and check product detail page.

answered Nov 29, 2019 at 12:15
1
  • 1
    Thanks sumit, I have got same issue after migrate my site. Commented Dec 11, 2019 at 10:36
3

I also faced the issue.

After doing some investigation I found that has_options column has 0 but product have at least one option associated in the product options table.

I didn't find a scenario to reproduce but it seems the product options were imported by any third party extension or migrated from an older version of Magento.

Re-saving product resolves the issue because there is a check at before product save that updates has_options value to 1.

So, I prepared below query to find all such products and managed to save all the resulted products.

SELECT * FROM `catalog_product_entity` WHERE entity_id in (SELECT product_id FROM `catalog_product_option`) and has_options = 0 

I hope this may help someone facing the same issue.

answered Nov 13, 2019 at 7:56
0
0

its because of $product->save()

when you save product with orm, its setting has_options to 0. Shortly its a magento bug. To fix that issue in db level, you can execute the query below.

update catalog_product_entity t1 
inner join catalog_product_option t2 on t2.product_id = t1.entity_id
set t1.has_options = 1
where t1.has_options = 0 and t1.type_id = 'simple';
update catalog_product_entity t1
inner join catalog_product_option t2 on t2.product_id = t1.entity_id and t2.is_require = 1
set t1.required_options = 1
where t1.required_options = 0
and t1.type_id = 'simple';

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.