soneritics / beslistshopitem
Beslist.nl ShopItem的PHP实现
dev-master
2015-11-24 12:09 UTC
Requires
- php: >=5.5.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-23 17:52:39 UTC
README
- @Soneritics - Jordi Jolink
简介
Beslist.nl平台通过数据源导入网店的商品信息。数据源的创建、下载和处理都是非实时的过程。因此,开发了一个API,允许近实时地更新库存项的多个属性。在这个API的上下文中,这些网店商品被称为“shopitems”,而这个API被称为“Shopitem API”。
最低要求
- PHP 5.6
- 编译了cURL的PHP
示例
# Initialisation $restConfig = new RESTConfig('your-api-key-here'); $shopItem = new ShopItem($restConfig); # Fetching Shops $shops = $shopItem->getShops(); print_r($shops); // array of Shop objects # Looping shops and fetching items $items = ['1234', '1235', '1236']; foreach ($shops as $shop) { $items = $shopItem->getItems($items); print_r($items); // array of Item objects } # Updating an item $item = $shopItem->getItem($shop, '1234'); if ($item->isValid()) { $item ->setPrice(24.95) ->setDiscountPrice(19.99) ->setDeliveryCostNl(0) ->setDeliveryCostBe(1.95); $saved = $item->save(); var_dump($saved); // True or false }