Forum
cart not updating variants
Hi,
i have added variants to the cart.html template. I find that it not setting the option initially (defaults to first radio being selected). And does not update when submitting the form with a different variant selected.
only the quantity is updated.
i'm using the same variant code from single.html
thanks in advance.
tony
<perch:input class="qty_update" type="submit" value="Update" aria-hidden="true" style="float:right;"/>
code added, do display variants
<div class="myItem_variants">
<perch:if exists="has_variants">
<perch:productopts>
<div class="span span1">
<h5><perch:productopt id="title" /></h5>
<perch:productvalues>
<perch:before><ul></perch:before>
<li>
<label>
<perch:input id="options" name="opt-<perch:productvalue id="optionID" />[]" value="<perch:productvalue id="valueID" />" type="radio" required="required" />
<perch:productvalue id="valueTitle" />
</label>
</li>
<perch:after></ul></perch:after>
</perch:productvalues>
</div>
</perch:productopts>
</div>
cart.html
<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" />
<perch:cartitems>
<div id="item_<perch:cartitem id="identifier" />" class="myCart_item">
<div class="myCart_wrap">
<perch:input id="" type="submit" value="Update" hidden="true" aria-hidden="true" />
<div class="myItem_image">
<perch:cartitem id="image" class="cartitem_image" type="image" height="375" crop="true" output="tag" />
</div>
<div class="myItem_title">
<h3><perch:cartitem id="title" /></h3>
<div class="myItem_brand">brand: <perch:cartitem id="brand" type="shop_brand" /></div>
<div class="myItem_sku">sku: <perch:cartitem id="sku" /></div>
<div class="myItem_var">options: <perch:cartitem id="variant_desc" /></div>
</div>
<div class="myItem_desc">
<div class="myItem_desc_text">
<h5 style="line-height:20px;"><perch:cartitem id="description" type="textarea" markdown="true" /></h5>
</div>
</div>
<div class="myItem_variants">
<perch:if exists="has_variants">
<perch:productopts>
<div class="span span1">
<h5><perch:productopt id="title" /></h5>
<perch:productvalues>
<perch:before><ul></perch:before>
<li>
<label>
<perch:input id="options" name="opt-<perch:productvalue id="optionID" />[]" value="<perch:productvalue id="valueID" />" type="radio" required="required" />
<perch:productvalue id="valueTitle" />
</label>
</li>
<perch:after></ul></perch:after>
</perch:productvalues>
</div>
</perch:productopts>
</div>
<div class="myItem_prices">
<table class="myItem_prices_table" style="float:left;width:100%;" border=0 >
<tr>
<td>Qty:</td>
<td>
<div id="cart_qty" style="float:left;">
<perch:input id="qty:<perch:cartitem id="identifier" />" value="<perch:cartitem id="quantity" />" type="number" min="0" />
</div>
<perch:input class="qty_update" type="submit" value="Update" aria-hidden="true" style="float:right;"/>
</td>
</tr>
<tr><td class="myItem_cartPrice">Price: </td><td><perch:cartitem id="price_without_tax_formatted" /></td></tr>
<tr><td class="myItem_cartTotal">Total: </td><td><perch:cartitem id="total_without_tax_formatted" /></td></tr>
<tr><td> </td><td> </td></tr>
<tr>
<td> </td>
<td>
<button type="submit" class="remove_cart" name="del:<perch:cartitem id="identifier" />" value="1" style="float:right;" onkeypress="return event.keyCode != 13;" >Remove</button>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="clearfix"></div>
</perch:cartitems>
</perch:form>
</perch:if>
Diagnostics report
Perch: 2.8.31, PHP: 5.5.35, MySQL: 5.5.49, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.31), assets (2.8.31), categories (2.8.31), perch_blog (5.0), perch_shop_orders (PERCH_SHOP_VERSION), perch_shop_products (1.0.8), perch_shop (1.0.8), perch_members (1.5)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_members', 'perch_shop', ); ?>
PERCH_LOGINPATH: /perch
PERCH_PATH: /nfs/c05/h06/mnt/78335/domains/shop.stylishlittleme.com/html/perch
PERCH_CORE: /nfs/c05/h06/mnt/78335/domains/shop.stylishlittleme.com/html/perch/core
PERCH_RESFILEPATH: /nfs/c05/h06/mnt/78335/domains/shop.stylishlittleme.com/html/perch/resources
Image manipulation: GD
PHP limits: Max upload 20M, Max POST 20M, Memory: 2048M, Total max file upload: 20M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: shop.stylishlittleme.com
DOCUMENT_ROOT: /home/78335/domains/shop.stylishlittleme.com/html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
If you're changing the product that's in the cart, that's not an update. You'll need to remove that product and add the new one.
ok,
So once a product has been added to the cart. the only thing that can be changed is the quantity. changing e.g.: size or colour. can not be done
is this correct?
tony
Different size or colour are different products, not the same product.