0

We have set the products position according to the sku in excel work sheet. for example: sku-1 | 1 , sku-2 | 2 ..... because we have thounsands of product in a specific sku, so we hope we can do this programmatically.

0

You can do it:

  1. with Magento API, here you can see the full documentation - http://www.magentocommerce.com/api/soap/catalog/catalogCategory/catalog_category.updateProduct.html
  2. like Magento update it, you can see app/code/core/Mage/Catalog/Model/Resource/Category.php -> protected function _saveCategoryProducts and more specifically this:

    /**
     * Update product positions in category
     */
    if (!empty($update)) {
        foreach ($update as $productId => $position) {
            $where = array(
                'category_id = ?'=> (int)$id,
                'product_id = ?' => (int)$productId
            );
            $bind  = array('position' => (int)$position);
            $adapter->update($this->_categoryProductTable, $bind, $where);
        }
    }
    
  • thank you michael. but in your scripts, where should we put the array? – scott528 Jan 12 '15 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.