VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Ihateit on December 13, 2012, 12:38:04 PM

Title: Cart - Cant change quantity + Sprite gone
Post by: Ihateit on December 13, 2012, 12:38:04 PM
Hey forum,

i have implemented a new custom cart template, but now i cant change the quantity of the product, or remove it. The quantity is just set to the number of products, not inside a "editing" box or anything. How to i add these features again? So i am able to edit quantity and remove the product from the cart.

//Anders J.
Title: Re: Cart - Cant change quantity + Sprite gone
Post by: Jumbo! on December 13, 2012, 12:59:07 PM
Probably you are using some ajax script to update the quantity and it is creating Javascript errors.

Please check the Error Console of your browser. Your Firebug tools in Firefox to locate the error.
Title: Re: Cart - Cant change quantity + Sprite gone
Post by: Ihateit on December 13, 2012, 14:02:17 PM
Thanks for the answer :-)

Im not a regular FireFox user, and i cant find any ajax errors in the console of Firebug :/

Couldnt find any ajax erros in Google Chrome developer tool either though

//Anders J.
Title: Re: Cart - Cant change quantity + Sprite gone
Post by: Ihateit on December 13, 2012, 14:12:48 PM
This is the html/php from the cart/default.php file:

<div class="quantity">
<div class="spacer">
<?php // We Are in The Last Step
if ($cart->mws_cart) { ?>

<form action="<?php echo JRoute::_('index.php'); ?>" method="post" class="inline">
<input type="hidden" name="option" value="com_virtuemart" />
<input type="text" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" class="quantity" size="3" maxlength="4" name="quantity" value="<?php echo $prow->quantity ?>" />
<?php } else { ?>
<input type="text" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" class="quantity-confirm" size="3" maxlength="4" name="quantity" value="<?php echo $prow->quantity ?>" disabled="disabled" />
<?php ?>
<?php // We Are in The Last Step
if ($cart->mws_cart) { ?>

<input type="hidden" name="view" value="cart" />
<input type="hidden" name="task" value="update" />
<input type="hidden" name="cart_virtuemart_product_id" value="<?php echo $prow->cart_item_id  ?>" />
<input type="submit" class="refresh-icon" name="update" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" align="middle" value=" "/>
</form>
<?php ?>
</div>
</div>

And this is the only thing that is shown on the site using developer tool from chrome:

http://ajytzler.dk/pics/vmquantityerror.png (http://ajytzler.dk/pics/vmquantityerror.png)

Dont know if that helps
Title: Re: Cart - Cant change quantity + Sprite gone
Post by: Ihateit on December 13, 2012, 15:07:32 PM
I found out!

The form was setup completely wrong. So i made a few adjustments and included everything inside the if, else and second if statements:

<form action="<?php echo JRoute::_('index.php'); ?>" method="post" class="inline">
<input type="hidden" name="option" value="com_virtuemart" />
<input type="text" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" class="quantity" size="3" maxlength="4" name="quantity" value="<?php echo $prow->quantity ?>" />
                                <input type="hidden" name="view" value="cart" />
<input type="hidden" name="task" value="update" />
<input type="hidden" name="cart_virtuemart_product_id" value="<?php echo $prow->cart_item_id  ?>" />
<input type="submit" class="refresh-icon" name="update" title="<?php echo  JText::_('COM_VIRTUEMART_CART_UPDATE'?>" align="middle" value=" "/>
                                </form>