bozo question about database and calculating shipping boxes and weight
OK, I need to modify the site for our particular needs
we list products by the item, but sell by the box, so for every item, the minimum quantity and order quantity are the same, usually 100 or 200, however many are in each box.
Fine, now I'm working on a shipping module that will calculate how many boxes there are and how much each one weighs, but I can't seem to access the products_quantity_order_min column for a given product.
so, shipping module has access to the shopping cart.
I think it reads like this:
$products_array = $_SESSION['cart']->get_products();
for ($i=0; $i<count($products_array); $i++)
{do stuff}
Here's some psudocode of what I'd like:
For each item[$i]
itemWeight * productMinimum = boxWeight;
totalItems / productMinimum = #ofBoxes;
next item
totalWeight = sum boxWeight [$i];
total#Boxes = sum #ofBoxes[$i];
except I can't seem to access product Minimum.
Any ideas?
Re: bozo question about database access
Had a quick look at the includes/classes/orders class and in particular at the get_products() function in there (about line 1050).
It does look as though the column you want is being extracted from the database at the beginning of the function, but not added to the products_array at the end.
You could try adding it and see if that makes it available to you.
Re: bozo question about database access
Quote:
Originally Posted by
kuroi
Had a quick look at the includes/classes/orders class and in particular at the get_products() function in there (about line 1050).
It does look as though the column you want is being extracted from the database at the beginning of the function, but not added to the products_array at the end.
You could try adding it and see if that makes it available to you.
I only have 1039 lines in my includes/classes/order.php file. Are you up-to-date?
Anyways, I looked at the line (427) and that's basically what I'm doing:
Code:
$products_array = $_SESSION['cart']->get_products();
for ($i=0; $i<count($products_array); $i++)
if (zen_get_product_is_always_free_shipping($products_array[$i]['id']) == false){
$this->_addItem ($products_array[$i][quantity],
$products_array[$i][final_price],
$products_array[$i][weight],
$products_array[$i][length],
$products_array[$i][width],
$products_array[$i][height],
$products_array[$i][model]."/".$products_array[$i][name],
$products_array[$i][ready_to_ship],
$products_array[$i][dim_type],
$products_array[$i][weight_type]); . . .
and then later I'm making a SOAP array
Code:
$params2 = array(
"Shipment"=>array(
"PackageInformation" =>array(
"PiecesInformation"=> array(
"Pieces[$i]"=>array(
"Weight"=>array(
"Value"=>$products_array[$i][weight] * SOMETHING_THAT_GETS_MY_MINIMUM_VALUE,
"WeightUnit"=>SOMETHING_FOR_WEIGHT_TYPE, . . .
stuff like that. But It will calculate the weight, but not for each box.
Does that help?