Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Function $price difference MS1 and MS2


Guest

Recommended Posts

Posted

Hi,

 

Could anyone help me change the following code which worked in osC MS1 to right code that will work in MS2:

 

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;

 

This is in somefile.php in /includes/functions/...

 

Problem with code:

PriceSum is displayed as price with no tax included - although in shop all prices are displayed with TAX included.

So PriceSum must be Price WITH tax.

 

 

Any info on how to get the same data for shipping?

I need to make a same <product> for the shipping - shipping will be just another item on my xml created list.

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...