« See all FAQs for LCShopping - Responsive VirtueMart Template
Option for choosing Cart Attribute directly from category and Virtuemart Product module layout.
Here is such a form is given to the attributes and quantity
<?php if (!VmConfig::get('use_as_catalog')) {?>
<div class="addtocart-area">
<?php if ($product->product_in_stock < 1) { ?>
<a class="addtocart-button" href="<?php echo JRoute::_('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id='.$product->virtuemart_product_id); ?>"><?php echo JText::_('COM_VIRTUEMART_CART_NOTIFY') ?></a>
<?php } else { ?>
<form method="post" class="product" action="index.php" id="addtocartproduct<?php echo $product->virtuemart_product_id ?>">
<div class="product-custom">
<?php // Product custom_fields
if (!empty($product->customfieldsCart)) { ?>
<div class="product-fields">
<?php foreach ($product->customfieldsCart as $field) { ?>
<div class="product-field product-field-type-<?php echo $field->field_type ?>">
<div class="wrapper">
<span class="product-fields-title"><b><?php echo JText::_($field->custom_title) ?></b></span>
<span class="product-field-display"><?php echo $field->display ?></span>
</div>
<span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
</div>
<?php
}
?>
</div>
<?php } ?>
<div class="clear" />
</div>
<?php
/* Product custom Childs
* to display a simple link use $field->virtuemart_product_id as link to child product_id
* custom_value is relation value to child
*/
if (!empty($product->customsChilds)) {
?>
<div class="product-fields">
<?php foreach ($product->customsChilds as $field) { ?>
<div class="product-field product-field-type-<?php echo $field->field->field_type ?>">
<span class="product-fields-title"><b><?php echo JText::_($field->field->custom_title) ?></b></span>
<span class="product-field-desc"><?php echo JText::_($field->field->custom_value) ?></span>
<span class="product-field-display"><?php echo $field->display ?></span>
</div><br />
<?php } ?>
</div>
<?php } ?>
<div class="addtocart-bar">
<div class="controls">
<label for="quantity<?php echo $product->virtuemart_product_id;?>" class="quantity_box"><?php echo JText::_('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label>
<span class="box-quantity">
<span class="quantity-box" style="display:inline-block">
<input type="text" class="quantity-input js-recalculate" name="quantity[]" value="<?php if (isset($product->min_order_level) && (int) $product->min_order_level > 0) {
echo $product->min_order_level;
} else {
echo '1';
} ?>" />
</span>
<span class="quantity-controls js-recalculate">
<input type="button" class="quantity-controls quantity-plus" />
<input type="button" class="quantity-controls quantity-minus" />
</span>
</span>
<?php // Display the quantity box END ?>
</div>
<?php // Add the button
$button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
$button_cls = 'addtocart-button cart-click btn'; //$button_cls = 'addtocart_button';
?>
<?php // Display the add to cart button ?>
<div class="clear" />
<span class="addtocart_button">
<button type="submit" value="<?php echo $button_lbl ?>" class="<?php echo $button_cls ?>"><?php echo $button_lbl ?></button>
</span>
<div class="det">
<?php // Product Details Button
echo JHTML::link($product->link, JText::_('ART_DETAILS'), array('title' => $product->product_name,'class' => 'btn-det'));
?>
<div id="compare_cat" class="jClever">
<input id="prods<?php echo $product->virtuemart_product_id;?>" class="compare_checkbox" type="checkbox" name="prods<?php echo $product->virtuemart_product_id;?>"></input>
<label style="float:left;" for="prods<?php echo $product->virtuemart_product_id;?>" class="compare-label"><?php echo JText::_('ADD_TO_COMPARE');?></label>
<a href="index.php?option=com_compare&view=compare" class="go_to_compare"><?php echo JText::_('GO_TO_COMPARE'); ?></a>
</div>
</div>
<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 ?>" />
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
</div>
</form>
<?php } ?>
</div>
<?php }?>
In order to be displayed on the list kvontiti have to change styles
#product_list .addtocart-bar .quantity-box, #product_list .addtocart-bar .quantity-controls, #product_list .addtocart-bar .quantity_box {
display: block;
}
you can put the same form and in the grid, but it will be necessary to change
<div id="compare_cat" class="jClever">
<input id="prods<?php echo $product->virtuemart_product_id;?>" class="compare_checkbox" type="checkbox" name="prods<?php echo $product->virtuemart_product_id;?>"></input>
<label style="float:left;" for="prods<?php echo $product->virtuemart_product_id;?>" class="compare-label"><?php echo JText::_('ADD_TO_COMPARE');?></label>
<a href="index.php?option=com_compare&view=compare" class="go_to_compare"><?php echo JText::_('GO_TO_COMPARE'); ?></a>
</div>
with
<div id="compare_cat" class="jClever">
<input id="prod_<?php echo $product->virtuemart_product_id;?>" class="compare_checkbox" type="checkbox" name="compare_<?php echo $product->virtuemart_product_id;?> "></input>
<label style="float:left;" for="prod_<?php echo $product->virtuemart_product_id;?>" class="compare-label"><?php echo JText::_('ADD_TO_COMPARE');?></label>
<a href="index.php?option=com_compare&view=compare" class="go_to_compare"><?php echo JText::_('GO_TO_COMPARE'); ?></a>
</div>
For module products also need to insert the form and watch styles.

