OScommerce adding the weight to Ship200 automatically (OneByOne Version)

(OneByOne Version)

add_weight

Here are the instructions of what to do to add weight to Ship200 automatically

Step 1.

open /admin/includes/classes/order.php and on line #80 replace following code
      $orders_products_query = tep_db_query(“select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from ” . TABLE_ORDERS_PRODUCTS . ” where orders_id = ‘” . (int)$order_id . “‘”);
      while ($orders_products = tep_db_fetch_array($orders_products_query)) {
        $this->products[$index] = array(‘qty’ => $orders_products[‘products_quantity’],
                                        ‘name’ => $orders_products[‘products_name’],
                                        ‘model’ => $orders_products[‘products_model’],
                                        ‘tax’ => $orders_products[‘products_tax’],
                                        ‘price’ => $orders_products[‘products_price’],
                                        ‘final_price’ => $orders_products[‘final_price’]);
with this
      $orders_products_query = tep_db_query(“select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price,products_id  from ” . TABLE_ORDERS_PRODUCTS . ” where orders_id = ‘” . (int)$order_id . “‘”);
      while ($orders_products = tep_db_fetch_array($orders_products_query)) {
 
$orders_products_query2 = tep_db_query(“select products_weight  from products where products_id = ‘” . (int)$orders_products[‘products_id’] . “‘”);
$orders_products2 = tep_db_fetch_array($orders_products_query2);
 
        $this->products[$index] = array(‘qty’ => $orders_products[‘products_quantity’],
                                        ‘name’ => $orders_products[‘products_name’],
                                        ‘model’ => $orders_products[‘products_model’],
                                        ‘tax’ => $orders_products[‘products_tax’],
                                        ‘price’ => $orders_products[‘products_price’],
                                        ‘weight’ => $orders_products2[‘products_weight’],
                                        ‘final_price’ => $orders_products[‘final_price’]);
 
Step 2.
Open /admin/ship200_onebyone_addon.php and replace line#12 from following xode:
if($postback_url != “”){$keyForUpdate = “$_GET[oID]”;}else{$keyForUpdate = “”;}
with this
 
if($postback_url != “”){$keyForUpdate = “$_GET[oID]”;}else{$keyForUpdate = “”;}
// Adding Weight Calculation
foreach($order->products as $value){
$total_weight += $value[‘weight’];
}
then just change line#35 to the following code:
‘<?php echo $total_weight ?>’,        //11 Weight
That is it.