This is sample Magento 2 module. It creates "alternative" catalog with products (they called "custom products" here) based on custom EAV entity type. It also supports multistore attributes.
Each custom product contains such attributes:
- ID
- SKU (string, unique, global)
- VPN (Vendor Product Number, string, unique, global)
- Copy Write Info (text, store scope)
Module provides CRUD functionality for custom products and provides several web API endpoints
Magento 2.3.*
To install module follow next steps:
- Add
https://github.com/arendarenko/module-m2-custom-catalog/
as repository to yourcomposer.json
:
"repositories": [
...
{
"type": "vcs",
"url": "https://github.com/arendarenko/module-m2-custom-catalog"
}
]
- Run
composer require arendarenko/module-m2-custom-catalog
- Run
bin/magento setup:upgrade
Module is enabled by default.
To disable module go to: Stores → Configuration → Catalog → Custom Catalog
In order to manage custom products go to Catalog → Custom Catalog (when module is enabled).
Module provides such web API endpoints:
Returns information about custom product by it's VPN (vendor product number).
Requires such ACL permissions: Arendarenko_CustomCatalog::webapi_view
Async product update (by it's entity id as primary field) using Message Queue mechanism (works with RabbitMQ broker).
Requires such ACL permissions: Arendarenko_CustomCatalog::webapi_update
Example request body (make sure you have product with ID = 1!):
{
"customProduct":
{
"id": 1,
"sku": "PRD-12345",
"vpn": "999111",
"copy_write_info": "Actually I would prefer to be named 'copyright info', but..."
}
}
In order to start module consumer manually please run: magento queue:consumers:start CustomCatalogProductUpdate