重定向/重定向-sdk

此包最新版本(1.0.0)没有可用的许可证信息。

重定向 SDK

1.0.0 2019-05-29 09:12 UTC

This package is auto-updated.

Last update: 2024-09-12 07:30:16 UTC


README

概述

重定向 SDK 是一个用于电子商务平台的软件开发工具,简化了重定向扩展的实现。

最低要求

重定向 SDK 至少需要 PHP 版本 7.1.0 或更高。

如何安装

在您的平台根目录下克隆仓库。

示例

用于 sendProduct 实现的产品类

示例请求

use Retargeting/Product;

$brand = [
     'id' => 8, 
     'name' => 'Apple'
];

$category = [
    [
      "id" => 20,
      "name" => "Desktop",
      "parent" => false,
      "breadcrumb" => []
    ],
    [
      "id" => 28,
      "name" => "Monitors",
      "parent" => 25,
      "breadcrumb" => [
          ["id" => 25, "name" => "Components", "parent" => false]     
    ]
];

$inventory = [
    'variations' => true,
    'stock' => [
        'Red' => true,
        'Small' => false,
        'Medium' => true,
    ]
];

$additionalImages = [
    "https:///upload/image/catalog/demo/canon_logo.jpg",
    "https:///upload/image/catalog/demo/hp_1.jpg",
    "https:///upload/image/catalog/demo/compaq_presario.jpg",
    "https:///upload/image/catalog/demo/canon_eos_5d_1.jpg",
    "https:///upload/image/catalog/demo/canon_eos_5d_2.jpg"
];

$product = new Product();
$product->setId(42);
$product->setName('Shoes');
$product->setUrl('https:///upload/test');
$product->setImg('https:///upload/image/catalog/demo/apple_cinema_30.jpg');
$product->setPrice(122);
$product->setPromo(90);
$product->setBrand($brand);
$product->setCategory($category);
$product->setInventory($inventory);
$product->setAdditionalImages($additionalImages)

echo $product->getData();

示例响应

[
    {
        "id": 42,
        "name": "Apple Cinema 30\"",
        "url": "https:///upload/test",
        "img": "https:///upload/image/catalog/demo/apple_cinema_30.jpg",
        "price": 122,
        "promo": 90,
        "brand": {
            "id": "8",
            "name": "Apple"
        },
        "category": [
            {
                "id": "20",
                "name": "Desktops",
                "parent": false,
                "breadcrumb": []
            },
            {
                "id": "28",
                "name": "Monitors",
                "parent": "25",
                "breadcrumb": [
                    {
                        "id": "25",
                        "name": "Components",
                        "parent": false
                    }
                ]
            }
        ],
        "inventory": {
            "variations": true,
            "stock": {
                "Small": true,
                "Medium": true,
                "Large": true,
                "Checkbox 1": true,
                "Checkbox 2": true,
                "Checkbox 3": true,
                "Checkbox 4": true,
                "Red": true,
                "Blue": true,
                "Green": true,
                "Yellow": true
            }
        },
        "images": [
            "https:///upload/image/catalog/demo/canon_logo.jpg",
            "https:///upload/image/catalog/demo/hp_1.jpg",
            "https:///upload/image/catalog/demo/compaq_presario.jpg",
            "https:///upload/image/catalog/demo/canon_eos_5d_1.jpg",
            "https:///upload/image/catalog/demo/canon_eos_5d_2.jpg"
        ]
    }
]