Update products programmatically in Magento

后端 未结 5 818
礼貌的吻别
礼貌的吻别 2020-12-13 15:53

I\'m working on a script that will create or update products in my catalog.
The script works fine when the product needs to be created, but it fails when the product alr

5条回答
  •  抹茶落季
    2020-12-13 16:11

    Easy with Magento API, also can use methods....

    example

    $data = array('qty'=>1, 'is_in_stock'=>1)
    
    $stockModel = new Mage_CatalogInventory_Model_Stock_Item_Api;
    $stockModel->update($product_id, $data);
    

    Also can set Admin mode

    Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
    

提交回复
热议问题