Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2006
    Posts
    17
    Plugin Contributions
    0

    Default Shipping, Product Category, Question

    Is there a Quick and Easy way to access the categories of the products purchased?

    The reason I ask is the person I'm working for has a crazy shipping scheme. And if all the products are in one category it qualifies for another shipping type.

    I've been looking at the $order variable, but it doesn't seem to contain information about the category type.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Shipping, Product Category, Question

    You could verify the categories_id of each product ...

    Does this client use or intend to use Linked Products? Or will all Products always be in 1 Category and ONLY 1 Category?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Sep 2006
    Posts
    17
    Plugin Contributions
    0

    Default Re: Shipping, Product Category, Question

    God I hope not...

    I was also hoping to not have to do any extra queries if I didn't have to. I was just wondering if it was already sitting in a variable somewhere that was accessable from the shipping modules.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Shipping, Product Category, Question

    This is not built into Zen Cart at this time for the Shipping Modules ...

    You would need to do some custom coding ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Sep 2006
    Posts
    17
    Plugin Contributions
    0

    Default Re: Shipping, Product Category, Question

    I know that. The question I'm trying to ask is: is the category_id of the products under $order->products sitting in $order somewhere or another variable? Or do I need to add it in /includes/classes/order.php?
    Last edited by OmnipotentEntity; 15 Nov 2006 at 09:14 PM.

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Shipping, Product Category, Question

    It is not in the orders anything ...

    You could, if the products are NOT Linked, use the master_categories_id to check this ...

    You could build a function to check what categories the products are in and send back a true or false on whether or not they are all in the same category ...

    Get a list of products from the shopping_cart and do a quick look up of the category ... using a quick loop, you can verify whether or not these are all in the same category ...

    Even if you use Linked Products this can still be done with a function for verification ...

    There are several methods to address this ... but you do need to make sure about the Linked Products issue ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Sep 2006
    Posts
    17
    Plugin Contributions
    0

    Default Re: Shipping, Product Category, Question

    After a lengthy hiatus I've come back to this problem.

    I've made the following changes to the code (1.3.5): (Link to the edited version, if you don't know how or care to apply the diff: here)

    Code:
    155,162c155,173
    <     $orders_products_query = "select orders_products_id, products_id, products_name,
    <                                  products_model, products_price, products_tax,
    <                                  products_quantity, final_price,
    <                                  onetime_charges,
    <                                  products_priced_by_attribute, product_is_free, products_discount_type,
    <                                  products_discount_type_from
    <                                   from " . TABLE_ORDERS_PRODUCTS . "
    <                                   where orders_id = '" . (int)$order_id . "'";
    ---
    >
    >     $orders_products_query = "select " . TABLE_ORDERS_PRODUCTS . ".orders_products_id as orders_products_id, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".products_id as products_id, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".products_name as products_name, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".products_model as products_model, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".products_price as products_price, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".products_tax as products_tax, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".products_quantity as products_quantity, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".final_price as final_price, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".onetime_charges as onetime_charges, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".products_priced_by_attribute as products_priced_by_attribute, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".product_is_free as product_is_free, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".products_discount_type as products_discount_type, "
    >                                        . TABLE_ORDERS_PRODUCTS . ".products_discount_type_from as products_discount_type_from, "
    >                                        . TABLE_PRODUCTS . ".master_categories_id as master_categories_id "
    >                                   . " from " . TABLE_ORDERS_PRODUCTS .
    >                                   " left join " . TABLE_PRODUCTS .
    >                                   " on " . TABLE_ORDERS_PRODUCTS. ".products_id = " . TABLE_PRODUCTS . ".products_id "
    >                                   . TABLE_ORDERS_PRODUCTS . "where orders_id = '" . (int)$order_id . "'";
    199c210,211
    <                                       'products_discount_type_from' => $orders_products->fields['products_discount_type_from']);
    ---
    >                                       'products_discount_type_from' => $orders_products->fields['products_discount_type_from'],
    >                                       'master_categories_id' => $orders_products->fields['master_categories_id']);
    433a446
    >                                       'master_categories_id' => $products[$i]['master_categories_id'],
    727a741
    >                               'master_categories_id' => $this->products[$i]['master_categories_id'],
    981c995
    < ?>
    \ No newline at end of file
    ---
    > ?>
    I went ahead and did a print_r on the object when it's passed to the shipping estimator, and I got this:

    Code:
    order Object
    (
        [observers] => Array
            (
            )
    
        [info] => Array
            (
                [order_status] => 1
                [currency] => USD
                [currency_value] => 1.00000000
                [payment_method] => 
                [payment_module_code] => 
                [coupon_code] => 
                [shipping_method] => 
                [shipping_module_code] => 
                [shipping_cost] => 
                [subtotal] => 39.97
                [tax] => 0
                [total] => 39.97
                [tax_groups] => Array
                    (
                        [Sales Tax] => 0
                    )
    
                [comments] => 
                [ip_address] => 255.255.255.255
            )
    
        [totals] => Array
            (
            )
    
        [products] => Array
            (
                [0] => Array
                    (
                        [qty] => 1
                        [name] => Jon Amraphel At Early Morning Practice Print
                        [model] => 
                        [tax] => 0
                        [tax_description] => Sales Tax
                        [price] => 10.0000
                        [final_price] => 10
                        [onetime_charges] => 0
                        [weight] => 0.5
                        [products_priced_by_attribute] => 0
                        [product_is_free] => 0
                        [products_discount_type] => 0
                        [products_discount_type_from] => 0
                        [master_categories_id] => 
                        [id] => 19
                        [rowClass] => rowEven
                    )
    
                [1] => Array
                    (
                        [qty] => 2
                        [name] => Exploitation Now, Volume Two
                        [model] => 
                        [tax] => 0
                        [tax_description] => Sales Tax
                        [price] => 9.9900
                        [final_price] => 9.99
                        [onetime_charges] => 0
                        [weight] => 0.382
                        [products_priced_by_attribute] => 0
                        [product_is_free] => 0
                        [products_discount_type] => 0
                        [products_discount_type_from] => 0
                        [master_categories_id] => 
                        [id] => 57
                        [rowClass] => rowOdd
                    )
    
                [2] => Array
                    (
                        [qty] => 1
                        [name] => Errant Story, Volume Two
                        [model] => 
                        [tax] => 0
                        [tax_description] => Sales Tax
                        [price] => 9.9900
                        [final_price] => 9.99
                        [onetime_charges] => 0
                        [weight] => 0.5625
                        [products_priced_by_attribute] => 0
                        [product_is_free] => 0
                        [products_discount_type] => 0
                        [products_discount_type_from] => 0
                        [master_categories_id] => 
                        [id] => 4
                        [rowClass] => rowEven
                    )
    
            )
    
        [customer] => Array
            (
                [firstname] => Michael
                [lastname] => Reilly
                [company] => 
                [street_address] => 143 Scottwood Dr
                [suburb] => 
                [city] => Ft. Walton Beach
                [postcode] => 32548
                [state] => Florida
                [zone_id] => 18
                [country] => Array
                    (
                        [id] => 223
                        [title] => United States
                        [iso_code_2] => US
                        [iso_code_3] => USA
                    )
    
                [format_id] => 2
                [telephone] => 850-555-5555
                [email_address] => OmnipotentEntity######################
            )
    
        [delivery] => Array
            (
                [firstname] => Michael
                [lastname] => Reilly
                [company] => 
                [street_address] => 123 Anonymous Way
                [suburb] => 
                [city] => The Burbs
                [postcode] => 12321
                [state] => Florida
                [zone_id] => 18
                [country] => Array
                    (
                        [id] => 223
                        [title] => United States
                        [iso_code_2] => US
                        [iso_code_3] => USA
                    )
    
                [country_id] => 223
                [format_id] => 2
            )
    
        [content_type] => physical
        [email_low_stock] => 
        [products_ordered_attributes] => 
        [products_ordered] => 
        [products_ordered_email] => 
        [billing] => Array
            (
                [firstname] => 
                [lastname] => 
                [company] => 
                [street_address] => 
                [suburb] => 
                [city] => 
                [postcode] => 
                [state] => 
                [zone_id] => 
                [country] => Array
                    (
                        [id] => 
                        [title] => 
                        [iso_code_2] => 
                        [iso_code_3] => 
                    )
    
                [country_id] => 
                [format_id] => 
            )
    
    )
    The one I added (master_categories_id) is coming up null, and I don't believe it's the query, I think I missed something I have to edit or something. Any ideas?

  8. #8
    Join Date
    Sep 2006
    Posts
    17
    Plugin Contributions
    0

    Default Re: Shipping, Product Category, Question

    No takers at all?

 

 

Similar Threads

  1. v139h Virtual product setup question regarding shipping
    By jgold723 in forum General Questions
    Replies: 3
    Last Post: 5 Apr 2013, 07:28 PM
  2. Replies: 22
    Last Post: 12 Apr 2010, 04:45 PM
  3. Shipping carrier by product category
    By bellemount in forum Addon Shipping Modules
    Replies: 1
    Last Post: 27 Nov 2007, 05:00 AM
  4. Product category question
    By parmaham in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 7 Mar 2007, 11:22 AM
  5. Product Category Box Question
    By labelsru in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 12 May 2006, 11:19 AM

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