Jump to content

[gelöst] "Nicht auf Lager" und "verfügbar" in Produktliste unterschiedlich formatieren?


Recommended Posts

Hallo,

hat jemand eine Idee, wie ich "Nicht auf Lager" und "verfügbar" in derProduktliste unterschiedlich formatieren kann? Habe es per CSS probiert, aber da fehlt der Unterscheider. Die Klasse heißt in beiden Fällen ".availability". Somit kann ich nicht Unterscheiden.

Hintergrund: Wollte damit eine Art von minimalistischem Ampelsystem bauen.

In der Artikelansicht hat das gut geklappt, aber in der Produktliste leider nicht.

 

Danke für Eure Ideen.

Gruß

Jan

Link to comment
Share on other sites

Hallo Jan,

 

das sollte an sich kein großes Problem darstellen. im Template der Produktliste findet sich ca bei Zeile 53 (hier aus dem default-Template einer 1.5.4.1er Shopversion) ungefähr folgendes. Ungefähr, weil ich das nicht die komplette Zeile ist und zum besseren lesen in mehrere Zeilen aufgeteilt wurde.

<span class="availability">
{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}
{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'}
{else}{l s='Out of stock'}
{/if}
</span>

Der Reihe nach gelesen heisst das:

Mit <span> wird die Anzeige formatiert.

Danach kommt eine IF Schleife: Wenn das Produkt da ist dann zeige verfügbar....

gefolgt von einem ELSEIF, wenn die erste Bedingung nicht erfüllt wird (sagt das ELSE), wird eine zweite Bedingung geprüft (das IF von ELSEIF) stimmt diese dann zeige mit anderen Optionen...

ist auch das nicht der Fall (noch ein ELSE) dann zeige Ausverkauft....

{/if} beendet dann die IF-Verschachtelung

Danach wird nur noch die anders formatierte Anzeige beendet.

 

Langer Rede kurzer Sinn:

Wenn du weitere CSS-Classes anlegst und die <span> Anweisung jeweils in die einzelnen Bedingungen legst, also direkt um die anzuzeigenden Texte, dann sollte das problemlos funktionieren.

Das könnte dann ungefähr so aussehen:

{if ($product.allow_oosp || $product.quantity > 0)}<span class="availability">{l s='Available'}</span>
{elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}<span class="availability_with_other_options">{l s='Product available with different options'}</span>
{else}<span class="availability_out_of_stock">{l s='Out of stock'}</span>
{/if}

Bitte beachten!

Auch dieses Codebeispiel ist nicht die vollständige Zeile und ist auch zur besseren Lesbarkeit unterteilt.

 

LG Klaus / Lockesoft

Edited by Lockesoft (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

Ja, wenn es denn so einfach wäre, Klaus. Zum einen ist es doch ein wenig komplexer, da 1.5.4.1 Code in der Art wie von dir gepostet, nicht mehr kennt und stattdessen diesen hier in der product.tpl vorhält:

 

<span id="availability_value" {if="" $product-="">quantity <= 0} class="warning_inline"{/if}>
{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}
{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}
</span>

 

Wenn man hier die in der global.css vorhandenen Styles nach deinem Rat ergänzt hat, kann man den Code dann etwa so erweitern:

 

<span id="availability_value" {if="" $product-="">quantity <= 0} class="warning_inline"{/if}>
{if $product->quantity <= 0}{if $allow_oosp}<span id="availability_with_other_options">{$product->available_later}</span>
{else}<span id="availability_out_of_stock">{l s='This product is no longer in stock'}</span>{/if}
{else}<span id="availability_now">{$product->available_now}</span>{/if}
</span>

 

... dann funktioniert das bei normalen Produkten auch, nicht aber bei Kombinationen! Da hast du dann nämlich als Resultat eine weiße Schrift auf - zumindest im Default-Template - weißen Grund. Mit anderen Worten: der Kunde bekommt nichts angezeigt.

 

Hast du da auch eine Idee - oder vielleicht auch jemand anders.

 

Viele Grüße

Rainer

Edited by eleazar (see edit history)
Link to comment
Share on other sites

Hallo Rainer,

 

doch doch, der Schnippsel oben ist aus der product-list.tpl einer 1.5.4.1, einzig zur besseren Lesbarkeit auf ein paar Zeilen mehr verteilt. Das war ja auch die ursprüngliche Fragestellung.

 

Im product.tpl selber muss ich mir auch noch mal näher ansehen, ob und wie das klappen könnte.

 

LG Klaus

Link to comment
Share on other sites

Sorry, Klaus, du brauchst nicht zu suchen. Es war mein Fehler. :rolleyes:

 

Die erste span-ID ("availability value") musste raus. Es klappt so:

 

product.tpl:

<span {if $product->quantity <= 0} class="warning_inline"{/if}>
{if $product->quantity <= 0}{if $allow_oosp}<span id="availability_later">{$product->available_later}</span>
{else}<span id="availability_out_of_stock">{l s='This product is no longer in stock'}</span>{/if}
{else}<span id="availability_now">{$product->available_now}</span>{/if}</span>

 

product.css:

/* availability_statut */
#availability_statut {padding-bottom:10px;}
#availability_statut span#availability_label {
   display:inline-block;
   width: 40%;
   font-weight:bold;
   font-size:12px;
   text-align:right
}
#availability_statut span#availability_value{
   display:inline-block;
   padding:1px 5px;
   font-weight:bold;
   font-size:10px;
   color:#fff;
   text-transform:uppercase;
/*background:#339933 !important;*/
}
#availability_statut span#availability_now{
   display:inline-block;
   padding:1px 5px;
   font-weight:bold;
   font-size:10px;
   color:#fff;
   text-transform:uppercase;
   background:#339933 !important;
}
#availability_statut span#availability_out_of_stock{
   display:inline-block;
   padding:1px 5px;
   font-weight:bold;
   font-size:10px;
   color:#fff;
   text-transform:uppercase;
   background:#6f6f6e !important;
}
#availability_statut span#availability_later{
   display:inline-block;
   padding:1px 5px;
   font-weight:bold;
   font-size:10px;
   color:#fff;
   text-transform:uppercase;
   background:#ff9933 !important;

