Currently i have an requirement of adding a custom Driver tip step in magento onepage checkout process, right after the shipping method(step-3), in which i want user to select tip from some given options(i will make radio buttons), that will contain certain amounts, suppose user selected $150 then this amount will be added into total payment ? i tried all other tutorials over google, none of them is working for me, any help is appreciated,
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
By default magento gives some checkout steps. But Sometime you need to add extra information from the customer for future reference. A common requested customization is to add the Custom Form in default checkout process. This is not good practice to touch core files. You can do this via overriding Modules. In this example Comapnyname is Ipragmatech and Module name is Checkoutstep.
Step1: Add Custom step in the checkout process
Open the Ipragmatech > Checkoutstep > Block > Onepage> Checkoutstep.php file and write the following code
Step2: Add steps which and where you want in the checkout process
Open the Ipragmatech > Checkoutstep > Block > Onepage> Checkoutstep.php file and write the following code
Step3: Grab the submitted value of custom form and set the values of Custom form
Open the ipragmatech > Checkoutstep > controllers > OnepageController.php and write the following fucntion
Step4: Save Custom Form information
When checkout_onepage_controller_success_action event hook is called. Open the Ipragmatech > Checkoutstep > Model >Observer.php and write the following
}
Magento – Add Custom Form in Checkout Extension is a complete solution to add extra step in Checkout process for your ecommerce website. It allow admin to export data from custom table in CSV format. Visit the link to get this free extension http://www.magentocommerce.com/magento-connect/custom-form-in-checkout.html
I recently work on similar type of requirement. so follow my instructions:-
I request to you that don't focus on the length of answer just focus on the result
step 1:-if you want to put Driver tip between shipping and shipping method then first open
\app\code\core\Mage\Checkout\Block\Onepage.php there is an array $stepCodes (line no:- 44). replace that with this
i am using excellence2 you can also use this name.
Step 2:- now we need to create Excellence2 class on app\code\core\Mage\Checkout\Block\Onepage\ so create a new php file and put that code into it and save as Excellence2.php
Note:- now you can put any name at label of _construct() function so change 'Tip Ammount' to Driver tip
Step 3:-now open OnepageController.php which is located in app\code\core\Mage\Checkout\controllers\ and find saveBillingAction() function (line no:-296) and replace that code by this
Step 4:- again in same file OnepageController.php there is a saveShippingAction() function (line no 331) change this to
this code tells that when user pass though the shipping step then he will go to our Driver tip step.
Step 5:-again in same file (OnepageController.php) we need to tell that where user will redirect after pass though Driver tip step .so create a saveExcellence2Action() just after saveShippingAction() function
Step 6:- now we change in checkout.xml which is located in
\app\design\frontend\default\your template\layout open it and find
and in that particular node there is block (line no 326)
just add a new block after this line shown above
Step 7:- now we need to create a excellence2.phtml file at \app\design\frontend\default\your template\template\checkout\onepage\
this file show the content which you want to show to user
Step 8:-now we need to create a excellencecheckout.js file at \skin\frontend\default\your template\js
Step 9:- now we need to create a new function for save data which user was selected . so we are creating new function which name is saveExcellence2() just after the saveShipping($data, $customerAddressId) finction in Onepage.php which is located in \app\code\core\Mage\Checkout\Model\Type\