Forum
Add to Cart
Hi,
I'm setting up Perch Shop and am having issues with the add to cart button. If the quantity is set to 1 on the product page the cart shows as empty but if it is any more than 1 it adds perfectly?
product debug
Debug Message - Perch 3.0.12
[37] SELECT DISTINCT settingID, settingValue FROM perch3_settings WHERE userID=0
[1] SELECT * FROM perch3_pages WHERE pagePath='/easyphp/jade/designer outdoor lighting 2018/product.php' LIMIT 1
[1] SELECT * FROM perch3_shop_cart WHERE cartID=66
------------------------------ setting loc from adr default ------------------------------
default
[1] SELECT * FROM perch3_shop_cart WHERE cartID=66
Using cart from cache.
[1] Using template: \templates\shop\cart\mini-cart.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='test-test')) 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
[nil] SELECT * FROM perch3_shop_products WHERE parentID IN ('1') AND productDeleted IS NULL
[1] Using template: \templates\shop\products\product.html
[1] SELECT * FROM perch3_shop_currencies WHERE currencyID=47 LIMIT 1
[1] SELECT * FROM perch3_shop_tax_groups WHERE groupID='1' AND groupDeleted IS NULL LIMIT 1
product template
<!-- breadcrumbs -->
<div class="breadcrumbs">
<div class="container">
<ol class="breadcrumb breadcrumb--ys pull-left">
<li class="home-link"><a href="index.php" class="icon icon-home"></a></li>
<li><a href="shop.php">Shop Online</a></li>
<li class="active"><perch:shop id="title" type="text" label="Title" required="true" order="2" /></li>
</ol>
</div>
</div>
<!-- CONTENT section -->
<div id="pageContent">
<section class="content offset-top-0">
<div class="container">
<div class="row product-info-outer">
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="row">
<div class="col-sm-6 col-md-6 col-lg-4 col-xl-4 hidden-xs">
<div class="product-main-image">
<div class="product-main-image__item"><img class="product-zoom" src='<perch:shop id="image" type="image" label="Main product image" order="4" width="533" />' data-zoom-image="<perch:shop id="image" type="image" label="Main product image" order="4" width="533" />" alt="" /></div>
<div class="product-main-image__zoom"></div>
</div>
<div class="product-images-carousel">
<ul id="smallGallery">
<li><a href="#" data-image="<perch:shop id="image" type="image" label="Main product image" order="4" width="553" />" data-zoom-image="<perch:shop id="image" type="image" label="Main product image" order="4" width="533" />"><img src="<perch:shop id="image" type="image" label="Main product image" order="4" width="533" />" alt="" /></a></li>
<li><a href="#" data-image="images/product/product-big-2.jpg" data-zoom-image="images/product/product-big-2-zoom.jpg"><img src="images/product/product-small-2.jpg" alt="" /></a></li>
<li><a href="#" data-image="images/product/product-big-3.jpg" data-zoom-image="images/product/product-big-3-zoom.jpg"><img src="images/product/product-small-3.jpg" alt="" /></a></li>
<li><a href="#" data-image="images/product/product-big-4.jpg" data-zoom-image="images/product/product-big-4-zoom.jpg"><img src="images/product/product-small-4.jpg" alt="" /></a></li>
<li><a href="#" data-image="images/product/product-big-5.jpg" data-zoom-image="images/product/product-big-5-zoom.jpg"><img src="images/product/product-small-5.jpg" alt="" /></a></li>
</ul>
</div>
</div>
<perch:shop id="image" type="image" width="270" height="335" density="1.6" crop="true" bucket="products" suppress="true"/>
<div class="product-info col-sm-6 col-md-6 col-lg-6 col-xl-6">
<div class="wrapper hidden-xs">
<div class="product-info__sku pull-left">SKU: <strong><perch:shop id="sku" type="text" label="SKU" required="true" order="1" /></strong></div>
<div class="product-info__availability pull-right">Availability: <strong class="color"><perch:shop id="stock_status" type="shop_stock_status" label="Stock status" required="true" /></strong></div>
</div>
<div class="product-info__title">
<h2><perch:shop id="title" type="text" label="Title" required="true" order="2" /></h2>
</div>
<div class="wrapper visible-xs">
<div class="product-info__sku pull-left">SKU: <strong><perch:shop id="sku" type="text" label="SKU" required="true" order="1" /></strong></div>
<div class="product-info__availability pull-right">Availability: <strong class="color"><perch:shop id="stock_status" type="shop_stock_status" label="Stock status" required="true" /></strong></div>
</div>
<div class="visible-xs">
<div class="clearfix"></div>
<ul id="mobileGallery">
<li><a href="#" data-image="<perch:shop id="image" type="image" label="Main product image" order="4" width="553" />" data-zoom-image="<perch:shop id="image" type="image" label="Main product image" order="4" width="533" />"><img src="<perch:shop id="image" type="image" label="Main product image" order="4" width="533" />" alt="" /></a></li>
<li><a href="#" data-image="images/product/product-big-2.jpg" data-zoom-image="images/product/product-big-2-zoom.jpg"><img src="images/product/product-small-2.jpg" alt="" /></a></li>
<li><a href="#" data-image="images/product/product-big-3.jpg" data-zoom-image="images/product/product-big-3-zoom.jpg"><img src="images/product/product-small-3.jpg" alt="" /></a></li>
<li><a href="#" data-image="images/product/product-big-4.jpg" data-zoom-image="images/product/product-big-4-zoom.jpg"><img src="images/product/product-small-4.jpg" alt="" /></a></li>
<li><a href="#" data-image="images/product/product-big-5.jpg" data-zoom-image="images/product/product-big-5-zoom.jpg"><img src="images/product/product-small-5.jpg" alt="" /></a></li>
</ul>
</div>
<div class="price-box product-info__price">
<perch:if id="trade_pricing" value="1">
<perch:shop id="trade_price" type="shop_currency_value" label="Trade Price" />
<perch:else />
<perch:shop id="price" type="shop_currency_value" label="Price" />
</perch:if>
</div>
<div class="divider divider--xs product-info__divider hidden-xs"></div>
<div class="product-info__description hidden-xs">
<div class="product-info__description__text"><perch:shop id="excerpt" type="textarea" label="Excerpt" editor="redactor" order="3" html="true" size="s" /></div>
</div>
<div class="divider divider--xs product-info__divider"></div>
<div class="wrapper">
<perch:form id="add_to_cart" app="perch_shop" action="cart.php">
<perch:if exists="has_variants">
<perch:productopts>
<h3><perch:productopt id="title" /></h3>
<perch:productvalues>
<perch:before><ul class="size-list"></perch:before>
<li class="value">
<perch:input id="options" class="form-control input-sm size-variants" name="opt-<perch:productvalue id="optionID" />[]"
value="<perch:productvalue id="valueID" />" type="radio" required="required" />
<perch:productvalue id="valueTitle" />
</li>
<perch:after></ul></perch:after>
</perch:productvalues>
</perch:productopts>
</perch:if>
<div class="pull-left"><span class="qty-label">QTY:</span></div>
<div class="pull-left">
<!-- -->
<div class="number input-counter">
<!-- -->
<perch:input id="qty" value="1" type="number" min="0" placeholder="1" class="form-control"/>
</div>
</div>
<perch:input id="product" type="hidden" env-autofill="false" value="<perch:shop id="productID" type="hidden" env-autofill="false" />" />
<perch:input type="submit" value="Add to cart" />
</perch:form>
</div>
<!-- Nav tabs -->
<ul class="nav nav-tabs nav-tabs--ys1" role="tablist">
<li class="active"><a href="#Tab1" role="tab" data-toggle="tab" class="text-uppercase">DESCRIPTION</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content tab-content--ys nav-stacked">
<div role="tabpanel" class="tab-pane active" id="Tab1">
<perch:shop id="description" type="textarea" label="Description" editor="redactor" order="3" html="true" size="s" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End CONTENT section -->
</div>
</section>
<perch:shop id="slug" type="slug" editable="true" indelible="true" label="Slug" for="title sku" order="10" divider-before="Meta data" />
<perch:shop id="status" type="shop_status" label="Status" />
<perch:categories id="category" set="products" label="Category">
<perch:category id="catTitle" />
</perch:categories>
<perch:shop id="stock_status" type="shop_stock_status" label="Stock status" divider-before="Stock" required="true" />
<perch:shop id="stock_level" type="number" label="Stock level" size="s" />
<perch:shop id="stock_location" type="shop_stock_location" label="Count stock" />
<perch:shop id="max_in_cart" type="number" label="Max quantity in cart" size="s" />
<perch:shop id="requires_shipping" type="shop_requires_shipping" label="Requires shipping" divider-before="Shipping" />
Any help much appreciated
Do you have a minimum quantity set on the product?
No I don't. I've set the stock level to 600, but I'm not sure where the minimum quantity is
If you turn debug on for your cart page and perform the two actions, how does the output differ?
Quantity set to 1 :
Quantity 2:
Is this the same site as your other issue?
Yes it is.
Ok, it might be best to address one issue at a time.