landofcoder/module-barcodeinventory

landofcoder为Magento 2开发的扩展,生成库存产品的条形码

1.0.0 2021-08-14 09:32 UTC

This package is auto-updated.

Last update: 2024-09-16 10:18:46 UTC


README

``landofcoder/module-barcodeinventory``

兼容Magento 2.3.6、2.4.0、2.4.1、2.4.2、2.4.2-p1、2.4.3

主要功能

  • 通过库存生成条形码,多源库存
  • 使用条形码将产品添加到购物车(GraphQl、REST API)
  • 通过条形码查询产品(GraphQl、REST API)

安装

* = 在生产中请使用 --keep-generated 选项

选项1:通过composer安装(推荐)

composer require landofcoder/module-barcodeinventory

选项2:通过FTP上传安装

  • 解压zip文件到app/code/Lof
  • 安装picqer库:composer require picqer/php-barcode-generator
  • 安装mpdf库:composer require mpdf/mpdf

最后一步

  • 通过运行php bin/magento module:enable Lof_BarcodeInventory启用模块
  • 通过运行php bin/magento setup:upgrade应用数据库更新
  • 通过运行php bin/magento cache:flush清除缓存

示例Graphql

  1. 通过条形码添加产品到购物车
mutation{
  frontAddProductToCartByBarcode(
    cart_id: 22,
    barcode: "123456789"
  ){
    code
    message
  }
}
  1. 通过条形码获取产品信息

query{
  frontProductByBarcode(barcode: "123456789"){
    id
    name
    sku
		thumbnail{
      url
      label
      position
    }
    price_range{
      minimum_price{
        regular_price{
          value
          currency
        }
        final_price{
          value
          currency
        }
      }
      maximum_price{
        regular_price{
          value
          currency
        }
        final_price{
          value
          currency
        }
      }
    }
  }
}