Version Notes
This is a stable version.
Download this release
Release Info
| Developer | pureimagination |
| Extension | PI_Selectstore |
| Version | 0.1.2 |
| Comparing to | |
| See all releases | |
Version 0.1.2
- app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore.php +15 -0
- app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore/Edit.php +46 -0
- app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore/Edit/Form.php +19 -0
- app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore/Edit/Tab/Store.php +35 -0
- app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore/Edit/Tabs.php +24 -0
- app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore/Grid.php +74 -0
- app/code/local/PI/Stepincheckout/Block/Checkout/Onepage.php +21 -0
- app/code/local/PI/Stepincheckout/Block/Checkout/Onepage/Selectstore.php +12 -0
- app/code/local/PI/Stepincheckout/Block/Sales/Order/Total.php +69 -0
- app/code/local/PI/Stepincheckout/Helper/Data.php +4 -0
- app/code/local/PI/Stepincheckout/Model/Checkout/Type/Onepage.php +19 -0
- app/code/local/PI/Stepincheckout/Model/Observer.php +12 -0
- app/code/local/PI/Stepincheckout/Model/Resource/Selectstore.php +9 -0
- app/code/local/PI/Stepincheckout/Model/Resource/Selectstore/Collection.php +10 -0
- app/code/local/PI/Stepincheckout/Model/Sales/Order/Pdf/Selectedstore.php +28 -0
- app/code/local/PI/Stepincheckout/Model/Sales/Order/Total/Creditmemo/Price.php +20 -0
- app/code/local/PI/Stepincheckout/Model/Sales/Order/Total/Invoice/Price.php +21 -0
- app/code/local/PI/Stepincheckout/Model/Sales/Quote/Address/Total/Price.php +49 -0
- app/code/local/PI/Stepincheckout/Model/Selectstore.php +8 -0
- app/code/local/PI/Stepincheckout/controllers/Adminhtml/SitestoreController.php +121 -0
- app/code/local/PI/Stepincheckout/controllers/Checkout/OnepageController.php +36 -0
- app/code/local/PI/Stepincheckout/controllers/IndexController.php +34 -0
- app/code/local/PI/Stepincheckout/etc/adminhtml.xml +35 -0
- app/code/local/PI/Stepincheckout/etc/config.xml +168 -0
- app/code/local/PI/Stepincheckout/sql/stepincheckout_setup/mysql4-install-0.1.0.php +40 -0
- app/code/local/PI/Stepincheckout/sql/stepincheckout_setup/upgrade-0.1.0-0.1.1.php +10 -0
- app/code/local/PI/Stepincheckout/sql/stepincheckout_setup/upgrade-0.1.1-0.1.2.php +12 -0
- app/design/adminhtml/default/default/layout/stepincheckout.xml +71 -0
- app/design/adminhtml/default/default/template/stepincheckout/sales/order/invoice/create/form.phtml +148 -0
- app/design/adminhtml/default/default/template/stepincheckout/sales/order/invoice/view/form.phtml +120 -0
- app/design/adminhtml/default/default/template/stepincheckout/sales/order/refunded.phtml +14 -0
- app/design/adminhtml/default/default/template/stepincheckout/sales/order/total.phtml +14 -0
- app/design/adminhtml/default/default/template/stepincheckout/sales/order/view/tab/info.phtml +163 -0
- app/design/frontend/base/default/layout/stepincheckout.xml +90 -0
- app/design/frontend/base/default/template/stepincheckout/checkout/onepage.phtml +61 -0
- app/design/frontend/base/default/template/stepincheckout/checkout/onepage/progress.phtml +65 -0
- app/design/frontend/base/default/template/stepincheckout/checkout/onepage/progress/select_store.phtml +55 -0
- app/design/frontend/base/default/template/stepincheckout/checkout/onepage/selectstore.phtml +44 -0
- app/etc/modules/PI_Stepincheckout.xml +9 -0
- package.xml +20 -0
- skin/frontend/base/default/js/stepincheckout/opcheckout.js +929 -0
- skin/frontend/base/default/js/stepincheckout/store.js +76 -0
app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore.php
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Stepincheckout_Block_Adminhtml_Selectstore extends Mage_Adminhtml_Block_Widget_Grid_Container {
|
| 4 |
+
|
| 5 |
+
public function __construct() {
|
| 6 |
+
|
| 7 |
+
$this->_controller = 'adminhtml_selectstore';
|
| 8 |
+
$this->_blockGroup = 'stepincheckout';
|
| 9 |
+
$this->_headerText = Mage::helper('stepincheckout')->__('Manage Store');
|
| 10 |
+
$this->_addButtonLabel = Mage::helper('stepincheckout')->__('Add New Store');
|
| 11 |
+
|
| 12 |
+
parent::__construct();
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
}
|
app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore/Edit.php
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Stepincheckout_Block_Adminhtml_Selectstore_Edit extends Mage_Adminhtml_Block_Widget_Form_Container {
|
| 4 |
+
|
| 5 |
+
public function __construct() {
|
| 6 |
+
parent::__construct();
|
| 7 |
+
|
| 8 |
+
$this->_objectId = 'id';
|
| 9 |
+
$this->_blockGroup = 'stepincheckout';
|
| 10 |
+
$this->_controller = 'adminhtml_selectstore';
|
| 11 |
+
|
| 12 |
+
$this->_updateButton('delete', 'label', Mage::helper('stepincheckout')->__('Delete'));
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
$this->_addButton('saveandcontinue', array(
|
| 17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
| 18 |
+
'onclick' => 'saveAndContinueEdit()',
|
| 19 |
+
'class' => 'save',
|
| 20 |
+
), -100);
|
| 21 |
+
|
| 22 |
+
$this->_formScripts[] = "
|
| 23 |
+
function toggleEditor() {
|
| 24 |
+
if (tinyMCE.getInstanceById('edge_content') == null) {
|
| 25 |
+
tinyMCE.execCommand('mceAddControl', false, 'edge_content');
|
| 26 |
+
} else {
|
| 27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'edge_content');
|
| 28 |
+
}
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
function saveAndContinueEdit(){
|
| 32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
| 33 |
+
|
| 34 |
+
}
|
| 35 |
+
";
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
public function getHeaderText() {
|
| 39 |
+
if (Mage::registry('selectstore_data') && Mage::registry('selectstore_data')->getId()) {
|
| 40 |
+
return Mage::helper('stepincheckout')->__("Edit Store '%s'", $this->htmlEscape(Mage::registry('selectstore_data')->getName()));
|
| 41 |
+
} else {
|
| 42 |
+
return Mage::helper('stepincheckout')->__('Add Store');
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
}
|
app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore/Edit/Form.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Stepincheckout_Block_Adminhtml_Selectstore_Edit_Form extends Mage_Adminhtml_Block_Widget_Form {
|
| 4 |
+
|
| 5 |
+
protected function _prepareForm() {
|
| 6 |
+
$form = new Varien_Data_Form(array(
|
| 7 |
+
'id' => 'edit_form',
|
| 8 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
| 9 |
+
'method' => 'post',
|
| 10 |
+
'enctype' => 'multipart/form-data'
|
| 11 |
+
)
|
| 12 |
+
);
|
| 13 |
+
|
| 14 |
+
$form->setUseContainer(true);
|
| 15 |
+
$this->setForm($form);
|
| 16 |
+
return parent::_prepareForm();
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
}
|
app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore/Edit/Tab/Store.php
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Stepincheckout_Block_Adminhtml_Selectstore_Edit_Tab_Store extends Mage_Adminhtml_Block_Widget_Form {
|
| 4 |
+
|
| 5 |
+
protected function _prepareForm() {
|
| 6 |
+
$form = new Varien_Data_Form();
|
| 7 |
+
$this->setForm($form);
|
| 8 |
+
$fieldset = $form->addFieldset('selectstore_form', array('legend' => Mage::helper('stepincheckout')->__('Store Details')));
|
| 9 |
+
|
| 10 |
+
$fieldset->addField('name', 'text', array(
|
| 11 |
+
'label' => Mage::helper('stepincheckout')->__('Store Name'),
|
| 12 |
+
'class' => 'required-entry',
|
| 13 |
+
'required' => true,
|
| 14 |
+
'name' => 'name',
|
| 15 |
+
));
|
| 16 |
+
|
| 17 |
+
$fieldset->addField('price', 'text', array(
|
| 18 |
+
'label' => Mage::helper('stepincheckout')->__('Price'),
|
| 19 |
+
'class' => 'required-entry',
|
| 20 |
+
'required' => true,
|
| 21 |
+
'name' => 'price',
|
| 22 |
+
));
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
if (Mage::getSingleton('adminhtml/session')->getSelectstoreData()) {
|
| 27 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getSelectstoreData());
|
| 28 |
+
Mage::getSingleton('adminhtml/session')->setDriverData(null);
|
| 29 |
+
} elseif (Mage::registry('selectstore_data')) {
|
| 30 |
+
$form->setValues(Mage::registry('selectstore_data')->getData());
|
| 31 |
+
}
|
| 32 |
+
return parent::_prepareForm();
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
}
|
app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore/Edit/Tabs.php
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Stepincheckout_Block_Adminhtml_Selectstore_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
| 4 |
+
{
|
| 5 |
+
|
| 6 |
+
public function __construct()
|
| 7 |
+
{
|
| 8 |
+
parent::__construct();
|
| 9 |
+
$this->setId('selectstore_tabs');
|
| 10 |
+
$this->setDestElementId('edit_form');
|
| 11 |
+
$this->setTitle(Mage::helper('stepincheckout')->__('Store Informations'));
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
protected function _beforeToHtml()
|
| 15 |
+
{
|
| 16 |
+
$this->addTab('form_section', array(
|
| 17 |
+
'label' => Mage::helper('stepincheckout')->__('Store Informations'),
|
| 18 |
+
'title' => Mage::helper('stepincheckout')->__('Store Informations'),
|
| 19 |
+
'content' => $this->getLayout()->createBlock('stepincheckout/adminhtml_selectstore_edit_tab_store')->toHtml(),
|
| 20 |
+
));
|
| 21 |
+
|
| 22 |
+
return parent::_beforeToHtml();
|
| 23 |
+
}
|
| 24 |
+
}
|
app/code/local/PI/Stepincheckout/Block/Adminhtml/Selectstore/Grid.php
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Stepincheckout_Block_Adminhtml_Selectstore_Grid extends Mage_Adminhtml_Block_Widget_Grid {
|
| 4 |
+
|
| 5 |
+
public function __construct() {
|
| 6 |
+
parent::__construct();
|
| 7 |
+
$this->setId('storeGrid');
|
| 8 |
+
$this->setDefaultSort('store_id');// sorting according to which colunm name
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
protected function _prepareCollection() {
|
| 12 |
+
|
| 13 |
+
$collection = Mage::getModel('stepincheckout/selectstore')->getCollection();
|
| 14 |
+
$this->setCollection($collection);
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
return parent::_prepareCollection();
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
protected function _prepareColumns() {
|
| 21 |
+
$this->addColumn('store_id', array(
|
| 22 |
+
'header' => Mage::helper('stepincheckout')->__('ID'),
|
| 23 |
+
'width' => '25%',
|
| 24 |
+
'index' => 'store_id',
|
| 25 |
+
));
|
| 26 |
+
|
| 27 |
+
$this->addColumn('name', array(
|
| 28 |
+
'header' => Mage::helper('stepincheckout')->__('Store Name'),
|
| 29 |
+
'width' => '25%',
|
| 30 |
+
'index' => 'name',
|
| 31 |
+
));
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
$this->addColumn('action', array(
|
| 35 |
+
'header' => Mage::helper('stepincheckout')->__('Action'),
|
| 36 |
+
'width' => '100',
|
| 37 |
+
'type' => 'action',
|
| 38 |
+
'getter' => 'getId',
|
| 39 |
+
'actions' => array(
|
| 40 |
+
array(
|
| 41 |
+
'caption' => Mage::helper('stepincheckout')->__('Edit'),
|
| 42 |
+
'url' => array('base' => '*/*/edit'),
|
| 43 |
+
'field' => 'id'
|
| 44 |
+
)
|
| 45 |
+
),
|
| 46 |
+
'filter' => false,
|
| 47 |
+
'sortable' => false,
|
| 48 |
+
'index' => 'stores',
|
| 49 |
+
'is_system' => true,
|
| 50 |
+
));
|
| 51 |
+
|
| 52 |
+
return parent::_prepareColumns();
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
protected function _prepareMassaction() {
|
| 56 |
+
|
| 57 |
+
$this->setMassactionIdField('store_id');
|
| 58 |
+
$this->getMassactionBlock()->setFormFieldName('store_id');
|
| 59 |
+
|
| 60 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
| 61 |
+
'label' => Mage::helper('stepincheckout')->__('Delete'),
|
| 62 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
| 63 |
+
'confirm' => Mage::helper('stepincheckout')->__('Are you sure?')
|
| 64 |
+
));
|
| 65 |
+
|
| 66 |
+
return $this;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
public function getRowUrl($row) {
|
| 70 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
}
|
| 74 |
+
|
app/code/local/PI/Stepincheckout/Block/Checkout/Onepage.php
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Stepincheckout_Block_Checkout_Onepage extends Mage_Checkout_Block_Onepage{
|
| 3 |
+
|
| 4 |
+
public function getSteps()
|
| 5 |
+
{
|
| 6 |
+
$steps = array();
|
| 7 |
+
|
| 8 |
+
if (!$this->isCustomerLoggedIn()) {
|
| 9 |
+
$steps['login'] = $this->getCheckout()->getStepData('login');
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
//New Code Adding step excellence here
|
| 13 |
+
$stepCodes = array('billing', 'shipping', 'shipping_method','select_store', 'payment', 'review');
|
| 14 |
+
|
| 15 |
+
foreach ($stepCodes as $step) {
|
| 16 |
+
$steps[$step] = $this->getCheckout()->getStepData($step);
|
| 17 |
+
}
|
| 18 |
+
return $steps;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
}
|
app/code/local/PI/Stepincheckout/Block/Checkout/Onepage/Selectstore.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Stepincheckout_Block_Checkout_Onepage_Selectstore extends Mage_Checkout_Block_Onepage_Abstract{
|
| 3 |
+
protected function _construct()
|
| 4 |
+
{
|
| 5 |
+
$this->getCheckout()->setStepData('select_store', array(
|
| 6 |
+
'label' => Mage::helper('checkout')->__('Select A Store'),
|
| 7 |
+
'is_show' => $this->isShow()
|
| 8 |
+
));
|
| 9 |
+
|
| 10 |
+
parent::_construct();
|
| 11 |
+
}
|
| 12 |
+
}
|
app/code/local/PI/Stepincheckout/Block/Sales/Order/Total.php
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Stepincheckout_Block_Sales_Order_Total extends Mage_Core_Block_Template
|
| 3 |
+
{
|
| 4 |
+
/**
|
| 5 |
+
* Get label cell tag properties
|
| 6 |
+
*
|
| 7 |
+
* @return string
|
| 8 |
+
*/
|
| 9 |
+
public function getLabelProperties()
|
| 10 |
+
{
|
| 11 |
+
return $this->getParentBlock()->getLabelProperties();
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Get order store object
|
| 16 |
+
*
|
| 17 |
+
* @return Mage_Sales_Model_Order
|
| 18 |
+
*/
|
| 19 |
+
public function getOrder()
|
| 20 |
+
{
|
| 21 |
+
return $this->getParentBlock()->getOrder();
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Get totals source object
|
| 26 |
+
*
|
| 27 |
+
* @return Mage_Sales_Model_Order
|
| 28 |
+
*/
|
| 29 |
+
public function getSource()
|
| 30 |
+
{
|
| 31 |
+
return $this->getParentBlock()->getSource();
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* Get value cell tag properties
|
| 36 |
+
*
|
| 37 |
+
* @return string
|
| 38 |
+
*/
|
| 39 |
+
public function getValueProperties()
|
| 40 |
+
{
|
| 41 |
+
return $this->getParentBlock()->getValueProperties();
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Initialize reward points totals
|
| 46 |
+
*
|
| 47 |
+
* @return Enterprise_Reward_Block_Sales_Order_Total
|
| 48 |
+
*/
|
| 49 |
+
public function initTotals()
|
| 50 |
+
{
|
| 51 |
+
if ((float) $this->getOrder()->getSelectedStore()) {
|
| 52 |
+
$source = $this->getSource();
|
| 53 |
+
|
| 54 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($source->getSelectedStore());
|
| 55 |
+
|
| 56 |
+
$value = $storeDetail->getPrice();
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
$this->getParentBlock()->addTotal(new Varien_Object(array(
|
| 60 |
+
'code' => 'selected_store',
|
| 61 |
+
'strong' => false,
|
| 62 |
+
'label' => Mage::helper('stepincheckout')->__('Selected Store'),
|
| 63 |
+
'value' => $value
|
| 64 |
+
)));
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
return $this;
|
| 68 |
+
}
|
| 69 |
+
}
|
app/code/local/PI/Stepincheckout/Helper/Data.php
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Stepincheckout_Helper_Data extends Mage_Core_Helper_Abstract{
|
| 3 |
+
|
| 4 |
+
}
|
app/code/local/PI/Stepincheckout/Model/Checkout/Type/Onepage.php
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Stepincheckout_Model_Checkout_Type_Onepage extends Mage_Checkout_Model_Type_Onepage{
|
| 3 |
+
|
| 4 |
+
public function saveSelectedStore($data){
|
| 5 |
+
if (empty($data)) {
|
| 6 |
+
return array('error' => -1, 'message' => $this->_helper->__('Invalid data.'));
|
| 7 |
+
}
|
| 8 |
+
$this->getQuote()->setSelectedStore($data['selected_store']);
|
| 9 |
+
$this->getQuote()->collectTotals();
|
| 10 |
+
$this->getQuote()->save();
|
| 11 |
+
|
| 12 |
+
$this->getCheckout()
|
| 13 |
+
->setStepData('select_store', 'allow', true)
|
| 14 |
+
->setStepData('select_store', 'complete', true)
|
| 15 |
+
->setStepData('payment', 'allow', true);
|
| 16 |
+
|
| 17 |
+
return array();
|
| 18 |
+
}
|
| 19 |
+
}
|
app/code/local/PI/Stepincheckout/Model/Observer.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class PI_Stepincheckout_Model_Observer {
|
| 5 |
+
/**
|
| 6 |
+
* Code for "select_store"
|
| 7 |
+
**/
|
| 8 |
+
public function convertSelectedStore($observer)
|
| 9 |
+
{
|
| 10 |
+
return $this;
|
| 11 |
+
}
|
| 12 |
+
}
|
app/code/local/PI/Stepincheckout/Model/Resource/Selectstore.php
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Stepincheckout_Model_Resource_Selectstore extends Mage_Core_Model_Mysql4_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
$this->_init('stepincheckout/store', 'store_id');
|
| 8 |
+
}
|
| 9 |
+
}
|
app/code/local/PI/Stepincheckout/Model/Resource/Selectstore/Collection.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Stepincheckout_Model_Resource_Selectstore_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
| 4 |
+
{
|
| 5 |
+
public function _construct()
|
| 6 |
+
{
|
| 7 |
+
parent::_construct();
|
| 8 |
+
$this->_init('stepincheckout/selectstore');
|
| 9 |
+
}
|
| 10 |
+
}
|
app/code/local/PI/Stepincheckout/Model/Sales/Order/Pdf/Selectedstore.php
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Stepincheckout_Model_Sales_Order_Pdf_Selectedstore extends Mage_Sales_Model_Order_Pdf_Total_Default
|
| 3 |
+
{
|
| 4 |
+
public function getTotalsForDisplay()
|
| 5 |
+
{
|
| 6 |
+
// getAmount is defined in the parent class and should read
|
| 7 |
+
// the value from the defined source_field in your config.xml
|
| 8 |
+
$order = $this->getOrder();
|
| 9 |
+
$selectedStore = $order->getSelectedStore();
|
| 10 |
+
|
| 11 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($selectedStore);
|
| 12 |
+
$value = $storeDetail->getPrice();
|
| 13 |
+
//if($value>0)
|
| 14 |
+
//{
|
| 15 |
+
$label = Mage::helper('stepincheckout')->__('Selected Store');
|
| 16 |
+
$fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
|
| 17 |
+
$total = array(
|
| 18 |
+
'amount' => $order->formatPriceTxt($value),
|
| 19 |
+
'label' => $label,
|
| 20 |
+
'font_size' => $fontSize
|
| 21 |
+
);
|
| 22 |
+
|
| 23 |
+
//}
|
| 24 |
+
|
| 25 |
+
return array($total);
|
| 26 |
+
}
|
| 27 |
+
}
|
| 28 |
+
?>
|
app/code/local/PI/Stepincheckout/Model/Sales/Order/Total/Creditmemo/Price.php
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Stepincheckout_Model_Sales_Order_Total_Creditmemo_Price extends Mage_Sales_Model_Order_Creditmemo_Total_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
|
| 5 |
+
{
|
| 6 |
+
$order = $creditmemo->getOrder();
|
| 7 |
+
|
| 8 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($order->getSelectedStore());
|
| 9 |
+
|
| 10 |
+
$value = $storeDetail->getPrice();
|
| 11 |
+
|
| 12 |
+
if ($value > 0) {
|
| 13 |
+
$creditmemo->setGrandTotal($creditmemo->getGrandTotal() + $value);
|
| 14 |
+
$creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal() + $value);
|
| 15 |
+
$creditmemo->setSelectedStore($order->getSelectedStore());
|
| 16 |
+
//$creditmemo->setBaseFeeAmount($basefeeAmountLeft);
|
| 17 |
+
}
|
| 18 |
+
return $this;
|
| 19 |
+
}
|
| 20 |
+
}
|
app/code/local/PI/Stepincheckout/Model/Sales/Order/Total/Invoice/Price.php
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Stepincheckout_Model_Sales_Order_Total_Invoice_Price extends Mage_Sales_Model_Order_Invoice_Total_Abstract
|
| 3 |
+
{
|
| 4 |
+
public function collect(Mage_Sales_Model_Order_Invoice $invoice)
|
| 5 |
+
{
|
| 6 |
+
$order = $invoice->getOrder();
|
| 7 |
+
|
| 8 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($order->getSelectedStore());
|
| 9 |
+
|
| 10 |
+
$value = $storeDetail->getPrice();
|
| 11 |
+
|
| 12 |
+
if ($value>0) {
|
| 13 |
+
$invoice->setGrandTotal($invoice->getGrandTotal() + $value);
|
| 14 |
+
$invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() + $value);
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
$invoice->setSelectedStore($order->getSelectedStore());
|
| 18 |
+
//$invoice->setSelectedStore($order->getSelectedStore());
|
| 19 |
+
return $this;
|
| 20 |
+
}
|
| 21 |
+
}
|
app/code/local/PI/Stepincheckout/Model/Sales/Quote/Address/Total/Price.php
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
class PI_Stepincheckout_Model_Sales_Quote_Address_Total_Price extends Mage_Sales_Model_Quote_Address_Total_Abstract{
|
| 3 |
+
protected $_code = 'selected_store';
|
| 4 |
+
|
| 5 |
+
public function collect(Mage_Sales_Model_Quote_Address $address)
|
| 6 |
+
{
|
| 7 |
+
parent::collect($address);
|
| 8 |
+
|
| 9 |
+
$this->_setAmount(0);
|
| 10 |
+
$this->_setBaseAmount(0);
|
| 11 |
+
|
| 12 |
+
$items = $this->_getAddressItems($address);
|
| 13 |
+
if (!count($items)) {
|
| 14 |
+
return $this; //this makes only address type shipping to come through
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
$quote = $address->getQuote();
|
| 19 |
+
|
| 20 |
+
if($quote->getSelectedStore()!=''){
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
$selectedStore = $quote->getSelectedStore();
|
| 24 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($selectedStore);
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
$address->setGrandTotal($address->getGrandTotal() + $storeDetail->getPrice());
|
| 28 |
+
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $storeDetail->getPrice());
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
public function fetch(Mage_Sales_Model_Quote_Address $address)
|
| 33 |
+
{
|
| 34 |
+
$quote = $address->getQuote();
|
| 35 |
+
if($quote->getSelectedStore()!=''){
|
| 36 |
+
|
| 37 |
+
$selectedStore = $quote->getSelectedStore();
|
| 38 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($selectedStore);
|
| 39 |
+
|
| 40 |
+
$amt = $storeDetail->getPrice()/2;
|
| 41 |
+
$address->addTotal(array(
|
| 42 |
+
'code'=> $this->getCode(),
|
| 43 |
+
'title'=> $storeDetail->getName(),
|
| 44 |
+
'value'=> $amt
|
| 45 |
+
));
|
| 46 |
+
}
|
| 47 |
+
return $this;
|
| 48 |
+
}
|
| 49 |
+
}
|
app/code/local/PI/Stepincheckout/Model/Selectstore.php
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Stepincheckout_Model_Selectstore extends Mage_Core_Model_Abstract {
|
| 4 |
+
public function _construct() {
|
| 5 |
+
parent::_construct();
|
| 6 |
+
$this->_init('stepincheckout/selectstore');
|
| 7 |
+
}
|
| 8 |
+
}
|
app/code/local/PI/Stepincheckout/controllers/Adminhtml/SitestoreController.php
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class PI_Stepincheckout_Adminhtml_SitestoreController extends Mage_Adminhtml_Controller_Action {
|
| 4 |
+
|
| 5 |
+
public function indexAction() {
|
| 6 |
+
$this->loadLayout();
|
| 7 |
+
|
| 8 |
+
/** set active menu* */
|
| 9 |
+
$this->_setActiveMenu('pistores/stores');
|
| 10 |
+
$this->_addContent($this->getLayout()->createBlock('stepincheckout/adminhtml_selectstore'));
|
| 11 |
+
$this->renderLayout();
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
public function editAction()
|
| 15 |
+
{
|
| 16 |
+
$id = $this->getRequest()->getParam('id');
|
| 17 |
+
$model = Mage::getModel('stepincheckout/selectstore')->load($id);
|
| 18 |
+
|
| 19 |
+
if ($model->getId() || $id == 0) {
|
| 20 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
| 21 |
+
if (!empty($data)) {
|
| 22 |
+
$model->setData($data);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
Mage::register('selectstore_data', $model);
|
| 27 |
+
|
| 28 |
+
$this->loadLayout();
|
| 29 |
+
$this->_setActiveMenu('ggpfast/store');
|
| 30 |
+
|
| 31 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
| 32 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
| 33 |
+
|
| 34 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
| 35 |
+
|
| 36 |
+
$this->_addContent($this->getLayout()->createBlock('stepincheckout/adminhtml_selectstore_edit'))
|
| 37 |
+
->_addLeft($this->getLayout()->createBlock('stepincheckout/adminhtml_selectstore_edit_tabs'));
|
| 38 |
+
|
| 39 |
+
$this->renderLayout();
|
| 40 |
+
} else {
|
| 41 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('stepincheckout')->__('Store not exist'));
|
| 42 |
+
$this->_redirect('*/*/');
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
public function newAction() {
|
| 47 |
+
$this->_forward('edit');
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
public function saveAction() {
|
| 51 |
+
$id = $this->getRequest()->getParam('id');
|
| 52 |
+
if ($data = $this->getRequest()->getPost()) {
|
| 53 |
+
try {
|
| 54 |
+
|
| 55 |
+
$model = Mage::getModel('stepincheckout/selectstore');
|
| 56 |
+
$model->setData($data)
|
| 57 |
+
->setId($id);
|
| 58 |
+
|
| 59 |
+
$model->save();
|
| 60 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('stepincheckout')->__('Store saved successfully'));
|
| 61 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
| 62 |
+
|
| 63 |
+
if ($this->getRequest()->getParam('back')) {
|
| 64 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
| 65 |
+
return;
|
| 66 |
+
}
|
| 67 |
+
$this->_redirect('*/*/');
|
| 68 |
+
return;
|
| 69 |
+
} catch (Exception $e) {
|
| 70 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 71 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
| 72 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 73 |
+
return;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
$this->_redirect('*/*/');
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
public function deleteAction() {
|
| 82 |
+
if ($this->getRequest()->getParam('id') > 0) {
|
| 83 |
+
try {
|
| 84 |
+
$model = Mage::getModel('stepincheckout/selectstore');
|
| 85 |
+
|
| 86 |
+
$model->setId($this->getRequest()->getParam('id'))
|
| 87 |
+
->delete();
|
| 88 |
+
|
| 89 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Store successfully deleted'));
|
| 90 |
+
$this->_redirect('*/*/');
|
| 91 |
+
} catch (Exception $e) {
|
| 92 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 93 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
| 94 |
+
}
|
| 95 |
+
}
|
| 96 |
+
$this->_redirect('*/*/');
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
public function massDeleteAction() {
|
| 100 |
+
$storeIds = $this->getRequest()->getParam('store_id');
|
| 101 |
+
if (!is_array($storeIds)) {
|
| 102 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select Store(s)'));
|
| 103 |
+
} else {
|
| 104 |
+
try {
|
| 105 |
+
foreach ($storeIds as $storeId) {
|
| 106 |
+
$store = Mage::getModel('stepincheckout/selectstore')->load($storeId);
|
| 107 |
+
$store->delete();
|
| 108 |
+
}
|
| 109 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
| 110 |
+
Mage::helper('adminhtml')->__(
|
| 111 |
+
'Total of %d record(s) is successfully deleted', count($storeIds)
|
| 112 |
+
)
|
| 113 |
+
);
|
| 114 |
+
} catch (Exception $e) {
|
| 115 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
$this->_redirect('*/*/index');
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
}
|
app/code/local/PI/Stepincheckout/controllers/Checkout/OnepageController.php
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once ('Mage/Checkout/controllers/OnepageController.php');
|
| 4 |
+
|
| 5 |
+
class PI_Stepincheckout_Checkout_OnepageController extends Mage_Checkout_OnepageController {
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Shipping method save action
|
| 11 |
+
*/
|
| 12 |
+
public function saveShippingMethodAction() {
|
| 13 |
+
if ($this->_expireAjax()) {
|
| 14 |
+
return;
|
| 15 |
+
}
|
| 16 |
+
if ($this->getRequest()->isPost()) {
|
| 17 |
+
$data = $this->getRequest()->getPost('shipping_method', '');
|
| 18 |
+
$result = $this->getOnepage()->saveShippingMethod($data);
|
| 19 |
+
// $result will contain error data if shipping method is empty
|
| 20 |
+
if (!$result) {
|
| 21 |
+
Mage::dispatchEvent(
|
| 22 |
+
'checkout_controller_onepage_save_shipping_method', array(
|
| 23 |
+
'request' => $this->getRequest(),
|
| 24 |
+
'quote' => $this->getOnepage()->getQuote()));
|
| 25 |
+
$this->getOnepage()->getQuote()->collectTotals();
|
| 26 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
| 27 |
+
|
| 28 |
+
$result['goto_section'] = 'select_store'; //add new code for new step store
|
| 29 |
+
|
| 30 |
+
}
|
| 31 |
+
$this->getOnepage()->getQuote()->collectTotals()->save();
|
| 32 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
}
|
app/code/local/PI/Stepincheckout/controllers/IndexController.php
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
require_once ('Mage/Checkout/controllers/OnepageController.php');
|
| 4 |
+
|
| 5 |
+
class PI_Stepincheckout_IndexController extends Mage_Checkout_OnepageController
|
| 6 |
+
{
|
| 7 |
+
public function indexAction()
|
| 8 |
+
{
|
| 9 |
+
//echo 1;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
public function saveStoreAction()
|
| 13 |
+
{
|
| 14 |
+
if ($this->_expireAjax()) {
|
| 15 |
+
return;
|
| 16 |
+
}
|
| 17 |
+
if ($this->getRequest()->isPost()) {
|
| 18 |
+
$data = $this->getRequest()->getPost();
|
| 19 |
+
|
| 20 |
+
$result = $this->getOnepage()->saveSelectedStore($data);
|
| 21 |
+
|
| 22 |
+
if (!isset($result['error'])) {
|
| 23 |
+
$result['goto_section'] = 'payment';
|
| 24 |
+
$result['update_section'] = array(
|
| 25 |
+
'name' => 'payment-method',
|
| 26 |
+
'html' => $this->_getPaymentMethodsHtml()
|
| 27 |
+
);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
}
|
app/code/local/PI/Stepincheckout/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
|
| 3 |
+
<config>
|
| 4 |
+
<menu>
|
| 5 |
+
<pistores translate="title">
|
| 6 |
+
<title>Manage stores</title>
|
| 7 |
+
<sort_order>77</sort_order>
|
| 8 |
+
<children>
|
| 9 |
+
<stores translate="title">
|
| 10 |
+
<title>stores</title>
|
| 11 |
+
<sort_order>6</sort_order>
|
| 12 |
+
<action>adminhtml/sitestore</action>
|
| 13 |
+
<!--on click i.e on action our controller inside the adminhtml will call.-->
|
| 14 |
+
</stores>
|
| 15 |
+
</children>
|
| 16 |
+
</pistores>
|
| 17 |
+
</menu>
|
| 18 |
+
<acl>
|
| 19 |
+
<resources>
|
| 20 |
+
<admin>
|
| 21 |
+
<children>
|
| 22 |
+
<pistores translate="title" module="stepincheckout">
|
| 23 |
+
<title>Manage stores</title>
|
| 24 |
+
<sort_order>76</sort_order>
|
| 25 |
+
<children>
|
| 26 |
+
<stores translate="title" module="stepincheckout">
|
| 27 |
+
<title>stores</title>
|
| 28 |
+
</stores>
|
| 29 |
+
</children>
|
| 30 |
+
</pistores>
|
| 31 |
+
</children>
|
| 32 |
+
</admin>
|
| 33 |
+
</resources>
|
| 34 |
+
</acl>
|
| 35 |
+
</config>
|
app/code/local/PI/Stepincheckout/etc/config.xml
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<config>
|
| 2 |
+
<modules>
|
| 3 |
+
<PI_Stepincheckout>
|
| 4 |
+
<version>0.1.2</version>
|
| 5 |
+
</PI_Stepincheckout>
|
| 6 |
+
</modules>
|
| 7 |
+
<admin>
|
| 8 |
+
<routers>
|
| 9 |
+
<adminhtml>
|
| 10 |
+
<args>
|
| 11 |
+
<modules>
|
| 12 |
+
<PI_Stepincheckout before="Mage_Adminhtml">PI_Stepincheckout_Adminhtml</PI_Stepincheckout>
|
| 13 |
+
</modules>
|
| 14 |
+
</args>
|
| 15 |
+
</adminhtml>
|
| 16 |
+
</routers>
|
| 17 |
+
</admin>
|
| 18 |
+
<frontend>
|
| 19 |
+
<routers>
|
| 20 |
+
<stepincheckout>
|
| 21 |
+
<use>standard</use>
|
| 22 |
+
<args>
|
| 23 |
+
<module>PI_Stepincheckout</module>
|
| 24 |
+
<frontName>stepincheckout</frontName>
|
| 25 |
+
</args>
|
| 26 |
+
</stepincheckout>
|
| 27 |
+
<checkout>
|
| 28 |
+
<args>
|
| 29 |
+
<modules>
|
| 30 |
+
<PI_Stepincheckout before="Mage_Checkout">PI_Stepincheckout_Checkout</PI_Stepincheckout>
|
| 31 |
+
</modules>
|
| 32 |
+
</args>
|
| 33 |
+
</checkout>
|
| 34 |
+
</routers>
|
| 35 |
+
<layout>
|
| 36 |
+
<updates>
|
| 37 |
+
<stepincheckout>
|
| 38 |
+
<file>stepincheckout.xml</file>
|
| 39 |
+
</stepincheckout>
|
| 40 |
+
</updates>
|
| 41 |
+
</layout>
|
| 42 |
+
<events>
|
| 43 |
+
<sales_convert_quote_to_order>
|
| 44 |
+
<observers>
|
| 45 |
+
<convertSelectedStore_observer>
|
| 46 |
+
<type>singleton</type>
|
| 47 |
+
<class>PI_Stepincheckout_Model_Observer</class>
|
| 48 |
+
<method>convertSelectedStore</method>
|
| 49 |
+
</convertSelectedStore_observer>
|
| 50 |
+
</observers>
|
| 51 |
+
</sales_convert_quote_to_order>
|
| 52 |
+
</events>
|
| 53 |
+
</frontend>
|
| 54 |
+
<adminhtml>
|
| 55 |
+
<layout>
|
| 56 |
+
<updates>
|
| 57 |
+
<stepincheckout>
|
| 58 |
+
<file>stepincheckout.xml</file>
|
| 59 |
+
</stepincheckout>
|
| 60 |
+
</updates>
|
| 61 |
+
</layout>
|
| 62 |
+
</adminhtml>
|
| 63 |
+
<global>
|
| 64 |
+
<blocks>
|
| 65 |
+
<stepincheckout>
|
| 66 |
+
<class>PI_Stepincheckout_Block</class>
|
| 67 |
+
</stepincheckout>
|
| 68 |
+
<checkout>
|
| 69 |
+
<rewrite>
|
| 70 |
+
<onepage>PI_Stepincheckout_Block_Checkout_Onepage</onepage>
|
| 71 |
+
</rewrite>
|
| 72 |
+
</checkout>
|
| 73 |
+
</blocks>
|
| 74 |
+
<models>
|
| 75 |
+
<checkout>
|
| 76 |
+
<rewrite>
|
| 77 |
+
<type_onepage>PI_Stepincheckout_Model_Checkout_Type_Onepage</type_onepage>
|
| 78 |
+
</rewrite>
|
| 79 |
+
</checkout>
|
| 80 |
+
<stepincheckout>
|
| 81 |
+
<class>PI_Stepincheckout_Model</class>
|
| 82 |
+
<resourceModel>stepincheckout_resource</resourceModel>
|
| 83 |
+
</stepincheckout>
|
| 84 |
+
<stepincheckout_resource>
|
| 85 |
+
<class>PI_Stepincheckout_Model_Resource</class>
|
| 86 |
+
<entities>
|
| 87 |
+
<store>
|
| 88 |
+
<table>stepincheckout_store</table>
|
| 89 |
+
</store>
|
| 90 |
+
</entities>
|
| 91 |
+
</stepincheckout_resource>
|
| 92 |
+
</models>
|
| 93 |
+
<resources>
|
| 94 |
+
<stepincheckout_setup>
|
| 95 |
+
<setup>
|
| 96 |
+
<module>PI_Stepincheckout</module>
|
| 97 |
+
</setup>
|
| 98 |
+
<connection>
|
| 99 |
+
<use>core_setup</use>
|
| 100 |
+
</connection>
|
| 101 |
+
</stepincheckout_setup>
|
| 102 |
+
</resources>
|
| 103 |
+
<helpers>
|
| 104 |
+
<stepincheckout>
|
| 105 |
+
<class>PI_Stepincheckout_Helper</class>
|
| 106 |
+
</stepincheckout>
|
| 107 |
+
</helpers>
|
| 108 |
+
|
| 109 |
+
<fieldsets>
|
| 110 |
+
<sales_convert_quote>
|
| 111 |
+
<selected_store>
|
| 112 |
+
<to_order>*</to_order>
|
| 113 |
+
</selected_store>
|
| 114 |
+
<select_substitution>
|
| 115 |
+
<to_order>*</to_order>
|
| 116 |
+
</select_substitution>
|
| 117 |
+
</sales_convert_quote>
|
| 118 |
+
<sales_convert_order>
|
| 119 |
+
<selected_store>
|
| 120 |
+
<to_quote>*</to_quote>
|
| 121 |
+
</selected_store>
|
| 122 |
+
<select_substitution>
|
| 123 |
+
<to_quote>*</to_quote>
|
| 124 |
+
</select_substitution>
|
| 125 |
+
</sales_convert_order>
|
| 126 |
+
</fieldsets>
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
<pdf>
|
| 130 |
+
<totals>
|
| 131 |
+
<selected_store translate="title">
|
| 132 |
+
<title>Selected Store</title>
|
| 133 |
+
<source_field>selected_store</source_field>
|
| 134 |
+
<model>stepincheckout/sales_order_pdf_selectedstore</model>
|
| 135 |
+
<font_size>7</font_size>
|
| 136 |
+
<display_zero>0</display_zero>
|
| 137 |
+
<sort_order>650</sort_order>
|
| 138 |
+
</selected_store>
|
| 139 |
+
</totals>
|
| 140 |
+
</pdf>
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
<!--Add selected store price in total-->
|
| 144 |
+
<sales>
|
| 145 |
+
<quote>
|
| 146 |
+
<totals>
|
| 147 |
+
<selected_store>
|
| 148 |
+
<class>stepincheckout/sales_quote_address_total_price</class>
|
| 149 |
+
</selected_store>
|
| 150 |
+
</totals>
|
| 151 |
+
</quote>
|
| 152 |
+
<order_invoice>
|
| 153 |
+
<totals>
|
| 154 |
+
<selected_store>
|
| 155 |
+
<class>stepincheckout/sales_order_total_invoice_price</class>
|
| 156 |
+
</selected_store>
|
| 157 |
+
</totals>
|
| 158 |
+
</order_invoice>
|
| 159 |
+
<order_creditmemo>
|
| 160 |
+
<totals>
|
| 161 |
+
<selected_store>
|
| 162 |
+
<class>stepincheckout/sales_order_total_creditmemo_price</class>
|
| 163 |
+
</selected_store>
|
| 164 |
+
</totals>
|
| 165 |
+
</order_creditmemo>
|
| 166 |
+
</sales>
|
| 167 |
+
</global>
|
| 168 |
+
</config>
|
app/code/local/PI/Stepincheckout/sql/stepincheckout_setup/mysql4-install-0.1.0.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$this->startSetup();
|
| 3 |
+
$table = new Varien_Db_Ddl_Table();
|
| 4 |
+
$table->setName($this->getTable('stepincheckout/store'));
|
| 5 |
+
$table->addColumn(
|
| 6 |
+
'store_id',
|
| 7 |
+
Varien_Db_Ddl_Table::TYPE_INTEGER,
|
| 8 |
+
10,
|
| 9 |
+
array(
|
| 10 |
+
'auto_increment' => true,
|
| 11 |
+
'unsigned' => true,
|
| 12 |
+
'nullable'=> false,
|
| 13 |
+
'primary' => true
|
| 14 |
+
)
|
| 15 |
+
);
|
| 16 |
+
|
| 17 |
+
$table->addColumn(
|
| 18 |
+
'name',
|
| 19 |
+
Varien_Db_Ddl_Table::TYPE_VARCHAR,
|
| 20 |
+
255,
|
| 21 |
+
array(
|
| 22 |
+
'nullable' => false,
|
| 23 |
+
)
|
| 24 |
+
);
|
| 25 |
+
|
| 26 |
+
$table->addColumn(
|
| 27 |
+
'price',
|
| 28 |
+
Varien_Db_Ddl_Table::TYPE_FLOAT,
|
| 29 |
+
10,
|
| 30 |
+
array(
|
| 31 |
+
'nullable' => false,
|
| 32 |
+
)
|
| 33 |
+
);
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
$table->setOption('type', 'InnoDB');
|
| 37 |
+
$table->setOption('charset', 'utf8');
|
| 38 |
+
$this->getConnection()->createTable($table);
|
| 39 |
+
|
| 40 |
+
$this->endSetup();
|
app/code/local/PI/Stepincheckout/sql/stepincheckout_setup/upgrade-0.1.0-0.1.1.php
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$installer = $this;
|
| 3 |
+
$installer->startSetup();
|
| 4 |
+
|
| 5 |
+
//Add Column to sales table
|
| 6 |
+
$this->_conn->addColumn($this->getTable('sales/quote'), 'selected_store', 'float');
|
| 7 |
+
|
| 8 |
+
$this->_conn->addColumn($this->getTable('sales/order'), 'selected_store', 'float');
|
| 9 |
+
|
| 10 |
+
$installer->endSetup();
|
app/code/local/PI/Stepincheckout/sql/stepincheckout_setup/upgrade-0.1.1-0.1.2.php
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$installer = $this;
|
| 3 |
+
$installer->startSetup();
|
| 4 |
+
|
| 5 |
+
//Add Column to sales table
|
| 6 |
+
$this->_conn->addColumn($this->getTable('sales/invoice'), 'selected_store', 'float');
|
| 7 |
+
|
| 8 |
+
$this->_conn->addColumn($this->getTable('sales/shipment'), 'selected_store', 'float');
|
| 9 |
+
|
| 10 |
+
$this->_conn->addColumn($this->getTable('sales/creditmemo'), 'selected_store', 'float');
|
| 11 |
+
|
| 12 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/layout/stepincheckout.xml
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<adminhtml_sales_order_view>
|
| 4 |
+
<reference name="order_totals">
|
| 5 |
+
<block type="adminhtml/sales_order_totals_item" name="selectedStore" template="stepincheckout/sales/order/total.phtml">
|
| 6 |
+
</block>
|
| 7 |
+
<block type="adminhtml/sales_order_totals_item" name="selectedStore.refunded" template="stepincheckout/sales/order/refunded.phtml">
|
| 8 |
+
<action method="setDisplayArea"><area>footer</area></action>
|
| 9 |
+
<action method="setAfterCondition"><condition>last</condition></action>
|
| 10 |
+
</block>
|
| 11 |
+
</reference>
|
| 12 |
+
<reference name="order_tab_info">
|
| 13 |
+
<action method="setTemplate">
|
| 14 |
+
<template>stepincheckout/sales/order/view/tab/info.phtml</template>
|
| 15 |
+
</action>
|
| 16 |
+
</reference>
|
| 17 |
+
</adminhtml_sales_order_view>
|
| 18 |
+
|
| 19 |
+
<adminhtml_sales_order_invoice_new>
|
| 20 |
+
<reference name="invoice_totals">
|
| 21 |
+
<block type="adminhtml/sales_order_totals_item" name="selectedStore" template="stepincheckout/sales/order/total.phtml">
|
| 22 |
+
</block>
|
| 23 |
+
</reference>
|
| 24 |
+
<reference name="form">
|
| 25 |
+
<action method="setTemplate">
|
| 26 |
+
<template>stepincheckout/sales/order/invoice/create/form.phtml</template>
|
| 27 |
+
</action>
|
| 28 |
+
</reference>
|
| 29 |
+
</adminhtml_sales_order_invoice_new>
|
| 30 |
+
|
| 31 |
+
<adminhtml_sales_order_invoice_updateqty>
|
| 32 |
+
<reference name="invoice_totals">
|
| 33 |
+
<block type="adminhtml/sales_order_totals_item" name="selectedStore" template="stepincheckout/sales/order/total.phtml">
|
| 34 |
+
</block>
|
| 35 |
+
</reference>
|
| 36 |
+
</adminhtml_sales_order_invoice_updateqty>
|
| 37 |
+
|
| 38 |
+
<adminhtml_sales_order_invoice_view>
|
| 39 |
+
<reference name="invoice_totals">
|
| 40 |
+
<block type="adminhtml/sales_order_totals_item" name="selectedStore" template="stepincheckout/sales/order/total.phtml">
|
| 41 |
+
</block>
|
| 42 |
+
</reference>
|
| 43 |
+
<reference name="form">
|
| 44 |
+
<action method="setTemplate">
|
| 45 |
+
<template>stepincheckout/sales/order/invoice/view/form.phtml</template>
|
| 46 |
+
</action>
|
| 47 |
+
</reference>
|
| 48 |
+
</adminhtml_sales_order_invoice_view>
|
| 49 |
+
|
| 50 |
+
<adminhtml_sales_order_creditmemo_new>
|
| 51 |
+
<reference name="creditmemo_totals">
|
| 52 |
+
<block type="adminhtml/sales_order_totals_item" name="selectedStore" template="stepincheckout/sales/order/total.phtml">
|
| 53 |
+
</block>
|
| 54 |
+
</reference>
|
| 55 |
+
</adminhtml_sales_order_creditmemo_new>
|
| 56 |
+
|
| 57 |
+
<adminhtml_sales_order_creditmemo_updateqty>
|
| 58 |
+
<reference name="creditmemo_totals">
|
| 59 |
+
<block type="adminhtml/sales_order_totals_item" name="selectedStore" template="stepincheckout/sales/order/total.phtml">
|
| 60 |
+
</block>
|
| 61 |
+
</reference>
|
| 62 |
+
</adminhtml_sales_order_creditmemo_updateqty>
|
| 63 |
+
|
| 64 |
+
<adminhtml_sales_order_creditmemo_view>
|
| 65 |
+
<reference name="creditmemo_totals">
|
| 66 |
+
<block type="adminhtml/sales_order_totals_item" name="selectedStore.refunded" template="stepincheckout/sales/order/refunded.phtml">
|
| 67 |
+
<action method="setDisplayArea"><area>footer</area></action>
|
| 68 |
+
</block>
|
| 69 |
+
</reference>
|
| 70 |
+
</adminhtml_sales_order_creditmemo_view>
|
| 71 |
+
</layout>
|
app/design/adminhtml/default/default/template/stepincheckout/sales/order/invoice/create/form.phtml
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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@magento.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.magento.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category design
|
| 22 |
+
* @package default_default
|
| 23 |
+
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
?>
|
| 27 |
+
<form id="edit_form" method="post" action="<?php echo $this->getSaveUrl() ?>">
|
| 28 |
+
<?php echo $this->getBlockHtml('formkey')?>
|
| 29 |
+
<?php $_order = $this->getInvoice()->getOrder() ?>
|
| 30 |
+
<?php echo $this->getChildHtml('order_info') ?>
|
| 31 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
| 32 |
+
<div class="box-left">
|
| 33 |
+
<?php else: ?>
|
| 34 |
+
<div class="box-right">
|
| 35 |
+
<?php endif; ?>
|
| 36 |
+
|
| 37 |
+
<div class="entry-edit">
|
| 38 |
+
<div class="entry-edit-head">
|
| 39 |
+
<h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
|
| 40 |
+
</div>
|
| 41 |
+
<fieldset>
|
| 42 |
+
<div><?php echo $this->getChildHtml('order_payment') ?></div>
|
| 43 |
+
<div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
|
| 44 |
+
</fieldset>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
| 48 |
+
<div class="box-right">
|
| 49 |
+
<!--Shipping Address-->
|
| 50 |
+
<div class="entry-edit">
|
| 51 |
+
<div class="entry-edit-head">
|
| 52 |
+
<h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping Information') ?></h4>
|
| 53 |
+
</div>
|
| 54 |
+
<fieldset>
|
| 55 |
+
<div>
|
| 56 |
+
<strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
|
| 57 |
+
<?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
|
| 58 |
+
|
| 59 |
+
<?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
|
| 60 |
+
<?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
|
| 61 |
+
<?php else: ?>
|
| 62 |
+
<?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
|
| 63 |
+
<?php endif; ?>
|
| 64 |
+
<?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
|
| 65 |
+
|
| 66 |
+
<?php echo $_excl; ?>
|
| 67 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
| 68 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
| 69 |
+
<?php endif; ?>
|
| 70 |
+
</div>
|
| 71 |
+
<?php if ($this->canCreateShipment() && $this->canShipPartiallyItem()): ?>
|
| 72 |
+
<p class="nm">
|
| 73 |
+
<label for="invoice_do_shipment" class="normal"><?php echo Mage::helper('sales')->__('Create Shipment') ?></label>
|
| 74 |
+
<input type="checkbox" name="invoice[do_shipment]" id="invoice_do_shipment" value="1" <?php echo $this->hasInvoiceShipmentTypeMismatch()?' disabled="disabled"':'' ?> />
|
| 75 |
+
</p>
|
| 76 |
+
<?php if ($this->hasInvoiceShipmentTypeMismatch()): ?>
|
| 77 |
+
<small><?php echo $this->__('Some items in this order have different invoice and shipment types. You can create shipment only after the invoice is created.') ?></small>
|
| 78 |
+
<?php endif; ?>
|
| 79 |
+
<?php endif; ?>
|
| 80 |
+
<div id="tracking" style="display:none;"><?php echo $this->getChildHtml('tracking',false) ?></div>
|
| 81 |
+
</fieldset>
|
| 82 |
+
</div>
|
| 83 |
+
</div>
|
| 84 |
+
<?php endif; ?>
|
| 85 |
+
<div class="clear"></div>
|
| 86 |
+
<!--Display Selected Store-->
|
| 87 |
+
<?php if($_order->getSelectedStore()):?>
|
| 88 |
+
<?php
|
| 89 |
+
$storeId = $_order->getSelectedStore();
|
| 90 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($storeId);
|
| 91 |
+
?>
|
| 92 |
+
<div class="box-left">
|
| 93 |
+
<div class="entry-edit">
|
| 94 |
+
<div class="entry-edit-head">
|
| 95 |
+
<h4><?php echo Mage::helper('sales')->__('Selected Store') ?></h4>
|
| 96 |
+
</div>
|
| 97 |
+
<fieldset>
|
| 98 |
+
<?php if($storeDetail->getPrice()!=0):?>
|
| 99 |
+
<div>
|
| 100 |
+
<strong><?php echo $storeDetail->getName()?> - </strong>
|
| 101 |
+
<span><?php echo Mage::helper('core')->currency($storeDetail->getPrice(), true, false);?></span>
|
| 102 |
+
</div>
|
| 103 |
+
<?php else:?>
|
| 104 |
+
<div>
|
| 105 |
+
<strong><?php echo $storeDetail->getName()?> - </strong>
|
| 106 |
+
<span><?php echo $this->__('Free');?></span>
|
| 107 |
+
</div>
|
| 108 |
+
<?php endif;?>
|
| 109 |
+
</fieldset>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
<div class="clear"></div>
|
| 113 |
+
<?php endif;?>
|
| 114 |
+
<div class="entry-edit">
|
| 115 |
+
<div class="entry-edit-head">
|
| 116 |
+
<?php
|
| 117 |
+
$_itemsGridLabel = $this->getForcedShipmentCreate()?'Items to Invoice and Ship':'Items to Invoice';
|
| 118 |
+
?>
|
| 119 |
+
<h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('%s', $_itemsGridLabel) ?></h4>
|
| 120 |
+
</div>
|
| 121 |
+
</div>
|
| 122 |
+
<div id="invoice_item_container">
|
| 123 |
+
<?php echo $this->getChildHtml('order_items') ?>
|
| 124 |
+
</div>
|
| 125 |
+
</form>
|
| 126 |
+
<script type="text/javascript">
|
| 127 |
+
//<![CDATA[
|
| 128 |
+
var createShipment = $('invoice_do_shipment');
|
| 129 |
+
if (createShipment) {
|
| 130 |
+
createShipment.observe('click', function(e){
|
| 131 |
+
if (createShipment.checked) {
|
| 132 |
+
document.getElementById('tracking').style.display = 'block';
|
| 133 |
+
} else {
|
| 134 |
+
document.getElementById('tracking').style.display = 'none'
|
| 135 |
+
}
|
| 136 |
+
})
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
/*forced creating of shipment*/
|
| 140 |
+
var forcedShipmentCreate = <?php echo $this->getForcedShipmentCreate() ?>;
|
| 141 |
+
var shipmentElement = $('invoice_do_shipment');
|
| 142 |
+
if (forcedShipmentCreate && shipmentElement) {
|
| 143 |
+
shipmentElement.checked = true;
|
| 144 |
+
shipmentElement.disabled = true;
|
| 145 |
+
document.getElementById('tracking').style.display = 'block';
|
| 146 |
+
}
|
| 147 |
+
//]]>
|
| 148 |
+
</script>
|
app/design/adminhtml/default/default/template/stepincheckout/sales/order/invoice/view/form.phtml
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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@magento.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.magento.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category design
|
| 22 |
+
* @package default_default
|
| 23 |
+
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
?>
|
| 27 |
+
<?php $_invoice = $this->getInvoice() ?>
|
| 28 |
+
<?php $_order = $_invoice->getOrder() ?>
|
| 29 |
+
<?php echo $this->getChildHtml('order_info') ?>
|
| 30 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
| 31 |
+
<div class="box-left">
|
| 32 |
+
<?php else: ?>
|
| 33 |
+
<div class="box-right">
|
| 34 |
+
<?php endif; ?>
|
| 35 |
+
<!--Billing Address-->
|
| 36 |
+
<div class="entry-edit">
|
| 37 |
+
<div class="entry-edit-head">
|
| 38 |
+
<h4 class="icon-head head-payment-method"><?php echo $this->helper('sales')->__('Payment Information') ?></h4>
|
| 39 |
+
</div>
|
| 40 |
+
<fieldset>
|
| 41 |
+
<div><?php echo $this->getChildHtml('order_payment') ?></div>
|
| 42 |
+
<div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
|
| 43 |
+
</fieldset>
|
| 44 |
+
</div>
|
| 45 |
+
</div>
|
| 46 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
| 47 |
+
<div class="box-right">
|
| 48 |
+
<!--Shipping Address-->
|
| 49 |
+
<div class="entry-edit">
|
| 50 |
+
<div class="entry-edit-head">
|
| 51 |
+
<h4 class="icon-head head-shipping-method"><?php echo $this->helper('sales')->__('Shipping Information') ?></h4>
|
| 52 |
+
</div>
|
| 53 |
+
<fieldset>
|
| 54 |
+
<strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
|
| 55 |
+
<?php echo $this->helper('sales')->__('Total Shipping Charges'); ?>:
|
| 56 |
+
|
| 57 |
+
<?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
|
| 58 |
+
<?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
|
| 59 |
+
<?php else: ?>
|
| 60 |
+
<?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
|
| 61 |
+
<?php endif; ?>
|
| 62 |
+
<?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
|
| 63 |
+
|
| 64 |
+
<?php echo $_excl; ?>
|
| 65 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
| 66 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
| 67 |
+
<?php endif; ?>
|
| 68 |
+
<div><?php echo $this->getChildHtml('shipment_tracking') ?></div>
|
| 69 |
+
</fieldset>
|
| 70 |
+
</div>
|
| 71 |
+
<?php endif; ?>
|
| 72 |
+
</div>
|
| 73 |
+
<div class="clear"></div>
|
| 74 |
+
<!--Display Selected Store-->
|
| 75 |
+
<?php if($_order->getSelectedStore()):?>
|
| 76 |
+
<?php
|
| 77 |
+
$storeId = $_order->getSelectedStore();
|
| 78 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($storeId);
|
| 79 |
+
?>
|
| 80 |
+
<div class="box-left">
|
| 81 |
+
<div class="entry-edit">
|
| 82 |
+
<div class="entry-edit-head">
|
| 83 |
+
<h4><?php echo Mage::helper('sales')->__('Selected Store') ?></h4>
|
| 84 |
+
</div>
|
| 85 |
+
<fieldset>
|
| 86 |
+
<?php if($storeDetail->getPrice()!=0):?>
|
| 87 |
+
<div>
|
| 88 |
+
<strong><?php echo $storeDetail->getName()?> - </strong>
|
| 89 |
+
<span><?php echo Mage::helper('core')->currency($storeDetail->getPrice(), true, false);?></span>
|
| 90 |
+
</div>
|
| 91 |
+
<?php else:?>
|
| 92 |
+
<div>
|
| 93 |
+
<strong><?php echo $storeDetail->getName()?> - </strong>
|
| 94 |
+
<span><?php echo $this->__('Free');?></span>
|
| 95 |
+
</div>
|
| 96 |
+
<?php endif;?>
|
| 97 |
+
</fieldset>
|
| 98 |
+
</div>
|
| 99 |
+
</div>
|
| 100 |
+
<div class="clear"></div>
|
| 101 |
+
<?php endif;?>
|
| 102 |
+
<div class="entry-edit">
|
| 103 |
+
<div class="entry-edit-head">
|
| 104 |
+
<h4 class="icon-head head-products"><?php echo $this->helper('sales')->__('Items Invoiced') ?></h4>
|
| 105 |
+
</div>
|
| 106 |
+
<div id="invoice_item_container">
|
| 107 |
+
<?php echo $this->getChildHtml('invoice_items') ?>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
|
| 111 |
+
<div class="box-left entry-edit">
|
| 112 |
+
<div class="entry-edit-head"><h4><?php echo $this->__('Invoice History') ?></h4></div>
|
| 113 |
+
<fieldset><?php echo $this->getChildHtml('order_comments') ?></fieldset>
|
| 114 |
+
</div>
|
| 115 |
+
|
| 116 |
+
<div class="box-right entry-edit" id="history_form">
|
| 117 |
+
<div class="entry-edit-head"><h4><?php echo $this->__('Invoice Totals') ?></h4></div>
|
| 118 |
+
<div class="order-totals"><?php echo $this->getChildHtml('invoice_totals') ?></div>
|
| 119 |
+
</div>
|
| 120 |
+
<div class="clear"></div>
|
app/design/adminhtml/default/default/template/stepincheckout/sales/order/refunded.phtml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php $this->setPriceDataObject($this->getSource()) ?>
|
| 2 |
+
<?php if ((float) $this->getSource()->getSelectedStore()): ?>
|
| 3 |
+
<?php
|
| 4 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($this->getSource()->getSelectedStore());
|
| 5 |
+
|
| 6 |
+
$amt = $storeDetail->getPrice();
|
| 7 |
+
?>
|
| 8 |
+
<tr>
|
| 9 |
+
<td class="label"><?php echo Mage::helper('stepincheckout')->__('Selected Store') ?></td>
|
| 10 |
+
<td>
|
| 11 |
+
<?php echo $this->displayPrices($amt, $amt); ?>
|
| 12 |
+
</td>
|
| 13 |
+
</tr>
|
| 14 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/stepincheckout/sales/order/total.phtml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php $this->setPriceDataObject($this->getSource()) ?>
|
| 2 |
+
<?php if ((float) $this->getSource()->getSelectedStore()): ?>
|
| 3 |
+
<?php
|
| 4 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($this->getSource()->getSelectedStore());
|
| 5 |
+
|
| 6 |
+
$amt = $storeDetail->getPrice();
|
| 7 |
+
?>
|
| 8 |
+
<tr>
|
| 9 |
+
<td class="label"><?php echo Mage::helper('stepincheckout')->__('Selected Store') ?></td>
|
| 10 |
+
<td>
|
| 11 |
+
<?php echo $this->displayPrices($amt, $amt); ?>
|
| 12 |
+
</td>
|
| 13 |
+
</tr>
|
| 14 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/stepincheckout/sales/order/view/tab/info.phtml
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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@magento.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.magento.com for more information.
|
| 20 |
+
*
|
| 21 |
+
* @category design
|
| 22 |
+
* @package default_default
|
| 23 |
+
* @copyright Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
|
| 24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 25 |
+
*/
|
| 26 |
+
?>
|
| 27 |
+
<?php /** @var $this Mage_Adminhtml_Block_Sales_Order_View_Tab_Info */ ?>
|
| 28 |
+
<?php $_order = $this->getOrder() ?>
|
| 29 |
+
<div>
|
| 30 |
+
<div id="order-messages">
|
| 31 |
+
<?php echo $this->getChildHtml('order_messages') ?>
|
| 32 |
+
</div>
|
| 33 |
+
<?php echo $this->getChildHtml('order_info') ?>
|
| 34 |
+
<input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
|
| 35 |
+
<?php if ($_order->getIsVirtual()): ?>
|
| 36 |
+
<div class="box-right">
|
| 37 |
+
<?php else: ?>
|
| 38 |
+
<div class="box-left">
|
| 39 |
+
<?php endif; ?>
|
| 40 |
+
<!--Payment Method-->
|
| 41 |
+
<div class="entry-edit">
|
| 42 |
+
<div class="entry-edit-head">
|
| 43 |
+
<h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
|
| 44 |
+
</div>
|
| 45 |
+
<fieldset>
|
| 46 |
+
<?php echo $this->getPaymentHtml() ?>
|
| 47 |
+
<div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
|
| 48 |
+
</fieldset>
|
| 49 |
+
</div>
|
| 50 |
+
</div>
|
| 51 |
+
<?php if (!$_order->getIsVirtual()): ?>
|
| 52 |
+
<div class="box-right">
|
| 53 |
+
<!--Shipping Method-->
|
| 54 |
+
<div class="entry-edit">
|
| 55 |
+
<div class="entry-edit-head">
|
| 56 |
+
<h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping & Handling Information') ?></h4>
|
| 57 |
+
</div>
|
| 58 |
+
<fieldset>
|
| 59 |
+
<?php if ($_order->getTracksCollection()->count()) : ?>
|
| 60 |
+
<a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>
|
| 61 |
+
<br/>
|
| 62 |
+
<?php endif; ?>
|
| 63 |
+
<?php if ($_order->getShippingDescription()): ?>
|
| 64 |
+
<strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
|
| 65 |
+
|
| 66 |
+
<?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
|
| 67 |
+
<?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
|
| 68 |
+
<?php else: ?>
|
| 69 |
+
<?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
|
| 70 |
+
<?php endif; ?>
|
| 71 |
+
<?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
|
| 72 |
+
|
| 73 |
+
<?php echo $_excl; ?>
|
| 74 |
+
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
|
| 75 |
+
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
|
| 76 |
+
<?php endif; ?>
|
| 77 |
+
<?php else: ?>
|
| 78 |
+
<?php echo $this->helper('sales')->__('No shipping information available'); ?>
|
| 79 |
+
<?php endif; ?>
|
| 80 |
+
</fieldset>
|
| 81 |
+
</div>
|
| 82 |
+
</div>
|
| 83 |
+
<?php endif; ?>
|
| 84 |
+
<div class="clear"></div>
|
| 85 |
+
<!--Display Selected Store-->
|
| 86 |
+
<?php if($_order->getSelectedStore()):?>
|
| 87 |
+
<?php
|
| 88 |
+
$storeId = $_order->getSelectedStore();
|
| 89 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($storeId);
|
| 90 |
+
?>
|
| 91 |
+
<div class="box-left">
|
| 92 |
+
<div class="entry-edit">
|
| 93 |
+
<div class="entry-edit-head">
|
| 94 |
+
<h4><?php echo Mage::helper('sales')->__('Selected Store') ?></h4>
|
| 95 |
+
</div>
|
| 96 |
+
<fieldset>
|
| 97 |
+
<?php if($storeDetail->getPrice()!=0):?>
|
| 98 |
+
<div>
|
| 99 |
+
<strong><?php echo $storeDetail->getName()?> - </strong>
|
| 100 |
+
<span><?php echo Mage::helper('core')->currency($storeDetail->getPrice(), true, false);?></span>
|
| 101 |
+
</div>
|
| 102 |
+
<?php else:?>
|
| 103 |
+
<div>
|
| 104 |
+
<strong><?php echo $storeDetail->getName()?> - </strong>
|
| 105 |
+
<span><?php echo $this->__('Free');?></span>
|
| 106 |
+
</div>
|
| 107 |
+
<?php endif;?>
|
| 108 |
+
</fieldset>
|
| 109 |
+
</div>
|
| 110 |
+
</div>
|
| 111 |
+
<div class="clear"></div>
|
| 112 |
+
<?php endif;?>
|
| 113 |
+
<?php echo $this->getGiftOptionsHtml() ?>
|
| 114 |
+
<div class="clear"></div>
|
| 115 |
+
<div class="entry-edit">
|
| 116 |
+
<div class="entry-edit-head">
|
| 117 |
+
<h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
|
| 118 |
+
</div>
|
| 119 |
+
</div>
|
| 120 |
+
<?php echo $this->getItemsHtml() ?>
|
| 121 |
+
<div class="clear"></div>
|
| 122 |
+
|
| 123 |
+
<div class="box-left">
|
| 124 |
+
<div class="entry-edit">
|
| 125 |
+
<div class="entry-edit-head">
|
| 126 |
+
<h4><?php echo Mage::helper('sales')->__('Comments History') ?></h4>
|
| 127 |
+
</div>
|
| 128 |
+
<fieldset><?php echo $this->getChildHtml('order_history') ?></fieldset>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
<div class="box-right entry-edit">
|
| 132 |
+
<div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
|
| 133 |
+
<div class="order-totals"><?php echo $this->getChildHtml('order_totals') ?></div>
|
| 134 |
+
</div>
|
| 135 |
+
<div class="clear"></div>
|
| 136 |
+
</div>
|
| 137 |
+
|
| 138 |
+
<?php echo $this->getChildHtml('popup_window');?>
|
| 139 |
+
<script type="text/javascript">
|
| 140 |
+
//<![CDATA[
|
| 141 |
+
/**
|
| 142 |
+
* Retrieve gift options tooltip content
|
| 143 |
+
*/
|
| 144 |
+
function getGiftOptionsTooltipContent(itemId) {
|
| 145 |
+
var contentLines = [];
|
| 146 |
+
var headerLine = null;
|
| 147 |
+
var contentLine = null;
|
| 148 |
+
|
| 149 |
+
$$('#gift_options_data_' + itemId + ' .gift-options-tooltip-content').each(function (element) {
|
| 150 |
+
if (element.down(0)) {
|
| 151 |
+
headerLine = element.down(0).innerHTML;
|
| 152 |
+
contentLine = element.down(0).next().innerHTML;
|
| 153 |
+
if (contentLine.length > 30) {
|
| 154 |
+
contentLine = contentLine.slice(0,30) + '...';
|
| 155 |
+
}
|
| 156 |
+
contentLines.push(headerLine + ' ' + contentLine);
|
| 157 |
+
}
|
| 158 |
+
});
|
| 159 |
+
return contentLines.join('<br/>');
|
| 160 |
+
}
|
| 161 |
+
giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
|
| 162 |
+
//]]>
|
| 163 |
+
</script>
|
app/design/frontend/base/default/layout/stepincheckout.xml
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout>
|
| 3 |
+
<checkout_onepage_index> <!-- Adding our new step to onepage block -->
|
| 4 |
+
<reference name="head">
|
| 5 |
+
<action method="addItem"><type>skin_js</type><name>js/stepincheckout/store.js</name></action>
|
| 6 |
+
</reference>
|
| 7 |
+
<reference name="checkout.onepage">
|
| 8 |
+
<action method="setTemplate">
|
| 9 |
+
<name>stepincheckout/checkout/onepage.phtml</name>
|
| 10 |
+
</action>
|
| 11 |
+
<block type="stepincheckout/checkout_onepage_selectstore" name="stepincheckout.checkout.onepage.selectstore" as="select_store" template="stepincheckout/checkout/onepage/selectstore.phtml"/>
|
| 12 |
+
</reference>
|
| 13 |
+
<reference name="checkout.progress">
|
| 14 |
+
<action method="setTemplate">
|
| 15 |
+
<name>stepincheckout/checkout/onepage/progress.phtml</name>
|
| 16 |
+
</action>
|
| 17 |
+
<block type="checkout/onepage_progress" name="selectstore.progress" template="stepincheckout/checkout/onepage/progress/select_store.phtml"></block>
|
| 18 |
+
</reference>
|
| 19 |
+
</checkout_onepage_index>
|
| 20 |
+
<checkout_onepage_progress>
|
| 21 |
+
<reference name="root">
|
| 22 |
+
<action method="setTemplate">
|
| 23 |
+
<name>stepincheckout/checkout/onepage/progress.phtml</name>
|
| 24 |
+
</action>
|
| 25 |
+
<block type="checkout/onepage_progress" name="selectstore.progress" template="stepincheckout/checkout/onepage/progress/select_store.phtml"></block>
|
| 26 |
+
</reference>
|
| 27 |
+
</checkout_onepage_progress>
|
| 28 |
+
|
| 29 |
+
<checkout_onepage_progress_select_store>
|
| 30 |
+
<!-- Mage_Checkout -->
|
| 31 |
+
<remove name="right"/>
|
| 32 |
+
<remove name="left"/>
|
| 33 |
+
|
| 34 |
+
<block type="checkout/onepage_progress" name="root" output="toHtml" template="stepincheckout/checkout/onepage/progress/select_store.phtml">
|
| 35 |
+
<action method="setInfoTemplate"><method></method><template></template></action>
|
| 36 |
+
</block>
|
| 37 |
+
</checkout_onepage_progress_select_store>
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
<sales_order_view>
|
| 43 |
+
<reference name="order_totals">
|
| 44 |
+
<block type="stepincheckout/sales_order_total" name="stepincheckout.sales.order.total" />
|
| 45 |
+
</reference>
|
| 46 |
+
</sales_order_view>
|
| 47 |
+
<sales_order_print>
|
| 48 |
+
<reference name="order_totals">
|
| 49 |
+
<block type="stepincheckout/sales_order_total" name="stepincheckout.sales.order.total" />
|
| 50 |
+
</reference>
|
| 51 |
+
</sales_order_print>
|
| 52 |
+
<sales_email_order_items>
|
| 53 |
+
<reference name="order_totals">
|
| 54 |
+
<block type="stepincheckout/sales_order_total" name="stepincheckout.sales.order.total" />
|
| 55 |
+
</reference>
|
| 56 |
+
</sales_email_order_items>
|
| 57 |
+
|
| 58 |
+
<sales_order_invoice>
|
| 59 |
+
<reference name="invoice_totals">
|
| 60 |
+
<block type="stepincheckout/sales_order_total" name="stepincheckout.sales.order.total" />
|
| 61 |
+
</reference>
|
| 62 |
+
</sales_order_invoice>
|
| 63 |
+
<sales_order_printinvoice>
|
| 64 |
+
<reference name="invoice_totals">
|
| 65 |
+
<block type="stepincheckout/sales_order_total" name="stepincheckout.sales.order.total" />
|
| 66 |
+
</reference>
|
| 67 |
+
</sales_order_printinvoice>
|
| 68 |
+
<sales_email_order_invoice_items>
|
| 69 |
+
<reference name="invoice_totals">
|
| 70 |
+
<block type="stepincheckout/sales_order_total" name="stepincheckout.sales.order.total" />
|
| 71 |
+
</reference>
|
| 72 |
+
</sales_email_order_invoice_items>
|
| 73 |
+
|
| 74 |
+
<sales_order_creditmemo>
|
| 75 |
+
<reference name="creditmemo_totals">
|
| 76 |
+
<block type="stepincheckout/sales_order_total" name="stepincheckout.sales.order.total" />
|
| 77 |
+
</reference>
|
| 78 |
+
</sales_order_creditmemo>
|
| 79 |
+
<sales_order_printcreditmemo>
|
| 80 |
+
<reference name="creditmemo_totals">
|
| 81 |
+
<block type="stepincheckout/sales_order_total" name="stepincheckout.sales.order.total" />
|
| 82 |
+
</reference>
|
| 83 |
+
</sales_order_printcreditmemo>
|
| 84 |
+
<sales_email_order_creditmemo_items>
|
| 85 |
+
<reference name="creditmemo_totals">
|
| 86 |
+
<block type="stepincheckout/sales_order_total" name="stepincheckout.sales.order.total" />
|
| 87 |
+
</reference>
|
| 88 |
+
</sales_email_order_creditmemo_items>
|
| 89 |
+
|
| 90 |
+
</layout>
|
app/design/frontend/base/default/template/stepincheckout/checkout/onepage.phtml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 rwd_default
|
| 23 |
+
* @copyright Copyright (c) 2014 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="page-title">
|
| 28 |
+
<h1><?php echo $this->__('Checkout') ?></h1>
|
| 29 |
+
</div>
|
| 30 |
+
<script type="text/javascript" src="<?php echo $this->getJsUrl('varien/accordion.js') ?>"></script>
|
| 31 |
+
<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/stepincheckout/opcheckout.js') ?>"></script>
|
| 32 |
+
<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/opcheckout_rwd.js') ?>"></script>
|
| 33 |
+
<ol class="opc opc-firststep-<?php echo $this->getActiveStep() ?>" id="checkoutSteps">
|
| 34 |
+
<?php $i=0; foreach($this->getSteps() as $_stepId => $_stepInfo): ?>
|
| 35 |
+
<?php if (!$this->getChild($_stepId) || !$this->getChild($_stepId)->isShow()): continue; endif; $i++ ?>
|
| 36 |
+
<li id="opc-<?php echo $_stepId ?>" class="section<?php echo !empty($_stepInfo['allow'])?' allow':'' ?><?php echo !empty($_stepInfo['complete'])?' saved':'' ?>">
|
| 37 |
+
<div class="step-title">
|
| 38 |
+
<span class="number"><?php echo $i ?></span>
|
| 39 |
+
<h2><?php echo $_stepInfo['label'] ?></h2>
|
| 40 |
+
<a href="#"><?php echo $this->__('Edit') ?></a>
|
| 41 |
+
</div>
|
| 42 |
+
<div id="checkout-step-<?php echo $_stepId ?>" class="step a-item" style="display:none;">
|
| 43 |
+
<?php echo $this->getChildHtml($_stepId) ?>
|
| 44 |
+
</div>
|
| 45 |
+
</li>
|
| 46 |
+
<?php endforeach ?>
|
| 47 |
+
</ol>
|
| 48 |
+
<script type="text/javascript">
|
| 49 |
+
//<![CDATA[
|
| 50 |
+
var accordion = new Accordion('checkoutSteps', '.step-title', true);
|
| 51 |
+
<?php if($this->getActiveStep()): ?>
|
| 52 |
+
accordion.openSection('opc-<?php echo $this->getActiveStep() ?>');
|
| 53 |
+
<?php endif ?>
|
| 54 |
+
var checkout = new Checkout(accordion,{
|
| 55 |
+
progress: '<?php echo $this->getUrl('checkout/onepage/progress') ?>',
|
| 56 |
+
review: '<?php echo $this->getUrl('checkout/onepage/review') ?>',
|
| 57 |
+
saveMethod: '<?php echo $this->getUrl('checkout/onepage/saveMethod') ?>',
|
| 58 |
+
failure: '<?php echo $this->getUrl('checkout/cart') ?>'}
|
| 59 |
+
);
|
| 60 |
+
//]]>
|
| 61 |
+
</script>
|
app/design/frontend/base/default/template/stepincheckout/checkout/onepage/progress.phtml
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 rwd_default
|
| 23 |
+
* @copyright Copyright (c) 2014 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="block block-progress opc-block-progress<?php if (!$this->isCustomerLoggedIn()/* && !$this->getCheckout()->getStepData('billing', 'is_show')*/): ?> opc-block-progress-step-login<?php endif; ?>">
|
| 28 |
+
<div class="block-title">
|
| 29 |
+
<strong><span><?php echo $this->__('Your Checkout Progress') ?></span></strong>
|
| 30 |
+
</div>
|
| 31 |
+
<div class="block-content">
|
| 32 |
+
<dl>
|
| 33 |
+
<?php if ($this->getCheckout()->getStepData('billing', 'is_show')): ?>
|
| 34 |
+
<div id="billing-progress-opcheckout">
|
| 35 |
+
<?php echo $this->getChildHtml('billing.progress') ?>
|
| 36 |
+
</div>
|
| 37 |
+
<?php endif; ?>
|
| 38 |
+
|
| 39 |
+
<?php if ($this->getCheckout()->getStepData('shipping', 'is_show')): ?>
|
| 40 |
+
<div id="shipping-progress-opcheckout">
|
| 41 |
+
<?php echo $this->getChildHtml('shipping.progress') ?>
|
| 42 |
+
</div>
|
| 43 |
+
<?php endif; ?>
|
| 44 |
+
|
| 45 |
+
<?php if ($this->getCheckout()->getStepData('shipping_method', 'is_show')): ?>
|
| 46 |
+
<div id="shipping_method-progress-opcheckout">
|
| 47 |
+
<?php echo $this->getChildHtml('shippingmethod.progress') ?>
|
| 48 |
+
</div>
|
| 49 |
+
<?php endif; ?>
|
| 50 |
+
|
| 51 |
+
<?php if ($this->getCheckout()->getStepData('select_store', 'is_show')): ?>
|
| 52 |
+
<div id="select_store-progress-opcheckout">
|
| 53 |
+
<?php echo $this->getChildHtml('selectstore.progress') ?>
|
| 54 |
+
</div>
|
| 55 |
+
<?php endif; ?>
|
| 56 |
+
|
| 57 |
+
<?php if ($this->getCheckout()->getStepData('payment', 'is_show')): ?>
|
| 58 |
+
<div id="payment-progress-opcheckout">
|
| 59 |
+
<?php echo $this->getChildHtml('payment.progress') ?>
|
| 60 |
+
</div>
|
| 61 |
+
<?php endif; ?>
|
| 62 |
+
</dl>
|
| 63 |
+
</div>
|
| 64 |
+
</div>
|
| 65 |
+
|
app/design/frontend/base/default/template/stepincheckout/checkout/onepage/progress/select_store.phtml
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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) 2014 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 |
+
<?php if ($this->getCheckout()->getStepData('select_store', 'complete')): ?>
|
| 28 |
+
<dt class="complete">
|
| 29 |
+
<?php echo $this->__('Selected Store') ?> <span class="changelink"><span class="separator">|</span> <a
|
| 30 |
+
href="#select_store"
|
| 31 |
+
onclick="checkout.changeSection('opc-select_store'); return false;"><?php echo $this->__('Change') ?></a></span>
|
| 32 |
+
</dt>
|
| 33 |
+
<dd class="complete">
|
| 34 |
+
<?php
|
| 35 |
+
$selectedStore = $this->getQuote()->getSelectedStore();
|
| 36 |
+
$storeDetail = Mage::getModel('stepincheckout/selectstore')->load($selectedStore);
|
| 37 |
+
?>
|
| 38 |
+
<?php if($storeDetail->getPrice()!=0):?>
|
| 39 |
+
<div>
|
| 40 |
+
<strong><?php echo $storeDetail->getName()?> - </strong>
|
| 41 |
+
<span><?php echo Mage::helper('core')->currency($storeDetail->getPrice(), true, false);?></span>
|
| 42 |
+
</div>
|
| 43 |
+
<?php else:?>
|
| 44 |
+
<div>
|
| 45 |
+
<strong><?php echo $storeDetail->getName()?> - </strong>
|
| 46 |
+
<span><?php echo $this->__('Free');?></span>
|
| 47 |
+
</div>
|
| 48 |
+
<?php endif;?>
|
| 49 |
+
</dd>
|
| 50 |
+
<?php else: ?>
|
| 51 |
+
<dt>
|
| 52 |
+
<?php echo $this->__('Selected Store') ?>
|
| 53 |
+
</dt>
|
| 54 |
+
<?php endif; ?>
|
| 55 |
+
|
app/design/frontend/base/default/template/stepincheckout/checkout/onepage/selectstore.phtml
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$stores = Mage::getModel('stepincheckout/selectstore')->getCollection();
|
| 3 |
+
?>
|
| 4 |
+
<form id="co-select-store-form" action="">
|
| 5 |
+
<div class="fieldset">
|
| 6 |
+
<ul class="form-list">
|
| 7 |
+
<li id="store-form">
|
| 8 |
+
<div class="fieldset">
|
| 9 |
+
<ul>
|
| 10 |
+
<li class="wide">
|
| 11 |
+
<label for="select-store" class="required"><em>*</em><?php echo $this->__('Select a store') ?></label>
|
| 12 |
+
<div class="input-box">
|
| 13 |
+
<select name="selected_store" class="required-select">
|
| 14 |
+
<?php foreach ($stores as $store): ?>
|
| 15 |
+
<?php if($store->getPrice()!=0):?>
|
| 16 |
+
<?php $price = Mage::helper('core')->currency($store->getPrice(), true, false)?>
|
| 17 |
+
<?php else:?>
|
| 18 |
+
<?php $price = $this->__('Free')?>
|
| 19 |
+
<?php endif;?>
|
| 20 |
+
<option value="<?php echo $store->getId() ?>" <?php if ($this->getQuote()->getSelectedStore() == $store->getId()): ?>selected="selected"<?php endif; ?>><?php echo $store->getName() ?> - <?php echo $price;?></option>
|
| 21 |
+
<?php endforeach; ?>
|
| 22 |
+
</select>
|
| 23 |
+
</div>
|
| 24 |
+
</li>
|
| 25 |
+
</ul>
|
| 26 |
+
</div>
|
| 27 |
+
</li>
|
| 28 |
+
</ul>
|
| 29 |
+
|
| 30 |
+
<div class="buttons-set" id="select-store-buttons-container">
|
| 31 |
+
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
|
| 32 |
+
<button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="selectStore.save()"><span><span><?php echo $this->__('Continue') ?></span></span></button>
|
| 33 |
+
<span class="please-wait" id="select-store-please-wait" style="display:none;">
|
| 34 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
|
| 35 |
+
</span>
|
| 36 |
+
</div>
|
| 37 |
+
</div>
|
| 38 |
+
</form>
|
| 39 |
+
<script type="text/javascript">
|
| 40 |
+
//<![CDATA[
|
| 41 |
+
var selectStore = new selectStore('co-select-store-form', "<?php echo $this->getUrl('stepincheckout/index/saveStore') ?>");
|
| 42 |
+
var storeForm = new VarienForm('co-select-store-form');
|
| 43 |
+
//]]>
|
| 44 |
+
</script>
|
app/etc/modules/PI_Stepincheckout.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<PI_Stepincheckout>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>local</codePool>
|
| 7 |
+
</PI_Stepincheckout>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>PI_Selectstore</name>
|
| 4 |
+
<version>0.1.2</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>You can use this extension in order to add store, so that customer's can select their require store at the of checkout.</summary>
|
| 10 |
+
<description>This extension has a feature in admin so that you can add stores from admin with their prices.
|
| 11 |
+
After that customer can select their require store at the time of checkout.
|
| 12 |
+
</description>
|
| 13 |
+
<notes>This is a stable version.</notes>
|
| 14 |
+
<authors><author><name>pureimagination</name><user>pureimagination</user><email>johncarter15oct@gmail.com</email></author></authors>
|
| 15 |
+
<date>2015-06-04</date>
|
| 16 |
+
<time>09:36:23</time>
|
| 17 |
+
<contents><target name="magelocal"><dir name="PI"><dir name="Stepincheckout"><dir name="Block"><dir name="Adminhtml"><dir name="Selectstore"><dir name="Edit"><file name="Form.php" hash="4f3cbbe6e93557e5b2aeaa2cc38af69e"/><dir name="Tab"><file name="Store.php" hash="4dfa7b04921ee2c351c405e28bda16ff"/></dir><file name="Tabs.php" hash="babe0815a7d20bde78cadb4d15896442"/></dir><file name="Edit.php" hash="5e6190d2a50e49a56e4b4b410c1e445c"/><file name="Grid.php" hash="42a45ad5964e7b955af3f1a87489134c"/></dir><file name="Selectstore.php" hash="483312d24adc6f821f3709712787bb37"/></dir><dir name="Checkout"><dir name="Onepage"><file name="Selectstore.php" hash="48ae54e7d4e39bd0790c75b1b9ecf120"/></dir><file name="Onepage.php" hash="7c1c9929ad2125e998c06ca75b56f9a1"/></dir><dir name="Sales"><dir name="Order"><file name="Total.php" hash="dc83ea9019724ec20aa0fab5c00ea1ed"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="117ff13fd61786daf42ed461bd94e12d"/></dir><dir name="Model"><dir name="Checkout"><dir name="Type"><file name="Onepage.php" hash="d5fb14b341e01df35dcd63c70c3b0223"/></dir></dir><file name="Observer.php" hash="c64aaf86ab769b9cb531f10cf89a5611"/><dir name="Resource"><dir name="Selectstore"><file name="Collection.php" hash="d6ba76d27e2219dd7b550adea56efd9d"/></dir><file name="Selectstore.php" hash="511eccdc8938f4de8a654a6c7f05b841"/></dir><dir name="Sales"><dir name="Order"><dir name="Pdf"><file name="Selectedstore.php" hash="741192b47b9fada32daf55b980bb6211"/></dir><dir name="Total"><dir name="Creditmemo"><file name="Price.php" hash="c18c3ac9391bd1268c29310e26c0207e"/></dir><dir name="Invoice"><file name="Price.php" hash="ffb11ecb3da2ba0024ab9774c7e01b8a"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Price.php" hash="c5cefd18f3bbb0cf0761f44d30082037"/></dir></dir></dir></dir><file name="Selectstore.php" hash="927454f35eb44108f526ebb81e22b3ae"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SitestoreController.php" hash="5abcea7ed45f23ae9a49788dcf38aea6"/></dir><dir name="Checkout"><file name="OnepageController.php" hash="0a7bea1d139cbd133ce5315440b59f11"/></dir><file name="IndexController.php" hash="45c2ab168601df03f91f79d8d3732c2b"/></dir><dir name="etc"><file name="adminhtml.xml" hash="21527005680ef3d2f62ab03c81b6a45b"/><file name="config.xml" hash="527040acc407771e2d98a32cf22dc68d"/></dir><dir name="sql"><dir name="stepincheckout_setup"><file name="mysql4-install-0.1.0.php" hash="6a75df70d6c005fd7ac5dfaaff9a5863"/><file name="upgrade-0.1.0-0.1.1.php" hash="6d4ddffb21c7b1d4669e7b1515f5f6b5"/><file name="upgrade-0.1.1-0.1.2.php" hash="6d7ba6b42d2e435608031de4cbfb1e83"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PI_Stepincheckout.xml" hash="73201f9076d5dfae4f5c9868b4252393"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="stepincheckout"><dir name="sales"><dir name="order"><dir name="invoice"><dir name="create"><file name="form.phtml" hash="df88f18e7ace9fc5d7451b1a74c06968"/></dir><dir name="view"><file name="form.phtml" hash="2784c5626b926bcf12451752ab418ea5"/></dir></dir><file name="refunded.phtml" hash="baeb7c0872e649c427bb7140a870df57"/><file name="total.phtml" hash="586d0a7a53e82bc24b99a644553addff"/><dir name="view"><dir name="tab"><file name="info.phtml" hash="2565b525fffb3ca417ea6f838e9bf486"/></dir></dir></dir></dir></dir></dir><dir name="layout"><file name="stepincheckout.xml" hash="a40e4e26cc562e5c66e363c4aaffd71e"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="stepincheckout"><dir name="checkout"><dir name="onepage"><dir name="progress"><file name="select_store.phtml" hash="f5b1367484ac4fbf04c34e1835cdcd7f"/></dir><file name="progress.phtml" hash="bc06147f3a4b1d2603cb2fd219a29de5"/><file name="selectstore.phtml" hash="b7d92008b1e1726a849f96181b466103"/></dir><file name="onepage.phtml" hash="82d0d14c769363e3fa7c9e787f8760b3"/></dir></dir></dir><dir name="layout"><file name="stepincheckout.xml" hash="4f7a2dc7af3346340821ecc7b6d43c80"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="js"><dir name="stepincheckout"><file name="opcheckout.js" hash="3812c59ed43c32e10a2a1d14d1813470"/><file name="store.js" hash="1716fd76416c7489cab4a06701f2259a"/></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/js/stepincheckout/opcheckout.js
ADDED
|
@@ -0,0 +1,929 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Magento
|
| 3 |
+
*
|
| 4 |
+
* NOTICE OF LICENSE
|
| 5 |
+
*
|
| 6 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
| 7 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
| 8 |
+
* It is also available through the world-wide-web at this URL:
|
| 9 |
+
* http://opensource.org/licenses/afl-3.0.php
|
| 10 |
+
* If you did not receive a copy of the license and are unable to
|
| 11 |
+
* obtain it through the world-wide-web, please send an email
|
| 12 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
| 13 |
+
*
|
| 14 |
+
* DISCLAIMER
|
| 15 |
+
*
|
| 16 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
| 17 |
+
* versions in the future. If you wish to customize Magento for your
|
| 18 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
| 19 |
+
*
|
| 20 |
+
* @category design
|
| 21 |
+
* @package base_default
|
| 22 |
+
* @copyright Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
|
| 23 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
| 24 |
+
*/
|
| 25 |
+
var Checkout = Class.create();
|
| 26 |
+
Checkout.prototype = {
|
| 27 |
+
initialize: function(accordion, urls) {
|
| 28 |
+
this.accordion = accordion;
|
| 29 |
+
this.progressUrl = urls.progress;
|
| 30 |
+
this.reviewUrl = urls.review;
|
| 31 |
+
this.saveMethodUrl = urls.saveMethod;
|
| 32 |
+
this.failureUrl = urls.failure;
|
| 33 |
+
this.billingForm = false;
|
| 34 |
+
this.shippingForm = false;
|
| 35 |
+
this.syncBillingShipping = false;
|
| 36 |
+
this.method = '';
|
| 37 |
+
this.payment = '';
|
| 38 |
+
this.loadWaiting = false;
|
| 39 |
+
this.steps = ['login', 'billing', 'shipping', 'shipping_method','select_store', 'payment', 'review'];//add new code for new step store
|
| 40 |
+
//We use billing as beginning step since progress bar tracks from billing
|
| 41 |
+
this.currentStep = 'billing';
|
| 42 |
+
|
| 43 |
+
this.accordion.sections.each(function(section) {
|
| 44 |
+
Event.observe($(section).down('.step-title'), 'click', this._onSectionClick.bindAsEventListener(this));
|
| 45 |
+
}.bind(this));
|
| 46 |
+
|
| 47 |
+
this.accordion.disallowAccessToNextSections = true;
|
| 48 |
+
},
|
| 49 |
+
/**
|
| 50 |
+
* Section header click handler
|
| 51 |
+
*
|
| 52 |
+
* @param event
|
| 53 |
+
*/
|
| 54 |
+
_onSectionClick: function(event) {
|
| 55 |
+
var section = $(Event.element(event).up().up());
|
| 56 |
+
if (section.hasClassName('allow')) {
|
| 57 |
+
Event.stop(event);
|
| 58 |
+
this.gotoSection(section.readAttribute('id').replace('opc-', ''), false);
|
| 59 |
+
return false;
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
ajaxFailure: function() {
|
| 63 |
+
location.href = this.failureUrl;
|
| 64 |
+
},
|
| 65 |
+
reloadProgressBlock: function(toStep) {
|
| 66 |
+
this.reloadStep(toStep);
|
| 67 |
+
if (this.syncBillingShipping) {
|
| 68 |
+
this.syncBillingShipping = false;
|
| 69 |
+
this.reloadStep('shipping');
|
| 70 |
+
}
|
| 71 |
+
},
|
| 72 |
+
reloadStep: function(prevStep) {
|
| 73 |
+
var updater = new Ajax.Updater(prevStep + '-progress-opcheckout', this.progressUrl, {
|
| 74 |
+
method: 'get',
|
| 75 |
+
onFailure: this.ajaxFailure.bind(this),
|
| 76 |
+
onComplete: function() {
|
| 77 |
+
this.checkout.resetPreviousSteps();
|
| 78 |
+
},
|
| 79 |
+
parameters: prevStep ? {prevStep: prevStep} : null
|
| 80 |
+
});
|
| 81 |
+
},
|
| 82 |
+
reloadReviewBlock: function() {
|
| 83 |
+
var updater = new Ajax.Updater('checkout-review-load', this.reviewUrl, {method: 'get', onFailure: this.ajaxFailure.bind(this)});
|
| 84 |
+
},
|
| 85 |
+
_disableEnableAll: function(element, isDisabled) {
|
| 86 |
+
var descendants = element.descendants();
|
| 87 |
+
for (var k in descendants) {
|
| 88 |
+
descendants[k].disabled = isDisabled;
|
| 89 |
+
}
|
| 90 |
+
element.disabled = isDisabled;
|
| 91 |
+
},
|
| 92 |
+
setLoadWaiting: function(step, keepDisabled) {
|
| 93 |
+
if (step) {
|
| 94 |
+
if (this.loadWaiting) {
|
| 95 |
+
this.setLoadWaiting(false);
|
| 96 |
+
}
|
| 97 |
+
var container = $(step + '-buttons-container');
|
| 98 |
+
container.addClassName('disabled');
|
| 99 |
+
container.setStyle({opacity: .5});
|
| 100 |
+
this._disableEnableAll(container, true);
|
| 101 |
+
Element.show(step + '-please-wait');
|
| 102 |
+
} else {
|
| 103 |
+
if (this.loadWaiting) {
|
| 104 |
+
var container = $(this.loadWaiting + '-buttons-container');
|
| 105 |
+
var isDisabled = (keepDisabled ? true : false);
|
| 106 |
+
if (!isDisabled) {
|
| 107 |
+
container.removeClassName('disabled');
|
| 108 |
+
container.setStyle({opacity: 1});
|
| 109 |
+
}
|
| 110 |
+
this._disableEnableAll(container, isDisabled);
|
| 111 |
+
Element.hide(this.loadWaiting + '-please-wait');
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
this.loadWaiting = step;
|
| 115 |
+
},
|
| 116 |
+
gotoSection: function(section, reloadProgressBlock) {
|
| 117 |
+
|
| 118 |
+
if (reloadProgressBlock) {
|
| 119 |
+
this.reloadProgressBlock(this.currentStep);
|
| 120 |
+
}
|
| 121 |
+
this.currentStep = section;
|
| 122 |
+
var sectionElement = $('opc-' + section);
|
| 123 |
+
sectionElement.addClassName('allow');
|
| 124 |
+
this.accordion.openSection('opc-' + section);
|
| 125 |
+
if (!reloadProgressBlock) {
|
| 126 |
+
this.resetPreviousSteps();
|
| 127 |
+
}
|
| 128 |
+
},
|
| 129 |
+
resetPreviousSteps: function() {
|
| 130 |
+
var stepIndex = this.steps.indexOf(this.currentStep);
|
| 131 |
+
|
| 132 |
+
//Clear other steps if already populated through javascript
|
| 133 |
+
for (var i = stepIndex; i < this.steps.length; i++) {
|
| 134 |
+
var nextStep = this.steps[i];
|
| 135 |
+
var progressDiv = nextStep + '-progress-opcheckout';
|
| 136 |
+
if ($(progressDiv)) {
|
| 137 |
+
//Remove the link
|
| 138 |
+
$(progressDiv).select('.changelink').each(function(item) {
|
| 139 |
+
item.remove();
|
| 140 |
+
});
|
| 141 |
+
$(progressDiv).select('dt').each(function(item) {
|
| 142 |
+
item.removeClassName('complete');
|
| 143 |
+
});
|
| 144 |
+
//Remove the content
|
| 145 |
+
$(progressDiv).select('dd.complete').each(function(item) {
|
| 146 |
+
item.remove();
|
| 147 |
+
});
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
},
|
| 151 |
+
changeSection: function(section) {
|
| 152 |
+
var changeStep = section.replace('opc-', '');
|
| 153 |
+
this.gotoSection(changeStep, false);
|
| 154 |
+
},
|
| 155 |
+
setMethod: function() {
|
| 156 |
+
if ($('login:guest') && $('login:guest').checked) {
|
| 157 |
+
this.method = 'guest';
|
| 158 |
+
var request = new Ajax.Request(
|
| 159 |
+
this.saveMethodUrl,
|
| 160 |
+
{method: 'post', onFailure: this.ajaxFailure.bind(this), parameters: {method: 'guest'}}
|
| 161 |
+
);
|
| 162 |
+
Element.hide('register-customer-password');
|
| 163 |
+
this.gotoSection('billing', true);
|
| 164 |
+
}
|
| 165 |
+
else if ($('login:register') && ($('login:register').checked || $('login:register').type == 'hidden')) {
|
| 166 |
+
this.method = 'register';
|
| 167 |
+
var request = new Ajax.Request(
|
| 168 |
+
this.saveMethodUrl,
|
| 169 |
+
{method: 'post', onFailure: this.ajaxFailure.bind(this), parameters: {method: 'register'}}
|
| 170 |
+
);
|
| 171 |
+
Element.show('register-customer-password');
|
| 172 |
+
this.gotoSection('billing', true);
|
| 173 |
+
}
|
| 174 |
+
else {
|
| 175 |
+
alert(Translator.translate('Please choose to register or to checkout as a guest').stripTags());
|
| 176 |
+
return false;
|
| 177 |
+
}
|
| 178 |
+
document.body.fire('login:setMethod', {method: this.method});
|
| 179 |
+
},
|
| 180 |
+
setBilling: function() {
|
| 181 |
+
if (($('billing:use_for_shipping_yes')) && ($('billing:use_for_shipping_yes').checked)) {
|
| 182 |
+
shipping.syncWithBilling();
|
| 183 |
+
$('opc-shipping').addClassName('allow');
|
| 184 |
+
this.gotoSection('shipping_method', true);
|
| 185 |
+
} else if (($('billing:use_for_shipping_no')) && ($('billing:use_for_shipping_no').checked)) {
|
| 186 |
+
$('shipping:same_as_billing').checked = false;
|
| 187 |
+
this.gotoSection('shipping', true);
|
| 188 |
+
} else {
|
| 189 |
+
$('shipping:same_as_billing').checked = true;
|
| 190 |
+
this.gotoSection('shipping', true);
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
// this refreshes the checkout progress column
|
| 194 |
+
|
| 195 |
+
// if ($('billing:use_for_shipping') && $('billing:use_for_shipping').checked){
|
| 196 |
+
// shipping.syncWithBilling();
|
| 197 |
+
// //this.setShipping();
|
| 198 |
+
// //shipping.save();
|
| 199 |
+
// $('opc-shipping').addClassName('allow');
|
| 200 |
+
// this.gotoSection('shipping_method');
|
| 201 |
+
// } else {
|
| 202 |
+
// $('shipping:same_as_billing').checked = false;
|
| 203 |
+
// this.gotoSection('shipping');
|
| 204 |
+
// }
|
| 205 |
+
// this.reloadProgressBlock();
|
| 206 |
+
// //this.accordion.openNextSection(true);
|
| 207 |
+
},
|
| 208 |
+
setShipping: function() {
|
| 209 |
+
//this.nextStep();
|
| 210 |
+
this.gotoSection('shipping_method', true);
|
| 211 |
+
//this.accordion.openNextSection(true);
|
| 212 |
+
},
|
| 213 |
+
setShippingMethod: function() {
|
| 214 |
+
//this.nextStep();
|
| 215 |
+
this.gotoSection('select_store', true);//add new code for new step store
|
| 216 |
+
//this.accordion.openNextSection(true);
|
| 217 |
+
},
|
| 218 |
+
setSelectStore: function() {
|
| 219 |
+
//this.nextStep();
|
| 220 |
+
this.gotoSection('payment', true);//add new code for new step store
|
| 221 |
+
//this.accordion.openNextSection(true);
|
| 222 |
+
},
|
| 223 |
+
setPayment: function() {
|
| 224 |
+
//this.nextStep();
|
| 225 |
+
this.gotoSection('review', true);
|
| 226 |
+
//this.accordion.openNextSection(true);
|
| 227 |
+
},
|
| 228 |
+
setReview: function() {
|
| 229 |
+
this.reloadProgressBlock();
|
| 230 |
+
//this.nextStep();
|
| 231 |
+
//this.accordion.openNextSection(true);
|
| 232 |
+
},
|
| 233 |
+
back: function() {
|
| 234 |
+
if (this.loadWaiting)
|
| 235 |
+
return;
|
| 236 |
+
//Navigate back to the previous available step
|
| 237 |
+
var stepIndex = this.steps.indexOf(this.currentStep);
|
| 238 |
+
var section = this.steps[--stepIndex];
|
| 239 |
+
var sectionElement = $('opc-' + section);
|
| 240 |
+
|
| 241 |
+
//Traverse back to find the available section. Ex Virtual product does not have shipping section
|
| 242 |
+
while (sectionElement === null && stepIndex > 0) {
|
| 243 |
+
--stepIndex;
|
| 244 |
+
section = this.steps[stepIndex];
|
| 245 |
+
sectionElement = $('opc-' + section);
|
| 246 |
+
}
|
| 247 |
+
this.changeSection('opc-' + section);
|
| 248 |
+
},
|
| 249 |
+
setStepResponse: function(response) {
|
| 250 |
+
if (response.update_section) {
|
| 251 |
+
$('checkout-' + response.update_section.name + '-load').update(response.update_section.html);
|
| 252 |
+
}
|
| 253 |
+
if (response.allow_sections) {
|
| 254 |
+
response.allow_sections.each(function(e) {
|
| 255 |
+
$('opc-' + e).addClassName('allow');
|
| 256 |
+
});
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
if (response.duplicateBillingInfo)
|
| 260 |
+
{
|
| 261 |
+
this.syncBillingShipping = true;
|
| 262 |
+
shipping.setSameAsBilling(true);
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
if (response.goto_section) {
|
| 266 |
+
this.gotoSection(response.goto_section, true);
|
| 267 |
+
return true;
|
| 268 |
+
}
|
| 269 |
+
if (response.redirect) {
|
| 270 |
+
location.href = response.redirect;
|
| 271 |
+
return true;
|
| 272 |
+
}
|
| 273 |
+
return false;
|
| 274 |
+
}
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
// billing
|
| 278 |
+
var Billing = Class.create();
|
| 279 |
+
Billing.prototype = {
|
| 280 |
+
initialize: function(form, addressUrl, saveUrl) {
|
| 281 |
+
this.form = form;
|
| 282 |
+
if ($(this.form)) {
|
| 283 |
+
$(this.form).observe('submit', function(event) {
|
| 284 |
+
this.save();
|
| 285 |
+
Event.stop(event);
|
| 286 |
+
}.bind(this));
|
| 287 |
+
}
|
| 288 |
+
this.addressUrl = addressUrl;
|
| 289 |
+
this.saveUrl = saveUrl;
|
| 290 |
+
this.onAddressLoad = this.fillForm.bindAsEventListener(this);
|
| 291 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
| 292 |
+
this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
|
| 293 |
+
},
|
| 294 |
+
setAddress: function(addressId) {
|
| 295 |
+
if (addressId) {
|
| 296 |
+
request = new Ajax.Request(
|
| 297 |
+
this.addressUrl + addressId,
|
| 298 |
+
{method: 'get', onSuccess: this.onAddressLoad, onFailure: checkout.ajaxFailure.bind(checkout)}
|
| 299 |
+
);
|
| 300 |
+
}
|
| 301 |
+
else {
|
| 302 |
+
this.fillForm(false);
|
| 303 |
+
}
|
| 304 |
+
},
|
| 305 |
+
newAddress: function(isNew) {
|
| 306 |
+
if (isNew) {
|
| 307 |
+
this.resetSelectedAddress();
|
| 308 |
+
Element.show('billing-new-address-form');
|
| 309 |
+
} else {
|
| 310 |
+
Element.hide('billing-new-address-form');
|
| 311 |
+
}
|
| 312 |
+
},
|
| 313 |
+
resetSelectedAddress: function() {
|
| 314 |
+
var selectElement = $('billing-address-select')
|
| 315 |
+
if (selectElement) {
|
| 316 |
+
selectElement.value = '';
|
| 317 |
+
}
|
| 318 |
+
},
|
| 319 |
+
fillForm: function(transport) {
|
| 320 |
+
var elementValues = {};
|
| 321 |
+
if (transport && transport.responseText) {
|
| 322 |
+
try {
|
| 323 |
+
elementValues = eval('(' + transport.responseText + ')');
|
| 324 |
+
}
|
| 325 |
+
catch (e) {
|
| 326 |
+
elementValues = {};
|
| 327 |
+
}
|
| 328 |
+
}
|
| 329 |
+
else {
|
| 330 |
+
this.resetSelectedAddress();
|
| 331 |
+
}
|
| 332 |
+
arrElements = Form.getElements(this.form);
|
| 333 |
+
for (var elemIndex in arrElements) {
|
| 334 |
+
if (arrElements[elemIndex].id) {
|
| 335 |
+
var fieldName = arrElements[elemIndex].id.replace(/^billing:/, '');
|
| 336 |
+
arrElements[elemIndex].value = elementValues[fieldName] ? elementValues[fieldName] : '';
|
| 337 |
+
if (fieldName == 'country_id' && billingForm) {
|
| 338 |
+
billingForm.elementChildLoad(arrElements[elemIndex]);
|
| 339 |
+
}
|
| 340 |
+
}
|
| 341 |
+
}
|
| 342 |
+
},
|
| 343 |
+
setUseForShipping: function(flag) {
|
| 344 |
+
$('shipping:same_as_billing').checked = flag;
|
| 345 |
+
},
|
| 346 |
+
save: function() {
|
| 347 |
+
if (checkout.loadWaiting != false)
|
| 348 |
+
return;
|
| 349 |
+
|
| 350 |
+
var validator = new Validation(this.form);
|
| 351 |
+
if (validator.validate()) {
|
| 352 |
+
checkout.setLoadWaiting('billing');
|
| 353 |
+
|
| 354 |
+
// if ($('billing:use_for_shipping') && $('billing:use_for_shipping').checked) {
|
| 355 |
+
// $('billing:use_for_shipping').value=1;
|
| 356 |
+
// }
|
| 357 |
+
|
| 358 |
+
var request = new Ajax.Request(
|
| 359 |
+
this.saveUrl,
|
| 360 |
+
{
|
| 361 |
+
method: 'post',
|
| 362 |
+
onComplete: this.onComplete,
|
| 363 |
+
onSuccess: this.onSave,
|
| 364 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
| 365 |
+
parameters: Form.serialize(this.form)
|
| 366 |
+
}
|
| 367 |
+
);
|
| 368 |
+
}
|
| 369 |
+
},
|
| 370 |
+
resetLoadWaiting: function(transport) {
|
| 371 |
+
checkout.setLoadWaiting(false);
|
| 372 |
+
document.body.fire('billing-request:completed', {transport: transport});
|
| 373 |
+
},
|
| 374 |
+
/**
|
| 375 |
+
This method recieves the AJAX response on success.
|
| 376 |
+
There are 3 options: error, redirect or html with shipping options.
|
| 377 |
+
*/
|
| 378 |
+
nextStep: function(transport) {
|
| 379 |
+
if (transport && transport.responseText) {
|
| 380 |
+
try {
|
| 381 |
+
response = eval('(' + transport.responseText + ')');
|
| 382 |
+
}
|
| 383 |
+
catch (e) {
|
| 384 |
+
response = {};
|
| 385 |
+
}
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
if (response.error) {
|
| 389 |
+
if ((typeof response.message) == 'string') {
|
| 390 |
+
alert(response.message);
|
| 391 |
+
} else {
|
| 392 |
+
if (window.billingRegionUpdater) {
|
| 393 |
+
billingRegionUpdater.update();
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
alert(response.message.join("\n"));
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
return false;
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
checkout.setStepResponse(response);
|
| 403 |
+
payment.initWhatIsCvvListeners();
|
| 404 |
+
// DELETE
|
| 405 |
+
//alert('error: ' + response.error + ' / redirect: ' + response.redirect + ' / shipping_methods_html: ' + response.shipping_methods_html);
|
| 406 |
+
// This moves the accordion panels of one page checkout and updates the checkout progress
|
| 407 |
+
//checkout.setBilling();
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
// shipping
|
| 412 |
+
var Shipping = Class.create();
|
| 413 |
+
Shipping.prototype = {
|
| 414 |
+
initialize: function(form, addressUrl, saveUrl, methodsUrl) {
|
| 415 |
+
this.form = form;
|
| 416 |
+
if ($(this.form)) {
|
| 417 |
+
$(this.form).observe('submit', function(event) {
|
| 418 |
+
this.save();
|
| 419 |
+
Event.stop(event);
|
| 420 |
+
}.bind(this));
|
| 421 |
+
}
|
| 422 |
+
this.addressUrl = addressUrl;
|
| 423 |
+
this.saveUrl = saveUrl;
|
| 424 |
+
this.methodsUrl = methodsUrl;
|
| 425 |
+
this.onAddressLoad = this.fillForm.bindAsEventListener(this);
|
| 426 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
| 427 |
+
this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
|
| 428 |
+
},
|
| 429 |
+
setAddress: function(addressId) {
|
| 430 |
+
if (addressId) {
|
| 431 |
+
request = new Ajax.Request(
|
| 432 |
+
this.addressUrl + addressId,
|
| 433 |
+
{method: 'get', onSuccess: this.onAddressLoad, onFailure: checkout.ajaxFailure.bind(checkout)}
|
| 434 |
+
);
|
| 435 |
+
}
|
| 436 |
+
else {
|
| 437 |
+
this.fillForm(false);
|
| 438 |
+
}
|
| 439 |
+
},
|
| 440 |
+
newAddress: function(isNew) {
|
| 441 |
+
if (isNew) {
|
| 442 |
+
this.resetSelectedAddress();
|
| 443 |
+
Element.show('shipping-new-address-form');
|
| 444 |
+
} else {
|
| 445 |
+
Element.hide('shipping-new-address-form');
|
| 446 |
+
}
|
| 447 |
+
shipping.setSameAsBilling(false);
|
| 448 |
+
},
|
| 449 |
+
resetSelectedAddress: function() {
|
| 450 |
+
var selectElement = $('shipping-address-select')
|
| 451 |
+
if (selectElement) {
|
| 452 |
+
selectElement.value = '';
|
| 453 |
+
}
|
| 454 |
+
},
|
| 455 |
+
fillForm: function(transport) {
|
| 456 |
+
var elementValues = {};
|
| 457 |
+
if (transport && transport.responseText) {
|
| 458 |
+
try {
|
| 459 |
+
elementValues = eval('(' + transport.responseText + ')');
|
| 460 |
+
}
|
| 461 |
+
catch (e) {
|
| 462 |
+
elementValues = {};
|
| 463 |
+
}
|
| 464 |
+
}
|
| 465 |
+
else {
|
| 466 |
+
this.resetSelectedAddress();
|
| 467 |
+
}
|
| 468 |
+
arrElements = Form.getElements(this.form);
|
| 469 |
+
for (var elemIndex in arrElements) {
|
| 470 |
+
if (arrElements[elemIndex].id) {
|
| 471 |
+
var fieldName = arrElements[elemIndex].id.replace(/^shipping:/, '');
|
| 472 |
+
arrElements[elemIndex].value = elementValues[fieldName] ? elementValues[fieldName] : '';
|
| 473 |
+
if (fieldName == 'country_id' && shippingForm) {
|
| 474 |
+
shippingForm.elementChildLoad(arrElements[elemIndex]);
|
| 475 |
+
}
|
| 476 |
+
}
|
| 477 |
+
}
|
| 478 |
+
},
|
| 479 |
+
setSameAsBilling: function(flag) {
|
| 480 |
+
$('shipping:same_as_billing').checked = flag;
|
| 481 |
+
// #5599. Also it hangs up, if the flag is not false
|
| 482 |
+
// $('billing:use_for_shipping_yes').checked = flag;
|
| 483 |
+
if (flag) {
|
| 484 |
+
this.syncWithBilling();
|
| 485 |
+
}
|
| 486 |
+
},
|
| 487 |
+
syncWithBilling: function() {
|
| 488 |
+
$('billing-address-select') && this.newAddress(!$('billing-address-select').value);
|
| 489 |
+
$('shipping:same_as_billing').checked = true;
|
| 490 |
+
if (!$('billing-address-select') || !$('billing-address-select').value) {
|
| 491 |
+
arrElements = Form.getElements(this.form);
|
| 492 |
+
for (var elemIndex in arrElements) {
|
| 493 |
+
if (arrElements[elemIndex].id) {
|
| 494 |
+
var sourceField = $(arrElements[elemIndex].id.replace(/^shipping:/, 'billing:'));
|
| 495 |
+
if (sourceField) {
|
| 496 |
+
arrElements[elemIndex].value = sourceField.value;
|
| 497 |
+
}
|
| 498 |
+
}
|
| 499 |
+
}
|
| 500 |
+
//$('shipping:country_id').value = $('billing:country_id').value;
|
| 501 |
+
shippingRegionUpdater.update();
|
| 502 |
+
$('shipping:region_id').value = $('billing:region_id').value;
|
| 503 |
+
$('shipping:region').value = $('billing:region').value;
|
| 504 |
+
//shippingForm.elementChildLoad($('shipping:country_id'), this.setRegionValue.bind(this));
|
| 505 |
+
} else {
|
| 506 |
+
$('shipping-address-select').value = $('billing-address-select').value;
|
| 507 |
+
}
|
| 508 |
+
},
|
| 509 |
+
setRegionValue: function() {
|
| 510 |
+
$('shipping:region').value = $('billing:region').value;
|
| 511 |
+
},
|
| 512 |
+
save: function() {
|
| 513 |
+
|
| 514 |
+
if (checkout.loadWaiting != false)
|
| 515 |
+
return;
|
| 516 |
+
var validator = new Validation(this.form);
|
| 517 |
+
if (validator.validate()) {
|
| 518 |
+
checkout.setLoadWaiting('shipping');
|
| 519 |
+
var request = new Ajax.Request(
|
| 520 |
+
this.saveUrl,
|
| 521 |
+
{
|
| 522 |
+
method: 'post',
|
| 523 |
+
onComplete: this.onComplete,
|
| 524 |
+
onSuccess: this.onSave,
|
| 525 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
| 526 |
+
parameters: Form.serialize(this.form)
|
| 527 |
+
}
|
| 528 |
+
);
|
| 529 |
+
}
|
| 530 |
+
},
|
| 531 |
+
resetLoadWaiting: function(transport) {
|
| 532 |
+
checkout.setLoadWaiting(false);
|
| 533 |
+
},
|
| 534 |
+
nextStep: function(transport) {
|
| 535 |
+
if (transport && transport.responseText) {
|
| 536 |
+
try {
|
| 537 |
+
response = eval('(' + transport.responseText + ')');
|
| 538 |
+
}
|
| 539 |
+
catch (e) {
|
| 540 |
+
response = {};
|
| 541 |
+
}
|
| 542 |
+
}
|
| 543 |
+
if (response.error) {
|
| 544 |
+
if ((typeof response.message) == 'string') {
|
| 545 |
+
alert(response.message);
|
| 546 |
+
} else {
|
| 547 |
+
if (window.shippingRegionUpdater) {
|
| 548 |
+
shippingRegionUpdater.update();
|
| 549 |
+
}
|
| 550 |
+
alert(response.message.join("\n"));
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
return false;
|
| 554 |
+
}
|
| 555 |
+
|
| 556 |
+
checkout.setStepResponse(response);
|
| 557 |
+
|
| 558 |
+
/*
|
| 559 |
+
var updater = new Ajax.Updater(
|
| 560 |
+
'checkout-shipping-method-load',
|
| 561 |
+
this.methodsUrl,
|
| 562 |
+
{method:'get', onSuccess: checkout.setShipping.bind(checkout)}
|
| 563 |
+
);
|
| 564 |
+
*/
|
| 565 |
+
//checkout.setShipping();
|
| 566 |
+
}
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
// shipping method
|
| 570 |
+
var ShippingMethod = Class.create();
|
| 571 |
+
ShippingMethod.prototype = {
|
| 572 |
+
initialize: function(form, saveUrl) {
|
| 573 |
+
this.form = form;
|
| 574 |
+
if ($(this.form)) {
|
| 575 |
+
$(this.form).observe('submit', function(event) {
|
| 576 |
+
this.save();
|
| 577 |
+
Event.stop(event);
|
| 578 |
+
}.bind(this));
|
| 579 |
+
}
|
| 580 |
+
this.saveUrl = saveUrl;
|
| 581 |
+
this.validator = new Validation(this.form);
|
| 582 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
| 583 |
+
this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
|
| 584 |
+
},
|
| 585 |
+
validate: function() {
|
| 586 |
+
var methods = document.getElementsByName('shipping_method');
|
| 587 |
+
if (methods.length == 0) {
|
| 588 |
+
alert(Translator.translate('Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.').stripTags());
|
| 589 |
+
return false;
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
if (!this.validator.validate()) {
|
| 593 |
+
return false;
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
|
| 597 |
+
for (var i = 0; i < methods.length; i++) {
|
| 598 |
+
if (methods[i].checked) {
|
| 599 |
+
return true;
|
| 600 |
+
}
|
| 601 |
+
}
|
| 602 |
+
alert(Translator.translate('Please specify shipping method.').stripTags());
|
| 603 |
+
return false;
|
| 604 |
+
},
|
| 605 |
+
save: function() {
|
| 606 |
+
|
| 607 |
+
if (checkout.loadWaiting != false)
|
| 608 |
+
return;
|
| 609 |
+
if (this.validate()) {
|
| 610 |
+
checkout.setLoadWaiting('shipping-method');
|
| 611 |
+
var request = new Ajax.Request(
|
| 612 |
+
this.saveUrl,
|
| 613 |
+
{
|
| 614 |
+
method: 'post',
|
| 615 |
+
onComplete: this.onComplete,
|
| 616 |
+
onSuccess: this.onSave,
|
| 617 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
| 618 |
+
parameters: Form.serialize(this.form)
|
| 619 |
+
}
|
| 620 |
+
);
|
| 621 |
+
}
|
| 622 |
+
},
|
| 623 |
+
resetLoadWaiting: function(transport) {
|
| 624 |
+
checkout.setLoadWaiting(false);
|
| 625 |
+
},
|
| 626 |
+
nextStep: function(transport) {
|
| 627 |
+
if (transport && transport.responseText) {
|
| 628 |
+
try {
|
| 629 |
+
response = eval('(' + transport.responseText + ')');
|
| 630 |
+
}
|
| 631 |
+
catch (e) {
|
| 632 |
+
response = {};
|
| 633 |
+
}
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
if (response.error) {
|
| 637 |
+
alert(response.message);
|
| 638 |
+
return false;
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
if (response.update_section) {
|
| 642 |
+
$('checkout-' + response.update_section.name + '-load').update(response.update_section.html);
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
payment.initWhatIsCvvListeners();
|
| 646 |
+
|
| 647 |
+
if (response.goto_section) {
|
| 648 |
+
checkout.gotoSection(response.goto_section, true);
|
| 649 |
+
checkout.reloadProgressBlock();
|
| 650 |
+
return;
|
| 651 |
+
}
|
| 652 |
+
|
| 653 |
+
if (response.payment_methods_html) {
|
| 654 |
+
$('checkout-payment-method-load').update(response.payment_methods_html);
|
| 655 |
+
}
|
| 656 |
+
|
| 657 |
+
checkout.setShippingMethod();
|
| 658 |
+
}
|
| 659 |
+
}
|
| 660 |
+
|
| 661 |
+
|
| 662 |
+
// payment
|
| 663 |
+
var Payment = Class.create();
|
| 664 |
+
Payment.prototype = {
|
| 665 |
+
beforeInitFunc: $H({}),
|
| 666 |
+
afterInitFunc: $H({}),
|
| 667 |
+
beforeValidateFunc: $H({}),
|
| 668 |
+
afterValidateFunc: $H({}),
|
| 669 |
+
initialize: function(form, saveUrl) {
|
| 670 |
+
this.form = form;
|
| 671 |
+
this.saveUrl = saveUrl;
|
| 672 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
| 673 |
+
this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
|
| 674 |
+
},
|
| 675 |
+
addBeforeInitFunction: function(code, func) {
|
| 676 |
+
this.beforeInitFunc.set(code, func);
|
| 677 |
+
},
|
| 678 |
+
beforeInit: function() {
|
| 679 |
+
(this.beforeInitFunc).each(function(init) {
|
| 680 |
+
(init.value)();
|
| 681 |
+
;
|
| 682 |
+
});
|
| 683 |
+
},
|
| 684 |
+
init: function() {
|
| 685 |
+
this.beforeInit();
|
| 686 |
+
var elements = Form.getElements(this.form);
|
| 687 |
+
if ($(this.form)) {
|
| 688 |
+
$(this.form).observe('submit', function(event) {
|
| 689 |
+
this.save();
|
| 690 |
+
Event.stop(event);
|
| 691 |
+
}.bind(this));
|
| 692 |
+
}
|
| 693 |
+
var method = null;
|
| 694 |
+
for (var i = 0; i < elements.length; i++) {
|
| 695 |
+
if (elements[i].name == 'payment[method]') {
|
| 696 |
+
if (elements[i].checked) {
|
| 697 |
+
method = elements[i].value;
|
| 698 |
+
}
|
| 699 |
+
} else {
|
| 700 |
+
elements[i].disabled = true;
|
| 701 |
+
}
|
| 702 |
+
elements[i].setAttribute('autocomplete', 'off');
|
| 703 |
+
}
|
| 704 |
+
if (method)
|
| 705 |
+
this.switchMethod(method);
|
| 706 |
+
this.afterInit();
|
| 707 |
+
},
|
| 708 |
+
addAfterInitFunction: function(code, func) {
|
| 709 |
+
this.afterInitFunc.set(code, func);
|
| 710 |
+
},
|
| 711 |
+
afterInit: function() {
|
| 712 |
+
(this.afterInitFunc).each(function(init) {
|
| 713 |
+
(init.value)();
|
| 714 |
+
});
|
| 715 |
+
},
|
| 716 |
+
switchMethod: function(method) {
|
| 717 |
+
if (this.currentMethod && $('payment_form_' + this.currentMethod)) {
|
| 718 |
+
this.changeVisible(this.currentMethod, true);
|
| 719 |
+
$('payment_form_' + this.currentMethod).fire('payment-method:switched-off', {method_code: this.currentMethod});
|
| 720 |
+
}
|
| 721 |
+
if ($('payment_form_' + method)) {
|
| 722 |
+
this.changeVisible(method, false);
|
| 723 |
+
$('payment_form_' + method).fire('payment-method:switched', {method_code: method});
|
| 724 |
+
} else {
|
| 725 |
+
//Event fix for payment methods without form like "Check / Money order"
|
| 726 |
+
document.body.fire('payment-method:switched', {method_code: method});
|
| 727 |
+
}
|
| 728 |
+
if (method) {
|
| 729 |
+
this.lastUsedMethod = method;
|
| 730 |
+
}
|
| 731 |
+
this.currentMethod = method;
|
| 732 |
+
},
|
| 733 |
+
changeVisible: function(method, mode) {
|
| 734 |
+
var block = 'payment_form_' + method;
|
| 735 |
+
[block + '_before', block, block + '_after'].each(function(el) {
|
| 736 |
+
element = $(el);
|
| 737 |
+
if (element) {
|
| 738 |
+
element.style.display = (mode) ? 'none' : '';
|
| 739 |
+
element.select('input', 'select', 'textarea', 'button').each(function(field) {
|
| 740 |
+
field.disabled = mode;
|
| 741 |
+
});
|
| 742 |
+
}
|
| 743 |
+
});
|
| 744 |
+
},
|
| 745 |
+
addBeforeValidateFunction: function(code, func) {
|
| 746 |
+
this.beforeValidateFunc.set(code, func);
|
| 747 |
+
},
|
| 748 |
+
beforeValidate: function() {
|
| 749 |
+
var validateResult = true;
|
| 750 |
+
var hasValidation = false;
|
| 751 |
+
(this.beforeValidateFunc).each(function(validate) {
|
| 752 |
+
hasValidation = true;
|
| 753 |
+
if ((validate.value)() == false) {
|
| 754 |
+
validateResult = false;
|
| 755 |
+
}
|
| 756 |
+
}.bind(this));
|
| 757 |
+
if (!hasValidation) {
|
| 758 |
+
validateResult = false;
|
| 759 |
+
}
|
| 760 |
+
return validateResult;
|
| 761 |
+
},
|
| 762 |
+
validate: function() {
|
| 763 |
+
var result = this.beforeValidate();
|
| 764 |
+
if (result) {
|
| 765 |
+
return true;
|
| 766 |
+
}
|
| 767 |
+
var methods = document.getElementsByName('payment[method]');
|
| 768 |
+
if (methods.length == 0) {
|
| 769 |
+
alert(Translator.translate('Your order cannot be completed at this time as there is no payment methods available for it.').stripTags());
|
| 770 |
+
return false;
|
| 771 |
+
}
|
| 772 |
+
for (var i = 0; i < methods.length; i++) {
|
| 773 |
+
if (methods[i].checked) {
|
| 774 |
+
return true;
|
| 775 |
+
}
|
| 776 |
+
}
|
| 777 |
+
result = this.afterValidate();
|
| 778 |
+
if (result) {
|
| 779 |
+
return true;
|
| 780 |
+
}
|
| 781 |
+
alert(Translator.translate('Please specify payment method.').stripTags());
|
| 782 |
+
return false;
|
| 783 |
+
},
|
| 784 |
+
addAfterValidateFunction: function(code, func) {
|
| 785 |
+
this.afterValidateFunc.set(code, func);
|
| 786 |
+
},
|
| 787 |
+
afterValidate: function() {
|
| 788 |
+
var validateResult = true;
|
| 789 |
+
var hasValidation = false;
|
| 790 |
+
(this.afterValidateFunc).each(function(validate) {
|
| 791 |
+
hasValidation = true;
|
| 792 |
+
if ((validate.value)() == false) {
|
| 793 |
+
validateResult = false;
|
| 794 |
+
}
|
| 795 |
+
}.bind(this));
|
| 796 |
+
if (!hasValidation) {
|
| 797 |
+
validateResult = false;
|
| 798 |
+
}
|
| 799 |
+
return validateResult;
|
| 800 |
+
},
|
| 801 |
+
save: function() {
|
| 802 |
+
if (checkout.loadWaiting != false)
|
| 803 |
+
return;
|
| 804 |
+
var validator = new Validation(this.form);
|
| 805 |
+
if (this.validate() && validator.validate()) {
|
| 806 |
+
checkout.setLoadWaiting('payment');
|
| 807 |
+
var request = new Ajax.Request(
|
| 808 |
+
this.saveUrl,
|
| 809 |
+
{
|
| 810 |
+
method: 'post',
|
| 811 |
+
onComplete: this.onComplete,
|
| 812 |
+
onSuccess: this.onSave,
|
| 813 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
| 814 |
+
parameters: Form.serialize(this.form)
|
| 815 |
+
}
|
| 816 |
+
);
|
| 817 |
+
}
|
| 818 |
+
},
|
| 819 |
+
resetLoadWaiting: function() {
|
| 820 |
+
checkout.setLoadWaiting(false);
|
| 821 |
+
},
|
| 822 |
+
nextStep: function(transport) {
|
| 823 |
+
if (transport && transport.responseText) {
|
| 824 |
+
try {
|
| 825 |
+
response = eval('(' + transport.responseText + ')');
|
| 826 |
+
}
|
| 827 |
+
catch (e) {
|
| 828 |
+
response = {};
|
| 829 |
+
}
|
| 830 |
+
}
|
| 831 |
+
/*
|
| 832 |
+
* if there is an error in payment, need to show error message
|
| 833 |
+
*/
|
| 834 |
+
if (response.error) {
|
| 835 |
+
if (response.fields) {
|
| 836 |
+
var fields = response.fields.split(',');
|
| 837 |
+
for (var i = 0; i < fields.length; i++) {
|
| 838 |
+
var field = null;
|
| 839 |
+
if (field = $(fields[i])) {
|
| 840 |
+
Validation.ajaxError(field, response.error);
|
| 841 |
+
}
|
| 842 |
+
}
|
| 843 |
+
return;
|
| 844 |
+
}
|
| 845 |
+
alert(response.error);
|
| 846 |
+
return;
|
| 847 |
+
}
|
| 848 |
+
|
| 849 |
+
checkout.setStepResponse(response);
|
| 850 |
+
|
| 851 |
+
//checkout.setPayment();
|
| 852 |
+
},
|
| 853 |
+
initWhatIsCvvListeners: function() {
|
| 854 |
+
$$('.cvv-what-is-this').each(function(element) {
|
| 855 |
+
Event.observe(element, 'click', toggleToolTip);
|
| 856 |
+
});
|
| 857 |
+
}
|
| 858 |
+
}
|
| 859 |
+
|
| 860 |
+
var Review = Class.create();
|
| 861 |
+
Review.prototype = {
|
| 862 |
+
initialize: function(saveUrl, successUrl, agreementsForm) {
|
| 863 |
+
this.saveUrl = saveUrl;
|
| 864 |
+
this.successUrl = successUrl;
|
| 865 |
+
this.agreementsForm = agreementsForm;
|
| 866 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
| 867 |
+
this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
|
| 868 |
+
},
|
| 869 |
+
save: function() {
|
| 870 |
+
if (checkout.loadWaiting != false)
|
| 871 |
+
return;
|
| 872 |
+
checkout.setLoadWaiting('review');
|
| 873 |
+
var params = Form.serialize(payment.form);
|
| 874 |
+
if (this.agreementsForm) {
|
| 875 |
+
params += '&' + Form.serialize(this.agreementsForm);
|
| 876 |
+
}
|
| 877 |
+
params.save = true;
|
| 878 |
+
var request = new Ajax.Request(
|
| 879 |
+
this.saveUrl,
|
| 880 |
+
{
|
| 881 |
+
method: 'post',
|
| 882 |
+
parameters: params,
|
| 883 |
+
onComplete: this.onComplete,
|
| 884 |
+
onSuccess: this.onSave,
|
| 885 |
+
onFailure: checkout.ajaxFailure.bind(checkout)
|
| 886 |
+
}
|
| 887 |
+
);
|
| 888 |
+
},
|
| 889 |
+
resetLoadWaiting: function(transport) {
|
| 890 |
+
checkout.setLoadWaiting(false, this.isSuccess);
|
| 891 |
+
},
|
| 892 |
+
nextStep: function(transport) {
|
| 893 |
+
if (transport && transport.responseText) {
|
| 894 |
+
try {
|
| 895 |
+
response = eval('(' + transport.responseText + ')');
|
| 896 |
+
}
|
| 897 |
+
catch (e) {
|
| 898 |
+
response = {};
|
| 899 |
+
}
|
| 900 |
+
if (response.redirect) {
|
| 901 |
+
this.isSuccess = true;
|
| 902 |
+
location.href = response.redirect;
|
| 903 |
+
return;
|
| 904 |
+
}
|
| 905 |
+
if (response.success) {
|
| 906 |
+
this.isSuccess = true;
|
| 907 |
+
window.location = this.successUrl;
|
| 908 |
+
}
|
| 909 |
+
else {
|
| 910 |
+
var msg = response.error_messages;
|
| 911 |
+
if (typeof(msg) == 'object') {
|
| 912 |
+
msg = msg.join("\n");
|
| 913 |
+
}
|
| 914 |
+
if (msg) {
|
| 915 |
+
alert(msg);
|
| 916 |
+
}
|
| 917 |
+
}
|
| 918 |
+
|
| 919 |
+
if (response.update_section) {
|
| 920 |
+
$('checkout-' + response.update_section.name + '-load').update(response.update_section.html);
|
| 921 |
+
}
|
| 922 |
+
|
| 923 |
+
if (response.goto_section) {
|
| 924 |
+
checkout.gotoSection(response.goto_section, true);
|
| 925 |
+
}
|
| 926 |
+
}
|
| 927 |
+
},
|
| 928 |
+
isSuccess: false
|
| 929 |
+
}
|
skin/frontend/base/default/js/stepincheckout/store.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// shipping method
|
| 2 |
+
var selectStore = Class.create();
|
| 3 |
+
selectStore.prototype = {
|
| 4 |
+
initialize: function(form, saveUrl) {
|
| 5 |
+
this.form = form;
|
| 6 |
+
if ($(this.form)) {
|
| 7 |
+
$(this.form).observe('submit', function(event) {
|
| 8 |
+
this.save();
|
| 9 |
+
Event.stop(event);
|
| 10 |
+
}.bind(this));
|
| 11 |
+
}
|
| 12 |
+
this.saveUrl = saveUrl;
|
| 13 |
+
this.validator = new Validation(this.form);
|
| 14 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
| 15 |
+
this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
|
| 16 |
+
},
|
| 17 |
+
validate: function() {
|
| 18 |
+
if(!this.validator.validate()) {
|
| 19 |
+
return false;
|
| 20 |
+
}
|
| 21 |
+
return true;
|
| 22 |
+
},
|
| 23 |
+
save: function() {
|
| 24 |
+
|
| 25 |
+
if (checkout.loadWaiting != false)
|
| 26 |
+
return;
|
| 27 |
+
if (this.validate()) {
|
| 28 |
+
checkout.setLoadWaiting('select-store');
|
| 29 |
+
var request = new Ajax.Request(
|
| 30 |
+
this.saveUrl,
|
| 31 |
+
{
|
| 32 |
+
method: 'post',
|
| 33 |
+
onComplete: this.onComplete,
|
| 34 |
+
onSuccess: this.onSave,
|
| 35 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
| 36 |
+
parameters: Form.serialize(this.form)
|
| 37 |
+
}
|
| 38 |
+
);
|
| 39 |
+
}
|
| 40 |
+
},
|
| 41 |
+
resetLoadWaiting: function(transport) {
|
| 42 |
+
checkout.setLoadWaiting(false);
|
| 43 |
+
},
|
| 44 |
+
nextStep: function(transport) {
|
| 45 |
+
if (transport && transport.responseText) {
|
| 46 |
+
try {
|
| 47 |
+
response = eval('(' + transport.responseText + ')');
|
| 48 |
+
}
|
| 49 |
+
catch (e) {
|
| 50 |
+
response = {};
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if (response.error) {
|
| 55 |
+
alert(response.message);
|
| 56 |
+
return false;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
if (response.update_section) {
|
| 60 |
+
$('checkout-' + response.update_section.name + '-load').update(response.update_section.html);
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
payment.initWhatIsCvvListeners();
|
| 64 |
+
|
| 65 |
+
if (response.goto_section) {
|
| 66 |
+
checkout.gotoSection(response.goto_section, true);
|
| 67 |
+
checkout.reloadProgressBlock();
|
| 68 |
+
return;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
checkout.setSelectStore();
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
|
