2

What are the basic tables which need to use, so Product will be shown in Admin & Frontend as well?

No need for extra attribute/image as well. Required fields & Enabled Product.

As I seen below 2 tables required. Not sure about other tables

catalog_product_entity
catalog_category_product
catalog_category_product_index
catalog_eav_attribute
catalog_product_website
catalog_product_entity_text
catalog_product_entity_varchar
catalog_product_entity_datetime
catalog_product_entity_decimal
catalog_product_entity_int
catalog_product_flat_1
catalog_product_index_price
cataloginventory_stock_item
cataloginventory_stock_status
cataloginventory_stock_status_idx
eav_entity_attribute
eav_attribute_option_value
url_rewrite

As I'm unable to import products from Backend. I'm thinking of alternatives.

Please re-confirm the above tables. This gonna be also tough. It's better someone can help with the Admin Side Product Import Issue

Magento 2: Product Import Error - Product Type is invalid or not supported. Duplicates found in column names [SOLVED]

https://github.com/magento/magento2/issues/6939

1 Answer 1

8

As Admin side Import is not working. Have to follow this way to achieve functionality ASAP.

Managed to do below things, But 1 issue not able to Save on Admin side. I have compared table entry with other tables as well. Please point out what I'm missing

  1. catalog_product_entity // Main Product Table Entry

INSERT INTO catalog_product_entity (entity_id, attribute_set_id, type_id, sku, has_options, required_options, created_at, updated_at) VALUES (NULL, '16', 'simple', 'test1', '0', '0', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

Will Return 2049 as Product Id & will be used for Future Tables

  1. catalog_product_entity_varchar // Title & Description & URL

INSERT INTO catalog_product_entity_varchar (value_id, attribute_id, store_id, entity_id, value) VALUES (NULL, '73', '0', '2049', 'Test 1'), (NULL, '84', '0', '2049', 'Test 1'), (NULL, '86', '0', '2049', 'Test 1'), (NULL, '126', '0', '2049', 'test-1');

  1. catalog_product_website // Assign Product to Website

INSERT INTO catalog_product_website (product_id, website_id) VALUES ('2049', '1');

  1. catalog_product_entity_decimal // Product Price

INSERT INTO catalog_product_entity_decimal (value_id, attribute_id, store_id, entity_id, value) VALUES (NULL, '77', '0', '2049', '1.11');

  1. catalog_product_index_price // Assign All Group Wise Price

INSERT INTO catalog_product_index_price (entity_id, customer_group_id, website_id, tax_class_id, price, final_price, min_price, max_price, tier_price) VALUES (2049, 0, 1, 2, '1.1100', '1.1100', '1.1100', '1.1100', NULL), (2049, 1, 1, 2, '1.1100', '1.1100', '1.1100', '1.1100', NULL), (2049, 2, 1, 2, '1.1100', '1.1100', '1.1100', '1.1100', NULL), (2049, 3, 1, 2, '1.1100', '1.1100', '1.1100', '1.1100', NULL);

  1. catalog_category_product // Assign Product to Category

INSERT INTO catalog_category_product (entity_id, category_id, product_id, position) VALUES (NULL, '41', '2049', '1');

  1. catalog_product_entity_int // Enable Product & Visibility

INSERT INTO catalog_product_entity_int (attribute_id, store_id, entity_id, value) VALUES (133, 0, 2049, 2), (115, 0, 2049, 1), (99, 0, 2049, 4), (97, 0, 2049, 1);

  1. cataloginventory_stock_item // For Inventory Quantity

INSERT INTO cataloginventory_stock_item (item_id, product_id, stock_id, qty, min_qty, use_config_min_qty, is_qty_decimal, backorders, use_config_backorders, min_sale_qty, use_config_min_sale_qty, max_sale_qty, use_config_max_sale_qty, is_in_stock, low_stock_date, notify_stock_qty, use_config_notify_stock_qty, manage_stock, use_config_manage_stock, stock_status_changed_auto, use_config_qty_increments, qty_increments, use_config_enable_qty_inc, enable_qty_increments, is_decimal_divided, website_id) VALUES (2049, 2049, 1, '100.0000', '0.0000', 1, 0, 0, 1, '1.0000', 1, '10000.0000', 1, 1, NULL, '1.0000', 1, 1, 1, 0, 1, '1.0000', 1, 0, 0, 0);

  1. url_rewrite // For URL Rewrite

INSERT INTO url_rewrite (entity_type, entity_id, request_path, target_path, redirect_type, store_id, description, is_autogenerated, metadata) VALUES ('product', 2049, 'coins/test-1.html', 'catalog/product/view/id/2049/category/41', 0, 1, NULL, 1, 'a:1:{s:11:"category_id";s:2:"41";}'), ('product', 2049, 'test-1.html', 'catalog/product/view/id/2049', 0, 1, NULL, 1, NULL);

Check the eav_attribute table which stores ALL Attributes

10] catalog_url_rewrite_product_category // For URL Rewrite

INSERT INTO catalog_url_rewrite_product_category (url_rewrite_id, category_id, product_id) VALUES ('631', '41', '2049');

After this, you are able to see your Product on the Frontend

Execute Below Command:

php bin/magento setup:upgrade
php bin/magento indexer:reindex
php bin/magento cache:flush

You can see your newly created product entry in Below tables now

catalog_category_product_index
catalog_product_flat_1
cataloginventory_stock_status
cataloginventory_stock_status_idx

Issue: When i go to Admin -> Catalog -> Edit Product & Save. It's not doing anything. Just Hold Over there. No Errors displayed on Admin or in Console no issue logged in Log file as well.

[UPDATE - Solution]

I'm using my new "Attribute Set" in that some of the Attributes are Mandatory fields.

I have added that attribute entry in catalog_product_entity_varchar & it's work fine now :)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.