Follow

Magento 1.3 (a known bug and its quick solution)

It seems that you are currently using Magento version 1.3 which contains a small bug.

The solution is an easy one. This is all you need to do:

1. Open the file - app/code/core/Mage/Catalog/Model/Product/Api/V2.php
2. Add the following line to line 90 –
,'website_ids' => $product->getWebsiteIds()

So instead of the following text:
        foreach ($collection as $product) {
//            $result[] = $product->getData();
            $result[] = array( // Basic product data
                'product_id' => $product->getId(),
                'sku'        => $product->getSku(),
                'name'       => $product->getName(),
                'set'        => $product->getAttributeSetId(),
                'type'       => $product->getTypeId(),
                'category_ids'       => $product->getCategoryIds()
            );
        }

it should look like this (including a comma before the line):
        foreach ($collection as $product) {
//            $result[] = $product->getData();
            $result[] = array( // Basic product data
                'product_id' => $product->getId(),
                'sku'        => $product->getSku(),
                'name'       => $product->getName(),
                'set'        => $product->getAttributeSetId(),
                'type'       => $product->getTypeId(),
                'category_ids'       => $product->getCategoryIds()
,'website_ids' => $product->getWebsiteIds()


            );
        }

3. Also add in - app/code/core/Mage/Catalog/etc/wsdl.xml
the Property minOccurs="0" on
types/schema/complexType[@name='catalogProductEntity']/element[@name='website_ids']
So instead of the following text:
<complexType name="catalogProductEntity">

                <all>
                    <element name="product_id" type="xsd:string" />
                    <element name="sku" type="xsd:string" />
                    <element name="name" type="xsd:string" />
                    <element name="set" type="xsd:string" />
                    <element name="type" type="xsd:string" />
                    <element name="category_ids" type="typens:ArrayOfString" />
                    <element name="website_ids" type="typens:ArrayOfString"  />
                </all>
            </complexType>

it should look like this:
            <complexType name="catalogProductEntity">
                <all>
                    <element name="product_id" type="xsd:string" />
                    <element name="sku" type="xsd:string" />
                    <element name="name" type="xsd:string" />
                    <element name="set" type="xsd:string" />
                    <element name="type" type="xsd:string" />
                    <element name="category_ids" type="typens:ArrayOfString" />
                    <element name="website_ids" type="typens:ArrayOfString" minOccurs="0" />
                </all>
            </complexType>

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk