Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty Bedingung mit Funktionen erstellen?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
Kopernikus
Smarty n00b


Joined: 17 Mar 2013
Posts: 1

PostPosted: Sun Mar 17, 2013 1:47 pm    Post subject: Smarty Bedingung mit Funktionen erstellen? Reply with quote

Hallo zusammen

Ich bin noch blutiger Smarty Anfänger und möchte mich einer ersten Aufgabe in meinem xtc basierenden Webshop stellen. Im Template-System habe ich zwei Smarty Funktionen, welche ich gerne einer Bedingung unterstellen würde.

{products_attributes} fügt den Inhalt von Attributen in die Produkteseite ein. Darin eingeschlossen ist eine Lagerampel speziell für die Attribute. Das Problem ist nun, dass ich bei Produkten ohne Attribute keine Lagerampel angezeigt bekomme. Damit diese auch dort erscheint dient folgende Funktion: {lagerampel qty=$item.PRODUCTS_QUANTITY}

Nun möchte ich eine Bedingung erstellen, in welcher geprüft wird, ob Attribute vorhanden sind. Da {products_attributes} nur dann eingeblendet wird, wenn auch Attribute vorhanden sind, könnte ich doch prüfen, ob diese aktiv sind. Falls nicht, dann kommt die Funktion {lagerampel qty=$item.PRODUCTS_QUANTITY} zum zug.

Leider will mir diese Bedingung auch nach mehreren Stunden nicht gelingen. Vielleicht hat mir hier jemand einen Tipp, wie diese Bedingung in etwa aussehen müsste?

Herzlichen Dank im Voraus Smile
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Mon Mar 18, 2013 9:01 am    Post subject: Reply with quote

Um eine Bedingung abzufragen verwendet man IF-Abfragen. Also z. B. so

Code:
{if isset($item.PRODUCTS_QUANTITY)}Tu dinge, wenn PRODUCTS_QUANTITY existiert{else}Falls etwas passieren soll, wenn diese Bedingung nicht zutrifft{/if}


Ich hoffe das meintest du
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP