Examples

Below are a couple of examples to quick start

Add to Cart example

{exp:channel:entries channel="products"}
    {exp:reinos_simple_store:add_to_cart
        entry_id="{entry_id}"
        sku="{entry_id}"
        product_name="{title}"
        product_price="{product_price}"
        disable_shipping="no"
        return_url="simple_store/index"
        custom_fields:test="test custom field"
        {!-- set some nice labels for your custom fields --}
        custom_fields_label:test="Testing"
        custom_fields_label:field_from_input="Field from Input"
    }
        {if error:invalid_price}
            <p style="color:red;">You have entered an invalid price</p>
        {/if}

        {if error:invalid_sale_price}
            <p style="color:red;">You have entered an invalid sale price</p>
        {/if}

        <p>
            <input type="text" name="custom_fields[field_from_input]" placeholder="custom field"/>
        </p>

        <p>
            <label for="qty">qty</label>
        </p>

        <p>            
            <input class="form-control" type="number" id="qty" name="qty" value="1"/>
        </p>

        <input type="submit" class="btn btn-primary" value="Add to Cart"/>      
    {/exp:reinos_simple_store:add_to_cart}
{/exp:channel:entries}

Cart example

{exp:reinos_simple_store:cart prefix="cart:" can_update="yes"}
    <h3>Cart</h3>
    {if cart:no_items}
        <p>No cart items</p>
    {if:else}
        <table class="table mt-4 mb-4">
            <thead>
                <tr>
                    <th class="text-left">Name</th>
                    <th></th>
                    <th class="text-left" colspan="2">Price</th>
                </tr>
            </thead>
        <tbody>
                {cart:items}
                    {exp:channel:entries entry_id="{cart:entry_id}"dynamic="no"}
                        <tr>
                            <td><a href="{page_uri}">{title}</a>
                                {if cart:sku != ''}<small>sku: {cart:sku}</small>{/if}
                                {cart:custom_fields}<br><strong>{custom_fields:label}:</strong> {custom_fields:value}{/cart:custom_fields}
                            </td>
                            <td class="text-right"><input type="number" value="{cart:qty}" name="qty[{cart:id}]"></td>
                            <td>{cart:price_total_plus_tax}</td>
                            <td>
                                {exp:reinos_simple_store:delete_cart_item cart_item_id="{cart:id}"}
                                    <a href="{remove_cart_item_url}">Remove</a>
                                {/exp:reinos_simple_store:delete_cart_item}
                            </td>
                        </tr>
                    {/exp:channel:entries}
                {/cart:items}

                <tr><td colspan="4"></td></tr>
                <tr>
                    <td></td>
                    <td class="text-right"><strong>Coupon</strong></td>
                    <td colspan="2">
                        <input type="text" name="coupon_code" value="{cart:coupon_code}"/>
                        <input type="submit" name="update" value="Apply" class="btn btn-sm btn-secondary"/>
                  </td>
                </tr>
                <tr><td colspan="4"></td></tr>

                <tr>
                    <td></td>
                    <td class="text-right"><strong>Subtotaal</strong></td>
                    <td colspan="2">{cart:subtotal_plus_tax}</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="text-right"><strong>Discount</strong></td>
                    <td colspan="2">{cart:discount}</td>
                </tr>
                <tr>
                    <td></td>
                    <td class="text-right"><strong>TAX</strong></td>
                    <td colspan="2">{cart:tax}</td>
                </tr>
                {if items:shipping_plus_tax != '€0,00'}
                    <tr>
                        <td></td>
                        <td class="text-right"><strong>Shipping</strong></td>
                        <td colspan="2">{cart:shipping_plus_tax}</td>
                    </tr>
                {/if}
                <tr>
                    <td></td>
                    <td class="text-right"><strong>Totaal</strong></td>
                    <td colspan="2">{cart:total_plus_tax}</td>
                </tr>
            </tbody>
        </table>
        <input type="submit" name="update" value="Update" class="btn btn-primary"/>
        <input type="submit" name="clear" value="Clear cart" class="btn btn-primary"/>
        <a class="btn btn-success" href="#">Afrekenen</a>
    {/if}
{/exp:reinos_simple_store:cart}

Checkout example

