2016-08-29 5 views
0

製品の作成時にダウンロード可能なリンクを設定しようとしましたが、製品を更新しようとしましたが動作しませんでした。 REST APIを使用してMagento/productダウンロード可能なリンクを設定する方法

は、私はそれが私にこのリンクフィールドがあるべき、それが保持すべきか、このエラーメッセージ

object(stdClass)[163] 
    public 'message' => string '%fieldName is a required field.' (length=31) 
    public 'parameters' => 
    object(stdClass)[164] 
     public 'fieldName' => string 'link' 

を与えることが

POST "/v1/products/$sku/downloadable-links" 

この

$downloadable_product_links = [ 
       [ 
       'id' => 1 
       , 'title' => json_encode(["resolution" => "1000x2000 px", "dpi" => "72", "size" => "16 KB"]) 
       , 'sort_order' => 1 
       , 'is_shareable' => 1 
       , 'price' => 15 
       , 'link_type' => 'url' 
       , 'link' => 'https://my-domain/image/DSC_0801.JPG' 
       , 'link_url' => 'https://my-domain/image/DSC_0801.JPG' 
      ], 
       [ 
        'id' => 2 
        , 'title' => json_encode(["resolution" => "150x200 px", "dpi" => "72", "size" => "18 KB"]) 
        , 'sort_order' => 2 
        , 'is_shareable' => 1 
        , 'price' => 14 
        , 'link_type' => 'url' 
        , 'link' => 'https://my-domain/image/DSC_0801.JPG' 
        , 'link_url' => 'https://my-domain/image/DSC_0801.JPG' 
      ] 
     ]; 
     $result = MagentoConn::instance()->reqPOST("/products/$sku/downloadable-links", $downloadable_product_links); 

のように、このエンドポイントを試してみました?上記の配列のキーとして置くことを試みたが、例外を与えた"no setter"

答えて

0

、誰もがそれが役に立つ

$item = [ 
      "product" => [ 
       'sku' => $sku, 
       'name' => $title, 
       'visibility' => self::VISIBILITY_BOTH, 
       "type_id" => self::TYP_DOWNLOADABLE, 
       'price' => 0 , 
       'status' => self::STATUS_ENABLED , 
       'attribute_set_id' => 9, 
       'weight' => 0, 
       "custom_attributes" => [ 
        ["attribute_code" => "url_key", "value" => $url_key], 
        ["attribute_code" => "links_purchased_separately", "value" => '1'], 
        ["attribute_code" => "category_ids", "value" => $categoryIds ], 
        ["attribute_code" => "meta_keyword", "value" => "my_keywords" ], 
        ["attribute_code" => "meta_description", "value" => "my_description" ], 
        ["attribute_code" => "tax_class_id", "value" => "0" ], // "0" => NO TAX || "2" => taxable 
       ], 
       "extension_attributes" => [ 
        "stock_item" => [ 
         "manage_stock" => 1, 
         "is_in_stock" => 1, 
         "qty" => "10" 
        ], 
        "downloadable_product_links" => [ 
         [ 
          'title' => "AAAA" 
          , 'sort_order' => 1 
          , 'is_shareable' => 1 
          , 'number_of_downloads' => 999 
          , 'price' => 15 
          , 'link_type' => 'url' 
          , 'link_url' => $link_url1 
         ],[ 
          'title' => "BBB" 
          , 'sort_order' => 2 
          , 'is_shareable' => 0 
          , 'number_of_downloads' => 0 
          , 'price' => 18 
          , 'link_type' => 'url' 
          , 'link_url' => $link_url2 
         ], 
        ] 
       ], 
      ] 
     ]; 
     $result = MagentoConn::POST("/products", $item); 
見つけることができれば、私はそれを考え出した
関連する問題