Ergebnis 1 bis 6 von 6

Thema: Artikelanzahl als DropDown

  1. #1
    Contao-Nutzer Avatar von bastler
    Registriert seit
    15.10.2010.
    Beiträge
    52

    Standard Artikelanzahl als DropDown

    Hallo Leutz,

    für ein Projekt benötige ich in einem ISOTOPE-Shop die Möglichkeit die Artikelanzahl als DropDown darzusellen.
    Als QuicknDirty-Lösung habe ich mir folgendes zusammengebaut:

    Ich habe per php.MyAdmin händisch in die Tabelle tl_iso_products eine neue Spalte names drop_id angelegt und in meinem Template verwende ich folgenden Code:

    Code:
    <form action="<?php echo $this->action; ?>" id="<?php echo $this->formId; ?>" name="iso<?php echo rand(); ?>" method="post" enctype="<?php echo $this->enctype; ?>">
    <div class="formbody">
    <input type="hidden" name="FORM_SUBMIT" value="<?php echo $this->formSubmit; ?>">
    <input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
    
    <h2><?php echo $this->name; ?></h2>
    
    <?php echo $this->images->generateMainImage('medium'); ?>
    <?php if($this->hasOptions): ?>
    <div class="options">
    <?php foreach( $this->options as $arrOption ): echo $arrOption['html']; endforeach; ?>
    </div>
    <?php endif; ?>
    
    <?php echo $this->images->generateGallery(); ?>
    
    <?php if ($this->sku): 
      ?>
    <div class="sku"><?php echo $this->sku;?></div><?php endif; if ($this->description): ?>
    <div class="description"><?php echo $this->description; ?></div><?php endif; ?>
    <div class="price"><?php echo $this->price; ?></div>
    <?php if($this->buttons): ?>
    <div class="submit_container">
    <?php if ($this->useQuantity): ?>
    <div class="quantity_container">
    
    if($this->drop_id == '2')
    {
    ?>
      <label for="quantity_requested_<?php echo $this->raw['id']; ?>"><?php echo $this->quantityLabel; ?>:</label>
      <select id="quantity_requested_<?php echo $this->raw['id']; ?>" name="quantity_requested" onblur="if (this.value=='') { this.value='1'; }" onfocus="if (this.value=='1') { this.value=''; }">
        <option value="250">250</option>
        <option value="500">500</option>
        <option value="750">750</option>
        <option value="1000">1000</option>
        <option value="1250">1250</option>
        <option value="1500">1500</option>
        <option value="1750">1750</option>
        <option value="2000">2000</option>
        <option value="2500">2500</option>
        <option value="3000">3000</option>
        <option value="3500">3500</option>
        <option value="4000">4000</option>
        <option value="4500">4500</option>
        <option value="5000">5000</option>
        <option value="5500">5500</option>
        <option value="6000">6000</option>
        <option value="6500">6500</option>
        <option value="7000">7000</option>
        <option value="7500">7500</option>
        <option value="8000">8000</option>
        <option value="8500">8500</option>
        <option value="9000">9000</option>
        <option value="9500">9500</option>
        <option value="10000">10000</option>
      </select> 
    
    <?php
    } 
    else if($this->drop_id == 3)
    {
    ?>
      
      <label for="quantity_requested_<?php echo $this->raw['id']; ?>"><?php echo $this->quantityLabel; ?>:</label>
      <select id="quantity_requested_<?php echo $this->raw['id']; ?>" name="quantity_requested" onblur="if (this.value=='') { this.value='1'; }" onfocus="if (this.value=='1') { this.value=''; }">
        <option value="500">500</option>
        <option value="750">750</option>
        <option value="1000">1000</option>
        <option value="1250">1250</option>
        <option value="1500">1500</option>
        <option value="1750">1750</option>
        <option value="2000">2000</option>
        <option value="2500">2500</option>
        <option value="3000">3000</option>
        <option value="3500">3500</option>
        <option value="4000">4000</option>
        <option value="4500">4500</option>
        <option value="5000">5000</option>
        <option value="5500">5500</option>
        <option value="6000">6000</option>
        <option value="6500">6500</option>
        <option value="7000">7000</option>
        <option value="7500">7500</option>
        <option value="8000">8000</option>
        <option value="8500">8500</option>
        <option value="9000">9000</option>
        <option value="9500">9500</option>
        <option value="10000">10000</option>
      </select> 
    
    <?php
    }
    else if($this->drop_id == 4)
    {
    ?>
    
      <label for="quantity_requested_<?php echo $this->raw['id']; ?>"><?php echo $this->quantityLabel; ?>:</label>
      <select id="quantity_requested_<?php echo $this->raw['id']; ?>" name="quantity_requested" onblur="if (this.value=='') { this.value='1'; }" onfocus="if (this.value=='1') { this.value=''; }">
        <option value="1000">1000</option>
        <option value="1250">1250</option>
        <option value="1500">1500</option>
        <option value="1750">1750</option>
        <option value="2000">2000</option>
        <option value="2500">2500</option>
        <option value="3000">3000</option>
        <option value="3500">3500</option>
        <option value="4000">4000</option>
        <option value="4500">4500</option>
        <option value="5000">5000</option>
        <option value="5500">5500</option>
        <option value="6000">6000</option>
        <option value="6500">6500</option>
        <option value="7000">7000</option>
        <option value="7500">7500</option>
        <option value="8000">8000</option>
        <option value="8500">8500</option>
        <option value="9000">9000</option>
        <option value="9500">9500</option>
        <option value="10000">10000</option>>
      </select> 
    
    <?php
    }
    else {
    ?>
    
     <label for="quantity_requested_<?php echo $this->raw['id']; ?>"><?php echo $this->quantityLabel; ?>:</label> <input type="text" class="text" id="quantity_requested_<?php echo $this->raw['id']; ?>" name="quantity_requested" value="<?php echo $this->quantity_requested; ?>" maxlength="10" onblur="if (this.value=='') { this.value='1'; }" onfocus="if (this.value=='1') { this.value=''; }">
    
    <?php
    }
    ?>
      
    <?php endif; ?>
    <?php foreach( $this->buttons as $name => $button ): ?>
    	<input type="submit" class="submit <?php echo $name; ?>" name="<?php echo $name; ?>" value="<?php echo $button['label']; ?>">
    <?php endforeach; ?>
    </div>
    <?php endif; ?>
    
    </div>
    </form>
    Nur das funktionier leider nicht.Wo liegt mein Fehler?Es wird mir nun das normale Textfeld ausgegeben und nicht das DropDown!

    Bin für jeden Tip dankbar

    Basti
    Geändert von bastler (02.10.2012 um 21:04 Uhr)

  2. #2
    Contao Core-Team
    Association Vorstand
    Avatar von andreas.schempp
    Registriert seit
    15.06.2009.
    Ort
    Lyss
    Beiträge
    5.621
    Partner-ID
    8667
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Du solltest schon ein entsprechendes Attribut anlegen, nur in der Datenbank reicht nicht.
    terminal42 gmbh
    Wir sind Contao Premium-Partner! Für Modulwünsche oder Programmierungen kannst du uns gerne kontaktieren.
    Hilfe für Isotope eCommerce kann man auch kaufen: Isotope Circle

  3. #3
    Contao-Nutzer
    Registriert seit
    25.05.2010.
    Beiträge
    75

    Standard

    Hi

    Ich würde das auch gerne in meinen Shop einbauen.
    Was genau ist mit den Attributen gemeint?
    Könnte mir jemand noch die Lösung erklären?

    Besten Dank und Gruss

  4. #4
    Contao-Urgestein Avatar von KATgirl
    Registriert seit
    31.03.2010.
    Ort
    Marburg
    Beiträge
    1.579
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard AW: Artikelanzahl als DropDown

    In der Schopkonfiguration kannst du Attribute anlegen, die dann dem Produkt zuweisen und fertig.

    Haben wir bei cupprint auch so gemacht, da wir feste Einheiten haben.
    - GitHub
    - Kontaktanfragen

    "Ein Lächeln ist die kürzeste Entfernung zwischen zwei Menschen." Victor Borge

  5. #5
    Contao-Nutzer
    Registriert seit
    25.05.2010.
    Beiträge
    75

    Standard

    Hallo KATgirl

    Merci für den Hinweis. Hab ein Attribut erstellt: Typ Auswahlmenü
    Nun habe ich aber ein DropDown im Produktereader. Ich möchte das DD aber im Warenkorb haben. geht das auch irgendwie?
    Weisst was ich meine?

    Gruss

    beziehungsweise: ich möchte die "quantity" mit einem DropDown angeben können...
    Geändert von fbo_bern (06.01.2013 um 13:21 Uhr)

  6. #6
    Contao-Urgestein Avatar von KATgirl
    Registriert seit
    31.03.2010.
    Ort
    Marburg
    Beiträge
    1.579
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard AW: Artikelanzahl als DropDown

    Das wirst du nur sicher über einen Hook hinbekommen. Alle Lösungen per JS konnte man überlisten.

    Hook habe ich aber nicht im Kopf, schau mal in die Klasse vom Warenkorb ob du da was findest.
    - GitHub
    - Kontaktanfragen

    "Ein Lächeln ist die kürzeste Entfernung zwischen zwei Menschen." Victor Borge

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •