News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

How to modify layout of featured items

Started by hibiscus, December 06, 2011, 07:07:18 AM

Previous topic - Next topic

hibiscus

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

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

<?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

make sure to do a template override with the module. OR all changes will get overwritten when you update.


charles99


PRO

mod_virtuemart_product/tmpl/default.php

^^^ but you should do an override


hibiscus

Thanks for the help.  I really appreciate it.

bunglehaze

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