software:virtuemart:hacks:top10

Десятка покупаемых товаров

Допил оригинального /modules/mod_virtuemart_topten/mod_virtuemart_topten.php чтобы показывался один самый продаваемый товар с картинкой. Обратить внимание - JRoute::_($router_url) использовать только с установленным router.php!

Если router.php нет, то изменения такие:

$router_url = 'index.php?page=shop.product_details&flypage=flypage_images.tpl&product_id='. $pr_id .'&category_id=' . $cat_id;

и вместо

$sess->purl( JRoute::_($router_url));

делаем

$sess->purl( $router_url );

mod_virtuemart_topten.php

<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/*
* Best selling Products module for VirtueMart
* @version $Id: mod_virtuemart_topten.php 1160 2008-01-14 20:35:19Z soeren_nb $
* @package VirtueMart
* @subpackage modules
*
* @copyright (C) John Syben ([email protected])
* Conversion to Mambo and the rest:
* 	@copyright (C) 2004-2005 Soeren Eberhardt
*
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* VirtueMart is Free Software.
* VirtueMart comes with absolute no warranty.
*
* www.virtuemart.net
*----------------------------------------------------------------------
* This code creates a list of the bestselling products
* and displays it wherever you want
*----------------------------------------------------------------------
*/
global $mosConfig_absolute_path, $sess;
 
// Load the virtuemart main parse code
if( file_exists(dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' )) {
	require_once( dirname(__FILE__).'/../../components/com_virtuemart/virtuemart_parser.php' );
} else {
	require_once( dirname(__FILE__).'/../components/com_virtuemart/virtuemart_parser.php' );
}
 
	$stat = mysql_query("SELECT p.product_name, p.product_id, c.category_id, p.product_thumb_image, pr.product_price, pr.product_currency
						  FROM jos_vm_product as p
						  LEFT JOIN jos_vm_product_category_xref as c ON (p.product_id = c.product_id)
						  LEFT JOIN jos_vm_product_price as pr ON (p.product_id = pr.product_id)
						  ORDER BY p.product_sales DESC
						  LIMIT 1
						  "); // show only 1 hit
 
 
	$row_stat = mysql_fetch_array($stat);
	$pr_id = $row_stat['product_id'];
	$cat_id = $row_stat['category_id'];
	$router_url = 'page=shop.product_details&flypage=flypage_images.tpl&product_id='. $pr_id .'&category_id=' . $cat_id;
?>
    <div class="virt_top">
    <a href='<?php $sess->purl( JRoute::_($router_url)); ?>'><img class="browseProductImage" src='/components/com_virtuemart/shop_image/product/<?php echo $row_stat['product_thumb_image'];?>'></a>
 
    <br style="clear:both"><h2 class="virt">
    <a href='<?php $sess->purl( JRoute::_($router_url)); ?>'><?php echo $row_stat['product_name'];?></a></h2>
    <p class="price"><span class="productPrice"><?php echo $row_stat['product_price'];?> ╤А╤Г╨▒.</span></p>
    </div>
  • software/virtuemart/hacks/top10.txt
  • Последнее изменение: 2017/05/09 18:34
  • 127.0.0.1