Comment 4 for bug 834619

Revision history for this message
Nicolas TRUBERT (nicolas-trubert) wrote :

Hi all,

I have same kind of issue after magento upgrade on 1.6.

It seems that there are difference to get product id on magento side according to some web_service.

I modify magento core to test for tierce_price.update and product.update and it works.
It seems that it works around product by Id or sku ??

../app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php
/* Magento 1.6 source
    protected function _initProduct($productId, $identifierType = null)
    {
        $product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), $identifierType);
        if (!$product->getId()) {
            $this->_fault('product_not_exists');
        }

        return $product;
    }
*/
/* My modif */
    protected function _initProduct($productId, $identifierType = null)
    {
        $product = Mage::helper('catalog/product')->getProduct($productId, $this->_getStoreId($store), $identifierType);

        if (!$product->getId()) {
            if ($identifierType === null) {
                $identifierType = 'sku';
                $idBySku = $product->getIdBySku($productId);
                if ($idBySku) {
                    $productId = $idBySku;
                    $product->load($productId);
                }
            }
            if (!$product->getId()) {
                $this->_fault('product_not_exists');
            }
        }

        return $product;
    }
/**/

../app/code/core/Mage/Catalog/Model/Product/Api.php

/* Magento 1.6 source
    public function update($productId, $productData, $store = null, $identifierType = null)
    {

        $product = $this->_getProduct($productId, $store, $identifierType);
        if (!$product->getId()) {
            $this->_fault('not_exists');
        }
*/
/* My modif */
    public function update($productId, $productData, $store = null, $identifierType = null)
    {

        $product = $this->_getProduct($productId, $store, $identifierType);
        if (!$product->getId()) {

            if ($identifierType === null) {
                $identifierType = 'sku';
                $idBySku = $product->getIdBySku($productId);
                if ($idBySku) {
                    $productId = $idBySku;
                    $product->load($productId);
                }
            }
            if (!$product->getId()) {
                $this->_fault('product_not_exists');
            }
            /**/

Regards.