Guest Posted August 22, 2005 Posted August 22, 2005 Hi, Can anyone tell me how to add the shipping cost to this XML output code? Following code is the output which includes 2 articles from order: <PRODUCT> <PageDescription>Test product</PageDescription> <Price>0.83</Price> <PriceNoTax>0.8333</PriceNoTax> <TaxRate>20</TaxRate> <Quantity>1</Quantity> <PriceSum>0.83</PriceSum> <PriceSumNoTax>0.67</PriceSumNoTax> <PriceTax>0.16</PriceTax> <Unit>kos</Unit> <ArticleNumber>490</ArticleNumber> </PRODUCT><PRODUCT> <PageDescription>10337 BATTERY SONY R6/3 (NS) "AA" 1,5V</PageDescription> <Price>208.33</Price> <PriceNoTax>208.3333</PriceNoTax> <TaxRate>20</TaxRate> <Quantity>1</Quantity> <PriceSum>208.33</PriceSum> <PriceSumNoTax>166.67</PriceSumNoTax> <PriceTax>41.66</PriceTax> <Unit>kos</Unit> <ArticleNumber>186</ArticleNumber> </PRODUCT> I would need shipping to be added to this also as a standard article something like: <PRODUCT> <PageDescription>Shipping charge</PageDescription> <Price>120</Price> <PriceNoTax>100</PriceNoTax> <TaxRate>20</TaxRate> <Quantity>1</Quantity> <PriceSum>120</PriceSum> <PriceSumNoTax>100</PriceSumNoTax> <PriceTax>20</PriceTax> <Unit>kos</Unit> <ArticleNumber>500</ArticleNumber> </PRODUCT> The function that creates this code is in /includes/functionc/pay.php: function make_order_line($description, $price, $tax_rate, $quantity, $unit, $article_number){ $price_w_tax = round($price, 2); $price_sum = round($price_w_tax * $quantity, 2); $price_sum_no_tax = round(($price / 100) * (100 - $tax_rate), 2); $price_tax = round($price_sum - $price_sum_no_tax, 2); $price = str_replace(",", ".", $price); $price_w_tax = str_replace(",", ".", $price_w_tax); $tax_rate = str_replace(",", ".", $tax_rate); $quantity = str_replace(",", ".", $quantity); $price_sum = str_replace(",", ".", $price_sum); $price_sum_not_tax = str_replace(",", ".", $price_sum_no_tax); $price_tax = str_replace(",", ".", $price_tax); $xml = "<PRODUCT> <PageDescription>$description</PageDescription> <Price>$price_w_tax</Price> <PriceNoTax>$price</PriceNoTax> <TaxRate>$tax_rate</TaxRate> <Quantity>$quantity</Quantity> <PriceSum>$price_sum</PriceSum> <PriceSumNoTax>$price_sum_no_tax</PriceSumNoTax> <PriceTax>$price_tax</PriceTax> <Unit>$unit</Unit> <ArticleNumber>$article_number</ArticleNumber> </PRODUCT>"; return $xml; } I know it's a lot of code displayed but can anyone help me? Thanks! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.