Forum

Thread tagged as: Question, Problem, Shop

Shipping method in cart using "template includes"

I'm using a "template include" in my "cart.html" template to display the shipping methods on the cart page. It's not working. Is there a better way to display shipping methods in the cart?

<section id="content">
    <div class="content-wrap">
        <div class="container clearfix">
            <perch:if id="product_count" match="gt" value="0">
                <perch:form id="cart" app="perch_shop">
                    <perch:input type="submit" value="Update" hidden="true" aria-hidden="true" />
                    <div class="table-responsive">
                        <table class="table cart">
                            <thead>
                                <tr>
                                    <th class="cart-product-remove">&nbsp;</th>
                                    <th class="cart-product-thumbnail">&nbsp;</th>
                                    <th class="cart-product-name">Item</th>
                                    <th class="cart-product-price">Price</th>
                                    <th class="cart-product-quantity">Quantity</th>
                                    <th class="cart-product-subtotal">Total</th>
                                </tr>
                            </thead>
                            <tbody>
                            <perch:cartitems>
                                <tr class="cart_item">
                                    <td class="cart-product-remove text-center">
                                        <button type="submit" class="remove_cart" name="del:<perch:cartitem id="identifier" />" value="1"><i class="icon-trash2"></i></button>
                                    </td>
                                    <td class="cart-product-thumbnail">
                                        <perch:repeater id="rptProductImages">
                                            <perch:if exists="perch_item_first"> 
                                                <perch:cartitem id="image" type="image" width="80" height="80" density="1.6" crop="true" output="tag" />
                                            </perch:if>
                                        </perch:repeater>
                                        <perch:cartitem id="image" type="image" width="80" height="80" density="1.6" crop="true" output="tag" />
                                    </td>
                                    <td class="cart-product-name">
                                        <h5 class="mb-0"><perch:cartitem id="title" /></h5>
                                        <p><i><perch:cartitem id="variant_desc" /></i></p>
                                        <div class="desc">
                                            <perch:cartitem id="description" type="textarea" markdown="true" />
                                        </div>
                                    </td>
                                    <td class="cart-product-price">
                                        <perch:cartitem id="price_without_tax" />
                                    </td>
                                    <td class="cart-product-quantity">
                                        <perch:input id="qty:<perch:cartitem id="identifier" />" value="<perch:cartitem id="quantity" />" type="number" min="0"  />
                                    </td>
                                    <td class="cart-product-subtotal">
                                        <span class="amount"><perch:cartitem id="total_without_tax_formatted" /></span>
                                    </td>
                                </tr>
                                </perch:cartitems>
                                <tr class="cart_item">
                                    <td colspan="6">
                                        <div class="row clearfix">
                                            <div class="col-lg-4 col-4 nopadding">
                                                <div class="row">
                                                    <div class="col-lg-8 col-7">
                                                        <perch:input type="text" value="" class="sm-form-control" placeholder="Enter Coupon Code.." id="discount_code" />
                                                    </div>
                                                    <div class="col-lg-4 col-5">
                                                        <perch:input type="submit" value="Apply Coupon" class="button button-3d button-black nomargin"/>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-lg-8 col-8 nopadding">
                                                <perch:input type="submit" value="Update Cart" class="button button-3d nomargin fright"/>
                                                <a href="checkout" class="button button-3d notopmargin fright">Checkout now</a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="row clearfix">
                        <div class="col-lg-6 clearfix">
                            <perch:template path="content/method_form.html" />
                        </div>
                        <div class="col-lg-6 clearfix">
                            <h4>Cart Totals</h4>
                            <div class="table-responsive">
                                <table class="table cart">
                                    <tbody>
                                        <perch:if id="total_discounts" match="gt" value="0.00">
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <strong>Discount (<perch:shop id="discount_code" />)</strong>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount"><perch:shop id="total_discounts_formatted" /></span>
                                            </td>
                                        </tr>
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <strong>Cart Subtotal</strong>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount"><perch:shop id="total_items_discounted_formatted" /></span>
                                            </td>
                                        </tr>
                                        <perch:else />
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <span class="amount"><strong>Cart Subtotal</strong></span>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount"><perch:shop id="total_items_formatted" /></span>
                                            </td>
                                        </tr>
                                        </perch:if>
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <strong>Shipping</strong>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount">Free Delivery</span>
                                            </td>
                                        </tr>
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <strong>Tax</strong>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount"><perch:shop id="total_tax_formatted" /></span>
                                            </td>
                                        </tr>
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <strong>Total</strong>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount color lead"><strong><perch:shop id="grand_total_formatted" /></strong></span>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
               </perch:form>   
            <perch:else />
                <div class="style-msg errormsg">
                    <div class="sb-msg"><i class="icon-remove"></i><strong>Oh snap!</strong> Your cart is empty.</div>
                </div>
            </perch:if>         
        </div>
    </div>
