Author Topic: How to modify layout of featured items  (Read 4245 times)

hibiscus

  • Beginner
  • *
  • Posts: 4
How to modify layout of featured items
« on: December 06, 2011, 07:07:18 am »
Is it possible to change the template for the featured items module?  I've looked but it's not obvious to me where/how to do it.

bunglehaze

  • Jr. Member
  • **
  • Posts: 487
Re: How to modify layout of featured items
« Reply #1 on: December 08, 2011, 00:05:35 am »
You can modify using simple inline css as well as styling in the VM site stylesheet. Here is a simple example of the standard module with a tweak to put everything inline. I also changed the module so that the image links to the product page and not an image popup

Code: [Select]
<?php // no direct access
defined('_JEXEC') or die('Restricted access');
$col;
?>

<div class="vmgroup<?php echo $params->get'moduleclass_sfx' ?>">

<?php if ($headerText) { ?>
<div class="vmheader"><?php echo $headerText ?></div>
<?php }
if (
$display_style =="div") { ?>

<div class="vmproduct<?php echo $params->get('moduleclass_sfx'); ?>">
<?php foreach ($products as $product) { ?>
<div style="float:left; display:block;margin:10px;text-align:center;">
<?php
if (!empty($product->images[0]) ) {
echo 
JHTML::_('link'JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id),$product->images[0]->displayMediaThumb('class="browseProductImage" border="0"',false)); 
}
?>

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

<?php echo JHTML::link(JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id), $product->product_name, array('title' => $product->product_name)); ?>
<div class="clear"></div>
<?php
if ($show_price) {
//  echo $currency->priceDisplay($product->prices['salesPrice']);
if ($product->prices['salesPrice']>0) echo $currency->createPriceDiv('salesPrice','',$product->prices,true);
//  if ($product->prices['salesPriceWithDiscount']>0) echo $currency->priceDisplay($product->prices['salesPriceWithDiscount']);
if ($product->prices['salesPriceWithDiscount']>0) echo $currency->createPriceDiv('salesPriceWithDiscount','',$product->prices,true);
}

?>

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

</div>

<?php
if ($col == $products_per_row && $products_per_row && $col $totalProd ) {
echo " </div><div style='clear:both;'>";
$col;
} else {
$col++;
}
?>

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

<br style='clear:both;' />
<?php
} else {
?>


<ul class="vmproduct<?php echo $params->get('moduleclass_sfx'); ?>">
<?php foreach ($products as $product) : ?>
<li>
<?php
$productModel->addImages($product);
echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0"');
?>

<?php echo JHTML::link(JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id), $product->product_name, array('title' => $product->product_name,'rel'=>'facebox')); ?>
<?php
if ($show_price) {
echo $currency->createPriceDiv('salesPrice','',$product->prices,true);
if ($product->prices['salesPriceWithDiscount']>0) echo $currency->createPriceDiv('salesPriceWithDiscount','',$product->prices,true);
}
if ($show_addtocart) echo mod_virtuemart_product::addtocart($product);
?>

</li>
<?php
if (
$col == $products_per_row && $products_per_row) {
echo "
</ul>
<ul>"
;
$col;
} else {
$col++;
}
endforeach; ?>

</ul>

<?php }
if ($footerText) : ?>

<div class="vmfooter<?php echo $params->get'moduleclass_sfx' ?>">
<?php echo $footerText ?>
</div>
<?php endif; ?>
</div>

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10414
  • VirtueMart Version: 3+
Re: How to modify layout of featured items
« Reply #2 on: December 08, 2011, 19:08:44 pm »
make sure to do a template override with the module. OR all changes will get overwritten when you update.

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

charles99

  • Jr. Member
  • **
  • Posts: 57
Re: How to modify layout of featured items
« Reply #3 on: December 09, 2011, 06:09:45 am »
What file this goes in?

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10414
  • VirtueMart Version: 3+
Re: How to modify layout of featured items
« Reply #4 on: December 09, 2011, 13:08:23 pm »
mod_virtuemart_product/tmpl/default.php

^^^ but you should do an override

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

hibiscus

  • Beginner
  • *
  • Posts: 4
Re: How to modify layout of featured items
« Reply #5 on: December 09, 2011, 20:15:37 pm »
Thanks for the help.  I really appreciate it.

bunglehaze

  • Jr. Member
  • **
  • Posts: 487
Re: How to modify layout of featured items
« Reply #6 on: December 10, 2011, 12:43:30 pm »
Hibiscus, as Banquet Tables says I created a new Joomla override is /templates/YOUR_Template/html/mod_virtuemart_product/default.php with that file which saves it from being overwritten after each upgrade