Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

the quest for an efficient product import script
 
Harry-S
Jr. Member
 
Total Posts:  8
Joined:  2009-11-04
 

to dweeves
i cant to post with attsach, so here is link to my test file wtih headings
http://dl.dropbox.com/u/1645583/import2.csv

 
Magento Community Magento Community
Magento Community
Magento Community
 
mennos
Member
 
Total Posts:  47
Joined:  2010-04-11
 

to dweeves:

I’ve been looking what effect the multistore/websites have on the data too.

Here’s our setup:

store id 0: base (admin values)
store id 1: Website 1 - store 1 - view = Dutch
store id 2: Website 1 - store 1 - view = English

store id 3: Website 1 - store 2 - view = Dutch (Store 3 has different kinds of items)

store id 4: Website 2 - store 1 - view = Dutch (WEBSITE 2 has different pricing!)

SKU 00012 (entity_id 76938) is available in storeid 1,2 and 4

in catalog_product_website it has entries for website_id 1 (base) and 2 (b2b)

breakdown of the changes made in DB: (as far as I could find)

example value: NAME (catalog_product_entity_text - attribute id 57)
backend settings: scope=store_view
by default (in our setup) Magento sets an imported item at it’s base value (store id 0)

catalog_product_entity_text:
attribute_id 57
store_id 0
value: NAME

Depending on the product settings, item is now available in all views
if you change the title in the English store view (storeid 2) (untick use default value box for selected store view in backend, change name) , it adds a line in the catalog_product_entity_text DB:

catalog_product_entity_text:
attribute_id 57
store_id 2
value: NAME FOR ENGLISH VIEW

it only seems to add a line for the entry needed (so no extra line for the other views - just storeid 0 (=base) and storeid 2 (=english) - the others are taken from the baseview

When you edit the product in the backend to change the Name back so it uses the default value (in store view for storeid 2, tick Use Deafult Value ON again), then it removes the entry from the DB again

Example 2: price (scope=website)
we have 2 prices - 1 for website 1 (use base/admin values), 1 for website 2 (storeid 4)
in catalog_product_entity_decimal:

storeid = 0, value = PRICE A
storeid = 4, value = PRICE B

I couldn’t create an export for all values in 1 export file (maybe it’s me, maybe it’s magento settings..)

hope this helps

 
Magento Community Magento Community
Magento Community
Magento Community
 
dweeves
Enthusiast
 
Total Posts:  877
Joined:  2010-06-26
FRANCE
 

Thanks for getting me data guys, should be able to get a new release this afternoon.

 
Magento Community Magento Community
Magento Community
Magento Community
 
pastanislas
Member
 
Total Posts:  46
Joined:  2008-07-29
 

For multiple stores or websites you just need to respecify attribute values that has scope \"store view\” if you want them to change.

If you don\’t specify a value for a \"store view\” attribute , for example product name, the value taken will be the \"admin\" value.

So you upload first product line with all \"admin\" values and then a second product line, with the same SKU, and values you want to change.

In my own case I want to specify a new price, a new url key, a new short description and description.

Inventory is \"global\" so I don\’t redefine inventory attribute (otherwise they are overwritted even if the field is leaved blank).

Here\’s an example of a csv for my website : 2 websites, with one store view each.

The first one extraction_article_de.csv witch set \"admin values\” (dropdown attributes codes, inventory etc..) that I can use for most websites / store views.

The second one extraction_article_de2.csv witch set \"store view\” specific values (product name in correct language, price, description...)

Hope this helps.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dweeves
Enthusiast
 
Total Posts:  877
Joined:  2010-06-26
FRANCE
 

You just forgot to attach the files , you can send them to be by mail if you want smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mizpah
Member
 
Avatar
Total Posts:  54
Joined:  2009-12-09
Birmingham
 

Hi Folks,

I assume not as I cant see it mentioned, but can anyone confirm if this script will help with:

A) Importing Categories
B) Importing Tiered Pricing
C) Importing Attribute Sets

Irrespective I will take a look to see if it helps with the base import - 15,063 products to do! (Single Store view, 400+ categories, 20 attribute sets, 100+ attributes).

Cheers,

Mizpah

 
Magento Community Magento Community
Magento Community
Magento Community
 
dweeves
Enthusiast
 
Total Posts:  877
Joined:  2010-06-26
FRANCE
 

This script only import products .

but if you have already defined your attribute sets/categories & attributes in magento it will correctly map all your products on it.

moreover,if you use multiselect or select attributes, you don’t need to predefine option values in magento, the script will create them automagically.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mr Lei
Jr. Member
 
