Version Notes
none
Download this release
Release Info
Developer | Nikita Nautiyal |
Extension | nrgdetailedonepagesuccess |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
app/code/local/Details/Checkout/Block/Onepage/Success.php
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Checkout Success-module for Magento
|
4 |
+
*
|
5 |
+
* @category Checkout
|
6 |
+
* @package Details_Checkout
|
7 |
+
* @author Nikita Nautiyal
|
8 |
+
@for any queries email at: nautiyal.nikita@gmail.com
|
9 |
+
*/
|
10 |
+
class Details_Checkout_Block_Onepage_Success extends Mage_Core_Block_Template
|
11 |
+
{
|
12 |
+
/* include all the methods in Mage_Core Checkout Onepage Success Block */
|
13 |
+
public function __construct()
|
14 |
+
{
|
15 |
+
parent::__construct();
|
16 |
+
}
|
17 |
+
|
18 |
+
public function getOrderId()
|
19 |
+
{
|
20 |
+
return $this->_getData('order_id');
|
21 |
+
}
|
22 |
+
|
23 |
+
public function canPrint()
|
24 |
+
{
|
25 |
+
return $this->_getData('can_view_order');
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getPrintUrl()
|
30 |
+
{
|
31 |
+
return $this->_getData('print_url');
|
32 |
+
}
|
33 |
+
|
34 |
+
public function getViewOrderUrl()
|
35 |
+
{
|
36 |
+
return $this->_getData('view_order_id');
|
37 |
+
}
|
38 |
+
|
39 |
+
public function isOrderVisible()
|
40 |
+
{
|
41 |
+
return (bool)$this->_getData('is_order_visible');
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getProfileUrl(Varien_Object $profile)
|
45 |
+
{
|
46 |
+
return $this->getUrl('sales/recurring_profile/view', array('profile' => $profile->getId()));
|
47 |
+
}
|
48 |
+
|
49 |
+
protected function _beforeToHtml()
|
50 |
+
{
|
51 |
+
$this->_prepareLastOrder();
|
52 |
+
$this->_prepareLastBillingAgreement();
|
53 |
+
$this->_prepareLastRecurringProfiles();
|
54 |
+
return parent::_beforeToHtml();
|
55 |
+
}
|
56 |
+
|
57 |
+
protected function _prepareLastOrder()
|
58 |
+
{
|
59 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
60 |
+
if ($orderId) {
|
61 |
+
$order = Mage::getModel('sales/order')->load($orderId);
|
62 |
+
if ($order->getId()) {
|
63 |
+
$isVisible = !in_array($order->getState(),
|
64 |
+
Mage::getSingleton('sales/order_config')->getInvisibleOnFrontStates());
|
65 |
+
$this->addData(array(
|
66 |
+
'is_order_visible' => $isVisible,
|
67 |
+
'view_order_id' => $this->getUrl('sales/order/view/', array('order_id' => $orderId)),
|
68 |
+
'print_url' => $this->getUrl('sales/order/print', array('order_id'=> $orderId)),
|
69 |
+
'can_print_order' => $isVisible,
|
70 |
+
'can_view_order' => Mage::getSingleton('customer/session')->isLoggedIn() && $isVisible,
|
71 |
+
'order_id' => $order->getIncrementId(),
|
72 |
+
));
|
73 |
+
}
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
protected function _prepareLastBillingAgreement()
|
78 |
+
{
|
79 |
+
$agreementId = Mage::getSingleton('checkout/session')->getLastBillingAgreementId();
|
80 |
+
$customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
81 |
+
if ($agreementId && $customerId) {
|
82 |
+
$agreement = Mage::getModel('sales/billing_agreement')->load($agreementId);
|
83 |
+
if ($agreement->getId() && $customerId == $agreement->getCustomerId()) {
|
84 |
+
$this->addData(array(
|
85 |
+
'agreement_ref_id' => $agreement->getReferenceId(),
|
86 |
+
'agreement_url' => $this->getUrl('sales/billing_agreement/view',
|
87 |
+
array('agreement' => $agreementId)
|
88 |
+
),
|
89 |
+
));
|
90 |
+
}
|
91 |
+
}
|
92 |
+
}
|
93 |
+
|
94 |
+
protected function _prepareLastRecurringProfiles()
|
95 |
+
{
|
96 |
+
$profileIds = Mage::getSingleton('checkout/session')->getLastRecurringProfileIds();
|
97 |
+
if ($profileIds && is_array($profileIds)) {
|
98 |
+
$collection = Mage::getModel('sales/recurring_profile')->getCollection()
|
99 |
+
->addFieldToFilter('profile_id', array('in' => $profileIds))
|
100 |
+
;
|
101 |
+
$profiles = array();
|
102 |
+
foreach ($collection as $profile) {
|
103 |
+
$profiles[] = $profile;
|
104 |
+
}
|
105 |
+
if ($profiles) {
|
106 |
+
$this->setRecurringProfiles($profiles);
|
107 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
108 |
+
$this->setCanViewProfiles(true);
|
109 |
+
}
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
protected function getItemCount()
|
115 |
+
{
|
116 |
+
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
117 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
118 |
+
$items = $order->getAllVisibleItems();
|
119 |
+
$itemcount=count($items);
|
120 |
+
return $itemcount;
|
121 |
+
}
|
122 |
+
|
123 |
+
protected function getItemsInfo()
|
124 |
+
{
|
125 |
+
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
126 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
127 |
+
$items = $order->getAllVisibleItems();
|
128 |
+
return $items;
|
129 |
+
|
130 |
+
}
|
131 |
+
|
132 |
+
protected function getShippingMethod()
|
133 |
+
{
|
134 |
+
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
135 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
136 |
+
$shipping_method = $order->getShippingMethod();
|
137 |
+
$mname = explode("_", $shipping_method);
|
138 |
+
return "Shipping & Handling(" . $mname[0] . ")" ;
|
139 |
+
}
|
140 |
+
|
141 |
+
protected function getSubTotal()
|
142 |
+
{
|
143 |
+
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
144 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
145 |
+
return $order->getSubtotal();
|
146 |
+
}
|
147 |
+
|
148 |
+
protected function getGrandtotal()
|
149 |
+
{
|
150 |
+
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
151 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
152 |
+
return $order->getGrandTotal();
|
153 |
+
}
|
154 |
+
|
155 |
+
protected function getShippingamount()
|
156 |
+
{
|
157 |
+
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
158 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
159 |
+
return $order->getShippingAmount();
|
160 |
+
}
|
161 |
+
|
162 |
+
protected function getPaymentmethod()
|
163 |
+
{
|
164 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
165 |
+
$payment_method = $order->getPayment()->getMethodInstance()->getTitle();
|
166 |
+
return $payment_method;
|
167 |
+
}
|
168 |
+
protected function getShippingaddress()
|
169 |
+
{
|
170 |
+
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
171 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
172 |
+
$shipping_address_data = $order->getShippingAddress();
|
173 |
+
$shippingaddress = "<br><b> First Name: " . $shipping_address_data['firstname'] . " Last Name: " . $shipping_address_data['lastname'] . "<br> Street: " . $shipping_address_data['street'] . "<br> City: " . $shipping_address_data['city'] . ", Region: " . $shipping_address_data['region'] . " Post Code: " . $shipping_address_data['postcode'] . "<br> Country ID: " . $shipping_address_data['country_id'];
|
174 |
+
|
175 |
+
return $shippingaddress;
|
176 |
+
}
|
177 |
+
|
178 |
+
protected function getBillingAddress()
|
179 |
+
{
|
180 |
+
$sOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
181 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId());
|
182 |
+
$billing_address_data = $order->getBillingAddress();
|
183 |
+
$billingaddress = "<br><b> First name: " . $billing_address_data['firstname'] . " Last Name: " . $billing_address_data['lastname'] . "<br> Street: " . $billing_address_data['street'] . "<br> City: " . $billing_address_data['city'] . ", Region: " . $billing_address_data['region'] . " popstCode: " . $billing_address_data['postcode'] . "<br> Country ID: " . $billing_address_data['country_id'];
|
184 |
+
|
185 |
+
return $billingaddress;
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
app/code/local/Details/Checkout/etc/config.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Checkout Success-module for Magento
|
5 |
+
*
|
6 |
+
* @category Checkout
|
7 |
+
* @package Details_Checkout
|
8 |
+
* @author Nikita Nautiyal
|
9 |
+
*/ @for any queries email at: nautiyal.nikita@gmail.com
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<global>
|
13 |
+
<blocks>
|
14 |
+
<checkout>
|
15 |
+
<rewrite>
|
16 |
+
<onepage_success>Details_Checkout_Block_Onepage_Success</onepage_success>
|
17 |
+
</rewrite>
|
18 |
+
</checkout>
|
19 |
+
</blocks>
|
20 |
+
</global>
|
21 |
+
<frontend>
|
22 |
+
<layout>
|
23 |
+
<updates>
|
24 |
+
<details_checkout>
|
25 |
+
<file>details_checkout.xml</file>
|
26 |
+
</details_checkout>
|
27 |
+
</updates>
|
28 |
+
</layout>
|
29 |
+
</frontend>
|
30 |
+
</config>
|
app/design/frontend/base/default/layout/details_checkout.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Checkout Success-module for Magento
|
5 |
+
*
|
6 |
+
* @category Checkout
|
7 |
+
* @package Details_Checkout
|
8 |
+
* @author Nikita Nautiyal
|
9 |
+
*/ @for any queries email at: nautiyal.nikita@gmail.com
|
10 |
+
-->
|
11 |
+
<layout version="0.1.0">
|
12 |
+
<checkout_onepage_success>
|
13 |
+
<reference name="checkout.success">
|
14 |
+
<action method="setTemplate"><template>details/checkout/success.phtml</template></action>
|
15 |
+
</reference>
|
16 |
+
</checkout_onepage_success>
|
17 |
+
</layout>
|
app/etc/modules/Details_Checkout.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Checkout Success-module for Magento
|
5 |
+
*
|
6 |
+
* @category Checkout
|
7 |
+
* @package Details_Checkout
|
8 |
+
* @author Nikita Nautiyal
|
9 |
+
*/ @for any queries email at: nautiyal.nikita@gmail.com
|
10 |
+
-->
|
11 |
+
<config>
|
12 |
+
<modules>
|
13 |
+
<Details_Checkout>
|
14 |
+
<active>true</active>
|
15 |
+
<codePool>local</codePool>
|
16 |
+
</Details_Checkout>
|
17 |
+
</modules>
|
18 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>nrgdetailedonepagesuccess</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL v1.1</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>A better Success page</summary>
|
10 |
+
<description>This module displays the products just purchased along with the billing address, shipping address, payment method and shipping method on the success page.</description>
|
11 |
+
<notes>none</notes>
|
12 |
+
<authors><author><name>Nikita Nautiyal</name><user>nautiyal_nikita</user><email>nautiyal.nikita@gmail.com</email></author></authors>
|
13 |
+
<date>2013-12-17</date>
|
14 |
+
<time>04:19:58</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Details_Checkout.xml" hash="cd83339784b7203040c660b70f82483d"/></dir></target><target name="magelocal"><dir name="Details"><dir name="Checkout"><dir name="Block"><dir name="Onepage"><file name="Success.php" hash="9d8e15eda0229272400f9a3d694a7f27"/></dir></dir><dir name="etc"><file name="config.xml" hash="3ef580a83134268280b3d5042f58b6c7"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="details_checkout.xml" hash="eb102a4b734e83cd1ca3d0002b834f6c"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|