Clearandfizzy_Reducedcheckout - Version 1.3.0

Version Notes

Did we add new features?

Yes



Did you fix a bunch of Bugs?

No



Well then, what in funkytown did you do?

Added the ability to skip checkout steps based on Customer Groups.

Download this release

Release Info

Developer Gareth Price
Extension Clearandfizzy_Reducedcheckout
Version 1.3.0
Comparing to
See all releases


Code changes from version 1.2.2 to 1.3.0

app/code/community/Clearandfizzy/Reducedcheckout/Helper/Data.php CHANGED
@@ -12,30 +12,88 @@ class Clearandfizzy_Reducedcheckout_Helper_Data extends Mage_Core_Helper_Abstrac
12
  return $value;
13
  } // end
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  public function isGuestCheckoutOnly() {
16
- $value = Mage::getStoreConfig('clearandfizzy_reducedcheckout_settings/reducedcheckout/guestcheckoutonly');
17
  return $value;
18
  } // end
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * Returns true if we should force the payment method
22
  * @return boolean
23
  */
24
  public function skipPaymentMethod() {
25
  $code = $this->getPaymentMethod();
 
 
26
 
27
  switch ($code) {
28
 
29
  case "noskip":
30
- return false;
31
  break;
32
 
33
  default:
34
- return true;
35
  break;
36
 
37
  } // end sw
38
 
 
 
39
  } // end fun
40
 
41
  /**
@@ -44,20 +102,48 @@ class Clearandfizzy_Reducedcheckout_Helper_Data extends Mage_Core_Helper_Abstrac
44
  */
45
  public function skipShippingMethod() {
46
  $code = $this->getShippingMethod();
 
 
47
 
48
  switch ($code) {
49
 
50
  case "noskip":
51
- return false;
52
  break;
53
 
54
  default:
55
- return true;
56
  break;
57
 
58
  } // end sw
59
 
 
 
60
  } // end fun
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  }
63
 
12
  return $value;
13
  } // end
14
 
15
+ public function getCustomerGroupsEnabled() {
16
+ $value = Mage::getStoreConfig('clearandfizzy_reducedcheckout_settings/reducedcheckout_customergroups/customergroups_enabled');
17
+ return $value;
18
+ }
19
+
20
+ public function getShippingCustomerGroups() {
21
+
22
+ if ($this->getCustomerGroupsEnabled() == 0) {
23
+ return array();
24
+ } // end
25
+
26
+ $value = Mage::getStoreConfig('clearandfizzy_reducedcheckout_settings/reducedcheckout_customergroups/shipping_noskip_customergroups');
27
+ $value = explode(',', $value);
28
+
29
+ return $value;
30
+ } // end
31
+
32
+ public function getPaymentCustomerGroups() {
33
+
34
+ if ($this->getCustomerGroupsEnabled() == 0) {
35
+ return array();
36
+ } // end
37
+
38
+ $value = Mage::getStoreConfig('clearandfizzy_reducedcheckout_settings/reducedcheckout_customergroups/payment_noskip_customergroups');
39
+ $value = explode(',', $value);
40
+
41
+ return $value;
42
+ } // end
43
+
44
  public function isGuestCheckoutOnly() {
45
+ $value = Mage::getStoreConfig('clearandfizzy_reducedcheckout_settings/reducedcheckout_customergroups/guestcheckoutonly');
46
  return $value;
47
  } // end
48
 
49
+
50
+ /**
51
+ * Returns the current logged in customers group.
52
+ * If the customer is not logged in return false
53
+ *
54
+ * @return boolean
55
+ */
56
+ protected function getCurrentCustomersGroup() {
57
+
58
+ // Check Customer is loggedin or not
59
+ if(Mage::getSingleton('customer/session')->isLoggedIn()){
60
+
61
+ // Get group Id
62
+ $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
63
+
64
+ return $groupId;
65
+ //Get customer Group name
66
+ //$group = Mage::getModel('customer/group')->load($groupId);
67
+ //return $group->getCode();
68
+ } // end
69
+
70
+ return false;
71
+ } // end
72
+
73
+
74
  /**
75
  * Returns true if we should force the payment method
76
  * @return boolean
77
  */
