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

Shopware Smarty Lagerbstandsabgleich

 
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
Nexusknicker
Smarty n00b


Joined: 25 Mar 2021
Posts: 1

PostPosted: Thu Mar 25, 2021 2:09 pm    Post subject: Shopware Smarty Lagerbstandsabgleich Reply with quote

Hallo,

ich bräuchte mit einer Programmierung weitere Hilfe.
Es geht darum einen Lagerbestandsabgleich zu machen.

Die Syntax mir mir soweit geläufig.

Derzeit besteht der folgende Code:

{strip}
{$sArticle.ordernumber|escape}{#S#}
{$sArticle.price|escape:"number"}{#S#}
{if $sArticle.instock > 0}{$sArticle.instock} {else}0{/if}{#S#}
{if $sArticle.instock > 0}2{else}5{/if}{#S#}
{/strip}{#L}


Besteht die Möglichkeit z.B. mit einem frei erstellten Freitextfeld in dieser nur "einen" Abfrage noch weitere Nummern abzufragen?

Beispiel:
Hauptprodukt Ordernummer = 5678
alternative Nummer 1 = 12
alternative Nummer 2 = 34

Hauptprodukt hat die Ordernummer 5678. Die alternativen Produkte bzw. die Nummer stehen in "einem" weiteren Feld in dem Hauptprodukt und sind beispielweise mit einem ";" von einander getrennt.
Die Abfrage soll nun prüfen: Hauptprodukt, Nummer 1, Nummer 2 usw. ob dieser eine Artikel noch Lagerbestand hat.

Ich wäre euch um Hilfe dankbar.
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Tue Apr 06, 2021 6:23 am    Post subject: Reply with quote

Hey,

solche "Dinge" sollten nicht unbedingt im Frontend gemacht werden. Smarty ist ja eher für die Anzeige da und nicht für berechnungen oder ähnliches.

Aber ja, theoretisch könntest du, wenn du es als array hättest mit der foreach durchgehen. Deine Semikolon-Separierten Werte könntest du z. B. mit der explode-Methode in ein array umwandeln
Back to top
View user's profile Send private message Visit poster's website
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Apr 07, 2021 2:44 pm    Post subject: Reply with quote

Sorry I did not see the question earlier.

Smarty is not a query language, Smarty is a template/presentation language. You query data in your PHP code and pass them to Smarty for display purposes.

So, the answer is: do that in your PHP code.
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Mon Apr 12, 2021 6:30 am    Post subject: Reply with quote

@AnrDaemon: My words Very Happy
Back to top
View user's profile Send private message Visit poster's website
Saviniel
Smarty n00b


Joined: 12 May 2022
Posts: 1

PostPosted: Thu May 12, 2022 10:58 am    Post subject: Reply with quote

Hallo, gibt es unter Ihnen einen Freiberufler, der bereit wäre, sich
Back to top
View user's profile Send private message Send e-mail
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