Last active
August 29, 2015 14:03
-
-
Save mklooss/37879f317169d1182613 to your computer and use it in GitHub Desktop.
Auto Add Items to Amazon Listing - m2e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(php_sapi_name() != 'cli') | |
{ | |
echo "only for cli!"; | |
exit; | |
} | |
require 'app/Mage.php'; | |
Mage::app('admin'); | |
$listingId = 2; | |
$storeId = 1; | |
echo "start\n"; | |
$collection = Mage::getModel('catalog/product')->getCollection() | |
->addAttributeToFilter('ean', array('notnull' => true)) | |
->addStoreFilter($storeId) | |
->addAttributeToFilter('status', 1); | |
foreach($collection->getAllIds() as $_id) | |
{ | |
$listing = Mage::helper('M2ePro/Component_Amazon')->getCachedObject('Listing', $listingId); | |
try { | |
$listing->addProduct($_id); | |
echo "product added {$_id}\n"; | |
} catch(Exception $e) | |
{ | |
echo "could not add {$_id}\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment