Version Notes
OneStepCheckout simplifies the checkout process of your Store.
Checking out is often the most complicated part of placing an order online, and many users end up abandoning their order. Some customers will be motivated enough to purchase regardless of how difficult it is - but others will be lost due to check-out complexity. OneStepCheckout greatly simplifies this process, leading to an immediate increase in sales.
Download this release
Release Info
Developer | BrainSINS |
Extension | mageguruonestepcheckout |
Version | 1.0.1 |
Comparing to | |
See all releases |
Version 1.0.1
- app/code/community/Mageguru/Onestepcheckout/Block/Adminhtml/Sales/Order/View/Opcheckoutcomment.php +59 -0
- app/code/community/Mageguru/Onestepcheckout/Block/Email/Info.php +6 -0
- app/code/community/Mageguru/Onestepcheckout/Block/Onepage.php +110 -0
- app/code/community/Mageguru/Onestepcheckout/Block/Onepage/Abstract.php +96 -0
- app/code/community/Mageguru/Onestepcheckout/Block/Onepage/Shipping/Method/Available.php +54 -0
- app/code/community/Mageguru/Onestepcheckout/Block/Sales/Order/View.php +10 -0
- app/code/community/Mageguru/Onestepcheckout/Helper/Data.php +202 -0
- app/code/community/Mageguru/Onestepcheckout/Model/Paypal/Api/Nvp.php +39 -0
- app/code/community/Mageguru/Onestepcheckout/Model/Type/Onepage.php +706 -0
- app/code/community/Mageguru/Onestepcheckout/controllers/OnepageController.php +624 -0
- app/code/community/Mageguru/Onestepcheckout/etc/config.xml +166 -0
- app/code/community/Mageguru/Onestepcheckout/etc/system.xml +103 -0
- app/code/community/Mageguru/Onestepcheckout/sql/onestepcheckout_setup/mysql4-install-0.1.0.php +17 -0
- app/code/community/Mageguru/Onestepcheckout/sql/onestepcheckout_setup/mysql4-upgrade-0.1.0-0.1.1.php +16 -0
- app/design/frontend/base/default/layout/onestepcheckout.xml +60 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/billing.phtml +195 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/coupan/coupan.phtml +109 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/delivery_date/deliverydate.phtml +228 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/delivery_date/js/calendar.phtml +71 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/email/comment.phtml +53 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/login.phtml +35 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/payment/methods.phtml +20 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/review/info.phtml +51 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/review/item.phtml +235 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/shipping.phtml +141 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/shipping_method.phtml +13 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/shipping_method/additional.phtml +1 -0
- app/design/frontend/base/default/template/onestepcheckout/onepage/shipping_method/available.phtml +36 -0
- app/design/frontend/base/default/template/onestepcheckout/onestepcheckout.phtml +295 -0
- app/design/frontend/base/default/template/onestepcheckout/sales/order/view.phtml +110 -0
- app/etc/modules/Mageguru_Onestepcheckout.xml +10 -0
- package.xml +20 -0
- skin/frontend/base/default/onestepcheckout/css/onestepcheckout.css +112 -0
- skin/frontend/base/default/onestepcheckout/images/ajax-loader.gif +0 -0
- skin/frontend/base/default/onestepcheckout/js/checkout-innner-modifications.js +12 -0
- skin/frontend/base/default/onestepcheckout/js/onestepcheckout.js +744 -0
- skin/frontend/base/default/onestepcheckout/js/osc-calendar-setup.js +218 -0
app/code/community/Mageguru/Onestepcheckout/Block/Adminhtml/Sales/Order/View/Opcheckoutcomment.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* To change this template, choose Tools | Templates
|
5 |
+
* and open the template in the editor.
|
6 |
+
*/
|
7 |
+
require_once 'Mage/Adminhtml/Block/Sales/Order/View/Items.php';
|
8 |
+
|
9 |
+
class Mageguru_Onestepcheckout_Block_Adminhtml_Sales_Order_View_Opcheckoutcomment extends Mage_Adminhtml_Block_Sales_Order_View_Items {
|
10 |
+
|
11 |
+
//put your code here
|
12 |
+
public function _toHtml() {
|
13 |
+
$html = parent::_toHtml();
|
14 |
+
$comment = $this->getOpcheckoutOrderCommentHtml();
|
15 |
+
$deliverDate = $this->getDeliveryDateHtml();
|
16 |
+
if(Mage::getStoreConfig('onestepcheckout/order/onestepcheckout_order_comment')==1){
|
17 |
+
return $html . $comment.$deliverDate;
|
18 |
+
}
|
19 |
+
return $html.$deliverDate;
|
20 |
+
}
|
21 |
+
|
22 |
+
public function getOpcheckoutOrderCommentHtml() {
|
23 |
+
$comment = $this->getOrder()->getOrderComment();
|
24 |
+
$html = '';
|
25 |
+
if (Mage::getStoreConfigFlag('onestepcheckout/order/onestepcheckout_order_comment') && $comment) {
|
26 |
+
$html .= '<div id="customer_comment" class="giftmessage-whole-order-container">
|
27 |
+
<div class="entry-edit">
|
28 |
+
<div class="entry-edit-head">
|
29 |
+
<h4>' . $this->helper('onestepcheckout')->__('Customer Comment') . '</h4>
|
30 |
+
</div>
|
31 |
+
<fieldset>' . nl2br($this->helper('onestepcheckout')->htmlEscape($comment)) . '</fieldset>
|
32 |
+
</div>
|
33 |
+
</div>';
|
34 |
+
}
|
35 |
+
return $html;
|
36 |
+
}
|
37 |
+
|
38 |
+
public function getDeliveryDateHtml() {
|
39 |
+
$date_format = 'd/M/Y';
|
40 |
+
$date_format.=" ,g:i a";
|
41 |
+
$ddate = $this->getOrder()->getShippingArrivalDate();
|
42 |
+
$formateddate = date ($date_format,strtotime($ddate));
|
43 |
+
$html = '';
|
44 |
+
if (Mage::getStoreConfigFlag('onestepcheckout/order/onestepcheckout_order_deliverydate') == 1 && $ddate != '') {
|
45 |
+
$html .= '<div id="delivery_date" class="delivery-whole-order-container">
|
46 |
+
<div class="entry-edit">
|
47 |
+
<div class="entry-edit-head">
|
48 |
+
<h4>' . $this->helper('onestepcheckout')->__('Deliver Date') . '</h4>
|
49 |
+
</div>
|
50 |
+
<fieldset>' . nl2br($this->helper('onestepcheckout')->htmlEscape($formateddate)) . '</fieldset>
|
51 |
+
</div>
|
52 |
+
</div>';
|
53 |
+
}
|
54 |
+
return $html;
|
55 |
+
}
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
?>
|
app/code/community/Mageguru/Onestepcheckout/Block/Email/Info.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Mageguru_Onestepcheckout_Block_Email_Info extends Mage_Sales_Block_Items_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
6 |
+
?>
|
app/code/community/Mageguru/Onestepcheckout/Block/Onepage.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mageguru_Onestepcheckout_Block_Onepage extends Mageguru_Onestepcheckout_Block_Onepage_Abstract {
|
4 |
+
|
5 |
+
protected function _prepareLayout() {
|
6 |
+
if ($head = $this->getLayout()->getBlock('head')) {
|
7 |
+
$head->setCanLoadCalendarJs(true);
|
8 |
+
}
|
9 |
+
return parent::_prepareLayout();
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getSteps() {
|
13 |
+
$steps = array();
|
14 |
+
|
15 |
+
if (!$this->isCustomerLoggedIn()) {
|
16 |
+
$steps['login'] = $this->getCheckout()->getStepData('login');
|
17 |
+
}
|
18 |
+
|
19 |
+
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
|
20 |
+
|
21 |
+
foreach ($stepCodes as $step) {
|
22 |
+
$steps[$step] = $this->getCheckout()->getStepData($step);
|
23 |
+
}
|
24 |
+
return $steps;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getActiveStep() {
|
28 |
+
return $this->isCustomerLoggedIn() ? 'billing' : 'login';
|
29 |
+
}
|
30 |
+
|
31 |
+
function getAddressBilling() {
|
32 |
+
if (!$this->isCustomerLoggedIn()) {
|
33 |
+
return $this->getQuote()->getBillingAddress();
|
34 |
+
} else {
|
35 |
+
return Mage::getModel('sales/quote_address');
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getAddressShipping() {
|
40 |
+
if (!$this->isCustomerLoggedIn()) {
|
41 |
+
return $this->getQuote()->getShippingAddress();
|
42 |
+
} else {
|
43 |
+
return Mage::getModel('sales/quote_address');
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
public function getFirstname() {
|
48 |
+
$firstname = $this->getAddress()->getFirstname();
|
49 |
+
if (empty($firstname) && $this->getQuote()->getCustomer()) {
|
50 |
+
return $this->getQuote()->getCustomer()->getFirstname();
|
51 |
+
}
|
52 |
+
return $firstname;
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getLastname() {
|
56 |
+
$lastname = $this->getAddress()->getLastname();
|
57 |
+
if (empty($lastname) && $this->getQuote()->getCustomer()) {
|
58 |
+
return $this->getQuote()->getCustomer()->getLastname();
|
59 |
+
}
|
60 |
+
return $lastname;
|
61 |
+
}
|
62 |
+
|
63 |
+
public function canShip() {
|
64 |
+
return !$this->getQuote()->isVirtual();
|
65 |
+
}
|
66 |
+
|
67 |
+
public function getMethod() {
|
68 |
+
return $this->getQuote()->getCheckoutMethod();
|
69 |
+
}
|
70 |
+
|
71 |
+
public function getAgreements() {
|
72 |
+
if (!$this->hasAgreements()) {
|
73 |
+
if (!Mage::getStoreConfigFlag('checkout/options/enable_agreements')) {
|
74 |
+
$agreements = array();
|
75 |
+
} else {
|
76 |
+
$agreements = Mage::getModel('checkout/agreement')->getCollection()
|
77 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
78 |
+
->addFieldToFilter('is_active', 1);
|
79 |
+
}
|
80 |
+
$this->setAgreements($agreements);
|
81 |
+
}
|
82 |
+
return $this->getData('agreements');
|
83 |
+
}
|
84 |
+
|
85 |
+
public function getAddress() {
|
86 |
+
if (is_null($this->_address)) {
|
87 |
+
if ($this->isCustomerLoggedIn()) {
|
88 |
+
$this->_address = $this->getQuote()->getBillingAddress();
|
89 |
+
if (!$this->_address->getFirstname()) {
|
90 |
+
$this->_address->setFirstname($this->getQuote()->getCustomer()->getFirstname());
|
91 |
+
}
|
92 |
+
if (!$this->_address->getLastname()) {
|
93 |
+
$this->_address->setLastname($this->getQuote()->getCustomer()->getLastname());
|
94 |
+
}
|
95 |
+
} else {
|
96 |
+
$this->_address = Mage::getModel('sales/quote_address');
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
return $this->_address;
|
101 |
+
}
|
102 |
+
|
103 |
+
public function isZipCodeRequired($countryId = null) {
|
104 |
+
if ($countryId != null) {
|
105 |
+
return !Mage::helper('directory')->isZipCodeOptional($countryId);
|
106 |
+
}
|
107 |
+
return true;
|
108 |
+
}
|
109 |
+
|
110 |
+
}
|
app/code/community/Mageguru/Onestepcheckout/Block/Onepage/Abstract.php
ADDED
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/Checkout/Block/Onepage/Abstract.php';
|
4 |
+
abstract class Mageguru_Onestepcheckout_Block_Onepage_Abstract extends Mage_Checkout_Block_Onepage_Abstract
|
5 |
+
{
|
6 |
+
|
7 |
+
public function getAddressesHtmlSelect($type)
|
8 |
+
{
|
9 |
+
if ($this->isCustomerLoggedIn()) {
|
10 |
+
$options = array();
|
11 |
+
foreach ($this->getCustomer()->getAddresses() as $address) {
|
12 |
+
$options[] = array(
|
13 |
+
'value' => $address->getId(),
|
14 |
+
'label' => $address->format('oneline')
|
15 |
+
);
|
16 |
+
}
|
17 |
+
|
18 |
+
$addressId = $this->getAddress()->getCustomerAddressId();
|
19 |
+
if (empty($addressId)) {
|
20 |
+
if ($type=='billing') {
|
21 |
+
$address = $this->getCustomer()->getPrimaryBillingAddress();
|
22 |
+
} else {
|
23 |
+
$address = $this->getCustomer()->getPrimaryShippingAddress();
|
24 |
+
}
|
25 |
+
if ($address) {
|
26 |
+
$addressId = $address->getId();
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
+
$select = $this->getLayout()->createBlock('core/html_select')
|
31 |
+
->setName($type.'_address_id')
|
32 |
+
->setId($type.'-address-select')
|
33 |
+
->setClass('address-select')
|
34 |
+
->setExtraParams('onchange="'.$type.'.newAddress(!this.value)"')
|
35 |
+
->setValue($addressId)
|
36 |
+
->setOptions($options);
|
37 |
+
|
38 |
+
$select->addOption('', Mage::helper('checkout')->__('New Address'));
|
39 |
+
|
40 |
+
return $select->getHtml();
|
41 |
+
}
|
42 |
+
return '';
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getCountryHtmlSelect($type)
|
46 |
+
{
|
47 |
+
$countryId = $this->getAddress()->getCountryId();
|
48 |
+
if (is_null($countryId)) {
|
49 |
+
$countryId = Mage::helper('core')->getDefaultCountry();
|
50 |
+
}
|
51 |
+
$select = $this->getLayout()->createBlock('core/html_select')
|
52 |
+
->setName($type.'[country_id]')
|
53 |
+
->setId($type.':country_id')
|
54 |
+
->setTitle(Mage::helper('checkout')->__('Country'))
|
55 |
+
->setClass('validate-select')
|
56 |
+
->setValue($countryId)
|
57 |
+
->setOptions($this->getCountryOptions());
|
58 |
+
if ($type === 'shipping') {
|
59 |
+
$select->setExtraParams('onchange="shipping.setSameAsBilling(false);"');
|
60 |
+
}
|
61 |
+
|
62 |
+
return $select->getHtml();
|
63 |
+
}
|
64 |
+
public function getCountryHtmlSelectOPcheckout($type,$default=null)
|
65 |
+
{
|
66 |
+
if($default) {
|
67 |
+
$countryId = $default;
|
68 |
+
}else {
|
69 |
+
if($type == 'billing'){
|
70 |
+
$countryId = $this->getAddressBilling()->getCountryId();
|
71 |
+
}else{
|
72 |
+
if($type == 'shipping'){
|
73 |
+
$countryId = $this->getAddressShipping()->getCountryId();
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
}
|
78 |
+
if (is_null($countryId)) {
|
79 |
+
$countryId = Mage::getStoreConfig('general/country/default');
|
80 |
+
}
|
81 |
+
$select = $this->getLayout()->createBlock('core/html_select')
|
82 |
+
->setName($type.'[country_id]')
|
83 |
+
->setId($type.':country_id')
|
84 |
+
->setTitle(Mage::helper('checkout')->__('Country'))
|
85 |
+
->setClass('validate-select com-box')
|
86 |
+
->setValue($countryId)
|
87 |
+
->setOptions($this->getCountryOptions());
|
88 |
+
if ($type === 'shipping') {
|
89 |
+
$select->setExtraParams('onchange="javascript: getShippingAndTax();"');
|
90 |
+
}else {
|
91 |
+
$select->setExtraParams('onchange="syncShipping(true);"');
|
92 |
+
}
|
93 |
+
|
94 |
+
return $select->getHtml();
|
95 |
+
}
|
96 |
+
}
|
app/code/community/Mageguru/Onestepcheckout/Block/Onepage/Shipping/Method/Available.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mageguru_Onestepcheckout_Block_Onepage_Shipping_Method_Available extends Mageguru_Onestepcheckout_Block_Onepage_Abstract
|
4 |
+
{
|
5 |
+
protected $_rates;
|
6 |
+
protected $_address;
|
7 |
+
|
8 |
+
public function getShippingRates()
|
9 |
+
{
|
10 |
+
if (empty($this->_rates)) {
|
11 |
+
$this->getAddress()->collectShippingRates()->save();
|
12 |
+
$groups = $this->getAddress()->getGroupedAllShippingRates();
|
13 |
+
/*
|
14 |
+
if (!empty($groups)) {
|
15 |
+
$ratesFilter = new Varien_Filter_Object_Grid();
|
16 |
+
$ratesFilter->addFilter(Mage::app()->getStore()->getPriceFilter(), 'price');
|
17 |
+
|
18 |
+
foreach ($groups as $code => $groupItems) {
|
19 |
+
$groups[$code] = $ratesFilter->filter($groupItems);
|
20 |
+
}
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
return $this->_rates = $groups;
|
25 |
+
}
|
26 |
+
return $this->_rates;
|
27 |
+
}
|
28 |
+
|
29 |
+
public function getAddress()
|
30 |
+
{
|
31 |
+
if (empty($this->_address)) {
|
32 |
+
$this->_address = $this->getQuote()->getShippingAddress();
|
33 |
+
}
|
34 |
+
return $this->_address;
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getCarrierName($carrierCode)
|
38 |
+
{
|
39 |
+
if ($name = Mage::getStoreConfig('carriers/'.$carrierCode.'/title')) {
|
40 |
+
return $name;
|
41 |
+
}
|
42 |
+
return $carrierCode;
|
43 |
+
}
|
44 |
+
|
45 |
+
public function getAddressShippingMethod()
|
46 |
+
{
|
47 |
+
return $this->getAddress()->getShippingMethod();
|
48 |
+
}
|
49 |
+
|
50 |
+
public function getShippingPrice($price, $flag)
|
51 |
+
{
|
52 |
+
return $this->getQuote()->getStore()->convertPrice(Mage::helper('tax')->getShippingPrice($price, $flag, $this->getAddress()), true);
|
53 |
+
}
|
54 |
+
}
|
app/code/community/Mageguru/Onestepcheckout/Block/Sales/Order/View.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mageguru_Onestepcheckout_Block_Sales_Order_View extends Mage_Sales_Block_Order_View
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->setTemplate('onestepcheckout/sales/order/view.phtml');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Mageguru/Onestepcheckout/Helper/Data.php
ADDED
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/Checkout/Helper/Data.php';
|
4 |
+
|
5 |
+
class Mageguru_Onestepcheckout_Helper_Data extends Mage_Checkout_Helper_Data {
|
6 |
+
|
7 |
+
const COMPATIBILITY_TYPE1 = 1; //for above
|
8 |
+
const COMPATIBILITY_TYPE2 = 2; //for 1.4.0.0 and 1.4.0.1
|
9 |
+
|
10 |
+
public function isActive() {
|
11 |
+
return Mage::getStoreConfigFlag('onestepcheckout/general/enabled');
|
12 |
+
}
|
13 |
+
|
14 |
+
public function isOrderCommentEnabled() {
|
15 |
+
// Mage::helper('unicommon')->c($this);
|
16 |
+
return Mage::getStoreConfigFlag('onestepcheckout/order/onestepcheckout_order_comment') ? true : false;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function isCouponDiscountEnabled() {
|
20 |
+
return Mage::getStoreConfigFlag('onestepcheckout/order/onestepcheckout_order_couponcode') ? true : false;
|
21 |
+
}
|
22 |
+
|
23 |
+
public function isOrderDeliveryEnabled() {
|
24 |
+
return Mage::getStoreConfigFlag('onestepcheckout/order/onestepcheckout_order_deliverydate') ? true : false;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function setOrderCommentCompatible1($observer) {
|
28 |
+
if ($this->getCompatibility() != self::COMPATIBILITY_TYPE1) {
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
$quote = $observer->getEvent()->getQuote();
|
32 |
+
if ($this->isOrderCommentEnabled()) {
|
33 |
+
$orderComment = trim($this->_getRequest()->getPost('order_comment'));
|
34 |
+
if ($orderComment != "") {
|
35 |
+
$observer->getEvent()->getOrder()->setOrderComment($orderComment);
|
36 |
+
} else {
|
37 |
+
$observer->getEvent()->getOrder()->setOrderComment(Mage::getSingleton('checkout/session')->getOpcheckoutOrderComment());
|
38 |
+
Mage::getSingleton('checkout/session')->unsOpcheckoutOrderComment();
|
39 |
+
}
|
40 |
+
}
|
41 |
+
$this->setGiftMessage($observer);
|
42 |
+
$this->saveShippingArrivalDate($observer);
|
43 |
+
$invetoryObserver = Mage::getModel('cataloginventory/observer');
|
44 |
+
if (!$quote->getInventoryProcessed()) {
|
45 |
+
$invetoryObserver->subtractQuoteInventory($observer);
|
46 |
+
$invetoryObserver->reindexQuoteInventory($observer);
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
public function setOrderCommentCompatible2($observer) {
|
51 |
+
if ($this->getCompatibility() != self::COMPATIBILITY_TYPE2) {
|
52 |
+
return;
|
53 |
+
}
|
54 |
+
if ($this->isOrderCommentEnabled()) {
|
55 |
+
$orderComment = trim($this->_getRequest()->getPost('order_comment'));
|
56 |
+
if ($orderComment == "") {
|
57 |
+
$orderComment = Mage::getSingleton('checkout/session')->getOpcheckoutOrderComment();
|
58 |
+
Mage::getSingleton('checkout/session')->unsOpcheckoutOrderComment();
|
59 |
+
}
|
60 |
+
$order = $observer->getEvent()->getOrder();
|
61 |
+
if ($order && ($orderComment != "")) {
|
62 |
+
if ($order->getId()) {
|
63 |
+
$resource = Mage::getSingleton('core/resource');
|
64 |
+
$sales_order = $resource->getTableName('sales_order');
|
65 |
+
$resource->getConnection('core_write')->update($sales_order, array('order_comment' => $orderComment), array('entity_id = ?' => $order->getId()));
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
$this->setGiftMessage($observer);
|
70 |
+
$this->saveShippingArrivalDate($observer);
|
71 |
+
}
|
72 |
+
|
73 |
+
public function isAllowedNewsletterSubscription() {
|
74 |
+
$customerSession = Mage::getSingleton('customer/session');
|
75 |
+
if (defined('Mage_Newsletter_Model_Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG') && Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG) != 1 && !$customerSession->isLoggedIn()) {
|
76 |
+
return false;
|
77 |
+
} else {
|
78 |
+
if ($customerSession->isLoggedIn()) {
|
79 |
+
$subscriber = Mage::getModel('newsletter/subscriber')->loadByCustomer($customerSession->getCustomer());
|
80 |
+
return !$subscriber->isSubscribed() && Mage::getStoreConfig('tscheckout/order/tscheckout_newsletter_subscribe');
|
81 |
+
}
|
82 |
+
return Mage::getStoreConfig('onestepcheckout/order/onestepcheckout_newsletter_subscribe');
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
public function isNewsletterSubscriptionChecked() {
|
87 |
+
return (boolean) Mage::getStoreConfig('onestepcheckout/order/newsletter_checked_bydefault');
|
88 |
+
}
|
89 |
+
|
90 |
+
public function getCompatibility() {
|
91 |
+
$version = Mage::getVersion();
|
92 |
+
if (in_array($version, array('1.4.0.0', '1.4.0.1'))) {
|
93 |
+
return self::COMPATIBILITY_TYPE2;
|
94 |
+
} else {
|
95 |
+
return self::COMPATIBILITY_TYPE1;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
/*
|
100 |
+
* Set Order Delivery Date..
|
101 |
+
*/
|
102 |
+
|
103 |
+
public function saveShippingArrivalDate($observer) {
|
104 |
+
$DDate = $this->_getRequest()->getPost('shipping_arrival_date');
|
105 |
+
if ($this->isOrderDeliveryEnabled()) {
|
106 |
+
if ($DDate == "") {
|
107 |
+
$DDate = Mage::getSingleton('checkout/session')->getShippingArrivalDate();
|
108 |
+
Mage::getSingleton('checkout/session')->unsShippingArrivalDate();
|
109 |
+
}
|
110 |
+
$order = $observer->getEvent()->getOrder();
|
111 |
+
$desiredArrivalDate = $DDate;
|
112 |
+
if (isset($desiredArrivalDate) && !empty($desiredArrivalDate)) {
|
113 |
+
if ($this->getCompatibility() == self::COMPATIBILITY_TYPE2) {
|
114 |
+
$resource = Mage::getSingleton('core/resource');
|
115 |
+
$sales_order = $resource->getTableName('sales_order');
|
116 |
+
$resource->getConnection('core_write')->update($sales_order, array('shipping_arrival_date' => $desiredArrivalDate), array('entity_id = ?' => $order->getId()));
|
117 |
+
} else {
|
118 |
+
$order->setShippingArrivalDate($desiredArrivalDate);
|
119 |
+
}
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
public function getFormatedDeliveryDateToSave($date = null) {
|
125 |
+
if (empty($date) || $date == null || $date == '0000-00-00 00:00:00') {
|
126 |
+
return null;
|
127 |
+
}
|
128 |
+
|
129 |
+
$timestamp = null;
|
130 |
+
try {
|
131 |
+
//TODO: add Better Date Validation
|
132 |
+
$timestamp = strtotime($date);
|
133 |
+
$dateArray = explode("-", $date);
|
134 |
+
if (count($dateArray) != 3) {
|
135 |
+
//invalid date
|
136 |
+
return null;
|
137 |
+
}
|
138 |
+
$formatedDate = date('Y-m-d H:i:s', strtotime($date));
|
139 |
+
} catch (Exception $e) {
|
140 |
+
//TODO: email error
|
141 |
+
//return null if not converted ok
|
142 |
+
return null;
|
143 |
+
}
|
144 |
+
|
145 |
+
return $formatedDate;
|
146 |
+
}
|
147 |
+
|
148 |
+
/*
|
149 |
+
* @ Gift Messages for Order and Item
|
150 |
+
*/
|
151 |
+
|
152 |
+
public function setGiftMessage($observer) {
|
153 |
+
$message = $this->_getRequest()->getPost('giftmessage');
|
154 |
+
if (empty($message)) {
|
155 |
+
$message = Mage::getSingleton('checkout/session')->getData('opgiftmessage');
|
156 |
+
Mage::getSingleton('checkout/session')->unsetData('opgiftmessage');
|
157 |
+
}
|
158 |
+
$quotemsg = array();
|
159 |
+
$order = $observer->getEvent()->getOrder();
|
160 |
+
if(is_array($message)) {
|
161 |
+
foreach ($message as $msgid => $msg):
|
162 |
+
if ($msg['type'] == 'quote') {
|
163 |
+
$m = $msg['message'];
|
164 |
+
$from = $msg['from'];
|
165 |
+
$to = $msg['to'];
|
166 |
+
$giftMessage = Mage::getModel('giftmessage/message');
|
167 |
+
if ($m !== '') {
|
168 |
+
$giftMessage->setSender($from);
|
169 |
+
$giftMessage->setRecipient($to);
|
170 |
+
$giftMessage->setMessage($m);
|
171 |
+
$giftMessage->save();
|
172 |
+
}
|
173 |
+
$order->setGiftMessageId($giftMessage->getId());
|
174 |
+
} else if ($msg['type'] == 'quote_item') {
|
175 |
+
$m = $msg['message'];
|
176 |
+
$from = $msg['from'];
|
177 |
+
$to = $msg['to'];
|
178 |
+
$giftMessage = Mage::getModel('giftmessage/message');
|
179 |
+
if ($m !== '') {
|
180 |
+
$giftMessage->setSender($from);
|
181 |
+
$giftMessage->setRecipient($to);
|
182 |
+
$giftMessage->setMessage($m);
|
183 |
+
$giftMessage->save();
|
184 |
+
}
|
185 |
+
$quotemsg[$msgid] = $giftMessage->getId();
|
186 |
+
if ($this->getCompatibility() == self::COMPATIBILITY_TYPE2) {
|
187 |
+
$resource = Mage::getSingleton('core/resource');
|
188 |
+
$sales_order = $resource->getTableName('sales_flat_order_item');
|
189 |
+
$resource->getConnection('core_write')->update($sales_order, array('gift_message_id' => $giftMessage->getId()), array('order_id= ?' => $order->getId()));
|
190 |
+
}
|
191 |
+
}
|
192 |
+
endforeach;
|
193 |
+
$items = $order->getAllItems();
|
194 |
+
foreach ($items as $itemId => $item) {
|
195 |
+
if (array_key_exists($item['quote_item_id'], $quotemsg)) {
|
196 |
+
$item->setGiftMessageId($quotemsg[$item['quote_item_id']]);
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
201 |
+
|
202 |
+
}
|
app/code/community/Mageguru/Onestepcheckout/Model/Paypal/Api/Nvp.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Mageguru_Onestepcheckout_Model_Paypal_Api_Nvp extends Mage_Paypal_Model_Api_Nvp
|
4 |
+
{
|
5 |
+
protected function _exportAddressses($data)
|
6 |
+
{
|
7 |
+
$version = Mage::getVersionInfo();
|
8 |
+
if($version['major']>=1 && $version['minor']>=7){
|
9 |
+
parent::_exportAddressses($data);
|
10 |
+
}else{
|
11 |
+
$address = new Varien_Object();
|
12 |
+
Varien_Object_Mapper::accumulateByMap($data, $address, $this->_billingAddressMap);
|
13 |
+
$address->setExportedKeys(array_values($this->_billingAddressMap));
|
14 |
+
$this->_applyStreetAndRegionWorkarounds($address);
|
15 |
+
$this->setExportedBillingAddress($address);
|
16 |
+
// assume there is shipping address if there is at least one field specific to shipping
|
17 |
+
if (isset($data['SHIPTONAME'])) {
|
18 |
+
$shippingAddress = clone $address;
|
19 |
+
Varien_Object_Mapper::accumulateByMap($data, $shippingAddress, $this->_shippingAddressMap);
|
20 |
+
$this->_applyStreetAndRegionWorkarounds($shippingAddress);
|
21 |
+
// PayPal doesn't provide detailed shipping name fields, so the name will be overwritten
|
22 |
+
$firstName = $data['SHIPTONAME'];
|
23 |
+
$lastName = null;
|
24 |
+
if (isset($data['FIRSTNAME']) && $data['LASTNAME']) {
|
25 |
+
$firstName = $data['FIRSTNAME'];
|
26 |
+
$lastName = $data['LASTNAME'];
|
27 |
+
}
|
28 |
+
$shippingAddress->addData(array(
|
29 |
+
'prefix' => null,
|
30 |
+
'firstname' => $firstName,
|
31 |
+
'middlename' => null,
|
32 |
+
'lastname' => $lastName,
|
33 |
+
'suffix' => null,
|
34 |
+
));
|
35 |
+
$this->setExportedShippingAddress($shippingAddress);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
app/code/community/Mageguru/Onestepcheckout/Model/Type/Onepage.php
ADDED
@@ -0,0 +1,706 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
require_once 'Mage/Checkout/Model/Type/Onepage.php';
|
5 |
+
|
6 |
+
class Mageguru_Onestepcheckout_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Enter description here...
|
10 |
+
*
|
11 |
+
* @return Mage_Checkout_Model_Session
|
12 |
+
*/
|
13 |
+
public function getCheckout() {
|
14 |
+
return Mage::getSingleton('checkout/session');
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Enter description here...
|
19 |
+
*
|
20 |
+
* @return Mage_Sales_Model_Quote
|
21 |
+
*/
|
22 |
+
public function getQuote() {
|
23 |
+
return $this->getCheckout()->getQuote();
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Enter description here...
|
28 |
+
*
|
29 |
+
* @return Mage_Checkout_Model_Type_Onepage
|
30 |
+
*/
|
31 |
+
public function initCheckout() {
|
32 |
+
$checkout = $this->getCheckout();
|
33 |
+
if (is_array($checkout->getStepData())) {
|
34 |
+
foreach ($checkout->getStepData() as $step => $data) {
|
35 |
+
if (!($step === 'login'
|
36 |
+
|| Mage::getSingleton('customer/session')->isLoggedIn() && $step === 'billing')) {
|
37 |
+
$checkout->setStepData($step, 'allow', false);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
/*
|
42 |
+
* want to laod the correct customer information by assiging to address
|
43 |
+
* instead of just loading from sales/quote_address
|
44 |
+
*/
|
45 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
46 |
+
if ($customer) {
|
47 |
+
$this->getQuote()->assignCustomer($customer);
|
48 |
+
}
|
49 |
+
if ($this->getQuote()->getIsMultiShipping()) {
|
50 |
+
$this->getQuote()->setIsMultiShipping(false);
|
51 |
+
$this->getQuote()->save();
|
52 |
+
}
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Enter description here...
|
58 |
+
*
|
59 |
+
* @param string $method
|
60 |
+
* @return array
|
61 |
+
*/
|
62 |
+
public function saveCheckoutMethod($method) {
|
63 |
+
if (empty($method)) {
|
64 |
+
$res = array(
|
65 |
+
'error' => -1,
|
66 |
+
'message' => Mage::helper('checkout')->__('Invalid data')
|
67 |
+
);
|
68 |
+
return $res;
|
69 |
+
}
|
70 |
+
|
71 |
+
$this->getQuote()->setCheckoutMethod($method)->save();
|
72 |
+
//$this->getCheckout()->setStepData('billing', 'allow', true);
|
73 |
+
return array();
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* This method is called by One Page Checkout JS (AJAX) while saving the billing information.
|
78 |
+
*
|
79 |
+
* @param unknown_type $data
|
80 |
+
* @param unknown_type $customerAddressId
|
81 |
+
* @return unknown
|
82 |
+
*/
|
83 |
+
public function saveBilling($data, $customerAddressId) {
|
84 |
+
if (empty($data)) {
|
85 |
+
$res = array(
|
86 |
+
'error' => -1,
|
87 |
+
'message' => Mage::helper('checkout')->__('Invalid data')
|
88 |
+
);
|
89 |
+
return $res;
|
90 |
+
}
|
91 |
+
|
92 |
+
$address = $this->getQuote()->getBillingAddress();
|
93 |
+
if (!empty($customerAddressId)) {
|
94 |
+
$customerAddress = Mage::getModel('customer/address')->load($customerAddressId);
|
95 |
+
if ($customerAddress->getId()) {
|
96 |
+
if ($customerAddress->getCustomerId() != $this->getQuote()->getCustomerId()) {
|
97 |
+
return array('error' => 1,
|
98 |
+
'message' => Mage::helper('checkout')->__('Customer Address is not valid.')
|
99 |
+
);
|
100 |
+
}
|
101 |
+
$address->importCustomerAddress($customerAddress);
|
102 |
+
}
|
103 |
+
} else {
|
104 |
+
unset($data['address_id']);
|
105 |
+
$address->addData($data);
|
106 |
+
//$address->setId(null);
|
107 |
+
}
|
108 |
+
|
109 |
+
if (($validateRes = $address->validate()) !== true) {
|
110 |
+
$res = array(
|
111 |
+
'error' => 1,
|
112 |
+
'message' => $validateRes
|
113 |
+
);
|
114 |
+
return $res;
|
115 |
+
}
|
116 |
+
|
117 |
+
if (!$this->getQuote()->getCustomerId() && Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER == $this->getQuote()->getCheckoutMethod()) {
|
118 |
+
if ($this->_customerEmailExists($address->getEmail(), Mage::app()->getWebsite()->getId())) {
|
119 |
+
return array('error' => 1,
|
120 |
+
'message' => Mage::helper('checkout')->__('There is already a customer registered using this email address')
|
121 |
+
);
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
$address->implodeStreetAddress();
|
126 |
+
|
127 |
+
if (!$this->getQuote()->isVirtual()) {
|
128 |
+
/**
|
129 |
+
* Billing address using otions
|
130 |
+
*/
|
131 |
+
$usingCase = isset($data['use_for_shipping']) ? (int) $data['use_for_shipping'] : 0;
|
132 |
+
|
133 |
+
switch ($usingCase) {
|
134 |
+
case 0:
|
135 |
+
$shipping = $this->getQuote()->getShippingAddress();
|
136 |
+
$shipping->setSameAsBilling(0);
|
137 |
+
break;
|
138 |
+
case 1:
|
139 |
+
$billing = clone $address;
|
140 |
+
$billing->unsAddressId()->unsAddressType();
|
141 |
+
$shipping = $this->getQuote()->getShippingAddress();
|
142 |
+
$shippingMethod = $shipping->getShippingMethod();
|
143 |
+
$shipping->addData($billing->getData())
|
144 |
+
->setSameAsBilling(1)
|
145 |
+
->setShippingMethod($shippingMethod)
|
146 |
+
->setCollectShippingRates(true);
|
147 |
+
$this->getCheckout()->setStepData('shipping', 'complete', true);
|
148 |
+
break;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
|
152 |
+
if (true !== $result = $this->_processValidateCustomer($address)) {
|
153 |
+
return $result;
|
154 |
+
}
|
155 |
+
|
156 |
+
$this->getQuote()->collectTotals();
|
157 |
+
$this->getQuote()->save();
|
158 |
+
|
159 |
+
$this->getCheckout()
|
160 |
+
->setStepData('billing', 'allow', true)
|
161 |
+
->setStepData('billing', 'complete', true)
|
162 |
+
->setStepData('shipping', 'allow', true);
|
163 |
+
|
164 |
+
return array();
|
165 |
+
}
|
166 |
+
|
167 |
+
public function saveBillingStep($data, $customerAddressId) {
|
168 |
+
if (empty($data)) {
|
169 |
+
$res = array(
|
170 |
+
'error' => -1,
|
171 |
+
'message' => Mage::helper('checkout')->__('Invalid data')
|
172 |
+
);
|
173 |
+
return $res;
|
174 |
+
}
|
175 |
+
|
176 |
+
$address = $this->getQuote()->getBillingAddress();
|
177 |
+
if (!empty($customerAddressId)) {
|
178 |
+
$customerAddress = Mage::getModel('customer/address')->load($customerAddressId);
|
179 |
+
if ($customerAddress->getId()) {
|
180 |
+
if ($customerAddress->getCustomerId() != $this->getQuote()->getCustomerId()) {
|
181 |
+
return array('error' => 1,
|
182 |
+
'message' => Mage::helper('checkout')->__('Customer Address is not valid.')
|
183 |
+
);
|
184 |
+
}
|
185 |
+
$address->importCustomerAddress($customerAddress);
|
186 |
+
}
|
187 |
+
} else {
|
188 |
+
unset($data['address_id']);
|
189 |
+
$address->addData($data);
|
190 |
+
//$address->setId(null);
|
191 |
+
}
|
192 |
+
|
193 |
+
if (!$this->getQuote()->getCustomerId() && Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER == $this->getQuote()->getCheckoutMethod()) {
|
194 |
+
if ($this->_customerEmailExists($address->getEmail(), Mage::app()->getWebsite()->getId())) {
|
195 |
+
return array('error' => 1,
|
196 |
+
'message' => Mage::helper('checkout')->__('There is already a customer registered using this email address')
|
197 |
+
);
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
$address->implodeStreetAddress();
|
202 |
+
|
203 |
+
if (!$this->getQuote()->isVirtual()) {
|
204 |
+
/**
|
205 |
+
* Billing address using otions
|
206 |
+
*/
|
207 |
+
$usingCase = isset($data['use_for_shipping']) ? (int) $data['use_for_shipping'] : 0;
|
208 |
+
|
209 |
+
switch ($usingCase) {
|
210 |
+
case 0:
|
211 |
+
$shipping = $this->getQuote()->getShippingAddress();
|
212 |
+
$shipping->setSameAsBilling(0);
|
213 |
+
break;
|
214 |
+
case 1:
|
215 |
+
$billing = clone $address;
|
216 |
+
$billing->unsAddressId()->unsAddressType();
|
217 |
+
$shipping = $this->getQuote()->getShippingAddress();
|
218 |
+
$shippingMethod = $shipping->getShippingMethod();
|
219 |
+
$shipping->addData($billing->getData())
|
220 |
+
->setSameAsBilling(1)
|
221 |
+
->setShippingMethod($shippingMethod)
|
222 |
+
->setCollectShippingRates(true);
|
223 |
+
$this->getCheckout()->setStepData('shipping', 'complete', true);
|
224 |
+
break;
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
if (true !== $result = $this->_processValidateCustomer($address)) {
|
229 |
+
return $result;
|
230 |
+
}
|
231 |
+
|
232 |
+
$this->getQuote()->collectTotals();
|
233 |
+
$this->getQuote()->save();
|
234 |
+
|
235 |
+
$this->getCheckout()
|
236 |
+
->setStepData('billing', 'allow', true)
|
237 |
+
->setStepData('billing', 'complete', true)
|
238 |
+
->setStepData('shipping', 'allow', true);
|
239 |
+
|
240 |
+
return array();
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Validate customer data and set some its data for further usage in quote
|
245 |
+
* Will return either true or array with error messages
|
246 |
+
*
|
247 |
+
* @param Mage_Sales_Model_Quote_Address $address
|
248 |
+
* @return true|array
|
249 |
+
*/
|
250 |
+
protected function _processValidateCustomer(Mage_Sales_Model_Quote_Address $address) {
|
251 |
+
// set customer date of birth for further usage
|
252 |
+
$dob = '';
|
253 |
+
if ($address->getDob()) {
|
254 |
+
$dob = Mage::app()->getLocale()->date($address->getDob(), null, null, false)->toString('yyyy-MM-dd');
|
255 |
+
$this->getQuote()->setCustomerDob($dob);
|
256 |
+
}
|
257 |
+
|
258 |
+
// set customer tax/vat number for further usage
|
259 |
+
if ($address->getTaxvat()) {
|
260 |
+
$this->getQuote()->setCustomerTaxvat($address->getTaxvat());
|
261 |
+
}
|
262 |
+
|
263 |
+
// invoke customer model, if it is registering
|
264 |
+
if (Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER == $this->getQuote()->getCheckoutMethod()) {
|
265 |
+
// set customer password hash for further usage
|
266 |
+
$customer = Mage::getModel('customer/customer');
|
267 |
+
$this->getQuote()->setPasswordHash($customer->encryptPassword($address->getCustomerPassword()));
|
268 |
+
|
269 |
+
// validate customer
|
270 |
+
foreach (array(
|
271 |
+
'firstname' => 'firstname',
|
272 |
+
'lastname' => 'lastname',
|
273 |
+
'email' => 'email',
|
274 |
+
'password' => 'customer_password',
|
275 |
+
'confirmation' => 'confirm_password',
|
276 |
+
'taxvat' => 'taxvat',
|
277 |
+
) as $key => $dataKey) {
|
278 |
+
$customer->setData($key, $address->getData($dataKey));
|
279 |
+
}
|
280 |
+
if ($dob) {
|
281 |
+
$customer->setDob($dob);
|
282 |
+
}
|
283 |
+
$validationResult = $customer->validate();
|
284 |
+
if (true !== $validationResult && is_array($validationResult)) {
|
285 |
+
return array(
|
286 |
+
'error' => -1,
|
287 |
+
'message' => implode(', ', $validationResult)
|
288 |
+
);
|
289 |
+
}
|
290 |
+
} elseif (Mage_Sales_Model_Quote::CHECKOUT_METHOD_GUEST == $this->getQuote()->getCheckoutMethod()) {
|
291 |
+
$email = $address->getData('email');
|
292 |
+
if (!Zend_Validate::is($email, 'EmailAddress')) {
|
293 |
+
return array(
|
294 |
+
'error' => -1,
|
295 |
+
'message' => Mage::helper('checkout')->__('Invalid email address "%s"', $email)
|
296 |
+
);
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
+
return true;
|
301 |
+
}
|
302 |
+
|
303 |
+
public function saveShipping($data, $customerAddressId) {
|
304 |
+
if (empty($data)) {
|
305 |
+
$res = array(
|
306 |
+
'error' => -1,
|
307 |
+
'message' => Mage::helper('checkout')->__('Invalid data')
|
308 |
+
);
|
309 |
+
return $res;
|
310 |
+
}
|
311 |
+
|
312 |
+
$address = $this->getQuote()->getShippingAddress();
|
313 |
+
|
314 |
+
if (!empty($customerAddressId)) {
|
315 |
+
$customerAddress = Mage::getModel('customer/address')->load($customerAddressId);
|
316 |
+
if ($customerAddress->getId()) {
|
317 |
+
if ($customerAddress->getCustomerId() != $this->getQuote()->getCustomerId()) {
|
318 |
+
return array('error' => 1,
|
319 |
+
'message' => Mage::helper('checkout')->__('Customer Address is not valid.')
|
320 |
+
);
|
321 |
+
}
|
322 |
+
$address->importCustomerAddress($customerAddress);
|
323 |
+
}
|
324 |
+
} else {
|
325 |
+
unset($data['address_id']);
|
326 |
+
$address->addData($data);
|
327 |
+
}
|
328 |
+
$address->implodeStreetAddress();
|
329 |
+
$address->setCollectShippingRates(true);
|
330 |
+
|
331 |
+
if (($validateRes = $address->validate()) !== true) {
|
332 |
+
$res = array(
|
333 |
+
'error' => 1,
|
334 |
+
'message' => $validateRes
|
335 |
+
);
|
336 |
+
return $res;
|
337 |
+
}
|
338 |
+
|
339 |
+
$this->getQuote()->collectTotals()->save();
|
340 |
+
|
341 |
+
$this->getCheckout()
|
342 |
+
->setStepData('shipping', 'complete', true)
|
343 |
+
->setStepData('shipping_method', 'allow', true);
|
344 |
+
|
345 |
+
return array();
|
346 |
+
}
|
347 |
+
|
348 |
+
public function saveShippingMethod($shippingMethod) {
|
349 |
+
if (empty($shippingMethod)) {
|
350 |
+
$res = array(
|
351 |
+
'error' => -1,
|
352 |
+
'message' => Mage::helper('checkout')->__('Invalid shipping method.')
|
353 |
+
);
|
354 |
+
return $res;
|
355 |
+
}
|
356 |
+
$rate = $this->getQuote()->getShippingAddress()->getShippingRateByCode($shippingMethod);
|
357 |
+
if (!$rate) {
|
358 |
+
$res = array(
|
359 |
+
'error' => -1,
|
360 |
+
'message' => Mage::helper('checkout')->__('Invalid shipping method.')
|
361 |
+
);
|
362 |
+
return $res;
|
363 |
+
}
|
364 |
+
$this->getQuote()->getShippingAddress()->setShippingMethod($shippingMethod);
|
365 |
+
$this->getQuote()->collectTotals()->save();
|
366 |
+
|
367 |
+
$this->getCheckout()
|
368 |
+
->setStepData('shipping_method', 'complete', true)
|
369 |
+
->setStepData('payment', 'allow', true);
|
370 |
+
|
371 |
+
return array();
|
372 |
+
}
|
373 |
+
|
374 |
+
public function savePayment($data) {
|
375 |
+
if (empty($data)) {
|
376 |
+
return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid data'));
|
377 |
+
}
|
378 |
+
|
379 |
+
$quote = $this->getQuote();
|
380 |
+
if ($quote->isVirtual()) {
|
381 |
+
$quote->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
382 |
+
} else {
|
383 |
+
$quote->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
384 |
+
}
|
385 |
+
|
386 |
+
// shipping totals may be affected by payment method
|
387 |
+
if (!$quote->isVirtual() && $quote->getShippingAddress()) {
|
388 |
+
$quote->getShippingAddress()->setCollectShippingRates(true);
|
389 |
+
}
|
390 |
+
$payment = $quote->getPayment();
|
391 |
+
$payment->importData($data);
|
392 |
+
|
393 |
+
$quote->save();
|
394 |
+
|
395 |
+
$this->getCheckout()
|
396 |
+
->setStepData('payment', 'complete', true)
|
397 |
+
->setStepData('review', 'allow', true);
|
398 |
+
|
399 |
+
return array();
|
400 |
+
}
|
401 |
+
|
402 |
+
protected function validateOrder() {
|
403 |
+
$helper = Mage::helper('checkout');
|
404 |
+
if ($this->getQuote()->getIsMultiShipping()) {
|
405 |
+
Mage::throwException($helper->__('Invalid checkout type.'));
|
406 |
+
}
|
407 |
+
|
408 |
+
if (!$this->getQuote()->isVirtual()) {
|
409 |
+
$address = $this->getQuote()->getShippingAddress();
|
410 |
+
$addressValidation = $address->validate();
|
411 |
+
if ($addressValidation !== true) {
|
412 |
+
Mage::throwException($helper->__('Please check shipping address information.'));
|
413 |
+
}
|
414 |
+
$method = $address->getShippingMethod();
|
415 |
+
$rate = $address->getShippingRateByCode($method);
|
416 |
+
if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) {
|
417 |
+
Mage::throwException($helper->__('Please specify shipping method.'));
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
$addressValidation = $this->getQuote()->getBillingAddress()->validate();
|
422 |
+
if ($addressValidation !== true) {
|
423 |
+
Mage::throwException($helper->__('Please check billing address information.'));
|
424 |
+
}
|
425 |
+
|
426 |
+
if (!($this->getQuote()->getPayment()->getMethod())) {
|
427 |
+
Mage::throwException($helper->__('Please select valid payment method.'));
|
428 |
+
}
|
429 |
+
}
|
430 |
+
|
431 |
+
/**
|
432 |
+
* Enter description here...
|
433 |
+
*
|
434 |
+
* @return array
|
435 |
+
*/
|
436 |
+
public function saveOrder() {
|
437 |
+
$this->validateOrder();
|
438 |
+
$billing = $this->getQuote()->getBillingAddress();
|
439 |
+
if (!$this->getQuote()->isVirtual()) {
|
440 |
+
$shipping = $this->getQuote()->getShippingAddress();
|
441 |
+
}
|
442 |
+
switch ($this->getQuote()->getCheckoutMethod()) {
|
443 |
+
case Mage_Sales_Model_Quote::CHECKOUT_METHOD_GUEST:
|
444 |
+
if (!$this->getQuote()->isAllowedGuestCheckout()) {
|
445 |
+
Mage::throwException(Mage::helper('checkout')->__('Sorry, guest checkout is not enabled. Please try again or contact store owner.'));
|
446 |
+
}
|
447 |
+
$this->getQuote()->setCustomerId(null)
|
448 |
+
->setCustomerEmail($billing->getEmail())
|
449 |
+
->setCustomerIsGuest(true)
|
450 |
+
->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID);
|
451 |
+
break;
|
452 |
+
|
453 |
+
case Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER:
|
454 |
+
$customer = Mage::getModel('customer/customer');
|
455 |
+
/* @var $customer Mage_Customer_Model_Customer */
|
456 |
+
|
457 |
+
$customerBilling = $billing->exportCustomerAddress();
|
458 |
+
$customer->addAddress($customerBilling);
|
459 |
+
|
460 |
+
if (!$this->getQuote()->isVirtual() && !$shipping->getSameAsBilling()) {
|
461 |
+
$customerShipping = $shipping->exportCustomerAddress();
|
462 |
+
$customer->addAddress($customerShipping);
|
463 |
+
}
|
464 |
+
|
465 |
+
if ($this->getQuote()->getCustomerDob() && !$billing->getCustomerDob()) {
|
466 |
+
$billing->setCustomerDob($this->getQuote()->getCustomerDob());
|
467 |
+
}
|
468 |
+
|
469 |
+
if ($this->getQuote()->getCustomerTaxvat() && !$billing->getCustomerTaxvat()) {
|
470 |
+
$billing->setCustomerTaxvat($this->getQuote()->getCustomerTaxvat());
|
471 |
+
}
|
472 |
+
|
473 |
+
Mage::helper('core')->copyFieldset('checkout_onepage_billing', 'to_customer', $billing, $customer);
|
474 |
+
|
475 |
+
$customer->setPassword($customer->decryptPassword($this->getQuote()->getPasswordHash()));
|
476 |
+
$customer->setPasswordHash($customer->hashPassword($customer->getPassword()));
|
477 |
+
|
478 |
+
$this->getQuote()->setCustomer($customer);
|
479 |
+
break;
|
480 |
+
|
481 |
+
default:
|
482 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
483 |
+
|
484 |
+
if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) {
|
485 |
+
$customerBilling = $billing->exportCustomerAddress();
|
486 |
+
$customer->addAddress($customerBilling);
|
487 |
+
}
|
488 |
+
if (!$this->getQuote()->isVirtual() &&
|
489 |
+
((!$shipping->getCustomerId() && !$shipping->getSameAsBilling()) ||
|
490 |
+
(!$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook()))) {
|
491 |
+
|
492 |
+
$customerShipping = $shipping->exportCustomerAddress();
|
493 |
+
$customer->addAddress($customerShipping);
|
494 |
+
}
|
495 |
+
$customer->setSavedFromQuote(true);
|
496 |
+
$customer->save();
|
497 |
+
|
498 |
+
$changed = false;
|
499 |
+
if (isset($customerBilling) && !$customer->getDefaultBilling()) {
|
500 |
+
$customer->setDefaultBilling($customerBilling->getId());
|
501 |
+
$changed = true;
|
502 |
+
}
|
503 |
+
if (!$this->getQuote()->isVirtual() && isset($customerBilling) && !$customer->getDefaultShipping() && $shipping->getSameAsBilling()) {
|
504 |
+
$customer->setDefaultShipping($customerBilling->getId());
|
505 |
+
$changed = true;
|
506 |
+
} elseif (!$this->getQuote()->isVirtual() && isset($customerShipping) && !$customer->getDefaultShipping()) {
|
507 |
+
$customer->setDefaultShipping($customerShipping->getId());
|
508 |
+
$changed = true;
|
509 |
+
}
|
510 |
+
|
511 |
+
if ($changed) {
|
512 |
+
$customer->save();
|
513 |
+
}
|
514 |
+
}
|
515 |
+
|
516 |
+
$this->getQuote()->reserveOrderId();
|
517 |
+
$convertQuote = Mage::getModel('sales/convert_quote');
|
518 |
+
/* @var $convertQuote Mage_Sales_Model_Convert_Quote */
|
519 |
+
//$order = Mage::getModel('sales/order');
|
520 |
+
if ($this->getQuote()->isVirtual()) {
|
521 |
+
$order = $convertQuote->addressToOrder($billing);
|
522 |
+
} else {
|
523 |
+
$order = $convertQuote->addressToOrder($shipping);
|
524 |
+
}
|
525 |
+
/* @var $order Mage_Sales_Model_Order */
|
526 |
+
$order->setBillingAddress($convertQuote->addressToOrderAddress($billing));
|
527 |
+
|
528 |
+
if (!$this->getQuote()->isVirtual()) {
|
529 |
+
$order->setShippingAddress($convertQuote->addressToOrderAddress($shipping));
|
530 |
+
}
|
531 |
+
|
532 |
+
$order->setPayment($convertQuote->paymentToOrderPayment($this->getQuote()->getPayment()));
|
533 |
+
|
534 |
+
foreach ($this->getQuote()->getAllItems() as $item) {
|
535 |
+
$orderItem = $convertQuote->itemToOrderItem($item);
|
536 |
+
if ($item->getParentItem()) {
|
537 |
+
$orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId()));
|
538 |
+
}
|
539 |
+
$order->addItem($orderItem);
|
540 |
+
}
|
541 |
+
|
542 |
+
/**
|
543 |
+
* We can use configuration data for declare new order status
|
544 |
+
*/
|
545 |
+
Mage::dispatchEvent('checkout_type_onepage_save_order', array('order' => $order, 'quote' => $this->getQuote()));
|
546 |
+
// check again, if customer exists
|
547 |
+
if ($this->getQuote()->getCheckoutMethod() == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER) {
|
548 |
+
if ($this->_customerEmailExists($customer->getEmail(), Mage::app()->getWebsite()->getId())) {
|
549 |
+
Mage::throwException(Mage::helper('checkout')->__('There is already a customer registered using this email address'));
|
550 |
+
}
|
551 |
+
}
|
552 |
+
$order->place();
|
553 |
+
|
554 |
+
if ($this->getQuote()->getCheckoutMethod() == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER) {
|
555 |
+
$customer->save();
|
556 |
+
$customerBillingId = $customerBilling->getId();
|
557 |
+
if (!$this->getQuote()->isVirtual()) {
|
558 |
+
$customerShippingId = isset($customerShipping) ? $customerShipping->getId() : $customerBillingId;
|
559 |
+
$customer->setDefaultShipping($customerShippingId);
|
560 |
+
}
|
561 |
+
$customer->setDefaultBilling($customerBillingId);
|
562 |
+
$customer->save();
|
563 |
+
|
564 |
+
$this->getQuote()->setCustomerId($customer->getId());
|
565 |
+
|
566 |
+
$order->setCustomerId($customer->getId());
|
567 |
+
Mage::helper('core')->copyFieldset('customer_account', 'to_order', $customer, $order);
|
568 |
+
|
569 |
+
$billing->setCustomerId($customer->getId())->setCustomerAddressId($customerBillingId);
|
570 |
+
if (!$this->getQuote()->isVirtual()) {
|
571 |
+
$shipping->setCustomerId($customer->getId())->setCustomerAddressId($customerShippingId);
|
572 |
+
}
|
573 |
+
|
574 |
+
if ($customer->isConfirmationRequired()) {
|
575 |
+
$customer->sendNewAccountEmail('confirmation');
|
576 |
+
} else {
|
577 |
+
$customer->sendNewAccountEmail();
|
578 |
+
}
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* a flag to set that there will be redirect to third party after confirmation
|
583 |
+
* eg: paypal standard ipn
|
584 |
+
*/
|
585 |
+
$version = Mage::getVersion();
|
586 |
+
$redirectUrl = $this->getQuote()->getPayment()->getOrderPlaceRedirectUrl();
|
587 |
+
$order->save();
|
588 |
+
if (!$redirectUrl) {
|
589 |
+
if ($version == '1.8.1.0') {
|
590 |
+
$order->sendNewOrderEmail();
|
591 |
+
$order->setEmailSent(true);
|
592 |
+
} else {
|
593 |
+
$order->setEmailSent(true);
|
594 |
+
}
|
595 |
+
}
|
596 |
+
|
597 |
+
Mage::dispatchEvent('checkout_type_onepage_save_order_after', array('order' => $order, 'quote' => $this->getQuote()));
|
598 |
+
|
599 |
+
/**
|
600 |
+
* need to have somelogic to set order as new status to make sure order is not finished yet
|
601 |
+
* quote will be still active when we send the customer to paypal
|
602 |
+
*/
|
603 |
+
$this->getCheckout()->setLastQuoteId($this->getQuote()->getId());
|
604 |
+
$this->getCheckout()->setLastOrderId($order->getId());
|
605 |
+
$this->getCheckout()->setLastRealOrderId($order->getIncrementId());
|
606 |
+
$this->getCheckout()->setRedirectUrl($redirectUrl);
|
607 |
+
|
608 |
+
/**
|
609 |
+
* we only want to send to customer about new order when there is no redirect to third party
|
610 |
+
*/
|
611 |
+
if (!$redirectUrl) {
|
612 |
+
try {
|
613 |
+
$order->sendNewOrderEmail();
|
614 |
+
} catch (Exception $e) {
|
615 |
+
Mage::logException($e);
|
616 |
+
}
|
617 |
+
}
|
618 |
+
if ($this->getQuote()->getCheckoutMethod(true) == Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER
|
619 |
+
&& !Mage::getSingleton('customer/session')->isLoggedIn()) {
|
620 |
+
/**
|
621 |
+
* we need to save quote here to have it saved with Customer Id.
|
622 |
+
* so when loginById() executes checkout/session method loadCustomerQuote
|
623 |
+
* it would not create new quotes and merge it with old one.
|
624 |
+
*/
|
625 |
+
$this->getQuote()->save();
|
626 |
+
if ($customer->isConfirmationRequired()) {
|
627 |
+
Mage::getSingleton('checkout/session')->addSuccess(Mage::helper('customer')->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%s">click here</a>.', Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail())
|
628 |
+
));
|
629 |
+
} else {
|
630 |
+
Mage::getSingleton('customer/session')->loginById($customer->getId());
|
631 |
+
}
|
632 |
+
}
|
633 |
+
|
634 |
+
//Setting this one more time like control flag that we haves saved order
|
635 |
+
//Must be checkout on success page to show it or not.
|
636 |
+
$this->getCheckout()->setLastSuccessQuoteId($this->getQuote()->getId());
|
637 |
+
|
638 |
+
$this->getQuote()->setIsActive(false);
|
639 |
+
$this->getQuote()->save();
|
640 |
+
|
641 |
+
return $this;
|
642 |
+
}
|
643 |
+
|
644 |
+
/**
|
645 |
+
* Enter description here...
|
646 |
+
*
|
647 |
+
* @return string
|
648 |
+
*/
|
649 |
+
public function getLastOrderId() {
|
650 |
+
/*
|
651 |
+
$customerSession = Mage::getSingleton('customer/session');
|
652 |
+
if (!$customerSession->isLoggedIn()) {
|
653 |
+
$this->_redirect('checkout/cart');
|
654 |
+
return;
|
655 |
+
}
|
656 |
+
$collection = Mage::getResourceModel('sales/order_collection')
|
657 |
+
->addAttributeSelect('self/real_order_id')
|
658 |
+
->addAttributeFilter('self/customer_id', $customerSession->getCustomerId())
|
659 |
+
->setOrder('self/created_at', 'DESC')
|
660 |
+
->setPageSize(1)
|
661 |
+
->loadData();
|
662 |
+
foreach ($collection as $order) {
|
663 |
+
$orderId = $order->getRealOrderId();
|
664 |
+
}
|
665 |
+
*/
|
666 |
+
$order = Mage::getModel('sales/order');
|
667 |
+
$order->load($this->getCheckout()->getLastOrderId());
|
668 |
+
$orderId = $order->getIncrementId();
|
669 |
+
return $orderId;
|
670 |
+
}
|
671 |
+
|
672 |
+
public function saveShippingStep($sdata, $customerAddressId) {
|
673 |
+
if (empty($sdata)) {
|
674 |
+
$res = array(
|
675 |
+
'error' => -1,
|
676 |
+
'message' => Mage::helper('checkout')->__('Invalid data')
|
677 |
+
);
|
678 |
+
return $res;
|
679 |
+
}
|
680 |
+
$address = $this->getQuote()->getShippingAddress();
|
681 |
+
if (!empty($customerAddressId)) {
|
682 |
+
$customerAddress = Mage::getModel('customer/address')->load($customerAddressId);
|
683 |
+
if ($customerAddress->getId()) {
|
684 |
+
if ($customerAddress->getCustomerId() != $this->getQuote()->getCustomerId()) {
|
685 |
+
return array('error' => 1,
|
686 |
+
'message' => Mage::helper('checkout')->__('Customer Address is not valid.')
|
687 |
+
);
|
688 |
+
}
|
689 |
+
$address->importCustomerAddress($customerAddress);
|
690 |
+
}
|
691 |
+
} else {
|
692 |
+
unset($sdata['address_id']);
|
693 |
+
$address->addData($sdata);
|
694 |
+
}
|
695 |
+
$address->implodeStreetAddress();
|
696 |
+
$address->setCollectShippingRates(true);
|
697 |
+
$this->getQuote()->collectTotals()->save();
|
698 |
+
|
699 |
+
$this->getCheckout()
|
700 |
+
->setStepData('shipping', 'complete', true)
|
701 |
+
->setStepData('shipping_method', 'allow', true);
|
702 |
+
|
703 |
+
return array();
|
704 |
+
}
|
705 |
+
|
706 |
+
}
|
app/code/community/Mageguru/Onestepcheckout/controllers/OnepageController.php
ADDED
@@ -0,0 +1,624 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
require_once 'Mage/Checkout/controllers/OnepageController.php';
|
5 |
+
|
6 |
+
class Mageguru_Onestepcheckout_OnepageController extends Mage_Checkout_OnepageController {
|
7 |
+
|
8 |
+
protected $_sectionUpdateFunctions = array(
|
9 |
+
'payment-method' => '_getPaymentMethodsHtml',
|
10 |
+
'shipping-method' => '_getShippingMethodsHtml',
|
11 |
+
'review' => '_getReviewHtml',
|
12 |
+
);
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return Mage_Checkout_OnepageController
|
16 |
+
*/
|
17 |
+
public function successAction() {
|
18 |
+
$this->_redirect('checkout/onepage/success');
|
19 |
+
}
|
20 |
+
|
21 |
+
public function failureAction() {
|
22 |
+
$this->_redirect('checkout/onepage/failure');
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function _expireAjax() {
|
26 |
+
if (!$this->getOnepage()->getQuote()->hasItems()) {
|
27 |
+
return array('redirect' => Mage::getUrl('checkout/onepage'));
|
28 |
+
}
|
29 |
+
if (!$this->getOnepage()->getQuote()->hasItems()
|
30 |
+
|| $this->getOnepage()->getQuote()->getHasError()
|
31 |
+
|| $this->getOnepage()->getQuote()->getIsMultiShipping()) {
|
32 |
+
$this->_ajaxRedirectResponse();
|
33 |
+
exit;
|
34 |
+
}
|
35 |
+
$action = $this->getRequest()->getActionName();
|
36 |
+
if (Mage::getSingleton('checkout/session')->getCartWasUpdated(true)
|
37 |
+
&& !in_array($action, array('index', 'progress', 'saveBillingStep', 'saveShippingStep', 'paymentmethod', 'saveOrderCustom', 'saveShippingMethod'))) {
|
38 |
+
$this->_ajaxRedirectResponse();
|
39 |
+
exit;
|
40 |
+
}
|
41 |
+
Mage::getSingleton('core/translate_inline')->setIsAjaxRequest(true);
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function _getShippingMethodsHtml() {
|
45 |
+
$layout = $this->getLayout();
|
46 |
+
$update = $layout->getUpdate();
|
47 |
+
$update->load('onestepcheckout_onepage_shippingmethod');
|
48 |
+
$layout->generateXml();
|
49 |
+
$layout->generateBlocks();
|
50 |
+
$output = $layout->getOutput();
|
51 |
+
return $output;
|
52 |
+
}
|
53 |
+
|
54 |
+
protected function _getPaymentMethodsHtml() {
|
55 |
+
$layout = $this->getLayout();
|
56 |
+
$update = $layout->getUpdate();
|
57 |
+
$update->load('onestepcheckout_onepage_paymentmethod');
|
58 |
+
$layout->generateXml();
|
59 |
+
$layout->generateBlocks();
|
60 |
+
$output = $layout->getOutput();
|
61 |
+
return $output;
|
62 |
+
}
|
63 |
+
|
64 |
+
protected function _getAdditionalHtml() {
|
65 |
+
$layout = $this->getLayout();
|
66 |
+
$update = $layout->getUpdate();
|
67 |
+
$update->load('onestepcheckout_onepage_additional');
|
68 |
+
$layout->generateXml();
|
69 |
+
$layout->generateBlocks();
|
70 |
+
$output = $layout->getOutput();
|
71 |
+
return $output;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Enter description here...
|
76 |
+
*
|
77 |
+
* @return Mage_Checkout_Model_Type_Onepage
|
78 |
+
*/
|
79 |
+
public function getOnepage() {
|
80 |
+
return Mage::getSingleton('onestepcheckout/type_onepage');
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Checkout page
|
85 |
+
*/
|
86 |
+
public function indexAction() {
|
87 |
+
$this->_redirect('checkout/onepage');
|
88 |
+
}
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Address JSON
|
92 |
+
*/
|
93 |
+
public function getAddressAction() {
|
94 |
+
$this->_expireAjax();
|
95 |
+
$addressId = $this->getRequest()->getParam('address', false);
|
96 |
+
if ($addressId) {
|
97 |
+
$address = $this->getOnepage()->getAddress($addressId);
|
98 |
+
$this->getResponse()->setHeader('Content-type', 'application/x-json');
|
99 |
+
$this->getResponse()->setBody($address->toJson());
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
public function saveMethodAction() {
|
104 |
+
$this->_expireAjax();
|
105 |
+
if ($this->getRequest()->isPost()) {
|
106 |
+
$method = $this->getRequest()->getPost('method');
|
107 |
+
$result = $this->getOnepage()->saveCheckoutMethod($method);
|
108 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* save checkout billing address
|
114 |
+
*/
|
115 |
+
public function saveBillingAction() {
|
116 |
+
$this->_expireAjax();
|
117 |
+
if ($this->getRequest()->isPost()) {
|
118 |
+
$data = $this->getRequest()->getPost('billing', array());
|
119 |
+
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
|
120 |
+
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);
|
121 |
+
|
122 |
+
if (!isset($result['error'])) {
|
123 |
+
/* check quote for virtual */
|
124 |
+
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
125 |
+
$result['goto_section'] = 'payment';
|
126 |
+
$result['update_section'] = array(
|
127 |
+
'name' => 'payment-method',
|
128 |
+
'html' => $this->_getPaymentMethodsHtml()
|
129 |
+
);
|
130 |
+
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
|
131 |
+
|
132 |
+
$result['goto_section'] = 'shipping_method';
|
133 |
+
|
134 |
+
$result['update_section'] = array(
|
135 |
+
'name' => 'shipping-method',
|
136 |
+
'html' => $this->_getShippingMethodsHtml()
|
137 |
+
);
|
138 |
+
|
139 |
+
$result['allow_sections'] = array('shipping');
|
140 |
+
$result['duplicateBillingInfo'] = 'true';
|
141 |
+
} else {
|
142 |
+
$result['goto_section'] = 'shipping';
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
+
public function saveBillingStepAction() {
|
151 |
+
if ($resError = $this->_expireAjax()) {
|
152 |
+
$this->getResponse()->setBody(Zend_Json::encode($resError));
|
153 |
+
return;
|
154 |
+
}
|
155 |
+
if ($this->getRequest()->isPost()) {
|
156 |
+
$data = $this->getRequest()->getPost('billing', array());
|
157 |
+
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);
|
158 |
+
$result = $this->getOnepage()->saveBillingStep($data, $customerAddressId);
|
159 |
+
|
160 |
+
if (!isset($result['error'])) {
|
161 |
+
/* check quote for virtual */
|
162 |
+
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
163 |
+
$result['goto_section'] = 'payment';
|
164 |
+
$result['update_section'] = array(
|
165 |
+
'name' => 'payment-method',
|
166 |
+
'html' => $this->_getPaymentMethodsHtml()
|
167 |
+
);
|
168 |
+
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
|
169 |
+
|
170 |
+
$result['goto_section'] = 'shipping_method';
|
171 |
+
|
172 |
+
$result['update_section'] = array(
|
173 |
+
'name' => 'shipping-method',
|
174 |
+
'html' => $this->_getShippingMethodsHtml()
|
175 |
+
);
|
176 |
+
|
177 |
+
$result['allow_sections'] = array('shipping');
|
178 |
+
$result['duplicateBillingInfo'] = 'true';
|
179 |
+
} else {
|
180 |
+
$result['goto_section'] = 'shipping';
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
public function saveShippingAction() {
|
189 |
+
$this->_expireAjax();
|
190 |
+
if ($this->getRequest()->isPost()) {
|
191 |
+
$data = $this->getRequest()->getPost('shipping', array());
|
192 |
+
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
|
193 |
+
$result = $this->getOnepage()->saveShipping($data, $customerAddressId);
|
194 |
+
|
195 |
+
if (!isset($result['error'])) {
|
196 |
+
$result['goto_section'] = 'shipping_method';
|
197 |
+
$result['update_section'] = array(
|
198 |
+
'name' => 'shipping-method',
|
199 |
+
'html' => $this->_getShippingMethodsHtml()
|
200 |
+
);
|
201 |
+
}
|
202 |
+
|
203 |
+
// $this->loadLayout('checkout_onepage_shippingMethod');
|
204 |
+
// $result['shipping_methods_html'] = $this->getLayout()->getBlock('root')->toHtml();
|
205 |
+
// $result['shipping_methods_html'] = $this->_getShippingMethodsHtml();
|
206 |
+
|
207 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
public function saveShippingMethodAction() {
|
212 |
+
if ($resError = $this->_expireAjax()) {
|
213 |
+
$this->getResponse()->setBody(Zend_Json::encode($resError));
|
214 |
+
return;
|
215 |
+
}
|
216 |
+
if ($this->getRequest()->isPost()) {
|
217 |
+
$data = $this->getRequest()->getPost('shipping_method', '');
|
218 |
+
$result = $this->getOnepage()->saveShippingMethod($data);
|
219 |
+
/*
|
220 |
+
$result will have erro data if shipping method is empty
|
221 |
+
*/
|
222 |
+
if (!$result) {
|
223 |
+
Mage::dispatchEvent('onestepcheckout_controller_onepage_save_shipping_method', array('request' => $this->getRequest(), 'quote' => $this->getOnepage()->getQuote()));
|
224 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
225 |
+
|
226 |
+
$result['goto_section'] = 'payment';
|
227 |
+
$result['update_section'] = array(
|
228 |
+
'name' => 'payment-method',
|
229 |
+
'html' => $this->_getPaymentMethodsHtml()
|
230 |
+
);
|
231 |
+
|
232 |
+
// $result['payment_methods_html'] = $this->_getPaymentMethodsHtml();
|
233 |
+
}
|
234 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
public function paymentmethodAction() {
|
239 |
+
if ($resError = $this->_expireAjax()) {
|
240 |
+
$this->getResponse()->setBody(Zend_Json::encode($resError));
|
241 |
+
return;
|
242 |
+
}
|
243 |
+
$result = array();
|
244 |
+
// saving payment to quote
|
245 |
+
try {
|
246 |
+
$data = $this->getRequest()->getPost('payment', array());
|
247 |
+
if (!empty($data)) {
|
248 |
+
if ($this->getOnepage()->getQuote()->isVirtual()) {
|
249 |
+
$this->getOnepage()->getQuote()->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
250 |
+
} else {
|
251 |
+
$this->getOnepage()->getQuote()->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
|
252 |
+
}
|
253 |
+
$payment = $this->getOnepage()->getQuote()->getPayment()->setMethod($data['method']);
|
254 |
+
$this->getOnepage()->getQuote()->save();
|
255 |
+
}
|
256 |
+
} catch (Exception $e) {
|
257 |
+
$result['error'] = true;
|
258 |
+
}
|
259 |
+
$result['method'] = $this->getOnepage()->getQuote()->getPayment()->getMethod();
|
260 |
+
$result['html'] = $this->_getPaymentMethodsHtml();
|
261 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
262 |
+
return;
|
263 |
+
}
|
264 |
+
|
265 |
+
public function savePaymentAction() {
|
266 |
+
$this->_expireAjax();
|
267 |
+
if ($this->getRequest()->isPost()) {
|
268 |
+
$data = $this->getRequest()->getPost('payment', array());
|
269 |
+
/*
|
270 |
+
* first to check payment information entered is correct or not
|
271 |
+
*/
|
272 |
+
|
273 |
+
try {
|
274 |
+
$result = $this->getOnepage()->savePayment($data);
|
275 |
+
} catch (Mage_Payment_Exception $e) {
|
276 |
+
if ($e->getFields()) {
|
277 |
+
$result['fields'] = $e->getFields();
|
278 |
+
}
|
279 |
+
$result['error'] = $e->getMessage();
|
280 |
+
} catch (Exception $e) {
|
281 |
+
$result['error'] = $e->getMessage();
|
282 |
+
}
|
283 |
+
$redirectUrl = $this->getOnePage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
|
284 |
+
if (empty($result['error']) && !$redirectUrl) {
|
285 |
+
$this->loadLayout('onestepcheckout_onepage_review');
|
286 |
+
|
287 |
+
$result['goto_section'] = 'review';
|
288 |
+
$result['update_section'] = array(
|
289 |
+
'name' => 'review',
|
290 |
+
'html' => $this->_getReviewHtml()
|
291 |
+
);
|
292 |
+
|
293 |
+
// $result['review_html'] = $this->getLayout()->getBlock('root')->toHtml();
|
294 |
+
}
|
295 |
+
|
296 |
+
if ($redirectUrl) {
|
297 |
+
$result['redirect'] = $redirectUrl;
|
298 |
+
}
|
299 |
+
|
300 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
public function saveShippingStepAction() {
|
305 |
+
if ($resError = $this->_expireAjax()) {
|
306 |
+
$this->getResponse()->setBody(Zend_Json::encode($resError));
|
307 |
+
return;
|
308 |
+
}
|
309 |
+
if ($this->getRequest()->isPost()) {
|
310 |
+
$bdata = $this->getRequest()->getPost('billing', array());
|
311 |
+
$sdata = $this->getRequest()->getPost('shipping', array());
|
312 |
+
$customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
|
313 |
+
$result = $this->getOnepage()->saveShippingStep($sdata, $customerAddressId);
|
314 |
+
|
315 |
+
if (!isset($result['error'])) {
|
316 |
+
$result['goto_section'] = 'shipping_method';
|
317 |
+
$result['update_section'] = array(
|
318 |
+
'name' => 'shipping-method',
|
319 |
+
'html' => $this->_getShippingMethodsHtml()
|
320 |
+
);
|
321 |
+
}
|
322 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
public function saveOrderCustomAction() {
|
327 |
+
if ($this->getRequest()->getParam('submitCustomCheckout')) {
|
328 |
+
if ($resError = $this->_expireAjax()) {
|
329 |
+
$this->getResponse()->setBody(Zend_Json::encode($resError));
|
330 |
+
return;
|
331 |
+
}
|
332 |
+
$opCheckoutOrderComment = $this->getRequest()->getParam('order_comment');
|
333 |
+
$deliverydate = $this->getRequest()->getParam('shipping_arrival_date');
|
334 |
+
$giftmessage = $this->getRequest()->getParam('giftmessage');
|
335 |
+
$billingAddress = $this->getRequest()->getParam('billing');
|
336 |
+
$shippingAddress = $this->getRequest()->getParam('shipping');
|
337 |
+
$paymentMethod = $this->getRequest()->getParam('payment');
|
338 |
+
$shippingMethod = $this->getRequest()->getParam('shipping_method');
|
339 |
+
$checkout = Mage::getSingleton('checkout/type_onepage');
|
340 |
+
$login = $this->getRequest()->getParam('create_account');
|
341 |
+
//$login=false;
|
342 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
343 |
+
$res = $checkout->saveCheckoutMethod(Mage_Sales_Model_Quote::CHECKOUT_METHOD_LOGIN_IN);
|
344 |
+
$billingCustomerAddressId = $this->getRequest()->getParam('billing_address_id');
|
345 |
+
$shippingCustomerAddressId = $this->getRequest()->getParam('shipping_address_id');
|
346 |
+
} else {
|
347 |
+
if ($login) {
|
348 |
+
$res = $checkout->saveCheckoutMethod(Mage_Sales_Model_Quote::CHECKOUT_METHOD_REGISTER);
|
349 |
+
$billingCustomerAddressId = false; //$billingAddress['address_id'];
|
350 |
+
$shippingCustomerAddressId = false; //$shippingAddress['address_id'];
|
351 |
+
} else {
|
352 |
+
$res = $checkout->saveCheckoutMethod(Mage_Sales_Model_Quote::CHECKOUT_METHOD_GUEST);
|
353 |
+
$billingCustomerAddressId = false;
|
354 |
+
$shippingCustomerAddressId = false;
|
355 |
+
}
|
356 |
+
}
|
357 |
+
|
358 |
+
try {
|
359 |
+
$billingRes = $checkout->saveBilling($billingAddress, $billingCustomerAddressId);
|
360 |
+
if (is_array($billingRes) && isset($billingRes['error'])) {
|
361 |
+
$result['success'] = false;
|
362 |
+
$result['error'] = true;
|
363 |
+
$result['error_messages'] = Mage::helper('checkout')->__($billingRes['message']);
|
364 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
365 |
+
return;
|
366 |
+
}
|
367 |
+
if (!$checkout->getQuote()->isVirtual()) {
|
368 |
+
$result['is_virtual'] = 0;
|
369 |
+
$shippingRes = $checkout->saveShipping($shippingAddress, $shippingCustomerAddressId);
|
370 |
+
if (is_array($shippingRes) && isset($shippingRes['error'])) {
|
371 |
+
$result['success'] = false;
|
372 |
+
$result['error'] = true;
|
373 |
+
|
374 |
+
$result['error_messages'] = Mage::helper('checkout')->__($shippingRes['message']);
|
375 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
376 |
+
return;
|
377 |
+
}
|
378 |
+
|
379 |
+
$shippingMethodRes = $checkout->saveShippingMethod($shippingMethod);
|
380 |
+
if (is_array($shippingMethodRes) && isset($shippingMethodRes['error'])) {
|
381 |
+
$result['success'] = false;
|
382 |
+
$result['error'] = true;
|
383 |
+
$result['error_messages'] = Mage::helper('checkout')->__($shippingMethodRes['message']);
|
384 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
385 |
+
return;
|
386 |
+
}
|
387 |
+
} else {
|
388 |
+
$result['is_virtual'] = 1;
|
389 |
+
}
|
390 |
+
$paymentRes = $checkout->savePayment($paymentMethod);
|
391 |
+
if (is_array($paymentRes) && isset($paymentRes['error'])) {
|
392 |
+
$result['success'] = false;
|
393 |
+
$result['error'] = true;
|
394 |
+
$result['error_messages'] = Mage::helper('checkout')->__($paymentRes['message']);
|
395 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
396 |
+
return;
|
397 |
+
}
|
398 |
+
} catch (Exception $e) {
|
399 |
+
$result['success'] = false;
|
400 |
+
$result['error'] = true;
|
401 |
+
$result['error_messages'] = Mage::helper('checkout')->__($e->getMessage());
|
402 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
403 |
+
return;
|
404 |
+
}
|
405 |
+
|
406 |
+
if ($paymentMethod['method'] && $paymentMethod['method'] == 'paypal_express' && (trim($opCheckoutOrderComment) != '')) {
|
407 |
+
Mage::getSingleton('checkout/session')->setOpcheckoutOrderComment($opCheckoutOrderComment);
|
408 |
+
}
|
409 |
+
if ($paymentMethod['method'] && $paymentMethod['method'] == 'paypal_express' && (trim($deliverydate) != '')) {
|
410 |
+
Mage::getSingleton('checkout/session')->setShippingArrivalDate($deliverydate);
|
411 |
+
}
|
412 |
+
if ($paymentMethod['method'] && $paymentMethod['method'] == 'paypal_express' && ($giftmessage) != '') {
|
413 |
+
Mage::getSingleton('checkout/session')->setData('opgiftmessage', $giftmessage);
|
414 |
+
}
|
415 |
+
// newsletter subscription
|
416 |
+
|
417 |
+
try {
|
418 |
+
if ($this->getRequest()->getParam('subscription_newsletter')) {
|
419 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
|
420 |
+
Mage::getSingleton('customer/session')->getCustomer()
|
421 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
422 |
+
->setIsSubscribed((boolean) $this->getRequest()->getParam('subscription_newsletter'))
|
423 |
+
->save();
|
424 |
+
} else {
|
425 |
+
$subscriber = Mage::getSingleton('newsletter/subscriber');
|
426 |
+
$subscriber->subscribe($billingAddress['email']);
|
427 |
+
}
|
428 |
+
}
|
429 |
+
} catch (Exception $e) {
|
430 |
+
Mage::log($e->getMessage());
|
431 |
+
}
|
432 |
+
//redirection to paypal express
|
433 |
+
$redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
|
434 |
+
if ($redirectUrl) {
|
435 |
+
$result['redirect'] = $redirectUrl;
|
436 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
437 |
+
return;
|
438 |
+
}
|
439 |
+
$result = array();
|
440 |
+
try {
|
441 |
+
if ($requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds()) {
|
442 |
+
$postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
|
443 |
+
if ($diff = array_diff($requiredAgreements, $postedAgreements)) {
|
444 |
+
$result['success'] = false;
|
445 |
+
$result['error'] = true;
|
446 |
+
$result['error_messages'] = $this->__('Please agree to all Terms and Conditions before placing the order.');
|
447 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
448 |
+
return;
|
449 |
+
}
|
450 |
+
}
|
451 |
+
if ($data = $this->getRequest()->getPost('payment', false)) {
|
452 |
+
$this->getOnepage()->getQuote()->getPayment()->importData($data);
|
453 |
+
}
|
454 |
+
$this->getOnepage()->saveOrder();
|
455 |
+
$redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
|
456 |
+
$result['success'] = true;
|
457 |
+
$result['error'] = false;
|
458 |
+
} catch (Mage_Core_Exception $e) {
|
459 |
+
Mage::logException($e);
|
460 |
+
Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
|
461 |
+
$result['success'] = false;
|
462 |
+
$result['error'] = true;
|
463 |
+
$result['error_messages'] = $e->getMessage();
|
464 |
+
|
465 |
+
if ($gotoSection = $this->getOnepage()->getCheckout()->getGotoSection()) {
|
466 |
+
$result['goto_section'] = $gotoSection;
|
467 |
+
$this->getOnepage()->getCheckout()->setGotoSection(null);
|
468 |
+
}
|
469 |
+
|
470 |
+
if ($updateSection = $this->getOnepage()->getCheckout()->getUpdateSection()) {
|
471 |
+
if (isset($this->_sectionUpdateFunctions[$updateSection])) {
|
472 |
+
$updateSectionFunction = $this->_sectionUpdateFunctions[$updateSection];
|
473 |
+
$result['update_section'] = array(
|
474 |
+
'name' => $updateSection,
|
475 |
+
'html' => $this->$updateSectionFunction()
|
476 |
+
);
|
477 |
+
}
|
478 |
+
$this->getOnepage()->getCheckout()->setUpdateSection(null);
|
479 |
+
}
|
480 |
+
|
481 |
+
$this->getOnepage()->getQuote()->save();
|
482 |
+
} catch (Exception $e) {
|
483 |
+
Mage::logException($e);
|
484 |
+
Mage::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
|
485 |
+
$result['success'] = false;
|
486 |
+
$result['error'] = true;
|
487 |
+
$result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
|
488 |
+
$this->getOnepage()->getQuote()->save();
|
489 |
+
}
|
490 |
+
|
491 |
+
/**
|
492 |
+
* when there is redirect to third party, we don't want to save order yet.
|
493 |
+
* we will save the order in return action.
|
494 |
+
*/
|
495 |
+
if (isset($redirectUrl)) {
|
496 |
+
$result['redirect'] = $redirectUrl;
|
497 |
+
}
|
498 |
+
|
499 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
500 |
+
return;
|
501 |
+
} else {
|
502 |
+
$this->_redirect('checkout/onepage/index');
|
503 |
+
}
|
504 |
+
}
|
505 |
+
|
506 |
+
public function ajaxloginAction() {
|
507 |
+
$username = $this->getRequest()->getPost('opcheckout_username', false);
|
508 |
+
$password = $this->getRequest()->getPost('opcheckout_password', false);
|
509 |
+
$session = Mage::getSingleton('customer/session');
|
510 |
+
$result = array(
|
511 |
+
'success' => false
|
512 |
+
);
|
513 |
+
if ($username && $password) {
|
514 |
+
try {
|
515 |
+
$session->login($username, $password);
|
516 |
+
} catch (Exception $e) {
|
517 |
+
$result['error'] = $e->getMessage();
|
518 |
+
}
|
519 |
+
if (!isset($result['error'])) {
|
520 |
+
$result['success'] = true;
|
521 |
+
}
|
522 |
+
} else {
|
523 |
+
$result['error'] = $this->__('Please enter a valid username and password.');
|
524 |
+
}
|
525 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
526 |
+
return;
|
527 |
+
}
|
528 |
+
|
529 |
+
public function ajaxforgotpasswordpostAction() {
|
530 |
+
$email = (string) $this->getRequest()->getPost('onestepcheckout_forgotpassword_email');
|
531 |
+
$result = array('success' => false);
|
532 |
+
if ($email) {
|
533 |
+
if (!Zend_Validate::is($email, 'EmailAddress')) {
|
534 |
+
$result['error'] = $this->__('Invalid email address.');
|
535 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
536 |
+
return;
|
537 |
+
}
|
538 |
+
|
539 |
+
/** @var $customer Mage_Customer_Model_Customer */
|
540 |
+
$customer = Mage::getModel('customer/customer')
|
541 |
+
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
|
542 |
+
->loadByEmail($email);
|
543 |
+
|
544 |
+
if ($customer->getId()) {
|
545 |
+
try {
|
546 |
+
$newResetPasswordLinkToken = Mage::helper('customer')->generateResetPasswordLinkToken();
|
547 |
+
$customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
|
548 |
+
$customer->sendPasswordResetConfirmationEmail();
|
549 |
+
} catch (Exception $exception) {
|
550 |
+
$result['error'] = $exception->getMessage();
|
551 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
552 |
+
return;
|
553 |
+
}
|
554 |
+
}
|
555 |
+
$result['success'] = true;
|
556 |
+
$result['message'] = Mage::helper('customer')->__('If there is an account associated with %s you will receive an email with a link to reset your password.', Mage::helper('customer')->htmlEscape($email));
|
557 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
558 |
+
return;
|
559 |
+
} else {
|
560 |
+
$result['error'] = $this->__('Please enter your email.');
|
561 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
562 |
+
return;
|
563 |
+
}
|
564 |
+
}
|
565 |
+
|
566 |
+
/*
|
567 |
+
* Discount Coupon Action..
|
568 |
+
*/
|
569 |
+
|
570 |
+
function couponAction() {
|
571 |
+
$quote = $this->_getOnepage()->getQuote();
|
572 |
+
$couponCode = (string) $this->getRequest()->getParam('code');
|
573 |
+
if ($this->getRequest()->getParam('remove') == 1) {
|
574 |
+
$couponCode = '';
|
575 |
+
}
|
576 |
+
$response = array(
|
577 |
+
'success' => false,
|
578 |
+
'error' => false,
|
579 |
+
'message' => false,
|
580 |
+
);
|
581 |
+
try {
|
582 |
+
$quote->getShippingAddress()->setCollectShippingRates(true);
|
583 |
+
$quote->setCouponCode(strlen($couponCode) ? $couponCode : '')
|
584 |
+
->collectTotals()
|
585 |
+
->save();
|
586 |
+
if ($couponCode) {
|
587 |
+
if ($couponCode == $quote->getCouponCode()) {
|
588 |
+
$response['success'] = true;
|
589 |
+
$response['message'] = $this->__('Coupon code "%s" was applied successfully.', Mage::helper('core')->htmlEscape($couponCode));
|
590 |
+
} else {
|
591 |
+
$response['success'] = false;
|
592 |
+
$response['error'] = true;
|
593 |
+
$response['message'] = $this->__('Coupon code "%s" is not valid.', Mage::helper('core')->htmlEscape($couponCode));
|
594 |
+
}
|
595 |
+
} else {
|
596 |
+
$response['success'] = true;
|
597 |
+
$response['message'] = $this->__('Coupon code was canceled successfully.');
|
598 |
+
}
|
599 |
+
} catch (Mage_Core_Exception $e) {
|
600 |
+
$response['success'] = false;
|
601 |
+
$response['error'] = true;
|
602 |
+
$response['message'] = $e->getMessage();
|
603 |
+
} catch (Exception $e) {
|
604 |
+
$response['success'] = false;
|
605 |
+
$response['error'] = true;
|
606 |
+
$response['message'] = $this->__('Can not apply coupon code.');
|
607 |
+
}
|
608 |
+
// $html = $this->getLayout()
|
609 |
+
// ->createBlock('opcheckout/onepage_shipping_method_available')
|
610 |
+
// ->setTemplate('opcheckout/onepage/shipping_method.phtml')
|
611 |
+
// ->toHtml();
|
612 |
+
// $response['shipping_method'] = $html;
|
613 |
+
$this->getResponse()->setBody(Zend_Json::encode($response));
|
614 |
+
}
|
615 |
+
|
616 |
+
protected function _getOnepage() {
|
617 |
+
return Mage::getSingleton('checkout/type_onepage');
|
618 |
+
}
|
619 |
+
|
620 |
+
protected function _canShowForUnregisteredUsers() {
|
621 |
+
return Mage::helper('onestepcheckout')->isActive();
|
622 |
+
}
|
623 |
+
|
624 |
+
}
|
app/code/community/Mageguru/Onestepcheckout/etc/config.xml
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mageguru_Onestepcheckout>
|
5 |
+
<version>0.1.3</version>
|
6 |
+
</Mageguru_Onestepcheckout>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<routers>
|
10 |
+
<onestepcheckout>
|
11 |
+
<use>standard</use>
|
12 |
+
<args>
|
13 |
+
<module>Mageguru_Onestepcheckout</module>
|
14 |
+
<frontName>onestepcheckout</frontName>
|
15 |
+
</args>
|
16 |
+
</onestepcheckout>
|
17 |
+
</routers>
|
18 |
+
<layout>
|
19 |
+
<updates>
|
20 |
+
<onestepcheckout>
|
21 |
+
<file>onestepcheckout.xml</file>
|
22 |
+
</onestepcheckout>
|
23 |
+
</updates>
|
24 |
+
</layout>
|
25 |
+
<events>
|
26 |
+
<checkout_type_onepage_save_order>
|
27 |
+
<observers>
|
28 |
+
<onestepcheckout_save_order_comment>
|
29 |
+
<type>helper</type>
|
30 |
+
<class>Mageguru_Onestepcheckout_Helper_Data</class>
|
31 |
+
<method>setOrderCommentCompatible1</method>
|
32 |
+
</onestepcheckout_save_order_comment>
|
33 |
+
</observers>
|
34 |
+
</checkout_type_onepage_save_order>
|
35 |
+
<checkout_type_onepage_save_order_after>
|
36 |
+
<observers>
|
37 |
+
<onestepcheckout_save_order_comment>
|
38 |
+
<type>helper</type>
|
39 |
+
<class>Mageguru_Onestepcheckout_Helper_Data</class>
|
40 |
+
<method>setOrderCommentCompatible2</method>
|
41 |
+
</onestepcheckout_save_order_comment>
|
42 |
+
</observers>
|
43 |
+
</checkout_type_onepage_save_order_after>
|
44 |
+
<sales_model_service_quote_submit_after>
|
45 |
+
<observers>
|
46 |
+
<onestepcheckout_service_quote_submit_order_comment>
|
47 |
+
<type>helper</type>
|
48 |
+
<class>Mageguru_Onestepcheckout_Helper_Data</class>
|
49 |
+
<method>setOrderCommentCompatible2</method>
|
50 |
+
</onestepcheckout_service_quote_submit_order_comment>
|
51 |
+
</observers>
|
52 |
+
</sales_model_service_quote_submit_after>
|
53 |
+
</events>
|
54 |
+
<translate>
|
55 |
+
<modules>
|
56 |
+
<onestepcheckout>
|
57 |
+
<files>
|
58 |
+
<default>Mageguru_Onestepcheckout.csv</default>
|
59 |
+
</files>
|
60 |
+
</onestepcheckout>
|
61 |
+
</modules>
|
62 |
+
</translate>
|
63 |
+
</frontend>
|
64 |
+
<adminhtml>
|
65 |
+
<acl>
|
66 |
+
<resources>
|
67 |
+
<all>
|
68 |
+
<title>Allow Everything</title>
|
69 |
+
</all>
|
70 |
+
<admin>
|
71 |
+
<children>
|
72 |
+
<onestepcheckout>
|
73 |
+
<title>Onestepcheckout Module</title>
|
74 |
+
<sort_order>10</sort_order>
|
75 |
+
</onestepcheckout>
|
76 |
+
<system>
|
77 |
+
<children>
|
78 |
+
<config>
|
79 |
+
<children>
|
80 |
+
<onestepcheckout>
|
81 |
+
<title>OnestepCheckout</title>
|
82 |
+
</onestepcheckout>
|
83 |
+
</children>
|
84 |
+
</config>
|
85 |
+
</children>
|
86 |
+
</system>
|
87 |
+
</children>
|
88 |
+
</admin>
|
89 |
+
</resources>
|
90 |
+
</acl>
|
91 |
+
</adminhtml>
|
92 |
+
<global>
|
93 |
+
<blocks>
|
94 |
+
<onestepcheckout>
|
95 |
+
<class>Mageguru_Onestepcheckout_Block</class>
|
96 |
+
</onestepcheckout>
|
97 |
+
<adminhtml>
|
98 |
+
<rewrite>
|
99 |
+
<sales_order_view_items>Mageguru_Onestepcheckout_Block_Adminhtml_Sales_Order_View_Opcheckoutcomment</sales_order_view_items>
|
100 |
+
</rewrite>
|
101 |
+
</adminhtml>
|
102 |
+
<sales>
|
103 |
+
<rewrite>
|
104 |
+
<order_view>Mageguru_Onestepcheckout_Block_Sales_Order_View</order_view>
|
105 |
+
</rewrite>
|
106 |
+
</sales>
|
107 |
+
</blocks>
|
108 |
+
<models>
|
109 |
+
<onestepcheckout>
|
110 |
+
<class>Mageguru_Onestepcheckout_Model</class>
|
111 |
+
</onestepcheckout>
|
112 |
+
<paypal>
|
113 |
+
<rewrite>
|
114 |
+
<api_nvp>Mageguru_Onestepcheckout_Model_Paypal_Api_Nvp</api_nvp>
|
115 |
+
</rewrite>
|
116 |
+
</paypal>
|
117 |
+
</models>
|
118 |
+
<helpers>
|
119 |
+
<onestepcheckout>
|
120 |
+
<class>Mageguru_Onestepcheckout_Helper</class>
|
121 |
+
</onestepcheckout>
|
122 |
+
</helpers>
|
123 |
+
<resources>
|
124 |
+
<onestepcheckout_setup>
|
125 |
+
<setup>
|
126 |
+
<module>Mageguru_Onestepcheckout</module>
|
127 |
+
</setup>
|
128 |
+
<connection>
|
129 |
+
<use>core_setup</use>
|
130 |
+
</connection>
|
131 |
+
</onestepcheckout_setup>
|
132 |
+
<onestepcheckout_write>
|
133 |
+
<connection>
|
134 |
+
<use>core_write</use>
|
135 |
+
</connection>
|
136 |
+
</onestepcheckout_write>
|
137 |
+
<onestepcheckout_read>
|
138 |
+
<connection>
|
139 |
+
<use>core_read</use>
|
140 |
+
</connection>
|
141 |
+
</onestepcheckout_read>
|
142 |
+
</resources>
|
143 |
+
</global>
|
144 |
+
<default>
|
145 |
+
<onestepcheckout>
|
146 |
+
<general>
|
147 |
+
<enabled>0</enabled>
|
148 |
+
</general>
|
149 |
+
<order>
|
150 |
+
<onestepcheckout_title>Welcome to One Step Checkout</onestepcheckout_title>
|
151 |
+
<onestepcheckout_desc>Complete your order in one step by entering your details below.</onestepcheckout_desc>
|
152 |
+
<onestepcheckout_newsletter_subscribe>1</onestepcheckout_newsletter_subscribe>
|
153 |
+
<newsletter_checked_bydefault>1</newsletter_checked_bydefault>
|
154 |
+
<onestepcheckout_order_comment>1</onestepcheckout_order_comment>
|
155 |
+
<onestepcheckout_order_comment_length>150</onestepcheckout_order_comment_length>
|
156 |
+
<enable_cart_link>1</enable_cart_link>
|
157 |
+
</order>
|
158 |
+
<billing_fields_setting>
|
159 |
+
<telephone>1</telephone>
|
160 |
+
</billing_fields_setting>
|
161 |
+
<shipping_fields_setting>
|
162 |
+
<telephone>1</telephone>
|
163 |
+
</shipping_fields_setting>
|
164 |
+
</onestepcheckout>
|
165 |
+
</default>
|
166 |
+
</config>
|
app/code/community/Mageguru/Onestepcheckout/etc/system.xml
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<mageguru_extensions translate="label">
|
5 |
+
<label>Mageguru</label>
|
6 |
+
<sort_order>120</sort_order>
|
7 |
+
</mageguru_extensions>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<onestepcheckout>
|
11 |
+
<label>One Step Checkout</label>
|
12 |
+
<tab>mageguru_extensions</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>306</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<general translate="label">
|
20 |
+
<label>General</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<enabled translate="label">
|
28 |
+
<label>Enabled</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</enabled>
|
36 |
+
</fields>
|
37 |
+
</general>
|
38 |
+
<order translate="label">
|
39 |
+
<label>Order</label>
|
40 |
+
<frontend_type>text</frontend_type>
|
41 |
+
<sort_order>2</sort_order>
|
42 |
+
<show_in_default>1</show_in_default>
|
43 |
+
<show_in_website>1</show_in_website>
|
44 |
+
<show_in_store>1</show_in_store>
|
45 |
+
<fields>
|
46 |
+
<onestepcheckout_title translate="label">
|
47 |
+
<label>Title for Checkout Page</label>
|
48 |
+
<frontend_type>text</frontend_type>
|
49 |
+
<sort_order>0</sort_order>
|
50 |
+
<show_in_default>1</show_in_default>
|
51 |
+
<show_in_website>1</show_in_website>
|
52 |
+
<show_in_store>1</show_in_store>
|
53 |
+
</onestepcheckout_title>
|
54 |
+
<onestepcheckout_desc translate="label">
|
55 |
+
<label>Description</label>
|
56 |
+
<frontend_type>textarea</frontend_type>
|
57 |
+
<sort_order>1</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</onestepcheckout_desc>
|
62 |
+
<onestepcheckout_newsletter_subscribe translate="label">
|
63 |
+
<label>Enable Newsletter Subscription Checkbox</label>
|
64 |
+
<frontend_type>select</frontend_type>
|
65 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
66 |
+
<sort_order>2</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
</onestepcheckout_newsletter_subscribe>
|
71 |
+
<newsletter_checked_bydefault translate="label">
|
72 |
+
<label>Newsletter subscription checkbox checked by default</label>
|
73 |
+
<frontend_type>select</frontend_type>
|
74 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
75 |
+
<sort_order>3</sort_order>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>1</show_in_website>
|
78 |
+
<show_in_store>1</show_in_store>
|
79 |
+
</newsletter_checked_bydefault>
|
80 |
+
<onestepcheckout_order_comment translate="label">
|
81 |
+
<label>Checkout Order Comment</label>
|
82 |
+
<frontend_type>select</frontend_type>
|
83 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
84 |
+
<sort_order>4</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
</onestepcheckout_order_comment>
|
89 |
+
<onestepcheckout_order_comment_length translate="label">
|
90 |
+
<label>Comment Length</label>
|
91 |
+
<frontend_type>text</frontend_type>
|
92 |
+
<sort_order>5</sort_order>
|
93 |
+
<show_in_default>1</show_in_default>
|
94 |
+
<show_in_website>1</show_in_website>
|
95 |
+
<show_in_store>1</show_in_store>
|
96 |
+
<comment><![CDATA[Character.]]></comment>
|
97 |
+
</onestepcheckout_order_comment_length>
|
98 |
+
</fields>
|
99 |
+
</order>
|
100 |
+
</groups>
|
101 |
+
</onestepcheckout>
|
102 |
+
</sections>
|
103 |
+
</config>
|
app/code/community/Mageguru/Onestepcheckout/sql/onestepcheckout_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$compatible = Mage::helper('onestepcheckout')->getCompatibility();
|
7 |
+
if ($compatible == 1) {
|
8 |
+
$table = $this->getTable('sales_flat_order');
|
9 |
+
} else {
|
10 |
+
$table = $this->getTable('sales_order');
|
11 |
+
}
|
12 |
+
$query = 'ALTER TABLE `' . $table . '` ADD COLUMN `order_comment` TEXT CHARACTER SET utf8 DEFAULT NULL';
|
13 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
14 |
+
$connection->query($query);
|
15 |
+
|
16 |
+
$installer->endSetup();
|
17 |
+
|
app/code/community/Mageguru/Onestepcheckout/sql/onestepcheckout_setup/mysql4-upgrade-0.1.0-0.1.1.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
$installer->startSetup();
|
5 |
+
|
6 |
+
$compatible = Mage::helper('onestepcheckout')->getCompatibility();
|
7 |
+
if ($compatible == 1) {
|
8 |
+
$table = $this->getTable('sales_flat_order');
|
9 |
+
} else {
|
10 |
+
$table = $this->getTable('sales_order');
|
11 |
+
}
|
12 |
+
$this->_conn->addColumn($this->getTable('sales_flat_quote'), 'shipping_arrival_date', 'datetime');
|
13 |
+
$this->_conn->addColumn($this->getTable($table), 'shipping_arrival_date', 'datetime');
|
14 |
+
$connection = Mage::getSingleton('core/resource')->getConnection('core_write');
|
15 |
+
$installer->endSetup();
|
16 |
+
|
app/design/frontend/base/default/layout/onestepcheckout.xml
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<checkout_onepage_index>
|
4 |
+
<reference name="root">
|
5 |
+
<action method="setTemplate" ifconfig="onestepcheckout/general/enabled"><template>page/1column.phtml</template></action>
|
6 |
+
</reference>
|
7 |
+
<reference name="head">
|
8 |
+
<action method="addItem" ifconfig="onestepcheckout/general/enabled"><type>skin_js</type><name>onestepcheckout/js/onestepcheckout.js</name><params/></action>
|
9 |
+
<action method="addCss" ifconfig="onestepcheckout/general/enabled"><stylesheet>onestepcheckout/css/onestepcheckout.css</stylesheet></action>
|
10 |
+
<block type="core/html_calendar" name="head.calendar" as="calendar" output="toHtml" template="onestepcheckout/onepage/delivery_date/js/calendar.phtml"/>
|
11 |
+
<action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
|
12 |
+
<action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<if/><condition>can_load_calendar_js</condition>--></action>
|
13 |
+
<action method="addItem" ifconfig="onestepcheckout/general/enabled"><type>skin_js</type><name>onestepcheckout/js/osc-calendar-setup.js</name><params/></action>
|
14 |
+
</reference>
|
15 |
+
<reference name="content">
|
16 |
+
<action method="setHeaderTitle" translate="title" module="checkout"><title>Onestepcheckout</title></action>
|
17 |
+
<action method="unsetChild" ifconfig="onestepcheckout/general/enabled"><name>checkout.onepage</name></action>
|
18 |
+
<block type="onestepcheckout/onepage" name="onestepcheckout.onepage">
|
19 |
+
<action method="setTemplate" ifconfig="onestepcheckout/general/enabled">
|
20 |
+
<template>onestepcheckout/onestepcheckout.phtml</template>
|
21 |
+
</action>
|
22 |
+
<block type="onestepcheckout/onepage" name="onestepcheckout.onepage.billing" as="billingx" template="onestepcheckout/onepage/billing.phtml"/>
|
23 |
+
<block type="onestepcheckout/onepage" name="onestepcheckout.onepage.shipping" as="shippingx" template="onestepcheckout/onepage/shipping.phtml"/>
|
24 |
+
<block type="onestepcheckout/onepage_shipping_method_available" name="onestepcheckout.onepage.shipping_method.available" as="availablex" template="onestepcheckout/onepage/shipping_method/available.phtml"/>
|
25 |
+
<block type="onestepcheckout/onepage" name="onestepcheckout.onepage.shipping_method.additional" as="additionalx" template="onestepcheckout/onepage/shipping_method/additional.phtml"/>
|
26 |
+
<block type="checkout/onepage_payment_methods" name="onestepcheckout.payment.methods" as="methodsx" template="onestepcheckout/onepage/payment/methods.phtml">
|
27 |
+
<action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
|
28 |
+
</block>
|
29 |
+
<block type="checkout/onepage_review_info" name="onestepcheckout.onepage.review.info" as="infox" template="onestepcheckout/onepage/review/info.phtml" />
|
30 |
+
<block type="onestepcheckout/onepage" name="onestepcheckout.onepage.agreements" as="agreementsx" template="onestepcheckout/onepage/agreements.phtml"/>
|
31 |
+
<block type="onestepcheckout/onepage/coupan" name="onestepcheckout.onepage.coupan" as="coupanx" template="onestepcheckout/onepage/coupan/coupan.phtml"/>
|
32 |
+
</block>
|
33 |
+
</reference>
|
34 |
+
</checkout_onepage_index>
|
35 |
+
<onestepcheckout_onepage_paymentmethod>
|
36 |
+
<block type="checkout/onepage_payment_methods" name="root" output="toHtml" template="onestepcheckout/onepage/payment/methods.phtml">
|
37 |
+
<action method="setMethodFormTemplate"><method>purchaseorder</method><template>payment/form/purchaseorder.phtml</template></action>
|
38 |
+
</block>
|
39 |
+
</onestepcheckout_onepage_paymentmethod>
|
40 |
+
<onestepcheckout_onepage_shippingmethod>
|
41 |
+
<block type="onestepcheckout/onepage_shipping_method_available" name="root" output="toHtml" template="onestepcheckout/onepage/shipping_method/available.phtml"/>
|
42 |
+
</onestepcheckout_onepage_shippingmethod>
|
43 |
+
<onestepcheckout_onepage_additional>
|
44 |
+
<block type="onestepcheckout/onepage" name="root" output="toHtml" template="onestepcheckout/onepage/shipping_method/additional.phtml">
|
45 |
+
<action method="setDontDisplayContainer"><param>1</param></action>
|
46 |
+
</block>
|
47 |
+
</onestepcheckout_onepage_additional>
|
48 |
+
<onestepcheckout_onepage_review>
|
49 |
+
<block type="checkout/onepage_review_info" name="root" output="toHtml" template="onestepcheckout/onepage/review/info.phtml">
|
50 |
+
<action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>onestepcheckout/onepage/review/item.phtml</template></action>
|
51 |
+
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>onestepcheckout/onepage/review/item.phtml</template></action>
|
52 |
+
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>onestepcheckout/onepage/review/item.phtml</template></action>
|
53 |
+
<block type="checkout/cart_totals" name="onestepcheckout.onepage.review.info.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
|
54 |
+
</block>
|
55 |
+
</onestepcheckout_onepage_review>
|
56 |
+
<onestepcheckout_email_comment>
|
57 |
+
<block type="onestepcheckout/email_info" name="emailcomment" template="onestepcheckout/onepage/email/comment.phtml">
|
58 |
+
</block>
|
59 |
+
</onestepcheckout_email_comment>
|
60 |
+
</layout>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/billing.phtml
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="wrapper-billing-div" class="wrapper-billing" >
|
2 |
+
<form id="co-billing-form" action="">
|
3 |
+
<input type="hidden" id="hidden_onestepcheckout_order_comment" name="order_comment" value=""/>
|
4 |
+
<input type="hidden" id="hidden_newsletter_subscription" name="subscription_newsletter" value=""/>
|
5 |
+
<div class="billing">
|
6 |
+
|
7 |
+
<h4><?php echo $this->__('Billing Address') ?></h4>
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
<?php if ($this->customerHasAddresses()): ?>
|
12 |
+
<div class="billing_addresses">
|
13 |
+
<?php echo $this->getAddressesHtmlSelect('billing'); ?>
|
14 |
+
</div>
|
15 |
+
<?php
|
16 |
+
$billData = $this->getCustomer()->getPrimaryBillingAddress()->getData();
|
17 |
+
if (is_array($billData) && count($billData) > 0) {
|
18 |
+
$firstname = $billData['firstname'];
|
19 |
+
$lastname = $billData['lastname'];
|
20 |
+
$city = $billData['city'];
|
21 |
+
$region = $billData['region'];
|
22 |
+
$postcode = $billData['postcode'];
|
23 |
+
$country_id = $billData['country_id'];
|
24 |
+
$telephone = $billData['telephone'];
|
25 |
+
$street1 = $billData['street'];
|
26 |
+
$region_id = $billData['region_id'];
|
27 |
+
}
|
28 |
+
?>
|
29 |
+
|
30 |
+
<?php else: ?>
|
31 |
+
<?php
|
32 |
+
$firstname = $this->htmlEscape($this->getAddressBilling()->getFirstname());
|
33 |
+
$lastname = $this->htmlEscape($this->getAddressBilling()->getLastname());
|
34 |
+
$city = $this->htmlEscape($this->getAddressBilling()->getCity());
|
35 |
+
$region = $this->htmlEscape($this->getAddressBilling()->getRegion());
|
36 |
+
$postcode = $this->htmlEscape($this->getAddressBilling()->getPostcode());
|
37 |
+
$telephone = $this->htmlEscape($this->getAddressBilling()->getTelephone());
|
38 |
+
$street1 = $this->htmlEscape($this->getAddressBilling()->getStreet(1));
|
39 |
+
$email = $this->htmlEscape($this->getAddressBilling()->getEmail());
|
40 |
+
//$street2 = $this->htmlEscape($this->getAddressBilling()->getStreet(2));
|
41 |
+
$region_id = $this->getAddressBilling()->getRegionId();
|
42 |
+
$createAccount = $this->getCreateAccount();
|
43 |
+
$country_id = $this->htmlEscape($this->getAddressBilling()->getCountryId());
|
44 |
+
?>
|
45 |
+
<?php endif; ?>
|
46 |
+
|
47 |
+
<?php
|
48 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn()):
|
49 |
+
if (!$firstname) {
|
50 |
+
echo $firstname = Mage::getSingleton('customer/session')->getCustomer()->getFirstname();
|
51 |
+
}
|
52 |
+
if (!$lastname) {
|
53 |
+
echo $lastname = Mage::getSingleton('customer/session')->getCustomer()->getLastname();
|
54 |
+
}
|
55 |
+
endif;
|
56 |
+
?>
|
57 |
+
|
58 |
+
<div id="billing-imformation-fields" style="display:<?php echo $this->customerHasAddresses() ? 'none' : 'block'; ?>">
|
59 |
+
<div class="billing-info">
|
60 |
+
<div class="field">
|
61 |
+
<label for="billing:firstname"><?php echo $this->__('First Name') ?><span class="required">*</span></label>
|
62 |
+
<div class="input-box"><input name="billing[firstname]" type="text" id="billing:firstname" class="required-entry input-text normal-box" onblur="javascript: syncShipping(false)" value="<?php echo $firstname; ?>"></div>
|
63 |
+
<input type="hidden" name="submitCustomCheckout" value="save"/>
|
64 |
+
</div>
|
65 |
+
<div class="field">
|
66 |
+
<input type="hidden" name="billing[address_id]" value="<?php echo $this->getQuote()->getBillingAddress()->getId() ?>" id="billing:address_id"/>
|
67 |
+
<label for="billing:lastname"><?php echo $this->__('Last Name') ?><span class="required">*</span></label>
|
68 |
+
<div class="input-box"><input name="billing[lastname]" type="text" id="billing:lastname" class="required-entry input-text normal-box" onblur="javascript: syncShipping(false)" value="<?php echo $lastname; ?>"/></div>
|
69 |
+
</div>
|
70 |
+
<div class="field">
|
71 |
+
<label for="billing:street1"><?php echo $this->__('Address') ?><span class="required">*</span></label>
|
72 |
+
<div class="input-box"><input name="billing[street][0]" type="text" id="billing:street1" class="required-entry input-text com-box" value="<?php echo $street1; ?>" onblur="javascript: syncShipping(false)"/></div>
|
73 |
+
</div>
|
74 |
+
<div class="field">
|
75 |
+
<label for="billing:country_id"><?php echo $this->__('Country') ?><span class="required">*</span></label>
|
76 |
+
<div class="input-box">
|
77 |
+
<?php echo $this->getCountryHtmlSelectOPcheckout('billing', $country_id) ?>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
<div class="field">
|
81 |
+
<label for="billing:region"><?php echo $this->__('State') ?><span class="required">*</span></label>
|
82 |
+
<div class="input-box">
|
83 |
+
<select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select com-box" onchange="javascript: syncShipping(false)">
|
84 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
85 |
+
</select>
|
86 |
+
<script type="text/javascript">
|
87 |
+
$('billing:region_id').setAttribute('defaultValue', "<?php echo $region_id; ?>");
|
88 |
+
</script>
|
89 |
+
<input type="text" id="billing:region" name="billing[region]" value="<?php echo $region; ?>" title="<?php echo $this->__('State/Province') ?>" style="display:none" class="required-entry input-text com-box" onblur="javascript: syncShipping(false)"/>
|
90 |
+
</div>
|
91 |
+
</div>
|
92 |
+
|
93 |
+
<div class="field">
|
94 |
+
<label for="billing:city"><?php echo $this->__('City') ?><span class="required">*</span></label>
|
95 |
+
<div class="input-box"><input type="text" name="billing[city]" class="required-entry input-text normal-box" id="billing:city" value="<?php echo $city; ?>" onBlur="javascript: syncShipping(false)"/>
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
<div class="field">
|
99 |
+
<label for="billing:postcode"><?php echo $this->__('Zip code') ?><span <?php /* check required zip code */ if ($this->isZipCodeRequired($country_id)) echo ' class="required"' ?>>*</span></label>
|
100 |
+
<div class="input-box"><input name="billing[postcode]" type="text" id="billing:postcode"<?php /* check required zip code */ if ($this->isZipCodeRequired($country_id)) echo ' class="validate-zip-international required-entry input-text normal-box"' ?> value="<?php echo $postcode; ?>" onBlur="javascript: syncShipping(false)"/></div>
|
101 |
+
</div>
|
102 |
+
<div class="field">
|
103 |
+
<label for="billing:telephone"><?php echo $this->__('Telephone') ?><span class="required">*</span></label>
|
104 |
+
<div class="input-box"><input name="billing[telephone]" type="text" id="billing:telephone" class="required-entry input-text normal-box" value="<?php echo $telephone; ?>" onblur="javascript: syncShipping(false)"/></div>
|
105 |
+
</div>
|
106 |
+
<div class="field">
|
107 |
+
<?php if (!$this->isCustomerLoggedIn()): ?>
|
108 |
+
<label for="billing:email"><?php echo $this->__('Email Address') ?><span class="required">*</span></label>
|
109 |
+
<?php endif; ?>
|
110 |
+
<?php if (!$this->isCustomerLoggedIn()): ?>
|
111 |
+
<div class="input-box"><input name="billing[email]" type="text" id="billing:email" class="validate-email required-entry input-text normal-box" value="<?php echo $email; ?>" onblur="javascript: syncShipping(false)"/></div>
|
112 |
+
<?php endif; ?>
|
113 |
+
</div>
|
114 |
+
<?php if (!$this->isCustomerLoggedIn()): ?>
|
115 |
+
<?php if ($this->getQuote()->isAllowedGuestCheckout()): ?>
|
116 |
+
|
117 |
+
<div class="field">
|
118 |
+
<input id="id_create_account" type="checkbox" name="create_account" value="1" <?php echo (($createAccount) ? ' checked="checked"' : '') ?> />
|
119 |
+
<label for="id_create_account"><?php echo $this->__('Create an account for later use'); ?></label>
|
120 |
+
</div>
|
121 |
+
|
122 |
+
|
123 |
+
<div id="onestepcheckout-li-password-label" class="field" style="display: none;">
|
124 |
+
<label for="billing:customer_password"><?php echo $this->__('Password') ?></label><span class="required">*</span>
|
125 |
+
<div class="input-box"><input type="password" class="required-entry validate-password input-text normal-box" value="<?php echo ((isset($_POST['billing']['customer_password'])) ? $_POST['billing']['customer_password'] : ''); ?>" title="Password" id="billing:customer_password" name="billing[customer_password]"/></div>
|
126 |
+
</div>
|
127 |
+
<div id="onestepcheckout-li-password" class="field" style="display: none;" >
|
128 |
+
<label for="billing:confirm_password"><?php echo $this->__('Confirm password') ?></label><span class="required">*</span>
|
129 |
+
<div class="input-box">
|
130 |
+
<input type="password" class="required-entry validate-password input-text normal-box" value="<?php echo ((isset($_POST['billing']['confirm_password'])) ? $_POST['billing']['confirm_password'] : ''); ?>" id="billing:confirm_password" title="Confirm Password" name="billing[confirm_password]"/>
|
131 |
+
</div>
|
132 |
+
</div>
|
133 |
+
<?php else: ?>
|
134 |
+
<div class="field">
|
135 |
+
<label for="billing:customer_password"><?php echo $this->__('Password') ?></label><span class="required">*</span>
|
136 |
+
<div class="input-box"><input type="hidden" name="create_account" value="1"/></div>
|
137 |
+
</div>
|
138 |
+
|
139 |
+
<div class="field" style="display: none;">
|
140 |
+
<label for="billing:confirm_password"><?php echo $this->__('Confirm password') ?></label><span class="required">*</span>
|
141 |
+
<div class="input-box"><input type="password" class="required-entry validate-password input-text normal-box" value="<?php echo ((isset($_POST['billing']['customer_password'])) ? $_POST['billing']['customer_password'] : ''); ?>" title="Password" id="billing:customer_password" name="billing[customer_password]"/>
|
142 |
+
</div>
|
143 |
+
<div class="input-box">
|
144 |
+
<input type="password" class="required-entry validate-password input-text normal-box" value="<?php echo ((isset($_POST['billing']['confirm_password'])) ? $_POST['billing']['confirm_password'] : ''); ?>" id="billing:confirm_password" title="Confirm Password" name="billing[confirm_password]"/>
|
145 |
+
</div>
|
146 |
+
|
147 |
+
<?php endif; ?>
|
148 |
+
<?php endif; ?>
|
149 |
+
</div>
|
150 |
+
<div class="field">
|
151 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()): ?>
|
152 |
+
<input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="if (window.shipping) {
|
153 |
+
shipping.setSameAsBilling(false);
|
154 |
+
}" <?php if ($this->getAddress()->getSaveInAddressBook()): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book'); ?></label>
|
155 |
+
<?php else: ?>
|
156 |
+
<input type="hidden" name="billing[save_in_address_book]" value="1" />
|
157 |
+
<?php endif; ?>
|
158 |
+
</div>
|
159 |
+
|
160 |
+
|
161 |
+
|
162 |
+
<?php if ($this->canShip()): ?>
|
163 |
+
|
164 |
+
<?php endif; ?>
|
165 |
+
</div>
|
166 |
+
</div>
|
167 |
+
<div class="field">
|
168 |
+
<input type="checkbox" value ="1" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" class="shipping-input" onclick="javascript: syncWithShipping(this.checked)" <?php echo (($this->isCustomerLoggedIn() == 1) ? 'checked="checked"' : 'checked="checked"'); ?>/>
|
169 |
+
<label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to the same address') ?></label>
|
170 |
+
</div>
|
171 |
+
</div>
|
172 |
+
</form>
|
173 |
+
<script>
|
174 |
+
<?php if (!$this->isCustomerLoggedIn()): ?>
|
175 |
+
document.observe("dom:loaded", function() {
|
176 |
+
$('id_create_account').observe('click', function(e) {
|
177 |
+
var element = e.element();
|
178 |
+
if (element.checked) {
|
179 |
+
$('onestepcheckout-li-password-label').show();
|
180 |
+
$('onestepcheckout-li-password').show();
|
181 |
+
}
|
182 |
+
else {
|
183 |
+
$('onestepcheckout-li-password-label').hide();
|
184 |
+
$('onestepcheckout-li-password').hide();
|
185 |
+
}
|
186 |
+
});
|
187 |
+
});
|
188 |
+
<?php endif; ?>
|
189 |
+
</script>
|
190 |
+
<script type="text/javascript">
|
191 |
+
var billingForm = new VarienForm('co-billing-form');
|
192 |
+
// $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
|
193 |
+
var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions);
|
194 |
+
</script>
|
195 |
+
</div>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/coupan/coupan.phtml
ADDED
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form id="discount-coupon-form" action="" method="post" >
|
2 |
+
<div id="coupon-notice" style="display: none;"></div>
|
3 |
+
<div class="discount" style="border: 1px solid #D9DDE3; padding: 20px;">
|
4 |
+
<h2><?php echo $this->__('Discount Codes') ?></h2>
|
5 |
+
<div class="discount-form">
|
6 |
+
<label for="coupon_code"><?php echo $this->__('Enter your coupon code if you have one.') ?></label>
|
7 |
+
|
8 |
+
<div class="input-box">
|
9 |
+
<input style="width:250px; margin-top:10px; margin-bottom:5px;" class="input-text" id="coupon_code" name="coupon_code" value="<?php echo $this->htmlEscape(Mage::getSingleton('checkout/session')->getQuote()->getCouponCode()) ?>" />
|
10 |
+
<br/><span id="msg" style="display:none; color:red;"></span>
|
11 |
+
</div>
|
12 |
+
|
13 |
+
<div class="buttons-sets" style="margin-top:15px;">
|
14 |
+
<span class="coupon-please-wait" id="coupon-please-wait" style="display:none; line-height:19px; margin-left:5px;">
|
15 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Submitting coupon information...') ?>" title="<?php echo $this->__('Submitting coupon information...') ?>" class="v-middle" />
|
16 |
+
</span>
|
17 |
+
<button id="onestepcheckout-coupon-add" type="button" title="<?php echo $this->__('Apply Coupon') ?>" class="button addcoupon"value="<?php echo $this->__('Apply Coupon') ?>"><span><span><?php echo $this->__('Apply Coupon') ?></span></span></button>
|
18 |
+
<?php $class = " no-display";
|
19 |
+
if (strlen(Mage::getModel('checkout/session')->getQuote()->getCouponCode())): ?>
|
20 |
+
<?php $class = "";
|
21 |
+
endif; ?>
|
22 |
+
<button id="onestepcheckout-coupon-remove" type="button" title="<?php echo $this->__('Cancel Coupon') ?>" class="button cancelcoupon<?php echo $class; ?>" value="<?php echo $this->__('Cancel Coupon') ?>"><span><span><?php echo $this->__('Cancel Coupon') ?></span></span></button>
|
23 |
+
</div>
|
24 |
+
</div>
|
25 |
+
</div>
|
26 |
+
</form>
|
27 |
+
<script type="text/javascript">
|
28 |
+
/*
|
29 |
+
*@ Add Coupon DisCount Code..
|
30 |
+
*/
|
31 |
+
Event.observe(window, 'load', function() {
|
32 |
+
$('onestepcheckout-coupon-add').observe('click', function(e) {
|
33 |
+
var coupon = $('coupon_code').getValue();
|
34 |
+
var couponNotice = $('coupon-notice');
|
35 |
+
couponNotice.hide();
|
36 |
+
if (coupon == '')
|
37 |
+
{
|
38 |
+
alert('<?php echo $this->__('Please enter a valid coupon code.'); ?>');
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
var url = '<?php echo $this->getUrl('onestepcheckout/onepage/coupon', array('_secure' => true)); ?>';
|
42 |
+
var parameters = {code: coupon};
|
43 |
+
new Ajax.Request(url, {
|
44 |
+
method: 'post',
|
45 |
+
parameters: parameters,
|
46 |
+
onSuccess: function(transport) {
|
47 |
+
if (transport.status == 200) {
|
48 |
+
var response = transport.responseText.evalJSON();
|
49 |
+
if (response.success) {
|
50 |
+
couponNotice.update(response.message);
|
51 |
+
couponNotice.removeClassName('error-msg');
|
52 |
+
couponNotice.addClassName('success-msg');
|
53 |
+
couponNotice.show();
|
54 |
+
/* Show remove button */
|
55 |
+
$('onestepcheckout-coupon-remove').removeClassName('no-display');
|
56 |
+
}
|
57 |
+
else {
|
58 |
+
couponNotice.update(response.message);
|
59 |
+
couponNotice.removeClassName('success-msg');
|
60 |
+
couponNotice.addClassName('error-msg');
|
61 |
+
couponNotice.show();
|
62 |
+
/* Hide remove button */
|
63 |
+
$('onestepcheckout-coupon-remove').addClassName('no-display');
|
64 |
+
;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
});
|
69 |
+
reviewStep.getReview();
|
70 |
+
});
|
71 |
+
});
|
72 |
+
/*
|
73 |
+
*@ Cancel Discount Coupon Code..
|
74 |
+
*/
|
75 |
+
$('onestepcheckout-coupon-remove').observe('click', function(e) {
|
76 |
+
var coupon = $('coupon_code').getValue();
|
77 |
+
var couponNotice = $('coupon-notice');
|
78 |
+
couponNotice.hide();
|
79 |
+
var url = '<?php echo $this->getUrl('onestepcheckout/onepage/coupon', array('_secure' => true)); ?>';
|
80 |
+
var parameters = {code: coupon, remove: '1'};
|
81 |
+
new Ajax.Request(url, {
|
82 |
+
method: 'post',
|
83 |
+
parameters: parameters,
|
84 |
+
onSuccess: function(transport) {
|
85 |
+
if (transport.status == 200) {
|
86 |
+
var response = transport.responseText.evalJSON();
|
87 |
+
if (response.success) {
|
88 |
+
couponNotice.update(response.message);
|
89 |
+
couponNotice.removeClassName('error-msg');
|
90 |
+
couponNotice.addClassName('success-msg');
|
91 |
+
couponNotice.show();
|
92 |
+
/* Show remove button */
|
93 |
+
$('onestepcheckout-coupon-remove').addClassName('no-display');
|
94 |
+
}
|
95 |
+
else {
|
96 |
+
|
97 |
+
couponNotice.update(response.message);
|
98 |
+
couponNotice.removeClassName('success-msg');
|
99 |
+
couponNotice.addClassName('error-msg');
|
100 |
+
couponNotice.show();
|
101 |
+
/* Hide remove button */
|
102 |
+
$('onestepcheckout-coupon-remove').removeClassName('no-display');
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
});
|
107 |
+
reviewStep.getReview();
|
108 |
+
});
|
109 |
+
</script>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/delivery_date/deliverydate.phtml
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<dd>
|
2 |
+
<ul style="border-top: 1px solid #D1D1D1; margin-top: 12px; padding-top: 10px;">
|
3 |
+
<li>
|
4 |
+
<label for="page_date-end">Delivery Date:</label>
|
5 |
+
<input name="shipping_arrival_date_display" id="shipping_arrival_date_display" value="" title="date" class=" input-text" style="width: 100px;" type="text"> <img src="<?php echo Mage::getBaseUrl('skin') ?>adminhtml/default/default/images/grid-cal.gif" alt="" class="v-middle" id="shipping_arrival_date_trig" title="Select Date" style=""> <a href="javascript:void(0)" id="link_reset" style="margin-left:5px;"><img src="<?php echo $this->getSkinUrl('onestepcheckout/images/ico_reset.png'); ?>" alt="" class="v-middle" title="Reset"></a>
|
6 |
+
<input name="shipping_arrival_date" id="shipping_arrival_date" value="" onChange="shippingArrivalDateOnChange(this); return false;" title="date" type="hidden">
|
7 |
+
</li>
|
8 |
+
</ul>
|
9 |
+
</dd>
|
10 |
+
|
11 |
+
<script type="text/javascript">
|
12 |
+
|
13 |
+
Calendar.prototype._init = function (firstDayOfWeek, date) {
|
14 |
+
var today = new CalendarDateObject(),
|
15 |
+
TY = today.getFullYear(),
|
16 |
+
TM = today.getMonth(),
|
17 |
+
TD = today.getDate();
|
18 |
+
this.table.style.visibility = "hidden";
|
19 |
+
var year = date.getFullYear();
|
20 |
+
if (year < this.minYear) {
|
21 |
+
year = this.minYear;
|
22 |
+
date.setFullYear(year);
|
23 |
+
} else if (year > this.maxYear) {
|
24 |
+
year = this.maxYear;
|
25 |
+
date.setFullYear(year);
|
26 |
+
}
|
27 |
+
this.firstDayOfWeek = firstDayOfWeek;
|
28 |
+
this.date = new CalendarDateObject(date);
|
29 |
+
var month = date.getMonth();
|
30 |
+
var mday = date.getDate();
|
31 |
+
var no_days = date.getMonthDays();
|
32 |
+
/* Added By B.C. on date 18/02/2013 */
|
33 |
+
var check_flag = false;
|
34 |
+
/* END */
|
35 |
+
|
36 |
+
// calendar voodoo for computing the first day that would actually be
|
37 |
+
// displayed in the calendar, even if it's from the previous month.
|
38 |
+
// WARNING: this is magic. ;-)
|
39 |
+
date.setDate(1);
|
40 |
+
var day1 = (date.getDay() - this.firstDayOfWeek) % 7;
|
41 |
+
if (day1 < 0)
|
42 |
+
day1 += 7;
|
43 |
+
date.setDate(-day1);
|
44 |
+
date.setDate(date.getDate() + 1);
|
45 |
+
|
46 |
+
var row = this.tbody.firstChild;
|
47 |
+
var MN = Calendar._SMN[month];
|
48 |
+
var ar_days = this.ar_days = new Array();
|
49 |
+
var weekend = Calendar._TT["WEEKEND"];
|
50 |
+
var dates = this.multiple ? (this.datesCells = {}) : null;
|
51 |
+
for (var i = 0; i < 6; ++i, row = row.nextSibling) {
|
52 |
+
var cell = row.firstChild;
|
53 |
+
if (this.weekNumbers) {
|
54 |
+
cell.className = "day wn";
|
55 |
+
cell.innerHTML = date.getWeekNumber();
|
56 |
+
cell = cell.nextSibling;
|
57 |
+
}
|
58 |
+
row.className = "daysrow";
|
59 |
+
var hasdays = false, iday, dpos = ar_days[i] = [];
|
60 |
+
for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) {
|
61 |
+
iday = date.getDate();
|
62 |
+
var wday = date.getDay();
|
63 |
+
cell.className = "day";
|
64 |
+
cell.pos = i << 4 | j;
|
65 |
+
dpos[j] = cell;
|
66 |
+
var current_month = (date.getMonth() == month);
|
67 |
+
if (!current_month) {
|
68 |
+
if (this.showsOtherMonths) {
|
69 |
+
cell.className += " othermonth";
|
70 |
+
cell.otherMonth = true;
|
71 |
+
} else {
|
72 |
+
cell.className = "emptycell";
|
73 |
+
cell.innerHTML = " ";
|
74 |
+
cell.disabled = true;
|
75 |
+
continue;
|
76 |
+
}
|
77 |
+
} else {
|
78 |
+
cell.otherMonth = false;
|
79 |
+
hasdays = true;
|
80 |
+
}
|
81 |
+
cell.disabled = false;
|
82 |
+
cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday;
|
83 |
+
if (dates)
|
84 |
+
dates[date.print("%Y%m%d")] = cell;
|
85 |
+
if (this.getDateStatus) {
|
86 |
+
var status = this.getDateStatus(date, year, month, iday);
|
87 |
+
if (this.getDateToolTip) {
|
88 |
+
var toolTip = this.getDateToolTip(date, year, month, iday);
|
89 |
+
if (toolTip)
|
90 |
+
cell.title = toolTip;
|
91 |
+
}
|
92 |
+
if (status === true) {
|
93 |
+
cell.className += " disabled";
|
94 |
+
cell.disabled = true;
|
95 |
+
} else {
|
96 |
+
if (/disabled/i.test(status))
|
97 |
+
cell.disabled = true;
|
98 |
+
cell.className += " " + status;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
if (!cell.disabled) {
|
102 |
+
cell.caldate = new CalendarDateObject(date);
|
103 |
+
cell.ttip = "_";
|
104 |
+
if (!this.multiple && current_month
|
105 |
+
&& iday == mday && this.hiliteToday) {
|
106 |
+
cell.className += " selected";
|
107 |
+
this.currentDateEl = cell;
|
108 |
+
}
|
109 |
+
if (date.getFullYear() == TY &&
|
110 |
+
date.getMonth() == TM &&
|
111 |
+
iday == TD) {
|
112 |
+
cell.className += " today";
|
113 |
+
cell.ttip += Calendar._TT["PART_TODAY"];
|
114 |
+
}
|
115 |
+
if (weekend.indexOf(wday.toString()) != -1)
|
116 |
+
cell.className += cell.otherMonth ? " oweekend" : " weekend";
|
117 |
+
if (check_flag){
|
118 |
+
cell.className += " selected";
|
119 |
+
this.currentDateEl = cell;
|
120 |
+
check_flag=false;
|
121 |
+
}
|
122 |
+
}else{
|
123 |
+
/* Added By B.C. on date 18/02/2013 */
|
124 |
+
if (!this.multiple && current_month
|
125 |
+
&& iday == mday && this.hiliteToday) {
|
126 |
+
check_flag=true;
|
127 |
+
}
|
128 |
+
|
129 |
+
/* END */
|
130 |
+
}
|
131 |
+
}
|
132 |
+
if (!(hasdays || this.showsOtherMonths))
|
133 |
+
row.className = "emptyrow";
|
134 |
+
}
|
135 |
+
this.title.innerHTML = Calendar._MN[month] + ", " + year;
|
136 |
+
this.onSetTime();
|
137 |
+
this.table.style.visibility = "visible";
|
138 |
+
this._initMultipleDates();
|
139 |
+
// PROFILE
|
140 |
+
// this.tooltips.innerHTML = "Generated in " + ((new CalendarDateObject()) - today) + " ms";
|
141 |
+
};
|
142 |
+
Calendar.setup({
|
143 |
+
inputField: "shipping_arrival_date",
|
144 |
+
ifFormat: "%Y-%mm-%ee %H:%M:%S",
|
145 |
+
showsTime: true,
|
146 |
+
button: "shipping_arrival_date_trig",
|
147 |
+
align: "Bl",
|
148 |
+
singleClick :true,
|
149 |
+
onSelect :function()
|
150 |
+
{
|
151 |
+
//var y = calendar.date.getFullYear();
|
152 |
+
currentTime1 = new Date();
|
153 |
+
var m = parseInt(currentTime1.getMonth())+parseInt(1);
|
154 |
+
var y=currentTime1.getFullYear();
|
155 |
+
var d = currentTime1.getDate();
|
156 |
+
|
157 |
+
currentTime = new Date(calendar.date.getTime());
|
158 |
+
var d1=currentTime.getDate();
|
159 |
+
var m1=parseInt(currentTime.getMonth())+parseInt(1);
|
160 |
+
var y1=currentTime.getFullYear();
|
161 |
+
var h1 = currentTime.getHours();
|
162 |
+
var min1= currentTime.getMinutes();
|
163 |
+
|
164 |
+
|
165 |
+
if (calendar.dateClicked)
|
166 |
+
{
|
167 |
+
if(d1 < d && m1==m && y1==y)
|
168 |
+
{
|
169 |
+
alert("You can not select previous date.")
|
170 |
+
document.getElementById('shipping_arrival_date_display').value="";
|
171 |
+
document.getElementById('shipping_arrival_date').value="";
|
172 |
+
calendar.hide();
|
173 |
+
}
|
174 |
+
else
|
175 |
+
{
|
176 |
+
document.getElementById('shipping_arrival_date_display').value=y1+"-"+m1+"-"+d1+" "+h1+":"+min1;
|
177 |
+
document.getElementById('shipping_arrival_date').value=y1+"-"+m1+"-"+d1+" "+h1+":"+min1;
|
178 |
+
calendar.hide();
|
179 |
+
}
|
180 |
+
}
|
181 |
+
else
|
182 |
+
{
|
183 |
+
calendar.show();
|
184 |
+
}
|
185 |
+
},
|
186 |
+
disableFunc : function(date)
|
187 |
+
{
|
188 |
+
var y = calendar.date.getFullYear();
|
189 |
+
var m = calendar.date.getMonth();
|
190 |
+
var d = calendar.date.getDate();
|
191 |
+
|
192 |
+
currentTime = new Date();
|
193 |
+
var d1=currentTime.getDate();
|
194 |
+
var m1=currentTime.getMonth();
|
195 |
+
var y1=currentTime.getFullYear();
|
196 |
+
|
197 |
+
if(y < y1)
|
198 |
+
{
|
199 |
+
return true;
|
200 |
+
}
|
201 |
+
else if(m1 > m && y==y1)
|
202 |
+
{
|
203 |
+
return true;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
});
|
207 |
+
|
208 |
+
function shippingArrivalDateOnChange(el)
|
209 |
+
{
|
210 |
+
var displayDate = $('shipping_arrival_date_display');
|
211 |
+
var date = $('shipping_arrival_date').getValue();
|
212 |
+
displayDate.setValue(date);
|
213 |
+
}
|
214 |
+
|
215 |
+
function resetArrivalDate()
|
216 |
+
{
|
217 |
+
//clear both fields
|
218 |
+
|
219 |
+
}
|
220 |
+
//MRD added disable field to only allow calendar input
|
221 |
+
//TODO: need to enable field when form is submitted
|
222 |
+
Form.Element.disable('shipping_arrival_date_display');
|
223 |
+
Event.observe($('link_reset'),'click',function(){
|
224 |
+
$('shipping_arrival_date').setValue('');
|
225 |
+
$('shipping_arrival_date_display').setValue('');
|
226 |
+
});
|
227 |
+
//]]>
|
228 |
+
</script>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/delivery_date/js/calendar.phtml
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// no notice of license for now
|
3 |
+
?>
|
4 |
+
|
5 |
+
<?php
|
6 |
+
/**
|
7 |
+
* Calendar localization script. Should be put into page header.
|
8 |
+
*
|
9 |
+
* @see Mage_Core_Block_Html_Calendar
|
10 |
+
*/
|
11 |
+
?>
|
12 |
+
<script type="text/javascript">
|
13 |
+
//<![CDATA[
|
14 |
+
enUS = <?php echo $enUS ?>; // en_US locale reference
|
15 |
+
Calendar._DN = <?php echo $days['wide'] ?>; // full day names
|
16 |
+
Calendar._SDN = <?php echo $days['abbreviated'] ?>; // short day names
|
17 |
+
Calendar._FD = <?php echo $firstDay ?>; // First day of the week. "0" means display Sunday first, "1" means display Monday first, etc.
|
18 |
+
Calendar._MN = <?php echo $months['wide'] ?>; // full month names
|
19 |
+
Calendar._SMN = <?php echo $months['abbreviated'] ?>; // short month names
|
20 |
+
Calendar._am = <?php echo $am ?>; // am/pm
|
21 |
+
Calendar._pm = <?php echo $pm ?>;
|
22 |
+
|
23 |
+
// tooltips
|
24 |
+
Calendar._TT = {};
|
25 |
+
Calendar._TT["INFO"] = "<?php echo $this->__('About the calendar'); ?>";
|
26 |
+
|
27 |
+
Calendar._TT["ABOUT"] =
|
28 |
+
"<?php echo $this->__('DHTML Date/Time Selector') ?>\n" +
|
29 |
+
"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" +
|
30 |
+
"<?php echo $this->__('For latest version visit: %s', 'http://www.dynarch.com/projects/calendar/') ?>\n" +
|
31 |
+
"<?php echo $this->__('Distributed under GNU LGPL. See %s for details.', 'http://gnu.org/licenses/lgpl.html') ?>" +
|
32 |
+
"\n\n" +
|
33 |
+
"<?php echo $this->__('Date selection:') ?>\n" +
|
34 |
+
"<?php echo $this->__('- Use the %s, %s buttons to select year', '\\xab', '\xbb') ?>\n" +
|
35 |
+
"<?php echo $this->__('- Use the %s buttons to select month', '" + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "') ?>\n" +
|
36 |
+
"<?php echo $this->__('- Hold mouse button on any of the above buttons for faster selection.') ?>";
|
37 |
+
Calendar._TT["ABOUT_TIME"] = "\n\n" +
|
38 |
+
"<?php echo $this->__('Time selection:') ?>\n" +
|
39 |
+
"<?php echo $this->__('- Click on any of the time parts to increase it') ?>\n" +
|
40 |
+
"<?php echo $this->__('- or Shift-click to decrease it') ?>\n" +
|
41 |
+
"<?php echo $this->__('- or click and drag for faster selection.') ?>";
|
42 |
+
|
43 |
+
Calendar._TT["PREV_YEAR"] = "<?php echo $this->__('Prev. year (hold for menu)'); ?>";
|
44 |
+
Calendar._TT["PREV_MONTH"] = "<?php echo $this->__('Prev. month (hold for menu)'); ?>";
|
45 |
+
Calendar._TT["GO_TODAY"] = "<?php echo $this->__('Go Today'); ?>";
|
46 |
+
Calendar._TT["NEXT_MONTH"] = "<?php echo $this->__('Next month (hold for menu)'); ?>";
|
47 |
+
Calendar._TT["NEXT_YEAR"] = "<?php echo $this->__('Next year (hold for menu)'); ?>";
|
48 |
+
Calendar._TT["SEL_DATE"] = "<?php echo $this->__('Select date'); ?>";
|
49 |
+
Calendar._TT["DRAG_TO_MOVE"] = "<?php echo $this->__('Drag to move'); ?>";
|
50 |
+
Calendar._TT["PART_TODAY"] = ' (' + <?php echo $today ?> + ')';
|
51 |
+
|
52 |
+
// the following is to inform that "%s" is to be the first day of week
|
53 |
+
Calendar._TT["DAY_FIRST"] = "<?php echo $this->__('Display %s first', '%s'); ?>";
|
54 |
+
|
55 |
+
// This may be locale-dependent. It specifies the week-end days, as an array
|
56 |
+
// of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
|
57 |
+
// means Monday, etc.
|
58 |
+
Calendar._TT["WEEKEND"] = <?php echo $weekendDays ?>;
|
59 |
+
|
60 |
+
Calendar._TT["CLOSE"] = "<?php echo $this->__('Close'); ?>";
|
61 |
+
Calendar._TT["TODAY"] = <?php echo $today ?>;
|
62 |
+
Calendar._TT["TIME_PART"] = "<?php echo $this->__('(Shift-)Click or drag to change value'); ?>";
|
63 |
+
|
64 |
+
// date formats
|
65 |
+
Calendar._TT["DEF_DATE_FORMAT"] = <?php echo $defaultFormat ?>;
|
66 |
+
Calendar._TT["TT_DATE_FORMAT"] = <?php echo $toolTipFormat ?>;
|
67 |
+
|
68 |
+
Calendar._TT["WK"] = <?php echo $week ?>;
|
69 |
+
Calendar._TT["TIME"] = "<?php echo $this->__('Time:'); ?>";
|
70 |
+
//]]>
|
71 |
+
</script>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/email/comment.phtml
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$version=Mage::getVersion();
|
3 |
+
if (in_array($version, array('1.4.0.0', '1.4.0.1'))){
|
4 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
5 |
+
if ($orderId) {
|
6 |
+
$_order = Mage::getModel('sales/order')->load($orderId);
|
7 |
+
$comment = $_order->getOrderComment();
|
8 |
+
$delivery = $_order->getShippingArrivalDate();
|
9 |
+
$date_format ='d/M/Y';
|
10 |
+
$date_format.=",g:i a";
|
11 |
+
$formateddate = date($date_format, strtotime($delivery));
|
12 |
+
}
|
13 |
+
}else{
|
14 |
+
$_order = $this->getOrder();
|
15 |
+
$comment = $_order->getOrderComment();
|
16 |
+
$delivery = $_order->getShippingArrivalDate();
|
17 |
+
$date_format ='d/M/Y';
|
18 |
+
$date_format.=",g:i a";
|
19 |
+
$formateddate = date($date_format, strtotime($delivery));
|
20 |
+
}
|
21 |
+
?>
|
22 |
+
<?php if ($_order): ?>
|
23 |
+
<?php if (isset($comment) || isset($delivery)): ?>
|
24 |
+
<table>
|
25 |
+
<thead>
|
26 |
+
<?php if (isset($comment) && $comment !== ''): ?>
|
27 |
+
<th bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Order Comment:</th>
|
28 |
+
<?php endif; ?>
|
29 |
+
<?php if (isset($delivery) && $delivery !== ''): ?>
|
30 |
+
<th bgcolor="#EAEAEA" style="font-size:13px; padding:5px 9px 6px 9px; line-height:1em;">Delivery Date:</th>
|
31 |
+
<?php endif; ?>
|
32 |
+
</thead>
|
33 |
+
<tbody>
|
34 |
+
<tr>
|
35 |
+
<?php if ($comment != ''): ?>
|
36 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
37 |
+
<span>
|
38 |
+
<?php echo $comment; ?>
|
39 |
+
</span>
|
40 |
+
</td>
|
41 |
+
<?php endif; ?>
|
42 |
+
<?php if ($delivery != ''): ?>
|
43 |
+
<td valign="top" style="font-size:12px; padding:7px 9px 9px 9px; border-left:1px solid #EAEAEA; border-bottom:1px solid #EAEAEA; border-right:1px solid #EAEAEA;">
|
44 |
+
<span>
|
45 |
+
<?php echo $formateddate; ?>
|
46 |
+
</span>
|
47 |
+
</td>
|
48 |
+
<?php endif; ?>
|
49 |
+
</tr>
|
50 |
+
</tbody>
|
51 |
+
</table>
|
52 |
+
<?php endif;?>
|
53 |
+
<?php endif;?>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/login.phtml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="account-login home-login">
|
2 |
+
<div class="page-title">
|
3 |
+
<h2><?php echo $this->__('Login Here') ?></h2>
|
4 |
+
</div>
|
5 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
6 |
+
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
|
7 |
+
<div class="fieldset">
|
8 |
+
<h2 class="legend"><?php echo $this->__('Registered Customers') ?></h2>
|
9 |
+
<ul class="form-list">
|
10 |
+
<li>
|
11 |
+
<label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
|
12 |
+
<div class="input-box">
|
13 |
+
<input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
|
14 |
+
</div>
|
15 |
+
</li>
|
16 |
+
<li>
|
17 |
+
<label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
|
18 |
+
<div class="input-box">
|
19 |
+
<input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
|
20 |
+
</div>
|
21 |
+
</li>
|
22 |
+
</ul>
|
23 |
+
</div>
|
24 |
+
<div class="buttons-set">
|
25 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
26 |
+
<p class="back-link"><a href="#" onclick="Modalbox.show('<?php echo $this->getUrl('sign-up') ?>', {title: '<?php echo $this->__("Sign Up") ?>', width: 500, height: 410});" class="back-link"><small>« </small><?php echo $this->__('Back') ?></a></p>
|
27 |
+
<button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
|
28 |
+
</div>
|
29 |
+
</form>
|
30 |
+
<script type="text/javascript">
|
31 |
+
//<![CDATA[
|
32 |
+
var dataForm = new VarienForm('login-form', true);
|
33 |
+
//]]>
|
34 |
+
</script>
|
35 |
+
</div>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/payment/methods.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="payment-methods">
|
2 |
+
<dl id="checkout-payment-method-load">
|
3 |
+
<?php
|
4 |
+
foreach ($this->getMethods() as $_method): $_code = $_method->getCode() ?>
|
5 |
+
<dt>
|
6 |
+
<?php if( sizeof($this->getMethods()) > 1 ): ?>
|
7 |
+
<input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->htmlEscape($_method->getTitle()) ?>" class="radio" onclick="payment.loadPaymentMethods();//payment.switchMethod('<?php echo $_code ?>')"<?php if($this->getSelectedMethodCode()==$_code): ?> checked="checked"<?php endif; ?> />
|
8 |
+
<?php else: ?>
|
9 |
+
<span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" /></span>
|
10 |
+
<?php endif; ?>
|
11 |
+
<label for="p_method_<?php echo $_code ?>"><?php echo $_method->getTitle() ?></label>
|
12 |
+
</dt>
|
13 |
+
<?php if($html = $this->getChildHtml('payment.method.'.$_code)): ?>
|
14 |
+
<dd>
|
15 |
+
<?php echo $html; ?>
|
16 |
+
</dd>
|
17 |
+
<?php endif; ?>
|
18 |
+
<?php endforeach; ?>
|
19 |
+
</dl>
|
20 |
+
</div>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/review/info.phtml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table cellspacing="0" class="data-table" id="checkout-review-table">
|
2 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
|
3 |
+
<thead>
|
4 |
+
<tr>
|
5 |
+
<th><?php echo $this->__('Product Image') ?></th>
|
6 |
+
<th rowspan="<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?></th>
|
7 |
+
<th class="a-center" rowspan="<?php echo $rowspan ?>" width="5%"><?php echo $this->__('Qty') ?></th>
|
8 |
+
<th class="a-center" colspan="<?php echo $colspan ?>" width="10%"><?php echo $this->__('Subtotal') ?></th>
|
9 |
+
</tr>
|
10 |
+
<?php //if ($this->helper('tax')->displayCartBothPrices()):?>
|
11 |
+
<!--<tr>
|
12 |
+
<th class="a-center"><?php //echo $this->__('Excl. Tax'); ?></th>
|
13 |
+
<th class="a-center"><?php //echo $this->__('Incl. Tax'); ?></th>
|
14 |
+
<th class="a-center"><?php //echo $this->__('Excl. Tax'); ?></th>
|
15 |
+
<th class="a-center"><?php //echo $this->__('Incl. Tax'); ?></th>
|
16 |
+
</tr>-->
|
17 |
+
<?php //endif; ?>
|
18 |
+
</thead>
|
19 |
+
<tbody>
|
20 |
+
<?php foreach($this->getItems() as $_item): ?>
|
21 |
+
<?php
|
22 |
+
$prod = Mage::getModel('catalog/product')->load($_item->getProductId());
|
23 |
+
$full_path_url = Mage::helper('catalog/image')->init($prod, 'thumbnail')->resize(80,90);
|
24 |
+
?>
|
25 |
+
<tr>
|
26 |
+
<td><img src="<?php echo $full_path_url; ?>"/></td>
|
27 |
+
<td class="attributes-col"><?php echo $_item->getName() ?></td>
|
28 |
+
<td class="a-center"><?php echo $_item->getQty() ?></td>
|
29 |
+
<td class="a-right"><?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?></td>
|
30 |
+
</tr>
|
31 |
+
<?php endforeach ?>
|
32 |
+
</tbody>
|
33 |
+
<?php
|
34 |
+
$totals = $this->getTotals();
|
35 |
+
if ($this->getTotals()): ?>
|
36 |
+
<tfoot>
|
37 |
+
<?php foreach($totals as $total): ?>
|
38 |
+
<tr>
|
39 |
+
<td colspan="3"><?php echo $total->getTitle()?></td>
|
40 |
+
<td><?php echo $this->helper('checkout')->formatPrice($total->getValue())?></td>
|
41 |
+
</tr>
|
42 |
+
<?php endforeach;?>
|
43 |
+
</tfoot>
|
44 |
+
<?php endif; ?>
|
45 |
+
</table>
|
46 |
+
<script type="text/javascript">
|
47 |
+
//<![CDATA[
|
48 |
+
decorateTable('checkout-review-table');
|
49 |
+
truncateOptions();
|
50 |
+
//]]>
|
51 |
+
</script>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/review/item.phtml
ADDED
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_item = $this->getItem()?>
|
2 |
+
<tr>
|
3 |
+
<td class="attributes-col"><h4 class="title"><?php echo $this->htmlEscape($this->getProductName()) ?></h4>
|
4 |
+
<?php if ($_options = $this->getOptionList()):?>
|
5 |
+
<dl class="item-options">
|
6 |
+
<?php foreach ($_options as $_option) :
|
7 |
+
$myOptVal=strtolower(trim($_option['label']));
|
8 |
+
if($myOptVal=='area'){
|
9 |
+
$myCartUnitArea=$_option['value'];
|
10 |
+
}else if($myOptVal=='eval_price'){
|
11 |
+
$myCartUnitPrice=$_option['value'];
|
12 |
+
}
|
13 |
+
else if($myOptVal=='sendurl'){
|
14 |
+
// $url=$_option['value'];
|
15 |
+
}
|
16 |
+
else{
|
17 |
+
?>
|
18 |
+
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
|
19 |
+
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
|
20 |
+
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
|
21 |
+
<?php if (isset($_formatedOptionValue['full_view'])): ?>
|
22 |
+
<div class="truncated_full_value">
|
23 |
+
<dl class="item-options">
|
24 |
+
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
|
25 |
+
<dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
|
26 |
+
</dl>
|
27 |
+
</div>
|
28 |
+
<?php endif; ?>
|
29 |
+
</dd>
|
30 |
+
<?php } endforeach; ?>
|
31 |
+
</dl>
|
32 |
+
<?php endif;?>
|
33 |
+
<!-- / -->
|
34 |
+
</td>
|
35 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
36 |
+
<td class="a-right">
|
37 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
38 |
+
<div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
39 |
+
<?php else: ?>
|
40 |
+
<div class="cart-price">
|
41 |
+
<?php endif; ?>
|
42 |
+
|
43 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
44 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
|
45 |
+
<?php else: ?>
|
46 |
+
<?php
|
47 |
+
if(isset($myCartUnitPrice)){
|
48 |
+
echo $this->helper('checkout')->formatPrice(round($myCartUnitPrice));
|
49 |
+
}else{
|
50 |
+
echo $this->helper('checkout')->formatPrice(round($_item->getCalculationPrice()));
|
51 |
+
}
|
52 |
+
?>
|
53 |
+
<?php endif; ?>
|
54 |
+
|
55 |
+
</div>
|
56 |
+
|
57 |
+
|
58 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
59 |
+
|
60 |
+
<div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display: none;">
|
61 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
62 |
+
<small>
|
63 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
64 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
|
65 |
+
<?php endforeach; ?>
|
66 |
+
</small>
|
67 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
68 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
69 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
|
70 |
+
<?php endforeach; ?>
|
71 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
72 |
+
<small>
|
73 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
74 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
|
75 |
+
<?php endforeach; ?>
|
76 |
+
</small>
|
77 |
+
<?php endif; ?>
|
78 |
+
</div>
|
79 |
+
|
80 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
81 |
+
<div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
82 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
|
83 |
+
</div>
|
84 |
+
<?php endif; ?>
|
85 |
+
<?php endif; ?>
|
86 |
+
</td>
|
87 |
+
<?php endif; ?>
|
88 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
89 |
+
<td class="a-right">
|
90 |
+
<?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
|
91 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
92 |
+
<div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
93 |
+
<?php else: ?>
|
94 |
+
<div class="cart-price">
|
95 |
+
<?php endif; ?>
|
96 |
+
|
97 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
98 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
|
99 |
+
<?php else: ?>
|
100 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
|
101 |
+
<?php endif; ?>
|
102 |
+
|
103 |
+
</div>
|
104 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
105 |
+
|
106 |
+
<div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display: none;">
|
107 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
108 |
+
<small>
|
109 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
110 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
|
111 |
+
<?php endforeach; ?>
|
112 |
+
</small>
|
113 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
114 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
115 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
|
116 |
+
<?php endforeach; ?>
|
117 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
118 |
+
<small>
|
119 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
120 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
|
121 |
+
<?php endforeach; ?>
|
122 |
+
</small>
|
123 |
+
<?php endif; ?>
|
124 |
+
</div>
|
125 |
+
|
126 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
127 |
+
<div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
128 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span>
|
129 |
+
</div>
|
130 |
+
<?php endif; ?>
|
131 |
+
<?php endif; ?>
|
132 |
+
</td>
|
133 |
+
<?php endif; ?>
|
134 |
+
<?php
|
135 |
+
if(isset($myCartUnitArea)){
|
136 |
+
$myCartUnits=($_item->getQty()/$myCartUnitArea);
|
137 |
+
}else{
|
138 |
+
$myCartUnits=$_item->getQty();
|
139 |
+
}
|
140 |
+
?>
|
141 |
+
<td class="a-center"><?php echo $myCartUnits;//$_item->getQty() ?></td>
|
142 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
143 |
+
<td class="a-right">
|
144 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
145 |
+
<div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
146 |
+
<?php else: ?>
|
147 |
+
<div class="cart-price">
|
148 |
+
<?php endif; ?>
|
149 |
+
|
150 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
151 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
152 |
+
<?php else: ?>
|
153 |
+
<?php echo $this->helper('checkout')->formatPrice(round($_item->getRowTotal())) ?>
|
154 |
+
<?php endif; ?>
|
155 |
+
|
156 |
+
</div>
|
157 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
158 |
+
|
159 |
+
<div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display: none;">
|
160 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
161 |
+
<small>
|
162 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
163 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span><br />
|
164 |
+
<?php endforeach; ?>
|
165 |
+
</small>
|
166 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
167 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
168 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
|
169 |
+
<?php endforeach; ?>
|
170 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
171 |
+
<small>
|
172 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
173 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
|
174 |
+
<?php endforeach; ?>
|
175 |
+
</small>
|
176 |
+
<?php endif; ?>
|
177 |
+
</div>
|
178 |
+
|
179 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
180 |
+
<div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
181 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
|
182 |
+
</div>
|
183 |
+
<?php endif; ?>
|
184 |
+
<?php endif; ?>
|
185 |
+
</td>
|
186 |
+
<?php endif; ?>
|
187 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
188 |
+
<td class="a-right">
|
189 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
190 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
191 |
+
<div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
192 |
+
<?php else: ?>
|
193 |
+
<div class="cart-price">
|
194 |
+
<?php endif; ?>
|
195 |
+
|
196 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
197 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
|
198 |
+
<?php else: ?>
|
199 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
200 |
+
<?php endif; ?>
|
201 |
+
|
202 |
+
</div>
|
203 |
+
|
204 |
+
|
205 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
206 |
+
|
207 |
+
<div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display: none;">
|
208 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
209 |
+
<small>
|
210 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
211 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span><br />
|
212 |
+
<?php endforeach; ?>
|
213 |
+
</small>
|
214 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
215 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
216 |
+
<span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></small></span><br />
|
217 |
+
<?php endforeach; ?>
|
218 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
219 |
+
<small>
|
220 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
221 |
+
<span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span><br />
|
222 |
+
<?php endforeach; ?>
|
223 |
+
</small>
|
224 |
+
<?php endif; ?>
|
225 |
+
</div>
|
226 |
+
|
227 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
228 |
+
<div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
229 |
+
<span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
|
230 |
+
</div>
|
231 |
+
<?php endif; ?>
|
232 |
+
<?php endif; ?>
|
233 |
+
</td>
|
234 |
+
<?php endif; ?>
|
235 |
+
</tr>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/shipping.phtml
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="wrapper-shipping-div" class="wrapper-shipping" style="display:<?php echo 'none';//(($this->isCustomerLoggedIn()==1)?'block':'none');?>">
|
2 |
+
<form id="co-shipping-form" action="">
|
3 |
+
<table border="0" cellpadding="0" cellspacing="1" align="center">
|
4 |
+
<tr>
|
5 |
+
<td align="left">
|
6 |
+
<h4><?php echo $this->__('Shipping Address')?></h4>
|
7 |
+
</td>
|
8 |
+
</tr>
|
9 |
+
<tr>
|
10 |
+
<td>
|
11 |
+
|
12 |
+
<?php if ($this->customerHasAddresses()): ?>
|
13 |
+
<div class="shipping_addresses">
|
14 |
+
<?php echo $this->getAddressesHtmlSelect('shipping');?>
|
15 |
+
</div>
|
16 |
+
<?php
|
17 |
+
$shippingAddress = $this->getCustomer()->getPrimaryShippingAddress();
|
18 |
+
if($shippingAddress){
|
19 |
+
$shipData = $shippingAddress->getData();
|
20 |
+
if(is_array($shipData) && count($shipData)>0) {
|
21 |
+
$firstname = $shipData['firstname'];
|
22 |
+
$lastname = $shipData['lastname'];
|
23 |
+
$city = $shipData['city'];
|
24 |
+
$region = $shipData['region'];
|
25 |
+
$postcode = $shipData['postcode'];
|
26 |
+
$country_id = $shipData['country_id'];
|
27 |
+
$telephone = $shipData['telephone'];
|
28 |
+
$street1 = $shipData['street'];
|
29 |
+
//$street2 = $shipData['street'];
|
30 |
+
$region_id = $shipData['region_id'];
|
31 |
+
}
|
32 |
+
}
|
33 |
+
?>
|
34 |
+
<?php else:
|
35 |
+
$firstname = $this->htmlEscape($this->getAddressShipping()->getFirstname());
|
36 |
+
$lastname = $this->htmlEscape($this->getAddressShipping()->getLastname());
|
37 |
+
$city = $this->htmlEscape($this->getAddressShipping()->getCity());
|
38 |
+
$region = $this->htmlEscape($this->getAddressShipping()->getRegion());
|
39 |
+
$postcode = $this->htmlEscape($this->getAddressShipping()->getPostcode());
|
40 |
+
$telephone = $this->htmlEscape($this->getAddressShipping()->getCity());
|
41 |
+
$street1 = $this->htmlEscape($this->getAddressShipping()->getStreet(1));
|
42 |
+
//$street2 = $this->htmlEscape($this->getAddressShipping()->getStreet(2));
|
43 |
+
$region_id = $this->getAddressShipping()->getRegionId();
|
44 |
+
$country_id = null;
|
45 |
+
endif;
|
46 |
+
?>
|
47 |
+
<div id="shipping-imformation-fields" align="center" style="display:<?php echo ((!$this->customerHasAddresses())?'block':'none');?>">
|
48 |
+
<table border="0" cellpadding="0" cellspacing="1" align="center">
|
49 |
+
<tr>
|
50 |
+
<td width="101" align="left"><label for="shipping:firstname"><?php echo $this->__('First Name') ?><span class="required">*</span></label></td>
|
51 |
+
</tr>
|
52 |
+
<tr>
|
53 |
+
<td align="left"><input name="shipping[firstname]" type="text" id="shipping:firstname" class="required-entry input-text normal-box" value="<?php echo $firstname; ?>">
|
54 |
+
<input type="hidden" name="shipping[address_id]" value="<?php echo $this->getQuote()->getShippingAddress()->getId() ?>" id="shipping:address_id" /></td>
|
55 |
+
</tr>
|
56 |
+
<tr>
|
57 |
+
<td width="102" align="left"><label for="shipping:lastname"><?php echo $this->__('Last Name') ?><span class="required">*</span></label></td>
|
58 |
+
</tr>
|
59 |
+
<tr>
|
60 |
+
<td align="left"><input name="shipping[lastname]" type="text" id="shipping:lastname" class="required-entry input-text normal-box" value="<?php echo $lastname; ?>"/></td>
|
61 |
+
</tr>
|
62 |
+
<tr>
|
63 |
+
<td colspan="2" align="left"><label for="shipping:street1"><?php echo $this->__('Address') ?><span class="required">*</span></label></td>
|
64 |
+
</tr>
|
65 |
+
<tr>
|
66 |
+
<td colspan="2" align="left"><input name="shipping[street][0]" type="text" id="shipping:street1" class="required-entry input-text com-box" value="<?php echo $street1; ?>"/></td>
|
67 |
+
</tr>
|
68 |
+
<!-- <tr>
|
69 |
+
<td colspan="2"><input name="shipping[street][1]" type="text" id="shipping:street2" class="input-text" value="<?php //echo $street2; ?>"/></td>
|
70 |
+
</tr> -->
|
71 |
+
<tr>
|
72 |
+
<td colspan="2" align="left"><label for="shipping:country_id"><?php echo $this->__('Country') ?><span class="required">*</span></label></td>
|
73 |
+
</tr>
|
74 |
+
<tr>
|
75 |
+
<td colspan="2" align="left"><?php echo $this->getCountryHtmlSelectOPcheckout('shipping',$country_id) ?></td>
|
76 |
+
</tr>
|
77 |
+
<tr>
|
78 |
+
<td colspan="2" align="left"><label for="shipping:region"><?php echo $this->__('State') ?><span class="required">*</span></label></td>
|
79 |
+
</tr>
|
80 |
+
<tr>
|
81 |
+
<td colspan="2" align="left"><select id="shipping:region_id" name="shipping[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select com-box" style="display:none" onchange="javascript: getShippingAndTax()">
|
82 |
+
<option value=""><?php echo $this->__('Please select region, state or province') ?></option>
|
83 |
+
</select>
|
84 |
+
<script type="text/javascript">
|
85 |
+
$('shipping:region_id').setAttribute('defaultValue', "<?php echo $region_id; ?>");
|
86 |
+
</script>
|
87 |
+
<input type="text" id="shipping:region" name="shipping[region]" value="<?php echo $region; ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text com-box" style="display:none" onblur="javascript: getShippingAndTax()"/></td>
|
88 |
+
</tr>
|
89 |
+
<tr>
|
90 |
+
<td align="left"><label for="shipping:city"><?php echo $this->__('City') ?><span class="required">*</span></label></td>
|
91 |
+
</tr>
|
92 |
+
<tr>
|
93 |
+
<td align="left"><input type="text" name="shipping[city]" class="required-entry input-text normal-box" id="shipping:city" value="<?php echo $city; ?>" onblur="javascript: getShippingAndTaxWithFlag(this.value)"/></td>
|
94 |
+
</tr>
|
95 |
+
<tr>
|
96 |
+
<td align="left"><label for="shipping:postcode"><?php echo $this->__('Zip code') ?><span <?php /* check required zip code*/ if ($this->isZipCodeRequired($country_id)) echo ' class="required"' ?>>*</span></label></td>
|
97 |
+
</tr>
|
98 |
+
<tr>
|
99 |
+
<td align="left"><input name="shipping[postcode]" type="text" id="shipping:postcode" <?php /* check required zip code*/ if ($this->isZipCodeRequired($country_id)) echo ' class="validate-zip-international required-entry input-text normal-box"' ?> value="<?php echo $postcode; ?>" onblur="javascript: getShippingAndTaxWithFlag(this.value)"/></td>
|
100 |
+
</tr>
|
101 |
+
<tr>
|
102 |
+
<td align="left"><label for="shipping:telephone"><?php echo $this->__('Telephone') ?><span class="required">*</span></label></td>
|
103 |
+
<?php if(false): ?>
|
104 |
+
<td align="left"><label for="shipping:email"><?php echo $this->__('Email Address') ?><span class="required">*</span></label></td>
|
105 |
+
<?php endif;?>
|
106 |
+
</tr>
|
107 |
+
<tr>
|
108 |
+
<td align="left"><input name="shipping[telephone]" type="text" id="shipping:telephone" class="required-entry input-text normal-box" value="<?php echo $telephone; ?>"/></td>
|
109 |
+
<?php if(false): ?>
|
110 |
+
<td align="left"><input name="shipping[email]" type="text" id="shipping:email" class="validate-email required-entry input-text normal-box" value="<?php echo $this->htmlEscape($this->getAddressShipping()->getEmail()); ?>"></td>
|
111 |
+
<?php endif; ?>
|
112 |
+
</tr>
|
113 |
+
<tr>
|
114 |
+
<td colspan="2" align="left">
|
115 |
+
<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0">
|
116 |
+
<tr>
|
117 |
+
<td colspan="2">
|
118 |
+
<?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
|
119 |
+
<input type="checkbox" name="shipping[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="shipping:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" />
|
120 |
+
<label for="shipping:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
|
121 |
+
<?php else:?>
|
122 |
+
<input type="hidden" name="shipping[save_in_address_book]" value="1" />
|
123 |
+
<?php endif;?>
|
124 |
+
</td>
|
125 |
+
</tr>
|
126 |
+
</table>
|
127 |
+
</td>
|
128 |
+
</tr>
|
129 |
+
</table>
|
130 |
+
</div>
|
131 |
+
</td>
|
132 |
+
</tr>
|
133 |
+
</table>
|
134 |
+
</form>
|
135 |
+
<script type="text/javascript">
|
136 |
+
var shippingForm = new VarienForm('co-shipping-form');
|
137 |
+
shippingForm.extraChildParams = ' onchange="shipping.setSameAsBilling(false);"';
|
138 |
+
// $('shipping-address-select') && shipping.newAddress(!$('shipping-address-select').value);
|
139 |
+
var shippingRegionUpdater = new RegionUpdater('shipping:country_id', 'shipping:region', 'shipping:region_id', countryRegions);
|
140 |
+
</script>
|
141 |
+
</div>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/shipping_method.phtml
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form id="co-shipping-method-form" action="">
|
2 |
+
<div class="inner-box">
|
3 |
+
<div class="default-box" id="checkout-shipping-method-load">
|
4 |
+
<?php echo $this->getChildHtml('availablex') ?>
|
5 |
+
</div>
|
6 |
+
</div>
|
7 |
+
<script type="text/javascript">
|
8 |
+
var shippingMethod = new ShippingMethodStep('co-shipping-method-form', "<?php echo $this->getUrl('onestepcheckout/onepage/saveShippingMethod', array('_secure' => true)) ?>");
|
9 |
+
</script>
|
10 |
+
<div id="onepage-checkout-shipping-method-additional-load">
|
11 |
+
<?php echo $this->getChildHtml('additionalx') ?>
|
12 |
+
</div>
|
13 |
+
</form>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/shipping_method/additional.phtml
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php echo $this->helper('giftmessage/message')->getInline('onepage_checkout', $this->getQuote(), $this->getDontDisplayContainer()) ?>
|
app/design/frontend/base/default/template/onestepcheckout/onepage/shipping_method/available.phtml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if (!($_shippingRateGroups = $this->getShippingRates())): ?>
|
2 |
+
<strong><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></strong>
|
3 |
+
<?php else: ?>
|
4 |
+
<dl class="shipment-methods">
|
5 |
+
<?php foreach ($_shippingRateGroups as $code => $_rates): ?>
|
6 |
+
<dt><?php echo $this->getCarrierName($code) ?></dt>
|
7 |
+
<dd>
|
8 |
+
<ul>
|
9 |
+
<?php foreach ($_rates as $_rate): ?>
|
10 |
+
<li>
|
11 |
+
<?php if ($_rate->getErrorMessage()): ?>
|
12 |
+
<ul class="messages"><li class="error-msg"><ul><li><?php echo $_rate->getErrorMessage() ?></li></ul></li></ul>
|
13 |
+
<?php else: ?>
|
14 |
+
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if ($_rate->getCode() === $this->getAddressShippingMethod()) echo ' checked="checked"' ?> onclick="shippingMethodStep.save()"/>
|
15 |
+
<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
|
16 |
+
<strong>
|
17 |
+
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
|
18 |
+
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
|
19 |
+
|
20 |
+
<?php echo $_excl; ?>
|
21 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
22 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
23 |
+
<?php endif; ?>
|
24 |
+
</strong>
|
25 |
+
</label>
|
26 |
+
<?php endif ?>
|
27 |
+
</li>
|
28 |
+
<?php endforeach; ?>
|
29 |
+
</ul>
|
30 |
+
</dd>
|
31 |
+
<?php endforeach; ?>
|
32 |
+
</dl>
|
33 |
+
<?php if (Mage::helper('onestepcheckout')->isOrderDeliveryEnabled()):
|
34 |
+
echo $this->getLayout()->createBlock('core/template')->setTemplate('onestepcheckout/onepage/delivery_date/deliverydate.phtml')->toHtml();
|
35 |
+
endif; ?>
|
36 |
+
<?php endif; ?>
|
app/design/frontend/base/default/template/onestepcheckout/onestepcheckout.phtml
ADDED
@@ -0,0 +1,295 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript">countryRegions = <?php echo $this->helper('directory')->getRegionJson() ?></script>
|
2 |
+
<div class="top-heading">
|
3 |
+
<h1 class="pageTitle"><?php echo $this->__(Mage::getStoreConfig('onestepcheckout/order/onestepcheckout_title')) ?></h1>
|
4 |
+
<p class="page-desc"><?php echo $this->__(Mage::getStoreConfig('onestepcheckout/order/onestepcheckout_desc')) ?></p>
|
5 |
+
</div>
|
6 |
+
<div id="onestepcheckout-wrapper" class="main-wrapper">
|
7 |
+
|
8 |
+
<div id="onestep-loader">
|
9 |
+
<img class="loader-checkout" src="<?php echo $this->getSkinUrl('onestepcheckout/images/ajax-loader.gif') ?>"/>
|
10 |
+
</div>
|
11 |
+
<div id="sub-loader"></div>
|
12 |
+
<?php $stepCounter = 1; ?>
|
13 |
+
|
14 |
+
<?php if (!$this->isCustomerLoggedIn()): ?>
|
15 |
+
<div class="borderDiv"><?php echo $this->__('If you already have an account. Click here to ') . '<a href="' . $this->getUrl('customer/account/login', array('_secure' => true)) . '" class="login-link" id="">' . $this->__('login') . '</a>.' ?></div>
|
16 |
+
<?php endif; ?>
|
17 |
+
<div class="first-address-wrap">
|
18 |
+
<div class="main-td main-td-first">
|
19 |
+
<div class="stap-in">
|
20 |
+
<div class="stap-heading">
|
21 |
+
<span class="step-count count<?php echo $stepCounter++; ?>">1</span>
|
22 |
+
<h2 class="checkout-steps"><?php echo $this->__('Name And Address') ?></h2>
|
23 |
+
</div>
|
24 |
+
<div class="inner-wrap"><?php echo $this->getChildHtml('billingx') ?></div>
|
25 |
+
</div>
|
26 |
+
<?php // if ($this->canShip()): ?><?php echo $this->getChildHtml('shippingx') ?><?php // endif; ?>
|
27 |
+
</div>
|
28 |
+
<!--first div closed-->
|
29 |
+
<div class="combined-review-methods">
|
30 |
+
<div class="methods-shipping-payment">
|
31 |
+
<div class="payment-in">
|
32 |
+
<input id="opcheckout-canShip" type="hidden" value="<?php echo $this->canShip() ? 1 : 0; ?>"/>
|
33 |
+
<?php if ($this->canShip()): ?>
|
34 |
+
<div class="shipping-method-step">
|
35 |
+
<div class="stap-heading">
|
36 |
+
<span class="step-count count<?php echo $stepCounter++; ?>">2</span>
|
37 |
+
<h2 class="checkout-steps"><?php echo $this->__('Shipping Method') ?></h2>
|
38 |
+
</div>
|
39 |
+
<div class="inner-wrap">
|
40 |
+
<form id="co-shipping-method-form" action="">
|
41 |
+
<div class="inner-box">
|
42 |
+
<div class="default-box" id="checkout-shipping-method-load">
|
43 |
+
<?php echo $this->getChildHtml('availablex') ?>
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
|
47 |
+
<div id="onepage-checkout-shipping-method-additional-load">
|
48 |
+
<?php echo $this->getChildHtml('additionalx') ?>
|
49 |
+
</div>
|
50 |
+
</form>
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
<?php endif; ?>
|
54 |
+
<div class="payment-method-step">
|
55 |
+
<div class="stap-heading">
|
56 |
+
<span class="step-count count<?php echo $stepCounter++; ?>">3</span>
|
57 |
+
<h2 class="checkout-steps"><?php echo $this->__('Payment Method') ?></h2>
|
58 |
+
</div>
|
59 |
+
<div class="inner-wrap">
|
60 |
+
<form action="" id="co-payment-form">
|
61 |
+
<div id="opcheckout-payment-method"><?php echo $this->getChildHtml('methodsx') ?></div>
|
62 |
+
<div class="tool-tip" id="payment-tool-tip" style="display:none;">
|
63 |
+
<div class="btn-close">
|
64 |
+
<a href="#" id="payment-tool-tip-close"><img src="<?php echo $this->getSkinUrl('onestepcheckout/images/btn_window_close.gif') ?>" alt="<?php echo $this->__('Close') ?>" /></a>
|
65 |
+
</div>
|
66 |
+
<div class="block-content">
|
67 |
+
<img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo $this->__('Card Verification Number Visual Reference') ?>" />
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
</form>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
+
</div>
|
74 |
+
|
75 |
+
<?php if (Mage::helper('onestepcheckout')->isCouponDiscountEnabled()): ?>
|
76 |
+
<div class="stap-in">
|
77 |
+
<span>
|
78 |
+
<?php echo $this->getChildHtml('coupanx'); ?>
|
79 |
+
</span>
|
80 |
+
</div>
|
81 |
+
<?php endif; ?>
|
82 |
+
</div>
|
83 |
+
<!--payment shipping method div end-->
|
84 |
+
<div class="review-order-onestep">
|
85 |
+
<div class="review-wrap">
|
86 |
+
<div class="stap-in">
|
87 |
+
<div class="stap-heading">
|
88 |
+
<h2 class=""><?php echo $this->__('Review Your Order') ?></h2>
|
89 |
+
</div>
|
90 |
+
<div class="inner-wrap">
|
91 |
+
<div class="review-main">
|
92 |
+
<div id="one-step-checkout-review"><?php echo $this->getChildHtml('infox') ?></div>
|
93 |
+
<?php
|
94 |
+
if (!$this->getAgreements()) {
|
95 |
+
|
96 |
+
} else {
|
97 |
+
?>
|
98 |
+
<form action="" id="checkout-agreements" onsubmit="return false;">
|
99 |
+
<ol class="checkout-agreements-ol">
|
100 |
+
<?php foreach ($this->getAgreements() as $_a): ?>
|
101 |
+
<li>
|
102 |
+
<div class="agreement-content"<?php echo ($_a->getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '') ?>>
|
103 |
+
<?php if ($_a->getIsHtml()): ?>
|
104 |
+
<?php echo $_a->getContent() ?>
|
105 |
+
<?php else: ?>
|
106 |
+
<?php echo nl2br($this->htmlEscape($_a->getContent())) ?>
|
107 |
+
<?php endif; ?>
|
108 |
+
</div>
|
109 |
+
<p class="agree">
|
110 |
+
<input type="checkbox" id="agreement-<?php echo $_a->getId() ?>" name="agreement[<?php echo $_a->getId() ?>]" value="1" />
|
111 |
+
<label for="agreement-<?php echo $_a->getId() ?>"><?php echo $_a->getCheckboxText() ?></label>
|
112 |
+
</p>
|
113 |
+
</li>
|
114 |
+
<?php endforeach ?>
|
115 |
+
</ol>
|
116 |
+
</form>
|
117 |
+
<?php } ?>
|
118 |
+
<?php if (Mage::helper('onestepcheckout')->isOrderCommentEnabled()): ?>
|
119 |
+
|
120 |
+
<ol class="checkout-agreements-ol">
|
121 |
+
<li>
|
122 |
+
<?php $_MAX_CHAR = Mage::getStoreConfig('onestepcheckout/order/onestepcheckout_order_comment_length'); ?>
|
123 |
+
<?php
|
124 |
+
$_msg = '';
|
125 |
+
$flag = false;
|
126 |
+
?>
|
127 |
+
<?php if ($_MAX_CHAR != '' && $_MAX_CHAR != 0): ?>
|
128 |
+
<?php $flag = true; ?>
|
129 |
+
<?php $_msg = $this->__('Maximum Character(s):' . $_MAX_CHAR); ?>
|
130 |
+
<?php endif; ?>
|
131 |
+
<label for="opcheckout_order_comment"><?php echo $this->__('Your Comment for this Order. ') ?></label>
|
132 |
+
<br/><textarea name="opcheckout-order-comment" id="opcheckout_order_comment" class="opcheckout_order_comment"></textarea>
|
133 |
+
<?php echo $_msg ? $_msg : '' ?>
|
134 |
+
<span id="comment_count_left"></span>
|
135 |
+
</li>
|
136 |
+
</ol>
|
137 |
+
<script type="text/javascript">
|
138 |
+
<?php if ($flag): ?>
|
139 |
+
var MAX_CHAR = '<?php echo $_MAX_CHAR; ?>';
|
140 |
+
var msg = '<?php echo $this->__('Character Left: ') ?>';
|
141 |
+
$('comment_count_left').innerHTML = msg + MAX_CHAR;
|
142 |
+
<?php endif; ?>
|
143 |
+
$('opcheckout_order_comment').observe('keyup', function() {
|
144 |
+
<?php if ($flag): ?>
|
145 |
+
var len = $(this).value.length;
|
146 |
+
if (len > MAX_CHAR) {
|
147 |
+
$(this).value = $(this).value.substring(0, MAX_CHAR);
|
148 |
+
}
|
149 |
+
$('comment_count_left').innerHTML = msg + (MAX_CHAR - $(this).value.length);
|
150 |
+
<?php endif; ?>
|
151 |
+
var commentvalue=$(this).value;
|
152 |
+
$('hidden_onestepcheckout_order_comment').value = commentvalue;
|
153 |
+
});
|
154 |
+
</script>
|
155 |
+
|
156 |
+
<?php endif; ?>
|
157 |
+
|
158 |
+
</div>
|
159 |
+
</div>
|
160 |
+
|
161 |
+
<?php if (Mage::helper('onestepcheckout')->isAllowedNewsletterSubscription()): ?>
|
162 |
+
|
163 |
+
<div class="opcheckout-newsletter-subscribe">
|
164 |
+
<input type="checkbox" name="subscribe_to_newsletter" id="subscribe_to_newsletter" value=""/>
|
165 |
+
<label for="subscribe_to_newsletter"><?php echo $this->__('Subscribe me for newsletter.') ?></label>
|
166 |
+
</div>
|
167 |
+
|
168 |
+
<?php if (Mage::helper('onestepcheckout')->isNewsletterSubscriptionChecked()): ?>
|
169 |
+
<script type="text/javascript">
|
170 |
+
$('subscribe_to_newsletter').checked = true;
|
171 |
+
$('hidden_newsletter_subscription').value = 1;
|
172 |
+
</script>
|
173 |
+
<?php endif; ?>
|
174 |
+
<script tytype="text/javascript">
|
175 |
+
$('subscribe_to_newsletter').observe('change', function() {
|
176 |
+
if ($('subscribe_to_newsletter').checked == true) {
|
177 |
+
$('hidden_newsletter_subscription').value = 1;
|
178 |
+
} else {
|
179 |
+
$('hidden_newsletter_subscription').value = 0;
|
180 |
+
}
|
181 |
+
});
|
182 |
+
</script>
|
183 |
+
<?php endif; ?>
|
184 |
+
<?php if (Mage::getStoreConfigFlag('onestepcheckout/order/enable_cart_link')): ?>
|
185 |
+
|
186 |
+
<div valign="top" class="opcheckout-newsletter-subscribe">
|
187 |
+
<?php echo $this->__('Forgot an Item?') ?> <a href="<?php echo $this->getUrl('checkout/cart') ?>"><?php echo $this->__('Edit Your Cart') ?></a>
|
188 |
+
</div>
|
189 |
+
|
190 |
+
<?php endif; ?>
|
191 |
+
|
192 |
+
<div class="button-set">
|
193 |
+
<button id="onestep-place-order" class="onestep-order-button button" style="text-align: center" onclick="checkout.save();"><span>Place Order</span></button>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
</div>
|
197 |
+
</div>
|
198 |
+
<!--review div closed-->
|
199 |
+
</div>
|
200 |
+
<!--second div closed-->
|
201 |
+
</div>
|
202 |
+
</div>
|
203 |
+
<script type="text/javascript">
|
204 |
+
//<![CDATA[
|
205 |
+
var payment = new Payment('co-payment-form', '<?php echo $this->getUrl('onestepcheckout/onepage/savePayment', array('_secure' => true)) ?>');
|
206 |
+
payment.init();
|
207 |
+
payment.currentMethod = "<?php echo $this->getChild('methodsx')->getSelectedMethodCode() ?>";
|
208 |
+
//]]>
|
209 |
+
</script>
|
210 |
+
<script type="text/javascript">var shippingMethod = new ShippingMethodStep('co-shipping-method-form', "<?php echo $this->getUrl('opcheckout/onepage/saveShippingMethod', array('_secure' => true)) ?>");</script>
|
211 |
+
<script type="text/javascript">
|
212 |
+
var billingForm = $('co-billing-form');
|
213 |
+
var shippingForm = $('co-shipping-form');
|
214 |
+
var shippingMethodForm = $('co-shipping-method-form');
|
215 |
+
var paymentForm = $('co-payment-form');
|
216 |
+
var checkoutCommentForm = $('checkout-order-comment');
|
217 |
+
var agreementsForm = $('checkout-agreements');
|
218 |
+
if (canShip()) {
|
219 |
+
var allForms = ((agreementsForm == null || agreementsForm == undefined) ? [billingForm, shippingForm, shippingMethodForm, paymentForm] : [billingForm, shippingForm, shippingMethodForm, paymentForm, agreementsForm]);
|
220 |
+
} else {
|
221 |
+
var allForms = ((agreementsForm == null || agreementsForm == undefined) ? [billingForm, paymentForm] : [billingForm, paymentForm, agreementsForm]);
|
222 |
+
}
|
223 |
+
var checkout = new CheckoutMain(allForms);
|
224 |
+
var billingStep = new Billing(billingForm, '<?php echo $this->getUrl('onestepcheckout/onepage/getAddress', array('_secure' => true)) ?>address/', '<?php echo $this->getUrl('onestepcheckout/onepage/saveBillingStep', array('_secure' => true)) ?>');
|
225 |
+
var shippingStep = new ShippingStep(shippingForm, "<?php echo $this->getUrl('onestepcheckout/onepage/saveShippingStep', array('_secure' => true)) ?>", "<?php echo $this->getUrl('onestepcheckout/onepage/shippingMethod', array('_secure' => true)) ?>");
|
226 |
+
var payment = new Payment(paymentForm, "<?php echo $this->getUrl('onestepcheckout/onepage/savePayment', array('_secure' => true)) ?>", "<?php echo $this->getUrl('onestepcheckout/onepage/paymentmethod', array('_secure' => true)) ?>");
|
227 |
+
billing = billingStep;
|
228 |
+
shipping = shippingStep;
|
229 |
+
billingStep.save();
|
230 |
+
var reviewStep = new ReviewStep("<?php echo $this->getUrl('onestepcheckout/onepage/review', array('_secure' => true)) ?>");
|
231 |
+
var shippingMethodStep = new ShippingMethodStep(shippingMethodForm, "<?php echo $this->getUrl('onestepcheckout/onepage/saveShippingMethod', array('_secure' => true)) ?>");
|
232 |
+
var reviewFinal = new ReviewFinal("<?php echo $this->getUrl('onestepcheckout/onepage/saveOrderCustom', array('_secure' => true)) ?>", "<?php echo $this->getUrl('onestepcheckout/onepage/success', array('_secure' => true)) ?>", agreementsForm);
|
233 |
+
|
234 |
+
</script>
|
235 |
+
<script type="text/javascript" language="javascript">
|
236 |
+
/*
|
237 |
+
*
|
238 |
+
* @param {type} flag
|
239 |
+
* @returns {synchronized billing and shipping address }
|
240 |
+
*/
|
241 |
+
if ($('billing:use_for_shipping_yes') && $('billing:use_for_shipping_yes').checked == true) {
|
242 |
+
Event.observe($('billing-address-select'), 'change', function() {
|
243 |
+
syncShipping(true);
|
244 |
+
});
|
245 |
+
}
|
246 |
+
function syncWithShipping(flag) {
|
247 |
+
resetShippingForm(flag);
|
248 |
+
checkout.setShippingDifferent('wrapper-shipping-div', flag);
|
249 |
+
shippingStep.setSameAsBilling(flag);
|
250 |
+
if (flag) {
|
251 |
+
billingStep.save();
|
252 |
+
}
|
253 |
+
}
|
254 |
+
function syncShipping(flag) {
|
255 |
+
if ($('billing:use_for_shipping_yes') && $('billing:use_for_shipping_yes').checked == true) {
|
256 |
+
if (($('shipping:country_id').value != $('billing:country_id').value) || $('shipping:region_id').value != $('billing:region_id').value || $('shipping:region').value != $('billing:region').value || $('shipping:city').value != $('billing:city').value || $('shipping:postcode').value != $('billing:postcode').value) {
|
257 |
+
$('shipping:country_id').value = $('billing:country_id').value;
|
258 |
+
shippingStep.setSameAsBilling(true);
|
259 |
+
billingStep.save();
|
260 |
+
} else {
|
261 |
+
$('shipping:country_id').value = $('billing:country_id').value;
|
262 |
+
shippingStep.setSameAsBilling(true);
|
263 |
+
}
|
264 |
+
} else {
|
265 |
+
if (flag) {
|
266 |
+
billingStep.save();
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}
|
270 |
+
function getShippingAndTax() {
|
271 |
+
billingStep.save();
|
272 |
+
}
|
273 |
+
function getShippingAndTaxWithFlag(flag) {
|
274 |
+
if (flag) {
|
275 |
+
billingStep.save();
|
276 |
+
}
|
277 |
+
}
|
278 |
+
if ($('shipping-address-select')) {
|
279 |
+
$('shipping-address-select').observe('change', function() {
|
280 |
+
billingStep.save();
|
281 |
+
});
|
282 |
+
}
|
283 |
+
/*
|
284 |
+
*
|
285 |
+
* @ reset shipping form when check box unchecked.
|
286 |
+
*/
|
287 |
+
function resetShippingForm(flag) {
|
288 |
+
if (!flag) {
|
289 |
+
allNodes = $$('#wrapper-shipping-div input[type=text]');
|
290 |
+
for (i = 0; i < allNodes.length; i++) {
|
291 |
+
allNodes[i].value = '';
|
292 |
+
}
|
293 |
+
}
|
294 |
+
}
|
295 |
+
</script>
|
app/design/frontend/base/default/template/onestepcheckout/sales/order/view.phtml
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package base_default
|
23 |
+
* @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<div class="order-items order-details">
|
28 |
+
<?php if ($this->helper('giftmessage/message')->getIsMessagesAvailable('items', $this->getOrder())): ?>
|
29 |
+
<script type="text/javascript">
|
30 |
+
//<![CDATA[
|
31 |
+
function giftMessageToogle(giftMessageIdentifier)
|
32 |
+
{
|
33 |
+
var link = $('order-item-gift-message-link-'+giftMessageIdentifier);
|
34 |
+
var container = $('order-item-gift-message-'+giftMessageIdentifier);
|
35 |
+
var row = $('order-item-row-'+giftMessageIdentifier);
|
36 |
+
if(link.expanded) {
|
37 |
+
link.expanded = false;
|
38 |
+
link.removeClassName('expanded');
|
39 |
+
if(container.hasClassName('last')) {
|
40 |
+
row.addClassName('last');
|
41 |
+
}
|
42 |
+
container.hide();
|
43 |
+
} else {
|
44 |
+
link.expanded = true;
|
45 |
+
link.addClassName('expanded');
|
46 |
+
if(container.hasClassName('last')) {
|
47 |
+
row.removeClassName('last');
|
48 |
+
}
|
49 |
+
container.show();
|
50 |
+
}
|
51 |
+
|
52 |
+
return false;
|
53 |
+
}
|
54 |
+
//]]>
|
55 |
+
</script>
|
56 |
+
<?php endif; ?>
|
57 |
+
<?php $_order = $this->getOrder() ?>
|
58 |
+
<?php if ($_order->getShippingArrivalDate()!=''){ ?>
|
59 |
+
<div class="delivery-date col2-set order-info-box">
|
60 |
+
<h2 class="table-caption"><?php echo $this->__('Delivery Date Information') ?></h2>
|
61 |
+
<?php
|
62 |
+
$date_format='d/M/Y';
|
63 |
+
$date_format.=" ,g:i a";
|
64 |
+
echo "<strong>Shipping Arrival Date :- </strong>".$currentDate = date ($date_format,strtotime($_order->getShippingArrivalDate()));
|
65 |
+
?>
|
66 |
+
</div>
|
67 |
+
<?php } ?>
|
68 |
+
<?php if ($_order->getOrderComment()!=''):?>
|
69 |
+
<div class="order-comments-box col2-set order-info-box">
|
70 |
+
<h2 class="table-caption"><?php echo $this->__('Order Comment Details') ?></h2>
|
71 |
+
<?php
|
72 |
+
echo "<strong>Order Comment:- </strong>".$_order->getOrderComment();
|
73 |
+
?>
|
74 |
+
</div>
|
75 |
+
<?php endif; ?>
|
76 |
+
<h2 class="table-caption"><?php echo $this->__('Items Ordered') ?>
|
77 |
+
<?php if ($_order->getTracksCollection()->count()) : ?>
|
78 |
+
<span class="separator">|</span> <a href="#" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','top=0,left=0,width=800,height=600,resizable=yes,scrollbars=yes'); return false;" title="<?php echo $this->__('Track your order') ?>"><?php echo $this->__('Track your order') ?></a>
|
79 |
+
<?php endif; ?>
|
80 |
+
</h2>
|
81 |
+
|
82 |
+
<?php echo $this->getChildHtml('order_items') ?>
|
83 |
+
|
84 |
+
<?php if($this->helper('giftmessage/message')->getIsMessagesAvailable('order', $_order) && $_order->getGiftMessageId()): ?>
|
85 |
+
<div class="order-additional order-gift-message">
|
86 |
+
<h2 class="sub-title"><?php echo $this->__('Gift Message for This Order') ?></h2>
|
87 |
+
<?php $_giftMessage=$this->helper('giftmessage/message')->getGiftMessageForEntity($_order); ?>
|
88 |
+
<dl class="gift-message">
|
89 |
+
<dt><strong><?php echo $this->__('From:') ?></strong> <?php echo $this->htmlEscape($_giftMessage->getSender()) ?></dt>
|
90 |
+
<dt><strong><?php echo $this->__('To:') ?></strong> <?php echo $this->htmlEscape($_giftMessage->getRecipient()) ?></dt>
|
91 |
+
<dd><?php echo $this->helper('giftmessage/message')->getEscapedGiftMessage($_order) ?></dd>
|
92 |
+
</dl>
|
93 |
+
</div>
|
94 |
+
<?php endif; ?>
|
95 |
+
<?php $_history = $this->getOrder()->getVisibleStatusHistory() ?>
|
96 |
+
<?php if (count($_history)): ?>
|
97 |
+
<div class="order-additional order-comments">
|
98 |
+
<h2 class="sub-title"><?php echo $this->__('About Your Order') ?></h2>
|
99 |
+
<dl class="order-about">
|
100 |
+
<?php foreach ($_history as $_historyItem): ?>
|
101 |
+
<dt><?php echo $this->formatDate($_historyItem->getCreatedAtStoreDate(), 'medium', true) ?></dt>
|
102 |
+
<dd><?php echo $this->escapeHtml($_historyItem->getComment()) ?></dd>
|
103 |
+
<?php endforeach; ?>
|
104 |
+
</dl>
|
105 |
+
</div>
|
106 |
+
<?php endif; ?>
|
107 |
+
<div class="buttons-set">
|
108 |
+
<p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>« </small><?php echo $this->getBackTitle() ?></a></p>
|
109 |
+
</div>
|
110 |
+
</div>
|
app/etc/modules/Mageguru_Onestepcheckout.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Mageguru_Onestepcheckout>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<version>0.0.1</version>
|
8 |
+
</Mageguru_Onestepcheckout>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>MageguruOneStepCheckout</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>OneStepCheckout simplifies the checkout process of your Store.</summary>
|
10 |
+
<description>Checking out is often the most complicated part of placing an order online, and many users end up abandoning their order. Some customers will be motivated enough to purchase regardless of how difficult it is - but others will be lost due to check-out complexity. OneStepCheckout greatly simplifies this process, leading to an immediate increase in sales.</description>
|
11 |
+
<notes>OneStepCheckout simplifies the checkout process of your Store.
|
12 |
+

|
13 |
+
Checking out is often the most complicated part of placing an order online, and many users end up abandoning their order. Some customers will be motivated enough to purchase regardless of how difficult it is - but others will be lost due to check-out complexity. OneStepCheckout greatly simplifies this process, leading to an immediate increase in sales.</notes>
|
14 |
+
<authors><author><name>developer</name><user>developer</user><email>mageguruindia@gmail.com</email></author></authors>
|
15 |
+
<date>2016-01-15</date>
|
16 |
+
<time>17:31:39</time>
|
17 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Mageguru_Onestepcheckout.xml" hash="6ada52ba29135a7aaecd7745be0d56c8"/></dir></target><target name="magecommunity"><dir name="Mageguru"><dir name="Onestepcheckout"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><dir name="View"><file name="Opcheckoutcomment.php" hash="0733439a04060716b4cd7e82e61a8aca"/></dir></dir></dir></dir><dir name="Email"><file name="Info.php" hash="142295e0fb29f7fd7d149c21d9e63d18"/></dir><dir name="Onepage"><file name="Abstract.php" hash="8535a5524ed64000f9da5a8dae29484f"/><dir name="Shipping"><dir name="Method"><file name="Available.php" hash="c2502b327d30fe746519b0c903c65945"/></dir></dir></dir><file name="Onepage.php" hash="982ad71c288252b266aa82bac0b109c1"/><dir name="Sales"><dir name="Order"><file name="View.php" hash="718e0d13ec74e4a05c2f5552d9258b88"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="71f2aa76a2d439453b9707421d53e2e3"/></dir><dir name="Model"><dir name="Paypal"><dir name="Api"><file name="Nvp.php" hash="7e964c90854f9db85768f9c29851a2dd"/></dir></dir><dir name="Type"><file name="Onepage.php" hash="509f668a686e0ad8c0570858676c436c"/></dir></dir><dir name="controllers"><file name="OnepageController.php" hash="c4c0f9c882f90b47cac8a4eedf5d0ea7"/></dir><dir name="etc"><file name="config.xml" hash="af22bd61521817607a46b3814a432a33"/><file name="system.xml" hash="3cef66508167ceee1b011701e8070619"/></dir><dir name="sql"><dir name="onestepcheckout_setup"><file name="mysql4-install-0.1.0.php" hash="adbd6830d1426e393f0229d17eacd531"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="a13dfd04d6eeef65adf326fa73df81f9"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="onestepcheckout.xml" hash="de74c36220333d9153f1bd1d44c66861"/></dir><dir name="template"><dir name="onestepcheckout"><dir name="onepage"><file name="billing.phtml" hash="09085f5c853cddb0be092c87a58f8146"/><dir name="coupan"><file name="coupan.phtml" hash="816ac45bbdae65f782ca1e2b730e91c4"/></dir><dir name="delivery_date"><file name="deliverydate.phtml" hash="aaa1d98942f3e55d6d463627d2d19e23"/><dir name="js"><file name="calendar.phtml" hash="1b4d289ed09552c2a39554e257e1724c"/></dir></dir><dir name="email"><file name="comment.phtml" hash="e601ce415bc23f2e2eceb072887881fe"/></dir><file name="login.phtml" hash="392f501f754684a31db5fb3f72b7714e"/><dir name="payment"><file name="methods.phtml" hash="cb9fdc2e260e7e1250fdf1c57964555c"/></dir><dir name="review"><file name="info.phtml" hash="73a3e6dc500ef967fe699e93411d2bb5"/><file name="item.phtml" hash="770c0f2bb04138d7d7a1f57d455762fb"/></dir><file name="shipping.phtml" hash="2f949b666111705e697a9a2913e4aeac"/><dir name="shipping_method"><file name="additional.phtml" hash="3c760ab6366bd650f8f83da34a90bc83"/><file name="available.phtml" hash="84964f6e2c4019d8b0f1aca182c11980"/></dir><file name="shipping_method.phtml" hash="62cc4fdba21ee700579a594942c773d1"/></dir><file name="onestepcheckout.phtml" hash="125ecf2b933a29fd9fb9c09773a19de5"/><dir name="sales"><dir name="order"><file name="view.phtml" hash="74cffae1f23fe4e8faa8bed932ec7146"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="onestepcheckout"><dir name="css"><file name="onestepcheckout.css" hash="7ff28c4166764bc79345f391b7ee1163"/></dir><dir name="images"><file name="ajax-loader.gif" hash="25148316277a51b68f03c13283fb1aec"/></dir><dir name="js"><file name="checkout-innner-modifications.js" hash="8979e64490a181eb903ebcb2225448e7"/><file name="onestepcheckout.js" hash="5d95b873fae8fd9ab33f043bb728ab0c"/><file name="osc-calendar-setup.js" hash="20813ef90706f77d936d4187af58ce85"/></dir></dir></dir></dir></dir></target></contents>
|
18 |
+
<compatible/>
|
19 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
20 |
+
</package>
|
skin/frontend/base/default/onestepcheckout/css/onestepcheckout.css
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.checkout-onepage-index .col-main {
|
2 |
+
width: 100% !important;
|
3 |
+
}
|
4 |
+
|
5 |
+
.main-wrapper {
|
6 |
+
/*margin: 0 auto;*/
|
7 |
+
/*max-width: 980px;*/
|
8 |
+
min-width: 320px;
|
9 |
+
padding-left: 20px;
|
10 |
+
padding-right: 20px;
|
11 |
+
width: 100% !important;
|
12 |
+
}
|
13 |
+
|
14 |
+
.main-wrapper div#onestep-loader{
|
15 |
+
z-index: 1000;
|
16 |
+
border: none;
|
17 |
+
margin: 0px;
|
18 |
+
padding: 0px;
|
19 |
+
width: 100%;
|
20 |
+
height: 100%;
|
21 |
+
top: 0px;
|
22 |
+
left: 0px;
|
23 |
+
position: absolute;
|
24 |
+
text-align: center;
|
25 |
+
}
|
26 |
+
|
27 |
+
.main-wrapper div#sub-loader{
|
28 |
+
z-index: 1000;
|
29 |
+
border: none;
|
30 |
+
margin: 0px;
|
31 |
+
padding: 0px;
|
32 |
+
width: 100%;
|
33 |
+
height: 100%;
|
34 |
+
top: 0px;
|
35 |
+
left: 0px;
|
36 |
+
background-color: rgb(0 , 0, 0);
|
37 |
+
|
38 |
+
/*background: transparent;*/
|
39 |
+
opacity: 0.4;
|
40 |
+
position: fixed;
|
41 |
+
text-align: center;
|
42 |
+
}
|
43 |
+
|
44 |
+
.main-wrapper div.first-address-wrap{
|
45 |
+
width: 40%;
|
46 |
+
box-sizing: border-box;
|
47 |
+
float: left;
|
48 |
+
margin-left: 2%;
|
49 |
+
min-height: 1px;
|
50 |
+
}
|
51 |
+
|
52 |
+
.main-wrapper div.combined-review-methods{
|
53 |
+
width: 55%;
|
54 |
+
box-sizing: border-box;
|
55 |
+
float: left;
|
56 |
+
margin-left: 2%;
|
57 |
+
min-height: 1px;
|
58 |
+
}
|
59 |
+
|
60 |
+
.main-wrapper div.combined-review-methods div.methods-shipping-payment{
|
61 |
+
min-width: 0;
|
62 |
+
padding-left: 0;
|
63 |
+
padding-right: 0;
|
64 |
+
width: 100%;
|
65 |
+
margin: 0;
|
66 |
+
}
|
67 |
+
|
68 |
+
div.shipping-method-step{
|
69 |
+
width: 40%;
|
70 |
+
margin-left: 0;
|
71 |
+
box-sizing: border-box;
|
72 |
+
float: left;
|
73 |
+
min-height: 1px;
|
74 |
+
}
|
75 |
+
|
76 |
+
div.payment-method-step{
|
77 |
+
width: 52%;
|
78 |
+
margin-left: 2%;
|
79 |
+
float: left;
|
80 |
+
min-height: 1px;
|
81 |
+
box-sizing: border-box;
|
82 |
+
}
|
83 |
+
|
84 |
+
.payment-methods .form-list{
|
85 |
+
max-width: 125% !important;
|
86 |
+
}
|
87 |
+
|
88 |
+
textarea.opcheckout_order_comment{
|
89 |
+
width: 99% !important;
|
90 |
+
}
|
91 |
+
|
92 |
+
div.stap-heading span.step-count{
|
93 |
+
float: left;
|
94 |
+
display: none;
|
95 |
+
/*margin-right: 12px; */
|
96 |
+
/*font-size: 20px;*/
|
97 |
+
/*border-radius: 20px;*/
|
98 |
+
/*background: green;*/
|
99 |
+
}
|
100 |
+
|
101 |
+
div.stap-heading h2{
|
102 |
+
color:#3399cc;
|
103 |
+
}
|
104 |
+
|
105 |
+
img.loader-checkout{
|
106 |
+
position: fixed;
|
107 |
+
top: 50%;
|
108 |
+
left: 50%;
|
109 |
+
margin-top: -50px;
|
110 |
+
margin-left: -100px;
|
111 |
+
height: 80px;
|
112 |
+
}
|
skin/frontend/base/default/onestepcheckout/images/ajax-loader.gif
ADDED
Binary file
|
skin/frontend/base/default/onestepcheckout/js/checkout-innner-modifications.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// document.getElementById('first-step-checkout').style.visibility='hidden'
|
2 |
+
|
3 |
+
function toggle_methods(process_id){
|
4 |
+
if(process_id=='first-step-checkout'){
|
5 |
+
document.getElementById('second-step-checkout').style.display='none';
|
6 |
+
document.getElementById('first-step-checkout').style.display='block';
|
7 |
+
}else if(process_id=='second-step-checkout'){
|
8 |
+
document.getElementById('first-step-checkout').style.display='none';
|
9 |
+
document.getElementById('second-step-checkout').style.display='block';
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
skin/frontend/base/default/onestepcheckout/js/onestepcheckout.js
ADDED
@@ -0,0 +1,744 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var CheckoutMain = Class.create();
|
2 |
+
CheckoutMain.prototype = {
|
3 |
+
initialize: function(allForms) {
|
4 |
+
this.allForms = allForms;
|
5 |
+
},
|
6 |
+
setLoadWaiting: function(flag) {
|
7 |
+
//$('onestep-loader').style.height = $('onestepcheckout-wrapper').clientHeight + 'px';
|
8 |
+
document.getElementById('onestep-loader').style.display = ((flag) ? 'block' : 'none');
|
9 |
+
document.getElementById('sub-loader').style.display = ((flag) ? 'block' : 'none');
|
10 |
+
},
|
11 |
+
save: function() {
|
12 |
+
var validators = new Array();
|
13 |
+
for (i = 0; i < this.allForms.length; i++) {
|
14 |
+
validators[i] = new Validation(this.allForms[i]);
|
15 |
+
}
|
16 |
+
if (validators[0].validate() && validators[1].validate() && this.shippingMethodValidate() && this.paymentMethodValidate() && (validators[3] ? validators[3].validate() : true)) {
|
17 |
+
reviewFinal.save();
|
18 |
+
}
|
19 |
+
},
|
20 |
+
setShippingDifferent: function(divId, isDiff) {
|
21 |
+
document.getElementById(divId).style.display = (isDiff ? 'none' : 'block');
|
22 |
+
},
|
23 |
+
setStepResponse: function(response) {
|
24 |
+
if (response.update_section) {
|
25 |
+
if ($('checkout-' + response.update_section.name + '-load')) {
|
26 |
+
$('checkout-' + response.update_section.name + '-load').update(response.update_section.html);
|
27 |
+
}
|
28 |
+
return true;
|
29 |
+
}
|
30 |
+
return false;
|
31 |
+
},
|
32 |
+
loadReview: function() {
|
33 |
+
|
34 |
+
},
|
35 |
+
shippingMethodValidate: function() {
|
36 |
+
if (!canShip()) {
|
37 |
+
return true;
|
38 |
+
}
|
39 |
+
var methods = document.getElementsByName('shipping_method');
|
40 |
+
if (methods.length == 0) {
|
41 |
+
alert(Translator.translate('Your order can not be completed at this time as there is no shipping methods available for it. Please make neccessary changes in your shipping address.'));
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
for (var i = 0; i < methods.length; i++) {
|
46 |
+
if (methods[i].checked) {
|
47 |
+
return true;
|
48 |
+
}
|
49 |
+
}
|
50 |
+
alert(Translator.translate('Please specify shipping method.'));
|
51 |
+
return false;
|
52 |
+
},
|
53 |
+
paymentMethodValidate: function() {
|
54 |
+
var methods = document.getElementsByName('payment[method]');
|
55 |
+
if (methods.length == 0) {
|
56 |
+
alert(Translator.translate('Your order can not be completed at this time as there is no payment methods available for it.'));
|
57 |
+
return false;
|
58 |
+
}
|
59 |
+
for (var i = 0; i < methods.length; i++) {
|
60 |
+
if (methods[i].checked) {
|
61 |
+
return true;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
alert(Translator.translate('Please specify payment method.'));
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
// billing
|
69 |
+
var Billing = Class.create();
|
70 |
+
Billing.prototype = {
|
71 |
+
initialize: function(form, addressUrl, saveUrl) {
|
72 |
+
this.form = form;
|
73 |
+
if ($(this.form)) {
|
74 |
+
$(this.form).observe('submit', function(event) {
|
75 |
+
this.save();
|
76 |
+
Event.stop(event);
|
77 |
+
}.bind(this));
|
78 |
+
}
|
79 |
+
this.addressUrl = addressUrl;
|
80 |
+
this.saveUrl = saveUrl;
|
81 |
+
this.onAddressLoad = this.fillForm.bindAsEventListener(this);
|
82 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
83 |
+
/*this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);*/
|
84 |
+
this.onFail = this.ajaxFailed.bindAsEventListener(this);
|
85 |
+
},
|
86 |
+
setAddress: function(addressId) {
|
87 |
+
if (addressId) {
|
88 |
+
request = new Ajax.Request(
|
89 |
+
this.addressUrl + addressId,
|
90 |
+
{
|
91 |
+
method: 'get',
|
92 |
+
onSuccess: this.onAddressLoad,
|
93 |
+
onFailure: this.onFail
|
94 |
+
}
|
95 |
+
);
|
96 |
+
}
|
97 |
+
else {
|
98 |
+
this.fillForm(false);
|
99 |
+
}
|
100 |
+
},
|
101 |
+
newAddress: function(isNew) {
|
102 |
+
if (isNew) {
|
103 |
+
this.resetSelectedAddress();
|
104 |
+
Element.show('billing-imformation-fields');
|
105 |
+
// arrElements = Form.getElements(this.form);
|
106 |
+
// for (var elemIndex in arrElements) {
|
107 |
+
// if (arrElements[elemIndex].id) {
|
108 |
+
// var fieldName = arrElements[elemIndex].id.replace(/^billing:/, '');
|
109 |
+
// if (fieldName != 'country_id'){
|
110 |
+
// arrElements[elemIndex].value = '';
|
111 |
+
// }
|
112 |
+
// }
|
113 |
+
// }
|
114 |
+
} else {
|
115 |
+
Element.hide('billing-imformation-fields');
|
116 |
+
}
|
117 |
+
billing.save();
|
118 |
+
},
|
119 |
+
resetSelectedAddress: function() {
|
120 |
+
var selectElement = $('billing-address-select')
|
121 |
+
if (selectElement) {
|
122 |
+
selectElement.value = '';
|
123 |
+
}
|
124 |
+
},
|
125 |
+
fillForm: function(transport) {
|
126 |
+
var elementValues = {};
|
127 |
+
if (transport && transport.responseText) {
|
128 |
+
try {
|
129 |
+
elementValues = eval('(' + transport.responseText + ')');
|
130 |
+
}
|
131 |
+
catch (e) {
|
132 |
+
elementValues = {};
|
133 |
+
}
|
134 |
+
}
|
135 |
+
else {
|
136 |
+
this.resetSelectedAddress();
|
137 |
+
}
|
138 |
+
arrElements = Form.getElements(this.form);
|
139 |
+
for (var elemIndex in arrElements) {
|
140 |
+
if (arrElements[elemIndex].id) {
|
141 |
+
var fieldName = arrElements[elemIndex].id.replace(/^billing:/, '');
|
142 |
+
arrElements[elemIndex].value = elementValues[fieldName] ? elementValues[fieldName] : '';
|
143 |
+
if (fieldName == 'country_id' && billingForm) {
|
144 |
+
billingForm.elementChildLoad(arrElements[elemIndex]);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
},
|
149 |
+
setUseForShipping: function(flag) {
|
150 |
+
$('shipping:same_as_billing').checked = flag;
|
151 |
+
},
|
152 |
+
save: function() {
|
153 |
+
checkout.setLoadWaiting('billing');
|
154 |
+
|
155 |
+
var request = new Ajax.Request(
|
156 |
+
this.saveUrl,
|
157 |
+
{
|
158 |
+
method: 'post',
|
159 |
+
onComplete: this.onComplete,
|
160 |
+
onSuccess: this.onSave,
|
161 |
+
onFailure: this.onFail,
|
162 |
+
parameters: Form.serialize(this.form)
|
163 |
+
}
|
164 |
+
);
|
165 |
+
},
|
166 |
+
resetLoadWaiting: function(transport) {
|
167 |
+
checkout.setLoadWaiting(false);
|
168 |
+
},
|
169 |
+
/**
|
170 |
+
This method recieves the AJAX response on success.
|
171 |
+
There are 3 options: error, redirect or html with shipping options.
|
172 |
+
*/
|
173 |
+
nextStep: function(transport) {
|
174 |
+
if (transport && transport.responseText) {
|
175 |
+
try {
|
176 |
+
response = eval('(' + transport.responseText + ')');
|
177 |
+
}
|
178 |
+
catch (e) {
|
179 |
+
response = {};
|
180 |
+
}
|
181 |
+
}
|
182 |
+
if (response.error) {
|
183 |
+
if ((typeof response.message) == 'string') {
|
184 |
+
alert(response.message);
|
185 |
+
} else {
|
186 |
+
if (window.billingRegionUpdater) {
|
187 |
+
billingRegionUpdater.update();
|
188 |
+
}
|
189 |
+
|
190 |
+
alert(response.message.join("\n"));
|
191 |
+
}
|
192 |
+
checkout.setLoadWaiting(false);
|
193 |
+
return false;
|
194 |
+
}
|
195 |
+
if ((response.goto_section == 'shipping' || response.goto_section == 'shipping_method') && checkout.setStepResponse(response)) {
|
196 |
+
}
|
197 |
+
checkout.setLoadWaiting(false);
|
198 |
+
if (response.goto_section == 'shipping') {
|
199 |
+
if (!canShip()) {
|
200 |
+
window.location = window.location;
|
201 |
+
} else {
|
202 |
+
shippingStep.save();
|
203 |
+
}
|
204 |
+
} else {
|
205 |
+
payment.loadPaymentMethods();
|
206 |
+
reviewStep.getReview();
|
207 |
+
}
|
208 |
+
},
|
209 |
+
ajaxFailed: function() {
|
210 |
+
alert('Ajax Failed!');
|
211 |
+
}
|
212 |
+
}
|
213 |
+
//Shipping
|
214 |
+
var ShippingStep = Class.create();
|
215 |
+
ShippingStep.prototype = {
|
216 |
+
initialize: function(shippingForm, saveUrl, methodsUrl) {
|
217 |
+
this.shippingForm = shippingForm
|
218 |
+
this.saveUrl = saveUrl;
|
219 |
+
this.methodsUrl = methodsUrl;
|
220 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
221 |
+
this.onFail = this.ajaxFailed.bindAsEventListener(this);
|
222 |
+
},
|
223 |
+
setSameAsBilling: function(flag) {
|
224 |
+
if (flag) {
|
225 |
+
this.syncWithBilling();
|
226 |
+
}
|
227 |
+
},
|
228 |
+
syncWithBilling: function() {
|
229 |
+
$('billing-address-select') && this.newAddress(!$('billing-address-select').value);
|
230 |
+
if (!$('billing-address-select') || !$('billing-address-select').value) {
|
231 |
+
arrElements = Form.getElements(this.shippingForm);
|
232 |
+
for (var elemIndex in arrElements) {
|
233 |
+
if (arrElements[elemIndex].id) {
|
234 |
+
var sourceField = $(arrElements[elemIndex].id.replace(/^shipping:/, 'billing:'));
|
235 |
+
if (sourceField) {
|
236 |
+
arrElements[elemIndex].value = sourceField.value;
|
237 |
+
}
|
238 |
+
}
|
239 |
+
}
|
240 |
+
shippingRegionUpdater.update();
|
241 |
+
$('shipping:region_id').value = $('billing:region_id').value;
|
242 |
+
$('shipping:region').value = $('billing:region').value;
|
243 |
+
} else {
|
244 |
+
$('shipping-address-select').value = $('billing-address-select').value;
|
245 |
+
}
|
246 |
+
},
|
247 |
+
save: function() {
|
248 |
+
checkout.setLoadWaiting(true);
|
249 |
+
var request = new Ajax.Request(
|
250 |
+
this.saveUrl,
|
251 |
+
{
|
252 |
+
method: 'post',
|
253 |
+
onComplete: this.onComplete,
|
254 |
+
onSuccess: this.onSave,
|
255 |
+
onFailure: this.onFail,
|
256 |
+
parameters: Form.serialize(this.shippingForm)
|
257 |
+
}
|
258 |
+
);
|
259 |
+
},
|
260 |
+
newAddress: function(isNew) {
|
261 |
+
if (isNew) {
|
262 |
+
this.resetSelectedAddress();
|
263 |
+
Element.show('shipping-imformation-fields');
|
264 |
+
} else {
|
265 |
+
Element.hide('shipping-imformation-fields');
|
266 |
+
}
|
267 |
+
shipping.setSameAsBilling(false);
|
268 |
+
|
269 |
+
},
|
270 |
+
resetSelectedAddress: function() {
|
271 |
+
var selectElement = $('shipping-address-select')
|
272 |
+
if (selectElement) {
|
273 |
+
selectElement.value = '';
|
274 |
+
}
|
275 |
+
},
|
276 |
+
nextStep: function(transport) {
|
277 |
+
if (transport && transport.responseText) {
|
278 |
+
try {
|
279 |
+
response = eval('(' + transport.responseText + ')');
|
280 |
+
}
|
281 |
+
catch (e) {
|
282 |
+
response = {};
|
283 |
+
}
|
284 |
+
}
|
285 |
+
if (response.error) {
|
286 |
+
if ((typeof response.message) == 'string') {
|
287 |
+
alert(response.message);
|
288 |
+
} else {
|
289 |
+
if (window.shippingRegionUpdater) {
|
290 |
+
shippingRegionUpdater.update();
|
291 |
+
}
|
292 |
+
alert(response.message.join("\n"));
|
293 |
+
}
|
294 |
+
checkout.setLoadWaiting(false);
|
295 |
+
return false;
|
296 |
+
}
|
297 |
+
if (checkout.setStepResponse(response)) {
|
298 |
+
}
|
299 |
+
checkout.setLoadWaiting(false);
|
300 |
+
payment.loadPaymentMethods();
|
301 |
+
reviewStep.getReview();
|
302 |
+
},
|
303 |
+
ajaxFailed: function() {
|
304 |
+
alert('Ajax Failed!!');
|
305 |
+
}
|
306 |
+
}
|
307 |
+
|
308 |
+
//Shipping Method
|
309 |
+
var ShippingMethodStep = Class.create();
|
310 |
+
ShippingMethodStep.prototype = {
|
311 |
+
initialize: function(shippingMethodForm, saveUrl) {
|
312 |
+
this.shippingMethodForm = shippingMethodForm
|
313 |
+
this.saveUrl = saveUrl;
|
314 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
315 |
+
this.onFail = this.ajaxFailed.bindAsEventListener(this);
|
316 |
+
},
|
317 |
+
save: function() {
|
318 |
+
checkout.setLoadWaiting(true);
|
319 |
+
var request = new Ajax.Request(
|
320 |
+
this.saveUrl,
|
321 |
+
{
|
322 |
+
method: 'post',
|
323 |
+
onComplete: this.onComplete,
|
324 |
+
onSuccess: this.onSave,
|
325 |
+
onFailure: this.onFail,
|
326 |
+
parameters: Form.serialize(this.shippingMethodForm)
|
327 |
+
}
|
328 |
+
);
|
329 |
+
|
330 |
+
},
|
331 |
+
nextStep: function(transport) {
|
332 |
+
if (transport && transport.responseText) {
|
333 |
+
try {
|
334 |
+
response = eval('(' + transport.responseText + ')');
|
335 |
+
}
|
336 |
+
catch (e) {
|
337 |
+
response = {};
|
338 |
+
}
|
339 |
+
}
|
340 |
+
if (response.redirect) {
|
341 |
+
location.href = response.redirect;
|
342 |
+
return;
|
343 |
+
}
|
344 |
+
if (response.error) {
|
345 |
+
alert(response.message);
|
346 |
+
return false;
|
347 |
+
}
|
348 |
+
checkout.setLoadWaiting(false);
|
349 |
+
reviewStep.getReview();
|
350 |
+
},
|
351 |
+
ajaxFailed: function() {
|
352 |
+
alert('Ajax Failed!!');
|
353 |
+
}
|
354 |
+
}
|
355 |
+
|
356 |
+
// payment
|
357 |
+
var Payment = Class.create();
|
358 |
+
Payment.prototype = {
|
359 |
+
initialize: function(form, saveUrl, actionUrl) {
|
360 |
+
this.form = form;
|
361 |
+
this.saveUrl = saveUrl;
|
362 |
+
this.actionUrl = actionUrl;
|
363 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
364 |
+
this.onLoad = this.setPaymentMethod.bindAsEventListener(this);
|
365 |
+
this.onFail = this.ajaxFailed.bindAsEventListener(this);
|
366 |
+
},
|
367 |
+
init: function() {
|
368 |
+
var elements = Form.getElements(this.form);
|
369 |
+
var method = null;
|
370 |
+
if (this.currentMethod && $('p_method_' + this.currentMethod)) {
|
371 |
+
$('p_method_' + this.currentMethod).checked = true;
|
372 |
+
}
|
373 |
+
for (var i = 0; i < elements.length; i++) {
|
374 |
+
if (elements[i].name == 'payment[method]') {
|
375 |
+
if (elements[i].checked) {
|
376 |
+
method = elements[i].value;
|
377 |
+
}
|
378 |
+
} else {
|
379 |
+
elements[i].disabled = true;
|
380 |
+
}
|
381 |
+
}
|
382 |
+
if (method)
|
383 |
+
this.switchMethod(method);
|
384 |
+
},
|
385 |
+
switchMethod: function(method) {
|
386 |
+
if (this.currentMethod && $('payment_form_' + this.currentMethod)) {
|
387 |
+
var form = $('payment_form_' + this.currentMethod);
|
388 |
+
form.style.display = 'none';
|
389 |
+
var elements = form.select('input', 'select', 'textarea');
|
390 |
+
for (var i = 0; i < elements.length; i++) {
|
391 |
+
elements[i].disabled = true;
|
392 |
+
}
|
393 |
+
}
|
394 |
+
if ($('payment_form_' + method)) {
|
395 |
+
var form = $('payment_form_' + method);
|
396 |
+
form.style.display = '';
|
397 |
+
var elements = form.select('input', 'select', 'textarea');
|
398 |
+
for (var i = 0; i < elements.length; i++)
|
399 |
+
elements[i].disabled = false;
|
400 |
+
}
|
401 |
+
if (method)
|
402 |
+
this.currentMethod = method;
|
403 |
+
},
|
404 |
+
validate: function() {
|
405 |
+
var methods = document.getElementsByName('payment[method]');
|
406 |
+
if (methods.length == 0) {
|
407 |
+
alert(Translator.translate('Your order can not be completed at this time as there is no payment methods available for it.'));
|
408 |
+
return false;
|
409 |
+
}
|
410 |
+
for (var i = 0; i < methods.length; i++) {
|
411 |
+
if (methods[i].checked) {
|
412 |
+
return true;
|
413 |
+
}
|
414 |
+
}
|
415 |
+
alert(Translator.translate('Please specify payment method.'));
|
416 |
+
return false;
|
417 |
+
},
|
418 |
+
save: function() {
|
419 |
+
var validator = new Validation(this.form);
|
420 |
+
if (this.validate() && validator.validate()) {
|
421 |
+
var request = new Ajax.Request(
|
422 |
+
this.saveUrl,
|
423 |
+
{
|
424 |
+
method: 'post',
|
425 |
+
onComplete: this.onComplete,
|
426 |
+
onSuccess: this.onSave,
|
427 |
+
onFailure: this.onFail,
|
428 |
+
parameters: Form.serialize(this.form)
|
429 |
+
}
|
430 |
+
);
|
431 |
+
} else {
|
432 |
+
alert('Payment Method validation fail.');
|
433 |
+
}
|
434 |
+
},
|
435 |
+
nextStep: function(transport) {
|
436 |
+
if (transport && transport.responseText) {
|
437 |
+
try {
|
438 |
+
response = eval('(' + transport.responseText + ')');
|
439 |
+
}
|
440 |
+
catch (e) {
|
441 |
+
response = {};
|
442 |
+
}
|
443 |
+
}
|
444 |
+
/*
|
445 |
+
* if there is an error in payment, need to show error message
|
446 |
+
*/
|
447 |
+
if (response.error) {
|
448 |
+
if (response.fields) {
|
449 |
+
var fields = response.fields.split(',');
|
450 |
+
for (var i = 0; i < fields.length; i++) {
|
451 |
+
var field = null;
|
452 |
+
if (field = $(fields[i])) {
|
453 |
+
Validation.ajaxError(field, response.error);
|
454 |
+
}
|
455 |
+
}
|
456 |
+
return;
|
457 |
+
}
|
458 |
+
alert(response.error);
|
459 |
+
return;
|
460 |
+
}
|
461 |
+
|
462 |
+
if (checkout.setStepResponse(response)) {
|
463 |
+
}
|
464 |
+
},
|
465 |
+
ajaxFailed: function() {
|
466 |
+
alert('Ajax Failed!!');
|
467 |
+
},
|
468 |
+
loadPaymentMethods: function() {
|
469 |
+
checkout.setLoadWaiting(true);
|
470 |
+
var request = new Ajax.Request(
|
471 |
+
this.actionUrl,
|
472 |
+
{
|
473 |
+
method: 'post',
|
474 |
+
onComplete: this.onComplete,
|
475 |
+
onSuccess: this.onLoad,
|
476 |
+
onFailure: this.onFail,
|
477 |
+
parameters: Form.serialize(this.form)
|
478 |
+
}
|
479 |
+
);
|
480 |
+
},
|
481 |
+
setPaymentMethod: function(transport) {
|
482 |
+
if (transport && transport.responseText) {
|
483 |
+
try {
|
484 |
+
response = eval('(' + transport.responseText + ')');
|
485 |
+
}
|
486 |
+
catch (e) {
|
487 |
+
response = {};
|
488 |
+
}
|
489 |
+
}
|
490 |
+
if (response.html) {
|
491 |
+
$('opcheckout-payment-method').update(response.html);
|
492 |
+
if (response.method) {
|
493 |
+
this.currentMethod = response.method;
|
494 |
+
}
|
495 |
+
this.init();
|
496 |
+
resetPaymentEvents();
|
497 |
+
checkout.setLoadWaiting(false);
|
498 |
+
}
|
499 |
+
}
|
500 |
+
}
|
501 |
+
|
502 |
+
//Review
|
503 |
+
var ReviewStep = Class.create();
|
504 |
+
ReviewStep.prototype = {
|
505 |
+
initialize: function(saveUrl) {
|
506 |
+
this.saveUrl = saveUrl;
|
507 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
508 |
+
this.onFail = this.ajaxFailed.bindAsEventListener(this);
|
509 |
+
},
|
510 |
+
getReview: function() {
|
511 |
+
checkout.setLoadWaiting(true);
|
512 |
+
var request = new Ajax.Request(
|
513 |
+
this.saveUrl,
|
514 |
+
{
|
515 |
+
method: 'post',
|
516 |
+
onComplete: this.onComplete,
|
517 |
+
onSuccess: this.onSave,
|
518 |
+
onFailure: this.onFail
|
519 |
+
}
|
520 |
+
);
|
521 |
+
//refresh cart on update
|
522 |
+
refreshCart();
|
523 |
+
},
|
524 |
+
nextStep: function(transport) {
|
525 |
+
$('one-step-checkout-review').update(transport.responseText);
|
526 |
+
checkout.setLoadWaiting(false);
|
527 |
+
},
|
528 |
+
ajaxFailed: function() {
|
529 |
+
alert('Ajax Failed!!');
|
530 |
+
},
|
531 |
+
isSuccess: false
|
532 |
+
}
|
533 |
+
|
534 |
+
var ReviewFinal = Class.create();
|
535 |
+
ReviewFinal.prototype = {
|
536 |
+
initialize: function(saveUrl, successUrl, agreementsForm) {
|
537 |
+
this.saveUrl = saveUrl;
|
538 |
+
this.successUrl = successUrl;
|
539 |
+
this.agreementsForm = agreementsForm;
|
540 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
541 |
+
this.onFail = this.ajaxFailed.bindAsEventListener(this);
|
542 |
+
},
|
543 |
+
save: function() {
|
544 |
+
checkout.setLoadWaiting(true);
|
545 |
+
var element = $('opcheckout_order_comment');
|
546 |
+
if (!element == null) {
|
547 |
+
$('hidden_opcheckout_order_comment').value = $('opcheckout_order_comment').value;
|
548 |
+
}
|
549 |
+
var params = '';
|
550 |
+
for (i = 0; i < checkout.allForms.length; i++) {
|
551 |
+
params = params + (params != '' ? '&' : '') + Form.serialize(checkout.allForms[i]);
|
552 |
+
}
|
553 |
+
|
554 |
+
params.save = true;
|
555 |
+
var request = new Ajax.Request(
|
556 |
+
this.saveUrl,
|
557 |
+
{
|
558 |
+
method: 'post',
|
559 |
+
parameters: params,
|
560 |
+
onComplete: this.onComplete,
|
561 |
+
onSuccess: this.onSave,
|
562 |
+
onFailure: this.onFail
|
563 |
+
});
|
564 |
+
},
|
565 |
+
nextStep: function(transport) {
|
566 |
+
//alert('Review Final:'+transport.responseText);
|
567 |
+
if (transport && transport.responseText) {
|
568 |
+
try {
|
569 |
+
response = eval('(' + transport.responseText + ')');
|
570 |
+
}
|
571 |
+
catch (e) {
|
572 |
+
response = {};
|
573 |
+
}
|
574 |
+
if (response.redirect) {
|
575 |
+
location.href = response.redirect;
|
576 |
+
return;
|
577 |
+
}
|
578 |
+
if (response.success) {
|
579 |
+
this.isSuccess = true;
|
580 |
+
window.location = this.successUrl;
|
581 |
+
}
|
582 |
+
else {
|
583 |
+
if (!canShip() && response.is_virtual == 0) {
|
584 |
+
window.location = window.location;
|
585 |
+
} else {
|
586 |
+
var msg = response.error_messages;
|
587 |
+
if (typeof (msg) == 'object') {
|
588 |
+
msg = msg.join("\n");
|
589 |
+
}
|
590 |
+
alert(msg);
|
591 |
+
}
|
592 |
+
}
|
593 |
+
}
|
594 |
+
checkout.setLoadWaiting(false);
|
595 |
+
},
|
596 |
+
ajaxFailed: function() {
|
597 |
+
alert('Ajax Failed!!');
|
598 |
+
$('onestep-place-order').onclick = 'checkout.save()';
|
599 |
+
},
|
600 |
+
isSuccess: false
|
601 |
+
}
|
602 |
+
|
603 |
+
function OpcheckoutDialog(popup_id, link_id, close_id, close_callback, open_callback) {
|
604 |
+
this.popup_id = popup_id;
|
605 |
+
this.popup = $(popup_id);
|
606 |
+
this.link_id = link_id;
|
607 |
+
this.link = $(link_id);
|
608 |
+
this.close_link_search = close_id;
|
609 |
+
if (typeof close_callback != 'undefined') {
|
610 |
+
this.close_callback = close_callback;
|
611 |
+
} else {
|
612 |
+
this.close_callback = false;
|
613 |
+
}
|
614 |
+
if (typeof open_callback != 'undefined') {
|
615 |
+
this.open_callback = open_callback;
|
616 |
+
} else {
|
617 |
+
this.open_callback = false;
|
618 |
+
}
|
619 |
+
var opcheckout_popup = this;
|
620 |
+
if (this.link != null) {
|
621 |
+
this.link.observe('click', function(e) {
|
622 |
+
e.preventDefault();
|
623 |
+
opcheckout_popup.show();
|
624 |
+
$('opcheckout_username').focus();
|
625 |
+
});
|
626 |
+
}
|
627 |
+
var close_link = $$(this.close_link_search);
|
628 |
+
if (close_link.length > 0) {
|
629 |
+
close_link.each(function(item, index) {
|
630 |
+
item.observe('click', function(e) {
|
631 |
+
e.preventDefault();
|
632 |
+
opcheckout_popup.hide();
|
633 |
+
});
|
634 |
+
});
|
635 |
+
}
|
636 |
+
this.overlay = $('opcheckout_login_popup');
|
637 |
+
this.overlay.observe('click', function(e) {
|
638 |
+
opcheckout_popup.hide();
|
639 |
+
});
|
640 |
+
}
|
641 |
+
|
642 |
+
OpcheckoutDialog.prototype.show_overlay = function() {
|
643 |
+
this.overlay.show();
|
644 |
+
//var dimensions = document.viewport.getDimensions();
|
645 |
+
var offset = document.viewport.getScrollOffsets();
|
646 |
+
var dimensions_new = {
|
647 |
+
height: (document.body.clientHeight + offset.top) + 'px',
|
648 |
+
width: (document.body.clientWidth) + 'px'
|
649 |
+
}
|
650 |
+
this.overlay.setStyle(dimensions_new);
|
651 |
+
/* IE Hack */
|
652 |
+
var IE6 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf('MSIE') + 5)) == 6;
|
653 |
+
if (IE6) {
|
654 |
+
$$('select').invoke('hide');
|
655 |
+
}
|
656 |
+
}
|
657 |
+
|
658 |
+
OpcheckoutDialog.prototype.show = function() {
|
659 |
+
this.show_overlay();
|
660 |
+
this.popup.show();
|
661 |
+
this.center();
|
662 |
+
if (this.open_callback) {
|
663 |
+
this.open_callback();
|
664 |
+
}
|
665 |
+
}
|
666 |
+
|
667 |
+
OpcheckoutDialog.prototype.hide = function() {
|
668 |
+
this.overlay.hide();
|
669 |
+
/* IE Hack */
|
670 |
+
var IE6 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf('MSIE') + 5)) == 6;
|
671 |
+
if (IE6) {
|
672 |
+
$$('select').invoke('show');
|
673 |
+
}
|
674 |
+
this.popup.hide();
|
675 |
+
if (this.close_callback) {
|
676 |
+
this.close_callback();
|
677 |
+
}
|
678 |
+
}
|
679 |
+
|
680 |
+
OpcheckoutDialog.prototype.center = function() {
|
681 |
+
//var dimensions = document.viewport.getDimensions();
|
682 |
+
var popup_width = this.popup.getWidth();
|
683 |
+
var popup_height = this.popup.getHeight();
|
684 |
+
var offset = document.viewport.getScrollOffsets();
|
685 |
+
var width = document.body.clientWidth;
|
686 |
+
var left = (width / 2) - (popup_width / 2);
|
687 |
+
var height = document.body.clientHeight;
|
688 |
+
var top = (height / 3) - (popup_height / 2) + offset.top;
|
689 |
+
this.popup.setStyle({
|
690 |
+
top: top + 'px',
|
691 |
+
left: left + 'px'
|
692 |
+
});
|
693 |
+
}
|
694 |
+
if (!String.prototype.trim) {
|
695 |
+
String.prototype.trim = function() {
|
696 |
+
return this.replace(/^\s+|\s+$/g, '');
|
697 |
+
};
|
698 |
+
}
|
699 |
+
function togglePopupContent(first_link, second_link) {
|
700 |
+
var firstlink = $(first_link);
|
701 |
+
var secondlink = $(second_link);
|
702 |
+
if (firstlink != null) {
|
703 |
+
firstlink.observe('click', function() {
|
704 |
+
gotoLogin();
|
705 |
+
});
|
706 |
+
}
|
707 |
+
if (secondlink != null) {
|
708 |
+
secondlink.observe('click', function() {
|
709 |
+
gotoForgotPassword();
|
710 |
+
});
|
711 |
+
}
|
712 |
+
}
|
713 |
+
function gotoLogin() {
|
714 |
+
$('onstep-forgotpassword').hide();
|
715 |
+
$('onestep-content').show();
|
716 |
+
$('opcheckout_username').focus();
|
717 |
+
}
|
718 |
+
function gotoForgotPassword() {
|
719 |
+
$('onestep-content').hide();
|
720 |
+
$('onstep-forgotpassword').show();
|
721 |
+
$('opcheckout_forgotpassword_email').focus();
|
722 |
+
}
|
723 |
+
|
724 |
+
function canShip() {
|
725 |
+
return parseInt($('opcheckout-canShip').value) ? true : false;
|
726 |
+
}
|
727 |
+
function resetPaymentEvents() {
|
728 |
+
function toggleToolTip(event) {
|
729 |
+
if ($('payment-tool-tip')) {
|
730 |
+
$('payment-tool-tip').setStyle({
|
731 |
+
//left: (Event.pointerX(event)+100)+'px'
|
732 |
+
top: (Event.pointerY(event) - 320) + 'px'
|
733 |
+
})
|
734 |
+
$('payment-tool-tip').toggle();
|
735 |
+
}
|
736 |
+
Event.stop(event);
|
737 |
+
}
|
738 |
+
if ($('payment-tool-tip-close')) {
|
739 |
+
Event.observe($('payment-tool-tip-close'), 'click', toggleToolTip);
|
740 |
+
}
|
741 |
+
$$('.cvv-what-is-this').each(function(element) {
|
742 |
+
Event.observe(element, 'click', toggleToolTip);
|
743 |
+
});
|
744 |
+
}
|
skin/frontend/base/default/onestepcheckout/js/osc-calendar-setup.js
ADDED
@@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/
|
2 |
+
* ---------------------------------------------------------------------------
|
3 |
+
*
|
4 |
+
* The DHTML Calendar
|
5 |
+
*
|
6 |
+
* Details and latest version at:
|
7 |
+
* http://dynarch.com/mishoo/calendar.epl
|
8 |
+
*
|
9 |
+
* This script is distributed under the GNU Lesser General Public License.
|
10 |
+
* Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
|
11 |
+
*
|
12 |
+
* This file defines helper functions for setting up the calendar. They are
|
13 |
+
* intended to help non-programmers get a working calendar on their site
|
14 |
+
* quickly. This script should not be seen as part of the calendar. It just
|
15 |
+
* shows you what one can do with the calendar, while in the same time
|
16 |
+
* providing a quick and simple method for setting it up. If you need
|
17 |
+
* exhaustive customization of the calendar creation process feel free to
|
18 |
+
* modify this code to suit your needs (this is recommended and much better
|
19 |
+
* than modifying calendar.js itself).
|
20 |
+
*/
|
21 |
+
Calendar.setup=function(params){
|
22 |
+
function param_default(pname,def){
|
23 |
+
if(typeof params[pname]=="undefined"){
|
24 |
+
params[pname]=def;
|
25 |
+
}
|
26 |
+
};
|
27 |
+
|
28 |
+
param_default("inputField",null);
|
29 |
+
param_default("displayArea",null);
|
30 |
+
param_default("button",null);
|
31 |
+
param_default("eventName","click");
|
32 |
+
param_default("ifFormat","%Y/%m/%d");
|
33 |
+
param_default("daFormat","%Y/%m/%d");
|
34 |
+
param_default("singleClick",true);
|
35 |
+
param_default("disableFunc",null);
|
36 |
+
param_default("dateStatusFunc",params["disableFunc"]);
|
37 |
+
param_default("dateText",null);
|
38 |
+
param_default("firstDay",null);
|
39 |
+
param_default("align","Br");
|
40 |
+
param_default("range",[1900,2999]);
|
41 |
+
param_default("weekNumbers",true);
|
42 |
+
param_default("flat",null);
|
43 |
+
param_default("flatCallback",null);
|
44 |
+
param_default("onSelect",null);
|
45 |
+
param_default("onClose",null);
|
46 |
+
param_default("onUpdate",null);
|
47 |
+
param_default("date",null);
|
48 |
+
param_default("showsTime",false);
|
49 |
+
param_default("timeFormat","24");
|
50 |
+
param_default("electric",true);
|
51 |
+
param_default("step",2);
|
52 |
+
param_default("position",null);
|
53 |
+
param_default("cache",false);
|
54 |
+
param_default("showOthers",false);
|
55 |
+
param_default("multiple",null);
|
56 |
+
var tmp=["inputField","displayArea","button"];
|
57 |
+
for(var i in tmp){
|
58 |
+
if(typeof params[tmp[i]]=="string"){
|
59 |
+
params[tmp[i]]=document.getElementById(params[tmp[i]]);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){
|
63 |
+
alert("Calendar.setup:\n Nothing to setup (no fields found). Please check your code");
|
64 |
+
return false;
|
65 |
+
}
|
66 |
+
function onSelect(cal){
|
67 |
+
var p=cal.params;
|
68 |
+
var update=(cal.dateClicked||p.electric);
|
69 |
+
if(update&&p.inputField){
|
70 |
+
p.inputField.value=cal.date.print(p.ifFormat);
|
71 |
+
if(typeof p.inputField.onchange=="function")p.inputField.onchange();
|
72 |
+
if(typeof fireEvent == 'function')fireEvent(p.inputField, "change");
|
73 |
+
}
|
74 |
+
if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);
|
75 |
+
if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);
|
76 |
+
if(update&&p.flat){
|
77 |
+
if(typeof p.flatCallback=="function")p.flatCallback(cal);
|
78 |
+
}
|
79 |
+
if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();
|
80 |
+
};
|
81 |
+
|
82 |
+
if(params.flat!=null){
|
83 |
+
if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);
|
84 |
+
if(!params.flat){
|
85 |
+
alert("Calendar.setup:\n Flat specified but can't find parent.");
|
86 |
+
return false;
|
87 |
+
}
|
88 |
+
var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);
|
89 |
+
cal.showsOtherMonths=params.showOthers;
|
90 |
+
cal.showsTime=params.showsTime;
|
91 |
+
cal.time24=(params.timeFormat=="24");
|
92 |
+
cal.params=params;
|
93 |
+
cal.weekNumbers=params.weekNumbers;
|
94 |
+
cal.setRange(params.range[0],params.range[1]);
|
95 |
+
cal.setDateStatusHandler(params.dateStatusFunc);
|
96 |
+
cal.getDateText=params.dateText;
|
97 |
+
if(params.ifFormat){
|
98 |
+
cal.setDateFormat(params.ifFormat);
|
99 |
+
}
|
100 |
+
if(params.inputField&&typeof params.inputField.value=="string"){
|
101 |
+
cal.parseDate(params.inputField.value);
|
102 |
+
}
|
103 |
+
cal.create(params.flat);
|
104 |
+
cal.show();
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
var triggerEl=params.button||params.displayArea||params.inputField;
|
108 |
+
triggerEl["on"+params.eventName]=function(){
|
109 |
+
var dateEl=params.inputField||params.displayArea;
|
110 |
+
var dateFmt=params.inputField?params.ifFormat:params.daFormat;
|
111 |
+
var mustCreate=false;
|
112 |
+
var cal=window.calendar;
|
113 |
+
if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);
|
114 |
+
if(!(cal&¶ms.cache)){
|
115 |
+
window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){
|
116 |
+
cal.hide();
|
117 |
+
});
|
118 |
+
cal.showsTime=params.showsTime;
|
119 |
+
cal.time24=(params.timeFormat=="24");
|
120 |
+
cal.weekNumbers=params.weekNumbers;
|
121 |
+
mustCreate=true;
|
122 |
+
}else{
|
123 |
+
if(params.date)cal.setDate(params.date);
|
124 |
+
cal.hide();
|
125 |
+
}
|
126 |
+
if(params.multiple){
|
127 |
+
cal.multiple={};
|
128 |
+
|
129 |
+
for(var i=params.multiple.length;--i>=0;){
|
130 |
+
var d=params.multiple[i];
|
131 |
+
var ds=d.print("%Y%m%d");
|
132 |
+
cal.multiple[ds]=d;
|
133 |
+
}
|
134 |
+
}
|
135 |
+
cal.showsOtherMonths=params.showOthers;
|
136 |
+
cal.yearStep=params.step;
|
137 |
+
cal.setRange(params.range[0],params.range[1]);
|
138 |
+
cal.params=params;
|
139 |
+
cal.setDateStatusHandler(params.dateStatusFunc);
|
140 |
+
cal.getDateText=params.dateText;
|
141 |
+
cal.setDateFormat(dateFmt);
|
142 |
+
if(mustCreate)cal.create();
|
143 |
+
cal.refresh();
|
144 |
+
if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);
|
145 |
+
return false;
|
146 |
+
};
|
147 |
+
|
148 |
+
return cal;
|
149 |
+
};
|
150 |
+
|
151 |
+
/*
|
152 |
+
* Different ways to find element's absolute position
|
153 |
+
*/
|
154 |
+
Calendar.getAbsolutePos = function(element) {
|
155 |
+
|
156 |
+
var res = new Object();
|
157 |
+
res.x = 0; res.y = 0;
|
158 |
+
|
159 |
+
// variant 1 (working best, copy-paste from prototype library)
|
160 |
+
do {
|
161 |
+
res.x += element.offsetLeft || 0;
|
162 |
+
res.y += element.offsetTop || 0;
|
163 |
+
element = element.offsetParent;
|
164 |
+
if (element) {
|
165 |
+
if (element.tagName.toUpperCase() == 'BODY') break;
|
166 |
+
var p = Calendar.getStyle(element, 'position');
|
167 |
+
if ((p !== 'static') && (p !== 'relative')) break;
|
168 |
+
}
|
169 |
+
} while (element);
|
170 |
+
|
171 |
+
return res;
|
172 |
+
|
173 |
+
// variant 2 (good solution, but lost in IE8)
|
174 |
+
if (element !== null) {
|
175 |
+
res.x = element.offsetLeft;
|
176 |
+
res.y = element.offsetTop;
|
177 |
+
|
178 |
+
var offsetParent = element.offsetParent;
|
179 |
+
var parentNode = element.parentNode;
|
180 |
+
|
181 |
+
while (offsetParent !== null) {
|
182 |
+
res.x += offsetParent.offsetLeft;
|
183 |
+
res.y += offsetParent.offsetTop;
|
184 |
+
|
185 |
+
if (offsetParent != document.body && offsetParent != document.documentElement) {
|
186 |
+
res.x -= offsetParent.scrollLeft;
|
187 |
+
res.y -= offsetParent.scrollTop;
|
188 |
+
}
|
189 |
+
//next lines are necessary to support FireFox problem with offsetParent
|
190 |
+
if (Calendar.is_gecko) {
|
191 |
+
while (offsetParent != parentNode && parentNode !== null) {
|
192 |
+
res.x -= parentNode.scrollLeft;
|
193 |
+
res.y -= parentNode.scrollTop;
|
194 |
+
parentNode = parentNode.parentNode;
|
195 |
+
}
|
196 |
+
}
|
197 |
+
parentNode = offsetParent.parentNode;
|
198 |
+
offsetParent = offsetParent.offsetParent;
|
199 |
+
}
|
200 |
+
}
|
201 |
+
return res;
|
202 |
+
|
203 |
+
// variant 2 (not working)
|
204 |
+
|
205 |
+
// var SL = 0, ST = 0;
|
206 |
+
// var is_div = /^div$/i.test(el.tagName);
|
207 |
+
// if (is_div && el.scrollLeft)
|
208 |
+
// SL = el.scrollLeft;
|
209 |
+
// if (is_div && el.scrollTop)
|
210 |
+
// ST = el.scrollTop;
|
211 |
+
// var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
|
212 |
+
// if (el.offsetParent) {
|
213 |
+
// var tmp = this.getAbsolutePos(el.offsetParent);
|
214 |
+
// r.x += tmp.x;
|
215 |
+
// r.y += tmp.y;
|
216 |
+
// }
|
217 |
+
// return r;
|
218 |
+
};
|