Jump to content

Shipping Cost With Product Options


Guest hlfunk

Recommended Posts

I have a number of products all of which have 3 options for size. The product weight for each of the options is different. In my specific case the weights are 8, 13, and 70 pounds.

My problem is how to configure shipping cost by weght.

Thanks in advance for your responses.

Link to comment
Share on other sites

Guest PMinteractive

Ok, perhaps you could add an extra column to 'CubeCart_options_bot', called 'option_weight'. This will contain the weight for that particular option. Each row represents a specific product/option combination so you might want to look into modifying the admin interface to let you add your weight values that way instead of modifying rows in the database.

Now you need to modify the cart to take into account your new weight information.

Somewhere around line 423 of /includes/content/cart.inc.php you will find this code:

$option = $db->select("SELECT ".$glob['dbprefix']."CubeCart_options_bot.option_id, ".$glob['dbprefix']."CubeCart_options_bot.value_id, option_price, option_symbol, value_name, option_name, assign_id FROM `".$glob['dbprefix']."CubeCart_options_bot` INNER JOIN `".$glob['dbprefix']."CubeCart_options_mid` ON ".$glob['dbprefix']."CubeCart_options_mid.value_id = ".$glob['dbprefix']."CubeCart_options_bot.value_id INNER JOIN `".$glob['dbprefix']."CubeCart_options_top` ON ".$glob['dbprefix']."CubeCart_options_bot.option_id = ".$glob['dbprefix']."CubeCart_options_top.option_id WHERE assign_id = ".$value);




replace it with:




// Mod to pull 'option_weight' from table

$option = $db->select("SELECT ".$glob['dbprefix']."CubeCart_options_bot.option_weight, ".$glob['dbprefix']."CubeCart_options_bot.option_id, ".$glob['dbprefix']."CubeCart_options_bot.value_id, option_price, option_symbol, value_name, option_name, assign_id FROM `".$glob['dbprefix']."CubeCart_options_bot` INNER JOIN `".$glob['dbprefix']."CubeCart_options_mid` ON ".$glob['dbprefix']."CubeCart_options_mid.value_id = ".$glob['dbprefix']."CubeCart_options_bot.value_id INNER JOIN `".$glob['dbprefix']."CubeCart_options_top` ON ".$glob['dbprefix']."CubeCart_options_bot.option_id = ".$glob['dbprefix']."CubeCart_options_top.option_id WHERE assign_id = ".$value);



$mod_option_weight = $option['option_weight'];




Next, find this code around line 530:




// work out weight

if($product[0]['prodWeight']>0 && $product[0]['digital']==0){

$totalWeight = ($product[0]['prodWeight'] * $quantity) + $totalWeight;

}




and replace it with:




// mod to work out weight of options - OVERRIDES MAIN PRODUCT WEIGHT IF SET

if ($mod_option_weight > 0 && $product[0]['digital']==0) {

$totalWeight = ($mod_option_weight * $quantity) + $totalWeight;

}

elseif($product[0]['prodWeight']>0 && $product[0]['digital']==0){

$totalWeight = ($product[0]['prodWeight'] * $quantity) + $totalWeight;

}

Then all you should need to do is set up the standard 'By Weight' shipping options and its all good. I haven't actually tried any of this, so let me know if you run into any problems.

Good luck

Link to comment
Share on other sites

Ok, perhaps you could add an extra column to 'CubeCart_options_bot', called 'option_weight'. This will [

...and more deleted.]

Then all you should need to do is set up the standard 'By Weight' shipping options and its all good. I haven't actually tried any of this, so let me know if you run into any problems.

Good luck

Thank you.

HLF

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...