Version Notes
Added the custom Form in Checkout process. Also added the admin setting to export the data of custom table.
Download this release
Release Info
Developer | iPragmatech |
Extension | ipragmatech_checkoutstep |
Version | 1.0.0.0 |
Comparing to | |
See all releases |
Version 1.0.0.0
- app/code/local/Ipragmatech/Checkoutstep/Block/Adminhtml/Exportdata.php +6 -0
- app/code/local/Ipragmatech/Checkoutstep/Block/Onepage.php +26 -0
- app/code/local/Ipragmatech/Checkoutstep/Block/Onepage/Checkoutstep.php +14 -0
- app/code/local/Ipragmatech/Checkoutstep/Controller/Observer.php +6 -0
- app/code/local/Ipragmatech/Checkoutstep/Helper/Data.php +13 -0
- app/code/local/Ipragmatech/Checkoutstep/Model/Customerdata.php +10 -0
- app/code/local/Ipragmatech/Checkoutstep/Model/Observer.php +25 -0
- app/code/local/Ipragmatech/Checkoutstep/Model/Observer/Customer.php +5 -0
- app/code/local/Ipragmatech/Checkoutstep/Model/Resource/Customerdata.php +9 -0
- app/code/local/Ipragmatech/Checkoutstep/Model/Resource/Customerdata/Collection.php +11 -0
- app/code/local/Ipragmatech/Checkoutstep/Model/Type/Onepage.php +29 -0
- app/code/local/Ipragmatech/Checkoutstep/controllers/Adminhtml/ExportdataController.php +67 -0
- app/code/local/Ipragmatech/Checkoutstep/controllers/OnepageController.php +107 -0
- app/code/local/Ipragmatech/Checkoutstep/etc/config.xml +164 -0
- app/code/local/Ipragmatech/Checkoutstep/etc/system.xml +41 -0
- app/code/local/Ipragmatech/Checkoutstep/sql/checkoutstep_setup/mysql4-install-0.1.1.php +21 -0
- app/design/adminhtml/default/default/template/checkoutstep/exportdata.phtml +26 -0
- app/design/frontend/base/default/layout/checkoutstep.xml +11 -0
- app/design/frontend/base/default/template/checkout/onepage/checkoutstep.phtml +131 -0
- app/design/frontend/rwd/default/layout/checkoutstep.xml +11 -0
- app/design/frontend/rwd/default/template/checkout/onepage/checkoutstep.phtml +131 -0
- app/etc/modules/Ipragmatech_Checkoutstep.xml +10 -0
- package.xml +18 -0
app/code/local/Ipragmatech/Checkoutstep/Block/Adminhtml/Exportdata.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ipragmatech_Checkoutstep_Block_Adminhtml_Exportdata extends Mage_Checkout_Block_Onepage
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/Block/Onepage.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ipragmatech_Checkoutstep_Block_Onepage extends Mage_Checkout_Block_Onepage
|
4 |
+
{
|
5 |
+
public function getSteps()
|
6 |
+
{
|
7 |
+
$steps = array();
|
8 |
+
|
9 |
+
if (!$this->isCustomerLoggedIn()) {
|
10 |
+
$steps['login'] = $this->getCheckout()->getStepData('login');
|
11 |
+
}
|
12 |
+
|
13 |
+
//check that module is enable or not
|
14 |
+
if (Mage::helper('checkoutstep')->isEnabled()) {
|
15 |
+
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'checkoutstep', 'review');
|
16 |
+
}
|
17 |
+
else {
|
18 |
+
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
|
19 |
+
}
|
20 |
+
foreach ($stepCodes as $step) {
|
21 |
+
$steps[$step] = $this->getCheckout()->getStepData($step);
|
22 |
+
}
|
23 |
+
|
24 |
+
return $steps;
|
25 |
+
}
|
26 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/Block/Onepage/Checkoutstep.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ipragmatech_Checkoutstep_Block_Onepage_Checkoutstep extends Mage_Checkout_Block_Onepage_Abstract
|
4 |
+
{
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->getCheckout()->setStepData('checkoutstep', array(
|
8 |
+
'label' => Mage::helper('checkout')->__('Invitation to participation'),
|
9 |
+
'is_show' => true
|
10 |
+
));
|
11 |
+
|
12 |
+
parent::_construct();
|
13 |
+
}
|
14 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/Controller/Observer.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ipragmatech_Checkoutstep_Controller_Observer
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/Helper/Data.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ipragmatech_Checkoutstep_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
const XML_CONFIG_PATH = 'checkoutstep/settings/';
|
5 |
+
public function isEnabled()
|
6 |
+
{
|
7 |
+
return (bool) $this->_getConfigValue('enabled');
|
8 |
+
}
|
9 |
+
protected function _getConfigValue($key)
|
10 |
+
{
|
11 |
+
return Mage::getStoreConfig(self::XML_CONFIG_PATH . $key);
|
12 |
+
}
|
13 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/Model/Customerdata.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ipragmatech_Checkoutstep_Model_Customerdata extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('checkoutstep/customerdata');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/Model/Observer.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ipragmatech_Checkoutstep_Model_Observer {
|
3 |
+
|
4 |
+
const ORDER_ATTRIBUTE_FHC_ID = 'checkoutstep';
|
5 |
+
|
6 |
+
public function hookToOrderSaveEvent() {
|
7 |
+
if (Mage::helper('checkoutstep')->isEnabled()) {
|
8 |
+
$order = new Mage_Sales_Model_Order ();
|
9 |
+
$incrementId = Mage::getSingleton ( 'checkout/session' )->getLastRealOrderId ();
|
10 |
+
$order->loadByIncrementId ( $incrementId );
|
11 |
+
|
12 |
+
// Fetch the data
|
13 |
+
$_checkoutstep_data = null;
|
14 |
+
$_checkoutstep_data = Mage::getSingleton ( 'core/session' )->getIpragmatechCheckoutstep ();
|
15 |
+
$model = Mage::getModel ( 'checkoutstep/customerdata' )->setData ( unserialize ( $_checkoutstep_data ) );
|
16 |
+
$model->setData ( "order_id",$order["entity_id"] );
|
17 |
+
try {
|
18 |
+
$insertId = $model->save ()->getId ();
|
19 |
+
Mage::log ( "Data successfully inserted. Insert ID: " . $insertId, null, 'mylog.log');
|
20 |
+
} catch ( Exception $e ) {
|
21 |
+
Mage::log ( "EXCEPTION " . $e->getMessage (), null, 'mylog.log' );
|
22 |
+
}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/Model/Observer/Customer.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ipragmatech_Checkoutstep_Model_Observer_Customer
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/Model/Resource/Customerdata.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ipragmatech_Checkoutstep_Model_Resource_Customerdata extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
$this->_init('checkoutstep/customerdata', 'id');
|
8 |
+
}
|
9 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/Model/Resource/Customerdata/Collection.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
class Ipragmatech_Checkoutstep_Model_Resource_Customerdata_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
5 |
+
{
|
6 |
+
public function _construct()
|
7 |
+
{
|
8 |
+
parent::_construct();
|
9 |
+
$this->_init('checkoutstep/customerdata');
|
10 |
+
}
|
11 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/Model/Type/Onepage.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Ipragmatech_Checkoutstep_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage
|
4 |
+
{
|
5 |
+
public function initCheckout()
|
6 |
+
{
|
7 |
+
$checkout = $this->getCheckout();
|
8 |
+
if (is_array($checkout->getStepData())) {
|
9 |
+
foreach ($checkout->getStepData() as $step=>$data) {
|
10 |
+
if (!($step==='login'
|
11 |
+
|| Mage::getSingleton('customer/session')->isLoggedIn() && $step==='billing')) {
|
12 |
+
$checkout->setStepData($step, 'allow', false);
|
13 |
+
}
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
$checkout->setStepData('checkoutstep', 'allow', true);
|
18 |
+
|
19 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
20 |
+
if ($customer) {
|
21 |
+
$this->getQuote()->assignCustomer($customer);
|
22 |
+
}
|
23 |
+
if ($this->getQuote()->getIsMultiShipping()) {
|
24 |
+
$this->getQuote()->setIsMultiShipping(false);
|
25 |
+
$this->getQuote()->save();
|
26 |
+
}
|
27 |
+
return $this;
|
28 |
+
}
|
29 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/controllers/Adminhtml/ExportdataController.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Ipragmatech_Checkoutstep_Adminhtml_ExportdataController extends Mage_Adminhtml_Controller_action
|
3 |
+
{
|
4 |
+
|
5 |
+
public function indexAction()
|
6 |
+
{
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('checkoutstep/adminhtml_exportdata')
|
9 |
+
->_addContent(
|
10 |
+
$this->getLayout()
|
11 |
+
->createBlock('checkoutstep/adminhtml_exportdata')
|
12 |
+
->setTemplate('checkoutstep/exportdata.phtml'))
|
13 |
+
->renderLayout();
|
14 |
+
|
15 |
+
}
|
16 |
+
|
17 |
+
public function postAction()
|
18 |
+
{
|
19 |
+
$post = $this->getRequest()->getPost();
|
20 |
+
try {
|
21 |
+
if (empty($post)) {
|
22 |
+
Mage::throwException($this->__('Invalid form data.'));
|
23 |
+
}
|
24 |
+
|
25 |
+
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
|
26 |
+
$customerdata = $read->fetchAll("select * from checkoutstep_customer_data");
|
27 |
+
$columns = $read->fetchAll("SHOW COLUMNS FROM checkoutstep_customer_data ");
|
28 |
+
$output = "";
|
29 |
+
|
30 |
+
Mage::log("The column is".json_encode($columns),null,'mylog.log');
|
31 |
+
|
32 |
+
//get the Table Header
|
33 |
+
foreach ($columns as $column){
|
34 |
+
$output .='"'.$column['Field'].'",';
|
35 |
+
}
|
36 |
+
$output .="\n";
|
37 |
+
|
38 |
+
// Get Records from the table
|
39 |
+
if (!empty($customerdata)) {
|
40 |
+
foreach ($customerdata as $item){
|
41 |
+
$output .='"'.$item['id'].'",';
|
42 |
+
$output .='"'.$item['entrant_name'].'",';
|
43 |
+
$output .='"'.$item['entrant_phone'].'",';
|
44 |
+
$output .='"'.$item['entrant_email'].'",';
|
45 |
+
$output .='"'.$item['permanent_address'].'",';
|
46 |
+
$output .='"'.$item['address'].'",';
|
47 |
+
$output .='"'.$item['order_id'].'",';
|
48 |
+
$output .="\n";
|
49 |
+
|
50 |
+
}
|
51 |
+
}
|
52 |
+
// Download the file
|
53 |
+
$filename = "Customerdata.csv";
|
54 |
+
header('Content-type: application/csv');
|
55 |
+
header('Content-Disposition: attachment; filename='.$filename);
|
56 |
+
|
57 |
+
echo $output;
|
58 |
+
exit;
|
59 |
+
|
60 |
+
$message = $this->__('Your form has been submitted successfully.');
|
61 |
+
Mage::getSingleton('adminhtml/session')->addSuccess($message);
|
62 |
+
} catch (Exception $e) {
|
63 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
64 |
+
}
|
65 |
+
$this->_redirect('*/*');
|
66 |
+
}
|
67 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/controllers/OnepageController.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/Checkout/controllers/OnepageController.php';
|
4 |
+
|
5 |
+
class Ipragmatech_Checkoutstep_OnepageController extends Mage_Checkout_OnepageController
|
6 |
+
{
|
7 |
+
public function doSomestuffAction()
|
8 |
+
{
|
9 |
+
if(true) {
|
10 |
+
$result['update_section'] = array(
|
11 |
+
'name' => 'payment-method',
|
12 |
+
'html' => $this->_getPaymentMethodsHtml()
|
13 |
+
);
|
14 |
+
}
|
15 |
+
else {
|
16 |
+
$result['goto_section'] = 'shipping';
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
public function savePaymentAction()
|
21 |
+
{
|
22 |
+
$this->_expireAjax();
|
23 |
+
if ($this->getRequest()->isPost()) {
|
24 |
+
$data = $this->getRequest()->getPost('payment', array());
|
25 |
+
|
26 |
+
try {
|
27 |
+
$result = $this->getOnepage()->savePayment($data);
|
28 |
+
}
|
29 |
+
catch (Mage_Payment_Exception $e) {
|
30 |
+
if ($e->getFields()) {
|
31 |
+
$result['fields'] = $e->getFields();
|
32 |
+
}
|
33 |
+
$result['error'] = $e->getMessage();
|
34 |
+
}
|
35 |
+
catch (Exception $e) {
|
36 |
+
$result['error'] = $e->getMessage();
|
37 |
+
}
|
38 |
+
$redirectUrl = $this->getOnePage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
|
39 |
+
if (empty($result['error']) && !$redirectUrl) {
|
40 |
+
|
41 |
+
//check the module is enable or not
|
42 |
+
if (Mage::helper('checkoutstep')->isEnabled()) {
|
43 |
+
$this->loadLayout('checkout_onepage_checkoutstep');
|
44 |
+
$result['goto_section'] = 'checkoutstep';
|
45 |
+
}
|
46 |
+
else {
|
47 |
+
$this->loadLayout('checkout_onepage_review');
|
48 |
+
|
49 |
+
$result['goto_section'] = 'review';
|
50 |
+
$result['update_section'] = array(
|
51 |
+
'name' => 'review',
|
52 |
+
'html' => $this->_getReviewHtml()
|
53 |
+
);
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
if ($redirectUrl) {
|
58 |
+
$result['redirect'] = $redirectUrl;
|
59 |
+
}
|
60 |
+
|
61 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
public function saveCheckoutstepAction()
|
66 |
+
{
|
67 |
+
$this->_expireAjax();
|
68 |
+
if ($this->getRequest()->isPost()) {
|
69 |
+
|
70 |
+
//Grab the submited value
|
71 |
+
$_entrant_name = $this->getRequest()->getPost('entrant_name',"");
|
72 |
+
$_entrant_phone = $this->getRequest()->getPost('entrant_phone',"");
|
73 |
+
$_entrant_email = $this->getRequest()->getPost('entrant_email',"");
|
74 |
+
$_permanent_address = $this->getRequest()->getPost('permanent_address',"");
|
75 |
+
$_address = $this->getRequest()->getPost('local_address',"");
|
76 |
+
|
77 |
+
Mage::getSingleton('core/session')->setIpragmatechCheckoutstep(serialize(array(
|
78 |
+
|
79 |
+
'entrant_name' =>$_entrant_name,
|
80 |
+
'entrant_phone' =>$_entrant_phone,
|
81 |
+
'entrant_email' =>$_entrant_email,
|
82 |
+
'permanent_address' =>$_permanent_address,
|
83 |
+
'address' =>$_address
|
84 |
+
)));
|
85 |
+
|
86 |
+
$result = array();
|
87 |
+
|
88 |
+
$redirectUrl = $this->getOnePage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
|
89 |
+
if (!$redirectUrl) {
|
90 |
+
$this->loadLayout('checkout_onepage_review');
|
91 |
+
|
92 |
+
$result['goto_section'] = 'review';
|
93 |
+
$result['update_section'] = array(
|
94 |
+
'name' => 'review',
|
95 |
+
'html' => $this->_getReviewHtml()
|
96 |
+
);
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
+
if ($redirectUrl) {
|
101 |
+
$result['redirect'] = $redirectUrl;
|
102 |
+
}
|
103 |
+
|
104 |
+
$this->getResponse()->setBody(Zend_Json::encode($result));
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
app/code/local/Ipragmatech/Checkoutstep/etc/config.xml
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Ipragmatech_Checkoutstep>
|
5 |
+
<version>0.1.1</version>
|
6 |
+
</Ipragmatech_Checkoutstep>
|
7 |
+
</modules>
|
8 |
+
|
9 |
+
<global>
|
10 |
+
<models>
|
11 |
+
<checkoutstep>
|
12 |
+
<class>Ipragmatech_Checkoutstep_Model</class>
|
13 |
+
<resourceModel>checkoutstep_resource</resourceModel>
|
14 |
+
</checkoutstep>
|
15 |
+
|
16 |
+
<checkoutstep_resource>
|
17 |
+
<class>Ipragmatech_Checkoutstep_Model_Resource</class>
|
18 |
+
<entities>
|
19 |
+
<customerdata>
|
20 |
+
<table>checkoutstep_customer_data</table>
|
21 |
+
</customerdata>
|
22 |
+
</entities>
|
23 |
+
</checkoutstep_resource>
|
24 |
+
|
25 |
+
<checkout>
|
26 |
+
<rewrite>
|
27 |
+
<type_onepage>Ipragmatech_Checkoutstep_Model_Type_Onepage</type_onepage>
|
28 |
+
</rewrite>
|
29 |
+
</checkout>
|
30 |
+
</models>
|
31 |
+
|
32 |
+
<helpers>
|
33 |
+
<checkoutstep>
|
34 |
+
<class>Ipragmatech_Checkoutstep_Helper</class>
|
35 |
+
</checkoutstep>
|
36 |
+
</helpers>
|
37 |
+
|
38 |
+
<blocks>
|
39 |
+
<checkout>
|
40 |
+
<rewrite>
|
41 |
+
<onepage>Ipragmatech_Checkoutstep_Block_Onepage</onepage>
|
42 |
+
</rewrite>
|
43 |
+
</checkout>
|
44 |
+
|
45 |
+
<checkoutstep>
|
46 |
+
<class>Ipragmatech_Checkoutstep_Block</class>
|
47 |
+
</checkoutstep>
|
48 |
+
|
49 |
+
<checkoutsteponepage>
|
50 |
+
<class>Ipragmatech_Checkoutstep_Block_Onepage</class>
|
51 |
+
</checkoutsteponepage>
|
52 |
+
|
53 |
+
</blocks>
|
54 |
+
|
55 |
+
<rewrite>
|
56 |
+
<ipragmatech_checkoutstep_onepage>
|
57 |
+
<from><![CDATA[#^/checkout/onepage/#]]></from>
|
58 |
+
<to>/checkoutstep/onepage/</to>
|
59 |
+
</ipragmatech_checkoutstep_onepage>
|
60 |
+
</rewrite>
|
61 |
+
<resources>
|
62 |
+
<checkoutstep_setup>
|
63 |
+
<setup>
|
64 |
+
<module>Ipragmatech_Checkoutstep</module>
|
65 |
+
</setup>
|
66 |
+
</checkoutstep_setup>
|
67 |
+
</resources>
|
68 |
+
</global>
|
69 |
+
|
70 |
+
<frontend>
|
71 |
+
<routers>
|
72 |
+
<ipragmatech_checkoutstep>
|
73 |
+
<use>standard</use>
|
74 |
+
<args>
|
75 |
+
<module>Ipragmatech_Checkoutstep</module>
|
76 |
+
<frontName>checkoutstep</frontName>
|
77 |
+
</args>
|
78 |
+
</ipragmatech_checkoutstep>
|
79 |
+
|
80 |
+
</routers>
|
81 |
+
|
82 |
+
<events>
|
83 |
+
<checkout_onepage_controller_success_action>
|
84 |
+
<observers>
|
85 |
+
<hooksystem_order_success>
|
86 |
+
<type>singleton</type>
|
87 |
+
<class>checkoutstep/observer</class>
|
88 |
+
<method>hookToOrderSaveEvent</method>
|
89 |
+
</hooksystem_order_success>
|
90 |
+
</observers>
|
91 |
+
</checkout_onepage_controller_success_action>
|
92 |
+
</events>
|
93 |
+
|
94 |
+
<layout>
|
95 |
+
<updates>
|
96 |
+
<checkoutstep>
|
97 |
+
<file>checkoutstep.xml</file>
|
98 |
+
</checkoutstep>
|
99 |
+
</updates>
|
100 |
+
</layout>
|
101 |
+
</frontend>
|
102 |
+
|
103 |
+
<admin>
|
104 |
+
<routers>
|
105 |
+
<ipragmatech_checkoutstep>
|
106 |
+
<use>admin</use>
|
107 |
+
<args>
|
108 |
+
<module>Ipragmatech_Checkoutstep</module>
|
109 |
+
<frontName>checkoutstep</frontName>
|
110 |
+
</args>
|
111 |
+
</ipragmatech_checkoutstep>
|
112 |
+
|
113 |
+
</routers>
|
114 |
+
</admin>
|
115 |
+
<adminhtml>
|
116 |
+
<menu>
|
117 |
+
<checkoutstep module="checkoutstep">
|
118 |
+
<title>iPragmatech</title>
|
119 |
+
<sort_order>71</sort_order>
|
120 |
+
<children>
|
121 |
+
<exportdata translate="title" module="checkoutstep">
|
122 |
+
<title>Export Data</title>
|
123 |
+
<sort_order>1</sort_order>
|
124 |
+
<action>checkoutstep/adminhtml_exportdata</action>
|
125 |
+
</exportdata>
|
126 |
+
</children>
|
127 |
+
</checkoutstep>
|
128 |
+
</menu>
|
129 |
+
<acl>
|
130 |
+
<resources>
|
131 |
+
<admin>
|
132 |
+
<children>
|
133 |
+
<checkoutstep translate="title" module="checkoutstep">
|
134 |
+
<title>iPragmatech</title>
|
135 |
+
<sort_order>70</sort_order>
|
136 |
+
<children>
|
137 |
+
<exportdata translate="title">
|
138 |
+
<title>Export Data</title>
|
139 |
+
<sort_order>10</sort_order>
|
140 |
+
</exportdata>
|
141 |
+
</children>
|
142 |
+
</checkoutstep>
|
143 |
+
</children>
|
144 |
+
</admin>
|
145 |
+
|
146 |
+
<admin>
|
147 |
+
<children>
|
148 |
+
<system>
|
149 |
+
<children>
|
150 |
+
<config>
|
151 |
+
<children>
|
152 |
+
<checkoutstep translate="title">
|
153 |
+
<title>Custom Checkout Step</title>
|
154 |
+
</checkoutstep>
|
155 |
+
</children>
|
156 |
+
</config>
|
157 |
+
</children>
|
158 |
+
</system>
|
159 |
+
</children>
|
160 |
+
</admin>
|
161 |
+
</resources>
|
162 |
+
</acl>
|
163 |
+
</adminhtml>
|
164 |
+
</config>
|
app/code/local/Ipragmatech/Checkoutstep/etc/system.xml
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<iPragmatech translate="label" module="checkoutstep">
|
5 |
+
<label>iPragmatech Extension</label>
|
6 |
+
<sort_order>300</sort_order>
|
7 |
+
</iPragmatech>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<checkoutstep translate="label">
|
11 |
+
<label>Checkout Setting</label>
|
12 |
+
<tab>iPragmatech</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>1001</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<settings translate="label">
|
20 |
+
<label>Custom Form In Checkout</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>100</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<enabled translate="label comment">
|
28 |
+
<label>Checkout Setting</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_enabledisable</source_model>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
</enabled>
|
36 |
+
</fields>
|
37 |
+
</settings>
|
38 |
+
</groups>
|
39 |
+
</checkoutstep>
|
40 |
+
</sections>
|
41 |
+
</config>
|
app/code/local/Ipragmatech/Checkoutstep/sql/checkoutstep_setup/mysql4-install-0.1.1.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
DROP TABLE IF EXISTS {$installer->getTable('checkoutstep/customerdata')};
|
9 |
+
CREATE TABLE {$installer->getTable('checkoutstep/customerdata')} (
|
10 |
+
`id` int(11) unsigned NOT NULL auto_increment,
|
11 |
+
`entrant_name` varchar(100),
|
12 |
+
`entrant_email` varchar(100),
|
13 |
+
`entrant_phone` varchar(30),
|
14 |
+
`permanent_address`varchar(255) NULL,
|
15 |
+
`address` varchar(255) NULL,
|
16 |
+
`order_id` int(11) NOT NULL default '0',
|
17 |
+
PRIMARY KEY (`id`)
|
18 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
19 |
+
");
|
20 |
+
|
21 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/checkoutstep/exportdata.phtml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="entry-edit">
|
2 |
+
<form id="edit_form" name="edit_form" method="post" action="<?=$this->getUrl('*/*/post')?>">
|
3 |
+
<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
|
4 |
+
<h4 class="icon-head head-edit-form fieldset-legend"><?=$this->__('Export Customer Data')?></h4>
|
5 |
+
<fieldset id="my-fieldset" style="width: 656px;">
|
6 |
+
<table class="form-list">
|
7 |
+
<tr>
|
8 |
+
<td class="label"><?=$this->__('Export CSV')?> <span class="required">*</span></td>
|
9 |
+
<td class="input-ele">
|
10 |
+
<select name="customerdata" class="required address-select validate-select" style="color: #000000 !important;font-weight: 100 !important;"><option></option><option value="CSV" style="color: #000000;">Export CSV</option></select>
|
11 |
+
</td>
|
12 |
+
</tr>
|
13 |
+
|
14 |
+
<tr>
|
15 |
+
<td class="label"></td>
|
16 |
+
<td class="input-ele">
|
17 |
+
<button onclick="editForm.submit()" class="scalable save" type="button"><span>Export</span></button>
|
18 |
+
</td>
|
19 |
+
</tr>
|
20 |
+
</table>
|
21 |
+
</fieldset>
|
22 |
+
</form>
|
23 |
+
</div>
|
24 |
+
<script type="text/javascript">
|
25 |
+
var editForm = new varienForm('edit_form');
|
26 |
+
</script>
|
app/design/frontend/base/default/layout/checkoutstep.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
|
5 |
+
<checkout_onepage_index>
|
6 |
+
<reference name="checkout.onepage">
|
7 |
+
<!-- Extra step added to OnePage Checkout -->
|
8 |
+
<block type="checkoutstep/onepage_checkoutstep" name="checkout.onepage.checkoutstep" as="checkoutstep" after="checkout.onepage.billing" template="checkout/onepage/checkoutstep.phtml"/>
|
9 |
+
</reference>
|
10 |
+
</checkout_onepage_index>
|
11 |
+
</layout>
|
app/design/frontend/base/default/template/checkout/onepage/checkoutstep.phtml
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form id="co-checkoutstep-form" action="">
|
2 |
+
<ul class="form-list">
|
3 |
+
<li>
|
4 |
+
<label for="shipping:firstname" class="required"><em>*</em>Additional Name</label>
|
5 |
+
<div class="input-box">
|
6 |
+
<input type="text" id="shipping:firstname" name="entrant_name" value="" title="Entrant Name" maxlength="255" class="input-text required-entry" style="width: 365px" />
|
7 |
+
</div>
|
8 |
+
</li>
|
9 |
+
<li>
|
10 |
+
<label for="shipping:entrant_phone" class="required"><em>*</em>Additional Phone</label>
|
11 |
+
<div class="input-box">
|
12 |
+
<input type="text" id="shipping:entrant_phone" name="entrant_phone" value="" title="Entrant Phone" maxlength="255" class="input-text required-entry" style="width: 365px" />
|
13 |
+
</div>
|
14 |
+
</li>
|
15 |
+
<li>
|
16 |
+
<label for="shipping:lastname" class="required"><em>*</em>Additional Email</label>
|
17 |
+
<div class="input-box">
|
18 |
+
<input type="text" id="shipping:entrant_email" name="entrant_email" value="" title="Entrant Email" maxlength="255" class="input-text required-entry validate-email" style="width: 365px" />
|
19 |
+
</div>
|
20 |
+
</li>
|
21 |
+
<li>
|
22 |
+
<label for="shipping:lastname" class="required"><em>*</em>Local Address</label>
|
23 |
+
<div class="input-box">
|
24 |
+
<textarea id="shipping:local_address" name="local_address" title="local address" maxlength="255" class="input-text required-entry" style="width: 365px"></textarea>
|
25 |
+
</div>
|
26 |
+
</li>
|
27 |
+
<li class="control">
|
28 |
+
<input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_entrant" value="1" title="Driver same as Entrant" class="checkbox"><label for="shipping:same_as_billing">same as Permanent Address</label>
|
29 |
+
</li>
|
30 |
+
<li>
|
31 |
+
<label for="shipping:firstname" class="required"><em>*</em>Permanent Address</label>
|
32 |
+
<div class="input-box">
|
33 |
+
<textarea id="shipping:permanent" name="permanent_address" title="Permanent Address" maxlength="255" class="input-text required-entry" style="width: 365px"></textarea>
|
34 |
+
</div>
|
35 |
+
</li>
|
36 |
+
|
37 |
+
</ul>
|
38 |
+
</form>
|
39 |
+
|
40 |
+
|
41 |
+
<div class="button-set">
|
42 |
+
<div id="checkoutstep-buttons-container">
|
43 |
+
<button type="button" class="button validation-passed" onclick="checkoutstep.save();"><span><?php echo $this->__('Continue') ?></span></button>
|
44 |
+
<span id="checkoutstep-please-wait" style="display:none;" class="opc-please-wait">
|
45 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle" alt="" /> <?php echo $this->__('Loading next step...') ?>
|
46 |
+
</span>
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<script type="text/javascript">
|
51 |
+
//<![CDATA[
|
52 |
+
|
53 |
+
var Checkoutstep = Class.create();
|
54 |
+
Checkoutstep.prototype = {
|
55 |
+
initialize: function(form, saveUrl){
|
56 |
+
this.form = form;
|
57 |
+
if ($(this.form)) {
|
58 |
+
$(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
|
59 |
+
}
|
60 |
+
this.saveUrl = saveUrl;
|
61 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
62 |
+
this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
|
63 |
+
},
|
64 |
+
|
65 |
+
save: function(){
|
66 |
+
if (checkout.loadWaiting!=false) return;
|
67 |
+
|
68 |
+
var validator = new Validation(this.form);
|
69 |
+
if (validator.validate()) {
|
70 |
+
|
71 |
+
checkout.setLoadWaiting('checkoutstep');
|
72 |
+
|
73 |
+
|
74 |
+
var request = new Ajax.Request(
|
75 |
+
this.saveUrl,
|
76 |
+
{
|
77 |
+
method: 'post',
|
78 |
+
onComplete: this.onComplete,
|
79 |
+
onSuccess: this.onSave,
|
80 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
81 |
+
parameters: Form.serialize(this.form)
|
82 |
+
}
|
83 |
+
);
|
84 |
+
}
|
85 |
+
},
|
86 |
+
|
87 |
+
resetLoadWaiting: function(transport){
|
88 |
+
checkout.setLoadWaiting(false);
|
89 |
+
},
|
90 |
+
|
91 |
+
nextStep: function(transport){
|
92 |
+
if (transport && transport.responseText){
|
93 |
+
try{
|
94 |
+
response = eval('(' + transport.responseText + ')');
|
95 |
+
}
|
96 |
+
catch (e) {
|
97 |
+
response = {};
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
if (response.error){
|
102 |
+
if ((typeof response.message) == 'string') {
|
103 |
+
alert(response.message);
|
104 |
+
} else {
|
105 |
+
if (window.billingRegionUpdater) {
|
106 |
+
billingRegionUpdater.update();
|
107 |
+
}
|
108 |
+
|
109 |
+
alert(response.message.join("\n"));
|
110 |
+
}
|
111 |
+
|
112 |
+
return false;
|
113 |
+
}
|
114 |
+
|
115 |
+
checkout.setStepResponse(response);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
var checkoutstep = new Checkoutstep('co-checkoutstep-form', '<?php echo $this->getUrl('checkout/onepage/saveCheckoutstep') ?>');
|
120 |
+
|
121 |
+
$('shipping:same_as_entrant').observe('click',function(){
|
122 |
+
if(this.checked){
|
123 |
+
$('shipping:permanent').setValue($('shipping:local_address').value);
|
124 |
+
}
|
125 |
+
else{
|
126 |
+
$('shipping:permanent').setValue('');
|
127 |
+
}
|
128 |
+
});
|
129 |
+
|
130 |
+
//]]>
|
131 |
+
</script>
|
app/design/frontend/rwd/default/layout/checkoutstep.xml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
|
5 |
+
<checkout_onepage_index>
|
6 |
+
<reference name="checkout.onepage">
|
7 |
+
<!-- Extra step added to OnePage Checkout -->
|
8 |
+
<block type="checkoutstep/onepage_checkoutstep" name="checkout.onepage.checkoutstep" as="checkoutstep" after="checkout.onepage.billing" template="checkout/onepage/checkoutstep.phtml"/>
|
9 |
+
</reference>
|
10 |
+
</checkout_onepage_index>
|
11 |
+
</layout>
|
app/design/frontend/rwd/default/template/checkout/onepage/checkoutstep.phtml
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form id="co-checkoutstep-form" action="">
|
2 |
+
<ul class="form-list">
|
3 |
+
<li>
|
4 |
+
<label for="shipping:firstname" class="required"><em>*</em>Additional Name</label>
|
5 |
+
<div class="input-box">
|
6 |
+
<input type="text" id="shipping:firstname" name="entrant_name" value="" title="Entrant Name" maxlength="255" class="input-text required-entry" style="width: 365px" />
|
7 |
+
</div>
|
8 |
+
</li>
|
9 |
+
<li>
|
10 |
+
<label for="shipping:entrant_phone" class="required"><em>*</em>Additional Phone</label>
|
11 |
+
<div class="input-box">
|
12 |
+
<input type="text" id="shipping:entrant_phone" name="entrant_phone" value="" title="Entrant Phone" maxlength="255" class="input-text required-entry" style="width: 365px" />
|
13 |
+
</div>
|
14 |
+
</li>
|
15 |
+
<li>
|
16 |
+
<label for="shipping:lastname" class="required"><em>*</em>Additional Email</label>
|
17 |
+
<div class="input-box">
|
18 |
+
<input type="text" id="shipping:entrant_email" name="entrant_email" value="" title="Entrant Email" maxlength="255" class="input-text required-entry validate-email" style="width: 365px" />
|
19 |
+
</div>
|
20 |
+
</li>
|
21 |
+
<li>
|
22 |
+
<label for="shipping:lastname" class="required"><em>*</em>Local Address</label>
|
23 |
+
<div class="input-box">
|
24 |
+
<textarea id="shipping:local_address" name="local_address" title="local address" maxlength="255" class="input-text required-entry" style="width: 365px"></textarea>
|
25 |
+
</div>
|
26 |
+
</li>
|
27 |
+
<li class="control">
|
28 |
+
<input type="checkbox" name="shipping[same_as_billing]" id="shipping:same_as_entrant" value="1" title="Driver same as Entrant" class="checkbox"><label for="shipping:same_as_billing">same as Permanent Address</label>
|
29 |
+
</li>
|
30 |
+
<li>
|
31 |
+
<label for="shipping:firstname" class="required"><em>*</em>Permanent Address</label>
|
32 |
+
<div class="input-box">
|
33 |
+
<textarea id="shipping:permanent" name="permanent_address" title="Permanent Address" maxlength="255" class="input-text required-entry" style="width: 365px"></textarea>
|
34 |
+
</div>
|
35 |
+
</li>
|
36 |
+
|
37 |
+
</ul>
|
38 |
+
</form>
|
39 |
+
|
40 |
+
|
41 |
+
<div class="button-set">
|
42 |
+
<div id="checkoutstep-buttons-container">
|
43 |
+
<button type="button" class="button validation-passed" onclick="checkoutstep.save();"><span><?php echo $this->__('Continue') ?></span></button>
|
44 |
+
<span id="checkoutstep-please-wait" style="display:none;" class="opc-please-wait">
|
45 |
+
<img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle" alt="" /> <?php echo $this->__('Loading next step...') ?>
|
46 |
+
</span>
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
|
50 |
+
<script type="text/javascript">
|
51 |
+
//<![CDATA[
|
52 |
+
|
53 |
+
var Checkoutstep = Class.create();
|
54 |
+
Checkoutstep.prototype = {
|
55 |
+
initialize: function(form, saveUrl){
|
56 |
+
this.form = form;
|
57 |
+
if ($(this.form)) {
|
58 |
+
$(this.form).observe('submit', function(event){this.save();Event.stop(event);}.bind(this));
|
59 |
+
}
|
60 |
+
this.saveUrl = saveUrl;
|
61 |
+
this.onSave = this.nextStep.bindAsEventListener(this);
|
62 |
+
this.onComplete = this.resetLoadWaiting.bindAsEventListener(this);
|
63 |
+
},
|
64 |
+
|
65 |
+
save: function(){
|
66 |
+
if (checkout.loadWaiting!=false) return;
|
67 |
+
|
68 |
+
var validator = new Validation(this.form);
|
69 |
+
if (validator.validate()) {
|
70 |
+
|
71 |
+
checkout.setLoadWaiting('checkoutstep');
|
72 |
+
|
73 |
+
|
74 |
+
var request = new Ajax.Request(
|
75 |
+
this.saveUrl,
|
76 |
+
{
|
77 |
+
method: 'post',
|
78 |
+
onComplete: this.onComplete,
|
79 |
+
onSuccess: this.onSave,
|
80 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
81 |
+
parameters: Form.serialize(this.form)
|
82 |
+
}
|
83 |
+
);
|
84 |
+
}
|
85 |
+
},
|
86 |
+
|
87 |
+
resetLoadWaiting: function(transport){
|
88 |
+
checkout.setLoadWaiting(false);
|
89 |
+
},
|
90 |
+
|
91 |
+
nextStep: function(transport){
|
92 |
+
if (transport && transport.responseText){
|
93 |
+
try{
|
94 |
+
response = eval('(' + transport.responseText + ')');
|
95 |
+
}
|
96 |
+
catch (e) {
|
97 |
+
response = {};
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
if (response.error){
|
102 |
+
if ((typeof response.message) == 'string') {
|
103 |
+
alert(response.message);
|
104 |
+
} else {
|
105 |
+
if (window.billingRegionUpdater) {
|
106 |
+
billingRegionUpdater.update();
|
107 |
+
}
|
108 |
+
|
109 |
+
alert(response.message.join("\n"));
|
110 |
+
}
|
111 |
+
|
112 |
+
return false;
|
113 |
+
}
|
114 |
+
|
115 |
+
checkout.setStepResponse(response);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
var checkoutstep = new Checkoutstep('co-checkoutstep-form', '<?php echo $this->getUrl('checkout/onepage/saveCheckoutstep') ?>');
|
120 |
+
|
121 |
+
$('shipping:same_as_entrant').observe('click',function(){
|
122 |
+
if(this.checked){
|
123 |
+
$('shipping:permanent').setValue($('shipping:local_address').value);
|
124 |
+
}
|
125 |
+
else{
|
126 |
+
$('shipping:permanent').setValue('');
|
127 |
+
}
|
128 |
+
});
|
129 |
+
|
130 |
+
//]]>
|
131 |
+
</script>
|
app/etc/modules/Ipragmatech_Checkoutstep.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<Ipragmatech_Checkoutstep>
|
6 |
+
<active>true</active>
|
7 |
+
<codePool>local</codePool>
|
8 |
+
</Ipragmatech_Checkoutstep>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>ipragmatech_checkoutstep</name>
|
4 |
+
<version>1.0.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>GNU General Public Licence (GPL)</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Added the custom Form in Checkout process. Also added the admin setting to export the data of custom table.</summary>
|
10 |
+
<description>Added the custom Form in Checkout process. Also added the admin setting to export the data of custom table.</description>
|
11 |
+
<notes>Added the custom Form in Checkout process. Also added the admin setting to export the data of custom table.</notes>
|
12 |
+
<authors><author><name>iPragmatech</name><user>iPragmatech</user><email>info@ipragmatech.com</email></author></authors>
|
13 |
+
<date>2014-12-09</date>
|
14 |
+
<time>11:54:18</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Ipragmatech"><dir name="Checkoutstep"><dir name="Block"><dir name="Adminhtml"><file name="Exportdata.php" hash="5346a20a62d6b5dd35010c39b7cef63e"/></dir><dir name="Onepage"><file name="Checkoutstep.php" hash="044631e3b20a01c94495290b9515b9e7"/></dir><file name="Onepage.php" hash="a80f985cc938c3740d1b7a3cbe742a7c"/></dir><dir name="Controller"><file name="Observer.php" hash="772168d115c0c7b07c7e8fdaf321ff1a"/></dir><dir name="Helper"><file name="Data.php" hash="24ce90a5c83e4fa0afcaf442737f1e00"/></dir><dir name="Model"><file name="Customerdata.php" hash="19008e5500e4ed8fbee32ee9deff4b6c"/><dir name="Observer"><file name="Customer.php" hash="7a0315ce217368cd886136f2d4c08f6a"/></dir><file name="Observer.php" hash="f8c49a3523a9e745108b79682c96c1cf"/><dir name="Resource"><dir name="Customerdata"><file name="Collection.php" hash="eca38737153eafbb62770998e6d5b784"/></dir><file name="Customerdata.php" hash="6dab5c6117b4ba514c2dba032698d4c7"/></dir><dir name="Type"><file name="Onepage.php" hash="9c71c56525370e81937c705a37a7caea"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ExportdataController.php" hash="49aeb8b6064bc438a5e35a58ffe7cb80"/></dir><file name="OnepageController.php" hash="66c0603ec668888927bddda1753fae6b"/></dir><dir name="etc"><file name="config.xml" hash="037c97b9c3f10b25aaaa4f19c939a6d9"/><file name="system.xml" hash="f2b45dcf218cce19d2bce1e22516a0d4"/></dir><dir name="sql"><dir name="checkoutstep_setup"><file name="mysql4-install-0.1.1.php" hash="9409b24c9ede74c30d6091cbb9fee6ce"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ipragmatech_Checkoutstep.xml" hash="16590e306e569a9119c8d4a348b7517e"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="checkoutstep"><file name="exportdata.phtml" hash="a65ef6bce3e02ecbc07971d84c3c5ab3"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="rwd"><dir name="default"><dir name="template"><dir name="checkout"><dir name="onepage"><file name="checkoutstep.phtml" hash="8d7f5ad94f556c6255e20c777b98f5d5"/></dir></dir></dir><dir name="layout"><file name="checkoutstep.xml" hash="eeb26262856da4f4f243395e8f6bd967"/></dir></dir></dir><dir name="base"><dir name="default"><dir name="template"><dir name="checkout"><dir name="onepage"><file name="checkoutstep.phtml" hash="8d7f5ad94f556c6255e20c777b98f5d5"/></dir></dir></dir><dir name="layout"><file name="checkoutstep.xml" hash="eeb26262856da4f4f243395e8f6bd967"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|