init
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" ?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
|
||||
<router id="admin">
|
||||
<route id="stemcell_subitem" frontName="stemcell_subitem">
|
||||
<module name="Stemcell_SubItemProduct" before="Magento_Backend"/>
|
||||
</route>
|
||||
</router>
|
||||
</config>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" ?>
|
||||
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
|
||||
<table name="subitem_product" resource="default" engine="innodb" comment="magento中简单产品包含的小货号,一个字产品可能包含多个小货号">
|
||||
<column xsi:type="int" name="subitem_id" unsigned="true" nullable="false" identity="true" comment="Entity Id"/>
|
||||
<constraint xsi:type="primary" referenceId="PRIMARY">
|
||||
<column name="subitem_id"/>
|
||||
</constraint>
|
||||
<column name="product_id" nullable="false" xsi:type="int" comment="product_id" identity="false" unsigned="true"/>
|
||||
<index referenceId="STEMCELL_SUBITEM_PRODUCT_ID" indexType="btree">
|
||||
<column name="product_id"/>
|
||||
</index>
|
||||
|
||||
<column name="sub_product_id" nullable="true" xsi:type="int" comment="sub_product_id" identity="false" unsigned="true" disabled="true" />
|
||||
<column name="quality" nullable="true" xsi:type="int" comment="quality in parent product" identity="false" unsigned="true" disabled="true" />
|
||||
|
||||
<column name="sub_sku" nullable="false" xsi:type="varchar" comment="小货号sku, 不在magento的product里" />
|
||||
<index referenceId="SUBITEM_SUB_SKU" indexType="btree">
|
||||
<column name="sub_sku"/>
|
||||
</index>
|
||||
<column name="bundle_qty" nullable="false" xsi:type="int" comment="一个简单产品包含的小货号数量" identity="false" unsigned="false"/>
|
||||
<column name="stock_qty" nullable="false" xsi:type="int" comment="小货号库存" identity="false" unsigned="false"/>
|
||||
<constraint xsi:type="unique" referenceId="product_id_sub_sku">
|
||||
<column name="product_id"/>
|
||||
<column name="sub_sku"/>
|
||||
</constraint>
|
||||
</table>
|
||||
</schema>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" ?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<type name="Magento\Framework\Console\CommandList">
|
||||
<arguments>
|
||||
<argument name="commands" xsi:type="array">
|
||||
<item name="ImportSubItemProduct" xsi:type="object">Stemcell\SubItemProduct\Console\Command\SubItemImport</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
<preference for="Stemcell\SubItemProduct\Api\SubItemRepositoryInterface" type="Stemcell\SubItemProduct\Model\SubItemRepository"/>
|
||||
<preference for="Stemcell\SubItemProduct\Api\Data\SubItemInterface" type="Stemcell\SubItemProduct\Model\SubItem"/>
|
||||
<preference for="Stemcell\SubItemProduct\Api\Data\SubItemSearchResultsInterface" type="Magento\Framework\Api\SearchResults"/>
|
||||
</config>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
|
||||
|
||||
<event name="checkout_submit_all_after">
|
||||
<observer name="sub_item" instance="Stemcell\SubItemProduct\Observer\SubtractSubItemInventory"/>
|
||||
</event>
|
||||
|
||||
<event name="order_cancel_after">
|
||||
<observer name="RevertSubItemInventory" instance="Stemcell\SubItemProduct\Observer\RevertSubItemInventory"/>
|
||||
</event>
|
||||
</config>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" ?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Stemcell_SubItemProduct">
|
||||
<sequence module="Magento_Catalog" />
|
||||
</module>
|
||||
</config>
|
||||
Reference in New Issue
Block a user