php - Magento V2 API override Product Info Model V2 (Attribute not showing) -
i trying override catalogproductinfo
. trying add together attribute returning soap result. problem new attribute not showing. i've tried far prepare issue.
soap.wsdl_cache_enabled=1
, soap.wsdl_cache = 1
i tried going /tmp/ folder , deleting wsdl cache file i disabled magento cacheing , tried reindex i trying override magento product info api model v2 following...
http://www.magentocommerce.com/api/soap/catalog/catalogproduct/catalog_product.info.html
i using v2 next example. want add together attribute returning result
$prodinfo = $fclient->catalogproductinfo($fsession, $prod->product_id, null,$attributes);
this did seek override returned... first created module. here config file /app/code/local/namespace/importexport/etc/config.xml
<config> <modules> <namespace_importexport> <version>0.0.1</version> </namespace_importexport> </modules> <global> <models> <catalog> <rewrite> <product_api_v2>namespace_importexport_model_product_api_v2</product_api_v2> </rewrite> </catalog> </models> </global> </config>
in below code, seek add together associated
in basic product data. doing see if shows up. problem when create soap call. not show in returning results. module has overrided mage_catalog_model_product_api_v2
because can break within module.
/app/code/local/namespace/importexport/model/product/api/v2.php
namespace_importexport_model_product_api_v2<?php class namespace_importexport_model_product_api_v2 extends mage_catalog_model_product_api_v2 { /** * retrieve product info * * @param int|string $productid * @param string|int $store * @param stdclass $attributes * @return array */ public function info($productid, $store = null, $attributes = null, $identifiertype = null) { $product = $this->_getproduct($productid, $store, $identifiertype); if (!$product->getid()) { $this->_fault('not_exists'); } $result = array( // basic product info 'associated' =>"test", 'product_id' => $product->getid(), 'sku' => $product->getsku(), 'set' => $product->getattributesetid(), 'type' => $product->gettypeid(), 'categories' => $product->getcategoryids(), 'websites' => $product->getwebsiteids(), ); if($product->gettypeid() == "configurable") { mage::log($product); // $child_products = $product->gettypeinstance(true)->getassociatedproducts($product); // if(!empty($child_products)) { // $result['associated_products'] = ""; // foreach ($child_products $p) { // $result['associated_products'] .= $p->getdata('sku').","; // } // } } $allattributes = array(); if (isset($attributes->attributes)) { $allattributes += array_merge($allattributes, $attributes->attributes); } $_additionalattributecodes = array(); if (isset($attributes->additional_attributes)) { foreach ($attributes->additional_attributes $k => $_attributecode) { $allattributes[] = $_attributecode; $_additionalattributecodes[] = $_attributecode; } } $_additionalattribute = 0; foreach ($product->gettypeinstance(true)->geteditableattributes($product) $attribute) { if ($this->_isallowedattribute($attribute, $allattributes)) { if (in_array($attribute->getattributecode(), $_additionalattributecodes)) { $result['additional_attributes'][$_additionalattribute]['key'] = $attribute->getattributecode(); $result['additional_attributes'][$_additionalattribute]['value'] = $product->getdata($attribute->getattributecode()); $_additionalattribute++; } else { $result[$attribute->getattributecode()] = $product->getdata($attribute->getattributecode()); } } } homecoming $result; } }
i have tried adding associated
catalogproductreturnentity
within module catalog wsdl.xml file /app/code/core/mage/catalog/etc/wsdl.xml
<complextype name="catalogproductreturnentity"> <all> <element name="associated" type="xsd:string" minoccurs="0" /> <element name="product_id" type="xsd:string" minoccurs="0" /> <element name="sku" type="xsd:string" minoccurs="0" /> <element name="set" type="xsd:string" minoccurs="0" /> <element name="type" type="xsd:string" minoccurs="0" /> <element name="categories" type="typens:arrayofstring" minoccurs="0" /> <element name="websites" type="typens:arrayofstring" minoccurs="0" /> <element name="created_at" type="xsd:string" minoccurs="0" /> <element name="updated_at" type="xsd:string" minoccurs="0" /> <element name="type_id" type="xsd:string" 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>
still nothing. have soap cacheing turned off. have magento cacheing turned off. doing wrong ??
[update] despite of this, nil changes. attribute associated
1 looking for. made post on friday. next mon tried out , associated attribute show out of no where. there new problem now. trying add together new attribute getting same issue. suggestions ??
figured out. php soap has server , client class. must create sure clear cache of soap requester, , response. in other words, server uses soap calls, find cache , clear , server receives cache calls, clear well. both must cleared total updates. not soap server.
php api magento soap
No comments:
Post a Comment