0

Magento バージョン 1.7 で Web ショップをセットアップしました。次のタスクは、v2 Soap API を使用して製品をインポートすることです。これまでのところ、作成された製品のすべてのカスタム属性が空のままであることを除いて、すべてが機能しているようです。名前、SKU、価格、説明など、他のすべては正常に機能します。私のスクリプトはasp.netで実行されるため、PHPコードはありませんが、多かれ少なかれ似ていると思います。属性が製品に割り当てられている場所で使用するスニペットを次に示します。

dim create as new catalogProductCreateEntity
create.name = "Test"
create.price = "11.1100"
create.description = "test description"

dim additional(0) as associativeEntity
dim attribute as new associativeEntity
attribute.key = "manufacturer"
attribute.key = "xyz"
additional(0) = attribute

create.additional_attributes = additional

この場合、単純なテキスト フィールドは値「xyz」を受け取る必要があります。過去にセットアップした他の Magento ストアでも同じ手順を使用していますが、問題なく動作します。唯一の違いは、これらのショップが Magento バージョン 1.5 を使用していることです。これはAPIのバグでしょうか?

4

2 に答える 2

0

「xyz」は、associativeEntity の .value に入る必要があります。

dim additional(0) as associativeEntity
dim attribute as new associativeEntity
attribute.key = "manufacturer"
attribute.value = "xyz" 
additional(0) = attribute

お役に立てれば。

于 2012-10-30T20:03:09.327 に答える
0

私はC#でこれを成功させました。以下はコードです

     private void getAdditionalAttributes()
            {
                string skuNumber="S00001";
                MagentoService mservice = new MagentoService();
                string sessionkey = "";
                try
                {
                    sessionkey = mservice.login("apiuser", "apipassword");


                }
                catch (Exception exp)
                {

                    //Error
                }

                try
                {
                    catalogProductRequestAttributes fetchattrib = new catalogProductRequestAttributes();
                    // it will only populate the attributes that you ask for
                    fetchattrib.attributes = new string[] { "name", "description", "short_description" };
// Additional Attribute
                    fetchattrib.additional_attributes = new string[] { "ismemo","color" };

    catalogProductReturnEntity prod =  MagentoConnectivity.magService.catalogProductInfo(sessionkey, skuNumber, "", fetchattrib, "sku");


                    foreach (var item in prod.additional_attributes)
                    {
                        MessageBox.Show("=> Key: " + item.key + "\t Attribute Value=" + item.value + "\n");
                    }

                }
                catch (Exception exp)
                {

                    MessageBox.Show("=> Exception in getting Additional Attributes \n" + exp.Message + "\n");
                    return;


                }
            }
于 2013-12-24T17:13:00.030 に答える