Hallo,
ich brauch Hilfe, ich raff es nämlich nicht ganz, außerdem bin ich PHP-Programmier-Noob....
Ich hab Typo3 4.0.1 und tt_products 2.5.0.
Ich hab einen Shop mit einer Payment-Option (Vorkasse) und drei Shipping-Optionen (Versand DE, Versand AT und Versand CH/restliche EU).
Das Template dazu sieht so aus:
plugin.tt_products.payment >
## payment config:
plugin.tt_products.payment {
radio = 1
TAXpercentage = 16
10.title = Vorkasse
10.calculationScript = EXT:tt_products/pi/products_comp_calcScript.inc
}
plugin.tt_products.shipping >
##shipping config:
plugin.tt_products.shipping {
radio = 1
TAXpercentage = 16
10.title = Versand nach Deutschland
10.priceTax = 4.95
10.image.file = fileadmin/shop/ups.gif
20.title = Versand nach Österreich
20.priceTax = 7.95
20.image.file = fileadmin/shop/ups.gif
30.title = Versand restliche EU und Schweiz
30.priceTax = 10.95
30.image.file = fileadmin/shop/ups.gif
}
Nun will aber mein Freund die Versandkosten abstufen.
Versand nach Deutschland soll unter 50 Euro Warenwert 4,95 Euro betragen, darüber Versandkostenfrei sein;
Versand nach Österreich bis 50 Euro 7,95 Euro, bis 100 Euro 4,95 Euro und darüber keine Versandkosten
Versand in die Schweiz/restliche EU unter 100 Euro 10,95 Euro, darüber frei.
Das mit den normalen Versandkosten funktioniert auch mit meinem Template wunderbar. Ich weiß auch, das ich Hand an die Datei "products_comp_calcScript.inc" anlegen muß. Leider hab ich schon viele Tipps hier aus dem Forum ausprobiert, hab aber leider keinerlei Erfolge.
Mein Skript für die Berechnung sieht so aus:
<?php
/*
products_comp_calcScript.php
Calculation script for use with the default products.inc script
The script is based on the assumption that you're going to add a fee for using MasterCard/Eurocard, VISA or Diners Club.
MasterCard and VISA demands 5.75 % percent of the total amount in transaction fee. To compensate for this and let the customer pay the fee, this script calculates how much you need to add to the total in order to fully compensate.
To compensate 5,75% you must add 6.10%, then 5,75 % percent of that total is exactly the same as the amount of the fee.
TypoScript properties:
.feeTax = enter sales-tax percentage for the fee, if any
.feePercent = the percent to be compensated for, default is 5.75 %
*/
$baseAmount = $this->basket->calculatedArray['priceTax']['goodstotal']+$this->basket->calculatedArray['priceTax']['shipping']; // The fee is calculated from the total of the goods AND shipping
$feePercent = doubleval($confScript['feePercent'] ? $confScript['feePercent'] : 5.75); // Fee percent is by default 5.75 %
# Calculate conpensating percentage by: 100/(1-pFee/100)-100 = pComp, where pFee is the percentage, eg. Mastercard is taking (5,75%) and pComp will thus be 6.1 %
$compPercent = 100/(1-$feePercent/100)-100; // The compensation percentage.
$this->basket->calculatedArray['priceNoTax']['payment'] = $baseAmount/100*$compPercent; // Add the amount to the no_tax total
$this->basket->calculatedArray['priceTax']['payment'] = $this->basket->calculatedArray['priceNoTax']['payment'] * (1+$this->basket->conf['payment.']['TAXpercentage']/100); // ..and add the amount to the tax total + tax of the amount, if any
?>
Kann mir hier irgendwer weiterhelfen? Ich bin mit meinem bischen Latein am Ende 😢
Danke im voraus,
Huaba