Add to cart button in category view

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Thu Aug 02, 2012 1:21 pm
Reply with quote
Report this post
Hello, is it possible to have the add to cart button in the category view?
User avatar
Fresh Boarder

teitbite
Sun Aug 05, 2012 4:01 pm
Reply with quote
Report this post
Hi

Can I please see your site?
User avatar
Moderator

GK User
Mon Aug 06, 2012 12:47 pm
Reply with quote
Report this post
Hi,

"Add to cart" button in the category it would be great !

http://e-jetable.com/en/disposable-elec ... otine.html
User avatar
Fresh Boarder

GK User
Tue Aug 07, 2012 5:13 am
Reply with quote
Report this post
hello the site is at this temp address now: http://carlneumann.com/sink/shop/

I would like to add the "add to cart" button in the category view.

I would also like the + and - in the product area.

How do I do this?
User avatar
Fresh Boarder

teitbite
Wed Aug 08, 2012 10:42 am
Reply with quote
Report this post
Hi

Ok. First of all lets check if it's even possible with VM. Please rename /html/com_virtuemart folder in template to /html/_com_virtuemart

With this You will be able to see a VM default view, so we would know if they made it in their component.
User avatar
Moderator

GK User
Thu Aug 23, 2012 3:08 am
Reply with quote
Report this post
Yes it can be done.
Simply add the code below to the default.php file in the following path;

yoursite/templates/gk_bikestore/html/com_virtuemart/category

Please be aware that the location of the code will depend on where you want the button to display. But I would put it on either line 223 or 228 in the default.php file of this template.

Code: Select all
<p>
<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 ?>
         <!-- <label for="quantity<?php echo $this->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="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>
</p>
User avatar
Fresh Boarder

GK User
Thu Aug 23, 2012 10:21 am
Reply with quote
Report this post
Excellent! It work perfectly!
User avatar
Fresh Boarder

teitbite
Fri Aug 24, 2012 12:38 pm
Reply with quote
Report this post
Hi

Great :) Thank You for help pyxiapps.
User avatar
Moderator

GK User
Mon Apr 15, 2013 5:57 pm
Reply with quote
Report this post
Hello,

I'm triying get this in Storebox template but don't work for me, I think that this because this template have the overlay with "View" text and I can't find where put the correct code to work in this template.

I'm triying put this code in my templates/gk_storebox/html/com_virtuemart/category/default.php

<div class="addtocart-bar">

<script type="text/javascript">
function check(obj) {
// use the modulus operator '%' to see if there is a remainder
remainder=obj.value % <?php echo $step?>;
quantity=obj.value;
if (remainder != 0) {
alert('<?php echo $alert?>!');
obj.value = quantity-remainder;
return false;
}
return true;
}
</script>

<?php // Display the quantity box

$stockhandle = VmConfig::get ('stockhandle', 'none');
if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($product->product_in_stock - $product->product_ordered) < 1) {
?>
<a href="<?php echo JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=' . $product->virtuemart_product_id); ?>" class="notify"><?php echo JText::_ ('COM_VIRTUEMART_CART_NOTIFY') ?></a>

<?php } else { ?>
<!-- <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 js-recalculate" name="quantity[]" onblur="check(this);" value="<?php if (isset($product->step_order_level) && (int)$product->step_order_level > 0) {
echo $product->step_order_level;
} else if(!empty($product->min_order_level)){
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>
<?php // Display the quantity box END ?>

<?php
// Display the add to cart button
?>
<span class="addtocart-button">
<?php echo shopFunctionsF::getAddToCartButton ($product->orderable); ?>
</span>
<?php } ?>

<div class="clear"></div>
</div>
<?php }
// Display the add to cart button END ?>
<input type="hidden" class="pname" value="<?php echo htmlentities($product->product_name, ENT_QUOTES, 'utf-8') ?>"/>
<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 ?>"/>
</form>

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

But with no luck for now.

¿Could some give some help with this?

Thanks.
User avatar
Fresh Boarder

teitbite
Tue Apr 16, 2013 4:26 pm
Reply with quote
Report this post
Hi

I'm sorry but this is a customization request we do not support so I cannot help.
User avatar
Moderator


cron