Magento WSDL 和产品

发布于 2024-10-06 16:20:36 字数 626 浏览 2 评论 0原文

所以,我有一个具有自定义选项的产品。在这种情况下,它的颜色。现在,我将从一个大型 xml 文件导入所有商店产品列表,因此我选择使用自定义选项,而不是属性。现在,我正在通过 magento api web 服务完成大部分工作。

所以我有以下内容。

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

}

现在我可以从“has_options”字段中查看哪些产品具有自定义选项。但如何查看自定义选项呢? “options_container”字段的值为“container2”,我该怎么办?

另外,当使用 magento api webservice 创建产品时......

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

如何为产品生成自定义选项?

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 suppose 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尐偏执 2024-10-13 16:20:36

这是不可能的,因为在 WSDL 中,我们没有描述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 可能只有字符串,要创建客户对象,您需要有一个选项对象。

如果您需要创建客户选项,您应该扩展 Mage_Catalog_Model_Product_Api_V2::create 函数

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

め可乐爱微笑 2024-10-13 16:20:36

您可以使用catalog_product_custom_option.list列出所有产品自定义选项,这将返回一个数组。

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

我不知道从哪个 Magento 版本开始可以使用此功能,因为它没有在任何地方记录。

API 定义于:app/code/core/Mage/Catalog/etc/api.xml

请参阅我对“创建自定义选项”的回答关于使用 Magento API 的产品”,了解有关定义的 API 函数的更多详细信息。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文