shop:checkout_shipping_method CMS action
Defined in |
/modules/shop/classes/shop_actions.php, lines 1946-1961 |
Author |
LemonStand eCommerce Inc. |
Base action for the Shipping Method checkout page.
This action is a part of the step-by-step checkout process.
The Shipping Method page is the third 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 |
shipping_option |
string |
an identifier of selected shipping method. Required. |
redirect |
string |
specifies an ULR of a page to redirect the browser after processing the form data. |
submit |
string |
a name of the SUBMIT input element. |
cart_name |
string |
specifies the shopping cart name. |
Supported form field details
¶
shipping_option form field
An identifier of selected shipping method. Required.
You can use either radio button set or a SELECT element for representing a list of available shipping methods.
¶
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 Payment 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.
¶
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_checkoutSetShippingMethod 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_options variable
array $shipping_options;
A list of available shipping options.
Each element in the array is an object of the Shop_ShippingOption class.
¶
shipping_method variable
object $shipping_method;
A PHP object representing a shipping method previously selected by the customer, if any.
The object has the following fields:
- id - an identifier of the shipping method in LemonStand database.
- quote - specifies the shipping quote.
- name - specifies the shipping method name.
You can use this variable for pre-selecting an item in the shipping method list.
¶
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_checkoutSetShippingMethod 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_checkoutSetShippingMethod')"/>
|