ict-master-pk/pricemeter-products-php

用于管理特定商店产品的 Price Meter PHP API

v1.2.1 2021-09-24 10:15 UTC

This package is auto-updated.

Last update: 2024-09-21 12:36:37 UTC


README

用于管理特定商店产品的 Price Meter PHP API

需求

  • PHP >= 7.2

安装

composer require ict-master-pk/pricemeter-products-php

对于 PHP >= 5.6

composer require ict-master-pk/pricemeter-products-php:dev-guzzle_655

API令牌

用法

$product = new \Pricemeter\Model\Product($apiToken);
$product = $product->fill([
    'id' => 1,
    'sku' => 'dummy',
    'upc' => "some upc",
    'title' => 'Dummy Product title',
    'brand' => 'Dummy brandings',
    'category' => 'Computers > Battery',
    'price' => 350.4,
    'discounted_price' => 300.2,
    'image_url' => 'https://dummystore.pk/detail_img.jpg',
    'url' => 'https://dummystore.pk/q/dummy',
    'description' => "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
    'availability' => 1,
    'rating' => 4.5,
    'keywords' => 'dummy, products, items'
]);

# To Insert
$product->insert();

# To Update
$product->update();

# To Delete
$product->delete();
# OR do this in more convenient way as below
(new \Pricemeter\Model\Product($apiToken))->fill([
    'id' => 1
])->delete();