{exp:reinos_simple_store:checkout
    return_url="simple_store/order"
    extra_fields="agree_with_terms"
}
    {if has_field_errors}<div class="text-red"><strong>Not all your fields are filled in.</strong></div>{/if}
    {if has_global_errors}<div class="text-red"><strong>{global_errors}<li>{global_errors:error}</li>{/global_errors}</strong></div>{/if}
    {if status == 'cancelled'}<div class="text-red"><strong>You cancelled your order</strong></div>{/if}
    {if status == 'failed'}<div class="text-red"><strong>Your order has been failed</strong></div>{/if}

    <div class="row">
        <div class="col-sm">
            <div class="input-wrapper">
                <label for="customer_first_name">Firstname</label>
                {if customer_first_name:error != ''}<span class="text-red">{customer_first_name:error}</span>{/if}
                <input type="text" class="form-control" id="customer_first_name" name="customer_first_name" value="{customer_first_name:value}" >
            </div>
            <div class="input-wrapper">
                <label for="customer_last_name">Lastname</label>
                {if customer_last_name:error != ''}<span class="text-red">{customer_last_name:error}</span>{/if}
                <input type="text" class="form-control" id="customer_last_name" name="customer_last_name" value="{customer_last_name:value}">
            </div>
            <div class="input-wrapper">
                <label for="customer_email">Email address</label>
                {if customer_email:error != ''}<span class="text-red">{customer_email:error}</span>{/if}
                <input type="email" class="form-control" id="customer_email" name="customer_email" value="{customer_email:value}">
            </div>
            <div class="input-wrapper">
                <label for="customer_phone">Phone</label>
                {if customer_phone:error != ''}<span class="text-red">{customer_phone:error}</span>{/if}
                <input type="text" class="form-control" id="customer_phone" name="customer_phone" value="{customer_phone:value}">
            </div>
            <div class="input-wrapper">
                <label for="customer_company">Company</label>
                {if customer_company:error != ''}<span class="text-red">{customer_company:error}</span>{/if}
                <input type="text" class="form-control" id="customer_company" name="customer_company" value="{customer_company:value}">
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm">
            <h3 class="mb-4">Billing address</h3>
            <div class="input-wrapper">
                <label for="billing_address">Address</label>
                {if billing_address:error != ''}<span class="text-red">{billing_address:error}</span>{/if}
                <input type="text" class="form-control" id="billing_address" name="billing_address" value="{billing_address:value}">
            </div>
            <div class="input-wrapper">
                <label for="billing_address">Address 2</label>
                {if billing_address2:error != ''}<span class="text-red">{billing_address2:error}</span>{/if}
                <input type="text" class="form-control" id="billing_address2" name="billing_address2" value="{billing_address2:value}">
            </div>
            <div class="input-wrapper">
                <label for="billing_zip">Zipcode</label>
                {if billing_zip:error != ''}<span class="text-red">{billing_zip:error}</span>{/if}
                <input type="text" class="form-control" id="billing_zip" name="billing_zip" value="{billing_zip:value}">
            </div>
            <div class="input-wrapper">
                <label for="billing_city">City</label>
                {if billing_city:error != ''}<span class="text-red">{billing_city:error}</span>{/if}
                <input type="text" class="form-control" id="billing_city" name="billing_city" value="{billing_city:value}">
            </div>
            <div class="input-wrapper">
                <label for="billing_country">Country</label>
                {if billing_country:error != ''}<span class="text-red">{billing_country:error}</span>{/if}
                {exp:reinos_simple_store:country_list type="billing" class="form-control" value="{billing_country:value}"}
            </div>
        </div>
        <div class="col-sm">
            <h3 class="mb-4">Shipping address</h3>
            <div class="input-wrapper">
                <input type="checkbox" value="1" checked id="billing_same_as_shipping" name="billing_same_as_shipping">
                <label for="billing_same_as_shipping">Shipping is the samee as billing</label>
            </div>
            <div id="shipping_address_wrapper" style="display: none;">
                <div class="input-wrapper">
                    <label for="shipping_address">Address</label>
                    {if shipping_address:error != ''}<span class="text-red">{shipping_address:error}</span>{/if}
                    <input type="text" class="form-control" id="shipping_address" name="shipping_address" value="{shipping_address:value}">
                </div>
                <div class="input-wrapper">
                    <label for="shipping_address">Address 2</label>
                    {if shipping_address2:error != ''}<span class="text-red">{shipping_address2:error}</span>{/if}
                    <input type="text" class="form-control" id="shipping_address2" name="shipping_address2" value="{shipping_address2:value}">
                </div>
                <div class="input-wrapper">
                    <label for="shipping_zip">ZipCode</label>
                    {if shipping_zip:error != ''}<span class="text-red">{shipping_zip:error}</span>{/if}
                    <input type="text" class="form-control" id="shipping_zip" name="shipping_zip" value="{shipping_zip:value}">
                </div>
                <div class="input-wrapper">
                    <label for="shipping_city">City</label>
                    {if shipping_city:error != ''}<span class="text-red">{shipping_city:error}</span>{/if}
                    <input type="text" class="form-control" id="shipping_city" name="shipping_city" value="{shipping_city:value}">
                </div>
                <div class="input-wrapper">
                    <label for="shipping_country">Country</label>
                    {if shipping_country:error != ''}<span class="text-red">{shipping_country:error}</span>{/if}
                    {exp:reinos_simple_store:country_list type="shipping" class="form-control" value="{shipping_city:value}"}
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-sm">
            <h3 class="mb-4">Gateway</h3>
            <div class="input-wrapper">
                <select name="gateway">
                    <option value="">Choose your gateway</option>
                    {exp:reinos_simple_store:gateway_list}
                    <option value="{gateway:name}">{gateway:label}</option>
                    {/exp:reinos_simple_store:gateway_list}
                </select>

                <!--
                You can also set a fixed provider by using
                <input type="hidden" name="gateway" value="paypal"/>
                -->
            </div>
        </div>
    </div>

    <input type="checkbox" name="extra[agree_with_terms]" value="yes"/>    Agree with the terms

    <button type="submit" class="btn btn-primary">Checkout</button>

    <script>
        $(function(){
            $('#billing_same_as_shipping').change(function(){
                if($(this).is(':checked')) {
                    $('#shipping_address_wrapper').hide();
                } else {
                    $('#shipping_address_wrapper').show();
                }
            });
        });
    </script>
{/exp:reinos_simple_store:checkout}

