开发者

What is StoreView1 and why is it being requested

开发者 https://www.devze.com 2023-04-09 15:15 出处:网络
Hi all i am using c# and i\'m being prompted to enter an out int storeview1 as a property of catalogProductCurrentStore(out int storevie开发者_JAVA百科w1, string sessionID, string storeview).

Hi all i am using c# and i'm being prompted to enter an out int storeview1 as a property of

catalogProductCurrentStore(out int storevie开发者_JAVA百科w1, string sessionID, string storeview).

Can anyone tell me what this is?

Thanks


You can look this up yourself. The catalogProductCurrentStore looks like a generated c# method for the catalog_product.currentstore API method. The PHP entry point for this method (in Magento 1.6) is here

#File: app/code/core/Mage/Catalog/Model/Api/Resource.php    
public function currentStore($store=null)
{
    if (!is_null($store)) {
        try {
            $storeId = Mage::app()->getStore($store)->getId();
        } catch (Mage_Core_Model_Store_Exception $e) {
            $this->_fault('store_not_exists');
        }

        $this->_getSession()->setData($this->_storeIdSessionField, $storeId);
    }

    return $this->_getStoreId();
}

So, calling this API method persists the passed in store ID into a PHP session variable. This doesn't make sense until you look at other API methods, and see that they're reading this ID back out of the session whenever they need to make a call that requires a specific Store ID.

The Magento system, and Magento objects, have a base configuration for an online store. But, you can also setup a single Magento system to serve out multiple stores, each with different products, pricing, etc. Internally, Magento keeps track of a base configuration, and then the differences each store has.

Oversimplified mostly true example: Say you had a system with two stores

Store A
Store B

which had 10,000 shoe products, and the only different was one pair of shoes cost $100 in Store A, but $200 is Store B, rather than store 20,000 show object, Magento stores 10,001. The base configuration of all those shoes, and the way that Store B is different.

To keep track of all this, Magento provides a store object. These store objects have IDs. This is relevant to you because you may make an API request for product information, but that information is going to vary from store to store. The catalog_product.currentstore method (which you API tools have generated as catalogProductCurrentStore?) lets you set a default store ID to use for requests that require an optional store id paramater.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号