magento import unique key - magento

when exporting and importing data in Magento via import/export profile, products are not being updated. We selected only mapped fields. I have some idea. But am unsure.
When you export and import, do you use the same profile? (or does the standard import function understand and import the mapped fields)
What does Magento use as the INDEX to update the correct record. We are updating SKU, but maybe this is used as key?
Thanks, appreciate the help

SKU is unique for every product. As imported product does not have id so magento can not understand that you are updating product if SKU is changed.

Related

Which magento table contains product url slug

The problem I'm having is that I import products with Magmi (magento product import open source solution), but I want to change the url slug. I need to know which table in magento database contains slug so that I could maybe feed it somehow directly...
I know this question is old and answer was accepted but for users do not using Magmi is there this answer:
URL Key is stored by EAV model.
You can find value by following query:
SELECT `attribute_id` INTO #urlKeyId
FROM `eav_attribute` WHERE `entity_type_id` = 4 AND `attribute_code` LIKE 'url_key';
SELECT * FROM `catalog_product_entity_varchar` WHERE `attribute_id` = #urlKeyId;
(if you are using table prefix add it to table's names)
The most excellent Magmi will do that for you. I suggest you read every single page of the Magmi instructions slowly and carefully to comprehend the enormous capabilities of this software tool. But the one you want to concentrate on is here.
So if you use a CSV like:
"sku","url_key"
"00085722994075","my-awesome-product-you-will-fail-without-it"
Then Magmi will update all the product 'slugs' for you.
To answer your question: The core_url_rewrite is the main table but it is built from, among other things, the product attribute 'url_key' and the product attributes are in the EAV so it isn't a single table update. That is why we bow to the genius of Dweeves and his magical Magmi code.
i think better idea to load product then update product URL otherwise if you try to do in direct database table. some problems can come out like indexing , magento can stop working.
i means how you do load MAGE class then load product then do this manually

Magento - How to set Super Product sort order on import

I am importing simple and configurable products using the magento Import. When associated products (super products) are imported the order is set to what appears to be alphabetical order based on the attribute name. The order of these can be changed in admin by dragging the attributes. It appears the order is kept in the catalog_product_super_attribute table in the ‘position’ column. But, so far I’ve found no way to import this order.
Is there are parameter I can add to the CSV file to import this value.

Magmi import doesn't remove the products

I have been using Magmi to import products by adding items to the file " export_all_products.csv" without any problems
But when I have products that need to be remove,what I did was by removing the whole row in that product line in the csv file and upload it using magmi, but the products that I want to delete is still there and sometimes duplicated, is there a way to get it done or can I empty some tables in the database in phpmyadmin before I do the import?
Thanks so much
You need to use the Product Deleter plugin to delete products with Magmi.
Use the column name magmi:delete with the value of 1 on the rows you want removed from Magento.
Example CSV:
"sku","magmi:delete"
"00001","1"
"00004","1"

Products are not displaying in Frontend after import in Magento

I have imported products using System - Import/Export - Import option.
I can see my products in Admin panel, but not in Frontend.
I tried Re-indexing, cache clear, cache refresh, physical cache remove.
also checked product stock status, availability etc. Everything is ok.
But they are not displaying in frontend. I marked onething, If I open product that I imported using csv, just saved without any change, it starts displaying. But I have 100s of products. So I can't use this solution.
So please help me where I am going wrong in csv. below is my csv screenshot.
You need to ensure that the products are attached to a website.
This can be done via a bulk update:
Access the product listm select all
Alter attribute
Products information -> websites
It can also be done in the csv by using a "_product_websites" field and setting it to the website name or 'base'.
I forgot which CSV columns are mandatory but I do remember that if some are missing the importer does not tell you that but instead you get the behaviour that you are describing.
The simplest way to find out what is mandatory is to:
Fix bugs in Magento ImportExport module
Create a new product in admin
Check that the new product is visible on front-end
Export the new product with Magento ImportExport exporter
Delete created product
Import the previously exported product csv
Clear cache and reindex data
Check that product is visible on front-end (it should be)
Compare your CSV with the exported one and try to figure out what is missing from it
Try to import your CSV with added/fixed columns and add data untill the product is imported so that it is visible on front-end
This requires allot of trial and error...
The missing columns in my case had always the same value so if this will be the case with your problem as well you can simply extend CSV importer and hard code those values in there instead of fixing your CSV manually.
Since your product gets saved correctly if you open it in admin and save it you can also:
Import a product
Export that product
Open that product in admin and save it
Export newly saved product
Compare exported CSV-s where they differ
Fixing Magento ImportExport bugs:
First bug is that if you import multiple products the quantity informatino from the first product is used for all the products. To fix this you have to add $row = array(); right before $row['product_id'] = $this->_newSku[$rowData[self::COL_SKU]]['entity_id']; in Mage_ImportExport_Model_Import_Entity_Product::_saveStockItem() function.
The second bug causes Magento ImportExport module to return a foreign key constraint error when importing multiple products. Error happens because magento splits products data into multiple segments and if one product is located in two segments importer will delete data that was imported for the product in first segment before importing the second segment thereby causing database corruption (see this link for detailed explanation - this is where I got the solution below).
Note that removing foreign key constraint will not fix the problem but will instead make it worse since the database will contain corrupt data.
To fix it you have to change the code in Mage_ImportExport_Model_Import_Entity_Abstract::_saveValidatedBunches() function:
After if ($startNewBunch || !$source->valid()) { add
if ($startNewBunch && count($bunchRows) > 1) {
$arrKeys = array_keys($bunchRows);
$arrNew = array();
while(($tRow = array_pop($bunchRows))) {
$tKey = array_pop($arrKeys);
$arrNew[$tKey] = $tRow;
if ($tRow['sku']) {
break;
}
}
$nextRowBackup = array_reverse($arrNew, TRUE) + $nextRowBackup;
}
Hope this helps.
I had the same problem recently and I spent some time tring to figure it out...
Looks like magento needs a status flag for every product otherwise magento will not show it in the dashboard.
Solution : add a "status" column to your CSV file and set all the statuses to "Enabled"
(yes it's not a boolean. Just use the string inside the quotes as it is :)
I was stuck with the same problem, i then visited my var/export/export_all_products file, downloaded it again and uploaded the same back through import, logged out of my account and logged-in back, all products were back. This worked as a backup for me and i could see all the products back at the back-end.
Import as you have. If they are enabled, but not showing...
then you can fix this by clicking "select all" products in the "manage products" table and then "change status" and then select "enabled." This process might take a minute.
Visit your store and you should see your frontend with products.
Some kind of bug with the status/enabled setting.
You must have next fields in CSV
sku
_attribute_set
_type
_category
description
image
name
price
short_description
status
tax_class_id
thumbnail
visibility
weight
qty
_product_websites
is_in_stock
Please note that field is_in_stock is mandatory even if qty more then 1
In magento 2 we need to reindex in index management to display the products in frontend.
We can reindex through cmd.like the given example we need to enter magento file directory after that cmd php -f bin/magento indexer:reindex to reindex .
When I first started importing products via csv although I set the product to enabled, I figured out that even though it shows in the magento back end as enabled, it actually isnt - think its to do with setting the field contents as "1" or "0" rather than "enabled" or "disabled/null".
To get around this, after a import I simply selected all the products in the back end and change status to enabled - it fixes issue.
But, I do think if I simply changed the data in the csv import it would save me this minor in-convenience.

Importing to store using Magento dataflow profile

I'm importing multiple products to Magento. I have two stores where I want to import products. I have created two stores in System / Manage Stores, but when I use store name in my csv-file in store column, it will return error "Skipping import row, store "mynewstorename" field does not exist.". If I use admin as store name, then products are imported successfully to Magento.
Version: Magento ver. 1.5.1.0
I found answer myself. When you create new store, you enter value code, and you must enter that code value to store column, not store value.

Resources