Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2010
    Location
    Fredericksburg, VA
    Posts
    3
    Plugin Contributions
    0

    Default Access cart conents from shipping module

    I have just recently started using Zen Cart and have been pretty impressed thus far. I had been using OsCommerce for projects like this in the past but decided to make the switch to Zen finally.

    Anyhow before we decided on ZenCart I had written a script to do some custom shipping calculations according to the particular part numbers, quantities and zip code the items were being shipped to and it worked out very well.

    Now that we have ZenCart up and running I'm trying to port this code over as a shipping module and am stuck at the part where I retrieve the parts currently in the cart to determine the shipping rate. I looked at some of the other modules that came with my base install and they seem to return a flat rate based on a basic set of criteria or quote a rate by an estimated number of boxes and weight per box. While I'm sure this works great for most people I'd really like to be able to retrieve the cart information (qty & id mainly) from inside the quote function of the module I've created from hacking up the flat rate module

    Sorry if this is answered on the forums already. The number of results I got was astronomical when searching as the terms being used here are pretty general/far reaching.
    Last edited by ayrscott; 7 Aug 2010 at 11:05 PM. Reason: glaring typo

  2. #2
    Join Date
    Aug 2010
    Location
    Fredericksburg, VA
    Posts
    3
    Plugin Contributions
    0

    Default Re: Access cart conents from shipping module

    Just wanted to post here and mention that I did a little more digging after posting the other day and found the easiest way to do this is simply using a copy of the cart class that's in the session variables. If there is a better way to do this please feel free to correct me.
    PHP Code:
        # Retrieve the list of parts in our cart so we can get their product ID for shipping calculations
        
    $ship_cart $_SESSION['cart'];
        
    $ship_products $ship_cart->get_products();

        
    # Create a variable to store our data for part ID's and qtys
        
    $parts_to_ship = array();
        foreach(
    $ship_products as $key => $values){
          
    $parts_to_ship[$values['product_id']] = $values['quantity'];
        } 

 

 

Similar Threads

  1. How to check cart contents from shipping module?
    By benbirdx in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 27 Jul 2009, 05:37 PM
  2. Replies: 1
    Last Post: 28 Jan 2009, 01:50 AM
  3. access zen cart from html site?
    By HoustonMcDog in forum General Questions
    Replies: 2
    Last Post: 5 Jun 2008, 12:37 AM
  4. Migrating USPS Shipping Module From Other Shopping Cart
    By krishtaurus in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 23 Apr 2008, 05:05 PM

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