News:

Looking for documentation? Take a look on our wiki

Main Menu

how to reposition add to cart button

Started by brenwa, April 07, 2012, 22:40:41 PM

Previous topic - Next topic

brenwa

Hi All

I want to move the add to cart button to the bottom of the product details page, I would appreciate your assuming Im a bit challenged at this & if you could please provide a copy and paste type of an answer.... Im ok at eventually figuring out, but dont write code and usually muddle my way along via trail and error....that normally takes me forever!

As far as the file location part:
Im just getting familiar with the overrides and do know I need to use an alternate "view" in the template folder rather than editing the original file in its original location.
(finding information about the location of the product default.php file in virtuemart 2 was actually quite a challenge, for the rookies like myself, not yet familiar with this and basic information about the change from editing the template to using the "view" instead...you may want to look here  http://forum.virtuemart.net/index.php?topic=90935.0  )

thanks for your help in advance :)

jenkinhill

Make a copy of the file joomla_root/components/com_virtuemart/views/productdetails/tmpl/default.php  and open it is a plain test editor such as Notepad.

Locate this part of the code and cut it out.

   <?php
      // Add To Cart Button
//          if (!empty($this->product->prices) and !empty($this->product->images[0]) and $this->product->images[0]->file_is_downloadable==0 ) {
      if (!VmConfig::get('use_as_catalog', 0) and !empty($this->product->prices)) {
          echo $this->loadTemplate('addtocart');
      }  // Add To Cart Button END
      ?>

Past that code back onto the page immeciately above the closing </div> (the last line on that file). Save it as, say, movedbutton.php

FTP into the site and locate the html directory within your Joomla template. In that directory add a new subdirectory, com_virtuemart. Then in that new com_virtuem,art directory make another one called productdetails. Transfer your new file, movedbutton.php into that directory. So the path is like this:

joomla_root/templates/(your joomla template)/html/com_virtuemart/productdetails/movedbutton.php

Then in VirtueMart backend Configuration/Templates under "Shopfront Settings"  for Product layout   select your override template, movedbutton.php

You may want to make further edits, css changes etc, but that is the basic "move".
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum