Marktplatz - Eine große Auswahl an neuen und hilfreichen Modulen sowie modernen Templates für die modified eCommerce Shopsoftware
Neuigkeiten
  • Die modified eCommerce Shopsoftware ist kostenlos, aber nicht umsonst.
    Spenden
  • Damit wir die modified eCommerce Shopsoftware auch zukünftig kostenlos anbieten können:
    Spenden
  • Thema: Herstellerbild im Listing

    Tonka

    • Fördermitglied
    • Beiträge: 103
    • Geschlecht:
    Herstellerbild im Listing
    am: 25. September 2014, 10:18:29
    Hallo Ihr fleißigen Bienchen,

    ich versuche Krampfhaft mit {$MANUFACTURER_IMAGE}
    in der produkt_listing_v1.html ein Herstellerbild auszugeben.

    was mache ich denn falsch?

    MFG Tonka

    Linkback: https://www.modified-shop.org/forum/index.php?topic=31117.0

    mkcomputer

    • Frisch an Board
    • Beiträge: 89
    • Geschlecht:
    Re: Herstellerbild im Listing
    Antwort #1 am: 25. September 2014, 11:35:06
    Wenn ich mich nicht irre ist genau das hier das richtige.

    Schau mal hier ;)
    http://www.gunnart.de/tipps-und-tricks/xtcommerce-hersteller-logo-und-herstellernamen-anzeigen/

    Übrigens super für die Frage, das kann ich auch gut gebrauchen xD

    karsta.de

    • Experte
    • Beiträge: 3.074
    Re: Herstellerbild im Listing
    Antwort #2 am: 25. September 2014, 12:06:12
    Das ist eigentlich doch schon im Modified-Shop enthalten und wird hier ausgegeben template/xtc5/module/product_listing/product_listing_v1.html :

    Code: PHP  [Auswählen]
    {if $CATEGORIES_IMAGE}<img src="{$CATEGORIES_IMAGE}" alt="{$CATEGORIES_NAME}" class="imgLeft" /><br />{/if}

    denn die Aufforderung dazu steht in der includes/modules/product_listing.php hier:
    Code: PHP  [Auswählen]
      if (isset ($_GET['manufacturers_id']) && $_GET['manufacturers_id'] > 0) {
        $manu_query = xtDBquery("select manufacturers_image, manufacturers_name from ".TABLE_MANUFACTURERS." where manufacturers_id = '".(int) $_GET['manufacturers_id']."'");
        $manu = xtc_db_fetch_array($manu_query,true);
        $category['categories_name'] = $manu['manufacturers_name'];

        if ($manu['manufacturers_image'] != '') {
          $image = DIR_WS_IMAGES.$manu['manufacturers_image'];
          if(!file_exists($image)) $image = '';
        }

      }
      //EOF -web28- 2010-08-06 - BUGFIX no manufacturers image displayed

    Tonka

    • Fördermitglied
    • Beiträge: 103
    • Geschlecht:
    Re: Herstellerbild im Listing
    Antwort #3 am: 25. September 2014, 12:31:17
    Hey vielen dank für den Link,

    den hatte ich auch schon gefunden kann damit aber leider nicht wirklich was anfangen.

    in die includes/modules/product_listing.php habe ich folgendes eingefügt.

    Code: PHP  [Auswählen]

    function getManufacturersData_by_ManufacturersID($ManufacturersID=false) {
            if($ManufacturersID) {
                    $ManufacturersDataQuery = xtDBquery("
                                                                    SELECT manufacturers_name, manufacturers_image
                                                                    FROM "
    .TABLE_MANUFACTURERS."
                                                                    WHERE manufacturers_id = '"
    .$ManufacturersID."'
                                                                    "
    );
                    $ManufacturersDataQuery = xtc_db_fetch_array($ManufacturersDataQuery,true);
                    $ManufacturersData['name'] = $ManufacturersDataQuery['manufacturers_name'];
                    $ManufacturersData['imageurl'] = $ManufacturersDataQuery['manufacturers_image'];
            }
            if(empty($ManufacturersData['name']))
                    $ManufacturersData['name'] = false;    
            if(empty($ManufacturersData['imageurl']))
                    $ManufacturersData['imageurl'] = false;
            return $ManufacturersData;
    }

    function getManufacturersID_by_ProductsID($ProdID=false) {
            if($ProdID) {
                    $ManufacturersIDQuery = xtDBquery("
                                                                    SELECT manufacturers_id
                                                                    FROM "
    .TABLE_PRODUCTS."
                                                                    WHERE products_id = '"
    .$ProdID."'
                                                                    "
    );
                    $ManufacturersIDQuery = xtc_db_fetch_array($ManufacturersIDQuery,true);
            }
            $ManufacturersID = $ManufacturersIDQuery['manufacturers_id'];
            if(empty($ManufacturersID))
                    return false;
            else
                    return $ManufacturersID;
    }

    function smarty_modifier_ManufacturersData_by_ProductsID($ProdID, $Which='name') {
            $Which = strtolower($Which);
            if($ProdID) {
                    $ManufacturersID = getManufacturersID_by_ProductsID($ProdID);
                    $ManufacturersData = getManufacturersData_by_ManufacturersID($ManufacturersID);
                    if ($Which == 'imageurl')
                            return $ManufacturersData['imageurl'];
                    else if ($Which == 'image' && $ManufacturersData['imageurl'])
                            return '<img src="'.DIR_WS_IMAGES.$ManufacturersData['imageurl'].'" alt="'.$ManufacturersData['name'].'" />';
                    else
                            return $ManufacturersData['name'];
            } else {
                    return false;
            }
    }

     

    und in die product_listing_v1.html habe ich
    Code: PHP  [Auswählen]
    {$module_data.PRODUCTS_ID|ManufacturersData_by_ProductsID:'image'}

    aber es kommt nur das icon/fehlendes Bild

    wer weiß Rat?

    MFG

    Tonka

    • Fördermitglied
    • Beiträge: 103
    • Geschlecht:
    Re: Herstellerbild im Listing
    Antwort #4 am: 25. September 2014, 12:35:09
    Das ist eigentlich doch schon im Modified-Shop enthalten und wird hier ausgegeben template/xtc5/module/product_listing/product_listing_v1.html :

    Code: PHP  [Auswählen]
    {if $CATEGORIES_IMAGE}<img src="{$CATEGORIES_IMAGE}" alt="{$CATEGORIES_NAME}" class="imgLeft" /><br />{/if}

    Danke für die Info aber

    Code: PHP  [Auswählen]
    {if $MANUFACTURER_IMAGE}<img src="{$MANUFACTURER_IMAGE}" alt="{$MANUFACTURER}" class="imgLeft" /><br />{/if}

    funktioniert leider nicht :(

    oder habe ich etwas übersehen?

    hpzeller

    • Experte
    • Beiträge: 4.130
    • Geschlecht:
    Re: Herstellerbild im Listing
    Antwort #5 am: 25. September 2014, 12:44:34
    hallo Tonka

    In die 'includes/modules/product_listing.php' musst Du nichts einbauen, die heruntegeladen Datei ist ein Smarty-Plugin und kommt in folgendes Verzeichnis 'includes/classes/Smarty_2.6.27/plugins/modifier.ManufacturersData_by_ProductsID.php'.

    PS:
    Zum Verständnis, das von 'mkcomputer' vorgeschlagene Plugin ist dazu gedacht z.B. in Produktlisten zu jedem Produkt den Hersteller-Namen, Hersteller-Bild, und oder die Hersteller-URL auszugeben.

    Gruss
    Hanspeter

    karsta.de

    • Experte
    • Beiträge: 3.074
    Re: Herstellerbild im Listing
    Antwort #6 am: 25. September 2014, 12:45:16
    @Tonka
    Hänge doch bitte mal deine product_listing.php ungeändert hier ran.

    Tonka

    • Fördermitglied
    • Beiträge: 103
    • Geschlecht:
    Re: Herstellerbild im Listing
    Antwort #7 am: 25. September 2014, 13:09:52
    da isse :)

    Code: PHP  [Auswählen]

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

       XT-Commerce - community made shopping
       http://www.(( Wir dulden keine kommerziellen Werbelinks - Bitte <a href="index.php?topic=3013.0">Forenregeln</a> beachten! ))

       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');
    $listing_split = new splitPageResults($listing_sql, (isset($_GET['page']) ? (int)$_GET['page'] : 1), MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');
    $module_content = array ();
    $category = array();

    if ($listing_split->number_of_rows > 0) {

      $navigation = '
        <table>
          <tr>
            <td class="smallText">'
    .$listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS).'</td>
            <td class="smallText">'
    .TEXT_RESULT_PAGE.' '.$listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, xtc_get_all_get_params(array ('page', 'info', 'x', 'y', 'keywords')).(isset($_GET['keywords'])?'&keywords='. urlencode($_GET['keywords']):'')).'</td>
          </tr>
        </table>'
    ;
      $group_check = '';
      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']."'
                                    LIMIT 1"
    );
      $category = xtc_db_fetch_array($category_query,true);
      $image = '';
      if ($category['categories_image'] != '') {
        $image = DIR_WS_IMAGES.'categories/'.$category['categories_image'];
        if(!file_exists($image)) $image = DIR_WS_IMAGES.'categories/noimage.gif';
      }













      if (isset ($_GET['manufacturers_id']) && $_GET['manufacturers_id'] > 0) {
        $manu_query = xtDBquery("select manufacturers_image, manufacturers_name from ".TABLE_MANUFACTURERS." where manufacturers_id = '".(int) $_GET['manufacturers_id']."'");
        $manu = xtc_db_fetch_array($manu_query,true);
        $category['categories_name'] = $manu['manufacturers_name'];

        if ($manu['manufacturers_image'] != '') {
          $image = DIR_WS_IMAGES.$manu['manufacturers_image'];
          if(!file_exists($image)) $image = '';
        }


     
      }
      //EOF -web28- 2010-08-06 - BUGFIX no manufacturers image displayed

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

    if ($result != false) {
      // get default template
      if (!array_key_exists('listing_template', $category) || $category['listing_template'] == '' || $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 (substr($file, -5) == ".html") and ($file != "index.html") and (substr($file, 0, 1) !=".")) {
              $files[] = $file;
            }
          }
          closedir($dir);
        }
        sort($files);
        $category['listing_template'] = $files[0];
      }

      $module_smarty->assign('MANUFACTURER_DROPDOWN', (isset($manufacturer_dropdown) ? $manufacturer_dropdown : ''));
      $module_smarty->assign('language', $_SESSION['language']);
      $module_smarty->assign('module_content', $module_content);
      $module_smarty->assign('NAVIGATION', $navigation);
       
    if(MODULE_QUANTITY_STATUS == 'true') {
            $module_smarty->assign('MODULE_QUANTITY_STATUS', 'true');
           
            if(MODULE_QUANTITY_LIGHT_STATUS == 'true') {
                    $module_smarty->assign('MODULE_QUANTITY_LIGHT_STATUS', 'true');
            } else {
                    $module_smarty->assign('MODULE_QUANTITY_LIGHT_STATUS', 'false');
            }

            $module_smarty->assign('MODULE_QUANTITY_GREEN', MODULE_QUANTITY_GREEN);
            $module_smarty->assign('MODULE_QUANTITY_YELLOW', MODULE_QUANTITY_YELLOW);
            $module_smarty->assign('MODULE_QUANTITY_RED', MODULE_QUANTITY_RED);    

    }

      // 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;

        //setting/clearing params
        $get_params = isset($_GET['manufacturers_id']) && xtc_not_null($_GET['manufacturers_id']) ? '_'.(int)$_GET['manufacturers_id'] : '';
        $get_params .= isset($_GET['filter_id']) && xtc_not_null($_GET['filter_id']) ? '_'.(int)$_GET['filter_id'] : '';
        $get_params .= isset($_GET['page']) && $_GET['page'] > 0  ? '_'.(int)$_GET['page'] : '';
        $get_params .= isset($_GET['categories_id']) && xtc_not_null($_GET['categories_id']) ? '_'.(int)$_GET['categories_id'] : '';
        $get_params .= isset($_GET['keywords']) && !empty($_GET['keywords']) ? '_'.stripslashes(trim(urldecode($_GET['keywords']))) : '';
        $get_params .= isset($_GET['pfrom']) && !empty($_GET['pfrom']) ? '_'.stripslashes($_GET['pfrom']) : '';
        $get_params .= isset($_GET['pto']) && !empty($_GET['pto']) ? '_'.stripslashes($_GET['pto']) : '';
        $get_params .= isset($_GET['x']) && $_GET['x'] >= 0 ? '_'.(int)$_GET['x'] : '';
        $get_params .= isset($_GET['y']) && $_GET['y'] >= 0 ? '_'.(int)$_GET['y'] : '';

        $cache_id = $current_category_id.'_'.$_SESSION['language'].'_'.$_SESSION['customers_status']['customers_status_name'].'_'.$_SESSION['currency'].$get_params;
        $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);
    }





    function getManufacturersData_by_ManufacturersID($ManufacturersID=false) {
            if($ManufacturersID) {
                    $ManufacturersDataQuery = xtDBquery("
                                                                    SELECT manufacturers_name, manufacturers_image
                                                                    FROM "
    .TABLE_MANUFACTURERS."
                                                                    WHERE manufacturers_id = '"
    .$ManufacturersID."'
                                                                    "
    );
                    $ManufacturersDataQuery = xtc_db_fetch_array($ManufacturersDataQuery,true);
                    $ManufacturersData['name'] = $ManufacturersDataQuery['manufacturers_name'];
                    $ManufacturersData['imageurl'] = $ManufacturersDataQuery['manufacturers_image'];
            }
            if(empty($ManufacturersData['name']))
                    $ManufacturersData['name'] = false;    
            if(empty($ManufacturersData['imageurl']))
                    $ManufacturersData['imageurl'] = false;
            return $ManufacturersData;
    }

    function getManufacturersID_by_ProductsID($ProdID=false) {
            if($ProdID) {
                    $ManufacturersIDQuery = xtDBquery("
                                                                    SELECT manufacturers_id
                                                                    FROM "
    .TABLE_PRODUCTS."
                                                                    WHERE products_id = '"
    .$ProdID."'
                                                                    "
    );
                    $ManufacturersIDQuery = xtc_db_fetch_array($ManufacturersIDQuery,true);
            }
            $ManufacturersID = $ManufacturersIDQuery['manufacturers_id'];
            if(empty($ManufacturersID))
                    return false;
            else
                    return $ManufacturersID;
    }

    function smarty_modifier_ManufacturersData_by_ProductsID($ProdID, $Which='name') {
            $Which = strtolower($Which);
            if($ProdID) {
                    $ManufacturersID = getManufacturersID_by_ProductsID($ProdID);
                    $ManufacturersData = getManufacturersData_by_ManufacturersID($ManufacturersID);
                    if ($Which == 'imageurl')
                            return $ManufacturersData['imageurl'];
                    else if ($Which == 'image' && $ManufacturersData['imageurl'])
                            return '<img src="'.DIR_WS_IMAGES.$ManufacturersData['imageurl'].'" alt="'.$ManufacturersData['name'].'" />';
                    else
                            return $ManufacturersData['name'];
            } else {
                    return false;
            }
    }





    ?>



     

    Tonka

    • Fördermitglied
    • Beiträge: 103
    • Geschlecht:
    Re: Herstellerbild im Listing
    Antwort #8 am: 25. September 2014, 13:13:26
    Hallo Hanspeter

    PS:
    Zum Verständnis, das von 'mkcomputer' vorgeschlagene Plugin ist dazu gedacht z.B. in Produktlisten zu jedem Produkt den Hersteller-Namen, Hersteller-Bild, und oder die Hersteller-URL auszugeben.

    Gruss
    Hanspeter

    Genau das ist mei Begehr :)

    habe die modifier datei ins plugin verzeichnis verfrachtet jetzt muss man die bestimmt noch einbinden oder?

    Tonka

    • Fördermitglied
    • Beiträge: 103
    • Geschlecht:
    Re: Herstellerbild im Listing
    Antwort #9 am: 25. September 2014, 13:34:32
    BLIIIIINNNND

    schau mal was in der product_listing.php drinnen steht
    Code: PHP  [Auswählen]
     //EOF -web28- 2010-08-06 - BUGFIX no manufacturers image displayed
     

    was können wir jetzt machen

    MFG TONKA XD

    hpzeller

    • Experte
    • Beiträge: 4.130
    • Geschlecht:
    Re: Herstellerbild im Listing
    Antwort #10 am: 25. September 2014, 13:40:56
    Hallo Hanspeter

    PS:
    Zum Verständnis, das von 'mkcomputer' vorgeschlagene Plugin ist dazu gedacht z.B. in Produktlisten zu jedem Produkt den Hersteller-Namen, Hersteller-Bild, und oder die Hersteller-URL auszugeben.

    Gruss
    Hanspeter

    Genau das ist mei Begehr :)

    habe die modifier datei ins plugin verzeichnis verfrachtet jetzt muss man die bestimmt noch einbinden oder?

    Nein das Plugin musst Du nicht einbinden, das einzige was Du jetzt noch tun musst ist folgendes.

    Suche in der product_listing_v1.html folgende Zeile
    Code: PHP  [Auswählen]
    {foreach name=aussen item=module_data from=$module_content}
     
    und füge unmittelbar danach folgendes ein
    Code: PHP  [Auswählen]
    {$module_data.PRODUCTS_ID|ManufacturersData_by_ProductsID:'name'}
    {$module_data.PRODUCTS_ID|ManufacturersData_by_ProductsID:'image'}
    {$module_data.PRODUCTS_ID|ManufacturersData_by_ProductsID:'imageurl'}
     

    danach solltest Du in der Produktliste eine veränderte Ausgabe sehen.

    Gruss
    Hanspeter

    karsta.de

    • Experte
    • Beiträge: 3.074
    Re: Herstellerbild im Listing
    Antwort #11 am: 25. September 2014, 13:42:05
    Bitte mache vorher eine Kopie deiner eigenen Datei.

    Ersetze mal die hier angehangene Datei mit deiner product_listing.php.
    (includes/modules/product_listing.php)

    Schreibe dann in die template/xtc5/module/product_listing/product_listing_v1.html folgendes:

    Code: PHP  [Auswählen]
    {if $MANUFACTURERS_IMAGE != ''}<img src="{$MANUFACTURERS_IMAGE}" alt="{$MANUFACTURERS_NAME}" title="{$MANUFACTURERS_NAME}"  />{/if}

    Tonka

    • Fördermitglied
    • Beiträge: 103
    • Geschlecht:
    Re: Herstellerbild im Listing
    Antwort #12 am: 25. September 2014, 14:15:17
    Hallo Hanspeter,

    vielen Dank für deine Hilfe ich habe alles schon genau so eingebunden aber der Shop streikt
    das will er einfach nicht machen. ich versuch es jetzt mit den üblichen
    Code: PHP  [Auswählen]
    { if $MANUFACTURERS_ID =='1'}
    <img src="pfad zum Bild">
    {/if}
     

    Hallo kgd
    auch dir vielen vielen dank aber leider klappts auch so nicht :(

    versteh es selber nicht son dreck...

    vielleicht hat ja jemand noch ne andere idee?
    1 Antworten
    2045 Aufrufe
    11. Juli 2010, 00:11:22 von hendrik
    3 Antworten
    2575 Aufrufe
    15. April 2012, 12:28:31 von stef
    20 Antworten
    9693 Aufrufe
    09. August 2010, 16:32:22 von rayzob
    3 Antworten
    2373 Aufrufe
    15. Juni 2013, 02:23:03 von noRiddle (revilonetz)