Version Notes
Fix bug with customers order print
Download this release
Release Info
| Developer | Plumrocket Team |
| Extension | Plumrocket_Print_Order_Confirmation_As_Guest |
| Version | 1.0.2 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.1 to 1.0.2
app/code/community/Plumrocket/GuestPrintOrder/controllers/Sales/OrderController.php
CHANGED
|
@@ -16,42 +16,41 @@
|
|
| 16 |
*/
|
| 17 |
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
class Plumrocket_GuestPrintOrder_Sales_OrderController extends Mage_Sales_OrderController
|
| 22 |
{
|
| 23 |
|
| 24 |
-
|
| 25 |
{
|
| 26 |
-
|
|
|
|
| 27 |
$action = $this->getRequest()->getActionName();
|
| 28 |
if ($action == 'print'){
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
parent::preDispatch();
|
| 33 |
-
$loginUrl = Mage::helper('customer')->getLoginUrl();
|
| 34 |
|
|
|
|
| 35 |
if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
|
| 36 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
| 37 |
}
|
| 38 |
}
|
| 39 |
|
| 40 |
-
|
|
|
|
| 41 |
{
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
$this->loadLayout('print');
|
| 52 |
$this->renderLayout();
|
| 53 |
}
|
| 54 |
-
|
|
|
|
| 55 |
protected function _loadPrintValidOrder($orderId = null)
|
| 56 |
{
|
| 57 |
if (null === $orderId) {
|
|
@@ -64,7 +63,12 @@ class Plumrocket_GuestPrintOrder_Sales_OrderController extends Mage_Sales_OrderC
|
|
| 64 |
|
| 65 |
$order = Mage::getModel('sales/order')->load($orderId);
|
| 66 |
|
| 67 |
-
if ($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
Mage::register('current_order', $order);
|
| 69 |
return true;
|
| 70 |
} else {
|
|
@@ -72,25 +76,18 @@ class Plumrocket_GuestPrintOrder_Sales_OrderController extends Mage_Sales_OrderC
|
|
| 72 |
}
|
| 73 |
return false;
|
| 74 |
}
|
| 75 |
-
|
| 76 |
-
|
| 77 |
protected function _canPrintOrder($order)
|
| 78 |
{
|
| 79 |
$availableStates = Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates();
|
| 80 |
-
|
| 81 |
if ($order->getId() && in_array($order->getState(), $availableStates, $strict = true)){
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
} else {
|
| 88 |
-
$remoteIP = Mage::helper('core/http')->getRemoteAddr();
|
| 89 |
-
$time = Mage::getModel('core/date')->timestamp() - 86400;
|
| 90 |
-
|
| 91 |
-
return ($order->getRemoteIP() == $remoteIP && $order->getCreatedAt() > date('Y-m-d H:i:s', $time));
|
| 92 |
-
}
|
| 93 |
-
}
|
| 94 |
|
| 95 |
return false;
|
| 96 |
}
|
| 16 |
*/
|
| 17 |
|
| 18 |
|
| 19 |
+
class Plumrocket_GuestPrintOrder_Sales_OrderController extends Mage_Sales_Controller_Abstract
|
|
|
|
|
|
|
| 20 |
{
|
| 21 |
|
| 22 |
+
public function preDispatch()
|
| 23 |
{
|
| 24 |
+
parent::preDispatch();
|
| 25 |
+
|
| 26 |
$action = $this->getRequest()->getActionName();
|
| 27 |
if ($action == 'print'){
|
| 28 |
+
return $this;
|
| 29 |
+
}
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
$loginUrl = Mage::helper('customer')->getLoginUrl();
|
| 32 |
if (!Mage::getSingleton('customer/session')->authenticate($this, $loginUrl)) {
|
| 33 |
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
|
| 34 |
}
|
| 35 |
}
|
| 36 |
|
| 37 |
+
|
| 38 |
+
public function printAction()
|
| 39 |
{
|
| 40 |
+
if (Mage::helper('guestprintorder')->moduleEnabled()){
|
| 41 |
+
if (!$this->_loadPrintValidOrder()) {
|
| 42 |
+
return;
|
| 43 |
+
}
|
| 44 |
+
} else {
|
| 45 |
+
if (!$this->_loadValidOrder()) {
|
| 46 |
+
return;
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
$this->loadLayout('print');
|
| 50 |
$this->renderLayout();
|
| 51 |
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
protected function _loadPrintValidOrder($orderId = null)
|
| 55 |
{
|
| 56 |
if (null === $orderId) {
|
| 63 |
|
| 64 |
$order = Mage::getModel('sales/order')->load($orderId);
|
| 65 |
|
| 66 |
+
if ($order->getCustomerId()) {
|
| 67 |
+
if ($this->_canViewOrder($order)) {
|
| 68 |
+
Mage::register('current_order', $order);
|
| 69 |
+
return true;
|
| 70 |
+
}
|
| 71 |
+
} else if ($this->_canPrintOrder($order)) {
|
| 72 |
Mage::register('current_order', $order);
|
| 73 |
return true;
|
| 74 |
} else {
|
| 76 |
}
|
| 77 |
return false;
|
| 78 |
}
|
| 79 |
+
|
| 80 |
+
|
| 81 |
protected function _canPrintOrder($order)
|
| 82 |
{
|
| 83 |
$availableStates = Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates();
|
| 84 |
+
|
| 85 |
if ($order->getId() && in_array($order->getState(), $availableStates, $strict = true)){
|
| 86 |
+
$remoteIP = Mage::helper('core/http')->getRemoteAddr();
|
| 87 |
+
$time = Mage::getModel('core/date')->timestamp() - 86400;
|
| 88 |
+
|
| 89 |
+
return ($order->getRemoteIP() == $remoteIP && $order->getCreatedAt() > date('Y-m-d H:i:s', $time));
|
| 90 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
return false;
|
| 93 |
}
|
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.
|
| 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.2</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.
|
| 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.2</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.
|
| 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’ loyalty. This magento print order plugin is a great way to open the door to your magento site for new customers.</description>
|
| 11 |
-
<notes>
|
| 12 |
<authors><author><name>Plumrocket Team</name><user>plumrocket</user><email>support@plumrocket.com</email></author></authors>
|
| 13 |
-
<date>2014-
|
| 14 |
-
<time>11:
|
| 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="
|
| 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.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’ 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>
|
