Web Ti Market
E-commerce ExperT

Notice

Les Produits vus récemment

Virtuemart : Avoir les "produits vus récemment" sur une seule ligne

Ils s'affichent l'un en dessous de l'autre, car il s'agit d'une structure en liste (<ul><li>)
Il faut, donc, supprimer les listes et mettre à la place des <div>
Pour cet exemple, il suffit de définir dans la feuille CSS de votre template, la classe "recent_product", par ex:
.recent_product {
float:left;

margin:5px;

etc....

}

et modifier le fichier php : dossierdevotre_site\components\com_virtuemart\themes\default\templates\common\recent.php

Fichier original :

<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); ?>
<?php if( empty($recent_products)) return;
?>
<!-- List of recent products -->
<h3><?php echo $VM_LANG->_('VM_RECENT_PRODUCTS') ?></h3>
<ul class="vmRecentDetail">
<?php
foreach( $recent_products as $recent ) { // Loop through all recent products
foreach( $recent as $attr => $val ) {
//echo $attr." - ".$val."<br />";
$this->set( $attr, $val );
}
/**
* Available indexes:
*
* $recent["product_name"] => The user ID of the comment author
* $recent["category_name"] => The username of the comment author
* $recent["product_thumb_image"] => The name of the comment author
* $recent["product_url"] => The UNIX timestamp of the comment ("when" it was posted)
* $recent["category_url"] => The rating; an integer from 1 - 5
* $recent["product_s_desc"] => The comment text
*
*/
?>
<li>
<a href="/<?php echo $recent["product_url"]; ?>" >
<?php echo $recent["product_name"]; ?></a> (: 
<a href="/<?php echo $recent["category_url"]; ?>" ><?php echo $recent["category_name"]; ?></a>)
</li>
<?php
}
?>
</ul>

Fichier modifié :

<?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); ?>
<?php if( empty($recent_products)) return;
?>
<!-- List of recent products -->

<h3><?php echo $VM_LANG->_('VM_RECENT_PRODUCTS') ?></h3>
<?php
foreach( $recent_products as $recent ) { // Loop through all recent products
foreach( $recent as $attr => $val ) {
//echo $attr." - ".$val."<br />";
$this->set( $attr, $val );
}
/**
* Available indexes:
*
* $recent["product_name"] => The user ID of the comment author
* $recent["category_name"] => The username of the comment author
* $recent["product_thumb_image"] => The name of the comment author
* $recent["product_url"] => The UNIX timestamp of the comment ("when" it was posted)
* $recent["category_url"] => The rating; an integer from 1 - 5
* $recent["product_s_desc"] => The comment text
*
*/
if( !empty($recent["product_name"])) { ?>
<div class="recent_product">
<a href="/<?php echo $recent["product_url"]; ?>" >
<img src="/<?php echo $mosConfig_live_site."/components/com_virtuemart/shop_image/product/".$recent["product_thumb_image"]; ?>">
</a>
<?php echo $recent["product_name"]; ?>
</div>
<?php }
}
?>

Un appel html sera envoyé vers votre feuille css et les affichera selon vos choix.