</section>                        
Justin Jojola

Justin Jojola 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How is it failing? Have you turned on debug to check what's happening?

The shipping options do not populate the select box.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you turned on debug to check what's happening?

Debug Message - Perch 3.0.14
[1] SELECT * FROM perch3_pages WHERE pagePath='/shop/cart.php' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=101
[1] SELECT * FROM perch3_shop_cart WHERE cartID=101
[47] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
[1] SELECT * FROM perch3_shop_products WHERE productID='695' AND productDeleted IS NULL LIMIT 1
[3] SELECT valueSKUCode FROM perch3_shop_option_values WHERE valueID IN ('15', '1', '9') AND optionID IN (5, 1, 3)
[1] SELECT productID FROM perch3_shop_products WHERE parentID=695 AND productDeleted IS NULL AND (sku REGEXP "[[:<:]]XSM[[:>:]]") AND (sku REGEXP "[[:<:]]BLC[[:>:]]") AND (sku REGEXP "[[:<:]]MEN[[:>:]]") LIMIT 1
[1] SELECT itemID, itemQty FROM perch3_shop_cart_items WHERE cartID=101 AND productID=696
[1] SELECT * FROM perch3_shop_products WHERE productID=696 AND productDeleted IS NULL LIMIT 1
INSERT INTO perch3_shop_cart_items(productID,itemQty,cartID) VALUES('696','1','101')
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch3_shop_cart WHERE cartID=101
[1] SELECT * FROM perch3_shop_cart WHERE cartID=101
[1] SELECT * FROM perch3_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
[1] SELECT locationID FROM perch3_shop_tax_locations WHERE locationIsHome=1 LIMIT 1
[1] SELECT * FROM perch3_shop_tax_locations WHERE locationID=1 AND locationDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_currencies WHERE currencyID=142 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch3_shop_cart_items WHERE cartID=101
Tax mode: exc
[1] SELECT * FROM perch3_shop_cart_items WHERE cartID=101 ORDER BY itemID ASC
[1] SELECT * FROM perch3_shop_products WHERE productID=696 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_products WHERE productID=695 AND productDeleted IS NULL LIMIT 1
[36] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=695 AND productDeleted IS NULL ORDER BY productOrder ASC
[3] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=695 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=5 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='5' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[6] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=1 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[6] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='1' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[3] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=3 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[3] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='3' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch3_shop_products WHERE productID=695 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[1] SELECT r.rateValue FROM perch3_shop_tax_group_rates gr, perch3_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[1] SELECT * FROM perch3_shop_products WHERE productID=695 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[1] SELECT r.rateValue FROM perch3_shop_tax_group_rates gr, perch3_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[1] SELECT * FROM perch3_shop_products WHERE productID=695 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_products WHERE productID=695 AND productDeleted IS NULL LIMIT 1
[36] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=695 AND productDeleted IS NULL ORDER BY productOrder ASC
[3] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=695 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=5 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='5' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[6] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=1 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[6] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='1' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[3] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=3 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[3] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='3' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch3_shop_products WHERE productID=695 AND productDeleted IS NULL LIMIT 1
[36] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=695 AND productDeleted IS NULL ORDER BY productOrder ASC
[3] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=695 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=5 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='5' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[6] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=1 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[6] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='1' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[3] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=3 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[3] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='3' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch3_shop_products WHERE productID=695 AND productDeleted IS NULL LIMIT 1
[36] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=695 AND productDeleted IS NULL ORDER BY productOrder ASC
[3] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=695 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=5 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='5' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[6] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=1 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[6] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='1' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[3] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=3 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[3] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='3' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch3_shop_products WHERE productID=695 AND productDeleted IS NULL LIMIT 1
[36] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=695 AND productDeleted IS NULL ORDER BY productOrder ASC
[3] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=695 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=5 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='5' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[6] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=1 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[6] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='1' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[3] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=3 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[3] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='3' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT * FROM perch3_shop_products WHERE productID=695 AND productDeleted IS NULL LIMIT 1
[36] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=695 AND productDeleted IS NULL ORDER BY productOrder ASC
[3] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=695 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=5 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='5' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[6] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=1 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[6] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='1' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[3] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=3 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[3] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='3' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[1] SELECT z.* FROM perch3_shop_shipping_zones z LEFT JOIN perch3_shop_shipping_zone_countries c ON z.zoneID=c.zoneID WHERE z.zoneActive=1 AND z.zoneDeleted IS NULL AND (c.countryID=237 OR zoneIsDefault=1) ORDER BY zoneIsDefault ASC LIMIT 1
[2] SELECT * FROM perch3_shop_shippings WHERE shippingDeleted IS NULL ORDER BY shippingOrder ASC
[1] SELECT * FROM perch3_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
[2] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch3_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[1] SELECT * FROM perch3_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
Qualifying shipping method ‘Free’
Qualifying shipping method ‘Overnight’
[1] SELECT * FROM perch3_shop_shippings WHERE shippingID='2' AND shippingDeleted IS NULL LIMIT 1
Using shipping zone: USA
[1] SELECT * FROM perch3_shop_tax_groups WHERE groupID=1 AND groupDeleted IS NULL LIMIT 1
[1] SELECT r.rateValue FROM perch3_shop_tax_group_rates gr, perch3_shop_tax_rates r WHERE gr.rateID=r.rateID AND gr.groupID=1 AND gr.locationID=1
[1] SELECT * FROM perch3_shop_promotions WHERE promoFrom<='2018-03-26 17:41:00' AND promoTo>'2018-03-26 17:41:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
Promo (Jojola Discount) skipped: discount code not applied.
UPDATE perch3_shop_cart SET cartTotalItems='1', cartTotalProducts='1', cartTotalWithTax='16.63', cartTotalWithoutTax='15.99' WHERE cartID='101'
INSERT INTO perch3_shop_cart_data(cartID,productID,cartData) VALUES('101','695','{\"opt-5\":\"15\",\"opt-1\":\"1\",\"opt-3\":\"9\",\"qty\":\"1\",\"product\":\"695\"}')
[6] SELECT * FROM perch3_pages WHERE pageNew=0 AND pageHidden=0 ORDER BY pageTreePosition ASC
[0] SELECT pageTreePosition FROM perch3_pages WHERE pagePath='/shop/cart.php' LIMIT 1
[6] Using template: /templates/navigation/navigation.html
[1] SELECT * FROM perch3_shop_products WHERE productID=695 AND productDeleted IS NULL LIMIT 1
[36] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=695 AND productDeleted IS NULL ORDER BY productOrder ASC
[3] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=695 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[2] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=5 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[2] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='5' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[6] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=1 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[6] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='1' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
[3] SELECT valueID AS id, valueTitle AS title, valueSKUCode AS skucode FROM perch3_shop_option_values WHERE optionID=3 AND valueDeleted IS NULL ORDER BY valueOrder ASC
[3] SELECT pov.prodoptID, pov.optionID, pov.valueID, o.optionTitle, ov.* FROM perch3_shop_product_option_values pov, perch3_shop_options o, perch3_shop_option_values ov WHERE pov.productID='695' AND pov.optionID=o.optionID AND pov.valueID=ov.valueID AND o.optionDeleted IS NULL AND ov.valueDeleted IS NULL AND o.optionID='3' ORDER BY o.optionPrecendence ASC, ov.valueOrder ASC
Using template: /addons/apps/perch_shop/templates/shop/cart/cart.html
[3] Using sub-template: /templates/content/method_form.html

