Forum

Thread tagged as: Problem, Shop

Perch Shop Sale – Price added to cart is Zero

Hi

I have a situation where I have enabled a sale promotion period in a shop.

Products have variants, some of which have sale prices set.

I am not using the use sale price checkbox.

So in theory only those products with sale prices should carry a sale price through to the cart – which they are successfully.

All other products, that don't have anything entered into the sale price, are displaying as their full price.

However when you add them to the cart, they show a price of 0. Which isn't ideal as you can imagine.

Help me Obi-Wan Kenobi!

Product detail template

<section class="l-product-content g-vertical-spacer">

    <article class="l-main-content t-serif g-flex-row g-flex-row-reverse">

        <div class="l-product-details g-col-two">                       
            <div class="l-main-copy t-big g-vertical-spacer">

                <header>

                <h1 class="h2"><perch:shop id="title" type="text" label="Title" /></h1>

                <p class="t-small">By <a href="/shop/<perch:shop id="brand" type="shop_brand" output="slug" />"><perch:shop id="brand" type="shop_brand" /></a></p>
                </header>

                <div class="l-product-categories">
                <perch:shop id="description" type="textarea" size="m" />

                <perch:if id="stock_status" match="gt" value="0"/>
                    <perch:if id="stock_level" match="gt" value="0"><p><strong><perch:shop id="stock_level"/> remaining.</strong></p>
                    </perch:if>
                </perch:if>
                </div>
                <div class="l-product-categories"><perch:categories id="category" set="media" label="Category">
<perch:category id="desc" type="textarea" editor="markitup" markdown="true" />
</perch:categories></div>

            </div>      

                <perch:if exists="stock_level"/>
                    <perch:if id="stock_level" match="eq" value="0">
                        <div class="l-variant">
                                <p><strong>Sold out</strong></p>
                        </div>  
                    <perch:else/>

                    <perch:template path="shop/products/variant_detail.html"/>  

                    </perch:if>

                <perch:else/>

                    <perch:if exists="has_variants">

                            <perch:template path="shop/products/variant_detail.html"/>

                    </perch:if> 

                </perch:if>                     

            <div class="l-product-extras">
                <p><a href="/delivery-returns/">Delivery information</a></p>
            </div>

        </div>
        <aside class="l-product-gallery g-col-four g-aside-left">
            <div class="l-hero-image l-image-border">
                <perch:if exists="limited"><div class="l-product-badge l-product-limited">
                <div class="l-product-badge-copy t-tiny">Limited Edition</div></div>
                </perch:if>
                <perch:if exists="special">
                <div class="l-product-badge l-product-special">
                <div class="l-product-badge-copy t-tiny">Special Offer</div></div>
                </perch:if>
                <perch:variants>
                <perch:if exists="sale_price">
                <div class="l-product-badge l-product-sale">
                <div class="l-product-badge-copy t-tiny">On Sale</div>
                </div>
                </perch:if> 
                </perch:variants>       


                <img srcset="<perch:shop id="image" type="image" width="560" density="2" bucket="products"/> 2x" src="<perch:shop id="image" type="image" width="560" density="1" bucket="products"/>" alt="<perch:shop id="image_alt" type="text" label="Image alt" />"><perch:shop id="image" type="image" width="560" density="2" bucket="products">
            </div>
            <div class="l-product-thumbnails">
                <perch:repeater id="image_detail_repeater" label="Image details" max="2">
                    <div class="l-product-thumbnail">
                        <img srcset="<perch:shop id="image_detail" type="image" width="272" density="2" bucket="products"/> 2x" src="<perch:shop id="image_detail" type="image" width="272" density="1" bucket="products"/>" alt="<perch:shop id="image_detail_alt" type="text" label="Image detail alt"/>">
                    </div>
                </perch:repeater>
            </div>
        </aside>
    </article>
</section>
<perch:showall/>

Variant detail template

