Version Notes
No notes
Download this release
Release Info
Developer | Yireo |
Extension | Yireo_CheckoutTester |
Version | 0.1.2 |
Comparing to | |
See all releases |
Code changes from version 0.1.0 to 0.1.2
app/code/community/Yireo/CheckoutTester/Helper/Data.php
CHANGED
@@ -62,4 +62,14 @@ class Yireo_CheckoutTester_Helper_Data extends Mage_Core_Helper_Abstract
|
|
62 |
{
|
63 |
return (int)Mage::getStoreConfig('checkouttester/settings/order_id');
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
62 |
{
|
63 |
return (int)Mage::getStoreConfig('checkouttester/settings/order_id');
|
64 |
}
|
65 |
+
|
66 |
+
public function getLastOrderId()
|
67 |
+
{
|
68 |
+
$orders = Mage::getModel('sales/order')->getCollection()
|
69 |
+
->setOrder('created_at','DESC')
|
70 |
+
->setPageSize(1)
|
71 |
+
->setCurPage(1);
|
72 |
+
$orderId = $orders->getFirstItem()->getEntityId();
|
73 |
+
return $orderId;
|
74 |
+
}
|
75 |
}
|
app/code/community/Yireo/CheckoutTester/controllers/IndexController.php
CHANGED
@@ -36,20 +36,32 @@ class Yireo_CheckoutTester_IndexController extends Mage_Core_Controller_Front_Ac
|
|
36 |
die('Access denied');
|
37 |
}
|
38 |
|
39 |
-
//
|
40 |
-
$
|
41 |
$urlId = (int)$this->getRequest()->getParam('order_id');
|
42 |
-
if(!empty($urlId)) {
|
43 |
-
$orderId = $urlId;
|
44 |
-
}
|
45 |
|
46 |
-
// Load the order
|
|
|
|
|
47 |
$order = Mage::getModel('sales/order')->load($orderId);
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
if(!$order->getId() > 0) {
|
50 |
die('Invalid order ID');
|
51 |
}
|
52 |
|
|
|
|
|
53 |
// Load the session
|
54 |
Mage::getModel('checkout/session')->setLastOrderId($order->getId())
|
55 |
->setLastRealOrderId($order->getIncrementId());
|
36 |
die('Access denied');
|
37 |
}
|
38 |
|
39 |
+
// Fetch variables
|
40 |
+
$lastOrderId = Mage::helper('checkouttester')->getLastOrderId();
|
41 |
$urlId = (int)$this->getRequest()->getParam('order_id');
|
|
|
|
|
|
|
42 |
|
43 |
+
// Load the order from setting or URL
|
44 |
+
$orderId = (int)Mage::helper('checkouttester')->getOrderId();
|
45 |
+
if(!empty($urlId)) $orderId = $urlId;
|
46 |
$order = Mage::getModel('sales/order')->load($orderId);
|
47 |
+
|
48 |
+
// Try to use this ID as an increment ID
|
49 |
+
if(!$order->getId() > 0 && $orderId > $lastOrderId) {
|
50 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId)
|
51 |
+
}
|
52 |
+
|
53 |
+
// Load the last order if this is still invalid
|
54 |
+
if(!$order->getId() > 0 && $lastOrderId > 0) {
|
55 |
+
$order = Mage::getModel('sales/order')->load($lastOrderId);
|
56 |
+
}
|
57 |
+
|
58 |
+
// Fail when there is still no order yet
|
59 |
if(!$order->getId() > 0) {
|
60 |
die('Invalid order ID');
|
61 |
}
|
62 |
|
63 |
+
Mage::register('current_order', $order);
|
64 |
+
|
65 |
// Load the session
|
66 |
Mage::getModel('checkout/session')->setLastOrderId($order->getId())
|
67 |
->setLastRealOrderId($order->getIncrementId());
|
app/code/community/Yireo/CheckoutTester/etc/config.xml
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
|
14 |
<modules>
|
15 |
<Yireo_CheckoutTester>
|
16 |
-
<version>0.1.
|
17 |
</Yireo_CheckoutTester>
|
18 |
</modules>
|
19 |
|
13 |
|
14 |
<modules>
|
15 |
<Yireo_CheckoutTester>
|
16 |
+
<version>0.1.2</version>
|
17 |
</Yireo_CheckoutTester>
|
18 |
</modules>
|
19 |
|
package.xml
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
-
<package><name>Yireo_CheckoutTester</name><version>0.1.
|
1 |
<?xml version="1.0"?>
|
2 |
+
<package><name>Yireo_CheckoutTester</name><version>0.1.2</version><stability>stable</stability><license>Open Source License</license><channel>community</channel><extends></extends><summary>No summary</summary><description>No description</description><notes>No notes</notes><authors><author><name>Yireo</name><user>yireo</user><email>info@yireo.com</email></author></authors><date>2014-09-18</date><time>6:20:11</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Yireo_CheckoutTester.xml" hash="5c25ce11fa9c85fa23a32225a674951a"/></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="checkouttester.xml" hash="9e0113d1d3df1d561c6846fec010f406"/></dir></dir></dir></dir></dir><dir name="code"><dir name="community"><dir name="Yireo"><dir name="CheckoutTester"><dir name="etc"><file name="adminhtml.xml" hash="e55f7023e0538a0cd564dd5c9327465d"/><file name="config.xml" hash="2638f1ee5cd79ed8d58ca0fb0e867661"/><file name="system.xml" hash="8e1520e370f90fae4f8d4217b03aaa31"/></dir><dir name="controllers"><file name="IndexController.php" hash="49f369229b03da1cdd15de4d0cb39d8f"/></dir><dir name="Model"><file name="Feed.php" hash="da5af719014c1cb94daad9cbe5a340b4"/><file name="Observer.php" hash="00c05b283b67c57442aaf0216764e7f3"/></dir><dir name="Helper"><file name="Data.php" hash="f5b4c221436bb54b3707bb90c9083373"/></dir><dir name="Block"><file name="Success.php" hash="a069a62e023e121238126212ca24601e"/></dir></dir></dir></dir></dir></dir></target></contents></package>
|