Magento 1.5, numeric SKUs and productIdentifierType

后端 未结 2 1228
忘了有多久
忘了有多久 2021-01-15 02:27

In Magento 1.5, accessing the catalogProductInfo API call from C# like this works with non-numeric SKUs:

catalogProductRequestAttributes fetchattrib = new ca         


        
相关标签:
2条回答
  • 2021-01-15 03:16

    Short answer is that there's a bug somewhere preventing the last param of product.update from being set properly (or maybe Varien haven't yet implemented it), which also presents a problem for the method product.info.

    A quick workaround (if you don't mind losing the option to update by ID) is just to set the $identifierType in the Product API update() method ):

    In app/code/core/Mage/Catalog/Model/Product/Api.php l.198

    public function update($productId, $productData, $store = null, $identifierType = 'sku')
    

    And finally load the product within the if ($idBySku) condition of the method getProduct() around l.427 of app/code/core/Mage/Catalog/Helper/Product.php

    $productId = $idBySku;
    $product->load($productId);
    

    It's a bit of a fudge. I'll have a look for a better workaround as an override; otherwise, maybe someone else can post a better solution.

    0 讨论(0)
  • 2021-01-15 03:20

    There is a workaround for pure numeric or mixed SKU, that works quiet well for me.

    Just add a whitespace at the end of your SKU. Magento will interpret the value as a SKU, because whitespace is non numeric. Internaly Magento trims the whitespace later

    This works perfectly from Magento 1.4.x - 1.9. (Edit: Thanks at Brett for testing with 1.9)

    Example:

        catalogProductReturnEntity ret = m_magentoClient.catalogProductInfo(sessionId, sku+" ", storeView, fetchattrib, productIdentifierType); 
    
    0 讨论(0)
提交回复
热议问题