<div class="l-variants">
    <perch:variants>
    <div class="l-variant">
        <dl>
            <dt><perch:variant id="productVariantDesc" type="text" /></dt>
            <perch:if exists="sale_price">
            <dd>ON SALE! <span class="t-strikethrough"><perch:variant id="price" type="shop_currency_value" /></span> <perch:variant id="sale_price" type="shop_currency_value" label="Sale price"/></dd>
            <perch:else/>
            <dd><perch:variant id="price" type="shop_currency_value" /></dd>
            </perch:if>
        </dl>
        <perch:form id="add_to_cart" app="perch_shop" action="/shop/basket" class="l-add-to-cart-form t-sans">
             <perch:input id="product" type="hidden" value="<perch:variant id="productID" type="hidden" env-autofill="false" />" />
              <perch:input type="submit" value="Add to cart" class="l-btn l-btn-small"/>    
        </perch:form>
    </div>
    </perch:variants>
</div>

Cart template

<section class="l-boilerplate g-vertical-spacer">
    <h1>Your basket</h1>
    <perch:if id="product_count" match="lte" value="0" />
    <h2>is empty.</h2>
    <p><a href="/shop">Return to the shop</a></p>
    </perch:if>
</section><!-- section -->  

<perch:if id="product_count" match="gt" value="0">

<section class="l-cart g-vertical-spacer">

    <perch:form id="cart" app="perch_shop">


        <button type="submit" value="Update" class="l-btn-hidden"></button>


        <div class="g-grid g-grid-cart-heading">
            <div>Title</div>
            <div>Details</div>
            <div>Quantity</div>
            <div class="g-item-center">Price</div>
            <div class="g-item-center">Total</div>
        </div>
        <perch:cartitems>

        <div class="g-grid g-grid-cart t-serif">
            <div class="c-image"><img srcset="<perch:cartitem id="image" type="image" width="128" density="2" bucket="products"/> 2x" src="<perch:cartitem id="image" type="image" width="128" density="1" bucket="products"/>" alt="<perch:cartitem id="image_alt" type="text"  />"></div>
            <div class="c-title"><perch:cartitem id="title" /></div>
            <div class="c-details"><perch:if exists="variant_desc"><perch:cartitem id="variant_desc" /><perch:else/><perch:cartitem id="description" type="textarea" markdown="true" /></perch:if></div>
            <div class="c-q"><perch:input id="qty:<perch:cartitem id="identifier" />" value="<perch:cartitem id="quantity" />" type="number" min="0" class="l-form-input"/><perch:input value="Update" type="submit" class="l-btn l-btn-small"/></div>
            <div class="c-price g-item-center"><perch:cartitem id="price_with_tax_formatted" /></div>
            <div class="c-total g-item-center"><perch:cartitem id="total_with_tax_formatted" /></div>
            <div class="t-sans t-small c-btn g-item-center"><button type="submit" class="l-btn l-btn-small l-btn-del" name="del:<perch:cartitem id="identifier" />" value="1" >Remove</button></div>
        </div>
        </perch:cartitems>

        <perch:if id="total_discounts" match="gt" value="0.00">
        <div class="g-grid g-grid-calc">    
            <div class="g-item-center">
                Voucher applied (<perch:shop id="discount_code" />)
            </div>
            <div class="g-item-center">
                -<perch:shop id="total_discounts_with_tax_formatted" />
            </div>
        </div>
        </perch:if>

        <div class="g-grid g-grid-calc">    
            <div class="g-item-center">
            Total<br>
            <span class="t-tiny t-serif">Excluding delivery</span>
            </div>
            <div class="g-item-center">
                <perch:shop id="total_items_discounted_with_tax_formatted" />
            </div>
        </div>

        <div class="g-grid g-grid-calc c-voucher">          
                <div class="c-voucher-label g-item-right">
                        <perch:label for="discount_code">Do you have a voucher code?</perch:label>
                </div>
                <div class="c-voucher-input">
                            <perch:input id="discount_code" type="text" placeholder="Enter code here" class="l-form-input"/>
                </div>
                <div class="c-voucher-btn t-sans t-small tb-btn"><perch:input value="Update" type="submit" class="l-btn l-btn-small"/></div>    
        </div>
        <div class="g-grid g-grid-calc">
            <div class="c-continue"><a href="/shop/" class="l-btn l-btn-small">Continue shopping</a></div>
        </div>
        <div class="g-grid g-grid-calc">
            <div class="c-checkout"><a href="/shop/delivery" class="l-btn l-btn-large">Checkout</a></div>
        </div>

    </perch:form>
