Module DigressivePrice

This commit is contained in:
2021-04-08 15:57:38 +02:00
parent 99f3749535
commit f608c9332b
17041 changed files with 3164200 additions and 14 deletions

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<loop name="digressive" class="DigressivePrice\Loop\DigressiveLoop" />
</loops>
<forms>
<form name="digressiveprice.create" class="DigressivePrice\Form\CreateDigressivePriceForm" />
<form name="digressiveprice.update" class="DigressivePrice\Form\UpdateDigressivePriceForm" />
<form name="digressiveprice.delete" class="DigressivePrice\Form\DeleteDigressivePriceForm" />
</forms>
<hooks>
<hook id="digressiveprice.hook" class="DigressivePrice\Hook\DigressivePriceHook" scope="request">
<tag name="hook.event_listener" event="product.tab" type="back"/>
<tag name="hook.event_listener" event="product.javascript-initialization" type="front"/>
<tag name="hook.event_listener" event="category.javascript-initialization" type="front"/>
</hook>
</hooks>
<services>
<service id="digressiveprice.listener" class="DigressivePrice\Listener\DigressivePriceListener" scope="request">
<argument type="service" id="request"/>
<tag name="kernel.event_subscriber"/>
</service>
</services>
</config>

View File

@@ -0,0 +1,28 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- digressive_price
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `digressive_price`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`product_id` INTEGER NOT NULL,
`price` DECIMAL(16,6) DEFAULT 0.000000 NOT NULL,
`promo_price` DECIMAL(16,6) DEFAULT 0.000000 NOT NULL,
`quantity_from` INTEGER NOT NULL,
`quantity_to` INTEGER NOT NULL,
PRIMARY KEY (`id`),
INDEX `FI_product_digressive` (`product_id`),
CONSTRAINT `fk_product_digressive`
FOREIGN KEY (`product_id`)
REFERENCES `product` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,13 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until tables are set.
SET FOREIGN_KEY_CHECKS = 0;
-- ---------------------------------------------------------------------
-- digressive_price
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `digressive_price`;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module>
<fullnamespace>DigressivePrice\DigressivePrice</fullnamespace>
<descriptive locale="en_US">
<title>Digressive price</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Prix dégressif</title>
</descriptive>
<version>2.1</version>
<author>
<name>Etienne PERRIERE - Nexxpix - OpenStudio</name>
<email>eperriere@openstudio.fr</email>
</author>
<type>classic</type>
<thelia>2.1.0</thelia>
<stability>other</stability>
</module>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="DigressivePrice.create" path="/admin/module/DigressivePrice/create">
<default key="_controller">DigressivePrice\Controller\DigressivePriceController::createAction</default>
</route>
<route id="DigressivePrice.update" path="/admin/module/DigressivePrice/update">
<default key="_controller">DigressivePrice\Controller\DigressivePriceController::updateAction</default>
</route>
<route id="DigressivePrice.delete" path="/admin/module/DigressivePrice/delete">
<default key="_controller">DigressivePrice\Controller\DigressivePriceController::deleteAction</default>
</route>
</routes>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia" namespace="DigressivePrice\Model">
<table name="digressive_price">
<column name="id" autoIncrement="true" primaryKey="true" required="true" type="INTEGER" />
<column name="product_id" required="true" type="INTEGER" />
<column name="price" required="true" scale="6" size="16" type="DECIMAL" defaultValue="0.000000" />
<column name="promo_price" required="true" scale="6" size="16" type="DECIMAL" defaultValue="0.000000" />
<column name="quantity_from" required="true" type="INTEGER" />
<column name="quantity_to" required="true" type="INTEGER" />
<foreign-key foreignTable="product" name="fk_product_digressive" onDelete="CASCADE" onUpdate="RESTRICT">
<reference local="product_id" foreign="id"/>
</foreign-key>
</table>
<external-schema filename="local/config/schema.xml" referenceOnly="true" />
</database>

View File

@@ -0,0 +1,11 @@
-- ---------------------------------------------------------------------
-- Update the foreign key to provide automatic delete
-- ---------------------------------------------------------------------
ALTER TABLE `digressive_price` DROP FOREIGN KEY `fk_product_digressive`;
ALTER TABLE `digressive_price` ADD CONSTRAINT `fk_product_digressive`
FOREIGN KEY (`product_id`)
REFERENCES `product` (`id`)
ON UPDATE RESTRICT
ON DELETE CASCADE;