In Magmi v0.7.17, I can't manage to import configurable products.
Here is an example of the csv I've got (just fields related to problem here):
http://img198.imageshack.us/img198/8871/csvq.jpg
First of all, I need to put "_attribute_set" for the importation to work, otherwise I've got the error “cannot create product sku:xxx no attribute_set defined”. But in every online documentation and in the Dataflow Export this field is "attribute_set".
When I run the importation (using the Configurable Item processor v1.3.6), only the simple products are created and I've got theses errors :
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'attribute_id' cannot be null - INSERT INTO catalog_product_super_attribute(product_id,attribute_id,position) VALUES (?,?,?)
None of the attributes and attributes set exist in database, I want it to be created on the fly. But is it possible ? or do I miss some fields ?
Thanks !
Ok, it works now. After a little debugging in the plugin, I saw that the column "configurable_attributes" was empty. I move it at the beginning of the files (next to attribute_set) and it works fine. It's due to the fact that I didn't encapsulate my text with "" in csv, because Excel doesn't do it. So I modified my file with OpenOffice and let it at the end.
Suddenly attribute_set is working too.
Be sure to select "Magmi Magento Reindexer", otherwise the products won't appear in frontend.
Attributes and attribute sets have to be created in BackOffice before importation. Magmi can just create values of attribute.
What is work for me is:
1. Check "configurable_attributes"
- All attribute are listed ?
- All attribute are correctly spelled?
2. Check same for all custom attribute on header row
3. Check attribute "Use To Create Configurable Product" value is set "Yes"
This Error Means you are having error with attribute and attribute set.
Related
I'm trying since hours to get some values from the table
catalog_product_entity_varchar
with no succes.
How is this table connected to the products?
I have a product with a custom attribute "materials" and I found the values in this mentioned table.
There is no result when I try to do this:
$_product->getAttributeText('materials');
#credit goes to this answer: https://magento.stackexchange.com/questions/13330/how-to-get-dropdown-and-multiple-select-value-for-a-product-collection
the following should work:
$_product->getAttributeText('some_dropdown_attr');
Therefore only the following could be happening:
You must have mis-named your dropdown attribute
Ensure that the attribute has valid values applied on the current store view
If all else fails, there may be a problem with your attribute setup code; for instance, not visible in the frontend isn't set properly and you're using flat tables...
In that case to debug output it with the following code:
$attr = $_product->getResource()->getAttribute('some_dropdown_attr')->getFrontend()->getValue($_product);
If that works check your catalog attribute configuration or disable flat indexes.
Hope this help !!
I have started using magmi to import products, using the option create new items & update existing ones, however, when a new product is created, the _attribute_set seems to be ignored.
I have defined an attribute set in Magento called Books, which includes attributes such as ISBN, author.
Here is a sample from the CSV file (only the first few columns):
Header:
sku,_store,_attribute_set,_type,categories,_product_websites,name
Product Line:
ZZ001,,Books,simple,MyCategory/MySubCategory,base,Book Title
On the above example, ZZ001 is created, but with an attribute set of Default
Store is blank - is this a problem?
Someone else asked a question about this - but I didn't see a satisfactory answer.
Please double-check and make sure your column names are correct.
_store should be store
_attribute_set should be attribute_set
_type should be type
_product_websites should be websites
Also for attribute sets, you must make sure that the attribute set is already created before attempting to import products under it. Magmi does not automatically create attribute sets.
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.
I am having an issue uploading a large csv of products.
It goes through the check on then after then import says: SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘attribute_id’ cannot be null
After this has done I have checked the products page and they are all there but do not seem to be in the categories, do not show in search and even if I manually enable the categories do not show.
Any ideas? Really stuck!
There is a value missing in "_media_attribute_id"
check all column and insert "88" where it is missing.
It solved my problem
Invalid attribute_id is associated with custom attributes.
You need to check that 1) all the attribute fields referenced in your csv - lets use Color just as an example - have been set up as attributes in Magento (Catalog > Attributes > Manage Attributes). Similarly, you need to make sure that any custom attributes that have been added and configured to be required are in your csv.
The attributes which Magento will be expecting will ultimately depend on the attribute_set you tell Magento to use for those products - also part of your csv. Attribute sets can be managed similarly under Catalog > Attributes > Manage Attribute Sets
You then need to make sure that all the attribute values you are attempting to import and are mentioned in the csv, actually appear as values for those attributes in Magento. For exmaple, if in Magento the available values for the attribute Color were only Red and Blue - and you were trying to import Yellow under this heading, it would throw the error you mentioned. Note these are also case sensitive. Magento will error on blue if it is expecting Blue.
Products not appearing in Search would be an unrelated issue...
In your csv, check under the heading "visibility" that you imported the value "Catalog, Search" - it might be that you have imported them as either "Catalog" or "Not visible individually" which would explain them not appearing (I assume at this point they have been uploaded as enabled or you have manually enabled them before searching!)
I had the same error. In my case, some products didn't have "_media_attribute_id" field populated.
I received this same error when I hadn't set up my attribute and attribute set prior to importing a configurable item using said non-existent attribute.
Edit: Thus, creating and configuring the attribute and attribute set from the Magento dashboard resulted in Magmi not throwing this error.
I had the same problem..Then i solved with filling '88' under '_media_attribute_id' column.
I installed an extension that adds an attribute which you can turn on per product when you edit or add a new product... but I need to add it to all existing products.
a) sql?
b) point me to a class somewhere that does this for a Magento collection?
Similar question, but I need to do it in sql or module: Default attribute value for all product in magento
adds an attribute which you can turn on per product
Been here before.
Does it show up in product maintenance now that the module is installed? If so, then it will show up in an export profile. Make an export for skuid, store, type and the new attribute and export to a CSV file. Make sure use Magento column headings is set to yes. Set the new attribute to what you need it to be in the CSV file for what product you need set and import it using the Import All Products profile.
Freshly installed module attributes will default to blank until something edited on the page the attribute shows on is saved. Use the profile import to set them all to yes or 1 if it's a yes/no enable type field to enable across the board. You will have to check the export to see if they're using yes/no in the database or boolean 1/0.
If this attribute is a dropdown item, you will need to create all the selection items in Attribute Maintenance and make sure the value in the upload file matches exactly the selection in attribute maintenance so the upload will work.
As an added note, if this attribute is only created on simple items, filter your export to only include simple items for inclusion in the import file.
It sounds like one of those one-time deals where expending a lot of effort on throwaway code violates the KISS method when a simple import will fix it and you're done with the operation for good.