</section>
</perch:if>
Perch Runway: 3.0.11, PHP: 7.0.1, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 7e72f9690b1498a1bead7a637c33a831c0d2f655 $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.11), assets (3.0.11), categories (3.0.11), perch_forms (1.9.1), perch_shop_orders (1.2.5), perch_shop_products (1.2.5), perch_shop (1.2.5), perch_members (1.6.2), perch_mailchimp (3.1)
App runtimes: <?php $apps_list = [ 'perch_mailchimp', 'perch_members', 'perch_shop', 'perch_forms', ];
PERCH_LOGINPATH: /perch
PERCH_PATH: /var/sites/e/ellipress.co.uk/public_html/perch
PERCH_CORE: /var/sites/e/ellipress.co.uk/public_html/perch/core
PERCH_RESFILEPATH: /var/sites/e/ellipress.co.uk/public_html/perch/resources
Image manipulation: GD
PHP limits: Max upload 100M, Max POST 100M, Memory: 128M, Total max file upload: 100M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
DOCUMENT_ROOT: /var/sites/e/ellipress.co.uk/public_html
HTTP_HOST: ellipress.co.uk
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Jonathan Elliman

Jonathan Elliman 27 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me the debug when that happens?

Sure, here you go:

Debug from product page

Debug Message - Perch Runway 3.0.11
[31] SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate, pr.routeOrder, s.settingValue AS siteOffline FROM perch3_pages p LEFT JOIN perch3_page_routes pr ON p.pageID=pr.pageID LEFT JOIN perch3_settings s ON s.settingID='siteOffline' UNION SELECT NULL AS pagePath, pr2.routePattern, pr2.routeRegExp, pr2.templatePath AS pageTemplate, pr2.routeOrder, NULL AS siteOffline FROM perch3_page_routes pr2 WHERE templateID!=0 ORDER BY routeOrder ASC, pagePath ASC
Matched route: shop/[slug:brand]/[slug:product]
Using master page: /templates/pages/shop/product.php
Page arguments:
Array
(
    [0] => /shop/tnb/karnak-tnb-002
    [brand] => tnb
    [1] => tnb
    [product] => karnak-tnb-002
    [2] => karnak-tnb-002
)
[1] SELECT * FROM perch3_pages WHERE pagePath='/shop/brand/product' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=10942
[1] SELECT * FROM perch3_shop_cart WHERE cartID=10942
[1] SELECT * FROM perch3_shop_sales WHERE saleFrom<='2017-11-23 09:39:00' AND saleTo>'2017-11-23 09:39:00' AND saleActive=1 AND saleDeleted IS NULL ORDER BY saleOrder ASC
UPDATE perch3_shop_cart SET cartPricing='sale' WHERE cartID='10942'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch3_shop_cart WHERE cartID=10942
[1] SELECT * FROM perch3_shop_cart WHERE cartID=10942
[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=47 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch3_shop_cart_items WHERE cartID=10942
[44] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
Tax mode: inc
[nil] SELECT * FROM perch3_shop_cart_items WHERE cartID=10942 ORDER BY itemID ASC
UPDATE perch3_shop_cart SET cartTotalItems=NULL, cartTotalProducts='0', cartTotalWithTax='0.00', cartTotalWithoutTax='0.00' WHERE cartID='10942'
[4] SELECT DISTINCT idx.itemID FROM perch3_shop_index idx JOIN perch3_shop_brands main ON idx.itemID=main.brandID AND idx.itemKey='brandID' AND ((idx.indexKey='status' AND idx.indexValue='1')) GROUP BY idx.itemID HAVING COUNT(idx.itemID)=1
[1] SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_shop_index idx JOIN perch3_shop_brands main ON idx.itemID=main.brandID AND idx.itemKey='brandID' JOIN perch3_shop_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='brandID' AND idx2.indexKey='_id' AND idx.itemID IN ('1', '2', '3', '4') WHERE 1=1 AND ((idx.indexKey='slug' AND idx.indexValue='tnb')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, brandID ) as tbl WHERE (brandDeleted IS NULL) GROUP BY itemID, sortval ORDER BY sortval ASC
Using template: /templates/shop/brands/brand.html
[1] SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_shop_index idx JOIN perch3_shop_products main ON idx.itemID=main.productID AND idx.itemKey='productID' JOIN perch3_shop_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='productID' AND idx2.indexKey='_id' WHERE 1=1 AND ((idx.indexKey='slug' AND idx.indexValue='karnak-tnb-002')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, productID ) as tbl WHERE (productDeleted IS NULL AND productStatus=1 AND parentID IS NULL) GROUP BY itemID, sortval ORDER BY sortval ASC
Using template: /templates/shop/products/product.html
[1] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=19 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=19 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[12] 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
[1] 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='19' 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
[5] SELECT catID, catPath FROM perch3_categories
Using template: /templates/pages/attributes/body_attributes.html
Using template: /templates/pages/attributes/seo.html
[3] SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/shop/brand/product' OR regionPage='*' ORDER BY regionPage DESC
[1] SELECT groupID FROM perch3_navigation WHERE groupSlug='main-navigation' LIMIT 1
[4] SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch3_navigation_pages np, perch3_pages p WHERE p.pageID=np.pageID AND np.groupID=6 AND p.pageNew=0 ORDER BY np.pageTreePosition ASC
[0] SELECT np.pageTreePosition FROM perch3_pages p, perch3_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=6 AND p.pagePath='/shop/brand/product' LIMIT 1
[4] Using template: /templates/navigation/menu_item.html
Using template: /templates/search/search-form.html
[1] SELECT pageTreePosition FROM perch3_pages WHERE pagePath='/shop/brand/product' OR pageSortPath='/shop/brand/product' LIMIT 1
[1] SELECT * FROM perch3_pages WHERE pageHidden=0 AND pageNew=0 AND pageTreePosition IN ('000-004-001-001', '000-004-001', '000-004', '000') ORDER BY pageTreePosition
[1] Using template: /templates/navigation/breadcrumb.html
[1] SELECT tbl.* FROM ( SELECT idx.itemID, main.*, idx2.indexValue as sortval FROM perch3_shop_index idx JOIN perch3_shop_products main ON idx.itemID=main.productID AND idx.itemKey='productID' JOIN perch3_shop_index idx2 ON idx.itemID=idx2.itemID AND idx.itemKey='productID' AND idx2.indexKey='_id' WHERE 1=1 AND ((idx.indexKey='slug' AND idx.indexValue='karnak-tnb-002')) AND idx.itemID=idx2.itemID AND idx.itemKey=idx2.itemKey GROUP BY idx.itemID, idx2.indexValue, productID ) as tbl WHERE (productDeleted IS NULL AND productStatus=1 AND parentID IS NULL) GROUP BY itemID, sortval ORDER BY sortval ASC
[1] SELECT * FROM perch3_shop_products WHERE parentID IN ('19') AND productDeleted IS NULL
[1] Using template: /templates/shop/products/product_detail.html
Using sub-template: /templates/shop/products/variant_detail.html
Using sub-template: /templates/shop/products/variant_detail.html
[1] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=19 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=19 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[12] 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
[1] 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='19' 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
[1] SELECT * FROM perch3_shop_products WHERE productID=19 AND productDeleted IS NULL LIMIT 1
[1] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=19 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=19 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[12] 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
[1] 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='19' 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
[1] SELECT * FROM perch3_shop_currencies WHERE currencyID=47 LIMIT 1
[1] SELECT * FROM perch3_shop_products WHERE productID=19 AND productDeleted IS NULL LIMIT 1
[1] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=19 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=19 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[12] 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
[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='19' 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
[1] SELECT * FROM perch3_categories ORDER BY catTreePosition ASC
[1] SELECT * FROM perch3_shop_brands WHERE brandID='2' AND brandDeleted IS NULL LIMIT 1
Looking up missing property slug
[1] SELECT * FROM perch3_shop_brands WHERE brandID='2' AND brandDeleted IS NULL LIMIT 1
[1] SELECT groupID FROM perch3_navigation WHERE groupSlug='secondary-navigation' LIMIT 1
[4] SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch3_navigation_pages np, perch3_pages p WHERE p.pageID=np.pageID AND np.groupID=2 AND p.pageNew=0 ORDER BY np.pageTreePosition ASC
[0] SELECT np.pageTreePosition FROM perch3_pages p, perch3_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=2 AND p.pagePath='/shop/brand/product' LIMIT 1
[4] Using template: /templates/navigation/menu_item.html
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch3_content_regions WHERE regionKey='ep_social' AND (regionPage LIKE '%' OR regionPage='*')
[1] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch3_content_index idx JOIN perch3_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch3_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=9 AND idx.itemRev=7)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval, regionID ORDER BY sortval ASC
[4] Using template: /templates/content//blocks/social_block.html
Request time: 0.0871
Process time: 0.086
Memory: 4.8758

Debug from cart page

Debug Message - Perch Runway 3.0.11
[31] SELECT p.pagePath, pr.routePattern, pr.routeRegExp, p.pageTemplate, pr.routeOrder, s.settingValue AS siteOffline FROM perch3_pages p LEFT JOIN perch3_page_routes pr ON p.pageID=pr.pageID LEFT JOIN perch3_settings s ON s.settingID='siteOffline' UNION SELECT NULL AS pagePath, pr2.routePattern, pr2.routeRegExp, pr2.templatePath AS pageTemplate, pr2.routeOrder, NULL AS siteOffline FROM perch3_page_routes pr2 WHERE templateID!=0 ORDER BY routeOrder ASC, pagePath ASC
Matched page: /shop/basket, so not using routes.
Using master page: /templates/pages/shop/basket.php
[1] SELECT * FROM perch3_pages WHERE pagePath='/shop/basket' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=10942
[1] SELECT * FROM perch3_shop_cart WHERE cartID=10942
[1] SELECT * FROM perch3_shop_sales WHERE saleFrom<='2017-11-23 09:41:00' AND saleTo>'2017-11-23 09:41:00' AND saleActive=1 AND saleDeleted IS NULL ORDER BY saleOrder ASC
UPDATE perch3_shop_cart SET cartPricing='sale' WHERE cartID='10942'
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch3_shop_cart WHERE cartID=10942
[1] SELECT * FROM perch3_shop_cart WHERE cartID=10942
[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=47 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch3_shop_cart_items WHERE cartID=10942
[44] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
Tax mode: inc
[nil] SELECT * FROM perch3_shop_cart_items WHERE cartID=10942 ORDER BY itemID ASC
UPDATE perch3_shop_cart SET cartTotalItems=NULL, cartTotalProducts='0', cartTotalWithTax='0.00', cartTotalWithoutTax='0.00' WHERE cartID='10942'
Using sub-template: /templates/shop/products/variant_detail.html
Using sub-template: /templates/shop/products/variant_detail.html
[1] SELECT itemID, itemQty FROM perch3_shop_cart_items WHERE cartID=10942 AND productID=20
[1] SELECT * FROM perch3_shop_products WHERE productID=20 AND productDeleted IS NULL LIMIT 1
INSERT INTO perch3_shop_cart_items(productID,itemQty,cartID) VALUES('20',1,'10942')
------------------------------ Calculating cart ------------------------------
[1] SELECT * FROM perch3_shop_cart WHERE cartID=10942
[1] SELECT * FROM perch3_shop_cart WHERE cartID=10942
[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=47 LIMIT 1
[1] SELECT COUNT(productID) AS product_count, SUM(itemQty) AS item_count FROM perch3_shop_cart_items WHERE cartID=10942
Tax mode: inc
[1] SELECT * FROM perch3_shop_cart_items WHERE cartID=10942 ORDER BY itemID ASC
[1] SELECT * FROM perch3_shop_products WHERE productID=20 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=19 AND productDeleted IS NULL LIMIT 1
[1] SELECT * FROM perch3_shop_products WHERE productID=19 AND productDeleted IS NULL LIMIT 1
[1] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=19 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=19 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[12] 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
[1] 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='19' 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
[1] SELECT * FROM perch3_shop_products WHERE productID=19 AND productDeleted IS NULL LIMIT 1
[1] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=19 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=19 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[12] 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
[1] 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='19' 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
[1] SELECT * FROM perch3_shop_products WHERE productID=19 AND productDeleted IS NULL LIMIT 1
[1] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=19 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=19 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[12] 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
[1] 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='19' 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
[1] SELECT * FROM perch3_shop_products WHERE productID=19 AND productDeleted IS NULL LIMIT 1
[1] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=19 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=19 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[12] 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
[1] 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='19' 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
[1] SELECT * FROM perch3_shop_products WHERE productID=19 AND productDeleted IS NULL LIMIT 1
[1] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=19 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=19 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[12] 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
[1] 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='19' 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
[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=236 OR zoneIsDefault=1) ORDER BY zoneIsDefault ASC LIMIT 1
[4] 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)
[37] SELECT rateID AS id, rateTitle AS title, rateValue AS rate, locationID FROM perch3_shop_tax_rates WHERE rateDeleted IS NULL ORDER BY rateValue DESC
[3] SELECT * FROM perch3_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2, 5, 6)
[3] SELECT * FROM perch3_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (2, 5, 6)
[1] SELECT * FROM perch3_shop_shipping_zones WHERE zoneDeleted IS NULL AND zoneActive=1 AND zoneID IN (1)
Qualifying shipping method ‘Second Class Delivery (FREE!)’
Rejecting shipping method ‘International Standard Delivery’ because: no price available for chosen shipping zone
Rejecting shipping method ‘International Tracked & Signed Delivery’ because: no price available for chosen shipping zone
Qualifying shipping method ‘First Class Tracked & Signed Delivery’
[1] SELECT * FROM perch3_shop_shippings WHERE shippingID='1' AND shippingDeleted IS NULL LIMIT 1
Using shipping zone: United Kingdom mainland
[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
[3] SELECT * FROM perch3_shop_promotions WHERE promoFrom<='2017-11-23 09:41:00' AND promoTo>'2017-11-23 09:41:00' AND promoActive=1 AND promoDeleted IS NULL ORDER BY promoOrder ASC
Promo (Mailing List 10%) skipped: discount code not applied.
Promo (Customer service 20%) skipped: discount code not applied.
Promo (Customer service 25%) skipped: discount code not applied.
UPDATE perch3_shop_cart SET cartTotalItems='1', cartTotalProducts='1', cartTotalWithTax='0.00', cartTotalWithoutTax='0.00' WHERE cartID='10942'
INSERT INTO perch3_shop_cart_data(cartID,productID,cartData) VALUES('10942','20','{\"product\":\"20\"}')
Using template: /templates/pages/attributes/body_attributes.html
Using template: /templates/pages/attributes/seo.html
[3] SELECT regionKey, regionHTML FROM perch3_content_regions WHERE regionPage='/shop/basket' OR regionPage='*' ORDER BY regionPage DESC
[1] SELECT groupID FROM perch3_navigation WHERE groupSlug='main-navigation' LIMIT 1
[4] SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch3_navigation_pages np, perch3_pages p WHERE p.pageID=np.pageID AND np.groupID=6 AND p.pageNew=0 ORDER BY np.pageTreePosition ASC
[0] SELECT np.pageTreePosition FROM perch3_pages p, perch3_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=6 AND p.pagePath='/shop/basket' LIMIT 1
[4] Using template: /templates/navigation/menu_item.html
Using template: /templates/search/search-form.html
[1] SELECT pageTreePosition FROM perch3_pages WHERE pagePath='/shop/basket' OR pageSortPath='/shop/basket' LIMIT 1
[2] SELECT * FROM perch3_pages WHERE pageHidden=0 AND pageNew=0 AND pageTreePosition IN ('000-004-002', '000-004', '000') ORDER BY pageTreePosition
[2] Using template: /templates/navigation/breadcrumb.html
Using cart from cache.
[1] SELECT * FROM perch3_shop_products WHERE productID=19 AND productDeleted IS NULL LIMIT 1
[1] SELECT productID, productVariantDesc, stock_level FROM perch3_shop_products WHERE parentID=19 AND productDeleted IS NULL ORDER BY productOrder ASC
[1] SELECT o.* FROM perch3_shop_options o, perch3_shop_product_options po WHERE o.optionID=po.optionID AND po.productID=19 AND o.optionDeleted IS NULL ORDER BY optionPrecendence ASC
[12] 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
[1] 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='19' 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
[1] Using template: /templates/shop/cart/cart.html
[1] SELECT groupID FROM perch3_navigation WHERE groupSlug='secondary-navigation' LIMIT 1
[4] SELECT np.pageID, np.pageParentID, p.pagePath, p.pageTitle, p.pageNavText, p.pageNew, p.pageOrder, np.pageDepth, p.pageSortPath, np.pageTreePosition, p.pageAccessTags, p.pageAttributes FROM perch3_navigation_pages np, perch3_pages p WHERE p.pageID=np.pageID AND np.groupID=2 AND p.pageNew=0 ORDER BY np.pageTreePosition ASC
[0] SELECT np.pageTreePosition FROM perch3_pages p, perch3_navigation_pages np WHERE np.pageID=p.pageID AND np.groupID=2 AND p.pagePath='/shop/basket' LIMIT 1
[4] Using template: /templates/navigation/menu_item.html
[1] SELECT regionID, regionTemplate, regionPage, regionRev AS rev FROM perch3_content_regions WHERE regionKey='ep_social' AND (regionPage LIKE '%' OR regionPage='*')
[1] SELECT * FROM ( SELECT idx.itemID, c.regionID, idx.pageID, c.itemJSON, idx2.indexValue as sortval FROM perch3_content_index idx JOIN perch3_content_items c ON idx.itemID=c.itemID AND idx.itemRev=c.itemRev AND idx.regionID=c.regionID JOIN perch3_content_index idx2 ON idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev AND idx2.indexKey='_order' WHERE ((idx.regionID=9 AND idx.itemRev=7)) AND idx.itemID=idx2.itemID AND idx.itemRev=idx2.itemRev ) as tbl GROUP BY itemID, pageID, itemJSON, sortval, regionID ORDER BY sortval ASC
[4] Using template: /templates/content//blocks/social_block.html
Request time: 0.0924
Process time: 0.0912
Memory: 4.9787
Drew McLellan

Drew McLellan 2638 points
Perch Support

Which discount code are you applying?

I've been playing around with it offline and the cart also seems to change behaviour between browsers.

If I disable the promotional sale period, and even delete it, then I get even more weird behaviour:

In Safari the full price remains 0 in the cart even though it's set to a number. If I add a sale price to a variant then the sale price appears in the cart. Even though there is no sale and there is a full price set in the variant.

Testing the same product in Firefox and Chrome and the full price appears in the cart.

If I regenerate the variants then I get a Fatal Error:

Fatal error: Uncaught Error: Call to a member function get_prices() on boolean in /Users/ellimondo/Dropbox/Sites/ellipress/dev.ellipress.co.uk/perch/addons/apps/perch_shop/lib/PerchShop_Cart.class.php:723 Stack trace: #0 /Users/ellimondo/Dropbox/Sites/ellipress/dev.ellipress.co.uk/perch/addons/apps/perch_shop/lib/PerchShop_Cart.class.php(244): PerchShop_Cart->calculate_cart() #1 /Users/ellimondo/Dropbox/Sites/ellipress/dev.ellipress.co.uk/perch/addons/apps/perch_shop/lib/PerchShop_Cart.class.php(123): PerchShop_Cart->recalculate_summary_data() #2 /Users/ellimondo/Dropbox/Sites/ellipress/dev.ellipress.co.uk/perch/addons/apps/perch_shop/lib/PerchShop_Runtime.class.php(205): PerchShop_Cart->add_to_cart('114', 1) #3 /Users/ellimondo/Dropbox/Sites/ellipress/dev.ellipress.co.uk/perch/addons/apps/perch_shop/runtime/forms.php(31): PerchShop_Runtime->add_to_cart_from_form(Object(PerchAPI_SubmittedForm)) #4 /Users/ellimondo/Dropbox/Sites/ellipress/dev.ellipress.co.uk/perch/core/lib/Perch.class.php(131): perch_shop_form_handler(Obje in /Users/ellimondo/Dropbox/Sites/ellipress/dev.ellipress.co.uk/perch/addons/apps/perch_shop/lib/PerchShop_Cart.class.php on line 723
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you deleting things that are already in a cart?

Very probably! Ignore the fatal error bit.

There's no discount code. It's just a sales promotion period of time. I assume that triggers any sales prices set on products and their variants?

So it seems that as soon as you set up a sales promotion period, any product variants are forced to take their price from the variant's sale price even if this isn't set. Any conditionals in the variant are ignored – the sale price is always taken by the cart, even if that is null.

The biggest problem I have here is that there's no way (as far as my pickled walnut of a brain can tell) to let non-sale products ignore this state because the sales promotion switch (sale_price or regular_price) is set at the product level not the variant. So full price products sell for 0 as I found out today with a live site, even though they display their full price in the product page.

Drew McLellan

Drew McLellan 2638 points
Perch Support

How is your promotion configured?

Hi Drew

This is how I set it up initially:

Sales promotion date range set and activated

Products have regular price and sales price set at the variant level.

Products not in sale do not have sales price set.