Search code examples
c#magentomagento-soap-api

Magento SOAP: how to update quantity increments?


I'm using SOAP v2 in a C# project, and I need to create many articles using catalogProductCreate.

Now, the object catalogInventoryStockItemUpdateEntity does not have the field qty_increments. Even in the documentation there is no trace of it, while all other fields in the administration and in the database are present.

How can i update this value (for the single product)? Does anybody have any idea or suggestion?


Solution

  • I finally found a solution: creating a module that adds qty_increments and qty_incrementsSpecified in the object catalogInventoryStockItemUpdateEntity.

    In this way I have the two parameters set via SOAP while creating or updating products.

    This is the main code in wsdl.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
    name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
    <types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
            <complexType name="catalogInventoryStockItemUpdateEntity">
                <all>
                    <element name="qty_increments" type="xsd:int" minOccurs="0" />
                    <element name="use_config_qty_increments" type="xsd:int" minOccurs="0" />
                </all>
            </complexType>
        </schema>
    </types>
    

    and this is wsi.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
             name="{{var wsdl.name}}"
             targetNamespace="urn:{{var wsdl.name}}">
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
            <xsd:complexType name="catalogInventoryStockItemUpdateEntity">
                <xsd:sequence>
                    <xsd:element name="qty_increments" type="xsd:int" minOccurs="0" />
                    <xsd:element name="use_config_qty_increments" type="xsd:int" minOccurs="0" />
                </xsd:sequence>
            </xsd:complexType>
        </xsd:schema>
    </wsdl:types>