Sto usando un modulo aggiuntivo per OsCommerce, voglio modificarlo per usare il campo "manufacturers_image" (nome inglese) o "manufacturers_name" (nome italiano) a seconda della lingua scelta.
Non riesco a capire pero' perchè la variabile $lang non influenza la scelta, quando poi la stessa variabile funziona per la funzione (!) categoriesList. Non posso nemmeno stampare la variabile per testare, in quanto questo file non è incluso, ma eseguito da un file selectphp.js.
Le ho provate tutte... non ho piu' idee.
A qualcuno viene in mente qualcosa?
Register_Global è su ON (per far girare OsCommerce).
Il seguente è il file originale, senza if ($lang=1) etc...
Codice PHP:
require("jsrsServer.php.inc");
jsrsDispatch( "categoriesList subcategoriesList manufacturersList" );
// SE $lang è 1 voglio che esegua
function manufacturersList( $subcategoriesID ){
// sopra ho anche provato a passargli $lang invece a/oltre a $subcategoriesID
return serializeSql("select manufacturers_id, manufacturers_name from manufacturers order by manufacturers_name");
}
// SE $lang è 4 voglio che esegua
/*
function manufacturersList( $subcategoriesID ){
return serializeSql("select manufacturers_id, manufacturers_image from manufacturers order by manufacturers_image");
}
*/
function categoriesList($manufacturersID, $lang) {
if ($manufacturersID==null){
return serializeSql( "select c.categories_id, cd.categories_name from categories c,categories_description cd where c.categories_id=cd.categories_id and c.parent_id=0 and cd.language_id=" . $lang . " order by categories_name" );
}
else{
return serializeSql( "select distinct c.parent_id, cd.categories_name from categories c,categories_description cd, products p, products_to_categories ptc, manufacturers m where m.manufacturers_id = " . $manufacturersID . " and p.manufacturers_id = m.manufacturers_id and ptc.products_id=p.products_id and c.categories_id = ptc.categories_id and cd.language_id=" . $lang . " and c.parent_id=cd.categories_id order by categories_name" );
}
}
e questo è il pezzo del file .js che lo esegue
codice:
function manufacturers_id_onChange(){
var val = this.options[this.selectedIndex].value;
IDCategories = noValue;
IDSubcategories = noValue;
IDManufacturers = val;
if(val == noValue){
emptyList( 'categories_id' );
emptyList( 'subcategories_id' );
window.status = 'cargando categorías...';
jsrsExecute( 'select_rs.php', cbFillOptions, 'manufacturersList',languages_id );
jsrsExecute( 'select_rs.php', cbFillMake, 'categoriesList',languages_id );
}
else {
fab_lleno="1";
curOption[this.name] = val;
// init dependent lists
emptyList( 'categories_id' );
emptyList( 'subcategories_id' );
window.status = 'cargando categorías...';
jsrsExecute( 'select_rs.php', cbFillMake, 'categoriesList', Array(val,languages_id) );
}
}