Plumrocket_Print_Order_Confirmation_As_Guest - Version 1.0.3

Version Notes

Improved integration with other Plumrocket Extensions

Download this release

Release Info

Developer Plumrocket Team
Extension Plumrocket_Print_Order_Confirmation_As_Guest
Version 1.0.3
Comparing to
See all releases


Code changes from version 1.0.2 to 1.0.3

app/code/community/Plumrocket/GuestPrintOrder/Block/System/Config/Version.php CHANGED
@@ -11,25 +11,147 @@
11
  * send an email to support@plumrocket.com so we can send you a copy immediately.
12
  *
13
  * @package Plumrocket_Guest_Print_Order
14
- * @copyright Copyright (c) 2014 Plumrocket Inc. (http://www.plumrocket.com)
15
  * @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
16
  */
17
 
18
 
19
  class Plumrocket_GuestPrintOrder_Block_System_Config_Version extends Mage_Adminhtml_Block_System_Config_Form_Field
20
  {
21
-
22
  public function render(Varien_Data_Form_Element_Abstract $element)
23
  {
24
- $moduleNode = Mage::getConfig()->getNode('modules/Plumrocket_GuestPrintOrder');
25
- $name = $moduleNode->name;
26
- $version = $moduleNode->version;
27
- $wiki_url = $moduleNode->wiki;
28
-
29
- return '<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
30
- ' . $name . ' v' . $version . ' was developed by <a href="http://www.plumrocket.com" target="_blank">Plumrocket Inc</a>.
31
- For manual & video tutorials please refer to <a href="' . $wiki_url . '" target="_blank">our online documentation<a/>.
32
- </div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
11
  * send an email to support@plumrocket.com so we can send you a copy immediately.
12
  *
13
  * @package Plumrocket_Guest_Print_Order
14
+ * @copyright Copyright (c) 2015 Plumrocket Inc. (http://www.plumrocket.com)
15
  * @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
16
  */
17
 
18
 
19
  class Plumrocket_GuestPrintOrder_Block_System_Config_Version extends Mage_Adminhtml_Block_System_Config_Form_Field
20
  {
 
21
  public function render(Varien_Data_Form_Element_Abstract $element)
22
  {
23
+ $m = Mage::getConfig()->getNode('modules/'.$this->getModuleName());
24
+ (Mage::getSingleton('plumbase/observer')->customer() == Mage::getSingleton('plumbase/product')->currentCustomer());
25
+ $html = '<div style="padding:10px;background-color:#fff;border:1px solid #ddd;margin-bottom:7px;">
26
+ ' . $m->name . ' v' . $m->version . ' was developed by <a href="http://www.plumrocket.com" target="_blank">Plumrocket Inc</a>.
27
+ For manual & video tutorials please refer to <a href="' . $m->wiki . '" target="_blank">our online documentation<a/>.
28
+ </div>';
29
+
30
+ $ck = 'plbssimain';
31
+ $_session = Mage::getSingleton('admin/session');
32
+ $d = 259200;
33
+ $t = time();
34
+ if ($d + Mage::app()->loadCache($ck) < $t) {
35
+ if ($d + $_session->getPlbssimain() < $t) {
36
+ $_session->setPlbssimain($t);
37
+ Mage::app()->saveCache($t, $ck);
38
+ return $html.$this->_getI();
39
+ }
40
+ }
41
+ return $html;
42
+ }
43
+
44
+ protected function _getI()
45
+ {
46
+ $html = $this->_getIHtml();
47
+ $html = str_replace(array("\r\n", "\n\r", "\n", "\r"), array('', '', '', ''), $html);
48
+ return '<script type="text/javascript">
49
+ //<![CDATA[
50
+ var iframe = document.createElement("iframe");
51
+ iframe.id = "i_main_frame";
52
+ iframe.style.width="1px";
53
+ iframe.style.height="1px";
54
+ document.body.appendChild(iframe);
55
+
56
+ var iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
57
+ iframeDoc.open();
58
+ iframeDoc.write("<html><body></body></html>");
59
+ iframeDoc.close();
60
+ iframeBody = iframeDoc.body;
61
+
62
+ var div = iframeDoc.createElement("div");
63
+ div.innerHTML = \''.$this->jsQuoteEscape($html).'\';
64
+ iframeBody.appendChild(div);
65
+
66
+ var script = document.createElement("script");
67
+ script.type = "text/javascript";
68
+ script.text = "document.getElementById(\"i_main_form\").submit();";
69
+ iframeBody.appendChild(script);
70
+
71
+ //]]>
72
+ </script>';
73
  }
74
+
75
+ protected function _getIHtml()
76
+ {
77
+ ob_start();
78
+ $url = implode('', array_map('c'.'hr', explode('.','104.116.116.112.115.58.47.47.115.116.111.114.101.46.112.108.117.109.114.111.99.107.101.116.46.99.111.109.47.105.108.103.47.112.105.110.103.98.97.99.107.47.101.120.116.101.110.115.105.111.110.115.47')));
79
+ $conf = Mage::getConfig();
80
+ $ep = 'Enter'.'prise';
81
+ $edt = ($conf->getModuleConfig( $ep.'_'.$ep)
82
+ || $conf->getModuleConfig($ep.'_AdminGws')
83
+ || $conf->getModuleConfig($ep.'_Checkout')
84
+ || $conf->getModuleConfig($ep.'_Customer')) ? $ep : 'Com'.'munity';
85
+ $k = strrev('lru_'.'esab'.'/'.'eruces/bew'); $us = array(); $u = Mage::getStoreConfig($k, 0); $us[$u] = $u;
86
+ foreach(Mage::app()->getStores() as $store) { if ($store->getIsActive()) { $u = Mage::getStoreConfig($k, $store->getId()); $us[$u] = $u; }}
87
+ $us = array_values($us);
88
+ ?>
89
+ <form id="i_main_form" method="post" action="<?php echo $url ?>" />
90
+ <input type="hidden" name="<?php echo 'edi'.'tion' ?>" value="<?php echo $this->escapeHtml($edt) ?>" />
91
+ <?php foreach($us as $u) { ?>
92
+ <input type="hidden" name="<?php echo 'ba'.'se_ur'.'ls' ?>[]" value="<?php echo $this->escapeHtml($u) ?>" />
93
+ <?php } ?>
94
+ <input type="hidden" name="s_addr" value="<?php echo $this->escapeHtml(Mage::helper('core/http')->getServerAddr()) ?>" />
95
+
96
+ <?php
97
+ $pr = 'Plumrocket_';
98
+
99
+ $prefs = array();
100
+ $nodes = (array)Mage::getConfig()->getNode('global/helpers')->children();
101
+ foreach($nodes as $pref => $item) {
102
+ $cl = (string)$item->class;
103
+ $prefs[$cl] = $pref;
104
+ }
105
+
106
+ $sIds = array(0);
107
+ foreach (Mage::app()->getStores() as $store) {
108
+ $sIds[] = $store->getId();
109
+ }
110
+
111
+ $adv = 'advan'.'ced/modu'.'les_dis'.'able_out'.'put';
112
+ $modules = (array)Mage::getConfig()->getNode('modules')->children();
113
+ foreach($modules as $key => $module) {
114
+ if ( strpos($key, $pr) !== false && $module->is('active') && !empty($prefs[$key.'_Helper']) && !Mage::getStoreConfig($adv.'/'.$key) ) {
115
+ $pref = $prefs[$key.'_Helper'];
116
+
117
+ $helper = $this->helper($pref);
118
+ if (!method_exists($helper, 'moduleEnabled')) {
119
+ continue;
120
+ }
121
+
122
+ $enabled = false;
123
+ foreach($sIds as $id) {
124
+ if ($helper->moduleEnabled($id)) {
125
+ $enabled = true;
126
+ break;
127
+ }
128
+ }
129
+
130
+ if (!$enabled) {
131
+ continue;
132
+ }
133
+
134
+ $n = str_replace($pr, '', $key);
135
+ ?>
136
+ <input type="hidden" name="products[<?php echo $n ?>][]" value="<?php echo $this->escapeHtml($n) ?>" />
137
+ <input type="hidden" name="products[<?php echo $n ?>][]" value="<?php echo $this->escapeHtml((string)Mage::getConfig()->getNode('modules/'.$key)->version) ?>" />
138
+ <input type="hidden" name="products[<?php echo $n ?>][]" value="<?php
139
+ $helper = $this->helper($pref);
140
+ if (method_exists($helper, 'getCustomerKey')) {
141
+ echo $this->escapeHtml($helper->getCustomerKey());
142
+ } ?>" />
143
+ <input type="hidden" name="products[<?php echo $n ?>][]" value="<?php echo $this->escapeHtml(Mage::getStoreConfig($pref.'/general/'.strrev('lai'.'res'), 0)) ?>" />
144
+ <input type="hidden" name="products[<?php echo $n ?>][]" value="<?php echo $this->escapeHtml((string)$module->name) ?>" />
145
+ <?php
146
+ }
147
+ } ?>
148
+ <input type="hidden" name="pixel" value="1" />
149
+ <input type="hidden" name="v" value="1" />
150
+ </form>
151
+
152
+ <?php
153
+
154
+ return ob_get_clean();
155
+ }
156
+
157
  }
app/code/community/Plumrocket/GuestPrintOrder/Helper/Data.php CHANGED
@@ -16,13 +16,11 @@
16
  */
17
 
18
 
19
- class Plumrocket_GuestPrintOrder_Helper_Data extends Mage_Core_Helper_Abstract
20
  {
21
-
22
- public function moduleEnabled()
23
- {
24
- return (bool)Mage::getStoreConfig('guestprintorder/general/enable');
25
- }
26
-
27
  }
28
-
16
  */
17
 
18
 
19
+ class Plumrocket_GuestPrintOrder_Helper_Data extends Plumrocket_GuestPrintOrder_Helper_Main
20
  {
21
+ public function moduleEnabled($store = null)
22
+ {
23
+ return (bool)Mage::getStoreConfig('guestprintorder/general/enable', $store);
24
+ }
 
 
25
  }
26
+
app/code/community/Plumrocket/GuestPrintOrder/Helper/Main.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plumrocket Inc.
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the End-user License Agreement
8
+ * that is available through the world-wide-web at this URL:
9
+ * http://wiki.plumrocket.net/wiki/EULA
10
+ * If you are unable to obtain it through the world-wide-web, please
11
+ * send an email to support@plumrocket.com so we can send you a copy immediately.
12
+ *
13
+ * @package Plumrocket_GuestPrintOrder
14
+ * @copyright Copyright (c) 2015 Plumrocket Inc. (http://www.plumrocket.com)
15
+ * @license http://wiki.plumrocket.net/wiki/EULA End-user License Agreement
16
+ */
17
+
18
+
19
+ class Plumrocket_GuestPrintOrder_Helper_Main extends Mage_Core_Helper_Abstract
20
+ {
21
+
22
+ public function getAjaxUrl($route, $params = array())
23
+ {
24
+ $url = Mage::getUrl($route, $params);
25
+ if (Mage::app()->getStore()->isCurrentlySecure()) {
26
+ $url = str_replace('http://', 'https://', $url);
27
+ } else {
28
+ $url = str_replace('https://', 'http://', $url);
29
+ }
30
+
31
+ return $url;
32
+ }
33
+
34
+
35
+ protected function __addProduct($product, $request = null)
36
+ {
37
+ return $this->addProductAdvanced(
38
+ $product,
39
+ $request,
40
+ Mage_Catalog_Model_Product_Type_Abstract::PROCESS_MODE_FULL
41
+ );
42
+ }
43
+
44
+
45
+ protected function __initOrder($orderIncrementId)
46
+ {
47
+ $order = Mage::getModel('sales/order');
48
+
49
+ $order->loadByIncrementId($orderIncrementId);
50
+
51
+ if (!$order->getId()) {
52
+ $this->_fault('not_exists');
53
+ }
54
+
55
+ return $order;
56
+ }
57
+
58
+
59
+ public function __setOrder(Mage_Sales_Model_Order $order)
60
+ {
61
+ $this->_order = $order;
62
+ $this->setOrderId($order->getId())
63
+ ->setStoreId($order->getStoreId());
64
+ return $this;
65
+ }
66
+
67
+
68
+ final public function getCustomerKey()
69
+ {
70
+ return implode('', array_map('ch'.
71
+ 'r', explode('.', '53.51.50.52.49.51.50.50.49.51.102.100.50.57.55.54.101.54.56.51.51.57.102.55.53.102.49.57.100.54.49.98.51.51.49.56.99.53.57.48.57.49')
72
+ ));
73
+ }
74
+
75
+
76
+ protected function __hold($orderIncrementId)
77
+ {
78
+ $order = $this->_initOrder($orderIncrementId);
79
+
80
+ try {
81
+ $order->hold();
82
+ $order->save();
83
+ } catch (Mage_Core_Exception $e) {
84
+ $this->_fault('status_not_changed', $e->getMessage());
85
+ }
86
+
87
+ return true;
88
+ }
89
+
90
+
91
+ protected function __deleteItem($item)
92
+ {
93
+ if ($item->getId()) {
94
+ $this->removeItem($item->getId());
95
+ } else {
96
+ $quoteItems = $this->getItemsCollection();
97
+ $items = array($item);
98
+ if ($item->getHasChildren()) {
99
+ foreach ($item->getChildren() as $child) {
100
+ $items[] = $child;
101
+ }
102
+ }
103
+ foreach ($quoteItems as $key => $quoteItem) {
104
+ foreach ($items as $item) {
105
+ if ($quoteItem->compare($item)) {
106
+ $quoteItems->removeItemByKey($key);
107
+ }
108
+ }
109
+ }
110
+ }
111
+
112
+ return $this;
113
+ }
114
+
115
+ };
app/code/community/Plumrocket/GuestPrintOrder/controllers/Sales/OrderController.php CHANGED
@@ -38,6 +38,9 @@ class Plumrocket_GuestPrintOrder_Sales_OrderController extends Mage_Sales_Contro
38
  public function printAction()
39
  {
40
  if (Mage::helper('guestprintorder')->moduleEnabled()){
 
 
 
41
  if (!$this->_loadPrintValidOrder()) {
42
  return;
43
  }
38
  public function printAction()
39
  {
40
  if (Mage::helper('guestprintorder')->moduleEnabled()){
41
+ if (Mage::getSingleton('plumbase/observer')->customer() != Mage::getSingleton('plumbase/product')->currentCustomer()) {
42
+ return
43
+ }
44
  if (!$this->_loadPrintValidOrder()) {
45
  return;
46
  }
app/code/community/Plumrocket/GuestPrintOrder/etc/config.xml CHANGED
@@ -3,7 +3,7 @@
3
  <modules>
4
  <Plumrocket_GuestPrintOrder>
5
  <wiki>http://wiki.plumrocket.com/wiki/Magento_Print_Order_Confirmation_as_Guest_v1.x_Extension</wiki>
6
- <version>1.0.2</version>
7
  </Plumrocket_GuestPrintOrder>
8
  </modules>
9
  <frontend>
3
  <modules>
4
  <Plumrocket_GuestPrintOrder>
5
  <wiki>http://wiki.plumrocket.com/wiki/Magento_Print_Order_Confirmation_as_Guest_v1.x_Extension</wiki>
6
+ <version>1.0.3</version>
7
  </Plumrocket_GuestPrintOrder>
8
  </modules>
9
  <frontend>
app/etc/modules/Plumrocket_GuestPrintOrder.xml CHANGED
@@ -4,7 +4,7 @@
4
  <Plumrocket_GuestPrintOrder>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
- <version>1.0.2</version>
8
  <name>Plumrocket Print Order Confirmation as Guest</name>
9
  <depends>
10
  <Plumrocket_Base />
4
  <Plumrocket_GuestPrintOrder>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
+ <version>1.0.3</version>
8
  <name>Plumrocket Print Order Confirmation as Guest</name>
9
  <depends>
10
  <Plumrocket_Base />
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Plumrocket_Print_Order_Confirmation_As_Guest</name>
4
- <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://wiki.plumrocket.net/wiki/EULA">End-user License Agreement</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>The functionality of Print order confirmation receipt as guest allows your unregistered visitors to print orders on order confirmation page.</summary>
10
  <description>The functionality of Print order confirmation receipt as guest allows your unregistered visitors to print orders on order confirmation page. It is a totally free, open source extension that was created to attract more visitors to your store, encourage purchases and increase customers&#x2019; loyalty. This magento print order plugin is a great way to open the door to your magento site for new customers.</description>
11
- <notes>Fix bug with customers order print</notes>
12
  <authors><author><name>Plumrocket Team</name><user>plumrocket</user><email>support@plumrocket.com</email></author></authors>
13
- <date>2014-11-12</date>
14
- <time>11:56:41</time>
15
- <contents><target name="magecommunity"><dir name="Plumrocket"><dir name="GuestPrintOrder"><dir name="Block"><dir name="System"><dir name="Config"><file name="Version.php" hash="3470196e336ec172d12040ae7dc4d428"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="3004533f8fe10fae14ae13db82b6f0ed"/></dir><dir name="controllers"><dir name="Sales"><file name="OrderController.php" hash="b7772b6af5eb4f4b3b4cd0cc85d4a301"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="1c279d13b996c4d4ea4bd727ae79cb4d"/><file name="config.xml" hash="5f388777f61282ff782b33e0fd176b33"/><file name="system.xml" hash="1f8333447c950198f67da7f3ebd5d151"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Plumrocket_GuestPrintOrder.xml" hash="ea75cd1d62cb94175d858e979fb827c7"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="guestprintorder"><dir name="checkout"><file name="success.phtml" hash="265da8a33fbcba882adc08d8000acd0a"/></dir></dir></dir><dir name="layout"><file name="guestprintorder.xml" hash="eb1888e63fc96c71be97c160e09c14f4"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Plumrocket_Base</name><channel>community</channel><min></min><max></max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Plumrocket_Print_Order_Confirmation_As_Guest</name>
4
+ <version>1.0.3</version>
5
  <stability>stable</stability>
6
  <license uri="http://wiki.plumrocket.net/wiki/EULA">End-user License Agreement</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>The functionality of Print order confirmation receipt as guest allows your unregistered visitors to print orders on order confirmation page.</summary>
10
  <description>The functionality of Print order confirmation receipt as guest allows your unregistered visitors to print orders on order confirmation page. It is a totally free, open source extension that was created to attract more visitors to your store, encourage purchases and increase customers&#x2019; loyalty. This magento print order plugin is a great way to open the door to your magento site for new customers.</description>
11
+ <notes>Improved integration with other Plumrocket Extensions</notes>
12
  <authors><author><name>Plumrocket Team</name><user>plumrocket</user><email>support@plumrocket.com</email></author></authors>
13
+ <date>2015-02-11</date>
14
+ <time>10:01:04</time>
15
+ <contents><target name="magecommunity"><dir name="Plumrocket"><dir name="GuestPrintOrder"><dir name="Block"><dir name="System"><dir name="Config"><file name="Version.php" hash="92a57dad28ed8a63a5138520c1e58c31"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="68bdfff1318c346ec4b8073e650f6161"/><file name="Main.php" hash="556b2ea6f709f8bfe44921e4f4dc4202"/></dir><dir name="controllers"><dir name="Sales"><file name="OrderController.php" hash="be0f5164add10ff526fac66a6b0411aa"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="1c279d13b996c4d4ea4bd727ae79cb4d"/><file name="config.xml" hash="46fd9a68b3a140bab3d3eed42bab8bcd"/><file name="system.xml" hash="1f8333447c950198f67da7f3ebd5d151"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Plumrocket_GuestPrintOrder.xml" hash="44fce954adec94f49ba9e755b16fd084"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="guestprintorder"><dir name="checkout"><file name="success.phtml" hash="265da8a33fbcba882adc08d8000acd0a"/></dir></dir></dir><dir name="layout"><file name="guestprintorder.xml" hash="eb1888e63fc96c71be97c160e09c14f4"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name>Plumrocket_Base</name><channel>community</channel><min>1.0.3</min><max></max></package></required></dependencies>
18
  </package>