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: ANLEITUNG: Attribut Dropdown Anzeige ergänzen mit "bitte wählen"

    peril

    • Frisch an Board
    • Beiträge: 71
    ACHTUNG: Ein Modul für Shopversion 2.x gibt es hier: MODUL: Attributauswahl als Pflichtfeld und vorbelegt mit "Bitte wählen"

    Hallo,

    habe schon in einem Thread, bei dem es darum ging den "bitte wählen" Eintrag aus dem Hersteller Dropdown zu entfernen, gepostet.

    Da es aber ein eigenes Thema ist und es bisher noch kein Feedback dazu gab, habe ich mich entschlossen noch einmal einen eignen Thread zu eröffnen.

    Es geht um folgendes Problem:

    Ich liste meine Artikel-Attribute als Dropdown in den jeweiligen Artikeln auf.
    Diese Ausgabe habe ich etwas erweitert. Jetzt wird dort im Dropdown auch der Lagerbestand angezeigt.

    Beispiel:
    Größe:
    S <<Artikel auf Lager

    Nun ist es aber leider nicht immer so das der Artikel S auf Lager ist geschweige denn die Dropdownliste in irgendeiner verständlichen Reihung angezeigt wird. So kommt es dann ab und zu mal vor das dann dort folgendes steht.

    Größe:
    L <<Artikel ausverkauft

    Ich vermute das es den ein oder anderen Kunden vielleicht verwirrt oder irritiert. Deswegen wollte ich mir abhilfe schaffen in dem ich dort standardmäßig den Eintrag

    Größe:
    Bitte wählen

    anzeige.

    Hat jemand eine Ahnung was ich genau in der includes/modules/product_attributes.php anpassen muss um so ein "bitte wählen" voranzustellen?

    Ich würde mich sehr über eure Tips und Hilfe freuen.

    Lieben Gruß

    Peril

    ACHTUNG: Ein Modul für Shopversion 2.x gibt es hier: MODUL: Attributauswahl als Pflichtfeld und vorbelegt mit "Bitte wählen"

    [EDIT Tomcraft 15.07.2011: Hier geht es direkt zur Anleitung von GTB.]
    [EDIT Tomcraft 16.10.2017: Modul für Shopversion 2.x verlinkt.]

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

    peril

    • Frisch an Board
    • Beiträge: 71
    Hier noch einmal der Inhalt der product_attributes.php

    Code: PHP  [Auswählen]
    <?php

    /* -----------------------------------------------------------------------------------------
       $Id: product_attributes.php 1255 2005-09-28 15:10:36Z 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_info.php,v 1.94 2003/05/04); www.oscommerce.com
       (c) 2003      nextcommerce (product_info.php,v 1.46 2003/08/25); www.nextcommerce.org

       Released under the GNU General Public License
       -----------------------------------------------------------------------------------------
       Third Party contribution:
       Customers Status v3.x  (c) 2002-2003 Copyright Elari elari@free.fr | www.unlockgsm.com/dload-osc/ | CVS : http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/elari/?sortby=date#dirlist
       New Attribute Manager v4b                            Autor: Mike G | mp3man@internetwork.net | http://downloads.ephing.com
       Cross-Sell (X-Sell) Admin 1                          Autor: Joshua Dechant (dreamscape)
       Released under the GNU General Public License
       ---------------------------------------------------------------------------------------*/


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

    if ($product->getAttributesCount()> 0) {
    // BOF - Tomcraft - 2009-11-07 - Added sortorder to products_options
            //$products_options_name_query = xtDBquery("select distinct popt.products_options_id, popt.products_options_name from ".TABLE_PRODUCTS_OPTIONS." popt, ".TABLE_PRODUCTS_ATTRIBUTES." patrib where patrib.products_id='".$product->data['products_id']."' and patrib.options_id = popt.products_options_id and popt.language_id = '".(int) $_SESSION['languages_id']."' order by popt.products_options_name");
            $products_options_name_query = xtDBquery("select distinct popt.products_options_id, popt.products_options_name from ".TABLE_PRODUCTS_OPTIONS." popt, ".TABLE_PRODUCTS_ATTRIBUTES." patrib where patrib.products_id='".$product->data['products_id']."' and patrib.options_id = popt.products_options_id and popt.language_id = '".(int) $_SESSION['languages_id']."' order by popt.products_options_sortorder, popt.products_options_id");
    // EOF - Tomcraft - 2009-11-07 - Added sortorder to products_options
            $row = 0;
            $col = 0;
            $products_options_data = array ();
            while ($products_options_name = xtc_db_fetch_array($products_options_name_query,true)) {
                    $selected = 0;
                    $products_options_array = array ();

                    $products_options_data[$row] = array ('NAME' => $products_options_name['products_options_name'], 'ID' => $products_options_name['products_options_id'], 'DATA' => '');
                    $products_options_query = xtDBquery("select pov.products_options_values_id,
                                                                     pov.products_options_values_name,
                                                                     pa.attributes_model,
                                                                     pa.options_values_price,
                                                                     pa.price_prefix,
                                                                     pa.attributes_stock,
                                                                     pa.attributes_model
                                                                      from "
    .TABLE_PRODUCTS_ATTRIBUTES." pa,
                                                                     "
    .TABLE_PRODUCTS_OPTIONS_VALUES." pov
                                                                     where pa.products_id = '"
    .$product->data['products_id']."'
                                                                     and pa.options_id = '"
    .$products_options_name['products_options_id']."'
                                                                     and pa.options_values_id = pov.products_options_values_id
                                                                     and pov.language_id = '"
    .(int) $_SESSION['languages_id']."'
                                                                     order by pa.sortorder"
    );
                    $col = 0;
                    while ($products_options = xtc_db_fetch_array($products_options_query,true)) {
                            $price = '';
                            if ($_SESSION['customers_status']['customers_status_show_price'] == '0') {
                                    $products_options_data[$row]['DATA'][$col] = array ('ID' => $products_options['products_options_values_id'], 'TEXT' => $products_options['products_options_values_name'], 'MODEL' => $products_options['attributes_model'],
                                    // Lagerampel
                                    'STOCK' => $products_options['attributes_stock'],
                                    // Lagerampel
                                    'PRICE' => '', 'FULL_PRICE' => '', 'PREFIX' => $products_options['price_prefix']);
                            } else {
                                    if ($products_options['options_values_price'] != '0.00') {
                                            $price = $xtPrice->xtcFormat($products_options['options_values_price'], false, $product->data['products_tax_class_id']);
                                    }

                                    $products_price = $xtPrice->xtcGetPrice($product->data['products_id'], $format = false, 1, $product->data['products_tax_class_id'], $product->data['products_price']);
                                    if ($_SESSION['customers_status']['customers_status_discount_attributes'] == 1 && $products_options['price_prefix'] == '+')
                                            $price -= $price / 100 * $discount;

                                            $attr_price=$price;
                                            if ($products_options['price_prefix']=="-") $attr_price=$price*(-1);
                                            $full = $products_price + $attr_price;
                                    $products_options_data[$row]['DATA'][$col] = array ('ID' => $products_options['products_options_values_id'], 'TEXT' => $products_options['products_options_values_name'], 'MODEL' => $products_options['attributes_model'],
                                    // Lagerampel
                                    'STOCK' => $products_options['attributes_stock'],
                                    // Lagerampel
                                     'PRICE' => $xtPrice->xtcFormat($price, true), 'FULL_PRICE' => $xtPrice->xtcFormat($full, true), 'PREFIX' => $products_options['price_prefix']);

                                    //if PRICE for option is 0 we don't need to display it
                                    if ($price == 0) {
                                            unset ($products_options_data[$row]['DATA'][$col]['PRICE']);
                                            unset ($products_options_data[$row]['DATA'][$col]['PREFIX']);
                                    }

                            }
                            $col ++;
                    }
                    $row ++;
            }

    }

    if ($product->data['options_template'] == '' or $product->data['options_template'] == 'default') {
            $files = array ();
            if ($dir = opendir(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_options/')) {
                    while (($file = readdir($dir)) !== false) {
    // BOF - Tomcraft - 2010-02-04 - Prevent modified eCommerce Shopsoftware from fetching other files than *.html
                            //if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_options/'.$file) and ($file != "index.html") and (substr($file, 0, 1) !=".")) {
                            if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_options/'.$file) and (substr($file, -5) == ".html") and ($file != "index.html") and (substr($file, 0, 1) !=".")) {
    // EOF - Tomcraft - 2010-02-04 - Prevent modified eCommerce Shopsoftware from fetching other files than *.html
                                    $files[] = array ('id' => $file, 'text' => $file);
                            } //if
                    } // while
                    closedir($dir);
            }
            $product->data['options_template'] = $files[0]['id'];
    }

    $module_smarty->assign('language', $_SESSION['language']);
    $module_smarty->assign('options', $products_options_data);
    // set cache ID

            $module_smarty->caching = 0;
            $module = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/product_options/'.$product->data['options_template']);

    $info_smarty->assign('MODULE_product_options', $module);
    ?>
     
    Ich vermute, dass die Änderungen ja irgendwo bei Zeile 40 stattfinden müssen. Nur leider habe ich kein Plan. Habe schon ein wenig probiert aber leider kein positives Ergebnis.

    Gruß

    Peril

    GTB

    • modified Team
    • Gravatar
    • Beiträge: 6.225
    • Geschlecht:
    gib einfach ein " bitte wählen..." als Attribut ein und füge es den Produkten hinzu.

    wichtig: ein Leerzeichen zu beginn, dann wird es auch als erstes angezeigt.

    peril

    • Frisch an Board
    • Beiträge: 71
    Hallo GTB,

    danke für den Tipp, aber das ist ja die Hardcore Version. Falls alle Stricke reißen!
    Da ist mir die Gefahr zu groß, dass die Kunden dann den Artikel mit dem Attribut "bitte wählen" bestellen.

    Ausserdem müsste man den dann für jeden Artikel nachträglich einbauen was widerum sehr zeitaufwendig ist.

    Ich weiß das es auch anders geht nur leider kenne ich mich mit PHP nicht so gut aus, dass ich wüsste wo genau ich da ansetzen muss.

    Immerhin ist es bei den Hersteller-Boxen ja auch mit drin.

    Gruß

    GTB

    • modified Team
    • Gravatar
    • Beiträge: 6.225
    • Geschlecht:
    probier's mal so:

    Code: PHP  [Auswählen]
    $col = 0;
    while ($products_options = xtc_db_fetch_array($products_options_query,true)) {
     
    ersetzen mit:

    Code: PHP  [Auswählen]
    $products_options_data[$row]['DATA'][0] = array ('ID' => 0, 'TEXT' => PULL_DOWN_DEFAULT);
    $col = 1;
    while ($products_options = xtc_db_fetch_array($products_options_query,true)) {

    peril

    • Frisch an Board
    • Beiträge: 71
    Super geil!!!

    Vielen Dank erst einmal dafür...

    Kleines Problem hab ich nun noch. :-(
    Kann es sein das ich die Zeilen entweder etwas höher oder später einbauen muss?

    Leider zeigt er mir bei dem "Bitte wählen" noch ein "<<Zurzeit ausverkauft" an.  :nixweiss:

    Da er das "Bitte wählen" wohl als Attribut erkennt und dies natürlich keinen Bestand hat.
    Habe für meine "Lagerampel" eigentlich nur 3 Änderungen vorgenommen.

    Code: PHP  [Auswählen]
    <?php

    /* -----------------------------------------------------------------------------------------
       $Id: product_attributes.php 1255 2005-09-28 15:10:36Z 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_info.php,v 1.94 2003/05/04); www.oscommerce.com
       (c) 2003      nextcommerce (product_info.php,v 1.46 2003/08/25); www.nextcommerce.org

       Released under the GNU General Public License
       -----------------------------------------------------------------------------------------
       Third Party contribution:
       Customers Status v3.x  (c) 2002-2003 Copyright Elari elari@free.fr | www.unlockgsm.com/dload-osc/ | CVS : http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/elari/?sortby=date#dirlist
       New Attribute Manager v4b                            Autor: Mike G | mp3man@internetwork.net | http://downloads.ephing.com
       Cross-Sell (X-Sell) Admin 1                          Autor: Joshua Dechant (dreamscape)
       Released under the GNU General Public License
       ---------------------------------------------------------------------------------------*/


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

    if ($product->getAttributesCount()> 0) {
    // BOF - Tomcraft - 2009-11-07 - Added sortorder to products_options
            //$products_options_name_query = xtDBquery("select distinct popt.products_options_id, popt.products_options_name from ".TABLE_PRODUCTS_OPTIONS." popt, ".TABLE_PRODUCTS_ATTRIBUTES." patrib where patrib.products_id='".$product->data['products_id']."' and patrib.options_id = popt.products_options_id and popt.language_id = '".(int) $_SESSION['languages_id']."' order by popt.products_options_name");
            $products_options_name_query = xtDBquery("select distinct popt.products_options_id, popt.products_options_name from ".TABLE_PRODUCTS_OPTIONS." popt, ".TABLE_PRODUCTS_ATTRIBUTES." patrib where patrib.products_id='".$product->data['products_id']."' and patrib.options_id = popt.products_options_id and popt.language_id = '".(int) $_SESSION['languages_id']."' order by popt.products_options_sortorder, popt.products_options_id");
    // EOF - Tomcraft - 2009-11-07 - Added sortorder to products_options
            $row = 0;
            $col = 0;
            $products_options_data = array ();
            while ($products_options_name = xtc_db_fetch_array($products_options_name_query,true)) {
                    $selected = 0;
                    $products_options_array = array ();

                    $products_options_data[$row] = array ('NAME' => $products_options_name['products_options_name'], 'ID' => $products_options_name['products_options_id'], 'DATA' => '');
                    $products_options_query = xtDBquery("select pov.products_options_values_id,
                                                                     pov.products_options_values_name,
                                                                     pa.attributes_model,
                                                                     pa.options_values_price,
                                                                     pa.price_prefix,
                                                                    pa.attributes_stock,
                                                                     pa.attributes_model
                                                                      from "
    .TABLE_PRODUCTS_ATTRIBUTES." pa,
                                                                     "
    .TABLE_PRODUCTS_OPTIONS_VALUES." pov
                                                                     where pa.products_id = '"
    .$product->data['products_id']."'
                                                                     and pa.options_id = '"
    .$products_options_name['products_options_id']."'
                                                                     and pa.options_values_id = pov.products_options_values_id
                                                                     and pov.language_id = '"
    .(int) $_SESSION['languages_id']."'
                                                                     order by pa.sortorder"
    );
                    $products_options_data[$row]['DATA'][0] = array ('ID' => 0, 'TEXT' => PULL_DOWN_DEFAULT);
            $col = 1;
            while ($products_options = xtc_db_fetch_array($products_options_query,true)) {
                            $price = '';
                            if ($_SESSION['customers_status']['customers_status_show_price'] == '0') {
                                    $products_options_data[$row]['DATA'][$col] = array ('ID' => $products_options['products_options_values_id'], 'TEXT' => $products_options['products_options_values_name'], 'MODEL' => $products_options['attributes_model'],
                                    // Lagerampel
                                    'STOCK' => $products_options['attributes_stock'],
                                    // Lagerampel
                                    'PRICE' => '', 'FULL_PRICE' => '', 'PREFIX' => $products_options['price_prefix']);
                            } else {
                                    if ($products_options['options_values_price'] != '0.00') {
                                            $price = $xtPrice->xtcFormat($products_options['options_values_price'], false, $product->data['products_tax_class_id']);
                                    }

                                    $products_price = $xtPrice->xtcGetPrice($product->data['products_id'], $format = false, 1, $product->data['products_tax_class_id'], $product->data['products_price']);
                                    if ($_SESSION['customers_status']['customers_status_discount_attributes'] == 1 && $products_options['price_prefix'] == '+')
                                            $price -= $price / 100 * $discount;

                                            $attr_price=$price;
                                            if ($products_options['price_prefix']=="-") $attr_price=$price*(-1);
                                            $full = $products_price + $attr_price;
                                    $products_options_data[$row]['DATA'][$col] = array ('ID' => $products_options['products_options_values_id'], 'TEXT' => $products_options['products_options_values_name'], 'MODEL' => $products_options['attributes_model'],
                                    / Lagerampel
                                    'STOCK' => $products_options['attributes_stock'],
                                    // Lagerampel
                                     'PRICE' => $xtPrice->xtcFormat($price, true), 'FULL_PRICE' => $xtPrice->xtcFormat($full, true), 'PREFIX' => $products_options['price_prefix']);

                                    //if PRICE for option is 0 we don't need to display it
                                    if ($price == 0) {
                                            unset ($products_options_data[$row]['DATA'][$col]['PRICE']);
                                            unset ($products_options_data[$row]['DATA'][$col]['PREFIX']);
                                    }

                            }
                            $col ++;
                    }
                    $row ++;
            }

    }

    if ($product->data['options_template'] == '' or $product->data['options_template'] == 'default') {
            $files = array ();
            if ($dir = opendir(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_options/')) {
                    while (($file = readdir($dir)) !== false) {
    // BOF - Tomcraft - 2010-02-04 - Prevent modified eCommerce Shopsoftware from fetching other files than *.html
                            //if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_options/'.$file) and ($file != "index.html") and (substr($file, 0, 1) !=".")) {
                            if (is_file(DIR_FS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/module/product_options/'.$file) and (substr($file, -5) == ".html") and ($file != "index.html") and (substr($file, 0, 1) !=".")) {
    // EOF - Tomcraft - 2010-02-04 - Prevent modified eCommerce Shopsoftware from fetching other files than *.html
                                    $files[] = array ('id' => $file, 'text' => $file);
                            } //if
                    } // while
                    closedir($dir);
            }
            $product->data['options_template'] = $files[0]['id'];
    }

    $module_smarty->assign('language', $_SESSION['language']);
    $module_smarty->assign('options', $products_options_data);
    // set cache ID

            $module_smarty->caching = 0;
            $module = $module_smarty->fetch(CURRENT_TEMPLATE.'/module/product_options/'.$product->data['options_template']);

    $info_smarty->assign('MODULE_product_options', $module);
    ?>
     
    Wäre supi wenn man das noch da weg bekommen könnte. Die Ampel ist mit formatiert.

    Gruß

    Peril

    GTB

    • modified Team
    • Gravatar
    • Beiträge: 6.225
    • Geschlecht:
    hi,

    eingebaut ist es an der richtigen Stelle.

    ändere mal diese Zeile ab:

    Code: PHP  [Auswählen]
    $products_options_data[$row]['DATA'][0] = array ('ID' => 0, 'TEXT' => PULL_DOWN_DEFAULT);
     
    in:

    Code: PHP  [Auswählen]
    $products_options_data[$row]['DATA'][0] = array ('ID' => 0, 'TEXT' => PULL_DOWN_DEFAULT, 'STOCK' => 1);
     
    kann sein dass du für STOCK einen höheren Wert angeben musst. Ich habe mir die Lagerampel noch nie angeschaut und weiss nicht nach welchen Werten, was angezigt wird.

    web28

    • modified Team
    • Beiträge: 9.404
    @peril

    Alle Optionswerte lassen sich sortieren, damit wird alles so angezeigt wie gewünscht.

    Ein "Bitte wählen" im Dropdown verhindert keine Fehlbestellung, egal ob im Admin definiert oder im Template "reingebastelt".
    Fehleingaben/Auswahl lässt sich aber mit einem JavaScript abfangen.

    Gruss Web28

    Schreibwarendiele

    • Frisch an Board
    • Beiträge: 67
    • Geschlecht:
    [...]
    Ein "Bitte wählen" im Dropdown verhindert keine Fehlbestellung, egal ob im Admin definiert oder im Template "reingebastelt".
    [...]

    Das ist sicher richtig, aber ich sehe dann sofort, daß ich nachfragen muß.
    Ohne "Bitte wählen" wird der erste Eintrag übernommen und ich merke gar nicht, daß der Kunde zu blöd war, Größe oder Farbe auszuwählen, und habe dann eine Retoure mehr.

    Gibt es eigentlich schon das Baustellenschild "Eltern haften für ihre Kinder" in der Variante "Händler haften für ihre Kunden" ???

    peril

    • Frisch an Board
    • Beiträge: 71
    @peril

    Alle Optionswerte lassen sich sortieren, damit wird alles so angezeigt wie gewünscht.

    Ein "Bitte wählen" im Dropdown verhindert keine Fehlbestellung, egal ob im Admin definiert oder im Template "reingebastelt".
    Fehleingaben/Auswahl lässt sich aber mit einem JavaScript abfangen.

    Gruss Web28

    Mir geht es bei der Anpassung nur darum das Kunden nicht auf einen Artikel gehen bei dem gleich steht "Größe: XYZ <<Zurzeit Ausverkauft" sondern stattdessen "Größe: Bitte wählen". Der Kunde ahnt dann, bei dem Feld suche ich die Größe aus. Bei der alten Variante könnte es sein, dass der Kunde (nicht jeder Kunde aber vielleicht doch einige) "denkt" es wären alle Artikel-Größen ausverkauft und schaut noch nicht einmal nach ob seine Größe eventuell doch verfügbar ist.

    Grüße

    peril

    • Frisch an Board
    • Beiträge: 71
    probier's mal so:

    Code: PHP  [Auswählen]
    $col = 0;
    while ($products_options = xtc_db_fetch_array($products_options_query,true)) {
     
    ersetzen mit:

    Code: PHP  [Auswählen]
    $products_options_data[$row]['DATA'][0] = array ('ID' => 0, 'TEXT' => PULL_DOWN_DEFAULT);
    $col = 1;
    while ($products_options = xtc_db_fetch_array($products_options_query,true)) {
    Boah... Du bist echt Super-Klasse!

    Vielen vielen Dank für Deine Hilfe!

    Habe es jetzt endlich hinbekommen.

    Jetzt hab ich auch verstanden was Du dort gemacht hast. :-)

    Also hier noch einmal für alle die eine [Lagerampel + Bitte wählen] Variante in Ihrem Shop einbauen möchten einmal hier aufpassen.

    Es müssen 2 Dateien angepasst werden.

    >>> includes/modules/product_attributes.php
    >>> templates/DEINTEMPLATE/module/product_option/product_options_dropdown.html
    ---

    >>> product_attributes.php
    Ca. ab Zeile 42 kommt dieser Block

    Code: PHP  [Auswählen]
    $products_options_query = xtDBquery("select pov.products_options_values_id,
                                                                     pov.products_options_values_name,
                                                                     pa.attributes_model,
                                                                     pa.options_values_price,
                                                                     pa.price_prefix,
                                                                     pa.attributes_model
                                                                      from "
    .TABLE_PRODUCTS_ATTRIBUTES." pa,
                                                                     "
    .TABLE_PRODUCTS_OPTIONS_VALUES." pov
                                                                     where pa.products_id = '"
    .$product->data['products_id']."'
                                                                     and pa.options_id = '"
    .$products_options_name['products_options_id']."'
                                                                     and pa.options_values_id = pov.products_options_values_id
                                                                     and pov.language_id = '"
    .(int) $_SESSION['languages_id']."'
                                                             order by pa.sortorder"
    );
     
    Dort müsst Ihr einfach ein "pa.attributes_stock," zwischen den Werten "pa.price_prefix," und "pa.attributes_model" einfügen!

    Ca. ab Zeile 57

    Code: PHP  [Auswählen]
    $col = 0;
    while ($products_options = xtc_db_fetch_array($products_options_query,true)) {
     
    ersetzen mit

    Code: PHP  [Auswählen]
    // Bitte Wählen anzeigen im Dropdown
    //$col = 0;
    //while ($products_options = xtc_db_fetch_array($products_options_query,true)) {
    $products_options_data[$row]['DATA'][0] = array ('ID' => 0, 'TEXT' => PULL_DOWN_DEFAULT, 'STOCK' => 999999);
    $col = 1;
    while ($products_options = xtc_db_fetch_array($products_options_query,true)) {
    // Bitte Wählen anzeigen im Dropdown
     
    Die 999999 ermöglicht in meinem Fall die "nicht" Anzeige eines "Bitte wählen <<Zuzeit ausverkauft". Das bedeutet wenn der Lagerwert des Attributes über 999999 liegt dann wird kein Lagerampel-Hinweis ausgegeben und es steht dann nur noch "Bitte wählen" in dem Dropdown.
    Wichtig wenn Ihr Artikel mit Attributen habt von denen mehr als 999999 auf Lager sind. Erhöht diesen Wert dann einfach so hoch, dass ihr da keine Probleme bekommt. In meinem Fall reicht dies auf jedenfall!

    Nun kommen wir noch zu der Ampel:
    Immernoch die Datei
    >>> product_attributes.php ca. Zeile 66

    Code: PHP  [Auswählen]
    'PRICE' => '', 'FULL_PRICE' => '', 'PREFIX' => $products_options['price_prefix']);
    } else {
     
    davor einfügen

    Code: PHP  [Auswählen]
    // Lagerampel
    'STOCK' => $products_options['attributes_stock'],
    // Lagerampel
     
    das gleiche macht Ihr noch einmal bei ca. bei Zeile 85

    Code: PHP  [Auswählen]
    'PRICE' => $xtPrice->xtcFormat($price, true), 'FULL_PRICE' => $xtPrice->xtcFormat($full, true), 'PREFIX' => $products_options['price_prefix']);

    //if PRICE for option is 0 we don't need to display it
    if ($price == 0) {
    unset ($products_options_data[$row]['DATA'][$col]['PRICE']);
     
    davor einfügen

    Code: PHP  [Auswählen]
    // Lagerampel
    'STOCK' => $products_options['attributes_stock'],
    // Lagerampel
     
    Jetzt sind wir mit der ersten Datei fertig!

    Nun zur zweiten Datei
    >>> product_options_dropdown.html

    Hier poste ich einfach den kompletten Inhalt. Vielleicht nennt Ihr die Datei mit dem neuen Inhalt einfach product_options_NEW_dropdown.html

    Code: PHP  [Auswählen]
    {config_load file="$language/lang_$language.conf" section="product_info"}
    {if $options!=''}

    <table width="80%" border="0" cellspacing="0" cellpadding="0">
      {foreach name=outer item=options_data from=$options}
      <tr>
      <tr>
        <td class="main"><b>Verfügbare {$options_data.NAME}:</b> </td>
       </tr>
        <td>
            <select name="id[{$options_data.ID}]">
        {foreach key=key_data item=item_data from=$options_data.DATA}
        <option style="min-width:95px;" value="{$item_data.ID}">{$item_data.TEXT} {if $item_data.PRICE !='' }{$item_data.PREFIX}{$item_data.PRICE}{/if}{if $item_data.STOCK <='0' }« Zurzeit Ausverkauft{elseif $item_data.STOCK <='999998' }« Artikel auf Lager!{/if}
        </option>
        {/foreach}
        </select>
        </td>
      </tr>
      {/foreach}
    </table>
    {/if}
     
    Der Vorteil dieser Anzeige ist Ihr könnt mehrere Ausgaben verwirklichen.

    Code: PHP  [Auswählen]
    {if $item_data.STOCK <='0' }« Zurzeit Ausverkauft
    {elseif $item_data.STOCK <='999998' }« Artikel auf Lager!{/if}
     
    Ändert das einfach so wie Ihr es haben möchtet.

    Bei dem Beispiel wird jetzt bei Attributen mit Bestand NULL ein "Zurzeit Ausverkauft" angezeigt. Alle Attribute die darüber lieben aber unter 999999 werden mit "Artikel auf Lager!" gekennzeichnet.

    Ich hoffe Ich habe damit etwas zurück geben können.
    Falls es Fragen gibt einfach hier im Thread stellen. Ich werde versuchen zu helfen.

    Lieben Gruß

    Peril

    GTB

    • modified Team
    • Gravatar
    • Beiträge: 6.225
    • Geschlecht:
    [...]
    Jetzt hab ich auch verstanden was Du dort gemacht hast. :-)
    [...]

    das ist das wichtigste!

    peril

    • Frisch an Board
    • Beiträge: 71
    ANLEITUNG: Attribut Dropdown Anzeige ergänzen mit "bitte wählen"
    Antwort #12 am: 05. August 2010, 12:30:26
    Hallo noch einmal,

    habe noch eine ergänzende Frage zu dem Dropdown.

    Wie ist es möglich bei einem Bestand von z.B. -1000 komplett auf eine Anzeige des Attributes zu verzichten?

    Also wenn -1000 dann Attribut nicht anzeigen?!

    Muss ja auch in der Datei hier passieren.

    Leider reicht der kleine Lernerfolg hier nicht für eine derartige Anpassung meinerseits aus.. :-(

    Gruß

    Peril

    GTB

    • modified Team
    • Gravatar
    • Beiträge: 6.225
    • Geschlecht:
    ANLEITUNG: Attribut Dropdown Anzeige ergänzen mit "bitte wählen"
    Antwort #13 am: 05. August 2010, 12:38:27
    willst du das komplette Dropdown nicht mehr anzeigen oder nur das Bitte wählen?

    gib mal ein Beispiel dafür.

    peril

    • Frisch an Board
    • Beiträge: 71
    ANLEITUNG: Attribut Dropdown Anzeige ergänzen mit "bitte wählen"
    Antwort #14 am: 05. August 2010, 13:15:37
    Hallo GTB,

    danke für die schnelle Antwort!

    Ich möchte dann nur speziell den Attribut nicht mehr anzeigen.

    Normalerweise würde ein Artikel so aussehen:
    Zitat
    T-Shirt XYZ

    Größe
    Bitte wählen

    > S
    > M
    > L
    > XL
    Wenn jetzt ein Attribut ausverkauft (-1000) ist dann soll die Ausgabe des Dropdowns in etwa so aussehen:

    ( In dem Beispiel ist nun L ausverkauft bzw. auf -1000 )
    Zitat
    T-Shirt XYZ

    Größe
    Bitte wählen

    > S
    > M
    > XL
    Es soll also nur das betroffene Attribut ausgeblendet werden.

    Da "Bitte Wählen" ja in meinem Fall auf +999999 eingestellt ist, kommt sich das ja dann nicht in die Quere.

    Grüße

    Peril

    14 Antworten
    5082 Aufrufe
    21. Juli 2010, 11:25:14 von peril
    1 Antworten
    3449 Aufrufe
    22. Mai 2012, 23:17:09 von jannemann
    15 Antworten
    13543 Aufrufe
    10. Dezember 2013, 21:27:31 von olli0578
               
    anything