Freitag, 18. april 2008
dem Einen oder Anderen ist es vielleicht schon aufgefallen, das für die Advanced Search Results Seite unter Umständen ein Template gewählt wird, daß eigentlich so nicht gedacht war, und das man es auch nicht im Admin einstellen kann, welches Template denn gewählt werden soll.
Die entsprechende Anweisung im original XTC code "wählt" nämlich einfach die "erste" Template-Datei im ordner templates/IhrTemplate/module/product_listing aus.
PHP-Code:
// get default template
if ($category['listing_template'] == '' or $category['listing_template'] == 'default') {
$files = array ();
if ($dir = opendir(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_listing/')) {
while (($file = readdir($dir)) !== false) {
if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_listing/'.$file) and ($file != "index.html") and (substr($file, 0, 1) !=".")) {
$files[] = array ('id' => $file, 'text' => $file);
} //if
} // while
closedir($dir);
}
$category['listing_template'] = $files[0]['id'];
}
das ist natürlich eine suboptimale Lösung, da man damit recht unflexibel ist.
deshalb habe ich mich mal schnell hingesetzt und eine Lösung gesucht, um das Suchergebnis-Template vom Admin-Bereich aus einstellbar zu machen.
Das Ergebnis ist einfach umzusetzten, daher an dieser Stelle kein Download sondern eine Anleitung.
1. SQL QUERY ausführen:
SQL-Code:
INSERT INTO configuration SET configuration_key="DEFAULT_SEARCH_TEMPLATE", configurationvalue="", configuration_group_id=22, sort_order=30,set_function="xtc_cfg_pull_template_selector(";
2. den codeblock
PHP-Code:
in includes/modules/product_listing.php gegen
// get default template
if ($category['listing_template'] == '' or $category['listing_template'] == 'default') {
$files = array ();
if ($dir = opendir(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_listing/')) {
while (($file = readdir($dir)) !== false) {
if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_listing/'.$file) and ($file != "index.html") and (substr($file, 0, 1) !=".")) {
$files[] = array ('id' => $file, 'text' => $file);
} //if
} // while
closedir($dir);
}
$category['listing_template'] = $files[0]['id'];
}
PHP-Code:
austauschen
if ($category['listing_template'] == '' or $category['listing_template'] == 'default') {
$category['listing_template'] = DEFAULT_SEARCH_TEMPLATE;
}
3. in lang/german/admin/german.php
PHP-Code:
einfügen
define('DEFAULT_SEARCH_TEMPLATE_TITLE','Standard Suchergebnis-Template');
define('DEFAULT_SEARCH_TEMPLATE_DESC','Standard Suchergebnis-Template');
4. in admin/includes/application_top.php
PHP-Code:
einfügen (vor
function xtc_cfg_pull_template_selector(){
$files = array ();
if ($dir = opendir(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_listing/')) {
while (($file = readdir($dir)) !== false) {
if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_listing/'.$file) and ($file != "index.html") and (substr($file, 0, 1) !=".")) {
$files[] = array ('id' => $file, 'text' => $file);
} //if
} // while
closedir($dir);
}
$ret='<select name="DEFAULT_SEARCH_TEMPLATE">
<option value="'.$file['id'].'">'.$file['id'].'</option></select>';
return $ret;
}
PHP-Code:
).
// Include Template Engine
require(DIR_FS_CATALOG.DIR_WS_CLASSES . 'Smarty_2.6.14/Smarty.class.php');
Das wars schon, jetzt könnt Ihr im Admin-Bereich unter Such-Optionen das Template für die Suchergebnisseite festlegen.
Ich hoffe es nützt dem einen oder anderen
von SMT-WebServices
veröffentlicht in:
about:xt:Commerce
Kommentar hinzufügen Kommentare (0) empfehlen
Kommentar hinzufügen Kommentare (0) empfehlen




