Un saluto a tutti girando su internet ho trovato il codice per inserire un filtro per produttore per virtue mart componente per joomla.
Ma non so in che punto vada inserito vi metto qui di seguito il codice per il filtro e il codice dove dovrei andarlo ad inserire ma non so dove.
ecco il codice per il filtro:
$query = "SELECT distinct a.manufacturer_id,a.mf_name FROM #__{vm}_manufacturer AS a ";
if (!empty( $category_id ) ) {
$query .= ", #__{vm}_product_category_xref AS d, "
. " #__{vm}_product AS b, "
. " #__{vm}_product_mf_xref AS c "
. " WHERE d.category_id='$category_id'"
. " AND d.product_id = b.product_id AND b.product_publish='Y' "
. " AND b.product_id = c.product_id AND c.manufacturer_id = a.manufacturer_id ";
}
$query .= "ORDER BY mf_name ASC";
$db = new ps_DB;
$db->query( $query );
$res = $db->record;
?>
_PHPSHOP_MANUFACTURER_MOD . ' --'?> manufacturer_id ."\" $selected>". $manufacturer->mf_name ."
Il codice dove dovrei inserirlo:
<?php
if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
/**
* This is the Main Product Listing File!
*
* @version $Id: shop.browse.php 1489 2008-07-30 19:38:04Z gregdev $
* @package VirtueMart
* @subpackage html
* @copyright Copyright (C) 2004-2008 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName( __FILE__ );
// load important class files
require_once (CLASSPATH."ps_product.php");
$ps_product = new ps_product;
require_once (CLASSPATH."ps_product_category.php");
$ps_product_category = new ps_product_category;
require_once (CLASSPATH."ps_product_files.php");
require_once (CLASSPATH."ps_reviews.php");
require_once (CLASSPATH."imageTools.class.php");
require_once (CLASSPATH."PEAR/Table.php");
require_once(CLASSPATH . 'ps_product_attribute.php' );
$ps_product_attribute = new ps_product_attribute;
$Itemid = $sess->getShopItemid();
$keyword1 = $vmInputFilter->safeSQL( urldecode(vmGet( $_REQUEST, 'keyword1', null )));
$keyword2 = $vmInputFilter->safeSQL( urldecode(vmGet( $_REQUEST, 'keyword2', null )));
$search_op= $vmInputFilter->safeSQL( vmGet( $_REQUEST, 'search_op', null ));
$search_limiter= $vmInputFilter->safeSQL( vmGet( $_REQUEST, 'search_limiter', null ));
if (empty($category_id)) $category_id = $search_category;
$default['category_flypage'] = FLYPAGE;
$db_browse = new ps_DB;
$dbp = new ps_DB;
// NEW: Include the query section from an external file
require_once( PAGEPATH. "shop_browse_queries.php" );
$db_browse->query( $count );
$num_rows = $db_browse->f("num_rows");
if( $limitstart > 0 && $limit >= $num_rows) {
$list = str_replace( 'LIMIT '.$limitstart, 'LIMIT 0', $list );
}
if( $category_id ) {
/**
* CATEGORY DESCRIPTION
*/
$db->query( "SELECT category_id, category_name FROM #__{vm}_category WHERE category_id='$category_id'");
$db->next_record();
$category_name = shopMakeHtmlSafe( $db->f('category_name') );
/* Set Dynamic Page Title */
$mainframe->setPageTitle( $db->f("category_name") );
$desc = $ps_product_category->get_description($category_id);
$desc = vmCommonHTML::ParseContentByPlugins( $desc );
/* Prepend Product Short Description Meta Tag "description" when applicable */
$mainframe->prependMetaTag( "description", substr(strip_tags($desc ), 0, 255) );
}
// when nothing has been found we tell this here and say goodbye
if ($num_rows == 0 && (!empty($keyword)||!empty($keyword1))) {
echo $VM_LANG->_('PHPSHOP_NO_SEARCH_RESULT');
}
elseif( $num_rows == 0 && empty($product_type_id) && !empty($child_list)) {
echo $VM_LANG->_('EMPTY_CATEGORY');
}
elseif( $num_rows == 1 && ( !empty($keyword) || !empty($keyword1) ) ) {
// If just one product has been found, we directly show the details page of it
$db_browse->query( $list );
$db_browse->next_record();
$flypage = $db_browse->sf("category_flypage") ? $db_browse->sf("category_flypage") : FLYPAGE;
$url_parameters = "page=shop.product_details&flypage=$flypage&am p;product_id=" . $db_browse->f("product_id") . "&category_id=" . $db_browse->f("category_id");
vmRedirect( $sess->url($url_parameters, true, false ) );
}
else {
// NOW START THE PRODUCT LIST
$tpl = vmTemplate::getInstance();
if( $category_id ) {
/**
* CATEGORY DESCRIPTION
*/
$browsepage_lbl = $category_name;
$tpl->set( 'browsepage_lbl', $browsepage_lbl );
$tpl->set( 'desc', $desc );
$category_childs = $ps_product_category->get_child_list($category_id);
$tpl->set( 'categories', $category_childs );
$navigation_childlist = $tpl->fetch( 'common/categoryChildlist.tpl.php');
$tpl->set( 'navigation_childlist', $navigation_childlist );
// Set up the CMS pathway
$category_list = array_reverse( $ps_product_category->get_navigation_list($category_id) );
$pathway = $ps_product_category->getPathway( $category_list );
$vm_mainframe->vmAppendPathway( $pathway );
$tpl->set( 'category_id', $category_id );
$tpl->set( 'category_name', $category_name );
$browsepage_header = $tpl->fetch( 'browse/includes/browse_header_category.tpl.php' );
}
elseif( $manufacturer_id) {
$db->query( "SELECT manufacturer_id, mf_name FROM #__{vm}_manufacturer WHERE manufacturer_id='$manufacturer_id'");
$db->next_record();
$mainframe->setPageTitle( $db->f("mf_name") );
$browsepage_lbl = shopMakeHtmlSafe( $db->f("mf_name") );
$tpl->set( 'browsepage_lbl', $browsepage_lbl );
$browsepage_lbltext = $db->f("mf_desc");
$tpl->set( 'browsepage_lbltext', $browsepage_lbltext );
$browsepage_header = $tpl->fetch( 'browse/includes/browse_header_manufacturer.tpl.php' );
}
elseif( $keyword ) {
$mainframe->setPageTitle( $VM_LANG->_('PHPSHOP_SEARCH_TITLE',false) );
$browsepage_lbl = $VM_LANG->_('PHPSHOP_SEARCH_TITLE') .': '.shopMakeHtmlSafe( $keyword );
$tpl->set( 'browsepage_lbl', $browsepage_lbl );
$browsepage_header = $tpl->fetch( 'browse/includes/browse_header_keyword.tpl.php' );
}
else {
$mainframe->setPageTitle( $VM_LANG->_('PHPSHOP_BROWSE_LBL',false) );#
$browsepage_lbl = $VM_LANG->_('PHPSHOP_BROWSE_LBL');
$tpl->set( 'browsepage_lbl', $browsepage_lbl );
$browsepage_header = $tpl->fetch( 'browse/includes/browse_header_all.tpl.php' );
}
$tpl->set( 'browsepage_header', $browsepage_header );
if (!empty($product_type_id) && @$_REQUEST['output'] != "pdf") {
$tpl->set( 'ps_product_type', $ps_product_type);
$tpl->set( 'product_type_id', $product_type_id);
$parameter_form = $tpl->fetch( 'browse/includes/browse_searchparameter_form.tpl.php' );
}
else {
$parameter_form = '';
}
$tpl->set( 'parameter_form', $parameter_form );
// Decide whether to show the limit box
$show_limitbox = ( $num_rows > 5 && @$_REQUEST['output'] != "pdf" );
$tpl->set( 'show_limitbox', $show_limitbox );
// Decide whether to show the top navigation
$show_top_navigation = ( PSHOP_SHOW_TOP_PAGENAV =='1' && $num_rows > $limit );
$tpl->set( 'show_top_navigation', $show_top_navigation );
// Prepare Page Navigation
require_once( CLASSPATH . 'pageNavigation.class.php' );
$pagenav = new vmPageNav( $num_rows, $limitstart, $limit );
$tpl->set( 'pagenav', $pagenav );
$search_string = '';
if ( $num_rows > 1 && @$_REQUEST['output'] != "pdf") {
if ( $num_rows > $limit || $num_rows > 5 ) {
$search_string = $mm_action_url."index.php?option=com_virtuemart&am p;page=$modulename.browse&category_id=$categor y_id&keyword=".urlencode( $keyword )."&manufacturer_id=$manufacturer_id&Itemi d=$Itemid";
$search_string .= !empty($orderby) ? "&orderby=".urlencode($orderby) : "";
if (!empty($keyword1)) {
$search_string.="&keyword1=".urlencode($keywor d1);
$search_string.="&search_category=$search_cate gory";
$search_string.="&search_limiter=$search_limit er";
if (!empty($keyword2)) {
$search_string.="&keyword2=".urlencode($keywor d2);
$search_string.="&search_op=$search_op";
}
}
if (!empty($product_type_id)){
foreach($_REQUEST as $key => $value){
if (substr($key, 0,13) == "product_type_"){
$val = vmGet($_REQUEST, $key );
if( is_array( $val )) {
foreach( $val as $var ) {
$search_string .="&".$key."[]=".urlencode($var);
}
} else {
$search_string .="&".$key."=".urlencode($val);
}
}
}
}
}