|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Nexusknicker Smarty n00b
Joined: 25 Mar 2021 Posts: 1
|
Posted: Thu Mar 25, 2021 2:09 pm Post subject: Shopware Smarty Lagerbstandsabgleich |
|
|
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 |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Tue Apr 06, 2021 6:23 am Post subject: |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Apr 07, 2021 2:44 pm Post subject: |
|
|
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 |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Mon Apr 12, 2021 6:30 am Post subject: |
|
|
@AnrDaemon: My words |
|
Back to top |
|
Saviniel Smarty n00b
Joined: 12 May 2022 Posts: 1
|
Posted: Thu May 12, 2022 10:58 am Post subject: |
|
|
Hallo, gibt es unter Ihnen einen Freiberufler, der bereit wäre, sich |
|
Back to top |
|
|
|
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
|