Here is what's on my page.

<?php include('../admin/runtime.php'); ?>
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
    <head>
        <?php
            perch_page_attributes(array(
            'template'=>'seo.html'
            ));
            perch_layout('global.stylesheet');
        ?>
        <link rel="stylesheet" href="https://canvashtml-cdn.semicolonweb.com/v5/css/components/bs-select.css" type="text/css" />
        <link rel="stylesheet" href="https://canvashtml-cdn.semicolonweb.com/v5/css/responsive.css" type="text/css" />
    </head>
    <body class="stretched">        
        <div id="wrapper" class="clearfix">
            <header id="header" class="full-header">
                <div id="header-wrap">
                    <div class="container clearfix">
                        <div id="primary-menu-trigger"><i class="icon-reorder"></i></div>
                        <?php perch_layout('global.navlogo'); ?>
                        <?php
                            perch_pages_navigation(array(
                                'template' => array('navigation.html'),
                            ));
                        ?>
                    </div>
                </div>
            </header>
            <section id="page-title">
                <div class="container clearfix">
                    <h1>Cart</h1>
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="/index.php">Home</a></li>
                        <li class="breadcrumb-item"><a href="/shop">Shop</a></li>
                        <li class="breadcrumb-item active" aria-current="page">Cart</li>
                    </ol>
                </div>
            </section>
            <?php perch_shop_cart(); ?>
            <footer id="footer" class="dark">
                <?php perch_layout('global.footer'); ?>
                <?php perch_content('Copyrights'); ?>
            </footer>
        </div>
        <div id="gotoTop" class="icon-angle-up"></div>
        <?php perch_layout('global.script'); ?>
        <script>
            jQuery(document).ready( function($){
                $('#shop').isotope({
                    transitionDuration: '0.65s',
                    getSortData: {
                        name: '.product-title',
                        price_lh: function( itemElem ) {
                            if( $(itemElem).find('.product-price').find('ins').length > 0 ) {
                                var price = $(itemElem).find('.product-price ins').text();
                            } else {
                                var price = $(itemElem).find('.product-price').text();
                            }

                            priceNum = price.split("$");

                            return parseFloat( priceNum[1] );
                        },
                        price_hl: function( itemElem ) {
                            if( $(itemElem).find('.product-price').find('ins').length > 0 ) {
                                var price = $(itemElem).find('.product-price ins').text();
                            } else {
                                var price = $(itemElem).find('.product-price').text();
                            }

                            priceNum = price.split("$");

                            return parseFloat( priceNum[1] );
                        }
                    },
                    sortAscending: {
                        name: true,
                        price_lh: true,
                        price_hl: false
                    }
                });

                $('.custom-filter:not(.no-count)').children('li:not(.widget-filter-reset)').each( function(){
                    var element = $(this),
                        elementFilter = element.children('a').attr('data-filter'),
                        elementFilterContainer = element.parents('.custom-filter').attr('data-container');

                    elementFilterCount = Number( jQuery(elementFilterContainer).find( elementFilter ).length );

                    element.append('<span>'+ elementFilterCount +'</span>');

                });

                $('.shop-sorting li').click( function() {
                    $('.shop-sorting').find('li').removeClass( 'active-filter' );
                    $(this).addClass( 'active-filter' );
                    var sortByValue = $(this).find('a').attr('data-sort-by');
                    $('#shop').isotope({ sortBy: sortByValue });
                    return false;
                });
            });
        </script>
        <script src="https://canvashtml-cdn.semicolonweb.com/v5/js/components/bs-select.js"></script>
        <script src="https://canvashtml-cdn.semicolonweb.com/v5/js/components/selectsplitter.js"></script>
        <script src="https://canvashtml-cdn.semicolonweb.com/v5/js/functions.js"></script>
        <script>
            $('.selectsplitter').selectsplitter();
        </script>
    </body>
