Question: Embed "Add to compare" into product form for Compare Desk

The only manual edit required in Compare Desk configuration is the one to embed "Add to compare" checkbox into product form.


HikaShop

HikaShop provides a wonderful opportunity to override its template files through interface which we are happiliy going to use.

Template override's great advantage is that the file will be saved separately in your Joomla template folder and even if you update HikaShop later custom edits will not be overwritten.

So let's go to HikaShop → Display → Views.

On this page select "product" and your Joomla template to narrow down the files.

The files that display product form are the ones named: "listing_img", "listing_img_desc", "listing_img_pane", "listing_img_title" etc. These are all different layouts that HikaShop provides for you to choose. For us to find out which of them to edit we can refer to HikaShop configuration → Display tab and scroll down to the bottom. In our case it's "Image and title" therefore we'll edit "listing_img_title":

In this layout we will insert "Add to compare" checkbox somewhere below Ratings and before Add to cart button:

You can choose yourself where to insert these few lines of code.

And here are the lines itself:

<?php
// galt: show Add to compare checkbox
require_once(JPATH_SITE .'/components/com_comparedesk/helpers/helper.php');
$HikaShopHelper = DeskFactory::getHikaShopHelper();
$HikaShopHelper->displayAddToCompare($this);
?>

That's it. Click "Save" and compare checkbox should appear now in front-end.



Virtuemart 2

Virtuemart 3 users, please see additional notes below.

Virtuemart is a little bit more hardcore and we'll have to use text editor to make changes. It is best to override a template file so that the edits we make will stay after Virtuemart updates. The original category template file is located at:

/components/com_virtuemart/views/category/tmpl/

Now to see which file to edit you can check Virtuemart configuration:

In our case it is the default default.php. Copy this file to your template directory creating all subdirectories if you don't have one:

/templates/<YOUR_TEMPLATE>/html/com_virtuemart/category/

You may find out that your template already provides custom overrides and has all the files it its place -- in this case you do not need to copy anything.

Now let's open default.php (or whatever it is in your case). We will add "Add to compare" checkbox right above the product details button so the final look will be:

..
<?php
// galt: show Add to compare checkbox
require_once(JPATH_SITE .'/components/com_comparedesk/helpers/helper.php');
$VirtuemartHelper = DeskFactory::getVirtuemartHelper();
$VirtuemartHelper->displayAddToCompare($product);
// galt: end
?>

<p>
  <?php // Product Details Button
   echo JHTML::link ($product->link, JText::_ ('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name, 'class' => 'product-details'));
  ?>
</p>
..


Virtuemart 3

Virtuemart 3 uses another approach to displaying products on page--it is called Sublayouts. So if you open default.php and see a line like this in it:

echo shopFunctionsF::renderVmSubLayout($this->productsLayout, array('products'=>$products, 'currency' => $this->currency, 'products_per_row' => $this->perRow, 'showRating' => $this->showRating));

that means we'll need to edit another file. The original path, where the file is located is:

/components/com_virtuemart/sublayouts/products.php

But remember, it is a good practice to override files in your template so that your changes will not be erased after Virtuemart update. That is why copy or edit (if it already exists) the file:

/templates/<YOUR_TEMPLATE>/html/com_virtuemart/sublayouts/products.php

and insert the same lines as in instructions for Virtuemart 2.


Visit AsianSexCenter.Com for the best asian xxx.