Magento - Mettre en place un export périodique facilement.
- Détails
- Catégorie : Magento
- Créé le Mardi, 21 Juin 2011 15:11
- Mis à jour le Mercredi, 30 Novembre -0001 00:09
- Publié le Mardi, 21 Juin 2011 15:11
- Affichages : 336
Voici un petit script trouvé sur le site de PremaSolutionsConsulting.
D'abord créer un profil d'export dans Magento.
Récupérer son id (voir l'URL dans l'admin).
Ensuite, envoyer ce script en remplaçant l'id par celui de votre export :
//THIS SCRIPT JUST INITIALS THE PROFILE TO BE RUN VIA MAGENTO ADMIN "RUN PROFILE IN POPUP". Its the same thing as click just via this file that you can run via cron $profileId = 8; // SYSTEM - IMPORT/EXPORT - (ADVANCED) PROFILES <-- you need to go into your magento admin and grab the exact profile ID require_once 'app/Mage.php'; umask(0); Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $profile = Mage::getModel('dataflow/profile'); $userModel = Mage::getModel('admin/user'); $userModel->setUserId(0); Mage::getSingleton('admin/session')->setUser($userModel); $profile->load($profileId); if (!$profile->getId()) { Mage::getSingleton('adminhtml/session')->addError('ERROR: Incorrect profile id'); } Mage::register('current_convert_profile', $profile); $profile->run(); $recordCount = 0; $batchModel = Mage::getSingleton('dataflow/batch'); // echo "EXPORT COMPLETE. BATCHID: " . $batchModel->getId(); ?>
Maintenant, il mettre en place un cronjob sur le serveur web qui exécute la commande suivante :
wget --output-document=- http://<mondomaine.com>/start_export.php
Remplacer start_export.php par le nom du script que vous avez donné.
- < Magento : Créer son propre fichier de log
- Magento - Plusieurs URL, plusieurs magasins, un seul Magento >