Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

not getting weight and price data from order.php


Lazze Lazer

Recommended Posts

Posted

I have a custom page that gets the order data and reformats parts of it suitable for a shipping company. all other data gets loaded from order.php. ex: customer adresses, shipping etc. and the products are there too. no weight gets loaded. the price turns up once but doesnt add up...?

 

ex:
$v1_1[$i]=$order->products[$i]['qty'];
    $v2_2[$i]=$order->products[$i]['id'];
    $v3_3[$i]=$order->products[$i]['weight'];
    $v4_4[$i]=$order->products[$i]['final_price'];
    $odata_normal .= $v1_1[$i] . ";" . $v2_2[$i] . ";" . $v3_3[$i] . ";" . round($v4_4[$i],2) . $ri;
 print_r($odata_normal);
 echo "<br>";
 echo "Vikt= " . $v3_3[$i] . "<br>";
 echo "Final_Price= " . $v4_4[$i] . "<br>";

output of the print_r: 5;89;;14#

 

Could it be that the fields in the database table orders_products is decimal(15,4) for price and weight and that my script has to take this into account? maybe i have to convert $v3_3 & $v4_4? the fields in the products table of course has values...

 

$prod_array[] = array(

'units' => $order->products[$i]['model'],

'id' => $order->products[$i]['id'] ."/",

'weight' => $order->products[$i]['weight'],

'qty' => $order->products[$i]['qty'],

'price' => $order->products[$i]['final_price']);

 

Here are som code that does some actual calculation where weights and prices should add up:

 

for ($j=0;$j<sizeof($prod_array);$j++){

      $prod_id .= $prod_array[$j]['id'];
      $weight += $prod_array[$j]['weight'];
      $qty = $prod_array[$j]['qty'];
      $final_price += $prod_array[$j]['price'];
      $units += $prod_array[$j]['units'];

     if ($units%3==0){
          $odata_str_array[] = substr($prod_id,0,-1) . ";" . $weight . ";" . round($final_price,2) . $ri;
         // print_r ($odata_str_array);
    echo "<br>";
    $weight=0;
          $final_price=0;
          $prod_id='';
          $units=0;
    
              }
           }

Lars

Posted

get the final_price to add up.

 

but the weight is still missing. NULL is what gets passed from includes/classe/order.php

 

very strange, since qty, ID and other data is passed....

 

 

Lars

Archived

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

×
×
  • Create New...