Order example

{exp:reinos_simple_store:order hash="{segment_3}"}
    {if no_results}
        No order found
    {/if}

    {if order:can_complete}
        <div class="alert alert-warning" role="alert">
            Your order is not yet payed, finish your order by clicking <a href="{order:payment_url}">here</a>.
        </div>
    {/if}

    <div class="row color-invoice">
        <div class="col-md-12">
            <div class="row">
                <div class="col-sm-7">
                    <h4>Order</h4>
                    <b>Order ID:</b> #{order:order_id}  <br>
                    <b>Order Date:</b> {order:time format="%d %M %Y"}<br>
                    <b>Transaction ID: </b> {order:transaction_id} <br>
                    <b>Status: </b> {order:status} <br>
                    <b>Gateway: </b> {order:gateway}

                    <br>
                    <br>
                    <h4>Your personal data</h4>
                    {if order:customer_company}{order:customer_company}<br>{/if}
                    {order:customer_first_name} {order:customer_last_name}<br>
                    {order:customer_email}<br>
                    {order:customer_phone} <br><br>

                </div>
                <div class="col-sm-5">
                    <strong>Custom Company</strong><br>
                    Custom street 6
                    <br>8985 KO Your-city
                    <br>2589-8987588
                    <br>info@customcompany.com

                    <br>

                </div>
            </div>
            <hr/>
            <div class="row">
                <div class="col-sm-7">
                    <br>
                    <h4>Billing address</h4>
                    {order:billing_address} {order:billing_address2}<br>
                    {order:billing_zip}, {order:billing_city}<br>
                    {exp:reinos_simple_store:country}{order:billing_country}{/exp:reinos_simple_store:country}<br>
                    <br>
                </div>
                <div class="col-sm-5">
                    <br>
                    <h4>Shipping address</h4>
                    {order:shipping_address} {order:shipping_address2}<br>
                    {order:shipping_zip}, {order:shipping_city}<br>
                    {exp:reinos_simple_store:country}{order:shipping_country}{/exp:reinos_simple_store:country}<br>
                    <br>
                </div>
            </div>

            <hr/>
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12">
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th width="55%">Item</th>
                                <th class="text-center" width="15%">qty</th>

                                <th class="text-center" width="15%">TAX</th>

                                <th class="text-right" width="15%">price</th>
                            </tr>
                            </thead>
                            <tbody>
                            {order:items}
                                <tr>
                                    <td>
                                        {order:items:name}
                                        {order:items:custom_fields}<br><strong>{custom_fields:label}:</strong> {custom_fields:value}{/order:items:custom_fields}
                                    </td>
                                    <td class="text-center">{order:items:qty}</td>

                                    <td class="text-center">
                                        {order:items:price_plus_tax}
                                    </td>

                                    <td class="text-right">
                                        {order:items:price_total_plus_tax}
                                    </td>
                                </tr>
                            {/order:items}
                            </tbody>
                        </table>
                    </div>

                    <div>
                        <table class="table borderless">

                            <tr>
                                <td class="text-right"><b>Subtotaal: {order:subtotal_plus_tax} </b></td>
                            </tr>

                            <tr>
                                <td class="text-right"><b>Discount: {order:discount} </b></td>
                            </tr>

                            <tr>
                                <td class="text-right"><b>Shipping: {order:shipping_plus_tax} </b></td>
                            </tr>

                            <tr>
                                <td class="text-right"><b>TAX: {order:tax} </b></td>
                            </tr>

                            <tr>
                                <td class="text-right"><b>Total: {order:total_plus_tax} </b></td>
                            </tr>
                        </table>
                    </div>
                    <hr>
                </div>
            </div>
        </div>
    </div>

{/exp:reinos_simple_store:order}