78
  public function skipPaymentMethod() {
79
  $code = $this->getPaymentMethod();
80
+ $noskip_groups = $this->getPaymentCustomerGroups();
81
+ $current_group = $this->getCurrentCustomersGroup();
82
 
83
  switch ($code) {
84
 
85
  case "noskip":
86
+ $return = false;
87
  break;
88
 
89
  default:
90
+ $return = $this->skipThisSection($current_group, $noskip_groups);
91
  break;
92
 
93
  } // end sw
94
 
95
+ return $return;
96
+
97
  } // end fun
98
 
99
  /**
102
  */
103
  public function skipShippingMethod() {
104
  $code = $this->getShippingMethod();
105
+ $noskip_groups = $this->getShippingCustomerGroups();
106
+ $current_group = $this->getCurrentCustomersGroup();
107
 
108
  switch ($code) {
109
 
110
  case "noskip":
111
+ $return = false;
112
  break;
113
 
114
  default:
115
+ $return = $this->skipThisSection($current_group, $noskip_groups);
116
  break;
117
 
118
  } // end sw
119
 
120
+ return $return;
121
+
122
  } // end fun
123
 
124
+
125
+ /**
126
+ * Returns true if we should skip this section
127
+ *
128
+ * @param int $current_group customers group id
129
+ * @param array $noskip_groups array of groupid's
130
+ */
131
+ private function skipThisSection($current_group, $noskip_groups) {
132
+
133
+ // var_dump($current_group);
134
+ // var_dump($noskip_groups);
135
+ // var_dump(is_array($noskip_groups));
136
+ // var_dump(array_search($current_group, $noskip_groups));
137
+
138
+ // if we find the current users groupid in the "dont skip" array, tell checkout not to skip this section
139
+ if ( $current_group !== false && is_array($noskip_groups) && array_search($current_group, $noskip_groups) > -1 ) {
140
+ return false;
141
+ } // end
142
+
143
+ return true;
144
+
145
+ } // end
146
+
147
+
148
  }
149
 
app/code/community/Clearandfizzy/Reducedcheckout/etc/adminhtml.xml CHANGED
@@ -2,6 +2,9 @@
2
  <config>
3
  <acl>
4
  <resources>
 
 
 
5
  <admin>
6
  <children>
7
  <system>
2
  <config>
3
  <acl>
4
  <resources>
5
+ <all>
6
+ <title>Allow Everything</title>
7
+ </all>
8
  <admin>
9
  <children>
10
  <system>
app/code/community/Clearandfizzy/Reducedcheckout/etc/config.xml CHANGED
@@ -71,12 +71,18 @@
71
 
72
  <default>
73
  <clearandfizzy_reducedcheckout_settings>
 
74
  <reducedcheckout>
75
- <isenabled>1</isenabled>
76
- <guestcheckoutonly>1</guestcheckoutonly>
77
  <default_shipping>noskip</default_shipping>
78
  <default_payment>noskip</default_payment>
79
  </reducedcheckout>
 
 
 
 
 
80
  </clearandfizzy_reducedcheckout_settings>
81
  </default>
82
 
71
 
72
  <default>
73
  <clearandfizzy_reducedcheckout_settings>
74
+
75
  <reducedcheckout>
76
+ <isenabled>0</isenabled>
77
+ <guestcheckoutonly>0</guestcheckoutonly>
78
  <default_shipping>noskip</default_shipping>
79
  <default_payment>noskip</default_payment>
80
  </reducedcheckout>
81
+
82
+ <reducedcheckout_customergroups>
83
+ <customergroups_enabled>0</customergroups_enabled>
84
+ </reducedcheckout_customergroups>
85
+
86
  </clearandfizzy_reducedcheckout_settings>
87
  </default>
88
 
app/code/community/Clearandfizzy/Reducedcheckout/etc/system.xml CHANGED
@@ -49,10 +49,13 @@
49
  <show_in_website>1</show_in_website>
50
  <show_in_store>1</show_in_store>
51
  <comment><![CDATA[ <ol>
 
52
  <li>Quick checkout method without changing the Magento checkout workflow </li>
53
  <li>Allows forced Guest Registration.</li>
54
  <li>Allows forced Payment method.</li>
55
  <li>Allows forced Shipping method.</li>
 
 
56
  </ol> ]]></comment>
57
  <expanded>1</expanded>
58
  </reducedcheckout_about>
@@ -114,8 +117,59 @@
114
  </default_payment>
115
 
116
  </fields>
 
117
 
118
- </reducedcheckout>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  </groups>
120
 
