Version Notes
No notes
Download this release
Release Info
| Developer | Yireo |
| Extension | Yireo_CheckoutTester |
| Version | 0.1.11 |
| Comparing to | |
| See all releases | |
Code changes from version 0.1.9 to 0.1.11
- app/code/community/Yireo/CheckoutTester/Block/Field/Link.php +3 -1
- app/code/community/Yireo/CheckoutTester/Block/Success.php +1 -1
- app/code/community/Yireo/CheckoutTester/Helper/Data.php +50 -25
- app/code/community/Yireo/CheckoutTester/Model/Feed.php +1 -1
- app/code/community/Yireo/CheckoutTester/Model/Observer.php +4 -4
- app/code/community/Yireo/CheckoutTester/Model/Observer/AddFeed.php +32 -0
- app/code/community/Yireo/CheckoutTester/controllers/IndexController.php +48 -8
- app/code/community/Yireo/CheckoutTester/etc/adminhtml.xml +1 -1
- app/code/community/Yireo/CheckoutTester/etc/config.xml +16 -3
- app/code/community/Yireo/CheckoutTester/etc/system.xml +2 -2
- app/design/frontend/base/default/layout/checkouttester.xml +1 -1
- app/etc/modules/Yireo_CheckoutTester.xml +1 -1
- package.xml +1 -1
app/code/community/Yireo/CheckoutTester/Block/Field/Link.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
*
|
| 5 |
* @package Yireo_CheckoutTester
|
| 6 |
* @author Yireo (https://www.yireo.com/)
|
| 7 |
-
* @copyright Copyright
|
| 8 |
* @license Open Source License (OSL v3)
|
| 9 |
*/
|
| 10 |
|
|
@@ -52,10 +52,12 @@ class Yireo_CheckoutTester_Block_Field_Link extends Mage_Adminhtml_Block_System_
|
|
| 52 |
if ($storeId) {
|
| 53 |
return $storeId;
|
| 54 |
}
|
|
|
|
| 55 |
$websiteId = Mage::getSingleton('adminhtml/config_data')->getWebsite();
|
| 56 |
if ($websiteId) {
|
| 57 |
return Mage::app()->getWebsite($websiteId)->getDefaultStore()->getId();
|
| 58 |
}
|
|
|
|
| 59 |
return Mage::app()->getWebsite(true)->getDefaultGroup()->getDefaultStoreId();
|
| 60 |
}
|
| 61 |
}
|
| 4 |
*
|
| 5 |
* @package Yireo_CheckoutTester
|
| 6 |
* @author Yireo (https://www.yireo.com/)
|
| 7 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
| 8 |
* @license Open Source License (OSL v3)
|
| 9 |
*/
|
| 10 |
|
| 52 |
if ($storeId) {
|
| 53 |
return $storeId;
|
| 54 |
}
|
| 55 |
+
|
| 56 |
$websiteId = Mage::getSingleton('adminhtml/config_data')->getWebsite();
|
| 57 |
if ($websiteId) {
|
| 58 |
return Mage::app()->getWebsite($websiteId)->getDefaultStore()->getId();
|
| 59 |
}
|
| 60 |
+
|
| 61 |
return Mage::app()->getWebsite(true)->getDefaultGroup()->getDefaultStoreId();
|
| 62 |
}
|
| 63 |
}
|
app/code/community/Yireo/CheckoutTester/Block/Success.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
*
|
| 5 |
* @package Yireo_CheckoutTester
|
| 6 |
* @author Yireo (https://www.yireo.com/)
|
| 7 |
-
* @copyright Copyright
|
| 8 |
* @license Open Source License (OSL v3)
|
| 9 |
*/
|
| 10 |
|
| 4 |
*
|
| 5 |
* @package Yireo_CheckoutTester
|
| 6 |
* @author Yireo (https://www.yireo.com/)
|
| 7 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
| 8 |
* @license Open Source License (OSL v3)
|
| 9 |
*/
|
| 10 |
|
app/code/community/Yireo/CheckoutTester/Helper/Data.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
*
|
| 5 |
* @package Yireo_CheckoutTester
|
| 6 |
* @author Yireo (https://www.yireo.com/)
|
| 7 |
-
* @copyright Copyright (C)
|
| 8 |
* @license Open Source License (OSL v3)
|
| 9 |
*/
|
| 10 |
|
|
@@ -13,6 +13,19 @@
|
|
| 13 |
*/
|
| 14 |
class Yireo_CheckoutTester_Helper_Data extends Mage_Core_Helper_Abstract
|
| 15 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
/**
|
| 17 |
* Switch to determine whether this extension is enabled or not
|
| 18 |
*
|
|
@@ -20,7 +33,7 @@ class Yireo_CheckoutTester_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 20 |
*/
|
| 21 |
public function enabled()
|
| 22 |
{
|
| 23 |
-
if ((bool)
|
| 24 |
return false;
|
| 25 |
}
|
| 26 |
|
|
@@ -34,29 +47,30 @@ class Yireo_CheckoutTester_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 34 |
*/
|
| 35 |
public function hasAccess()
|
| 36 |
{
|
| 37 |
-
$ip =
|
| 38 |
$ip = trim($ip);
|
| 39 |
|
| 40 |
$realIp = $this->getIpAddress();
|
| 41 |
|
| 42 |
-
if (
|
| 43 |
-
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
-
$ip = trim($ip);
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
}
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
| 55 |
}
|
| 56 |
-
return false;
|
| 57 |
}
|
| 58 |
|
| 59 |
-
return
|
| 60 |
}
|
| 61 |
|
| 62 |
/**
|
|
@@ -67,16 +81,14 @@ class Yireo_CheckoutTester_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 67 |
public function getIpAddress()
|
| 68 |
{
|
| 69 |
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
| 73 |
-
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
}
|
| 78 |
|
| 79 |
-
return $
|
| 80 |
}
|
| 81 |
|
| 82 |
/**
|
|
@@ -86,7 +98,7 @@ class Yireo_CheckoutTester_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 86 |
*/
|
| 87 |
public function getOrderIdFromConfig()
|
| 88 |
{
|
| 89 |
-
return (int)
|
| 90 |
}
|
| 91 |
|
| 92 |
/**
|
|
@@ -96,7 +108,8 @@ class Yireo_CheckoutTester_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 96 |
*/
|
| 97 |
public function getLastInsertedOrderId()
|
| 98 |
{
|
| 99 |
-
$orders
|
|
|
|
| 100 |
->setOrder('created_at', 'DESC')
|
| 101 |
->setPageSize(1)
|
| 102 |
->setCurPage(1);
|
|
@@ -105,11 +118,23 @@ class Yireo_CheckoutTester_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 105 |
return 0;
|
| 106 |
}
|
| 107 |
|
|
|
|
| 108 |
$firstOrder = $orders->getFirstItem();
|
| 109 |
if (empty($firstOrder)) {
|
| 110 |
return 0;
|
| 111 |
}
|
| 112 |
|
| 113 |
-
return (int)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
}
|
| 115 |
}
|
| 4 |
*
|
| 5 |
* @package Yireo_CheckoutTester
|
| 6 |
* @author Yireo (https://www.yireo.com/)
|
| 7 |
+
* @copyright Copyright (C) 2016 Yireo (https://www.yireo.com/)
|
| 8 |
* @license Open Source License (OSL v3)
|
| 9 |
*/
|
| 10 |
|
| 13 |
*/
|
| 14 |
class Yireo_CheckoutTester_Helper_Data extends Mage_Core_Helper_Abstract
|
| 15 |
{
|
| 16 |
+
/**
|
| 17 |
+
* @var Mage_Sales_Model_Order
|
| 18 |
+
*/
|
| 19 |
+
protected $order;
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Yireo_CheckoutTester_Helper_Data constructor.
|
| 23 |
+
*/
|
| 24 |
+
public function __construct()
|
| 25 |
+
{
|
| 26 |
+
$this->order = Mage::getModel('sales/order');
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
/**
|
| 30 |
* Switch to determine whether this extension is enabled or not
|
| 31 |
*
|
| 33 |
*/
|
| 34 |
public function enabled()
|
| 35 |
{
|
| 36 |
+
if ((bool)$this->getStoreConfig('advanced/modules_disable_output/Yireo_CheckoutTester')) {
|
| 37 |
return false;
|
| 38 |
}
|
| 39 |
|
| 47 |
*/
|
| 48 |
public function hasAccess()
|
| 49 |
{
|
| 50 |
+
$ip = $this->getStoreConfig('checkouttester/settings/ip');
|
| 51 |
$ip = trim($ip);
|
| 52 |
|
| 53 |
$realIp = $this->getIpAddress();
|
| 54 |
|
| 55 |
+
if (empty($ip) || empty($realIp)) {
|
| 56 |
+
return true;
|
| 57 |
+
}
|
| 58 |
|
| 59 |
+
$ips = explode(',', $ip);
|
|
|
|
| 60 |
|
| 61 |
+
foreach ($ips as $ip) {
|
| 62 |
+
$ip = trim($ip);
|
|
|
|
| 63 |
|
| 64 |
+
if (empty($ip)) {
|
| 65 |
+
continue;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
if ($ip == $realIp) {
|
| 69 |
+
return true;
|
| 70 |
}
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
+
return false;
|
| 74 |
}
|
| 75 |
|
| 76 |
/**
|
| 81 |
public function getIpAddress()
|
| 82 |
{
|
| 83 |
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
|
| 84 |
+
return $_SERVER['HTTP_CLIENT_IP'];
|
| 85 |
+
}
|
|
|
|
|
|
|
| 86 |
|
| 87 |
+
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
| 88 |
+
return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
| 89 |
}
|
| 90 |
|
| 91 |
+
return $_SERVER['REMOTE_ADDR'];
|
| 92 |
}
|
| 93 |
|
| 94 |
/**
|
| 98 |
*/
|
| 99 |
public function getOrderIdFromConfig()
|
| 100 |
{
|
| 101 |
+
return (int)$this->getStoreConfig('checkouttester/settings/order_id');
|
| 102 |
}
|
| 103 |
|
| 104 |
/**
|
| 108 |
*/
|
| 109 |
public function getLastInsertedOrderId()
|
| 110 |
{
|
| 111 |
+
/** @var Mage_Sales_Model_Resource_Order_Collection $orders */
|
| 112 |
+
$orders = $this->order->getCollection()
|
| 113 |
->setOrder('created_at', 'DESC')
|
| 114 |
->setPageSize(1)
|
| 115 |
->setCurPage(1);
|
| 118 |
return 0;
|
| 119 |
}
|
| 120 |
|
| 121 |
+
/** @var Mage_Sales_Model_Order $firstOrder */
|
| 122 |
$firstOrder = $orders->getFirstItem();
|
| 123 |
if (empty($firstOrder)) {
|
| 124 |
return 0;
|
| 125 |
}
|
| 126 |
|
| 127 |
+
return (int)$firstOrder->getEntityId();
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
/**
|
| 131 |
+
* @param $path
|
| 132 |
+
* @param null $default
|
| 133 |
+
*
|
| 134 |
+
* @return mixed
|
| 135 |
+
*/
|
| 136 |
+
protected function getStoreConfig($path, $default = null)
|
| 137 |
+
{
|
| 138 |
+
return Mage::getStoreConfig($path, $default);
|
| 139 |
}
|
| 140 |
}
|
app/code/community/Yireo/CheckoutTester/Model/Feed.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
*
|
| 5 |
* @author Yireo
|
| 6 |
* @package Yireo_Common
|
| 7 |
-
* @copyright Copyright
|
| 8 |
* @license Open Source License (OSL v3) (OSL)
|
| 9 |
* @link https://www.yireo.com
|
| 10 |
*/
|
| 4 |
*
|
| 5 |
* @author Yireo
|
| 6 |
* @package Yireo_Common
|
| 7 |
+
* @copyright Copyright 2016
|
| 8 |
* @license Open Source License (OSL v3) (OSL)
|
| 9 |
* @link https://www.yireo.com
|
| 10 |
*/
|
app/code/community/Yireo/CheckoutTester/Model/Observer.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
*
|
| 5 |
* @author Yireo
|
| 6 |
* @package CheckoutTester
|
| 7 |
-
* @copyright Copyright
|
| 8 |
* @license Open Source License (OSL v3)
|
| 9 |
* @link https://www.yireo.com
|
| 10 |
*/
|
|
@@ -12,17 +12,17 @@
|
|
| 12 |
/**
|
| 13 |
* CheckoutTester observer to various Magento events
|
| 14 |
*/
|
| 15 |
-
class Yireo_CheckoutTester_Model_Observer
|
| 16 |
{
|
| 17 |
/**
|
| 18 |
* Method fired on the event <controller_action_predispatch>
|
| 19 |
*
|
| 20 |
* @param Varien_Event_Observer $observer
|
| 21 |
* @return Yireo_CheckoutTester_Model_Observer
|
|
|
|
| 22 |
*/
|
| 23 |
public function controllerActionPredispatch($observer)
|
| 24 |
{
|
| 25 |
-
|
| 26 |
-
Mage::getModel('checkouttester/feed')->updateIfAllowed();
|
| 27 |
}
|
| 28 |
}
|
| 4 |
*
|
| 5 |
* @author Yireo
|
| 6 |
* @package CheckoutTester
|
| 7 |
+
* @copyright Copyright 2016
|
| 8 |
* @license Open Source License (OSL v3)
|
| 9 |
* @link https://www.yireo.com
|
| 10 |
*/
|
| 12 |
/**
|
| 13 |
* CheckoutTester observer to various Magento events
|
| 14 |
*/
|
| 15 |
+
class Yireo_CheckoutTester_Model_Observer
|
| 16 |
{
|
| 17 |
/**
|
| 18 |
* Method fired on the event <controller_action_predispatch>
|
| 19 |
*
|
| 20 |
* @param Varien_Event_Observer $observer
|
| 21 |
* @return Yireo_CheckoutTester_Model_Observer
|
| 22 |
+
* @deprecated
|
| 23 |
*/
|
| 24 |
public function controllerActionPredispatch($observer)
|
| 25 |
{
|
| 26 |
+
return $this;
|
|
|
|
| 27 |
}
|
| 28 |
}
|
app/code/community/Yireo/CheckoutTester/Model/Observer/AddFeed.php
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Yireo CheckoutTester
|
| 4 |
+
*
|
| 5 |
+
* @author Yireo
|
| 6 |
+
* @package CheckoutTester
|
| 7 |
+
* @copyright Copyright 2016
|
| 8 |
+
* @license Open Source License (OSL v3)
|
| 9 |
+
* @link https://www.yireo.com
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* CheckoutTester observer to various Magento events
|
| 14 |
+
*/
|
| 15 |
+
class Yireo_CheckoutTester_Model_Observer_AddFeed
|
| 16 |
+
{
|
| 17 |
+
/**
|
| 18 |
+
* Method fired on the event <controller_action_predispatch>
|
| 19 |
+
*
|
| 20 |
+
* @param Varien_Event_Observer $observer
|
| 21 |
+
*
|
| 22 |
+
* @return Yireo_CheckoutTester_Model_Observer_AddFeed
|
| 23 |
+
* @event controller_action_predispatch
|
| 24 |
+
*/
|
| 25 |
+
public function execute($observer)
|
| 26 |
+
{
|
| 27 |
+
// Run the feed
|
| 28 |
+
Mage::getModel('checkouttester/feed')->updateIfAllowed();
|
| 29 |
+
|
| 30 |
+
return $this;
|
| 31 |
+
}
|
| 32 |
+
}
|
app/code/community/Yireo/CheckoutTester/controllers/IndexController.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
*
|
| 5 |
* @package Yireo_CheckoutTester
|
| 6 |
* @author Yireo (https://www.yireo.com/)
|
| 7 |
-
* @copyright Copyright
|
| 8 |
* @license Open Source License (OSL v3)
|
| 9 |
*/
|
| 10 |
|
|
@@ -16,6 +16,42 @@
|
|
| 16 |
*/
|
| 17 |
class Yireo_CheckoutTester_IndexController extends Mage_Core_Controller_Front_Action
|
| 18 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
/**
|
| 20 |
* Empty page action
|
| 21 |
*/
|
|
@@ -30,15 +66,19 @@ class Yireo_CheckoutTester_IndexController extends Mage_Core_Controller_Front_Ac
|
|
| 30 |
public function successAction()
|
| 31 |
{
|
| 32 |
// Check access
|
| 33 |
-
if (
|
| 34 |
die('Access denied');
|
| 35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
// Fetch the order
|
| 38 |
$order = $this->getOrder();
|
| 39 |
|
| 40 |
// Fail when there is no valid order
|
| 41 |
-
if ($order
|
| 42 |
die('Invalid order ID');
|
| 43 |
}
|
| 44 |
|
|
@@ -65,13 +105,13 @@ class Yireo_CheckoutTester_IndexController extends Mage_Core_Controller_Front_Ac
|
|
| 65 |
return $order;
|
| 66 |
}
|
| 67 |
|
| 68 |
-
$orderIdFromConfig = (int)
|
| 69 |
$order = $this->loadOrder($orderIdFromConfig);
|
| 70 |
if ($order) {
|
| 71 |
return $order;
|
| 72 |
}
|
| 73 |
|
| 74 |
-
$lastOrderId =
|
| 75 |
$order = $this->loadOrder($lastOrderId);
|
| 76 |
if ($order) {
|
| 77 |
return $order;
|
|
@@ -89,12 +129,12 @@ class Yireo_CheckoutTester_IndexController extends Mage_Core_Controller_Front_Ac
|
|
| 89 |
*/
|
| 90 |
protected function loadOrder($orderId)
|
| 91 |
{
|
| 92 |
-
$order =
|
| 93 |
if ($order->getId() > 0) {
|
| 94 |
return $order;
|
| 95 |
}
|
| 96 |
|
| 97 |
-
$order =
|
| 98 |
if ($order->getId() > 0) {
|
| 99 |
return $order;
|
| 100 |
}
|
|
@@ -116,7 +156,7 @@ class Yireo_CheckoutTester_IndexController extends Mage_Core_Controller_Front_Ac
|
|
| 116 |
}
|
| 117 |
|
| 118 |
// Load the session with this order
|
| 119 |
-
|
| 120 |
->setLastRealOrderId($order->getIncrementId());
|
| 121 |
|
| 122 |
// Optionally dispatch an event
|
| 4 |
*
|
| 5 |
* @package Yireo_CheckoutTester
|
| 6 |
* @author Yireo (https://www.yireo.com/)
|
| 7 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
| 8 |
* @license Open Source License (OSL v3)
|
| 9 |
*/
|
| 10 |
|
| 16 |
*/
|
| 17 |
class Yireo_CheckoutTester_IndexController extends Mage_Core_Controller_Front_Action
|
| 18 |
{
|
| 19 |
+
/**
|
| 20 |
+
* @var Yireo_CheckoutTester_Helper_Data
|
| 21 |
+
*/
|
| 22 |
+
protected $helper;
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* @var Mage_Sales_Model_Order
|
| 26 |
+
*/
|
| 27 |
+
protected $orderModel;
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* @var Mage_Checkout_Model_Session
|
| 31 |
+
*/
|
| 32 |
+
protected $checkoutSession;
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Semiconstructor
|
| 36 |
+
*/
|
| 37 |
+
protected function _construct()
|
| 38 |
+
{
|
| 39 |
+
$this->helper = Mage::helper('checkouttester');
|
| 40 |
+
$this->orderModel = Mage::getModel('sales/order');
|
| 41 |
+
|
| 42 |
+
parent::_construct();
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/**
|
| 46 |
+
* @return Mage_Checkout_Model_Session
|
| 47 |
+
*/
|
| 48 |
+
public function getCheckoutSession() {
|
| 49 |
+
if(!$this->checkoutSession) {
|
| 50 |
+
$this->checkoutSession = Mage::getModel('checkout/session');
|
| 51 |
+
}
|
| 52 |
+
return $this->checkoutSession;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
/**
|
| 56 |
* Empty page action
|
| 57 |
*/
|
| 66 |
public function successAction()
|
| 67 |
{
|
| 68 |
// Check access
|
| 69 |
+
if ($this->helper->hasAccess() == false) {
|
| 70 |
die('Access denied');
|
| 71 |
}
|
| 72 |
+
// Check if module output is enabled
|
| 73 |
+
if (!$this->helper->enabled()) {
|
| 74 |
+
die('Module output disabled');
|
| 75 |
+
}
|
| 76 |
|
| 77 |
// Fetch the order
|
| 78 |
$order = $this->getOrder();
|
| 79 |
|
| 80 |
// Fail when there is no valid order
|
| 81 |
+
if ($order === false) {
|
| 82 |
die('Invalid order ID');
|
| 83 |
}
|
| 84 |
|
| 105 |
return $order;
|
| 106 |
}
|
| 107 |
|
| 108 |
+
$orderIdFromConfig = (int)$this->helper->getOrderIdFromConfig();
|
| 109 |
$order = $this->loadOrder($orderIdFromConfig);
|
| 110 |
if ($order) {
|
| 111 |
return $order;
|
| 112 |
}
|
| 113 |
|
| 114 |
+
$lastOrderId = $this->helper->getLastInsertedOrderId();
|
| 115 |
$order = $this->loadOrder($lastOrderId);
|
| 116 |
if ($order) {
|
| 117 |
return $order;
|
| 129 |
*/
|
| 130 |
protected function loadOrder($orderId)
|
| 131 |
{
|
| 132 |
+
$order = $this->orderModel->load($orderId);
|
| 133 |
if ($order->getId() > 0) {
|
| 134 |
return $order;
|
| 135 |
}
|
| 136 |
|
| 137 |
+
$order = $this->orderModel->loadByIncrementId($orderId);
|
| 138 |
if ($order->getId() > 0) {
|
| 139 |
return $order;
|
| 140 |
}
|
| 156 |
}
|
| 157 |
|
| 158 |
// Load the session with this order
|
| 159 |
+
$this->getCheckoutSession()->setLastOrderId($order->getId())
|
| 160 |
->setLastRealOrderId($order->getIncrementId());
|
| 161 |
|
| 162 |
// Optionally dispatch an event
|
app/code/community/Yireo/CheckoutTester/etc/adminhtml.xml
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
*
|
| 6 |
* @package Yireo_CheckoutTester
|
| 7 |
* @author Yireo (https://www.yireo.com/)
|
| 8 |
-
* @copyright Copyright
|
| 9 |
* @license Open Source License (OSL v3)
|
| 10 |
*/
|
| 11 |
-->
|
| 5 |
*
|
| 6 |
* @package Yireo_CheckoutTester
|
| 7 |
* @author Yireo (https://www.yireo.com/)
|
| 8 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
| 9 |
* @license Open Source License (OSL v3)
|
| 10 |
*/
|
| 11 |
-->
|
app/code/community/Yireo/CheckoutTester/etc/config.xml
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
*
|
| 6 |
* @package Yireo_CheckoutTester
|
| 7 |
* @author Yireo (https://www.yireo.com/)
|
| 8 |
-
* @copyright Copyright
|
| 9 |
* @license Open Source License (OSL v3)
|
| 10 |
*/
|
| 11 |
-->
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
|
| 14 |
<modules>
|
| 15 |
<Yireo_CheckoutTester>
|
| 16 |
-
<version>0.1.
|
| 17 |
</Yireo_CheckoutTester>
|
| 18 |
</modules>
|
| 19 |
|
|
@@ -47,6 +47,7 @@
|
|
| 47 |
</args>
|
| 48 |
</checkouttester>
|
| 49 |
</routers>
|
|
|
|
| 50 |
<layout>
|
| 51 |
<updates>
|
| 52 |
<checkouttester>
|
|
@@ -56,11 +57,23 @@
|
|
| 56 |
</layout>
|
| 57 |
</frontend>
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
<default>
|
| 60 |
<checkouttester>
|
| 61 |
<settings>
|
| 62 |
<order_id>0</order_id>
|
| 63 |
-
<ip></ip>
|
| 64 |
<checkout_onepage_controller_success_action>0</checkout_onepage_controller_success_action>
|
| 65 |
</settings>
|
| 66 |
</checkouttester>
|
| 5 |
*
|
| 6 |
* @package Yireo_CheckoutTester
|
| 7 |
* @author Yireo (https://www.yireo.com/)
|
| 8 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
| 9 |
* @license Open Source License (OSL v3)
|
| 10 |
*/
|
| 11 |
-->
|
| 13 |
|
| 14 |
<modules>
|
| 15 |
<Yireo_CheckoutTester>
|
| 16 |
+
<version>0.1.11</version>
|
| 17 |
</Yireo_CheckoutTester>
|
| 18 |
</modules>
|
| 19 |
|
| 47 |
</args>
|
| 48 |
</checkouttester>
|
| 49 |
</routers>
|
| 50 |
+
|
| 51 |
<layout>
|
| 52 |
<updates>
|
| 53 |
<checkouttester>
|
| 57 |
</layout>
|
| 58 |
</frontend>
|
| 59 |
|
| 60 |
+
<adminhtml>
|
| 61 |
+
<events>
|
| 62 |
+
<controller_action_predispatch>
|
| 63 |
+
<observers>
|
| 64 |
+
<checkouttester_addFeed>
|
| 65 |
+
<class>Yireo_CheckoutTester_Model_Observer_AddFeed</class>
|
| 66 |
+
<method>execute</method>
|
| 67 |
+
</checkouttester_addFeed>
|
| 68 |
+
</observers>
|
| 69 |
+
</controller_action_predispatch>
|
| 70 |
+
</events>
|
| 71 |
+
</adminhtml>
|
| 72 |
+
|
| 73 |
<default>
|
| 74 |
<checkouttester>
|
| 75 |
<settings>
|
| 76 |
<order_id>0</order_id>
|
|
|
|
| 77 |
<checkout_onepage_controller_success_action>0</checkout_onepage_controller_success_action>
|
| 78 |
</settings>
|
| 79 |
</checkouttester>
|
app/code/community/Yireo/CheckoutTester/etc/system.xml
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
*
|
| 6 |
* @package Yireo_CheckoutTester
|
| 7 |
* @author Yireo (https://www.yireo.com/)
|
| 8 |
-
* @copyright Copyright
|
| 9 |
* @license Open Source License (OSL v3)
|
| 10 |
*/
|
| 11 |
-->
|
|
@@ -21,7 +21,7 @@
|
|
| 21 |
<label>Checkout Tester</label>
|
| 22 |
<tab>yireo</tab>
|
| 23 |
<frontend_type>text</frontend_type>
|
| 24 |
-
<sort_order>
|
| 25 |
<show_in_default>1</show_in_default>
|
| 26 |
<show_in_website>1</show_in_website>
|
| 27 |
<show_in_store>1</show_in_store>
|
| 5 |
*
|
| 6 |
* @package Yireo_CheckoutTester
|
| 7 |
* @author Yireo (https://www.yireo.com/)
|
| 8 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
| 9 |
* @license Open Source License (OSL v3)
|
| 10 |
*/
|
| 11 |
-->
|
| 21 |
<label>Checkout Tester</label>
|
| 22 |
<tab>yireo</tab>
|
| 23 |
<frontend_type>text</frontend_type>
|
| 24 |
+
<sort_order>30</sort_order>
|
| 25 |
<show_in_default>1</show_in_default>
|
| 26 |
<show_in_website>1</show_in_website>
|
| 27 |
<show_in_store>1</show_in_store>
|
app/design/frontend/base/default/layout/checkouttester.xml
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
*
|
| 5 |
* @package Yireo_CheckoutTester
|
| 6 |
* @author Yireo (https://www.yireo.com/)
|
| 7 |
-
* @copyright Copyright
|
| 8 |
* @license Open Software License
|
| 9 |
*/
|
| 10 |
-->
|
| 4 |
*
|
| 5 |
* @package Yireo_CheckoutTester
|
| 6 |
* @author Yireo (https://www.yireo.com/)
|
| 7 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
| 8 |
* @license Open Software License
|
| 9 |
*/
|
| 10 |
-->
|
app/etc/modules/Yireo_CheckoutTester.xml
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
*
|
| 6 |
* @package Yireo_CheckoutTester
|
| 7 |
* @author Yireo (https://www.yireo.com/)
|
| 8 |
-
* @copyright Copyright
|
| 9 |
* @license Open Software License
|
| 10 |
*/
|
| 11 |
-->
|
| 5 |
*
|
| 6 |
* @package Yireo_CheckoutTester
|
| 7 |
* @author Yireo (https://www.yireo.com/)
|
| 8 |
+
* @copyright Copyright 2016 Yireo (https://www.yireo.com/)
|
| 9 |
* @license Open Software License
|
| 10 |
*/
|
| 11 |
-->
|
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.11</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>2016-09-19</date><time>10:04:01</time><compatible></compatible><dependencies><required><php><min>5.4.0</min><max>7.5.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Yireo_CheckoutTester.xml" hash="47de7bcbcb216689ac342a35b9adc8bb"/></dir></dir><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="checkouttester.xml" hash="381aac03d9824ab7cddc777ca7c8152b"/></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="0072e5c365e9ce45e5a8a4210a04cefc"/><file name="config.xml" hash="d3ce95b727f189e31b5b440c7e131c93"/><file name="system.xml" hash="31990d26c3eba05a8d1a13ccc6f51f5e"/></dir><dir name="controllers"><file name="IndexController.php" hash="d143db2de4aa62ded6928870e9dbd429"/></dir><dir name="Model"><file name="Feed.php" hash="796be2f78d380f5469fb9bc3355ec61d"/><file name="Observer.php" hash="0f3c568e42deca2694310a30c71bd902"/><dir name="Observer"><file name="AddFeed.php" hash="513c73783d947b2b9a3e9d3ba00ce10e"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9adb92c5e0373a35f1b5064aace272c5"/></dir><dir name="Block"><file name="Success.php" hash="a30bb56dd76d3ff2a779fc5073915735"/><dir name="Field"><file name="Link.php" hash="6c4e265b7f9910f060678e74d0a28e22"/></dir></dir></dir></dir></dir></dir></dir></target></contents></package>
|
