Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    57
    Plugin Contributions
    0

    red flag 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?

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default 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.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Mar 2009
    Posts
    57
    Plugin Contributions
    0

    Default Re: bozo question about database access

    Quote Originally Posted by kuroi View Post
    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?

 

 

Similar Threads

  1. Shipping Module Programming Question about weight and free shipping
    By voltar in forum Built-in Shipping and Payment Modules
    Replies: 59
    Last Post: 18 Nov 2011, 10:29 PM
  2. Question about 'featured' and 'specials' database tables
    By apsona in forum Setting Up Specials and SaleMaker
    Replies: 3
    Last Post: 29 Nov 2010, 05:52 AM
  3. Stupid Question about Layout Boxes and EZ-Pages
    By Solomoriah in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 4 Oct 2010, 03:15 PM
  4. Question about flat rate shipping and international orders
    By teqmedia in forum Built-in Shipping and Payment Modules
    Replies: 8
    Last Post: 24 Sep 2009, 08:34 PM
  5. Product weight and shipping boxes
    By jkos in forum General Questions
    Replies: 2
    Last Post: 3 Jun 2008, 08:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR