Version Notes
Stable release for Magento Vesrion 1.7, 1.8 and 1.8.1
Download this release
Release Info
Developer | Niko K |
Extension | Nikolakisae_FreeShippingAdmin |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/community/Nikolakisae/FreeShippingAdmin/Model/Sales/Quote/Address.php +51 -0
- app/code/community/Nikolakisae/FreeShippingAdmin/Model/Shipping/Config.php +50 -0
- app/code/community/Nikolakisae/FreeShippingAdmin/etc/config.xml +29 -0
- app/code/community/Nikolakisae/FreeShippingAdmin/etc/system.xml +114 -0
- app/etc/modules/Nikolakisae_FreeShippingAdmin.xml +12 -0
- package.xml +18 -0
app/code/community/Nikolakisae/FreeShippingAdmin/Model/Sales/Quote/Address.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
*
|
16 |
+
* Nikolakisae FreeShippingAdmin Sales Quote address model
|
17 |
+
*
|
18 |
+
* @category Nikolakisae
|
19 |
+
* @package Nikolakisae_FreeShippingAdmin
|
20 |
+
* @author Niko K
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
*/
|
23 |
+
class Nikolakisae_FreeShippingAdmin_Model_Sales_Quote_Address extends Mage_Sales_Model_Quote_Address
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Free Shipping Method settings
|
27 |
+
*/
|
28 |
+
const XML_PATH_CARRIERS_FREESHIPPING_SHOWONLYADMIN = 'carriers/freeshipping/show_only_admin';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Retrieve collection of quote shipping rates
|
32 |
+
*
|
33 |
+
* @return Mage_Eav_Model_Entity_Collection_Abstract
|
34 |
+
*/
|
35 |
+
public function getShippingRatesCollection()
|
36 |
+
{
|
37 |
+
parent::getShippingRatesCollection();
|
38 |
+
$freeShippingKey = false;
|
39 |
+
$freeShippingOnlyAdmin = Mage::getStoreConfig(self::XML_PATH_CARRIERS_FREESHIPPING_SHOWONLYADMIN);
|
40 |
+
|
41 |
+
foreach ($this->_rates as $key => $rate) {
|
42 |
+
if ($rate->getCarrier() == 'freeshipping' && $freeShippingOnlyAdmin && !Mage::app()->getStore()->isAdmin()) {
|
43 |
+
$freeShippingKey = $key;
|
44 |
+
}
|
45 |
+
}
|
46 |
+
if($freeShippingKey) {
|
47 |
+
$this->_rates->removeItemByKey($freeShippingKey);
|
48 |
+
}
|
49 |
+
return $this->_rates;
|
50 |
+
}
|
51 |
+
}
|
app/code/community/Nikolakisae/FreeShippingAdmin/Model/Shipping/Config.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
*
|
16 |
+
* Nikolakisae FreeShippingAdmin Shipping Config model
|
17 |
+
*
|
18 |
+
* @category Nikolakisae
|
19 |
+
* @package Nikolakisae_FreeShippingAdmin
|
20 |
+
* @author Niko K
|
21 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
22 |
+
*/
|
23 |
+
class Nikolakisae_FreeShippingAdmin_Model_Shipping_Config extends Mage_Shipping_Model_Config
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Free Shipping Method settings
|
27 |
+
*/
|
28 |
+
const XML_PATH_CARRIERS_FREESHIPPING_SHOWONLYADMIN = 'carriers/freeshipping/show_only_admin';
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Retrieve active system carriers
|
32 |
+
*
|
33 |
+
* @param mixed $store
|
34 |
+
* @return array
|
35 |
+
*/
|
36 |
+
public function getActiveCarriers($store = null)
|
37 |
+
{
|
38 |
+
$carriers = parent::getActiveCarriers($store);
|
39 |
+
if (!Mage::app()->getStore()->isAdmin()) {
|
40 |
+
$carriersCodes = array_keys($carriers);
|
41 |
+
$freeShippingOnlyAdmin = Mage::getStoreConfig(self::XML_PATH_CARRIERS_FREESHIPPING_SHOWONLYADMIN);
|
42 |
+
foreach ($carriersCodes as $carriersCode) {
|
43 |
+
if ($carriersCode == 'freeshipping' && $freeShippingOnlyAdmin) {
|
44 |
+
unset($carriers[$carriersCode]);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
return $carriers;
|
49 |
+
}
|
50 |
+
}
|
app/code/community/Nikolakisae/FreeShippingAdmin/etc/config.xml
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Nikolakisae_FreeShippingAdmin>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</Nikolakisae_FreeShippingAdmin>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<shipping>
|
11 |
+
<rewrite>
|
12 |
+
<config>Nikolakisae_FreeShippingAdmin_Model_Shipping_Config</config>
|
13 |
+
</rewrite>
|
14 |
+
</shipping>
|
15 |
+
<sales>
|
16 |
+
<rewrite>
|
17 |
+
<quote_address>Nikolakisae_FreeShippingAdmin_Model_Sales_Quote_Address</quote_address>
|
18 |
+
</rewrite>
|
19 |
+
</sales>
|
20 |
+
</models>
|
21 |
+
</global>
|
22 |
+
<default>
|
23 |
+
<carriers>
|
24 |
+
<freeshipping>
|
25 |
+
<show_only_admin>0</show_only_admin>
|
26 |
+
</freeshipping>
|
27 |
+
</carriers>
|
28 |
+
</default>
|
29 |
+
</config>
|
app/code/community/Nikolakisae/FreeShippingAdmin/etc/system.xml
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers translate="label" module="shipping">
|
5 |
+
<label>Shipping Methods</label>
|
6 |
+
<tab>sales</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>320</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<freeshipping translate="label">
|
14 |
+
<label>Free Shipping</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>2</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<active translate="label">
|
22 |
+
<label>Enabled</label>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
25 |
+
<sort_order>1</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>0</show_in_store>
|
29 |
+
</active>
|
30 |
+
<show_only_admin translate="label">
|
31 |
+
<label>Only for Admin Users (Backend)</label>
|
32 |
+
<frontend_type>select</frontend_type>
|
33 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
34 |
+
<sort_order>2</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
</show_only_admin>
|
39 |
+
<free_shipping_subtotal translate="label">
|
40 |
+
<label>Minimum Order Amount</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<validate>validate-number validate-zero-or-greater</validate>
|
43 |
+
<sort_order>5</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>1</show_in_website>
|
46 |
+
<show_in_store>0</show_in_store>
|
47 |
+
</free_shipping_subtotal>
|
48 |
+
<name translate="label">
|
49 |
+
<label>Method Name</label>
|
50 |
+
<frontend_type>text</frontend_type>
|
51 |
+
<sort_order>4</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
</name>
|
56 |
+
<sort_order translate="label">
|
57 |
+
<label>Sort Order</label>
|
58 |
+
<frontend_type>text</frontend_type>
|
59 |
+
<sort_order>100</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>0</show_in_store>
|
63 |
+
</sort_order>
|
64 |
+
<title translate="label">
|
65 |
+
<label>Title</label>
|
66 |
+
<frontend_type>text</frontend_type>
|
67 |
+
<sort_order>3</sort_order>
|
68 |
+
<show_in_default>1</show_in_default>
|
69 |
+
<show_in_website>1</show_in_website>
|
70 |
+
<show_in_store>1</show_in_store>
|
71 |
+
</title>
|
72 |
+
<sallowspecific translate="label">
|
73 |
+
<label>Ship to Applicable Countries</label>
|
74 |
+
<frontend_type>select</frontend_type>
|
75 |
+
<sort_order>90</sort_order>
|
76 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
77 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
78 |
+
<show_in_default>1</show_in_default>
|
79 |
+
<show_in_website>1</show_in_website>
|
80 |
+
<show_in_store>0</show_in_store>
|
81 |
+
</sallowspecific>
|
82 |
+
<specificcountry translate="label">
|
83 |
+
<label>Ship to Specific Countries</label>
|
84 |
+
<frontend_type>multiselect</frontend_type>
|
85 |
+
<sort_order>91</sort_order>
|
86 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
87 |
+
<show_in_default>1</show_in_default>
|
88 |
+
<show_in_website>1</show_in_website>
|
89 |
+
<show_in_store>0</show_in_store>
|
90 |
+
<can_be_empty>1</can_be_empty>
|
91 |
+
</specificcountry>
|
92 |
+
<showmethod translate="label">
|
93 |
+
<label>Show Method if Not Applicable</label>
|
94 |
+
<frontend_type>select</frontend_type>
|
95 |
+
<sort_order>92</sort_order>
|
96 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
97 |
+
<show_in_default>1</show_in_default>
|
98 |
+
<show_in_website>1</show_in_website>
|
99 |
+
<show_in_store>0</show_in_store>
|
100 |
+
</showmethod>
|
101 |
+
<specificerrmsg translate="label">
|
102 |
+
<label>Displayed Error Message</label>
|
103 |
+
<frontend_type>textarea</frontend_type>
|
104 |
+
<sort_order>80</sort_order>
|
105 |
+
<show_in_default>1</show_in_default>
|
106 |
+
<show_in_website>1</show_in_website>
|
107 |
+
<show_in_store>1</show_in_store>
|
108 |
+
</specificerrmsg>
|
109 |
+
</fields>
|
110 |
+
</freeshipping>
|
111 |
+
</groups>
|
112 |
+
</carriers>
|
113 |
+
</sections>
|
114 |
+
</config>
|
app/etc/modules/Nikolakisae_FreeShippingAdmin.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Nikolakisae_FreeShippingAdmin>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Shipping />
|
9 |
+
</depends>
|
10 |
+
</Nikolakisae_FreeShippingAdmin>
|
11 |
+
</modules>
|
12 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Nikolakisae_FreeShippingAdmin</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Free Shipping Admin</summary>
|
10 |
+
<description>Enable Free Shipping Method only for Admin Users (Backend).</description>
|
11 |
+
<notes>Stable release for Magento Vesrion 1.7, 1.8 and 1.8.1</notes>
|
12 |
+
<authors><author><name>Niko K</name><user>nikolakisae</user><email>info@nikolakisae.com</email></author></authors>
|
13 |
+
<date>2014-05-11</date>
|
14 |
+
<time>14:15:50</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Nikolakisae"><dir name="FreeShippingAdmin"><dir name="Model"><dir name="Sales"><dir name="Quote"><file name="Address.php" hash="75cdc1816702bac0fb5fe718b213f8de"/></dir></dir><dir name="Shipping"><file name="Config.php" hash="2ad1f2ef30a9c495b4de8114d970e65a"/></dir></dir><dir name="etc"><file name="config.xml" hash="0f81c406dcf1aca340e3fb5da0e1e328"/><file name="system.xml" hash="d4e5615eea0915a7940eefecfe07b0f4"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Nikolakisae_FreeShippingAdmin.xml" hash="2b6a492b55bcc91e202f5d40232d4507"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.13</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|