add to cart button in category

Joomla webshop template with CSS3-based animations, VirtueMart support and one-page checkout.
GK User
Sat Jan 03, 2015 1:57 pm
Virtuemart 3 now supports add to cart button in category view. How can this be implemented in latest Storefront template ?

When do you plan to release new e-comerce template ?

Thanks.
User avatar
Gold Boarder

teitbite
Sun Jan 04, 2015 10:26 am
Hi

I have no idea about releasing plans. It's something developers only knows.

Please send me an access to ftp and an url to the page with category view and I'll see what can be done about add to cart there.
User avatar
Moderator

GK User
Sun Jan 04, 2015 10:57 am
Well this is general question, site is still in development :) But I see on VM3 feature lists, that now products can be added to the basket from category view. This future was one of the most wanted for many of us... So it would be nice to implement to gavick templates by default.

Thanks.

teitbite wrote:Hi

I have no idea about releasing plans. It's something developers only knows.

Please send me an access to ftp and an url to the page with category view and I'll see what can be done about add to cart there.
User avatar
Gold Boarder

teitbite
Mon Jan 05, 2015 11:08 am
Hi

I had no idea it was added to VM3, but I remember helping ppl on this forum to add this functionality long time ago. It's not as hard as it sounds. You need to take the add to cart functionality from item layout and copy it to category layout. Please try it and get back to me if You will need help.
User avatar
Moderator

GK User
Fri Nov 20, 2015 2:58 pm
Hi,

This is an very actual question for me at this time.

I use the INSTORE template for my website. Is there any chance to tell me where to put what code, please?

Thanks!!
User avatar
Fresh Boarder

teitbite
Mon Nov 23, 2015 7:13 pm
Hi

Do You mean "in_style" template ? Edit file /html/com_virtuemart/category/default.php and replace code:

Code: Select all
               <?php
               /* REMOVE THE COMMENT AND PHP TAGS IF YOU NEED TO DISPLAY PRICES ON THE CATEGORY LISTING
               <div class="catProductPrice" id="productPrice<?php echo $product->virtuemart_product_id ?>">
                  <?php
                  if ($this->show_prices == '1') {
                     if ($product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and  !$product->images[0]->file_is_downloadable) {
                        echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE');
                     }
                     echo $this->currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
                  } ?>
               </div>
               */
               ?>


with

Code: Select all
               <?php
               <div class="catProductPrice" id="productPrice<?php echo $product->virtuemart_product_id ?>">
                  <?php
                  if ($this->show_prices == '1') {
                     if ($product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and  !$product->images[0]->file_is_downloadable) {
                        echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE');
                     }
                     echo $this->currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
                  } ?>
               </div>
               ?>
User avatar
Moderator

GK User
Thu Dec 10, 2015 4:14 pm
This is for showing the price in category view. I figured that out allready.

But how to show the 'Add to Cart' button in the same view?
User avatar
Fresh Boarder

teitbite
Sat Dec 12, 2015 1:25 pm
Hi

In that case please go to /html/com_virtuemart/category/ and rename this folder to _category.

First I need to check if add to cart is provided for category by Virtuemart and renaming this folder will make site use default Virtuemert files.
User avatar
Moderator

GK User
Wed Feb 08, 2017 2:39 pm
Hello, is there any solution about this issue please ?
I ahve already updated to latest storefront and no cart or quantity options are displayed on category view.
Is there any chance this could be fixed ?
User avatar
Fresh Boarder

teitbite
Mon Feb 13, 2017 12:44 pm
Hi

No one got back to me with a result of the test I've asked to do, can You please check if disabling template's override to Virtuemart will make a difference to this issue. To do that please go to /html/com_virtuemart/category/ and rename this folder to _category.
User avatar
Moderator

GK User
Thu Mar 16, 2017 5:51 pm
Yes, doing this makes VirtueMart display the Add To Cart buttons and quantity controls in this view.
User avatar
Fresh Boarder

teitbite
Mon Mar 20, 2017 3:26 pm
Hi

Ok. Please send me an access to FTP and url to the example page I'll be bale to see the page You need it to my mail [email protected]
User avatar
Moderator

teitbite
Fri Mar 24, 2017 2:13 pm
Hi

I'm afraid the FTP access You've send me is not working. Please send a correct one to my e-mail [email protected]
User avatar
Moderator

teitbite
Sat Mar 25, 2017 11:07 am
Hi

Ok. Looks to be working now. I've copied a code for cart to /html/com_virtuemart/category/default.php

Code: Select all
   <div class="addtocart-area">
      <form method="post" class="product js-recalculate" action="<?php echo JRoute::_ ('index.php?option=com_virtuemart',false); ?>">
         <div class="vm-customfields-wrap">
            <?php
            if(!empty($rowHeights['customfields'])) echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$product,'position'=>'addtocart')); ?>
         </div>         
            <?php
            if (!VmConfig::get('use_as_catalog', 0)  ) {
               echo shopFunctionsF::renderVmSubLayout('addtocartbar',array('product'=>$product));
            } ?>
         <input type="hidden" name="option" value="com_virtuemart"/>
         <input type="hidden" name="view" value="cart"/>
         <input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>"/>
         <input type="hidden" name="pname" value="<?php echo $product->product_name ?>"/>
         <input type="hidden" name="pid" value="<?php echo $product->virtuemart_product_id ?>"/>
         <?php
         $itemId=vRequest::getInt('Itemid',false);
         if($itemId){
            echo '<input type="hidden" name="Itemid" value="'.$itemId.'"/>';
         } ?>
      </form>

   </div>
User avatar
Moderator


cron
Remember me
Register New Account
If you are old Gavick user, click HERE for steps to retrieve your account.