Link to comment
Share on other sites

  • 2 months later...

Und wer das Ganze ebenso in der Produktliste haben möchte, der ändert Zeile 53 der /themes/<MeinTemplate/product-list.tpl wie folgt ab:

 

Statt

{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)} <span class="availability"> 
{if ($product.allow_oosp || $product.quantity > 0)}{l s='Available'}
 {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}{l s='Product available with different options'} 
{else} {l s='Out of stock'} {/if} </span> {/if} 

heißt es dann:

{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
 <span>
 {if $product.quantity > 0} <span class="availability_now">{$product.available_now}
</span> 
{else}
 {if $product.allow_oosp} <span class="availability_later">{$product.available_later}</span>
 {else} <span class="availability_out_of_stock">{l s='Out of stock'}</span> 
{/if}
 {/if}
 </span> 
{/if} 
Edited by eleazar (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Hallo, wenn ich das mal aufgreifen darf... ich versuche das gerade hinzubekommen, die Änderung in der product.css bekomm ich ja hin.

 

aber in der product.tpl kann ich nun nicht nachvollziehen wo der oben beschriebene Block wie geändert werden muss??
 

Ist das dieser Absatz aus meiner product.tpl?
 

<!-- availability -->
            <p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
                <span id="availability_label">{l s='Availability:'}</span>
                <span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if} itemprop="availability">{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock'}{/if}{else}{$product->available_now}{/if}</span>                
            </p>
            <p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}>
                <span id="availability_date_label">{l s='Availability date:'}</span>
                <span id="availability_date_value">{dateFormat date=$product->available_date full=false}</span>
            </p>
            <!-- number of item in stock -->
            {if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)}
            <p id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}>
                <span id="quantityAvailable">{$product->quantity|intval}</span>
                <span {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='Item in stock'}</span>
                <span {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='Items in stock'}</span>
            </p>
  

Und wenn, verstehe ich noch nicht ob ich obiges wo einfügen oder ändern müsste?

Ich bitte um eure Hilfe! ;-)

PS 1.5.5.0

Link to comment
Share on other sites

  • 2 weeks later...

Ich finde es äusserst traurig das in einem von Presta eingesetzten und von Presta eingesetzten Moderatoren niemand willens zu sein scheint eine Antwort, geschweige denn einen kleinen Hinweis zu geben!?

 

Ich gewinne mehr und mehr den Eindruck das einige "Supporter" der Auffassung sind wer sich mit php und tpl´s nicht auskennt hat hier eh nichts verloren...

 

Das ist keine Hilfe-Community mehr wie sie es noch von ca. 2 Jahren war..

 

Sehr Bedauerlich!!

Link to comment
Share on other sites

Na von Deinen vielen Posts wirds auch nicht besser....

Das ist hier kein kostenpflichtiges Support-Forum! sonder ein kostenloses; und wenn Du hoffst von Presta-Moderatoren hilfe zu bekommen: ich glaube die lesen hier gar nicht mit, oder schauen nur einmal im Monat rein.

Die deutschen Moderatoren hier machen das übrigends auch kostenlos; denke ich.

 

Und wenn Dir das nicht passt, musst Du hier ja nicht das Forum zukrixeln, das Niveau hier im Forum ist momentan eh auf einem extrem niedrigen Level, was sicher mit der Prestashop-Politik zu tun hat: Cloud, kostenlos

und den damit enstehenden Erwartungen mancher User hier im Forum......

Edited by kulli (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...