121
  </clearandfizzy_reducedcheckout_settings>
49
  <show_in_website>1</show_in_website>
50
  <show_in_store>1</show_in_store>
51
  <comment><![CDATA[ <ol>
52
+ <li><h3>About</h3></li>
53
  <li>Quick checkout method without changing the Magento checkout workflow </li>
54
  <li>Allows forced Guest Registration.</li>
55
  <li>Allows forced Payment method.</li>
56
  <li>Allows forced Shipping method.</li>
57
+ <li>Allows you to setup rules based on Customer groups.</li>
58
+ <li><a target="_blank" href="http://www.magentocommerce.com/magento-connect/clearandfizzy-reduced-one-step-checkout-6893.html">http://www.magentocommerce.com/magento-connect/clearandfizzy-reduced-one-step-checkout-6893.html</a>
59
  </ol> ]]></comment>
60
  <expanded>1</expanded>
61
  </reducedcheckout_about>
117
  </default_payment>
118
 
119
  </fields>
120
+ </reducedcheckout>
121
 
122
+ <reducedcheckout_customergroups>
123
+ <label>Reduced Checkout Customer Group Settings </label>
124
+ <sort_order>30</sort_order>
125
+ <show_in_default>1</show_in_default>
126
+ <show_in_website>1</show_in_website>
127
+ <show_in_store>1</show_in_store>
128
+ <expanded>1</expanded>
129
+ <comment><![CDATA[ <ol>
130
+ <li><h3>Customer Groups Rules</h3></li>
131
+ <li>For most users its advisable to disable forced guest checkout.</li>
132
+ <li>When enabled the customer groups selected will be forced to show thier respective steps.</li>
133
+ </ol> ]]></comment>
134
+
135
+ <fields>
136
+ <customergroups_enabled>
137
+ <label>Enabled Customer Groups</label>
138
+ <frontend_type>select</frontend_type>
139
+ <source_model>adminhtml/system_config_source_yesno</source_model>
140
+ <sort_order>1</sort_order>
141
+ <show_in_default>1</show_in_default>
142
+ <show_in_website>1</show_in_website>
143
+ <show_in_store>1</show_in_store>
144
+ </customergroups_enabled>
145
+
146
+ <shipping_noskip_customergroups>
147
+ <label>Do not skip Shipping Method for Customer Groups</label>
148
+ <frontend_type>multiselect</frontend_type>
149
+ <source_model>adminhtml/system_config_source_customer_group</source_model>
150
+ <comment></comment>
151
+ <depends><customergroups_enabled>1</customergroups_enabled></depends>
152
+ <sort_order>20</sort_order>
153
+ <show_in_default>1</show_in_default>
154
+ <show_in_website>1</show_in_website>
155
+ <show_in_store>1</show_in_store>
156
+ </shipping_noskip_customergroups>
157
+
158
+ <payment_noskip_customergroups>
159
+ <label>Do not skip Payment Method for Customer Groups</label>
160
+ <frontend_type>multiselect</frontend_type>
161
+ <source_model>adminhtml/system_config_source_customer_group</source_model>
162
+ <comment></comment>
163
+ <depends><customergroups_enabled>1</customergroups_enabled></depends>
164
+ <sort_order>30</sort_order>
165
+ <show_in_default>1</show_in_default>
166
+ <show_in_website>1</show_in_website>
167
+ <show_in_store>1</show_in_store>
168
+ </payment_noskip_customergroups>
169
+ </fields>
170
+
171
+ </reducedcheckout_customergroups>
172
+
173
  </groups>
174
 
175
  </clearandfizzy_reducedcheckout_settings>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Clearandfizzy_Reducedcheckout</name>
4
- <version>1.2.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/afl-3.0.php">AFL 3.0</license>
7
  <channel>community</channel>
@@ -14,18 +14,14 @@ Integration with 3rd-party payment and shipping extensions should be easy as thi
14
  Yes&lt;br /&gt;&#xD;
15
  &lt;br /&gt;&#xD;
16
  Did you fix a bunch of Bugs?&lt;br /&gt;&#xD;
17
- Yes&lt;br /&gt;&#xD;
18
  &lt;br /&gt;&#xD;
19
  Well then, what in funkytown did you do?&lt;br /&gt;&#xD;
