VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: TAIWAR on June 14, 2014, 01:52:56 AM

Title: Add to cart on list category
Post by: TAIWAR on June 14, 2014, 01:52:56 AM
I try to find an extension or code for VM266 for a button add to cart on list of category, a quick add to cart try this but not work:
http://extensions.joomla.fr/afficher-les-categories/e-commerce/1547-e-Commerce/4728-bouton-panier-champs-page-categories-virtuemart-2
and this : http://www.gjcwebdesign.com/joomla-virtuemart-tips/767-virtuemart-2-add-to-cart-button-on-category-page.html  but not work too...
Any suggest ?
Title: Re: Add to cart on list category
Post by: GJC Web Design on June 14, 2014, 17:03:09 PM
there is awhole tread on here about this!

But here is the code I used yesterday on a category template vm2.6.6 - no quantity box



<form method="post" class="product" action="index.php" id="addtocartproduct<?php echo $product->virtuemart_product_id ?>">
<div class="addtocart-bar">
<?php // Display the quantity box ?>

<span class="quantity-box">
<input style="display:none;" type="text" class="quantity-input" name="quantity[]" value="1" />
</span>

<?php // Display the quantity box END ?>

<?php // Add the button
$button_lbl JText::_('COM_VIRTUEMART_CART_ADD_TO');
$button_cls ''//$button_cls = 'addtocart_button';
if (VmConfig::get('check_stock') == '1' && !$this->product->product_in_stock) {
$button_lbl JText::_('COM_VIRTUEMART_CART_NOTIFY');
$button_cls 'notify-button';
?>


<?php // Display the add to cart button ?>
<span class="addtocart-button">
<input type="submit" name="addtocart"  class="addtocart-button" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
</span>

<div class="clear"></div>
</div>

<?php // Display the add to cart button END ?>
<input type="hidden" class="pname" value="<?php echo $product->product_name ?>">
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<noscript><input type="hidden" name="task" value="add" /></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
<?php /** @todo Handle the manufacturer view */ ?>
<input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
</form>


Title: Re: Add to cart on list category
Post by: AH on June 14, 2014, 17:33:36 PM
Ok so why is this proving so difficult

You do not need a plugin to achieve

http://forum.virtuemart.net/index.php?topic=90961.165 (http://forum.virtuemart.net/index.php?topic=90961.165)

See post 168

The to hide the quantity buttons just apply some CSS to them

.browse span.quantity-controls {
  display: none;
}
Title: Re: Add to cart on list category
Post by: TAIWAR on June 15, 2014, 02:31:24 AM
Thank you
to GJC Web Design : after wich code or line I have to insert  your code ;
to Hutson: I need to display the quantity

So in tje list I can quick add tp cart with quantity box.
Title: Re: Add to cart on list category
Post by: AH on June 15, 2014, 02:38:04 AM
?

My solution still displays the quantity!
It just hides the + and - image controls

You can still input a qty if required more than 1
Title: Re: Add to cart on list category
Post by: GJC Web Design on June 15, 2014, 10:55:48 AM
You insert it where ever you want it to appear - just try it...
Title: Re: Add to cart on list category
Post by: TAIWAR on June 15, 2014, 21:08:27 PM
Thank you vrey much ! ;)