LemonStand Documentation

shop:checkout_shipping_method

The shop:checkout_shipping_method action is designed for creating the Shipping Method page, which allows a customer to select a shipping method from a list of available methods. The Shipping Method page is the third step of the conventional step-by-step checkout process. Please read the generic description of the step-by-step actions in the Step-by-step checkout actions article.

Supported and required form fields

The Shipping Method page should contain a HTML form with the following fields. To post form data to the server using the regular POST method (non AJAX), create a submit input element with the "submit" name. To submit the form using the AJAX method, use the shop:on_checkoutSetShippingMethod handler, described in the Supported AJAX handlers section below.

  • shipping_option – 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 - an ULR of a page to redirect the browser after processing the form data, if the provided information has no errors. Use a hidden field for supplying this value. If you are implementing a conventional checkout process, a value of this field will be a URL of the checkout Billing Method page. Note: if your copy of LemonStand is installed in a subdirectory, you need to use the root_url() function to generate correct URLs referring to LemonStand pages.

Generated PHP variables

The action provides the following PHP variables, which you can access in the page code.

  • $shipping_options – a list of available shipping options, array. Each element in the array is an object of the Shop_ShippingOption class.
  • $shipping_method - an identifier of a shipping method previously selected by the customer (during a previous checkout). You can use this variable for pre-selecting an item in the shipping method list.
  • $discount - estimated cart discount. You can display this value during the checkout process.
  • $cart_total - cart total value (subtotal).
  • $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 - an estimated tax value. This value is calculated on each step of the checkout process, taking into account price rules (defined on the Shop/Discounts page) and known information about the customer. The tax value includes the goods tax and shipping tax.

Supported AJAX handlers

  • shop:on_checkoutSetShippingMethod - sends the shipping method form to the server for further processing. 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')"/>

Next: shop:checkout_payment_method
Previous: shop:checkout_shipping_info
Return to Step-by-step checkout actions