This is the documentation for LemonStand V1, which has been discontinued. You can learn more and upgrade your store here.

LemonStand Version 1 Has Been Discontinued

This documentation is for LemonStand Version 1. LemonStand is now offered as a cloud-based eCommerce platform.
You can try the new LemonStand and learn about upgrading here.

Creating an Order Review Page

The Order Review step finalizes the checkout process. On this step a visitor can see all the information about the order. The Order Review step doesn't have any input elements.

Start with creating a new partial. According to the code example in the Checkout Page partial, the name of the Order Review partial should be shop:checkout_review. You could use any other names for partials in your store.

The following code demonstrates the Order Review partial code example.

<h3>Order Review</h3>
<?
  $bill_to_str = $billing_info->as_string();
  $ship_to_str = $shipping_info->as_string();
  $items = Shop_Cart::list_active_items();
?>

<p>Bill to: <?= h($bill_to_str) ?></p>
<p>Ship to: <?= h($ship_to_str) ?></p>

<table>
  <tr>
    <th>Cart Items</th>
    <th>Quantity</th>
    <th>Price</th>
    <th>Discount</th>
    <th>Total</th>
  </tr>
  <?
    foreach ($items as $item):
      $options_str = $item->options_str();
  ?>
    <tr>
      <td>
        <strong><?= h($item->product->name) ?></strong>
        <? if (strlen($options_str)): ?>
          <br/><?= h($options_str) ?>.
        <? endif ?>
        <? if ($item->extra_options): ?>
          <? foreach ($item->extra_options as $option): ?>
            <br/>+ <?= h($option->description) ?>: <?= format_currency($option->get_price($item->product)) ?>
          <? endforeach ?>
        <? endif ?>
      </td>
      <td><?= $item->quantity ?></td>
      <td><?= format_currency($item->single_price()) ?></td>
      <td><?= format_currency($item->total_discount()) ?></td>
      <th><?= format_currency($item->total_price()) ?></th>
    </tr>
  <? endforeach ?>
</table>

<p>
  Subtotal: <?= format_currency($subtotal) ?><br/>
  Discount: <?= format_currency($discount) ?><br/>
    
  <? foreach ($product_taxes as $tax): ?>
    <?= ($tax->name) ?>:<?= format_currency($tax->total) ?><br/>
  <? endforeach ?>
    
  Shipping: <?= format_currency($shipping_quote) ?>
    
  <? foreach ($shipping_taxes as $tax): ?>
    Shipping tax (<?= ($tax->name) ?>): <?= format_currency($tax->rate) ?><br/>
  <? endforeach ?>
</p>

<p>Total: <strong><?= format_currency($total) ?></strong></p>
<input type="hidden" name="checkout_step" value="<?= $checkout_step ?>"/>
<input type="button" value="Place Order and Pay" onclick="return $(this).getForm().sendRequest(
  'on_action', 
  {update:{'checkout_page': 'checkout_partial'}}
)"/> 
<h3>Order Review</h3>
{% set bill_to_str = billing_info.as_string() %}
{% set ship_to_str = shipping_info.as_string() %}
{% set items = method('Shop_Cart', 'list_active_items') %}

<table>
  <thead>
    <tr>
      <th>Cart Items</th>
      <th>Quantity</th>
      <th>Price</th>
      <th>Discount</th>
      <th>Total</th>
    </tr>
  </thead>
  <tbody>
    {% for item in items %}
      {% set options_str = item.options_str() %}
      <tr>
        <td>
          <strong>{{ item.product.name }}</strong>
          {% if options_str|length > 0 %}
            <br/>{{ options_str }}.
          {% endif %}
          {% if item.extra_options %}
            {% for option in item.extra_options %}
              <br/>
              + {{ option.description }}:
              {{ option.get_price(item.product)|currency }}
            {% endfor %}
          {% endif %}
        </td>
        <td>{{ item.quantity }}</td>
        <td>{{ item.single_price()|currency }}</td>
        <td>{{ item.total_discount()|currency }}</td>
        <th>{{ item.total_price()|currency }}</th>
      </tr>
    {% endfor %}
  </tbody>
</table>

<p>
  Subtotal: {{ subtotal|currency }}<br/>
  Discount: {{ discount|currency }}<br/>
  
  {% for tax in product_taxes %}
    Sales tax ({{ tax.name }}): {{ tax.total|currency }}<br/>
  {% endfor %}
  
  Shipping: {{ shipping_quote|currency }}<br/>

  {% for tax in shipping_taxes %}
    Shipping tax ({{ tax.name }}): {{ tax.rate|currency }}<br/>
  {% endfor %}
</p>

<p>Total: <strong>{{ total|currency }}</strong></p>
<input type="hidden" name="checkout_step" value="{{ checkout_step }}"/>
<input type="button" value="Place Order and Pay" onclick="return $(this).getForm().sendRequest(
  'on_action', 
  {update:{'checkout_page': 'checkout_partial'}}
)"/> 

The code outputs the billing and shipping information, the cart item list, order subtotals, tax values, shipping cost and total value. The code for displaying a shopping carts content repeats the code described in the Cart page article. 

The as_string method of $billing_info and $shipping_info objects are used for obtaining a formatted string, containing a customer's billing and shipping information. The $billing_info and $shipping_info objects are instances of Shop_CheckoutAddressInfo class.

The checkout_step hidden field should be used in all checkout partials.

Displaying bundle items

Please read the Cart Page article to learn how to display bundle items on the order preview checkout step.

See also:

Next: Configuring a Non-Required Shipping for Digital Products and Services
Previous: Creating a Form for Payment Method
Return to AJAX-driven single-page checkout