Version Notes
This is the version 1.0.0 stable release.
Download this release
Release Info
Developer | Tanuj Pandey |
Extension | Sonic_Fshipping |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
app/code/local/Sonic/Fshipping/Model/Carrier.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Sonic_Fshipping_Model_Carrier extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface {
|
4 |
+
|
5 |
+
protected $_code = 'sonic_fshipping';
|
6 |
+
|
7 |
+
public function collectRates(
|
8 |
+
Mage_Shipping_Model_Rate_Request $request
|
9 |
+
) {
|
10 |
+
$result = Mage::getModel('shipping/rate_result');
|
11 |
+
/* @var $result Mage_Shipping_Model_Rate_Result */
|
12 |
+
|
13 |
+
if(!$this->_error){
|
14 |
+
$packageQty = $request->getPackageQty();
|
15 |
+
$result->append($this->_getStandardShippingRate());
|
16 |
+
}
|
17 |
+
else{
|
18 |
+
$result->append($this->getConfigData('error_message'));
|
19 |
+
}
|
20 |
+
|
21 |
+
return $result;
|
22 |
+
}
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
protected function _getStandardShippingRate() {
|
27 |
+
$rate = Mage::getModel('shipping/rate_result_method');
|
28 |
+
/* @var $rate Mage_Shipping_Model_Rate_Result_Method */
|
29 |
+
$rate->setCarrier($this->_code);
|
30 |
+
$rate->setCarrierTitle($this->getConfigData('title'));
|
31 |
+
$rate->setMethod('express');
|
32 |
+
$rate->setMethodTitle($this->getConfigData('method'));
|
33 |
+
$price = $this->getConfigData('order_amount');
|
34 |
+
$customerList = $this->getConfigData('customer_list');
|
35 |
+
|
36 |
+
if($customerList != ""){
|
37 |
+
$customersAr = explode(",",$customerList);
|
38 |
+
if(count($customersAr)>0){
|
39 |
+
$customers = $customersAr;
|
40 |
+
}
|
41 |
+
else{
|
42 |
+
$customers = array($customersAr);
|
43 |
+
}
|
44 |
+
|
45 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
46 |
+
$loggedInCustomerId = $customerData->getId();
|
47 |
+
|
48 |
+
if(in_array($loggedInCustomerId,$customers)){
|
49 |
+
$price = 0;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
$rate->setPrice($price);
|
53 |
+
$rate->setCost($price);
|
54 |
+
return $rate;
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
public function getAllowedMethods() {
|
59 |
+
return array(
|
60 |
+
'standard' => 'Standard'
|
61 |
+
);
|
62 |
+
}
|
63 |
+
|
64 |
+
public function toOptionArray()
|
65 |
+
{
|
66 |
+
$collection = Mage::getModel('customer/customer')->getCollection()
|
67 |
+
->addAttributeToSelect('firstname')
|
68 |
+
->addAttributeToSelect('lastname');
|
69 |
+
|
70 |
+
$customer = array();
|
71 |
+
$cntr = 0;
|
72 |
+
foreach ($collection as $item)
|
73 |
+
{
|
74 |
+
$customer[$cntr]['value'] = $item->getId();
|
75 |
+
$customer[$cntr]['label'] = $item->getFirstname()." ".$item->getLastname();
|
76 |
+
$cntr++;
|
77 |
+
}
|
78 |
+
return $customer;
|
79 |
+
}
|
80 |
+
}
|
app/code/local/Sonic/Fshipping/etc/config.xml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sonic_Fshipping>
|
5 |
+
<module>0.0.1</module>
|
6 |
+
</Sonic_Fshipping>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<models>
|
10 |
+
<sonic_fshipping>
|
11 |
+
<class>Sonic_Fshipping_Model</class>
|
12 |
+
</sonic_fshipping>
|
13 |
+
</models>
|
14 |
+
</global>
|
15 |
+
<!-- Default configuration -->
|
16 |
+
<default>
|
17 |
+
<carriers>
|
18 |
+
<sonic_fshipping>
|
19 |
+
<active>1</active>
|
20 |
+
<!--
|
21 |
+
This configuration should not be made visible
|
22 |
+
to the administrator, because it specifies
|
23 |
+
the model to be used for this carrier.
|
24 |
+
-->
|
25 |
+
<model>sonic_fshipping/carrier</model>
|
26 |
+
<!--
|
27 |
+
The title as referenced in the carrier class
|
28 |
+
-->
|
29 |
+
<title>Free Shipping</title>
|
30 |
+
|
31 |
+
<method>Free</method>
|
32 |
+
|
33 |
+
<order_amount>50</order_amount>
|
34 |
+
|
35 |
+
<error_message>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</error_message>
|
36 |
+
<!--
|
37 |
+
The sort order specifies the position that
|
38 |
+
this carrier appears relative to the other
|
39 |
+
carriers available in checkout.
|
40 |
+
-->
|
41 |
+
<sort_order>10</sort_order>
|
42 |
+
<!--
|
43 |
+
Out of the box, Magento offers shipping
|
44 |
+
carriers the ability to restrict themselves
|
45 |
+
to specific countries. For this configuration
|
46 |
+
option, 0 means allow all countries available,
|
47 |
+
and 1 means allow all countries specified
|
48 |
+
in the country list that we will add later
|
49 |
+
in system.xml
|
50 |
+
-->
|
51 |
+
<sallowspecific>0</sallowspecific>
|
52 |
+
</sonic_fshipping>
|
53 |
+
</carriers>
|
54 |
+
</default>
|
55 |
+
</config>
|
app/code/local/Sonic/Fshipping/etc/system.xml
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<carriers translate="label" module="shipping">
|
5 |
+
<groups>
|
6 |
+
<sonic_fshipping translate="label">
|
7 |
+
<label>Sonic Free Shipping</label>
|
8 |
+
<frontend_type>text</frontend_type>
|
9 |
+
<sort_order>2</sort_order>
|
10 |
+
<show_in_default>1</show_in_default>
|
11 |
+
<show_in_website>1</show_in_website>
|
12 |
+
<show_in_store>1</show_in_store>
|
13 |
+
<fields>
|
14 |
+
<!--
|
15 |
+
The following fields are available
|
16 |
+
to modify in the admin panel.
|
17 |
+
The values are saved in the
|
18 |
+
database.
|
19 |
+
|
20 |
+
This shipping carrier abstract checks
|
21 |
+
this value to determine whether
|
22 |
+
the carrier should be shown.
|
23 |
+
-->
|
24 |
+
<active translate="label">
|
25 |
+
<label>Enabled</label>
|
26 |
+
<frontend_type>select</frontend_type>
|
27 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
28 |
+
<sort_order>1</sort_order>
|
29 |
+
<show_in_default>1</show_in_default>
|
30 |
+
<show_in_website>1</show_in_website>
|
31 |
+
<show_in_store>0</show_in_store>
|
32 |
+
</active>
|
33 |
+
<!--
|
34 |
+
This value can be used to specify a
|
35 |
+
custom title for our method.
|
36 |
+
-->
|
37 |
+
<title translate="label">
|
38 |
+
<label>Title</label>
|
39 |
+
<frontend_type>text</frontend_type>
|
40 |
+
<sort_order>2</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</title>
|
45 |
+
|
46 |
+
<method translate="label">
|
47 |
+
<label>Method Name</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>3</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</method>
|
54 |
+
|
55 |
+
<order_amount translate="label">
|
56 |
+
<label>Minimum Order Amount</label>
|
57 |
+
<frontend_type>text</frontend_type>
|
58 |
+
<sort_order>4</sort_order>
|
59 |
+
<show_in_default>1</show_in_default>
|
60 |
+
<show_in_website>1</show_in_website>
|
61 |
+
<show_in_store>1</show_in_store>
|
62 |
+
</order_amount>
|
63 |
+
|
64 |
+
<error_message translate="label">
|
65 |
+
<label>Displayed Error Message</label>
|
66 |
+
<frontend_type>textarea</frontend_type>
|
67 |
+
<sort_order>5</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 |
+
</error_message>
|
72 |
+
|
73 |
+
<!--
|
74 |
+
The sort order is used in Magento
|
75 |
+
to determine what order the carrier
|
76 |
+
will appear in relative to the
|
77 |
+
other carriers available.
|
78 |
+
-->
|
79 |
+
<sort_order translate="label">
|
80 |
+
<label>Sort Order</label>
|
81 |
+
<frontend_type>text</frontend_type>
|
82 |
+
<sort_order>100</sort_order>
|
83 |
+
<show_in_default>1</show_in_default>
|
84 |
+
<show_in_website>1</show_in_website>
|
85 |
+
<show_in_store>0</show_in_store>
|
86 |
+
</sort_order>
|
87 |
+
<!--
|
88 |
+
This value is used to specify whether
|
89 |
+
the carrier is available only for
|
90 |
+
specific countries or all countries
|
91 |
+
available in the current Magento
|
92 |
+
installation.
|
93 |
+
-->
|
94 |
+
<sallowspecific translate="label">
|
95 |
+
<label>Ship to Applicable Countries</label>
|
96 |
+
<frontend_type>select</frontend_type>
|
97 |
+
<sort_order>90</sort_order>
|
98 |
+
<frontend_class>shipping-applicable-country</frontend_class>
|
99 |
+
<source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
|
100 |
+
<show_in_default>1</show_in_default>
|
101 |
+
<show_in_website>1</show_in_website>
|
102 |
+
<show_in_store>0</show_in_store>
|
103 |
+
</sallowspecific>
|
104 |
+
<!--
|
105 |
+
If 'specific countries' is chosen
|
106 |
+
in the previous option, then this field
|
107 |
+
allows the administrator to specify
|
108 |
+
which specific countries this carrier
|
109 |
+
should be available for.
|
110 |
+
-->
|
111 |
+
<specificcountry translate="label">
|
112 |
+
<label>Ship to Specific Countries</label>
|
113 |
+
<frontend_type>multiselect</frontend_type>
|
114 |
+
<sort_order>91</sort_order>
|
115 |
+
<source_model>adminhtml/system_config_source_country</source_model>
|
116 |
+
<show_in_default>1</show_in_default>
|
117 |
+
<show_in_website>1</show_in_website>
|
118 |
+
<show_in_store>0</show_in_store>
|
119 |
+
<can_be_empty>1</can_be_empty>
|
120 |
+
</specificcountry>
|
121 |
+
|
122 |
+
<customer_list translate="label">
|
123 |
+
<label>Free Shipping to specific customers</label>
|
124 |
+
<frontend_type>multiselect</frontend_type>
|
125 |
+
<sort_order>200</sort_order>
|
126 |
+
<source_model>sonic_fshipping/carrier</source_model>
|
127 |
+
<show_in_default>1</show_in_default>
|
128 |
+
<show_in_website>1</show_in_website>
|
129 |
+
<show_in_store>0</show_in_store>
|
130 |
+
<can_be_empty>1</can_be_empty>
|
131 |
+
</customer_list>
|
132 |
+
|
133 |
+
</fields>
|
134 |
+
</sonic_fshipping>
|
135 |
+
</groups>
|
136 |
+
</carriers>
|
137 |
+
</sections>
|
138 |
+
</config>
|
app/etc/modules/Sonic_Fshipping.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Sonic_Fshipping>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>local</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Shipping />
|
9 |
+
</depends>
|
10 |
+
</Sonic_Fshipping>
|
11 |
+
</modules>
|
12 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Sonic_Fshipping</name>
|
4 |
+
<version>1.0.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>Sonic Free Shipping enables the free shipping option for multiple or individual specific customers.</summary>
|
10 |
+
<description>Sonic Free Shipping for specific customers
|
11 |
+

|
12 |
+

|
13 |
+
Overview
|
14 |
+

|
15 |
+

|
16 |
+
The module allows you to apply free shipping on specific customers. It adds a multi select option that contains a list with all store customers in Free Shipping module settings. You can select one or multiple customers that will always get free shipping option.
|
17 |
+

|
18 |
+

|
19 |
+
Usage
|
20 |
+

|
21 |
+

|
22 |
+
All you need to do is:
|
23 |
+

|
24 |
+
- Install the module - the installation is simple and straightforward. Extract the archive and copy the directory called "app" to your Magento root directory. It contains all the files of the module.
|
25 |
+

|
26 |
+
- Select customers that will get free shipping.
|
27 |
+

|
28 |
+
- You can also set the price for the remaining non selected customers.</description>
|
29 |
+
<notes>This is the version 1.0.0 stable release.</notes>
|
30 |
+
<authors><author><name>Tanuj Pandey</name><user>TanujP</user><email>tanuj.d.pandey@gmail.com</email></author></authors>
|
31 |
+
<date>2015-03-26</date>
|
32 |
+
<time>13:36:46</time>
|
33 |
+
<contents><target name="magelocal"><dir name="Sonic"><dir name="Fshipping"><dir name="Model"><file name="Carrier.php" hash="a501c08bf97f0f9458b0d0a3ecd57917"/></dir><dir name="etc"><file name="config.xml" hash="e5db89324fb65946f5c0782d941ee811"/><file name="system.xml" hash="e5362dbfc64229e61108e516ff4c95ba"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Sonic_Fshipping.xml" hash="07a59610c1e327878bf1177cfc8aeb6c"/></dir></target></contents>
|
34 |
+
<compatible/>
|
35 |
+
<dependencies><required><php><min>5.2.0</min><max>5.6.0</max></php></required></dependencies>
|
36 |
+
</package>
|