雪中悍刀行 / magento2-attribute-option-code
v3.2.0
2023-09-26 10:26 UTC
Requires
- php: ^7.4||^8.1
- magento/framework: ^103
- magento/module-catalog: ^104
- magento/module-eav: ^102
Requires (Dev)
- rector/rector: ^0.8.56
- dev-master
- v3.2.0
- v3.1.0
- v3.0.2
- v3.0.1
- v3.0.0
- 2.x-dev
- v2.1.1
- v2.1.0
- 2.0.2
- v2.0.1
- v2.0.0
- v1.8.3
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.2
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.0
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
- dev-upgrade/PHP-8-1-compat
- dev-fix/constructor-bug
- dev-fix/option-add-update
This package is auto-updated.
Last update: 2024-08-26 12:20:20 UTC
README
描述
Magento 2模块,用于为属性选项添加唯一代码。现在远程客户端可以通过标识符(属性选项代码)创建属性选项,客户端可以指定并稍后参考产品保存时的标识符。使用客户端创建的属性选项也可以通过指定属于该属性选项的属性选项代码来删除。请参考端点表以获取uri端点路径。
Magento版本
- 2.3.x使用2.x标签
- 2.4.x使用master
先决条件
- PHP 5.6或更高版本
- Composer (https://getcomposer.org.cn/download/)。
magento/framework
100或更高版本magento/module-eav
100或更高版本magento/module-catalog
101或更高版本
安装
composer require snowio/magento2-attribute-option-code
php bin/magento module:enable SnowIO_AttributeOptionCode
php bin/magento setup:upgrade
使用方法
端点表
创建带代码的属性选项
请求消息正文(JSON)
{ "entity_type" : 4, "attribute_code" : "testAttribute", "option" : { "label": "foo", "value": "bar", "sort_order": 0, "is_default": true, "store_labels": [ { "store_code" : "testStore", "label": "Foo Label Test" } ] } }
消息正文描述
entity_type
整数 : 与属性选项对应的实体类型。attribute_code
字符串 : 与选项对应的属性代码。选项
:label
字符串 : 选项标签value
字符串 : 选项代码sort_order
整数 : 选项的排序顺序is_default
布尔值 : 默认选项标志store_labels
1..nstore_code
字符串 : 选项的店铺代码label
字符串 : 选项标签
删除属性选项
:entityType
整数 : 与属性选项对应的实体类型。:attributeCode
字符串 : 与属性选项对应的属性代码。:optionCode
字符串 : 属性选项代码。
在产品中指定属性选项
URI参数
:sku
字符串 : 产品sku。
请求消息正文(JSON)
{ "product": { "type_id": "simple", "sku": "test-from-snowio-simple", "attribute_set_id": 4, "name": "test from snow.io simple", "price": 10, "visibility": 4, "status": 1, "custom_attributes": { "testAttribute": "bar" } } }
注意自定义属性testAttribute
的value
是属性选项代码bar
。
许可证
此软件根据MIT许可证授权。 查看许可证