php - how to update product information outside from Magento -
i want programmatically update product information, such quantity, price, etc. (from outside of magento source directory.)
how can that?
magento pretty easy bootstrap. if want standalone script can access functions, add following @ top of php file :
define('magento', realpath(dirname(__file__))); require_once magento . '/../app/mage.php'; //or whatever location mage.php file mage::app(mage_core_model_store::admin_code); //initialization store possible
after can load models. update products suggest 2 ways. regular 1 :
mage::getmodel('catalog/product')->setstoreid($mystoreid)->load($myproductid) ->setprice(50) ->save();
or api model usage :
$api = mage::getmodel('catalog/product_api_v2'); $api->update($productid, $productdata, $store, $identifiertype);
Comments
Post a Comment