Magento API adding a new complex type to catalogProductCreateEntity (extra attributes not being passed) -
i trying extend magento pass configurable products. want do extending catalogproductcreateentity
. did created own module , extended catalog modules wsdl adding next in <types>
tag. so...
<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>
i created new element within catalogproductcreateentity
called super attribute. type catalogproductsuperattributeentityarray
array of catalogproductsuperattributeentity
both defined above. when phone call soap server, so...
foreach($prodinfo->super_attributes $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 ); }
all elements populated. looks this...
[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 ) )
now, i've extended mage_catalog_model_product_api_v2
class handle new attribute. problem when step through code, magento recieves 2 attributes within array.
all other attributes ignored. i've empty soap cache on server , client side yet nil seems change.
figured out...
<element name="super_attributes" type="typens:catalogproductlinkentityarray" minoccurs="0" />
should newly created typens
...
<element name="super_attributes" type="typens:catalogproductsuperattributeentityarray" minoccurs="0" />
within complex type catalogproductcreateentity
api magento soap
No comments:
Post a Comment