eSport and Category list with add to cart option

GK User
Wed Feb 29, 2012 5:11 pm
With this template, in the category list view option, the products have the option 'product detail' (see the image) but no the option 'add to cart' with the quantity box included. How can I make visible these options?

Thanks in advance
User avatar
Junior Boarder

GK User
Thu Mar 01, 2012 11:58 am
Hello,

At the end, I have found the solution.
I have modified the file
\templates\gk_esport\html\com_virtuemart\category\default.php
after the place where the product details button is printer ( <?php // Product Details Button
echo JHTML::link($product->link, JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' => 'catProductDetails'));
?>)
I have added the next code:

<?php // Add To Cart Button
if (!VmConfig::get('use_as_catalog',0)) { ?>
<div class="addtocart-area">
<form method="post" class="product js-recalculate" action="index.php" >


<?php // Product custom_fields

if (!empty($product->customfieldsCart)) { ?>
<div class="product-fields">
<?php foreach ($product->customfieldsCart as $field)
{ ?>
<div class="product-field-type-<?php echo $field->field_type ?>">
<label class="product-fields-title" ><?php echo JText::_($field->custom_title) ?></label>
<?php echo $field->display ?>
</div>
<?php
}
?>
</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 style="display:inline-block;" 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">
<?php // Display the quantity box ?>
<!-- <label for="quantity<?php echo $product->virtuemart_product_id;?>" class="quantity_box"><?php echo JText::_('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label> -->
<span class="quantity-box">
<input type="text" class="quantity-input" 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>
<?php // Display the quantity box END ?>
<?php // Add the button
$button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
$button_cls = 'addtocart-button'; //$button_cls = 'addtocart_button';
$button_name = 'addtocart'; //$button_cls = 'addtocart_button';


// Display the add to cart button
$stockhandle = VmConfig::get('stockhandle','none');
if(($stockhandle=='disableit' or $stockhandle=='disableadd') and ($product->product_in_stock - $product->product_ordered)<1){
$button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
$button_cls = 'notify-button';
$button_name = 'notifycustomer';
}
vmdebug('$stockhandle '.$stockhandle.' and stock '.$product->product_in_stock.' ordered '.$product->product_ordered);
?>
<span class="addtocart-button">
<input type="submit" name="<?php echo $button_name ?>" class="<?php echo $button_cls ?> addtoCart" 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>
<div class="clear"></div>
</div>
<?php } // Add To Cart Button END ?>

I hope this cought help someone else...
User avatar
Junior Boarder


cron