Hi
I've already customized Sage Line 50 Integration contribution,
but I need to do some more work on it.
What I'm trying to do is to get the shipping information / cost out when I export and I got that working, but when there is more than one product in an order the shipping cost is added for every product. I know why it does it, but I don't have any solution for it.
You will see the problem in the code I'll list.
And don't mind that the code is very untidy
PHP Code:
$shipping_q = "SELECT *
FROM " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL ." ot
WHERE o.orders_status <= $statustosages AND date_purchased >= $datestart AND date_purchased <= $dateend
AND ot.class = 'ot_shipping'
AND ot.orders_id = $orderid ";
$shipping_query = $db->Execute($shipping_q);
$saleprice = $Orderedproduct->fields["final_price"];
$output_prod["Sales_Price"]=number_format ($saleprice, 2, '.', '') . ";";
$output_prod["quantity"]= $Orderedproduct->fields['products_quantity'] . "\r\n";
$prodprice=$prodprice*$Orderedproduct->fields['products_quantity'];
$totprice = $prodprice+$totprice;
$Orderedproduct->MoveNext();
$output_ship["ShippingID"] = $shipping_query->fields['orders_id'] . ";";
$output_ship["ShippingModell"] = "Frakt;";
$output_ship["ShippingDesc"] = "Frakt;";
$output_ship["ShippingCost"] = $shipping_query->fields['value'] . ";";
$output_ship["Shippingquantity"]= "1 \r\n";
$output = array_merge($output_prod, $output_ship);
zen_sages_fwrite($output);
} //6
Bookmarks