Eintragsdetails ansehen

IDProjektKategorieSichtbarkeitZuletzt aktualisiert
0000093WEB-ShopFrontendöffentlich24.10.2009 15:48
Reporterhein-tobiBearbeitung durch 
PrioritätniedrigSchweregradUnschönheitReproduzierbarimmer
Status neuLösungoffen 
ProduktversionDevelopment 
Zielversion1.1 
Zusammenfassung0000093: Herstellerseite
BeschreibungDie geänderte produt_listing.php zur Anzeige des Herstellerbildes und der Beschreibung des Herstellers

<?php
/* -----------------------------------------------------------------------------------------
$Id: product_listing.php 1286 2005-10-07 10:10:18Z mz $

XT-Commerce - community made shopping
http://www.xt-commerce.com

Copyright (c) 2003 XT-Commerce
-----------------------------------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(product_listing.php,v 1.42 2003/05/27); www.oscommerce.com
(c) 2003 nextcommerce (product_listing.php,v 1.19 2003/08/1); www.nextcommerce.org

Released under the GNU General Public License
---------------------------------------------------------------------------------------*/

$module_smarty = new Smarty;
$module_smarty -> assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/');
$result = true;

// include needed functions
require_once (DIR_FS_INC.'xtc_get_all_get_params.inc.php');
require_once (DIR_FS_INC.'xtc_get_vpe_name.inc.php');

if(isset($_POST['products_per_site'])) {
    $_SESSION['products_per_site'] = (int) $_POST['products_per_site'];
}

if(!isset($_SESSION['products_per_site'])) $_SESSION['products_per_site'] = MAX_DISPLAY_SEARCH_RESULTS;
$listing_split = new splitPageResults($listing_sql, (int)$_GET['page'], $_SESSION['products_per_site'], 'p.products_id');

