Version Notes
- Improved graphics in backend
- Add "Include product tax class for calculating discount" button
- Fix minor bugs for mass action
Download this release
Release Info
Developer | alditalia |
Extension | AntonioLoiaconoDesign_CalculateDiscount |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.0 to 1.3.0
- app/code/community/AntonioLoiaconoDesign/CalculateDiscount/Block/Config/Adminhtml/System/Config/Fieldset/Appinfo.php +23 -0
- app/code/community/AntonioLoiaconoDesign/CalculateDiscount/Helper/Data.php +1 -0
- app/code/community/AntonioLoiaconoDesign/CalculateDiscount/Model/Observer.php +11 -3
- app/code/community/AntonioLoiaconoDesign/CalculateDiscount/controllers/Adminhtml/CalculatediscountController.php +10 -3
- app/code/community/AntonioLoiaconoDesign/CalculateDiscount/etc/config.xml +64 -49
- app/code/community/AntonioLoiaconoDesign/CalculateDiscount/etc/system.xml +17 -1
- app/design/adminhtml/default/default/template/calculatediscount/system/config/fieldset/appinfo.phtml +12 -0
- package.xml +7 -5
app/code/community/AntonioLoiaconoDesign/CalculateDiscount/Block/Config/Adminhtml/System/Config/Fieldset/Appinfo.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class AntonioLoiaconoDesign_CalculateDiscount_Block_Config_Adminhtml_System_Config_Fieldset_Appinfo
|
4 |
+
extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {
|
5 |
+
|
6 |
+
protected $_template = 'calculatediscount/system/config/fieldset/appinfo.phtml';
|
7 |
+
|
8 |
+
public function render(Varien_Data_Form_Element_Abstract $element) {
|
9 |
+
return $this->toHtml();
|
10 |
+
}
|
11 |
+
|
12 |
+
protected function getModuleVersion() {
|
13 |
+
return (string) Mage::getConfig()->getNode('modules/AntonioLoiaconoDesign_CalculateDiscount/version');
|
14 |
+
}
|
15 |
+
|
16 |
+
protected function getAldWebsite() {
|
17 |
+
return (string) "http://www.antonioloiaconodesign.it";
|
18 |
+
}
|
19 |
+
|
20 |
+
protected function getCalculateDiscountInfo() {
|
21 |
+
return (string) "http://www.antonioloiaconodesign.it/calculate-discount";
|
22 |
+
}
|
23 |
+
}
|
app/code/community/AntonioLoiaconoDesign/CalculateDiscount/Helper/Data.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
class AntonioLoiaconoDesign_CalculateDiscount_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
{
|
|
|
4 |
}
|
5 |
|
1 |
<?php
|
2 |
class AntonioLoiaconoDesign_CalculateDiscount_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
{
|
4 |
+
|
5 |
}
|
6 |
|
app/code/community/AntonioLoiaconoDesign/CalculateDiscount/Model/Observer.php
CHANGED
@@ -23,10 +23,18 @@ class AntonioLoiaconoDesign_CalculateDiscount_Model_Observer
|
|
23 |
{
|
24 |
$product = $observer->getProduct();
|
25 |
$discountAttribute = Mage::getStoreConfig('antonioloiaconodesign_calculatediscount/general/attributeofdiscount');
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
$discountConditions = Mage::getStoreConfig('antonioloiaconodesign_calculatediscount/general/discountconditions');
|
|
|
30 |
if ($discountConditions) {
|
31 |
$discountConditions = unserialize($discountConditions);
|
32 |
if (is_array($discountConditions)) {
|
23 |
{
|
24 |
$product = $observer->getProduct();
|
25 |
$discountAttribute = Mage::getStoreConfig('antonioloiaconodesign_calculatediscount/general/attributeofdiscount');
|
26 |
+
$Price = $product->getPrice();
|
27 |
+
$finalPrice = $product->getFinalPrice();
|
28 |
+
|
29 |
+
if (Mage::getStoreConfig('antonioloiaconodesign_calculatediscount/general/producttaxclass')) {
|
30 |
+
$Price = Mage::helper('core')->currency($product->getPrice(),true,false);
|
31 |
+
$finalPrice = Mage::helper('core')->currency($product->getFinalPrice(),true,false);
|
32 |
+
}
|
33 |
+
|
34 |
+
if ($finalPrice < $Price && $product->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE){
|
35 |
+
$discountPer = round(($Price - $finalPrice) / $Price * 100, 0, PHP_ROUND_HALF_DOWN);
|
36 |
$discountConditions = Mage::getStoreConfig('antonioloiaconodesign_calculatediscount/general/discountconditions');
|
37 |
+
|
38 |
if ($discountConditions) {
|
39 |
$discountConditions = unserialize($discountConditions);
|
40 |
if (is_array($discountConditions)) {
|
app/code/community/AntonioLoiaconoDesign/CalculateDiscount/controllers/Adminhtml/CalculatediscountController.php
CHANGED
@@ -31,10 +31,17 @@ class AntonioLoiaconoDesign_CalculateDiscount_Adminhtml_CalculatediscountControl
|
|
31 |
|
32 |
$product = Mage::getModel('catalog/product')->load($_product->getId());
|
33 |
$discountAttribute = Mage::getStoreConfig('antonioloiaconodesign_calculatediscount/general/attributeofdiscount');
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
-
$discountPer = round(($
|
38 |
$discountConditions = Mage::getStoreConfig('antonioloiaconodesign_calculatediscount/general/discountconditions');
|
39 |
if ($discountConditions) {
|
40 |
$discountConditions = unserialize($discountConditions);
|
31 |
|
32 |
$product = Mage::getModel('catalog/product')->load($_product->getId());
|
33 |
$discountAttribute = Mage::getStoreConfig('antonioloiaconodesign_calculatediscount/general/attributeofdiscount');
|
34 |
+
$Price = $product->getPrice();
|
35 |
+
$finalPrice = $product->getFinalPrice();
|
36 |
+
|
37 |
+
if (Mage::getStoreConfig('antonioloiaconodesign_calculatediscount/general/producttaxclass')) {
|
38 |
+
$Price = Mage::helper('core')->currency($product->getPrice(),true,false);
|
39 |
+
$finalPrice = Mage::helper('core')->currency($product->getFinalPrice(),true,false);
|
40 |
+
}
|
41 |
+
|
42 |
+
if ($finalPrice < $Price && $product->getVisibility() != Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE) {
|
43 |
|
44 |
+
$discountPer = round(($Price - $finalPrice) / $Price * 100, 0, PHP_ROUND_HALF_DOWN);
|
45 |
$discountConditions = Mage::getStoreConfig('antonioloiaconodesign_calculatediscount/general/discountconditions');
|
46 |
if ($discountConditions) {
|
47 |
$discountConditions = unserialize($discountConditions);
|
app/code/community/AntonioLoiaconoDesign/CalculateDiscount/etc/config.xml
CHANGED
@@ -1,12 +1,19 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
-
|
4 |
<AntonioLoiaconoDesign_CalculateDiscount>
|
5 |
-
<version>1.
|
6 |
</AntonioLoiaconoDesign_CalculateDiscount>
|
7 |
</modules>
|
8 |
<global>
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
<calculatediscount>
|
11 |
<class>AntonioLoiaconoDesign_CalculateDiscount_Block</class>
|
12 |
</calculatediscount>
|
@@ -16,53 +23,61 @@
|
|
16 |
<class>AntonioLoiaconoDesign_CalculateDiscount_Model</class>
|
17 |
</calculatediscount>
|
18 |
</models>
|
19 |
-
|
20 |
<calculatediscount>
|
21 |
<class>AntonioLoiaconoDesign_CalculateDiscount_Helper</class>
|
22 |
</calculatediscount>
|
23 |
-
</helpers>
|
|
|
24 |
</global>
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
<
|
38 |
-
|
39 |
-
<
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
+
<modules>
|
4 |
<AntonioLoiaconoDesign_CalculateDiscount>
|
5 |
+
<version>1.3.0</version>
|
6 |
</AntonioLoiaconoDesign_CalculateDiscount>
|
7 |
</modules>
|
8 |
<global>
|
9 |
+
<blocks>
|
10 |
+
<!-- This is how and where we rewrite Mage_Catalog_Product_View -->
|
11 |
+
<catalog>
|
12 |
+
<rewrite>
|
13 |
+
<product_view>AntonioLoiaconoDesign_CalculateDiscount_Block_Catalog_Product_View</product_view>
|
14 |
+
</rewrite>
|
15 |
+
</catalog>
|
16 |
+
|
17 |
<calculatediscount>
|
18 |
<class>AntonioLoiaconoDesign_CalculateDiscount_Block</class>
|
19 |
</calculatediscount>
|
23 |
<class>AntonioLoiaconoDesign_CalculateDiscount_Model</class>
|
24 |
</calculatediscount>
|
25 |
</models>
|
26 |
+
<helpers>
|
27 |
<calculatediscount>
|
28 |
<class>AntonioLoiaconoDesign_CalculateDiscount_Helper</class>
|
29 |
</calculatediscount>
|
30 |
+
</helpers>
|
31 |
+
|
32 |
</global>
|
33 |
+
<frontend>
|
34 |
+
<layout>
|
35 |
+
<updates>
|
36 |
+
<antonioloiaconodesign_calculatediscount>
|
37 |
+
<file>calculatediscount/discount.xml</file>
|
38 |
+
</antonioloiaconodesign_calculatediscount>
|
39 |
+
</updates>
|
40 |
+
</layout>
|
41 |
+
</frontend>
|
42 |
+
<admin>
|
43 |
+
<routers>
|
44 |
+
<adminhtml>
|
45 |
+
<args>
|
46 |
+
<modules>
|
47 |
+
<AntonioLoiaconoDesign_CalculateDiscount before="Mage_Adminhtml">AntonioLoiaconoDesign_CalculateDiscount_Adminhtml</AntonioLoiaconoDesign_CalculateDiscount>
|
48 |
+
</modules>
|
49 |
+
</args>
|
50 |
+
</adminhtml>
|
51 |
+
</routers>
|
52 |
+
</admin>
|
53 |
+
<adminhtml>
|
54 |
+
<events>
|
55 |
+
<!-- event triggered after the original massaction items are added -->
|
56 |
+
<adminhtml_catalog_product_grid_prepare_massaction>
|
57 |
+
<observers>
|
58 |
+
<antonioloiaconodesign_calculatediscount_add>
|
59 |
+
<type>singleton</type>
|
60 |
+
<class>calculatediscount/observer</class>
|
61 |
+
<method>addMassCalculate</method>
|
62 |
+
</antonioloiaconodesign_calculatediscount_add>
|
63 |
+
</observers>
|
64 |
+
</adminhtml_catalog_product_grid_prepare_massaction>
|
65 |
+
<catalog_product_save_after>
|
66 |
+
<observers>
|
67 |
+
<calculatediscount>
|
68 |
+
<type>singleton</type>
|
69 |
+
<class>calculatediscount/observer</class>
|
70 |
+
<method>calculateDiscountAfterProductSave</method>
|
71 |
+
</calculatediscount>
|
72 |
+
</observers>
|
73 |
+
</catalog_product_save_after>
|
74 |
+
</events>
|
75 |
+
</adminhtml>
|
76 |
+
<phpunit>
|
77 |
+
<suite>
|
78 |
+
<modules>
|
79 |
+
<AntonioLoiaconoDesign_CalculateDiscount/>
|
80 |
+
</modules>
|
81 |
+
</suite>
|
82 |
+
</phpunit>
|
83 |
+
</config>
|
app/code/community/AntonioLoiaconoDesign/CalculateDiscount/etc/system.xml
CHANGED
@@ -15,6 +15,13 @@
|
|
15 |
<show_in_website>1</show_in_website>
|
16 |
<show_in_store>1</show_in_store>
|
17 |
<groups>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
<general translate="label" module="calculatediscount">
|
19 |
<label>General</label>
|
20 |
<frontend_type>text</frontend_type>
|
@@ -34,7 +41,7 @@
|
|
34 |
</attributeofdiscount>
|
35 |
<discountconditions translate="label">
|
36 |
<label>Discount conditions</label>
|
37 |
-
|
38 |
<frontend_model>calculatediscount/config_discountConditions</frontend_model>
|
39 |
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
40 |
<sort_order>20</sort_order>
|
@@ -42,6 +49,15 @@
|
|
42 |
<show_in_website>1</show_in_website>
|
43 |
<show_in_store>1</show_in_store>
|
44 |
</discountconditions>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
</fields>
|
46 |
</general>
|
47 |
</groups>
|
15 |
<show_in_website>1</show_in_website>
|
16 |
<show_in_store>1</show_in_store>
|
17 |
<groups>
|
18 |
+
<appinfo>
|
19 |
+
<frontend_model>calculatediscount/config_adminhtml_system_config_fieldset_appinfo</frontend_model>
|
20 |
+
<sort_order>0</sort_order>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_store>1</show_in_store>
|
24 |
+
</appinfo>
|
25 |
<general translate="label" module="calculatediscount">
|
26 |
<label>General</label>
|
27 |
<frontend_type>text</frontend_type>
|
41 |
</attributeofdiscount>
|
42 |
<discountconditions translate="label">
|
43 |
<label>Discount conditions</label>
|
44 |
+
<comment>Before add a condition, save the attribute of discount.</comment>
|
45 |
<frontend_model>calculatediscount/config_discountConditions</frontend_model>
|
46 |
<backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
|
47 |
<sort_order>20</sort_order>
|
49 |
<show_in_website>1</show_in_website>
|
50 |
<show_in_store>1</show_in_store>
|
51 |
</discountconditions>
|
52 |
+
<producttaxclass translate="label">
|
53 |
+
<label>Include product tax class for calculating discount?</label>
|
54 |
+
<frontend_type>select</frontend_type>
|
55 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
56 |
+
<sort_order>30</sort_order>
|
57 |
+
<show_in_default>1</show_in_default>
|
58 |
+
<show_in_website>1</show_in_website>
|
59 |
+
<show_in_store>1</show_in_store>
|
60 |
+
</producttaxclass>
|
61 |
</fields>
|
62 |
</general>
|
63 |
</groups>
|
app/design/adminhtml/default/default/template/calculatediscount/system/config/fieldset/appinfo.phtml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<fieldset ng-class="creare-info">
|
2 |
+
<table>
|
3 |
+
<tr>
|
4 |
+
<td><img src="//www.antonioloiaconodesign.it/img/calculate-discount.gif" alt="Calculate Discount" /></td>
|
5 |
+
<td width="10"></td><td>
|
6 |
+
<h3>Calculate Discount version <?php echo $this->getModuleVersion() ?></h3>
|
7 |
+
<p><strong><a href="<?php echo $this->getCalculateDiscountInfo() ?>" target="_blank">Info & Details</a></strong> - Calculate Discount - How to use
|
8 |
+
<br /><strong><a href="<?php echo $this->getAldWebsite() ?>" target="_blank">ALD</a></strong> - for more about Antonio Loiacono Design
|
9 |
+
</td>
|
10 |
+
</tr>
|
11 |
+
</table>
|
12 |
+
</fieldset>
|
package.xml
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>AntonioLoiaconoDesign_CalculateDiscount</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>The extension of the calculation discount will be useful to the one who will want to obtain a filter based on the percentage of discount in the frontend.</summary>
|
10 |
<description>The extension of the calculation discount lets choose an attribute used for the discount. For each option dropdown of the attribute it is possible to associate a range of percentages that will be visible in frontend if the attribute makes itself filterable with results.</description>
|
11 |
-
<notes>-
|
|
|
|
|
12 |
<authors><author><name>alditalia</name><user>alditalia</user><email>a.loiacono@live.it</email></author></authors>
|
13 |
-
<date>2016-06-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="AntonioLoiaconoDesign"><dir name="CalculateDiscount"><dir name="Block"><dir name="Config"><file name="DiscountConditions.php" hash="ea2c2594c7623d440d51daf3a3d3e210"/><dir name="Adminhtml"><dir name="Form"><dir name="Field"><file name="Discount.php" hash="04fdf4b428de3f987c282a1dde99f9d5"/></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CalculatediscountController.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>AntonioLoiaconoDesign_CalculateDiscount</name>
|
4 |
+
<version>1.3.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>The extension of the calculation discount will be useful to the one who will want to obtain a filter based on the percentage of discount in the frontend.</summary>
|
10 |
<description>The extension of the calculation discount lets choose an attribute used for the discount. For each option dropdown of the attribute it is possible to associate a range of percentages that will be visible in frontend if the attribute makes itself filterable with results.</description>
|
11 |
+
<notes>- Improved graphics in backend
|
12 |
+
- Add "Include product tax class for calculating discount" button
|
13 |
+
- Fix minor bugs for mass action</notes>
|
14 |
<authors><author><name>alditalia</name><user>alditalia</user><email>a.loiacono@live.it</email></author></authors>
|
15 |
+
<date>2016-06-08</date>
|
16 |
+
<time>10:05:25</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="AntonioLoiaconoDesign"><dir name="CalculateDiscount"><dir name="Block"><dir name="Config"><file name="DiscountConditions.php" hash="ea2c2594c7623d440d51daf3a3d3e210"/><dir name="Adminhtml"><dir name="Form"><dir name="Field"><file name="Discount.php" hash="04fdf4b428de3f987c282a1dde99f9d5"/></dir></dir><dir name="System"><dir name="Config"><dir name="Fieldset"><file name="Appinfo.php" hash="f7da318f9068a772715abc5854693c63"/></dir></dir></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="CalculatediscountController.php" hash="420ea9421d2acfd076326dc7ef6b7c21"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="4034f1c2ab351864c50c09ae97dca679"/><file name="config.xml" hash="4d89a13aedadaf6fa2e9d432e1ad07c1"/><file name="system.xml" hash="4c304868f1e47c98f176cd62c84d3978"/></dir><dir name="Helper"><file name="Data.php" hash="d013701eb0402200a0d9bf391234a6b5"/></dir><dir name="Model"><file name="Observer.php" hash="be16617966b257992eb465f3de7e42a6"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="AntonioLoiaconoDesign_CalculateDiscount.xml" hash="31047778a163b19ed5c8b2bfeea2d337"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="calculatediscount"><dir name="system"><dir name="config"><dir name="fieldset"><file name="appinfo.phtml" hash="74776ccb496a96d7c9cdd4d2e2712dfa"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
</package>
|