Total Posts:  13
Joined:  2010-05-05
 

[SOLVED]

Clearing product list....OK
Fatal error
Uncaught exception \'PDOException\' with message \'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.\' in /Serwer/Profile/lib/magento_mass_importer.class.php:78
Stack trace
:
#0 /Serwer/Profile/lib/magento_mass_importer.class.php(78): PDOStatement->execute()
#1 /Serwer/Profile/lib/magento_mass_importer.class.php(114): DBHelper->exec_stmt(\'SELECT code,web...\', NULL)
#2 /Serwer/Profile/lib/magento_mass_importer.class.php(268): DBHelper->select(\'SELECT code,web...\')
#3 /Serwer/Profile/lib/magento_mass_importer.class.php(1091): MagentoMassImporter->initWebsites()
#4 /Serwer/Profile/Import.php(52): MagentoMassImporter->import(\'/Devel/Szablon/...\', 1)
#5 {main}
  
thrown in /Serwer/Profile/lib/magento_mass_importer.class.php on line 78
How ... unbuffered queries fix?

=====================
it whose problem whit PDO used in php v5.2.9…

---------
Mr Lei

 
Magento Community Magento Community
Magento Community
Magento Community
 
dweeves
Enthusiast
 
Total Posts:  877
Joined:  2010-06-26
FRANCE
 

updated 0.2.11

- minor fixes
image editing on the backend
enhancement for reset SQL exception (should not appear now)

0.3 will come later than expected, need to setup multi store on my dev site an see how it goes.
however , the 0.2.11 has already some multi store experimental code, if some adventurous testers want to make a test but i doubt it’s already working.

File Attachments
magento_mass_importer.zip  (File Size: 11KB - Downloads: 240)
 
Magento Community Magento Community
Magento Community
Magento Community
 
dweeves
Enthusiast
 
Total Posts:  877
Joined:  2010-06-26
FRANCE
 

new release 0.3 !!!!

- multiple store support (using magento syntax , one line per product & per store, you can leave empty values for values not changing from base store)

File Attachments
magento_mass_importer.zip  (File Size: 11KB - Downloads: 255)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Mr Lei
Jr. Member
 
Total Posts:  13
Joined:  2010-05-05
 

[SOLVED]

[Problem]
I have problem whit my polish fonts…
When i import use MassImport a have broken polsih fonts, in the same file i used to norma import in System -> Import/Export->Profile and them fonts is ok.

i’m trail chang in import() method:

#setlocale(LC_ALL,"en_US.UTF-8");
--> setlocale(LC_ALL,"pl_PL.UTF-8");
but it’s don’t work.
=========================

[SOLUTION]

//intialize connection with PDO
$this->_db=new PDO("mysql:host=$host;dbname=$dbname;charset=utf8"$user$pass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
        
//use exception error mode
        
$this->_db->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
        
//use fetch assoc as default fetch mode
        
$this->_db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE,PDO::FETCH_ASSOC);
        
//set database debug mode to trace if necessary
        
$this->_debug=$debug;
        if(
$this->_debug)
        
{
            $this
->_db->query("SET GLOBAL general_log='ON' ")->execute();
        
}
        
//force UTF8 chars
                 #$this->_db->exec("SET CHARACTER SET utf8");

i change initialisation in PDO add --> array(PDO::MYSQL_ATTR_INIT_COMMAND => “SET NAMES utf8")
and erase force UTF8 chars ..

and All Polish words work great and very fasssssst grin

Mr Lei

 
Magento Community Magento Community
Magento Community
Magento Community
 
dweeves
Enthusiast
 
Total Posts:  877
Joined:  2010-06-26
FRANCE
 

To Mr Lei:
be sure to save your csv input file in UTF-8 since i don\’t perform input encoding detection yet.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mr Lei
Jr. Member
 
Total Posts:  13
Joined:  2010-05-05
 

To dweeves:

yes… UTF-8 and this file work ok in Import in System -> Import/Export->Profile…

 
Magento Community Magento Community
Magento Community
Magento Community
 
dweeves
Enthusiast
 
Total Posts:  877
Joined:  2010-06-26
FRANCE
 

updated version 0.3.1
- binary reading for csv (should fix mr Lei issue)

File Attachments
magento_mass_importer.zip  (File Size: 11KB - Downloads: 312)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Mr Lei
Jr. Member
 
Total Posts:  13
Joined:  2010-05-05
 

To dweeves:

...don’t work form me.
i don’t now where find?

Mr Lei

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top