Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2013
    Location
    California
    Posts
    22
    Plugin Contributions
    0

    Default where is shopping cart information stored?

    I am having a really difficult time figuring out where shopping cart information is stored.

    We use flat rate usps boxes for shipping. I'm making a custom module that prices flat rate shipping based on how many items we can fit into a box. We have items of varying size so it gets a little complicated.

    Theoretically it works like this.

    Code:
    These are the amounts that fit into a box
    
    item        small      medium     large
    A            2           10            30
    B            500        1500         5000
    C            2000      10000       18000
    So if they bout 200 of item b and 1500 of item c it knows that 500 of item a would fit into a small box and we have 300/500 or 3/5's room left in the box. so 3/5's of item c's max of 2000 is room left for item c.

    so. 2000 * .6 = 1200. We can fit 1200 of item c into the box. They bought 1500 of item c so it doesn't fit.

    Then we do the same check again for the medium and large boxes. If it fits in one of those fine if not mutiply our box values by two and double the price and check again for the small box so and and so forth until it finally fits.

    Once you start getting into 2 boxes flat rate becomes more expensive than usps and they will likely pick the cheaper usps option.

    However, how do I get the contents of their shopping cart into my code? I cant seem to figure out at all where that information is held at.

  2. #2
    Join Date
    Aug 2013
    Location
    California
    Posts
    22
    Plugin Contributions
    0

    Default Re: where is shopping cart information stored?

    over 60 page views and not a reply yet. Is this information not common knowledge? Is every one ignoring me because I should have searched Google first? The problem with google is the keyword "shopping cart." When you google zen cart you get websited related to zen cart or that use zen cart. When you google "shopping cart" you get websites related to ecommerce shopping cart solutions. When you google "how do you get information from zen carts shopping cart php" you get eCommerce solutions and third party customization companies for zen cart. Still a little lost as where to get started.

    Should I be looking in the database for shopping cart information? Currently my website forces them to log in to shop so I dont think it would be that complicated to grab a user id and search the shopping cart entries that are related to it. I just cant find them.

    *NOTE: Search engines index this Zen Cart® support site very quickly. Posting your URL will cause your site and your post to show up in search engines. If you want to prevent that, put spaces between each letter of the domain name in your URL.
    Saw that and just wanted to throw in www.glicco.com =P


    EDIT: OMG its zen_basket! I never thought to call it a basket.

  3. #3
    Join Date
    Aug 2013
    Location
    California
    Posts
    22
    Plugin Contributions
    0

    Default Re: where is shopping cart information stored?

    zen_customers_basket*

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: where is shopping cart information stored?

    Quote Originally Posted by nazca View Post
    I'm making a custom module that prices flat rate shipping based on how many items we can fit into a box. We have items of varying size so it gets a little complicated.

    ... how do I get the contents of their shopping cart into my code? I cant seem to figure out at all where that information is held at.
    Don't look to database tables, because that's stale information.
    What you're talking about doesn't come from database tables.

    Shipping modules must deal with the shopping_cart class and/or the orders class ... which deal with the current object that the customer is actually using.

    And, since you've specifically mentioned usps, it would be most efficient for you to extend the usps shipping module to add the functionality you mention.
    Or, similarly, the existing flat-rate shipping module would also be a useful starting point.

    In fact, there's a (slightly outdated) usps module variant that deals with dimensions stuff, which might be useful fodder.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Aug 2013
    Location
    California
    Posts
    22
    Plugin Contributions
    0

    Default Re: where is shopping cart information stored?

    Where are those two classes initiated at? application_top.php?

    what are their differences?

  6. #6
    Join Date
    Aug 2013
    Location
    California
    Posts
    22
    Plugin Contributions
    0

    Default Re: where is shopping cart information stored?

    this is driving me absolutely nuts. Why cant zen cart just hold shopping cart information in a session. how do I get the product information of the items in their shopping cart into some simple variables. Where the heck is it at? Why is there no documentation on this? I'm so frustrated.

    looking inside usps.php

    PHP Code:
    //line16 - sorting quotes numerically?  who cares.

    //line 33 - we find the usps class.  Great!  where the hell does it get ITS information from?
    //lets look.

    //line 79 creates a usps function that seems to define the order global variable.

    //line 95 looks to see what zones your in and their in and random garbage - dont care.

    //line 119 - an array that defines a billion differente transit types form $this->types where I have no idea came from.

    //line 317 all of a suddon we're getting a quote?!  a quote of what?!  It never asked what was in the shopping cart?  


    where is order at.  usps.php just uses it but never asks for it any where.  likely because this page is being called by index.php

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: where is shopping cart information stored?

    I must apologize: I made an error in my previous post. The main USPS module doesn't loop through the products in the cart, as it leaves that job to the shopping-cart class (unlike the older module which was obsoleted by recent usps upgrades).

    Instead, it calculates boxes based on weight, which is prepared by code in the shopping-cart class while products are being added to the cart, via:
    $_SESSION['cart']->show_weight()

    If you're wanting to loop through the list of products already in the cart, use the existing session object:
    $_SESSION['cart']->get_products();

    You can see the details of all those class methods in the shopping_cart class, which is located in /includes/classes/shopping_cart.php
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. where is shopping cart items stored in DB?
    By nonoobsnofun in forum General Questions
    Replies: 2
    Last Post: 20 Jan 2011, 02:22 AM
  2. Replies: 2
    Last Post: 24 Jun 2010, 01:51 AM
  3. Where is product information stored?
    By 5tar5hine in forum General Questions
    Replies: 4
    Last Post: 11 Nov 2009, 10:29 PM
  4. Where are EZ Pages Stored
    By Petzlifedirect.com in forum General Questions
    Replies: 10
    Last Post: 19 Mar 2007, 05:31 PM
  5. Where are cart contents stored?
    By superprogrammer in forum General Questions
    Replies: 16
    Last Post: 6 Jul 2006, 07:50 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