</html>
Drew McLellan

Drew McLellan 2638 points
Perch Support

 Using sub-template: /templates/content/method_form.html

It looks like it is being used. What's in the template?

This is "method_form.html"

<perch:form id="shipping_method" method="post" app="perch_shop">
    <h4>Shipping method</h4>

    <perch:error for="all" type="login">
        <p class="error">Sorry, there was a problem.</p>
    </perch:error>

    <div>
        <perch:label for="shipping">Method</perch:label>
        <perch:input type="select" options="<perch:shop id="shippings_list" />" id="shipping" required="true" placeholder="Please choose"  />
        <perch:error for="shipping" type="required">Required</perch:error>
    </div>
    <div>
        <perch:input type="submit" id="submit" value="OK!" />
        <perch:input type="hidden" id="r" />
    </div>

</perch:form>
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Justin,

What you have at the moment is:

<perch:form id="cart" app="perch_shop">
.
.
<perch:form id="shipping_method" method="post" app="perch_shop">
</perch:form>
.
.
</perch:form>

Even if Perch renders the inner form correctly (use your browser dev tools to check), I'm not sure that's going to work as <form> elements aren't supposed to have other <form> elements inside them. See HTML5 docs:

Flow content, but with no form element descendants.

I removed the "template include". Instead just placed the code in the template. When I debug I see the options.