20
- * You can now decide which checkout steps are skipped.&lt;br /&gt;&#xD;
21
- * Fixed a bug preventing progress if the customer decided to chose an alternative shipping address.&#xD;
22
- &lt;br /&gt;&#xD;
23
- * Fixed final step JS error.&#xD;
24
- &lt;br /&gt;</notes>
25
  <authors><author><name>Gareth Price</name><user>clearandfizzy</user><email>gareth@clearandfizzy.com</email></author></authors>
26
  <date>2013-02-24</date>
27
- <time>03:32:34</time>
28
- <contents><target name="magecommunity"><dir name="Clearandfizzy"><dir name="Reducedcheckout"><dir name="Helper"><file name="Data.php" hash="4de24bcf12122165b7ef382be9c12b28"/></dir><dir name="Model"><file name="Observer.php" hash="8f4498205db5d37752b3f795816517b4"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Payment"><file name="EnabledMethods.php" hash="f6b69e6fc6697870c53c6c86dbd68e98"/></dir><dir name="Shipping"><file name="EnabledMethods.php" hash="5cf16d02a105f9699e4258bb5bc57364"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="OnepageController.php" hash="8d8d7ee733035d27a202cbd277041267"/></dir><dir name="etc"><file name="adminhtml.xml" hash="477add7dac98d6903555708e178761ce"/><file name="config.xml" hash="294dc1059cfd09e10e9d6175fd9639e4"/><file name="system.xml" hash="457f256018d0a0ae317581832673e09d"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clearandfizzy_ReducedCheckout.xml" hash="9cb58e8121e0c0e294f10a3595b2be7d"/></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="clearandfizzy"><dir name="reducedcheckout"><file name="reducedcheckout.xml" hash="282aeb07fe3b9510bcbd92498907968f"/></dir></dir></dir><dir name="template"><dir name="clearandfizzy"><dir name="reducedcheckout"><file name="onepage.phtml" hash="21921ab772ef02af217c49200619f2d5"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
29
  <compatible/>
30
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
31
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Clearandfizzy_Reducedcheckout</name>
4
+ <version>1.3.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/afl-3.0.php">AFL 3.0</license>
7
  <channel>community</channel>
14
  Yes&lt;br /&gt;&#xD;
15
  &lt;br /&gt;&#xD;
16
  Did you fix a bunch of Bugs?&lt;br /&gt;&#xD;
17
+ No&lt;br /&gt;&#xD;
18
  &lt;br /&gt;&#xD;
19
  Well then, what in funkytown did you do?&lt;br /&gt;&#xD;
20
+ Added the ability to skip checkout steps based on Customer Groups.</notes>
 
 
 
 
21
  <authors><author><name>Gareth Price</name><user>clearandfizzy</user><email>gareth@clearandfizzy.com</email></author></authors>
22
  <date>2013-02-24</date>
23
+ <time>21:03:56</time>
24
+ <contents><target name="magecommunity"><dir name="Clearandfizzy"><dir name="Reducedcheckout"><dir name="Helper"><file name="Data.php" hash="ba32d1914690cba78aa1f88c3ce63c3f"/></dir><dir name="Model"><file name="Observer.php" hash="8f4498205db5d37752b3f795816517b4"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Payment"><file name="EnabledMethods.php" hash="f6b69e6fc6697870c53c6c86dbd68e98"/></dir><dir name="Shipping"><file name="EnabledMethods.php" hash="5cf16d02a105f9699e4258bb5bc57364"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="OnepageController.php" hash="8d8d7ee733035d27a202cbd277041267"/></dir><dir name="etc"><file name="adminhtml.xml" hash="0bb1372118e88ad09fbd1b1d5113dea7"/><file name="config.xml" hash="d6f318cedca281655d55e0813c8282a4"/><file name="system.xml" hash="4b2819dbe5db301e2067a2331ad1c145"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Clearandfizzy_ReducedCheckout.xml" hash="9cb58e8121e0c0e294f10a3595b2be7d"/></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="clearandfizzy"><dir name="reducedcheckout"><file name="reducedcheckout.xml" hash="282aeb07fe3b9510bcbd92498907968f"/></dir></dir></dir><dir name="template"><dir name="clearandfizzy"><dir name="reducedcheckout"><file name="onepage.phtml" hash="21921ab772ef02af217c49200619f2d5"/></dir></dir></dir></dir></dir></dir></dir></target></contents>
25
  <compatible/>
26
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
27
  </package>