Zencart 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_folder/includes/classes/order.php and on line #146 replace following code

$this->products[$index] = array(‘qty’ => $new_qty,
‘id’ => $orders_products->fields[‘products_id’],
‘name’ => $orders_products->fields[‘products_name’],
‘model’ => $orders_products->fields[‘products_model’],
‘tax’ => $orders_products->fields[‘products_tax’],
‘price’ => $orders_products->fields[‘products_price’],
‘onetime_charges’ => $orders_products->fields[‘onetime_charges’],
‘final_price’ => $orders_products->fields[‘final_price’],
‘product_is_free’ => $orders_products->fields[‘product_is_free’]);

with this

// Ship200 Weight
$weights = $db->Execute(“select products_weight
from ” . TABLE_PRODUCTS . ”
where products_id = ‘” . (int)$orders_products->fields[‘products_id’] . “‘”);
// Ship200 Weight
$this->products[$index] = array(‘qty’ => $new_qty,
‘id’ => $orders_products->fields[‘products_id’],
‘name’ => $orders_products->fields[‘products_name’],
‘model’ => $orders_products->fields[‘products_model’],
‘tax’ => $orders_products->fields[‘products_tax’],
‘price’ => $orders_products->fields[‘products_price’],
‘onetime_charges’ => $orders_products->fields[‘onetime_charges’],
‘weight’ => $weights->fields[‘products_weight’],
‘final_price’ => $orders_products->fields[‘final_price’],
‘product_is_free’ => $orders_products->fields[‘product_is_free’]);

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 and 35 to the following code:
‘<?php echo addslashes($order->info[total]) ?>’,        //10 Declared Value
‘<?php echo $total_weight ?>’,        //11 Weight
That is it.