SELECT * FROM perch3_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
Qualifying shipping method ‘Free’
Qualifying shipping method ‘Overnight’
[1] SELECT * FROM perch3_shop_shippings WHERE shippingID='2' AND shippingDeleted IS NULL LIMIT 1
Using shipping zone: USA

If I view the source code from the browser the options are not there. ~~ <div> <select id="form1_shipping" name="shipping" class="selectpicker" placeholder="Please choose" required="required"><option disabled="disabled" selected="selected" value="">Please choose</option><option selected="selected" value=""></option></select>

                                                <input id="form1_submit" name="submit" class="button button-3d notopmargin fright" value="OK!" type="submit"><input type="hidden" name="cms-form" value="Y2FydDpwZXJjaF9zaG9wOi9hZGRvbnMvYXBwcy9wZXJjaF9zaG9wL3RlbXBsYXRlcy9zaG9wL2NhcnQvY2FydC5odG1sOjE1MjIxNjIwOTI=">
                                                <input id="form1_r" name="r" type="hidden">
                                            </div>

~~

Here is the template I'm using.

<section id="content">
    <div class="content-wrap">
        <div class="container clearfix">
            <perch:if id="product_count" match="gt" value="0">
                <perch:form id="cart" app="perch_shop">
                    <perch:input type="submit" value="Update" hidden="true" aria-hidden="true" />
                    <div class="table-responsive">
                        <table class="table cart">
                            <thead>
                                <tr>
                                    <th class="cart-product-remove" style="width:100px">&nbsp;</th>
                                    <th class="cart-product-thumbnail" style="width:100px">&nbsp;</th>
                                    <th class="cart-product-name">Item</th>
                                    <th class="cart-product-price" style="width:100px">Price</th>
                                    <th class="cart-product-quantity" style="width:100px">Quantity</th>
                                    <th class="cart-product-subtotal" style="width:100px">Total</th>
                                </tr>
                            </thead>
                            <tbody>
                            <perch:cartitems>
                                <tr class="cart_item">
                                    <td class="cart-product-remove text-center">
                                        <button type="submit" class="button button-3d notopmargin" name="del:<perch:cartitem id="identifier" />" value="1"><i class="icon-trash2"></i></button>
                                    </td>
                                    <td class="cart-product-thumbnail">
                                        <perch:repeater id="rptProductImages">
                                            <perch:if exists="perch_item_first"> 
                                                <perch:cartitem id="image" type="image" width="80" height="80" density="1.6" crop="true" output="tag" />
                                            </perch:if>
                                        </perch:repeater>
                                        <perch:cartitem id="image" type="image" width="80" height="80" density="1.6" crop="true" output="tag" />
                                    </td>
                                    <td class="cart-product-name">
                                        <h5 class="mb-0"><perch:cartitem id="title" /></h5>
                                        <p><i><perch:cartitem id="variant_desc" /></i></p>
                                        <div class="desc">
                                            <perch:cartitem id="description" type="textarea" markdown="true" />
                                        </div>
                                    </td>
                                    <td class="cart-product-price">
                                        <perch:cartitem id="price_without_tax" />
                                    </td>
                                    <td class="cart-product-quantity">
                                        <perch:input id="qty:<perch:cartitem id="identifier" />" class="form-control" value="<perch:cartitem id="quantity" />" type="number" min="0"  />
                                    </td>
                                    <td class="cart-product-subtotal">
                                        <span class="amount"><perch:cartitem id="total_without_tax_formatted" /></span>
                                    </td>
                                </tr>
                                </perch:cartitems>
                                <tr class="cart_item">
                                    <td colspan="6">
                                        <div class="row clearfix">
                                            <div class="col-lg-4 col-4 nopadding">
                                                <div class="row">
                                                    <div class="col-lg-8 col-7">
                                                        <perch:input type="text" value="" class="sm-form-control" placeholder="Enter Coupon Code.." id="discount_code" />
                                                    </div>
                                                    <div class="col-lg-4 col-5">
                                                        <perch:input type="submit" value="Apply Coupon" class="button button-3d button-black nomargin"/>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-lg-8 col-8 nopadding">
                                                <perch:input type="submit" value="Update Cart" class="button button-3d nomargin fright"/>
                                                <a href="checkout" class="button button-3d notopmargin fright">Checkout now</a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="row clearfix">
                        <div class="col-lg-6 clearfix"></div>
                        <div class="col-lg-6 clearfix">
                            <h4>Cart Totals</h4>
                            <div class="table-responsive">
                                <table class="table cart">
                                    <tbody>
                                        <perch:if id="total_discounts" match="gt" value="0.00">
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <strong>Discount (<perch:shop id="discount_code" />)</strong>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount"><perch:shop id="total_discounts_formatted" /></span>
                                            </td>
                                        </tr>
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <strong>Cart Subtotal</strong>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount"><perch:shop id="total_items_discounted_formatted" /></span>
                                            </td>
                                        </tr>
                                        <perch:else />
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <span class="amount"><strong>Cart Subtotal</strong></span>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount"><perch:shop id="total_items_formatted" /></span>
                                            </td>
                                        </tr>
                                        </perch:if>
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <strong>Shipping</strong>
                                            </th>
                                            <td class="cart-product-name">
                                                <perch:error for="all" type="login">
                                                    <p class="error">Sorry, there was a problem.</p>
                                                </perch:error>
                                                <div>
                                                    <perch:input type="select" options="<perch:shop id="shippings_list" />" class="selectpicker" id="shipping" required="true" placeholder="Please choose"  />
                                                    <perch:error for="shipping" type="required">Required</perch:error>
                                                    <perch:input type="submit" id="submit" value="OK!" class="button button-3d notopmargin fright"/>
                                                    <perch:input type="hidden" id="r" />
                                                </div>
                                            </td>
                                        </tr>
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <strong>Tax</strong>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount"><perch:shop id="total_tax_formatted" /></span>
                                            </td>
                                        </tr>
                                        <tr class="cart_item">
                                            <th colspan="5">
                                                <strong>Total</strong>
                                            </th>
                                            <td class="cart-product-name">
                                                <span class="amount color lead"><strong><perch:shop id="grand_total_formatted" /></strong></span>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
               </perch:form>   
            <perch:else />
                <div class="style-msg errormsg">
                    <div class="sb-msg"><i class="icon-remove"></i><strong>Oh snap!</strong> Your cart is empty.</div>
                </div>
            </perch:if>         
        </div>
    </div>
</section>                        

I have not altered the code on the page, so the code above for the page is still the same.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you using perch_shop_shipping_method_form() ?

That works if I add it to my page, but I want to have the shipping method options within my template. I'm not sure how to accomplish this? My first attempt was to use a template include, that didn't work.

Well, I found a workaround that I'm happy with. I added the perch_shop_shipping_method_form(), and changed the "method_form.html" template to just use it as a modal.

"method_form.html"

<div class="modal fade ShippingModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-body">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="myModalLabel">Shipping Options</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                </div>
                <div class="modal-body">
                    <perch:form id="shipping_method" method="post" app="perch_shop">
                        <perch:error for="all" type="login">
                            <p class="error">Sorry, there was a problem.</p>
                        </perch:error>

                        <div>
                            <perch:label for="shipping">Method</perch:label>
                            <perch:input type="select" options="<perch:shop id="shippings_list" />" id="shipping" required="true" placeholder="Please choose"  />
                            <perch:error for="shipping" type="required">Required</perch:error>
                        </div>
                        <div>
                            <perch:input type="submit" id="submit" value="OK!" />
                            <perch:input type="hidden" id="r" />
                        </div>
                    </perch:form>
                </div>
            </div>
        </div>
    </div>
</div>