MaxicycleCom_Connector - Version 1.0.7

Version Notes

v1.0.7
Minor Refactoring
v1.0.6
New hooks for custom checkouts that do not use Magento's default hooks.

If the sku needs to be added at the beginn of the checkout, some payment providers like Klarna require that the following hook need need to be triggered

* maxicycle_add_product_to_quote

If the sales_order_place_after hook is not triggered the following hook needs to be triggered

* maxicycle_add_product_to_order

v1.0.5
Added compatibility with Klarna
v1.0.4
Fixed bug in PHP 5.4
v1.0.3
Refresh caching
Fix bug when having a multi store setup for SKU check

v1.0.2
Bug fix release

v1.0.1
Stability improvements
Logging into separate logfile

v.1.0.0
* Initial official release

Download this release

Release Info

Developer Maxicycle Software GmbH
Extension MaxicycleCom_Connector
Version 1.0.7
Comparing to
See all releases


Code changes from version 1.0.5 to 1.0.7

app/code/community/Maxicycle/Connector/Model/Observer.php CHANGED
@@ -28,13 +28,35 @@ class Maxicycle_Connector_Model_Observer{
28
  private function getActiveCampaigns() {
29
  return $this->_db->fetchAll("SELECT * FROM " . $this->_dbResource->getTableName('maxicycle/campaigns') . " WHERE campaign_start <= '$this->_now' AND response_time_end >= '$this->_now' AND store_id = " . Mage::app()->getStore()->getId());
30
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  // will add product to quote table to have product ready for payment methods
33
  // like Klarna which sends the cart items before the actual order creation
34
- public function add_product_to_quote($observer) {
35
- Mage::log('controller_action_predispatch_checkout_onepage_index', null, 'maxicycle.log');
36
  try {
37
- $quote = $this->getQuote();
38
  $this->setConfig($quote->getStoreId());
39
  if ($this->moduleEnabled() && $this->checkoutEnabled() && !$this->hasCampaignOrderTypeSet($quote)) {
40
  Mage::log('QUOTE: adding product to order', null, 'maxicycle.log');
28
  private function getActiveCampaigns() {
29
  return $this->_db->fetchAll("SELECT * FROM " . $this->_dbResource->getTableName('maxicycle/campaigns') . " WHERE campaign_start <= '$this->_now' AND response_time_end >= '$this->_now' AND store_id = " . Mage::app()->getStore()->getId());
30
  }
31
+
32
+ // manually triggered event for quote
33
+ public function maxicycle_add_product_to_quote_hook($observer) {
34
+ Mage::log('Event hook maxicycle_add_product_to_quote', null, 'maxicycle.log');
35
+ try {
36
+ $quote = $observer->getQuote();
37
+ $this->add_product_to_quote($quote);
38
+ }
39
+ catch(Exception $e) {
40
+ Mage::log('QUOTE: maxicycle_add_product_to_quote hook failed: ' .$e->getMessage(), null, 'maxicycle.log');
41
+ }
42
+ }
43
+
44
+ // triggered by event observer
45
+ public function one_page_checkout_hook($observer) {
46
+ Mage::log('controller_action_predispatch_checkout_onepage_index', null, 'maxicycle.log');
47
+ try {
48
+ $quote = $this->getQuote();
49
+ $this->add_product_to_quote($quote);
50
+ }
51
+ catch(Exception $e) {
52
+ Mage::log('QUOTE: one_page_checkout hook failed: ' .$e->getMessage(), null, 'maxicycle.log');
53
+ }
54
+ }
55
 
56
  // will add product to quote table to have product ready for payment methods
57
  // like Klarna which sends the cart items before the actual order creation
58
+ public function add_product_to_quote($quote) {
 
59
  try {
 
60
  $this->setConfig($quote->getStoreId());
61
  if ($this->moduleEnabled() && $this->checkoutEnabled() && !$this->hasCampaignOrderTypeSet($quote)) {
62
  Mage::log('QUOTE: adding product to order', null, 'maxicycle.log');
app/code/community/Maxicycle/Connector/etc/config.xml CHANGED
@@ -12,7 +12,7 @@
12
  <config>
13
  <modules>
14
  <Maxicycle_Connector>
15
- <version>1.0.5</version>
16
  </Maxicycle_Connector>
17
  </modules>
18
 
@@ -94,7 +94,7 @@
94
  <maxicycle>
95
  <type>singleton</type>
96
  <class>maxicycle/observer</class>
97
- <method>add_product_to_quote</method>
98
  </maxicycle>
99
  </observers>
100
  </controller_action_predispatch_checkout_onepage_index>
@@ -106,7 +106,25 @@
106
  <method>sales_order_save_after</method>
107
  </maxicycle>
108
  </observers>
109
- </sales_order_save_after>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  </events>
111
  </global>
112
 
12
  <config>
13
  <modules>
14
  <Maxicycle_Connector>
15
+ <version>1.0.7</version>
16
  </Maxicycle_Connector>
17
  </modules>
18
 
94
  <maxicycle>
95
  <type>singleton</type>
96
  <class>maxicycle/observer</class>
97
+ <method>one_page_checkout_hook</method>
98
  </maxicycle>
99
  </observers>
100
  </controller_action_predispatch_checkout_onepage_index>
106
  <method>sales_order_save_after</method>
107
  </maxicycle>
108
  </observers>
109
+ </sales_order_save_after>
110
+ <maxicycle_connector_add_product_to_quote>
111
+ <observers>
112
+ <maxicycle>
113
+ <type>singleton</type>
114
+ <class>maxicycle/observer</class>
115
+ <method>maxicycle_add_product_to_quote_hook</method>
116
+ </maxicycle>
117
+ </observers>
118
+ </maxicycle_connector_add_product_to_quote>
119
+ <maxicycle_connector_add_product_to_order>
120
+ <observers>
121
+ <maxicycle>
122
+ <type>singleton</type>
123
+ <class>maxicycle/observer</class>
124
+ <method>add_product_to_order</method>
125
+ </maxicycle>
126
+ </observers>
127
+ </maxicycle_connector_add_product_to_order>
128
  </events>
129
  </global>
130
 
app/design/adminhtml/default/default/template/maxicycle/connector/installation/step1.phtml CHANGED
@@ -181,10 +181,10 @@
181
  <td class="value">
182
  <input type="checkbox" value="1" name="add_during_checkout" <?php echo (intval($config['add_during_checkout']) == 1 ? ' checked' : ''); ?>>
183
  <p class="note">
184
- <span><?php echo $this->__('Check this box e.g. if you use Klarna invoice.'); ?></span>
185
  </p>
186
  </td>
187
- </tr>
188
  </table>
189
  </div>
190
  </div>
181
  <td class="value">
182
  <input type="checkbox" value="1" name="add_during_checkout" <?php echo (intval($config['add_during_checkout']) == 1 ? ' checked' : ''); ?>>
183
  <p class="note">
184
+ <span><?php echo $this->__('Check this box if you need to add the sku before placing the order (e.g. Klarna). Magento\'s default onepage Checkout is required.'); ?></span>
185
  </p>
186
  </td>
187
+ </tr>
188
  </table>
189
  </div>
190
  </div>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MaxicycleCom_Connector</name>
4
- <version>1.0.5</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.maxicycle/license">Copyright Maxicycle Software GmbH 2015</license>
7
  <channel>community</channel>
@@ -11,7 +11,20 @@
11
  &#xD;
12
  Did you know that enclosing package inserts (coupons, catalogs, freebies, product samples, etc.) are extremely effective in driving follow-up orders from your existing customer base? Maxicycle is the solution that turns your packages into a real performance-based retention marketing channel with an amazing ROI: Create, manage, measure and optimise package inserts in a similar way than you are used from your AdWords or Facebook ads.&#xD;
13
  </description>
14
- <notes>v1.0.5&#xD;
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  Added compatibility with Klarna&#xD;
16
  v1.0.4&#xD;
17
  Fixed bug in PHP 5.4&#xD;
@@ -29,9 +42,9 @@ Logging into separate logfile&#xD;
29
  v.1.0.0&#xD;
30
  * Initial official release</notes>
31
  <authors><author><name>Maxicycle Software GmbH</name><user>maxicycle</user><email>support@maxicycle.com</email></author></authors>
32
- <date>2015-10-09</date>
33
- <time>07:12:57</time>
34
- <contents><target name="mageetc"><dir name="modules"><file name="Maxicycle_Connector.xml" hash="0d64b2d2ad66099e225460c349125557"/></dir></target><target name="magecommunity"><dir name="Maxicycle"><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><dir name="Campaigns"><file name="Grid.php" hash="c350b3b4e428bf5f11027a97e38167ae"/></dir><file name="Campaigns.php" hash="b09c985fc4215ecd937024e0364f319b"/><dir name="Cronlog"><file name="Grid.php" hash="256284d0455dbb136baf8e00d2a71a89"/></dir><file name="Cronlog.php" hash="577f5e50a80fbac7b83cf8d5727bbb5f"/><dir name="Results"><file name="Grid.php" hash="4236c80b8faa31e6cba5f184e0d45adc"/><dir name="Renderer"><file name="Campaign.php" hash="ef4d3f0cd6c3558367f82e07853414e6"/><file name="Flag2.php" hash="d8779254a77e19da81c91e81452a7e43"/><file name="Order.php" hash="aecdc4cb460c558773660778060cde0f"/></dir></dir><file name="Results.php" hash="4d32a5f15b1f3a18434e3b2754030659"/></dir></dir><dir name="Helper"><file name="Data.php" hash="a7df4cd21dc681b1887b21276e099c53"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="71be3bc47c32463bc8f6f84e901719ef"/><file name="Rest.php" hash="260c1849fc5dba7b5698d5160f427d5d"/></dir><file name="Campaigns.php" hash="4e60821d8a19ea5391921e5b358257dc"/><file name="Cronlog.php" hash="dc5eec5445c6c703429992b749c8ef2c"/><dir name="Mysql4"><dir name="Campaigns"><file name="Collection.php" hash="880cbcd1ab65efb9096965c267ad35cc"/></dir><file name="Campaigns.php" hash="98143aae26423260cccb496aac9d28f2"/><dir name="Cronlog"><file name="Collection.php" hash="44d321c218f66619fbbf14271fca361f"/></dir><file name="Cronlog.php" hash="299749238a435407cce37b5dc524c466"/><dir name="Results"><file name="Collection.php" hash="8b046e56516f2f1893b6f3d1e6e2b228"/><dir name="Renderer"><file name="Actions.php" hash="da76e0352436e0570c8e6506a121d031"/><file name="Status.php" hash="37878ac8231edee56041b714077f7aec"/></dir></dir><file name="Results.php" hash="8898f253c8dce9ebe3a6b289e26945a6"/></dir><file name="Observer.php" hash="fcf1cef79925c7bc67479fe7f2be04a4"/><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="ccae8f6fc1d48cb5ef6b761211e75bd9"/></dir></dir><file name="Results.php" hash="246fff1018a0b03f521ba96ec61b8a8e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CampaignsController.php" hash="420557976cfeda32353ce0b5f435a252"/><file name="CronlogController.php" hash="eb58983412dec2890d22138adecb95a7"/><file name="InstallationController.php" hash="8f338320862fc72b7f2eaaf5a918e293"/><file name="ResultsController.php" hash="78633bbdd767350c56deef829c7b4a62"/></dir><file name="TestConnectionController.php" hash="ddb67e441e3478d45632905b78e5c362"/><file name="V1Controller.php" hash="8cf992ec3ab988d3b11f8428ea98d501"/></dir><dir name="data"><file name="data_sample.sql" hash="c02ad04dc9c1b43814ac7877970ab1ae"/></dir><dir name="etc"><file name="adminhtml.xml" hash="363126b0e935810dd07d42426ce9f766"/><file name="config.xml" hash="403a42ac42d65dc92b9dc4b69f97eb69"/></dir><dir name="sql"><dir name="maxicycle_setup"><file name="mysql4-install-1.0.0.php" hash="ac322e77f8b08beb2d326426f2c23121"/><file name="upgrade-1.0.0-1.0.1.php" hash="dba0e0a874a87c101b379de988646b1f"/><file name="upgrade-1.0.3-1.0.4.php" hash="dba0e0a874a87c101b379de988646b1f"/><file name="upgrade-1.0.4-1.0.5.php" hash="28f1d904f1dc1bebb1436bd93dca0122"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="maxicycle"><dir name="connector"><dir name="installation"><file name="step1.phtml" hash="1e6b091fb1c9f94533b2015835030d91"/></dir></dir></dir></dir><dir name="layout"><dir name="maxicycle"><dir name="connector"><file name="layout.xml" hash="b4c388d059df42d365c945f972e8cfca"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="maxicycle"><dir name="connector"><dir name="css"><file name="css.css" hash="6cb4c9ca0ce1288f028ea80284d368ae"/></dir></dir></dir></dir></dir></dir></target></contents>
35
  <compatible/>
36
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
37
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>MaxicycleCom_Connector</name>
4
+ <version>1.0.7</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.maxicycle/license">Copyright Maxicycle Software GmbH 2015</license>
7
  <channel>community</channel>
11
  &#xD;
12
  Did you know that enclosing package inserts (coupons, catalogs, freebies, product samples, etc.) are extremely effective in driving follow-up orders from your existing customer base? Maxicycle is the solution that turns your packages into a real performance-based retention marketing channel with an amazing ROI: Create, manage, measure and optimise package inserts in a similar way than you are used from your AdWords or Facebook ads.&#xD;
13
  </description>
14
+ <notes>v1.0.7&#xD;
15
+ Minor Refactoring&#xD;
16
+ v1.0.6&#xD;
17
+ New hooks for custom checkouts that do not use Magento's default hooks.&#xD;
18
+ &#xD;
19
+ If the sku needs to be added at the beginn of the checkout, some payment providers like Klarna require that the following hook need need to be triggered&#xD;
20
+ &#xD;
21
+ * maxicycle_add_product_to_quote&#xD;
22
+ &#xD;
23
+ If the sales_order_place_after hook is not triggered the following hook needs to be triggered&#xD;
24
+ &#xD;
25
+ * maxicycle_add_product_to_order&#xD;
26
+ &#xD;
27
+ v1.0.5&#xD;
28
  Added compatibility with Klarna&#xD;
29
  v1.0.4&#xD;
30
  Fixed bug in PHP 5.4&#xD;
42
  v.1.0.0&#xD;
43
  * Initial official release</notes>
44
  <authors><author><name>Maxicycle Software GmbH</name><user>maxicycle</user><email>support@maxicycle.com</email></author></authors>
45
+ <date>2015-10-20</date>
46
+ <time>19:54:42</time>
47
+ <contents><target name="mageetc"><dir name="modules"><file name="Maxicycle_Connector.xml" hash="0d64b2d2ad66099e225460c349125557"/></dir></target><target name="magecommunity"><dir name="Maxicycle"><dir name="Connector"><dir name="Block"><dir name="Adminhtml"><dir name="Campaigns"><file name="Grid.php" hash="c350b3b4e428bf5f11027a97e38167ae"/></dir><file name="Campaigns.php" hash="b09c985fc4215ecd937024e0364f319b"/><dir name="Cronlog"><file name="Grid.php" hash="256284d0455dbb136baf8e00d2a71a89"/></dir><file name="Cronlog.php" hash="577f5e50a80fbac7b83cf8d5727bbb5f"/><dir name="Results"><file name="Grid.php" hash="4236c80b8faa31e6cba5f184e0d45adc"/><dir name="Renderer"><file name="Campaign.php" hash="ef4d3f0cd6c3558367f82e07853414e6"/><file name="Flag2.php" hash="d8779254a77e19da81c91e81452a7e43"/><file name="Order.php" hash="aecdc4cb460c558773660778060cde0f"/></dir></dir><file name="Results.php" hash="4d32a5f15b1f3a18434e3b2754030659"/></dir></dir><dir name="Helper"><file name="Data.php" hash="a7df4cd21dc681b1887b21276e099c53"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="71be3bc47c32463bc8f6f84e901719ef"/><file name="Rest.php" hash="260c1849fc5dba7b5698d5160f427d5d"/></dir><file name="Campaigns.php" hash="4e60821d8a19ea5391921e5b358257dc"/><file name="Cronlog.php" hash="dc5eec5445c6c703429992b749c8ef2c"/><dir name="Mysql4"><dir name="Campaigns"><file name="Collection.php" hash="880cbcd1ab65efb9096965c267ad35cc"/></dir><file name="Campaigns.php" hash="98143aae26423260cccb496aac9d28f2"/><dir name="Cronlog"><file name="Collection.php" hash="44d321c218f66619fbbf14271fca361f"/></dir><file name="Cronlog.php" hash="299749238a435407cce37b5dc524c466"/><dir name="Results"><file name="Collection.php" hash="8b046e56516f2f1893b6f3d1e6e2b228"/><dir name="Renderer"><file name="Actions.php" hash="da76e0352436e0570c8e6506a121d031"/><file name="Status.php" hash="37878ac8231edee56041b714077f7aec"/></dir></dir><file name="Results.php" hash="8898f253c8dce9ebe3a6b289e26945a6"/></dir><file name="Observer.php" hash="03036e17fe2bd7b1c7294f5cee9ad7b0"/><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="ccae8f6fc1d48cb5ef6b761211e75bd9"/></dir></dir><file name="Results.php" hash="246fff1018a0b03f521ba96ec61b8a8e"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="CampaignsController.php" hash="420557976cfeda32353ce0b5f435a252"/><file name="CronlogController.php" hash="eb58983412dec2890d22138adecb95a7"/><file name="InstallationController.php" hash="8f338320862fc72b7f2eaaf5a918e293"/><file name="ResultsController.php" hash="78633bbdd767350c56deef829c7b4a62"/></dir><file name="TestConnectionController.php" hash="ddb67e441e3478d45632905b78e5c362"/><file name="V1Controller.php" hash="8cf992ec3ab988d3b11f8428ea98d501"/></dir><dir name="data"><file name="data_sample.sql" hash="c02ad04dc9c1b43814ac7877970ab1ae"/></dir><dir name="etc"><file name="adminhtml.xml" hash="363126b0e935810dd07d42426ce9f766"/><file name="config.xml" hash="9aeb95efe08ad5d9d72e653b5c4156fb"/></dir><dir name="sql"><dir name="maxicycle_setup"><file name="mysql4-install-1.0.0.php" hash="ac322e77f8b08beb2d326426f2c23121"/><file name="upgrade-1.0.0-1.0.1.php" hash="dba0e0a874a87c101b379de988646b1f"/><file name="upgrade-1.0.3-1.0.4.php" hash="dba0e0a874a87c101b379de988646b1f"/><file name="upgrade-1.0.4-1.0.5.php" hash="28f1d904f1dc1bebb1436bd93dca0122"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="maxicycle"><dir name="connector"><dir name="installation"><file name="step1.phtml" hash="498b5417c51c5b7d92bb46a17caeb9fa"/></dir></dir></dir></dir><dir name="layout"><dir name="maxicycle"><dir name="connector"><file name="layout.xml" hash="b4c388d059df42d365c945f972e8cfca"/></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="maxicycle"><dir name="connector"><dir name="css"><file name="css.css" hash="6cb4c9ca0ce1288f028ea80284d368ae"/></dir></dir></dir></dir></dir></dir></target></contents>
48
  <compatible/>
49
  <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
50
  </package>