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

Page 2 of 17
Poll
Do you think the product import in Magento is too slow?
Yes, it should be improved! 613
No, it’s fine. There are more important things to work on. 19
What are you talking about? 1
Total Votes: 633
You must be a logged-in member to vote
Import Speed / Performance optimization
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

I tried running that query - someone knows their sql, but not me! I had zero rows affected no matter how I tried to run it, and I did setup the temp table and import into that so I am happy with my syntax.
I ended up using a few simple queries, one to get the product_id from the sku, then updated everything after that, less elegantly than the one statement above. I would still like to see what you got though, what works for you.
Someone - hint, hint, needs to put a wiki article on this as everyone is left to find out for themselves or use the ‘dataflow’ route.

 
Magento Community Magento Community
Magento Community
Magento Community
 
michael_g08
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2009-03-06
Ukraine
 

Hi.

That’s the simple script I’ve made for one of community members.
May be it would be useful.

Regards, Michael.

File Attachments
script.zip  (File Size: 2KB - Downloads: 2068)
 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

Very neat! Impressive, clean code - if only that had been up here earlier. I really would advise posting that in the ‘wiki’ for the next person. Thanks muchly.

 
Magento Community Magento Community
Magento Community
Magento Community
 
michael_g08
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2009-03-06
Ukraine
 

I’m glad to help.
May be You are right about Wiki. But I have not much time for now. Pity :-(
I’ll try to do it as soon as I can.

Regards, Michael.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

Done it!

http://www.magentocommerce.com/wiki/stock_level_import_script

 
Magento Community Magento Community
Magento Community
Magento Community
 
michael_g08
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2009-03-06
Ukraine
 

@Discovery

I thank You for that.
And I’m pleased You mentioned my name there.

That’s great and I hope it will help…

Regards, Michael.

 
Magento Community Magento Community
Magento Community
Magento Community
 
michael_g08
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2009-03-06
Ukraine
 

@Discovery

Hi. Here is an updated full version of script. Now it can do:
- Update products in magento database
- Insert products if they not exist in magento DB
- Insert/update MANUFACTURER field
- Update QTY, PRICE, DESCRIPTION, SHORT_DESCRIPTION, and some my custom attributes.

Update part is direct-SQL. Insert part uses magento API it’s based on code written by blakew.

Hope it will helps somebody.

Regads, Michael.

File Attachments
script.zip  (File Size: 14KB - Downloads: 1562)
 
Magento Community Magento Community
Magento Community
Magento Community
 
amsoftuk
Jr. Member
 
Total Posts:  2
Joined:  2009-03-30
 

Hi, a couple of small refinements I have added to this script, that I don’t know if you would find useful.

I have added them inline here rather than added them to the script, as I am using the earlier version of the script. (which does everything I need).

First, at the top of the script

include_once 'path/to/Mage.php';

umask(0);
Mage::app('default');

$config Mage::getConfig()->getResourceConnectionConfig('core_write');
$base Mage::getBaseDir();

  
////////////////GLOBAL DEFINITIONS/////////////////////

  //DATABASE SETTINGS

$dbConfig = array(

                  
'host'      => $config->host,

                  
'username'  => $config->username,

                  
'password'  => $config->password,

                  
'dbname'    => $config->dbname,

                  
'driver_options'=> array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8')

                  );

This means you don’t need to hardcode the db info in the script. Needless to say, the include for Mage.php below the initial config needs to go.

function updateTempTableFromFile($db_magento$path){
  $db_magento
->query("CREATE TEMPORARY TABLE IF NOT EXISTS temp_table (sku CHAR(50), qty INT(32))");

This creates the temp_table for you, if it isn’t there already, as a temporary table. Again fairly obviously you’ll need to change the columns to the ones you actually want to use.

Hope that helps someone

 
Magento Community Magento Community
Magento Community
Magento Community
 
nafnaf1000
Sr. Member
 
Total Posts:  209
Joined:  2008-02-21
 

Dummy requesting help.

Sorry to bother you all. This is exactly what I need to do in order to get my site up and running. But I have no idea how to work this code.

Can some one please help me to set this up.

I need to upload new items once a day.
and I need to upload price and qty every hour.....

can anyone please help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
boxer1732
Jr. Member
 
Total Posts:  14
Joined:  2009-02-04
 

Michael - this code is just what we needed!  Thanks for your time and effort. smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
michael_g08
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2009-03-06
Ukraine
 

Glad to help, boxer !

 
Magento Community Magento Community
Magento Community
Magento Community
 
sphays
Jr. Member
 
Total Posts:  6
Joined:  2009-06-10
 

I have tried this script several times with different tweaks and parameters, but keep getting the same error:

Fatal error: Uncaught exception ‘Zend_Db_Statement_Exception’ with message ‘SQLSTATE[28000]: Invalid authorization specification: 1045 Access denied for user ‘sstaley_test’@’webservices.servername.com’ (using password: YES)’ in /home/sstaley/public_html/test29464/lib/Zend/Db/Statement/Pdo.php:238 Stack trace: #0 /home/sstaley/public_html/test29464/lib/Zend/Db/Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array) #1 /home/sstaley/public_html/test29464/lib/Zend/Db/Adapter/Abstract.php(457): Zend_Db_Statement->execute(Array) #2 /home/sstaley/public_html/test29464/lib/Zend/Db/Adapter/Pdo/Abstract.php(230): Zend_Db_Adapter_Abstract->query(’LOAD DATA INFIL...’, Array) #3 /home/sstaley/public_html/test01.php(62): Zend_Db_Adapter_Pdo_Abstract->query(’LOAD DATA INFIL...’) #4 /home/sstaley/public_html/test01.php(20): updateTempTableFromFile(Object(Zend_Db_Adapter_Pdo_Mysql), ‘/import/sam.csv’) #5 {main} thrown in /home/sstaley/public_html/test29464/lib/Zend/Db/Statement/Pdo.php on line 238

anyone else experience this or know how to fix.

Thanks for any help

 
Magento Community Magento Community
Magento Community
Magento Community
 
Discovery
Enthusiast
 
Total Posts:  767
Joined:  2007-12-29
 

Yeah. You got your login wrong. Make sure your web services user/pass(apikey) is what it should be, give the role full permission for everything and all should be cushty.

 
Magento Community Magento Community
Magento Community
Magento Community
 
michael_g08
Sr. Member
 
Avatar
Total Posts:  108
Joined:  2009-03-06
Ukraine
 

Disovery is wright. sphays. You should contact Your web sevices provider. You are not only one who get this error. You just have not all the permissions. If You run LOAD DATA INFILE query in phpMyAdmin You will get the same error.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sphays
Jr. Member
 
Total Posts:  6
Joined:  2009-06-10
 

as I stated in the post...we have verified the database connection credentials and the database user permissions serveral times over and continue to get this error....

I am not sure what else to try

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 17