Export a profile from shell

MagentoI was struggling to run an export profile from the web interface of Magento without having any luck, increasing timeout or memory or anything was not helping at all.
Since I needed that export to be done, with this small script you can do that:

$profileId = 7; #The ID of the profile from the administration view
require_once 'app/Mage.php';
$profile = Mage::getModel('dataflow/profile');
$userModel = Mage::getModel('admin/user');
if (!$profile->getId()) {
Mage::getSingleton('adminhtml/session')->addError('[ERROR] Invalid ID');
Mage::register('current_convert_profile', $profile);



11 thoughts on “Export a profile from shell

  1. i get this ;

    PHP Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (devdeaddi.dataflow_profile_history, CONSTRAINT FK_AEA06B0C500063D3CE6EA671AE776645 FOREIGN KEY (profile_id) REFERENCES dataflow_profile (profile_id) ON DELETE CASCADE ON UPDATE CAS)’ in /var/www/html/www.addison-electronique.com/dev/lib/Zend/Db/Statement/Pdo.php:228
    Stack trace:
    #0 /var/www/html/www.addison-electronique.com/dev/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
    #1 /var/www/html/www.addison-electronique.com/dev/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
    #2 /var/www/html/www.addison-electronique.com/dev/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
    #3 /var/www/html/www.addison-electronique.com/dev/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
    #4 /var/www/html/www.addison-electronique.com/dev/lib/Zend/Db/Ad in /var/www/html/www.addison-electronique.com/dev/lib/Zend/Db/Statement/Pdo.php on line 234

    • Make sure you update the value for $profileId = 7;. The author doesn’t make that super clear, but you need to go into the Magento admin, record the profile id, then update the “7” to the correct profile id.

      • Strangely, changing the profile_id to the value it had before I had to delete a profile and insert a new one did help. I just inserted the new profile_id directly in the ‘dataflow_profile’-table in the database…

      • It is actually in the comment to the line since always 🙂

        Be always careful when handling deletes, the profile id is only from the admin view

  2. Pingback: Magento Dataflow profiles with over 8k products | Old Wild Issue

Your opinion is important!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s