开发者

Magento WSDL and products

So, I have a product that has custom options. In this case, its color. Now I'm going to be importing all of the stores product listings from a large xml file, so that is what I chose to use custom options, and not attributes. Now, I'm doing most of those from the magento api webservice.

So I have the following.

$products = $api->soap()->call( $api->session(), 'catalog_product.list' );
foreach($products as $product)
{
    print_r($product); 
    echo "<br />"; 

}

Now I can see what product has custom options from the 'has_options' field. But how do I view the custom options? The 'options_container' field has a value of "container2", what am I suppo开发者_StackOverflow社区se to do with that?

Also, when creating products using the magento api webservice.....

$api->soap()->call($api->session(), 'catalog_product.create', product_array_values);

How do I generate custom options for the products?


This is not possible, because in WSDL we do not have description product_option

    <complexType name="catalogProductCreateEntity">
        <all>
            <element name="categories" type="typens:ArrayOfString" minOccurs="0" />
            <element name="websites" type="typens:ArrayOfString" minOccurs="0" />
            <element name="name" type="xsd:string" minOccurs="0" />
            <element name="description" type="xsd:string" minOccurs="0" />
            <element name="short_description" type="xsd:string" minOccurs="0" />
            <element name="weight" type="xsd:string" minOccurs="0" />
            <element name="status" type="xsd:string" minOccurs="0" />
            <element name="url_key" type="xsd:string" minOccurs="0" />
            <element name="url_path" type="xsd:string" minOccurs="0" />
            <element name="visibility" type="xsd:string" minOccurs="0" />
            <element name="category_ids" type="typens:ArrayOfString" minOccurs="0" />
            <element name="website_ids" type="typens:ArrayOfString" minOccurs="0" />
            <element name="has_options" type="xsd:string" minOccurs="0" />
            <element name="gift_message_available" type="xsd:string" minOccurs="0" />
            <element name="price" type="xsd:string" minOccurs="0" />
            <element name="special_price" type="xsd:string" minOccurs="0" />
            <element name="special_from_date" type="xsd:string" minOccurs="0" />
            <element name="special_to_date" type="xsd:string" minOccurs="0" />
            <element name="tax_class_id" type="xsd:string" minOccurs="0" />
            <element name="tier_price" type="typens:catalogProductTierPriceEntityArray" minOccurs="0" />
            <element name="meta_title" type="xsd:string" minOccurs="0" />
            <element name="meta_keyword" type="xsd:string" minOccurs="0" />
            <element name="meta_description" type="xsd:string" minOccurs="0" />
            <element name="custom_design" type="xsd:string" minOccurs="0" />
            <element name="custom_layout_update" type="xsd:string" minOccurs="0" />
            <element name="options_container" type="xsd:string" minOccurs="0" />
            <element name="additional_attributes" type="typens:associativeArray" minOccurs="0" />
        </all>
    </complexType>

additional_attributes may have only string, to create customer object you need to have an object of option.

If you need to create customer option you should extend Mage_Catalog_Model_Product_Api_V2::create function


You can list all product custom options, using catalog_product_custom_option.list, which will return an array.

if( true == (boolean) $productInfo['has_options'] )
{
    $options = $this->call( 'catalog_product_custom_option.list', $this->productId );
}

I don't know since which Magento version this feature is available, because it isn't documented anywhere.

The API is defined in: app/code/core/Mage/Catalog/etc/api.xml

Please see my answer on "Creating Custom Options on a Product using the Magento API" for some more details on teh defined API functions.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