zero1/magento2-rest-client

适用于 Magento 2 的 PHP rest 客户端

1.2.0 2021-04-07 07:23 UTC

README

适用于 Magento 2 的 PHP rest 客户端

示例

更多示例可以在 examples 目录中找到。

$magento = new Magento2\Client(
    'https://www.mysite.com',
    'username',
    'password'
);

$products = $magento->getProducts([
    [['type_id', 'simple', 'eq']],
    [['status', 1, 'eq']],
    [['visibility', 1, 'gt']]
]);

获取所有简单、启用且可见的产品

变更日志

  • 1.0.0
    首次提交

  • 1.0.1
    添加了方法

    • getStockItem
    • getCategories
    • getStoreViews
    • getStoreGroups
    • getCmsPages
  • 1.0.2

    • 添加了方法 getStoreConfiguration
    • 添加到文档
    • 移动示例
    • 添加示例
  • 1.0.3 添加了方法

    • getProductBySku($sku)
    • setStockLevelForSku($sku, $quantity, $item_id)
    • loadOrder($id)
    • getOrders($filter)
    • getCustomer($id)
    • addOrderComment($orderId, $status, $message, $notify)
    • getAllProducts($filters)
    • getStockInfo($sku_or_product_id)
    • updateStock($sku_or_id, $stockdata)
    • getAllGiftCards
    • updateGiftCard($code, $balance, $expiry = null)
    • getGiftCardFromOrder($order_id)
  • 1.0.5 添加了方法

    • getAllCategories($orderBy, $page, $limit)
    • getCustomer($customer_id)
    • getOrder($order_id)
    • getOrders($where, $orderBy, $page, $limit)
    • getProductBySku($sku)
    • setStockLevelForSku(($sku, $quantity, $item_id)
  • 1.0.6 添加了方法

    • getStockStatuses($sku)
    • shipOrder($orderId, $items = [], $notify = true, $appendComment = true, $comment = [], $tracks = [], $packages = [], $arguments = [])
    • getOrderItems($where = [], $orderBy = null, $page = 1, $limit = 100)
    • 添加了向 guzzle 客户端提供自定义配置的能力
  • 1.0.7

    • 将 Guzzle 版本提升以支持更新的应用程序。
  • 1.0.10 替换了属性方法

    • getProductAttributeOptions($attribute = 'string')
    • getProductAttribute($attribute = 'string')
    • addProductAttributeLabel($attribute = 'string', $label = 'string')
    • deleteProductAttributeLabel($attribute = 'string', int $label_id)
  • 1.0.18

    • 重构以允许使用自定义端点,请参阅 example11
  • 1.0.19

    • 添加了 "实体未找到" 异常,请参阅 example12
  • 1.0.20

    • 添加了更新产品的示例
    • 添加了获取产品属性选项的示例
    • 添加了更新产品功能
  • 1.1.0

    • 添加了传递令牌管理器的功能,请参阅 example15
    • 错误修复:getAllCategories 现在将递归获取所有类别,而不仅仅是第一页
    • 错误修复:getCategories 无效 URL 端点已解决
    • 功能:getProductAttributeOptions 现在可以传递一个商店代码
    • 功能:addProductAttributeLabel 现在可以传递一个要添加到新属性选项的 "商店标签" 列表
    • 错误修复:setWebsiteForProduct 无效 URL 端点已解决
    • 功能:现在可以通过 getTierPrices、removeTierPrices、setTierPrices 管理阶梯价格
    • 功能:现在可以通过 addProductToCategory 将产品添加到类别中
    • 功能:现在可以通过 getMediaGalleryEntries、addMediaGalleryEntry、updateMediaGalleryEntry、deleteMediaGalleryEntry 管理媒体相册条目