dqellle310167 2019-07-08 09:49
浏览 119
已采纳

Shopify发送带有shopify选项的产品

$productShopify = array(
    "body_html" => $product->description[(int)$id_lang],
    "created_at" => $date_now,
    "handle" => $product->name[(int)$id_lang],
    "id" => $product->id,
        "images"=>array(array("src"=>$ProducDATA['image']),
        //  array("src"=>$imageShopify[0]),
            array("src"=>$imageShopify[1])
        ),
    "options" => array("name" => $group_name[0],array("name" => $group_name[1])),
    "product_type" => $ProducDATA['Category_1'],
    "published_at" => $date_now,
    "published_scope" => "global",
    "tags" => $Tag,
    "template_suffix" => null,
    "title" => $product->name[(int)$id_lang],
    "variants" => array(
        array(
            "barcode" => $product->ean13,
            "grams" => $product->weight,
            "option1" => $attribute_name[0][1],
            "price" => $product->price,
            "sku" => $ProducDATA['manufacturer_reference'].'-1',
            "title" => $product->name[(int)$id_lang],
           // "id" => 808950810,
            "product_id" => $product->id,
            "inventory_quantity" => $product->id
        ),
        array(
            "barcode" => $product->ean13,
            "grams" => $product->weight,
            "option2" => $attribute_name[0][2],
            "price" => $product->price,
            "sku" => $ProducDATA['manufacturer_reference'].'-2',
            "title" => $product->name[(int)$id_lang],
           // "id" => 808950810,
            "product_id" => $product->id,
            "inventory_quantity" => $product->id
        ),
        array(
            "barcode" => $product->ean13,
            "grams" => $product->weight,
            "option1" => $attribute_name[1][1],
            "price" => $product->price,
            "sku" => $ProducDATA['manufacturer_reference'].'-3',
            "title" => $product->name[(int)$id_lang],
           // "id" => 808950810,
            "product_id" => $product->id,
            "inventory_quantity" => $product->id
        ),
        array(
            "barcode" => $product->ean13,
            "grams" => $product->weight,
            "option2" => $attribute_name[1][2],
            "price" => $product->price,
            "sku" => $ProducDATA['manufacturer_reference'].'-4',
            "title" => $product->name[(int)$id_lang],
           // "id" => 808950810,
            "product_id" => $product->id,
            "inventory_quantity" => $product->id
        )
    ),
    "vendor" => $ProducDATA['marque'],
);

I can not find the solution to send a product with several options on shopify, syntax error

I try everything but impossible to understand the principle if you have an idea I can send the product on shopify with 1 option but not +

I can send the product on shopify with only 1 option but I do not start with Php be indulgent

  • 写回答

1条回答 默认 最新

  • dqy92287 2019-07-18 16:36
    关注

    Each of your 4 variants should have a value for both option1 and an option2. For example:

           array(
                "barcode" => $product->ean13,
                "grams" => $product->weight,
                "option1" => $attribute_name[0][1],
                "option2" => $attribute_name[0][2],
                "price" => $product->price,
                "sku" => $ProducDATA['manufacturer_reference'].'-1',
                "title" => $product->name[(int)$id_lang],
               // "id" => 808950810,
                "product_id" => $product->id,
                "inventory_quantity" => $product->id
            )
    

    Also, you should check the response code and response body from the Shopify API. If your request fails, it will contain information that is useful in tracking down the error.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)