I'm trying to retreive the products from one certain shop in magento. The thing is that the script seems only to work when there are no other shops.
error_reporting(E_ALL);
ini_set('display_errors', '1');
chdir ( dirname ( __FILE__ ) );
$my_folder = dirname ( realpath ( __FILE__ ) );
date_default_timezone_set ( 'Europe/Amsterdam' );
define('MAGENTO_ROOT', $my_folder);
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once($mageFilename);
$app = Mage::app();
Mage::app()->setCurrentStore(1);
$url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
function getMainWithVariantsProducts(){
$productModel = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('type_id', array('eq' => 'configurable'))
->setPageSize(100000);
$main = array();
$variants = array();
foreach ($productModel as $_product) {
echo "<pre>";
print_r($_product);
echo "</pre>";
}
}
mainProduct();
So When I try with it a Magento server with 1 shop it works, ben when I try it with another Magento server it doesn't work.