Jump to content

Edit History

rcopenhagen

rcopenhagen

I think the corect way is to fallow steps like this :

Step 1

First Add feature with following request.

url http://localhost/prestashop/api/product_features?schema=blank

Quote

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature>
        <id></id>
        <position></position>
        <name>
            <language id="1"></language>
        </name>
    </product_feature>
</prestashop>

 

Need to complet just <language> tag with Name of attribute i put a exemple :

Quote

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature>
        <id></id>
        <position></position>
        <name>
            <language id="1">Power</language>
        </name>
    </product_feature>
</prestashop>

 

response return :

Quote

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature>
        <id>
            <![CDATA[4]]>
        </id>
        <position>
            <![CDATA[3]]>
        </position>
        <name>
            <language id="1" xlink:href="http://ochelari7.local/api/languages/1">
                <![CDATA[Power]]>
            </language>
        </name>
    </product_feature>
</prestashop>

 

Pick id response => exemple 4 and use it in next step

 

Step 2

URL : http://localhost/prestashop/api/product_feature_values?schema=blank

Quote

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature_value>
        <id></id>
        <id_feature></id_feature>
        <custom></custom>
        <value>
            <language id="1"></language>
        </value>
    </product_feature_value>
</prestashop>

 

Need to complet <language> tag with value of attribute and id_feature with id from step 1 <custom> tag can be complet with 0 or 1.

0 means in back office will view in select field and can be easy reused

1 means can't be reuse in back office

 exemple :

Quote

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature_value>
        <id></id>
        <id_feature>4</id_feature>
        <custom>1</custom>
        <value>
            <language id="1">1000W</language>
        </value>
    </product_feature_value>
</prestashop>

 

response return :

Quote

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature_value>
        <id>
            <![CDATA[49]]>
        </id>
        <id_feature xlink:href="http://ochelari7.local/api/product_features/4">
            <![CDATA[4]]>
        </id_feature>
        <custom>
            <![CDATA[1]]>
        </custom>
        <value>
            <language id="1" xlink:href="http://ochelari7.local/api/languages/1">
                <![CDATA[1000 W]]>
            </language>
        </value>
    </product_feature_value>
</prestashop>

 

Pick id response => exemple 49 and use it in next step

Step 3

Create product with attribute selected

Have two id attribute from  

Step 1 : id feature attribute

Step 2  : id feature attribute value

I will pick requst demo from top of post and i will complet it with values for exemple :

Quote

<?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink">

<product>

<price required="true" format="isPrice">1100</price>

<link_rewrite required="true" maxSize="128" format="isLinkRewrite">

    <language id="1" xlink:href="http://localhost/prestashop_16/api/languages/1" format="isUnsignedId" >www.ankit_100.com</language>

</link_rewrite>

<name required="true" maxSize="128" format="isCatalogName">

    <language id="1" xlink:href="http://localhost/prestashop_16/api/languages/1" format="isUnsignedId" >ankit_104</language>

</name>

<associations>

    <product_features nodeType="product_feature" api="product_features">
                <product_feature>
                    <id required="true">4</id>
                    <id_feature_value xlink:href="http://ochelari7.local/api/product_feature_values/" required="true">49</id_feature_value>
                </product_feature>
    </product_features>

</associations>

</product>

</prestashop>

 

rcopenhagen

rcopenhagen

I think the corect way is to fallow steps like this :

Step 1.

First Add feature with following request.

url http://localhost/prestashop/api/product_features?schema=blank

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature>
        <id></id>
        <position></position>
        <name>
            <language id="1"></language>
        </name>
    </product_feature>
</prestashop>

 

Need to complet just <language> tag with Name of attribute i put a exemple :

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature>
        <id></id>
        <position></position>
        <name>
            <language id="1">Power</language>
        </name>
    </product_feature>
</prestashop>

 

response return :

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature>
        <id>
            <![CDATA[4]]>
        </id>
        <position>
            <![CDATA[3]]>
        </position>
        <name>
            <language id="1" xlink:href="http://ochelari7.local/api/languages/1">
                <![CDATA[Power]]>
            </language>
        </name>
    </product_feature>
</prestashop>

 

Pick id response => exemple 4 and use it in next step

 

Step 2:

URL : http://localhost/prestashop/api/product_feature_values?schema=blank

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature_value>
        <id></id>
        <id_feature></id_feature>
        <custom></custom>
        <value>
            <language id="1"></language>
        </value>
    </product_feature_value>
</prestashop>

Need to complet <language> tag with value of attribute and id_feature with id from step 1 <custom> tag can be complet with 0 or 1.

0 means in back office will view in select field and can be easy reused

1 means can't be reuse in back office

 exemple :

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature_value>
        <id></id>
        <id_feature>4</id_feature>
        <custom>1</custom>
        <value>
            <language id="1">1000W</language>
        </value>
    </product_feature_value>
</prestashop>

 

response return :

<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
    <product_feature_value>
        <id>
            <![CDATA[49]]>
        </id>
        <id_feature xlink:href="http://ochelari7.local/api/product_features/4">
            <![CDATA[4]]>
        </id_feature>
        <custom>
            <![CDATA[1]]>
        </custom>
        <value>
            <language id="1" xlink:href="http://ochelari7.local/api/languages/1">
                <![CDATA[1000 W]]>
            </language>
        </value>
    </product_feature_value>
</prestashop>

Pick id response => exemple 49 and use it in next step

Step 3 :

Create product with attribute selected

Have two id attribute from  

Step 1 : id feature attribute

Step : id feature attribute value

I will pick requst demo from top of post and i will complet it with value for exemple

<?xml version="1.0" encoding="UTF-8"?> <prestashop xmlns:xlink="http://www.w3.org/1999/xlink">

<product> <price required="true" format="isPrice">1100</price>

<link_rewrite required="true" maxSize="128" format="isLinkRewrite">

    <language id="1" xlink:href="http://localhost/prestashop_16/api/languages/1" format="isUnsignedId" >www.ankit_100.com</language>

</link_rewrite>

<name required="true" maxSize="128" format="isCatalogName">

    <language id="1" xlink:href="http://localhost/prestashop_16/api/languages/1" format="isUnsignedId" >ankit_104</language>

</name>

<associations>

    <product_features nodeType="product_feature" api="product_features">
                <product_feature>
                    <id required="true">4</id>
                    <id_feature_value xlink:href="http://ochelari7.local/api/product_feature_values/" required="true">49</id_feature_value>
                </product_feature>
    </product_features>

</associations>

</product>

</prestashop>

×
×
  • Create New...