Version Notes
Initial functionality is added in this module, further more enhancement in next version
Download this release
Release Info
Developer | Commerce Bees |
Extension | minimum_order_fee |
Version | 0.1.1 |
Comparing to | |
See all releases |
Version 0.1.1
- CommerceBees_Minimumorder_Fee_Extension_Guide_V0.1.1 .pdf +0 -0
- app/code/community/Ameex/MinimumorderFee/Block/Checkout/Total/Minimumorderfee.php +5 -0
- app/code/community/Ameex/MinimumorderFee/Block/Sales/Order/Totals/Minimumorderfee.php +18 -0
- app/code/community/Ameex/MinimumorderFee/Helper/Data.php +4 -0
- app/code/community/Ameex/MinimumorderFee/Model/Sales/Order/Creditmemo/Total/Minimumorderfee.php +24 -0
- app/code/community/Ameex/MinimumorderFee/Model/Sales/Order/Invoice/Total/Minimumorderfee.php +25 -0
- app/code/community/Ameex/MinimumorderFee/Model/Sales/Quote/Address/Total/Minimumorderfee.php +61 -0
- app/code/community/Ameex/MinimumorderFee/Model/Value.php +10 -0
- app/code/community/Ameex/MinimumorderFee/etc/config.xml +99 -0
- app/code/community/Ameex/MinimumorderFee/etc/system.xml +30 -0
- app/code/community/Ameex/MinimumorderFee/sql/ameex_minimumorderfee_setup/Upgrade-0.1.0-0.1.1.php +26 -0
- app/code/community/Ameex/MinimumorderFee/sql/ameex_minimumorderfee_setup/install-0.1.0.php +12 -0
- app/design/adminhtml/default/default/layout/minimumorderfee.xml +39 -0
- app/design/frontend/base/default/layout/minimumorderfee.xml +64 -0
- app/design/frontend/base/default/template/checkout/total/minimumorderfee.phtml +43 -0
- app/etc/modules/Ameex_MinimumorderFee.xml +9 -0
- package.xml +18 -0
CommerceBees_Minimumorder_Fee_Extension_Guide_V0.1.1 .pdf
ADDED
Binary file
|
app/code/community/Ameex/MinimumorderFee/Block/Checkout/Total/Minimumorderfee.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ameex_MinimumorderFee_Block_Checkout_Total_Minimumorderfee extends Mage_Checkout_Block_Total_Default
|
3 |
+
{
|
4 |
+
protected $_template = 'checkout/total/minimumorderfee.phtml';
|
5 |
+
}
|
app/code/community/Ameex/MinimumorderFee/Block/Sales/Order/Totals/Minimumorderfee.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ameex_MinimumorderFee_Block_Sales_Order_Totals_Minimumorderfee extends Mage_Core_Block_Abstract
|
3 |
+
{
|
4 |
+
public function getSource()
|
5 |
+
{
|
6 |
+
return $this->getParentBlock()->getSource();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function initTotals()
|
10 |
+
{
|
11 |
+
if((float)$this->getSource()->getBaseCustomFeeAmount()==0){
|
12 |
+
return $this;
|
13 |
+
}
|
14 |
+
$total=new Varien_Object(array('code'=>'minimumorderfee','label'=>$this->__('Minimum Order Fee'),'value'=>$this->getSource()->getBaseCustomFeeAmount(),'field'=>'custom_fee_amount'));
|
15 |
+
$this->getParentBlock()->addTotalBefore($total, 'shipping');
|
16 |
+
return $this;
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Ameex/MinimumorderFee/Helper/Data.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ameex_MinimumorderFee_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
app/code/community/Ameex/MinimumorderFee/Model/Sales/Order/Creditmemo/Total/Minimumorderfee.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ameex_MinimumorderFee_Model_Sales_Order_Creditmemo_Total_Minimumorderfee extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract{
|
3 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo){
|
4 |
+
$creditmemo->setCustomFeeAmount(0);
|
5 |
+
$creditmemo->setBaseCustomFeeAmount(0);
|
6 |
+
$lastcreditmemoCustomFeeAmount=0;
|
7 |
+
$lastcreditmemoBaseCustomFeeAmount=0;
|
8 |
+
foreach($creditmemo->getOrder()->getCreditmemosCollection() as $lastCreditmemo)
|
9 |
+
{
|
10 |
+
if($lastCreditmemo->getCustomFeeAmount() && ($lastCreditmemo->getState()!=Mage_Sales_Model_Order_Creditmemo::STATE_CANCELED))
|
11 |
+
{
|
12 |
+
$lastcreditmemoCustomFeeAmount+=$lastCreditmemo->getCustomFeeAmount();
|
13 |
+
$lastcreditmemoBaseCustomFeeAmount+=$lastCreditmemo->getBaseCustomFeeAmount();
|
14 |
+
}
|
15 |
+
}
|
16 |
+
$creditedMemo=$creditmemo->getOrder()->getCustomFeeAmount()-$lastcreditmemoCustomFeeAmount;
|
17 |
+
$creditedMemoBase=$creditmemo->getOrder()->getCustomFeeAmount()-$lastcreditmemoBaseCustomFeeAmount;
|
18 |
+
$creditmemo->setCustomFeeAmount($creditedMemo);
|
19 |
+
$creditmemo->setBaseCustomFeeAmount($creditedMemoBase);
|
20 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal()+$creditedMemo);
|
21 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()+$creditedMemoBase);
|
22 |
+
return $this;
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Ameex/MinimumorderFee/Model/Sales/Order/Invoice/Total/Minimumorderfee.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ameex_MinimumorderFee_Model_Sales_Order_Invoice_Total_Minimumorderfee extends Mage_Sales_Model_Order_Invoice_Total_Abstract{
|
3 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice)
|
4 |
+
{
|
5 |
+
$invoice->setCustomFeeAmount(0);
|
6 |
+
$invoice->setBaseCustomFeeAmount(0);
|
7 |
+
$lastinvoiceCustomFeeAmount=0;
|
8 |
+
$lastinvoiceBaseCustomFeeAmount=0;
|
9 |
+
foreach($invoice->getOrder()->getInvoiceCollection() as $lastInvoice)
|
10 |
+
{
|
11 |
+
if($lastInvoice->getCustomFeeAmount() && !$lastInvoice->isCanceled)
|
12 |
+
{
|
13 |
+
$lastinvoiceCustomFeeAmount+=$lastInvoice->getCustomFeeAmount();
|
14 |
+
$lastinvoiceBaseCustomFeeAmount+=$lastInvoice->getBaseCustomFeeAmount();
|
15 |
+
}
|
16 |
+
}
|
17 |
+
$invoicedcustomfee = $invoice->getOrder()->getCustomFeeAmount() - $lastinvoiceCustomFeeAmount;
|
18 |
+
$invoicedBasecustomfee = $invoice->getOrder()->getBaseCustomFeeAmount() - $lastinvoiceBaseCustomFeeAmount;
|
19 |
+
$invoice->setCustomFeeAmount($invoicedcustomfee);
|
20 |
+
$invoice->setBaseCustomFeeAmount($invoicedBasecustomfee);
|
21 |
+
$invoice->setGrandTotal($invoice->getGrandTotal()+$invoicedcustomfee);
|
22 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$invoicedBasecustomfee);
|
23 |
+
return $this;
|
24 |
+
}
|
25 |
+
}
|
app/code/community/Ameex/MinimumorderFee/Model/Sales/Quote/Address/Total/Minimumorderfee.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ameex_MinimumorderFee_Model_Sales_Quote_Address_Total_Minimumorderfee extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
3 |
+
protected $minimumfeeTiers=array(0=>10,5=>20,10=>30,);
|
4 |
+
public function __construct(){
|
5 |
+
$this->setCode('minimumorderfee');
|
6 |
+
}
|
7 |
+
public function collect(Mage_Sales_Model_Quote_Address $address){
|
8 |
+
parent::collect($address);
|
9 |
+
$this->_setAmount(0);
|
10 |
+
$this->_setBaseAmount(0);
|
11 |
+
$items = $this->_getAddressItems($address);
|
12 |
+
if (!count($items)) {
|
13 |
+
return $this; //this makes only address type shipping to come through
|
14 |
+
}
|
15 |
+
$quote = $address->getQuote();
|
16 |
+
$minimumorderfee=Mage::getStoreConfig('sales/minimum_order/minimumfee');
|
17 |
+
$subtotal=$address->getSubtotal();
|
18 |
+
$isMinAmt= Mage::getStoreConfig('sales/minimum_order/amount', Mage::app()->getStore()->getId());
|
19 |
+
$isMinAmtActive= Mage::getStoreConfig('sales/minimum_order/active', Mage::app()->getStore()->getId());
|
20 |
+
if($isMinAmtActive==1 && $subtotal<$isMinAmt){
|
21 |
+
$feecalculation=Mage::getStoreConfig('sales/minimum_order/feecalculation', Mage::app()->getStore()->getId());
|
22 |
+
switch($feecalculation){
|
23 |
+
/* case 1 is for fixed amount */
|
24 |
+
case 1 :
|
25 |
+
$address->setBaseCustomFeeAmount($minimumorderfee);
|
26 |
+
$address->setCustomFeeAmount($minimumorderfee);
|
27 |
+
$this->_addBaseAmount($minimumorderfee);
|
28 |
+
$this->_addAmount($minimumorderfee);
|
29 |
+
return $this;
|
30 |
+
break;
|
31 |
+
case 2 :
|
32 |
+
/* case 2 is for percentage of fixed amount */
|
33 |
+
$percentcalculation=$subtotal*($minimumorderfee/100);
|
34 |
+
$address->setBaseCustomFeeAmount($percentcalculation);
|
35 |
+
$address->setCustomFeeAmount($percentcalculation);
|
36 |
+
$this->_addBaseAmount($percentcalculation);
|
37 |
+
$this->_addAmount($percentcalculation);
|
38 |
+
return $this;
|
39 |
+
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
44 |
+
{
|
45 |
+
$amount = $address->getCustomFeeAmount();
|
46 |
+
if($amount!=0){
|
47 |
+
$isMinAmt= Mage::getStoreConfig('sales/minimum_order/amount', Mage::app()->getStore()->getId());
|
48 |
+
$subtotal=$address->getSubtotal();
|
49 |
+
$isMinAmtActive= Mage::getStoreConfig('sales/minimum_order/active', Mage::app()->getStore()->getId());
|
50 |
+
if($isMinAmtActive==1 && $subtotal<$isMinAmt){
|
51 |
+
$address->addTotal(array(
|
52 |
+
'code' => $this->getCode(),
|
53 |
+
'title' => Mage::helper('minimumorderfee')
|
54 |
+
->__('Minimum Order Fee'),
|
55 |
+
'value' => $amount
|
56 |
+
));
|
57 |
+
}
|
58 |
+
return $this;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
app/code/community/Ameex/MinimumorderFee/Model/Value.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ameex_MinimumorderFee_Model_Value{
|
3 |
+
public function toOptionArray()
|
4 |
+
{
|
5 |
+
return array(
|
6 |
+
array('value'=>1,'label'=>Mage::helper('minimumorderfee')->__('Fixed Amount')),
|
7 |
+
array('value'=>2,'label'=>Mage::helper('minimumorderfee')->__('Percentage of Amount'))
|
8 |
+
);
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Ameex/MinimumorderFee/etc/config.xml
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ameex_MinimumorderFee>
|
5 |
+
<version>0.1.1</version>
|
6 |
+
</Ameex_MinimumorderFee>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<layout>
|
10 |
+
<updates>
|
11 |
+
<minimumorderfee>
|
12 |
+
<file>minimumorderfee.xml</file>
|
13 |
+
</minimumorderfee>
|
14 |
+
</updates>
|
15 |
+
</layout>
|
16 |
+
</frontend>
|
17 |
+
<global>
|
18 |
+
<blocks>
|
19 |
+
<minimumorderfee>
|
20 |
+
<class>Ameex_MinimumorderFee_Block</class>
|
21 |
+
</minimumorderfee>
|
22 |
+
</blocks>
|
23 |
+
<models>
|
24 |
+
<minimumorderfee>
|
25 |
+
<class>Ameex_MinimumorderFee_Model</class>
|
26 |
+
<resourceModel>ameex_minimumorderfee_resource</resourceModel>
|
27 |
+
</minimumorderfee>
|
28 |
+
<ameex_minimumorderfee_resource>
|
29 |
+
<class>Ameex_MinimumorderFee_Model_Resource</class>
|
30 |
+
</ameex_minimumorderfee_resource>
|
31 |
+
</models>
|
32 |
+
<resources>
|
33 |
+
<ameex_minimumorderfee_setup>
|
34 |
+
<setup>
|
35 |
+
<module>Ameex_MinimumorderFee</module>
|
36 |
+
</setup>
|
37 |
+
</ameex_minimumorderfee_setup>
|
38 |
+
</resources>
|
39 |
+
<fieldsets>
|
40 |
+
<sales_convert_quote_address>
|
41 |
+
<base_custom_fee_amount>
|
42 |
+
<to_order>*</to_order>
|
43 |
+
</base_custom_fee_amount>
|
44 |
+
<custom_fee_amount>
|
45 |
+
<to_order>*</to_order>
|
46 |
+
</custom_fee_amount>
|
47 |
+
</sales_convert_quote_address>
|
48 |
+
<sales_convert_quote_item>
|
49 |
+
<base_custom_fee_amount>
|
50 |
+
<to_order_item>*</to_order_item>
|
51 |
+
</base_custom_fee_amount>
|
52 |
+
<custom_fee_amount>
|
53 |
+
<to_order_item>*</to_order_item>
|
54 |
+
</custom_fee_amount>
|
55 |
+
</sales_convert_quote_item>
|
56 |
+
</fieldsets>
|
57 |
+
<sales>
|
58 |
+
<quote>
|
59 |
+
<totals>
|
60 |
+
<minimumorderfee>
|
61 |
+
<class>minimumorderfee/sales_quote_address_total_minimumorderfee</class>
|
62 |
+
<after>subtotal</after>
|
63 |
+
<renderer>minimumorderfee/checkout_total_minimumorderfee</renderer>
|
64 |
+
</minimumorderfee>
|
65 |
+
</totals>
|
66 |
+
</quote>
|
67 |
+
<order_invoice>
|
68 |
+
<totals>
|
69 |
+
<minimumorderfee>
|
70 |
+
<class>minimumorderfee/sales_order_invoice_total_minimumorderfee</class>
|
71 |
+
<after>subtotal</after>
|
72 |
+
</minimumorderfee>
|
73 |
+
</totals>
|
74 |
+
</order_invoice>
|
75 |
+
<order_creditmemo>
|
76 |
+
<totals>
|
77 |
+
<minimumorderfee>
|
78 |
+
<class>minimumorderfee/sales_order_creditmemo_total_minimumorderfee</class>
|
79 |
+
<after>subtotal</after>
|
80 |
+
</minimumorderfee>
|
81 |
+
</totals>
|
82 |
+
</order_creditmemo>
|
83 |
+
</sales>
|
84 |
+
<helpers>
|
85 |
+
<minimumorderfee>
|
86 |
+
<class>Ameex_MinimumorderFee_Helper</class>
|
87 |
+
</minimumorderfee>
|
88 |
+
</helpers>
|
89 |
+
</global>
|
90 |
+
<adminhtml>
|
91 |
+
<layout>
|
92 |
+
<updates>
|
93 |
+
<minimumorderfee>
|
94 |
+
<file>minimumorderfee.xml</file>
|
95 |
+
</minimumorderfee>
|
96 |
+
</updates>
|
97 |
+
</layout>
|
98 |
+
</adminhtml>
|
99 |
+
</config>
|
app/code/community/Ameex/MinimumorderFee/etc/system.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<sales>
|
5 |
+
<groups>
|
6 |
+
<minimum_order>
|
7 |
+
<fields>
|
8 |
+
<minimumfee translate="label">
|
9 |
+
<label>Minimum Order Fee</label>
|
10 |
+
<frontend_type>text</frontend_type>
|
11 |
+
<sort_order>10</sort_order>
|
12 |
+
<show_in_default>1</show_in_default>
|
13 |
+
<show_in_website>1</show_in_website>
|
14 |
+
<show_in_stores>1</show_in_stores>
|
15 |
+
</minimumfee>
|
16 |
+
<feecalculation translate="label">
|
17 |
+
<label>Fee calculation</label>
|
18 |
+
<frontend_type>select</frontend_type>
|
19 |
+
<source_model>minimumorderfee/value</source_model>
|
20 |
+
<sort_order>10</sort_order>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_stores>1</show_in_stores>
|
24 |
+
</feecalculation>
|
25 |
+
</fields>
|
26 |
+
</minimum_order>
|
27 |
+
</groups>
|
28 |
+
</sales>
|
29 |
+
</sections>
|
30 |
+
</config>
|
app/code/community/Ameex/MinimumorderFee/sql/ameex_minimumorderfee_setup/Upgrade-0.1.0-0.1.1.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer=$this;
|
3 |
+
$installer->startSetup();
|
4 |
+
|
5 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/quote_address_item'),'base_custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'Base custom fee'));
|
6 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/quote_address_item'),'custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'custom fee'));
|
7 |
+
|
8 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/order_item'),'base_custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'Base custom fee'));
|
9 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/order_item'),'custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'custom fee'));
|
10 |
+
|
11 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/order'),'base_custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'Base custom fee'));
|
12 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/order'),'custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'custom fee'));
|
13 |
+
|
14 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/invoice'),'base_custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'Base custom fee'));
|
15 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/invoice'),'custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'custom fee'));
|
16 |
+
|
17 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo'),'base_custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'Base custom fee'));
|
18 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo'),'custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'custom fee'));
|
19 |
+
|
20 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/invoice_item'),'base_custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'Base custom fee'));
|
21 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/invoice_item'),'custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'custom fee'));
|
22 |
+
|
23 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo_item'),'base_custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'Base custom fee'));
|
24 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/creditmemo_item'),'custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'custom fee'));
|
25 |
+
|
26 |
+
$installer->endSetup();
|
app/code/community/Ameex/MinimumorderFee/sql/ameex_minimumorderfee_setup/install-0.1.0.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$installer=$this;
|
3 |
+
$installer->startSetup();
|
4 |
+
|
5 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'base_custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'Base custom fee'));
|
6 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/quote_address'),'custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'custom fee'));
|
7 |
+
|
8 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/quote_item'),'base_custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'Base custom fee'));
|
9 |
+
$installer->getConnection()->addColumn($installer->getTable('sales/quote_item'),'custom_fee_amount',array('type'=>Varien_Db_Ddl_Table::TYPE_DECIMAL,'nullable'=>'true','length'=>'12,4','comment'=>'custom fee'));
|
10 |
+
|
11 |
+
|
12 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/minimumorderfee.xml
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout>
|
3 |
+
<minimumorderfee_add_order_total>
|
4 |
+
<reference name="order_totals">
|
5 |
+
<block type="minimumorderfee/sales_order_totals_minimumorderfee" name="total_minimumorderfee" />
|
6 |
+
</reference>
|
7 |
+
</minimumorderfee_add_order_total>
|
8 |
+
<minimumorderfee_add_invoice_total>
|
9 |
+
<reference name="invoice_totals">
|
10 |
+
<block type="minimumorderfee/sales_order_totals_minimumorderfee" name="total_minimumorderfee" />
|
11 |
+
</reference>
|
12 |
+
</minimumorderfee_add_invoice_total>
|
13 |
+
<minimumorderfee_add_creditmemo_total>
|
14 |
+
<reference name="creditmemo_totals">
|
15 |
+
<block type="minimumorderfee/sales_order_totals_minimumorderfee" name="total_minimumorderfee" />
|
16 |
+
</reference>
|
17 |
+
</minimumorderfee_add_creditmemo_total>
|
18 |
+
<adminhtml_sales_order_view>
|
19 |
+
<update handle="minimumorderfee_add_order_total" />
|
20 |
+
</adminhtml_sales_order_view>
|
21 |
+
<adminhtml_sales_order_invoice_new>
|
22 |
+
<update handle="minimumorderfee_add_invoice_total" />
|
23 |
+
</adminhtml_sales_order_invoice_new>
|
24 |
+
<adminhtml_sales_order_invoice_updateqty>
|
25 |
+
<update handle="minimumorderfee_add_invoice_total" />
|
26 |
+
</adminhtml_sales_order_invoice_updateqty>
|
27 |
+
<adminhtml_sales_order_invoice_view>
|
28 |
+
<update handle="minimumorderfee_add_invoice_total" />
|
29 |
+
</adminhtml_sales_order_invoice_view>
|
30 |
+
<adminhtml_sales_order_creditmemo_new>
|
31 |
+
<update handle="minimumorderfee_add_creditmemo_total" />
|
32 |
+
</adminhtml_sales_order_creditmemo_new>
|
33 |
+
<adminhtml_sales_order_creditmemo_updateqty>
|
34 |
+
<update handle="minimumorderfee_add_creditmemo_total" />
|
35 |
+
</adminhtml_sales_order_creditmemo_updateqty>
|
36 |
+
<adminhtml_sales_order_creditmemo_view>
|
37 |
+
<update handle="minimumorderfee_add_creditmemo_total" />
|
38 |
+
</adminhtml_sales_order_creditmemo_view>
|
39 |
+
</layout>
|
app/design/frontend/base/default/layout/minimumorderfee.xml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<minimumorderfee_add_order_total>
|
4 |
+
<reference name="order_totals">
|
5 |
+
<block type="minimumorderfee/sales_order_totals_minimumorderfee" name="total_minimumorderfee" />
|
6 |
+
</reference>
|
7 |
+
</minimumorderfee_add_order_total>
|
8 |
+
<minimumorderfee_add_invoice_total>
|
9 |
+
<reference name="invoice_totals">
|
10 |
+
<block type="minimumorderfee/sales_order_totals_minimumorderfee" name="total_minimumorderfee" />
|
11 |
+
</reference>
|
12 |
+
</minimumorderfee_add_invoice_total>
|
13 |
+
<minimumorderfee_add_creditmemo_total>
|
14 |
+
<reference name="creditmemo_totals">
|
15 |
+
<block type="minimumorderfee/sales_order_totals_minimumorderfee" name="total_minimumorderfee" />
|
16 |
+
</reference>
|
17 |
+
</minimumorderfee_add_creditmemo_total>
|
18 |
+
<sales_order_view>
|
19 |
+
<update handle="minimumorderfee_add_order_total" />
|
20 |
+
</sales_order_view>
|
21 |
+
<sales_order_invoice>
|
22 |
+
<update handle="minimumorderfee_add_invoice_total" />
|
23 |
+
</sales_order_invoice>
|
24 |
+
<sales_order_creditmemo>
|
25 |
+
<update handle="minimumorderfee_add_creditmemo_total" />
|
26 |
+
</sales_order_creditmemo>
|
27 |
+
<sales_order_print>
|
28 |
+
<update handle="minimumorderfee_add_order_total" />
|
29 |
+
</sales_order_print>
|
30 |
+
<sales_order_printinvoice>
|
31 |
+
<update handle="minimumorderfee_add_invoice_total" />
|
32 |
+
</sales_order_printinvoice>
|
33 |
+
<sales_order_printcreditmemo>
|
34 |
+
<update handle="minimumorderfee_add_creditmemo_total" />
|
35 |
+
</sales_order_printcreditmemo>
|
36 |
+
<sales_email_order_items>
|
37 |
+
<update handle="minimumorderfee_add_order_total" />
|
38 |
+
</sales_email_order_items>
|
39 |
+
<sales_email_order_invoice_items>
|
40 |
+
<update handle="minimumorderfee_add_invoice_total" />
|
41 |
+
</sales_email_order_invoice_items>
|
42 |
+
<sales_email_order_creditmemo_items>
|
43 |
+
<update handle="minimumorderfee_add_creditmemo_total" />
|
44 |
+
</sales_email_order_creditmemo_items>
|
45 |
+
<sales_guest_view>
|
46 |
+
<update handle="minimumorderfee_add_order_total" />
|
47 |
+
</sales_guest_view>
|
48 |
+
<sales_guest_invoice>
|
49 |
+
<update handle="minimumorderfee_add_invoice_total" />
|
50 |
+
</sales_guest_invoice>
|
51 |
+
<sales_guest_creditmemo>
|
52 |
+
<update handle="minimumorderfee_add_creditmemo_total" />
|
53 |
+
</sales_guest_creditmemo>
|
54 |
+
<sales_guest_print>
|
55 |
+
<update handle="minimumorderfee_add_order_total" />
|
56 |
+
</sales_guest_print>
|
57 |
+
<sales_guest_printinvoice>
|
58 |
+
<update handle="minimumorderfee_add_invoice_total" />
|
59 |
+
</sales_guest_printinvoice>
|
60 |
+
<sales_guest_printcreditmemo>
|
61 |
+
<update handle="minimumorderfee_add_creditmemo_total" />
|
62 |
+
</sales_guest_printcreditmemo>
|
63 |
+
</layout>
|
64 |
+
|
app/design/frontend/base/default/template/checkout/total/minimumorderfee.phtml
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magento.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magento.com for more information.
|
21 |
+
*
|
22 |
+
* @category design
|
23 |
+
* @package base_default
|
24 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
?>
|
28 |
+
<tr>
|
29 |
+
<td colspan="<?php echo $this->getColspan(); ?>" style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
|
30 |
+
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
|
31 |
+
<?php echo $this->escapeHtml($this->getTotal()->getTitle()); ?>
|
32 |
+
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
|
33 |
+
<br/><a class="" onclick="expandDetails(this, '.noticetexts'); return false;" href="#">Details</a>
|
34 |
+
<?php $minimumamount= Mage::getStoreConfig('sales/minimum_order/amount'); ?>
|
35 |
+
<p class="noticetexts" style="display: none;"> Minimum order fee applies. If you purchase a minimum of <?php echo "$".$minimumamount; ?> this fee will be removed. </p>
|
36 |
+
</td>
|
37 |
+
<td style="<?php echo $this->getTotal()->getStyle() ?>" class="a-right">
|
38 |
+
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?><strong><?php endif; ?>
|
39 |
+
<?php echo $this->helper('checkout')->formatPrice($this->getTotal()->getValue()) ?>
|
40 |
+
<?php if ($this->getRenderingArea() == $this->getTotal()->getArea()): ?></strong><?php endif; ?>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
|
app/etc/modules/Ameex_MinimumorderFee.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ameex_MinimumorderFee>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Ameex_MinimumorderFee>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>minimum_order_fee</name>
|
4 |
+
<version>0.1.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>MinimumorderFee Module is used to apply fee for the minimum order.</summary>
|
10 |
+
<description>This module is used to add some fee for the minimum order. It checks the subtotal, if the subtotal is less than minimum order amount, it adds some fee to the grand total.</description>
|
11 |
+
<notes>Initial functionality is added in this module, further more enhancement in next version</notes>
|
12 |
+
<authors><author><name>commercebees</name><user>CommerceBees</user><email>commercebees@ameexusa.com</email></author><author><name>madhumala krishnan</name><user>madhumala</user><email>madhujerlin@gmail.com</email></author></authors>
|
13 |
+
<date>2015-10-12</date>
|
14 |
+
<time>17:00:36</time>
|
15 |
+
<contents><target name="mageetc"><dir><dir name="modules"><file name="Ameex_MinimumorderFee.xml" hash="2e7539c1ae8b3c207ce3f79a47df9428"/></dir></dir></target><target name="magecommunity"><dir><dir name="Ameex"><dir name="MinimumorderFee"><dir name="Block"><dir name="Checkout"><dir name="Total"><file name="Minimumorderfee.php" hash="2ac6dba02061a92ddbbb7f6c52f40efd"/></dir></dir><dir name="Sales"><dir name="Order"><dir name="Totals"><file name="Minimumorderfee.php" hash="453e083a54c94ef309326685b3dfde9b"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="b77a1ffaa1a6e8644f5a6d8e61215d97"/></dir><dir name="Model"><dir name="Sales"><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Minimumorderfee.php" hash="e865b993fdcdeb5fa07fb76a7d0be5ce"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Minimumorderfee.php" hash="3ef96c49bc61697f1f8fb844e113b7b0"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Minimumorderfee.php" hash="ec874a449b527a4400aacb41a2ff7708"/></dir></dir></dir></dir><file name="Value.php" hash="ad6d8ab9e8779f47b13c227c3c027031"/></dir><dir name="etc"><file name="config.xml" hash="87f4605290ff54daced5e9a7393b0cee"/><file name="system.xml" hash="48986e531446ebaee978ced836dfce54"/></dir><dir name="sql"><dir name="ameex_minimumorderfee_setup"><file name="Upgrade-0.1.0-0.1.1.php" hash="dcebf42adc69443d3db85f9664bb5449"/><file name="install-0.1.0.php" hash="6255d9eb79ccae8f5ffe6d6202d1df4c"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="minimumorderfee.xml" hash="a925b6be53c38c50549d2f496c49a4f8"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="minimumorderfee.xml" hash="203d1cb98bc986252c0b2d52cc0312eb"/></dir><dir name="template"><dir name="checkout"><dir name="total"><file name="minimumorderfee.phtml" hash="290f412160aa2d00f63ca986e4666509"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="CommerceBees_Minimumorder_Fee_Extension_Guide_V0.1.1 .pdf" hash="103ff1b355410d85712c7300c2150f7f"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|