$module_content = array ();
if ($listing_split -> number_of_rows > 0) {

    $navigation_smarty = new Smarty();
    $page_links = $listing_split -> getLinksArray(MAX_DISPLAY_PAGE_LINKS, xtc_get_all_get_params(array ('page', 'info', 'x', 'y')));

    $navigation_smarty -> assign('LINKS', $page_links);
    $navigation_smarty -> assign('language', $_SESSION['language']);
    $navigation_smarty -> assign('tpl_path', 'templates/'.CURRENT_TEMPLATE.'/');
    $navigation = $navigation_smarty -> fetch(CURRENT_TEMPLATE.'/module/page_navigation.html');

    if($current_category_id) {
    if (GROUP_CHECK == 'true') {
      $group_check = "and c.group_permission_".$_SESSION['customers_status']['customers_status_id']."=1 ";
    }
    $category_query = xtDBquery("SELECT cd.categories_description, cd.categories_name,
                                        cd.categories_heading_title, c.listing_template, c.categories_image
                                 FROM ".TABLE_CATEGORIES." c, ".TABLE_CATEGORIES_DESCRIPTION." cd
                                 WHERE c.categories_id = '".$current_category_id."'
                                 AND cd.categories_id = '".$current_category_id."'
                                 ".$group_check."
                                 AND cd.language_id = '".$_SESSION['languages_id']."'");

    $category = xtc_db_fetch_array($category_query,true);
    
    if ($category['categories_image'] != '') {
      $image = $category['categories_image'];
    }
    $module_smarty -> assign('CATEGORIES_NAME', $category['categories_name']);
    $module_smarty -> assign('CATEGORIES_HEADING_TITLE', $category['categories_heading_title']);

    $module_smarty -> assign('CATEGORIES_IMAGE', $image);
    $module_smarty -> assign('CATEGORIES_DESCRIPTION', $category['categories_description']);
  } else if(isset ($_GET['manufacturers_id'])) {
    $manufacturer_query = xtDBQuery("SELECT m.manufacturers_name,
                                            m.manufacturers_image,
                                            mi.manufacturers_url,
                                            mi.manufacturers_description
                                     FROM ".TABLE_MANUFACTURERS." m,
                                          ".TABLE_MANUFACTURERS_INFO." mi
                                     WHERE m.manufacturers_id = '".(int)$_GET['manufacturers_id']."'
                                     AND m.manufacturers_id = mi.manufacturers_id
                                     AND mi.languages_id = '".(int)$_SESSION['languages_id']."'");
    $manufacturer = xtc_db_fetch_array($manufacturer_query, true);
    
    if($manufacturer['manufacturers_image'] != '') {
      $image = DIR_WS_IMAGES . 'manufacturers/info_images/' . $manufacturer['manufacturers_image'];
    }
    $module_smarty -> assign('CATEGORIES_NAME', $manufacturer['manufacturers_name']);
    $module_smarty -> assign('CATEGORIES_HEADING_TITLE', $manufacturer['manufacturers_name']);

    $module_smarty -> assign('CATEGORIES_IMAGE', $image);
    $module_smarty -> assign('CATEGORIES_DESCRIPTION', $manufacturer['manufacturers_description']);
  }
    
  $rows = 0;
    $listing_query = xtDBquery($listing_split -> sql_query);
    while ($listing = xtc_db_fetch_array($listing_query, true)) {
        $rows ++;
        $module_content[] = $product -> buildDataArray($listing);
    }

} else {

    // no product found
    $result = false;

}

// 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'];
}

if ($result != false) {

    $module_smarty -> assign('MANUFACTURER_DROPDOWN', $manufacturer_dropdown);
    $module_smarty -> assign('module_content', $module_content);
    $module_smarty -> assign('language', $_SESSION['language']);
    $module_smarty -> assign('NAVIGATION', $navigation);
    $module_smarty -> assign('products_sort_file', $_SERVER['REQUEST_URI']);
    $products_sortby = $module_smarty -> fetch(CURRENT_TEMPLATE.'/module/products_sorting.html');
    $products_persite = $module_smarty -> fetch(CURRENT_TEMPLATE.'/module/products_per_site.html');
    $module_smarty -> assign('PRODUCTS_SORTBY', $products_sortby);
    $module_smarty -> assign('PRODUCTS_PER_SITE', $products_persite);
    // set cache ID
    if (!CacheCheck()) {
        $module_smarty -> caching = 0;
        $module = $module_smarty -> fetch(CURRENT_TEMPLATE.'/module/product_listing/'.$category['listing_template']);
    } else {
        $module_smarty -> caching = 1;
        $module_smarty -> cache_lifetime = CACHE_LIFETIME;
        $module_smarty -> cache_modified_check = CACHE_CHECK;
        $cache_id = $current_category_id.'_'.$_SESSION['language'].'_'.$_SESSION['customers_status']['customers_status_name'].'_'.$_SESSION['currency'].'_'.$_GET['manufacturers_id'].'_'.$_GET['filter_id'].'_'.$_GET['page'].'_'.$_GET['keywords'].'_'.$_GET['categories_id'].'_'.$_GET['pfrom'].'_'.$_GET['pto'].'_'.$_GET['x'].'_'.$_GET['y'];
        $module = $module_smarty -> fetch(CURRENT_TEMPLATE.'/module/product_listing/'.$category['listing_template'], $cache_id);
    }
    $smarty -> assign('main_content', $module);

} else {

    $error = TEXT_PRODUCT_NOT_FOUND;
    include (DIR_WS_MODULES.FILENAME_ERROR_HANDLER);

}
?>

In der Datei default.php muss der Block auskommentiert werden
    if ( isset ($_GET['manufacturers_id']) ) {
            $image = xtDBquery("SELECT manufacturers_image
                                FROM " . TABLE_MANUFACTURERS."
                                WHERE manufacturers_id = '".(int) $_GET['manufacturers_id']."'");
            $image = xtc_db_fetch_array($image, true);
      $image = $image['manufacturers_image'];
        }
    
    elseif ( $current_category_id ) {
            $image = xtDBquery("SELECT categories_image
                                FROM " . TABLE_CATEGORIES . "
                                WHERE categories_id = '".$current_category_id."'");
            $image = xtc_db_fetch_array($image, true);
            $image = $image['categories_image'];
        }

TagsKeine Tags zugeordnet.

Notizen / Dateien

hein-tobi

29.03.2009 11:55

Reporter   ~0000039

Das ganze ist nicht schön da 'manufacturers/info_images/' . $manufacturer['manufacturers_image'] hart codiert ist.
Vielleicht sollte das Imageprocessing auch auf Kategorien ausgeweitet werden

hein-tobi

29.03.2009 12:25

Reporter   ~0000040

Ist noch ein Fehler drin statt

$image = $category['categories_image'];

muss es

$image = DIR_WS_IMAGES . 'categories/' . $category['categories_image'];

sein

Eintrags-Historie

Änderungsdatum Benutzername Feld Änderung
29.03.2009 11:53 hein-tobi Neuer Eintrag
29.03.2009 11:55 hein-tobi Notiz hinzugefügt: 0000039
29.03.2009 12:25 hein-tobi Notiz hinzugefügt: 0000040
12.09.2009 20:50 xantiva Kategorie Backend / Core => newFrontend
12.09.2009 21:16 xantiva Kategorie newFrontend =>
24.10.2009 15:48 xantiva Zielversion => 1.1