Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    18
    Plugin Contributions
    0

    Default How can I restrict shipping choices based on kinds of products in the cart?

    OK, not sure if this is in the right topic, but hope I get some help here. I am attempting to modify the logic of the shopping cart shipping information. On a per product basis I have modified the products table to include two new boolean fields, one for canada post and one for UPS. When the user checksout I wish to check all cart items to see if which methods of shipping pertain to each and present to the user true totals as some of their orders may be split shipping (case in point, Canada Post will not ship Ammunition, only UPS will...user has 3 ammunition products in cart and another item that can go either or...we need to give the user the option to split this up). Anyhow, I'll deal with that later...for now my issue is this. I find tracking down the functions and methods somewhat difficult in Zen. Right now I am trying to determine what array element names exist in the array $product (foreach ($productArray as $product) ) which is used in the tpl_shoppingcartdefault file. Attempting to output array elements by key position does nothing $product[6] for instance). I've determined through a count that their are 19 positions in the array, but I need to know how to acccess each without knowing their element reference names!! I need the productid for each item in the array, and of course productid, product_id and the obvious don't seem to exist. In what file is the Session variable 'cart' created?? I can't seem to find that in the obvious places. Also, does there exist a dev manual for zen cart? Is there a way to view all current session variables at any given time, like a session var page??
    Last edited by bladerogers; 13 Sep 2009 at 06:58 PM.

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: New to Zen, need some Session var anc cart product direction

    Rather than reinvent the wheel...from your basic description there is a commercial module for "per item" shipping that has been reported to be highly versatile. You might open a dialog with them.
    PM me for reference.
    As to the rest, one of the Dev's will have to fill you in on the session programming.
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Sep 2009
    Posts
    18
    Plugin Contributions
    0

    Default Re: New to Zen, need some Session var anc cart product direction

    Absolutly! If this already exists, please point me in the direction of the mod! I looked high and low and couldn't find anything that fit the bill, but perhaps I missed this. thanks! :)

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: New to Zen, need some Session var anc cart product direction

    PM me
    Being commercial, forum guidlines prefer this privately
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Sep 2009
    Posts
    18
    Plugin Contributions
    0

    Default Re: New to Zen, need some Session var anc cart product direction

    Please understand, I am not looking for a modification to charge shipping on a per item basis, but to determine what shipping options are available for each item. Currently there are only two shipping options we use, CP and UPS. In each cart upon checkout we will check the cart and determine shipping using one method including all items that can be shipped using method A only and method A and B, and also determine cost of shipping for those items marked only B and A and B. We will still be using CP and UPS modules to determine actual shipping costs. The shipping on a per-item bases is cost per item, at least that is the only module I could find. THis is different...are you referring to another one that would work in this case?

    Thanks!

  6. #6
    Join Date
    Sep 2009
    Posts
    18
    Plugin Contributions
    0

    Default Re: New to Zen, need some Session var anc cart product direction

    Kobra, thanks for the direction, but that particular module does not do what we require. I do think I'll have to move forward with a custom modification. I need to be able to view current session items, will look into that.

  7. #7
    Join Date
    Sep 2009
    Posts
    18
    Plugin Contributions
    0

    Default Re: How can I restrict shipping choices based on kinds of products in the cart?

    found the API, got a good start

    $CartProductIDs = $_SESSION['cart']->get_product_id_list(); returns comma sep product ids. I'll take it from there. Not sure how I didn't stumble on that API up until now.

    Thanks all!

  8. #8
    Join Date
    Jan 2004
    Posts
    66,442
    Plugin Contributions
    279

    Default Re: New to Zen, need some Session var anc cart product direction

    http://www.zen-cart.com/forum/showpo...44&postcount=5
    http://www.zen-cart.com/forum/showpo...97&postcount=9
    These 2 posts discuss something akin to the following code, which is inserted into the constructor method of each of the shipping modules you want restrictions to occur in.
    Basically this example looks up the "products_model" field from the data in the products in the cart, to check for certain match combinations, and enables the module if those are found.
    You could do similarly using something like the products_id field and disabling the module instead (with false instead of true):
    Code:
    	  if (IS_ADMIN_FLAG == false) {
               if ($_SESSION['cart']->in_cart_check('products_model','NAV') > 4) && $_SESSION['cart']->in_cart_check('products_model','MP') > 0) ) {
    	    $this->enabled = true;
    	  }
    Other semi-related discussions:
    http://www.zen-cart.com/forum/showth...104#post781104
    http://www.zen-cart.com/forum/showthread.php?t=133190
    http://www.zen-cart.com/forum/showthread.php?t=126162

    (Or you could use the get_products() or get_product_id_list() methods and do your own looping instead.)
    .

    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.

  9. #9
    Join Date
    Sep 2009
    Posts
    18
    Plugin Contributions
    0

    Default Re: How can I restrict shipping choices based on kinds of products in the cart?

    Thanks DrByte, definitely that helps me!

 

 

Similar Threads

  1. v139h Restrict Products in Cart Based on Other Products in Cart
    By lindasdd in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 2 Nov 2013, 03:26 PM
  2. Replies: 0
    Last Post: 17 Sep 2012, 09:33 PM
  3. Restrict Products based on Country
    By ultra_mao in forum Setting Up Categories, Products, Attributes
    Replies: 14
    Last Post: 19 Jun 2010, 11:01 PM
  4. HOW CAN I AUTO-SELECT SINGLE-ATTRIBUTE CHOICES DURING ADD-TO-CART process?
    By wweyland in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 1 Dec 2009, 02:06 AM
  5. Payment Choices based on Shipping
    By Bootyrat in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 30 Aug 2006, 02:32 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