shop:checkout_shipping_info CMS action
Defined in |
/modules/shop/classes/shop_actions.php, lines 1855-1867 |
Author |
LemonStand eCommerce Inc. |
Base action for the Shipping Information checkout page.
This action is a part of the step-by-step checkout process.
The Shipping Information page is the second 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.
Field |
Type |
Description |
first_name |
string |
specifies the customer shipping first name. Required. |
last_name |
string |
specifies the customer shipping last name. Required. |
company |
string |
specifies the customer shipping company name. |
phone |
string |
specifies the phone number. |
street_address |
string |
specifies the customer shipping street address. Required. |
city |
string |
specifies the customer shipping city. Required. |
zip |
string |
specifies the customer shipping ZIP/postal code. Required. |
country |
integer |
specifies the customer shipping country identifier. Required. |
state |
integer |
specifies the customer shipping state identifier. Required. |
redirect |
string |
specifies an ULR of a page to redirect the browser after processing the form data. |
customer_notes |
string |
optional field for entering the customer order notes. |
coupon_code |
string |
specifies a coupon code. |
is_business |
boolean |
determines whether the shipping location is a business address. |
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 shipping first name. Required.
¶
last_name form field
Specifies the customer shipping last name. Required.
¶
company form field
Specifies the customer shipping company name.
¶
phone form field
Specifies the phone number.
¶
street_address form field
Specifies the customer shipping street address. Required.
¶
city form field
Specifies the customer shipping city. Required.
¶
zip form field
Specifies the customer shipping ZIP/postal code. Required.
¶
country form field
Specifies the customer shipping country identifier. Required.
¶
state form field
Specifies the customer shipping 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 Method 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
Optional field for entering the customer order notes.
¶
coupon_code form field
Specifies a coupon code.
¶
is_business form field
Determines whether the shipping location is a business address.
Supported values are 0, 1.
¶
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_checkoutSetShippingInfo 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
¶
shipping_info variable
An object representing a customer's shipping 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_checkoutSetShippingInfo 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_checkoutSetShippingInfo')"/>
¶
shop:on_copyBillingInfo AJAX handler
Copies billing information (a customer name and address) to the shipping information checkout step.
Use this for creating a link “ Copy billing information” on the shipping information checkout page. Example:
<a
href="#"
onclick="return $(this).getForm().sendRequest(
'shop:on_copyBillingInfo',
{update:{'checkout_page': 'checkout_partial'}})"
>Copy billing information</a>
|