我正在尝试扩展 magento 以传递可配置产品。我想通过扩展来做到这一点catalogProductCreateEntity
。我所做的是创建自己的模块并通过在<types>
标签中添加以下内容来扩展目录模块 wsdl。像这样...
<complexType name="catalogProductCreateEntity">
<all>
<element name="categories" type="typens:ArrayOfString" minOccurs="0" />
<element name="websites" type="typens:ArrayOfString" minOccurs="0" />
<element name="associated" type="typens:ArrayOfString" minOccurs="0" />
<element name="super_attributes" type="typens:catalogProductLinkEntityArray" 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:ArrayOfString" 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>
<complexType name="catalogProductSuperAttributeEntity">
<all>
<element name="attribute_id" type="xsd:string" minOccurs="0"/>
<element name="product_super_attribute_id" type="xsd:string" minOccurs="0"/>
<element name="product_id" type="xsd:string" minOccurs="0"/>
<element name="position" type="xsd:string" minOccurs="0"/>
<element name="label" type="xsd:string" minOccurs="0"/>
<element name="attribute_code" type="xsd:string" minOccurs="0"/>
<element name="use_default" type="xsd:string" minOccurs="0"/>
<element name="prices" type="xsd:string" minOccurs="0"/>
</all>
</complexType>
<complexType name="catalogProductSuperAttributeEntityArray">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="typens:catalogProductSuperAttributeEntity[]"/>
</restriction>
</complexContent>
</complexType>
catalogProductCreateEntity
我在名为 super 属性中创建了一个新元素。它的类型是which 是我也在上面定义catalogProductSuperAttributeEntityArray
的数组。catalogProductSuperAttributeEntity
当我调用肥皂服务器时,我会这样做......
foreach($prodInfo->super_attributes as $super_att) {
$sProdInfo['super_attributes'][] = array(
'attribute_id'=>$super_att->attribute_id,
'product_super_attribute_id'=>$super_att->product_super_attribute_id,
'product_id'=>$super_att->product_id,
'position'=>$super_att->position,
'label'=>$super_att->label,
'attribute_code'=>$super_att->attribute_code,
'use_default'=>$super_att->use_default,
'prices'=>12
);
}
所有元素都已填充。看起来像这样……
[super_attributes] => Array
(
[0] => Array
(
[attribute_id] => 159
[product_super_attribute_id] => 207
[product_id] => 4659
[position] => 0
[label] => Shirt Size
[attribute_code] => shirt_size
[use_default] => 0
[prices] => 12
)
[1] => Array
(
[attribute_id] => 70
[product_super_attribute_id] => 208
[product_id] => 4659
[position] => 0
[label] => Manufacturer
[attribute_code] => manufacturer
[use_default] => 0
[prices] => 12
)
)
现在,我还扩展了这个Mage_Catalog_Model_Product_Api_V2
类来处理这个新属性。我的问题是当我单步执行代码时,magento 只收到数组中的 2 个属性。
- product_id
- 位置
所有其他属性都被忽略。我还清空了服务器和客户端的肥皂缓存,但似乎没有任何改变。