July 2010
M T W T F S S
« Dec «-»  
 1234
567891011
12131415161718
19202122232425
262728293031  

Joomla VirtueMart related products lay out

VN:F [1.4.6_730]
Rating: 5.0/5 (1 vote cast)

VirtueMart is a store component of Joomla CMS. It allows us to sell and comercialize any kind of products through Internet. VirtueMart allows to show detailled information about our products and other products related to it. At DiceLock Security we found that the default lay out of these related products was making our viewers to scroll horizontally …

  Applies to:
Joomla 1.5
VirtueMart 1.1.3
These customizations are provided “AS IS” without warranty of any kind and DiceLock Security disclaims all warranties, EITHER EXPRESS OR IMPLIED INCLUDING THOSE OF MERCHANTABILITY, NONINFRINGEMENT OF THIRD-PARTY INTELLECTUAL PROPERTY, OR FITNESS FOR A PARTICULAR PURPOSE.

Upgrading or reinstalling the customized source code (package, plugin, component, …) may remove the customizations performed.

 

At DiceLock Security store for each product we show viewers other products that are related to it. We have found that when there are some related products, VirtueMart shows those related products horizontally and that the veiwer must scroll hotizontally to see the web site in its full width.

Horizontally scroll in our old VirtueMart store:

 Joomla VirtueMart related products lay out

We wanted that viewers would be able to see the web site in its full width and all related products with better lay out.

Looking at VirtueMart component structure we found that related products were handled by the PHP file ROOT\components\com_virtuemart\themes\default\templates\common\relatedProducts.tpl.php.

The file looked like:

<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); ?>
 
<hr/>
 
<h3><?php echo $VM_LANG->_('PHPSHOP_RELATED_PRODUCTS_HEADING') ?></h3>
 
<table width="100%" align="center">
	<tr>
    <?php 
    while( $products->next_record() ) { ?>
      	<td valign="top">
      		<?php echo $ps_product->product_snapshot( $products->f('product_sku') ) ?>
      	</td>
	<?php 
    }
	?>
    </tr>
</table>
Note: if you view this code through the machine translator, maybe you are viewing a transformed code. Please, view the original English version of the page to see it unaltered.

Where it can be seen that related products are shown within a “table”, with “one row” and “one column” for each related product.

What we have done is to change this lay out, we have removed the table and we have changed it by a “div” and we have put each related product within each own “div”. So, now file ROOT\components\com_virtuemart\themes\default\templates\common\relatedProducts.tpl.php looks like:

<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); ?>
 
<hr/>
 
<h3><?php echo $VM_LANG->_('PHPSHOP_RELATED_PRODUCTS_HEADING') ?></h3>
 
<div width="100%">
    <?php 
    while( $products->next_record() ) { ?>
<div style = "float: left; width: 190px;">
      		<?php echo $ps_product->product_snapshot( $products->f('product_sku') ) ?>
</div>
	<?php 
    }
	?>
</div>
Note: if you view this code through the machine translator, maybe you are viewing a transformed code. Please, view the original English version of the page to see it unaltered.

Now related products does not make viewers to horizontally scroll because related products looks like:

 Joomla VirtueMart related products lay out

And if the viewer reduces browser’s width related products get this lay out automatically:

 Joomla VirtueMart related products lay out

We prefer to show them in this way !.

VN:F [1.4.6_730]
Rating: 5.0/5 (1 vote cast)
  • Share/Save/Bookmark

Related posts:

  1. Joomla Search error message lay out
  2. Joomla Search form image improvement
  3. Joomla RSForm PRO adding contact information
  4. Joomla – Front Page number of articles
  5. WordPress – Improve your 404 File Not Found answers (4 of 4)

1 Comment

You must be logged in to post a comment.

If you want to subscribe to the comments of this information without commenting, enter your email.





Close Me  
Get FREE Random Number Test Windows DLL !
Get FREE Hash Algorithms Windows DLL !