ich wollte einen Shop machen, bei der man sich nicht anmelden muss. Ich habe nun Probleme mit der Übergabe der berechneten Mwst.
Wird der Einkaufswagen bestellt, also geht an processOrder stimmt dort die Mwst. nicht mehr. Entweder wird sie granicht berechnet oder die Gesamtsumme stimmt nicht. Da ich noch keine formularprüfung eingebaut habe, hab ich festegestellt, das wenn der Warenkob ohne ausgefüllte Formularfelder (also Name, Anschrift etc.) keine MWst. berechnet wird, wird nu das Feld email ausgefüllt, berechnet er die Gesamtsumme falsch. Ich bin gerade etwas verwirt.
Hier mal die Vorlagen.
hopping_cart.tmpl
Code: Alles auswählen
<we:ifShopEmpty shopname="verlag">
<we:var name="shoppingCartEmpty" />
<we:else /><!-- shopping cart exists, cart or order. -->
<we:ifVarNotEmpty match="order" type="request">
<!-- order -->
<we:var name="shoppingConfirm" />
<we:form id="101" method="post">
<p> <strong>Bitte tragen Sie Ihre Anschrift ein:</strong></p>
<p> <label for="formInput_Vorname">Vorname:</label><we:sessionField class="Input" name="Forename" type="textinput" /></p>
<p> <label for="formInput_Nachane">Nachmane:</label><we:sessionField class="contactInput" name="Surname" type="textinput" /></p>
<p> <label for="formInput_Strasse">Straße:</label><we:sessionField name="Kontakt_Addresse1" class="contactInput" type="textinput" /></p>
<p> <label for="formInput_PLZ">PLZ:</label><we:sessionField name="Kontakt_Addresse2" class="contactInput" type="textinput"/></p>
<p> <label for="formInput_Ort">Ort:</label><we:sessionField name="Kontakt_Land" class="contactInput" type="textinput"/></p>
<p> <label for="formInput_Email">E-Mail:</label><we:sessionField name="Kontakt_Email" class="contactInput" type="textinput"/>
</p>
<table class="shop">
<tr>
<th>Artikelname</th>
<th class="amount">Anzahl</th>
<th class="price">Preis</th>
<th class="price">Gesamt</th>
</tr>
<we:repeatShopItem shopname="verlag">
<tr>
<td><we:field name="shoptitle" /></td>
<td class="amount"><we:showShopItemNumber shopname="verlag" /></td>
<td class="price"><we:field name="price" num_format="german" /> €</td>
<td class="price"><we:calculate sum="warenkorb" num_format="german"><we:field name="price" num_format="german" />*<we:showShopItemNumber shopname="verlag"></we:calculate> €</td><td class="price">
<we:ifShopVat id="1">
<we:calculate print="false" sum="totalVat1">
<we:showShopItemNumber type="print" shopname="verlag" /> *
<we:field name="price" />*<we:field type="shopVat" />/(<we:field type="shopVat" />+100)
</we:calculate>
</we:ifShopVat>
<we:ifShopVat id="2">
<we:calculate print="false" sum="totalVat2">
<we:showShopItemNumber type="print" shopname="verlag" /> *
<we:field name="price" />*<we:field type="shopVat" />/(<we:field type="shopVat" />+100)
</we:calculate>
</we:ifShopVat>
</td>
</tr>
</we:repeatShopItem>
</table>
<table class="sum">
<tr>
<th>Preis</th>
<td class="price"><we:sum name="warenkorb" num_format="german" /> €</td>
</tr>
<we:ifVarSet name="totalVat1" type="sum"> <tr>
<th>zzgl. MwSt. <we:shopVat id="1" />%</th>
<td class="price">
<we:sum name="totalVat1" num_format="german" /> €</td>
</tr> </we:ifVarSet>
<we:ifVarSet name="totalVat2" type="sum">
<tr>
<th>zzgl. MwSt. <we:shopVat id="2" />%</th>
<td class="price"> <we:sum name="totalVat2" num_format="german" /> €</td>
</tr>
</we:ifVarSet>
<tr>
<th>Gesamtpreis</th>
<td class="price"><we:sum name="warenkorb" num_format="german" /> €</td>
</tr>
</table>
<input type="hidden" name="fromCart" value="process" />
<input type="submit" id="order" name="order" value="Bestellung abschicken" />
</we:form>
<p>
<we:form id="98">
<input type="submit" value="Warenkorb bearbeiten" />
</we:form>
</p>
<br />
<we:else />
<we:form type="shopliste" id="98">
<!-- the shopping cart -->
<table class="shop">
<tr>
<th>Artikelname</th>
<th class="amount">Anzahl</th>
<th class="price">Preis</th>
<th class="price">Gesamt</th>
</tr>
<we:repeatShopItem shopname="verlag">
<tr>
<td><we:field name="shoptitle" /></td>
<td class="amount"><we:showShopItemNumber type="textinput" shopname="verlag" /></td>
<td class="price"><we:field name="price" num_format="german" /> €</td>
<td class="price"><we:calculate sum="warenkorb" num_format="german"><we:field name="price" num_format="german" />*<we:showShopItemNumber shopname="verlag"></we:calculate> €</td>
<td class="price">
<we:ifShopVat id="1">
<we:calculate print="false" sum="totalVat1">
<we:showShopItemNumber type="print" shopname="verlag" /> *
<we:field name="price" />*<we:field type="shopVat" />/(<we:field type="shopVat" />+100)
</we:calculate>
</we:ifShopVat>
<we:ifShopVat id="2">
<we:calculate print="false" sum="totalVat2">
<we:showShopItemNumber type="print" shopname="verlag" /> *
<we:field name="price" />*<we:field type="shopVat" />/(<we:field type="shopVat" />+100)
</we:calculate>
</we:ifShopVat>
</td>
</we:repeatShopItem>
</table>
<table class="sum">
<tr>
<th>Preis</th>
<td class="price"><we:sum name="warenkorb" num_format="german" /> €</td>
</tr>
<we:ifVarSet name="totalVat1" type="sum"> <tr>
<th>zzgl. MwSt. <we:shopVat id="1" />%</th>
<td class="price">
<we:sum name="totalVat1" num_format="german" /> €</td>
</tr> </we:ifVarSet>
<we:ifVarSet name="totalVat2" type="sum">
<tr>
<th>zzgl. MwSt. <we:shopVat id="2" />%</th>
<td class="price"> <we:sum name="totalVat2" num_format="german" /> €</td>
</tr>
</we:ifVarSet>
<tr>
<th>Gesamtpreis</th>
<td class="price"><we:sum name="warenkorb" num_format="german" /> €</td>
</tr>
</table>
<input type="submit" name="refresh" value="Aktualisieren" />
<input type="submit" name="order" value="Bestellen" />
</we:form>
</we:ifVarNotEmpty>
</we:ifShopEmpty>
Code: Alles auswählen
<we:createShop shopname="verlag" />
<we:addDelShopItem shopname="verlag" />
<we:writeShopData shopname="verlag" pricename="price" netprices="true"/>
<div class="contentBox">
<we:ifEditmode>
<div class="editmode">
Hier geben Sie die Unterüberschrift der Seite ein.
</div>
</we:ifEditmode>
<h2><we:textarea name="headline2" autobr="true" cols="40" rows="3" /></h2>
</div>
<we:ifEditmode>
<div class="contentBox">
<div class="editmode">
Hier geben Sie den Text ein, der erscheint, wenn der Warenkorb noch leer ist.
</div>
<we:textarea wysiwyg="true" name="shoppingCartEmpty" cols="60" inlineedit="false" rows="20" xml="true" removefirstparagraph="true" buttonpos="bottom" classes="imageRight,imageLeft" />
<div class="editmode">
Hier geben Sie den Text ein, der bei erscheinen soll, wenn der Benutzer nicht vom Warenkorb kommt.
</div>
<we:textarea wysiwyg="true" name="shoppingCorrect" cols="60" inlineedit="false" rows="20" xml="true" removefirstparagraph="true" buttonpos="bottom" classes="imageRight,imageLeft" />
<div class="editmode">
Hier geben Sie den Text ein, der bei erfolgreicher Bestellung erscheinen soll.
</div>
<we:textarea wysiwyg="true" name="shoppingProgress" cols="60" inlineedit="false" rows="20" xml="true" removefirstparagraph="true" buttonpos="bottom" classes="imageRight,imageLeft" />
</div>
<we:else />
<we:ifShopEmpty shopname="verlag">
<we:var name="shoppingCartEmpty" />
<we:else /><!-- shopping cart exists, cart or order. -->
<we:ifVarEmpty match="fromCart" type="request">
<we:var name="shoppingCorrect" />
<we:else />
<?php $email = $_POST['s']['Kontakt_Email']; ?>
<we:sendMail id="100" subject="Ihre Demobestellung" recipient="$email" from="em@il.de" mimetype="text/plain" />
<we:var name="shoppingProgress" />
<strong>Anschrift:</strong><br /><br />
<?php echo $_POST['s']['Forename']; ?><br />
<?php echo $_POST['s']['Surname']; ?><br />
<?php echo $_POST['s']['Kontakt_Addresse1']; ?><br />
<?php echo $_POST['s']['Kontakt_Addresse2']; ?><br />
<?php echo $_POST['s']['Kontakt_Land']; ?><br />
<?php echo $_POST['s']['Kontakt_Email']; ?><br />
<table class="shop">
<tr>
<th>Artikelname</th>
<th class="amount">Anzahl</th>
<th class="price">Preis</th>
<th class="price">Gesamt</th>
</tr>
<we:repeatShopItem shopname="verlag">
<tr>
<td><we:field name="shoptitle" /></td>
<td class="amount"><we:showShopItemNumber shopname="verlag" /></td>
<td class="price"><we:field name="price" num_format="german" /> €</td>
<td class="price"><we:calculate sum="warenkorb" num_format="german"><we:field name="price" num_format="german" />*<we:showShopItemNumber shopname="verlag"></we:calculate> €</td><td class="price">
<we:ifShopVat id="1">
<we:calculate print="false" sum="totalVat1">
<we:showShopItemNumber type="print" shopname="verlag" /> *
<we:field name="price" />*<we:field type="shopVat" />/(<we:field type="shopVat" />+100)
</we:calculate>
</we:ifShopVat>
<we:ifShopVat id="2">
<we:calculate print="false" sum="totalVat2">
<we:showShopItemNumber type="print" shopname="verlag" /> *
<we:field name="price" />*<we:field type="shopVat" />/(<we:field type="shopVat" />+100)
</we:calculate>
</we:ifShopVat>
</td>
</tr>
</we:repeatShopItem>
</table>
<table class="sum">
<tr>
<th>Preis</th>
<td class="price"><we:sum name="warenkorb" num_format="german" /> €</td>
</tr>
<we:ifVarSet name="totalVat1" type="sum"> <tr>
<th>zzgl. MwSt. <we:shopVat id="1" />%</th>
<td class="price">
<we:sum name="totalVat1" num_format="german" /> €</td>
</tr> </we:ifVarSet>
<we:ifVarSet name="totalVat2" type="sum">
<tr>
<th>zzgl. MwSt. <we:shopVat id="2" />%</th>
<td class="price"> <we:sum name="totalVat2" num_format="german" /> €</td>
</tr>
</we:ifVarSet>
<tr>
<th>Gesamtpreis</th>
<td class="price"><we:sum name="warenkorb" num_format="german" /> €</td>
</tr>
</table>
<we:deleteShop shopname="verlag" />
</we:ifVarEmpty>
</we:ifShopEmpty>
</we:ifEditmode>
Code: Alles auswählen
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<we:title></we:title>
<we:description/>
<we:keywords/>
<we:charset defined="UTF-8">UTF-8</we:charset>
</head>
<body>
<we:createShop shopname="verlag"/>
<we:ifShopEmpty shopname="verlag">
Der Einkaufswagen ist leer.
<we:else />
Ihre Bestellung<?php echo "\n"; ?>
<?php echo "\n"; ?>
Folgende Bestellung ist soeben bei uns eingegangen:<?php echo "\n"; ?>
<?php echo "\n"; ?>
Adresse:<?php echo "\n"; ?>
<?php echo $_POST['s']['Forename']; ?><?php echo "\n"; ?>
<?php echo $_POST['s']['Surname']; ?><?php echo "\n"; ?>
<?php echo $_POST['s']['Kontakt_Addresse1']; ?><?php echo "\n"; ?>
<?php echo $_POST['s']['Kontakt_Addresse2']; ?><?php echo "\n"; ?>
<?php echo $_POST['s']['Kontakt_Land']; ?><?php echo "\n"; ?>
<?php echo $_POST['s']['Kontakt_Email']; ?><?php echo "\n"; ?>
<table class="shop">
<tr>
<th>Artikelname</th>
<th class="amount">Anzahl</th>
<th class="price">Preis</th>
<th class="price">Gesamt</th>
</tr>
<we:repeatShopItem shopname="verlag">
<tr>
<td><we:field name="shoptitle" /></td>
<td class="amount"><we:showShopItemNumber shopname="verlag" /></td>
<td class="price"><we:field name="price" num_format="german" /> €</td>
<td class="price"><we:calculate sum="warenkorb" num_format="german"><we:field name="price" num_format="german" />*<we:showShopItemNumber shopname="verlag"></we:calculate> €</td><td class="price">
<we:ifShopVat id="1">
<we:calculate print="false" sum="totalVat1">
<we:showShopItemNumber type="print" shopname="verlag" /> *
<we:field name="price" />*<we:field type="shopVat" />/(<we:field type="shopVat" />+100)
</we:calculate>
</we:ifShopVat>
<we:ifShopVat id="2">
<we:calculate print="false" sum="totalVat2">
<we:showShopItemNumber type="print" shopname="verlag" /> *
<we:field name="price" />*<we:field type="shopVat" />/(<we:field type="shopVat" />+100)
</we:calculate>
</we:ifShopVat>
</td>
</tr>
</we:repeatShopItem>
</table>
<table class="sum">
<tr>
<th>Preis</th>
<td class="price"><we:sum name="warenkorb" num_format="german" /> €</td>
</tr>
<we:ifVarSet name="totalVat1" type="sum"> <tr>
<th>zzgl. MwSt. <we:shopVat id="1" />%</th>
<td class="price">
<we:sum name="totalVat1" num_format="german" /> €</td>
</tr> </we:ifVarSet>
<we:ifVarSet name="totalVat2" type="sum">
<tr>
<th>zzgl. MwSt. <we:shopVat id="2" />%</th>
<td class="price"> <we:sum name="totalVat2" num_format="german" /> €</td>
</tr>
</we:ifVarSet>
<tr>
<th>Gesamtpreis</th>
<td class="price"><we:sum name="warenkorb" num_format="german" /> €</td>
</tr>
</table>
</we:ifShopEmpty>
</body>
</html>