shop:checkout_billing_info CMS action
Defined in |
/modules/shop/classes/shop_actions.php, lines 1746-1759 |
Author |
LemonStand eCommerce Inc. |
Base action for the Billing Information checkout page.
This action is a part of the step-by-step checkout process.
The Billing Information page is the first step of the conventional step-by-step checkout process.
Note that there is another action - shop:checkout, which incorporates all steps of the checkout process
and allows to build the AJAX-driven checkout page, where all steps of the
checkout process are displayed one by one on a single page. That sort of checkout process is implemented in our
Demo Store. As contrasted with the shop:checkout action,
the step-by-step checkout actions allows you to build a checkout process with separate pages. Also, using these
actions you can customize the checkout process. For example, it is possible to skip some checkout steps and implement
simplified checkout scenarios. Please refer to the Creating the One-Step Checkout
article for the example of customizing the checkout process.
Watching the cart content changes
It is possible that a customer can change the content of the shopping cart during the checkout process.
It can be done in a separate browser window. It is recommended to check whether the shopping content has not been changed after the
checkout process started. LemonStand automatically saves the cart content identifier to the memory on the Billing address information
step (the first step in the checkout process). You can place the following code in the Pre Action Code field of the Action
tab of all your checkout pages, excluding the billing address information step.
if (Shop_CheckoutData::get_cart_id() != Shop_Cart::get_content_id())
Phpr::$response->redirect('/checkout_billing_information');
The code compares the saved cart content identifier with a current identifier, and if they do not match, redirects the browser
to the first step of the checkout process. Please use an actual value for the URL of the first checkout step of your online store.
Automatic customer registration
Besides the supported form fields described below this action supports fields for the automatic customer registration.
Please refer to the Automatic Customer Registration
article for details.
Field |
Type |
Description |
first_name |
string |
specifies the customer billing first name. Required. |
last_name |
string |
specifies the customer billing last name. Required. |
email |
string |
specifies the customer email address. Required. |
company |
string |
specifies the customer company name. |
phone |
string |
specifies the customer phone number. |
street_address |
string |
specifies the customer bulling street address. Required. |
city |
string |
specifies the customer billing city. Required. |
zip |
string |
specifies the customer billing ZIP/postal code. Required. |
country |
integer |
specifies the customer billing country identifier. Required. |
state |
integer |
specifies the customer billing state identifier. Required. |
redirect |
string |
specifies an ULR of a page to redirect the browser after processing the form data. |
customer_notes |
string |
specifies optional customer order notes. |
coupon_code |
string |
specifies a coupon code. |
submit |
string |
a name of the SUBMIT input element. |
cart_name |
string |
specifies the shopping cart name. |
Supported form field details
¶
first_name form field
Specifies the customer billing first name. Required.
¶
last_name form field
Specifies the customer billing last name. Required.
¶
email form field
Specifies the customer email address. Required.
¶
company form field
Specifies the customer company name.
¶
phone form field
Specifies the customer phone number.
¶
street_address form field
Specifies the customer bulling street address. Required.
¶
city form field
Specifies the customer billing city. Required.
¶
zip form field
Specifies the customer billing ZIP/postal code. Required.
¶
country form field
Specifies the customer billing country identifier. Required.
¶
state form field
Specifies the customer billing state identifier. Required.
¶
redirect form field
Specifies an ULR of a page to redirect the browser after processing the form data.
Use a hidden field for this value. If you are implementing a conventional checkout process, a value of
this field is an URL of the checkout Shipping Information page.
Note that if your copy of LemonStand is installed in a subdirectory, you need to use the root_url() function
in the redirect field value.
¶
customer_notes form field
Specifies optional customer order notes.
¶
coupon_code form field
Specifies a coupon code.
¶
submit form field
A name of the SUBMIT input element.
The submit button should have name submit if you are implementing a regular POST form.
Alternatively you can create an AJAX form with shop:on_checkoutSetBillingInfo handler.
¶
cart_name form field
Specifies the shopping cart name.
LemonStand support multiple shopping cart. By default the cart named main used.
Generated PHP variable details
¶
billing_info variable
An address information object representing a customer's billing name and address.
¶
countries variable
A collection of countries for populating the Country list.
Each element in the collection is an object of the Shop_Country class.
¶
states variable
¶
discount variable
float $discount;
Estimated cart discount.
You can display this value during the checkout process.
¶
cart_total variable
float $cart_total;
Cart total amount (subtotal).
¶
estimated_total variable
float $estimated_total;
An estimated total value.
This value is calculated on each step of the checkout process, taking into account
price rules
and known information about the customer.
¶
estimated_tax variable
float $estimated_tax;
An estimated tax value.
The value includes the sales tax and shipping tax.
Built-in AJAX handlers details
¶
shop:on_checkoutSetBillingInfo AJAX handler
Processes the form in AJAX mode.
Use this handler for creating a button, or link, for sending the form data to the server and redirecting the browser
to a next checkout step. Example:
<input
type="image"
src="/resources/images/btn_next.gif"
alt="Next"
onclick="return $(this).getForm().sendRequest('shop:on_checkoutSetBillingInfo')"/>
|