Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Sep 2005
    Posts
    189
    Plugin Contributions
    0

    Default Product_ID for product on product_info page

    Hello,

    I noticed that when a product is displayed on the info page there might be two product_id's involved:

    1. product_id=1, which appears to mean that the product wasn't yet included in the shopping cart
    2. product_id=<some generated identifier string>, which means that the product was already included in the cart has was assigned this (temporary?) product_id

    is the product_id a good way to distinguish between products in the info page that are displayed, whether they are already included in the shopping cart or not?


    thank you,

    Daniel

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

    Default Re: Product_ID for product on product_info page

    No ...

    The products_id=34 vs products_id=34:4efe16a8d59724d68e2bb21a7c1f8e5f

    Means that the product happens to be in the shopping cart with attributes and you came from the shopping_cart page ...

    But, were you to get there via the Catalog to the Product Listing ... you'd see products_id=34 even if in the shopping_cart ...

    You can use a function to see if a product is in the shopping cart based on the products_id ...
    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: v1.5.5]
    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 2005
    Posts
    189
    Plugin Contributions
    0

    Default Re: Product_ID for product on product_info page

    Hello Ajeh,

    Thank you for your reponse.

    Is it however save to assume that when product_id=1, that the page displays a fresh product which hasen't yet been added to the cart?

    Said differently, is the identifier "1" allocated to denote the viewing of a new product not yet added to the shopping cart?


    thanks,

    Daniel

    p.s. what function would i use to check whether a product_id is in the shopping cart?
    Last edited by grossd; 23 Jul 2006 at 04:38 AM.

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

    Default Re: Product_ID for product on product_info page

    No ... products_id 1 is the same as products_id 1:whatever if there are attributes and you are coming from the shopping cart ...

    If there were no attributes, it would still remain products_id 1

    $_SESSION['cart']->in_cart($products_id)

    where products_id is the products_id you are checking to see if it is in the cart:

    A Product with no attributes will return true:
    $_SESSION['cart']->in_cart($products_id)

    But if that was in the cart with attributes would come up false, so you have to look it up in this manner:
    $_SESSION['cart']->in_cart((int)$products_id)

    That strips away the attributes to check if the Product itself is in the cart at all ...
    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: v1.5.5]
    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 2005
    Posts
    189
    Plugin Contributions
    0

    Default Re: Product_ID for product on product_info page

    Quote Originally Posted by Ajeh

    $_SESSION['cart']->in_cart((int)$products_id)

    That strips away the attributes to check if the Product itself is in the cart at all ...
    Hello Ajeh,

    Thank you for your clarification. So $product_id is just a "temporary" identifier passed to the product_info page, which, when the product has attributes, includes a string "prepended".

    BTW, the (int)$product_id in the above quote appears a bit strange to me. If $product_id is a string of the form 1:will not work when $prioduct_id is a string such as: 1:68d21c9b31936de13449ba9d5b7893f3, then casting such a string to an integer, may be undefined ...


    thanks,

    Daniel

  6. #6
    Join Date
    Sep 2005
    Posts
    189
    Plugin Contributions
    0

    Default Re: Product_ID for product on product_info page

    Hello Ajeh,

    In the end i used the following, which seems to work ...

    if ($_SESSION['cart']->in_cart($_GET['products_id'])) ...


    thanks

    Daniel

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

    Default Re: Product_ID for product on product_info page

    NOTE: That will only tell you if that exact product_id and attributes are in the shopping cart ...

    That means ... you came from shopping cart ...

    If you add a product with attributes ... and come back to the product from anything other than the shopping_cart link ... that will say that the product is NOT in the shopping cart because the products_id vs products_id:attributestuff is not the same thing ...
    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: v1.5.5]
    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!

  8. #8
    Join Date
    Sep 2005
    Posts
    189
    Plugin Contributions
    0

    Default Re: Product_ID for product on product_info page

    Hello Ajeh,

    Thank you again for your comments.

    So, i am wondering, what is the best way to determine whether a product displayed in the product_info page has a specific attribute defined, and that that attribute has already a value assigned?


    thanks,

    Daniel

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

    Default Re: Product_ID for product on product_info page

    Type very very slowly ...

    Do you want to know if the Widget is in the Shopping Cart?

    Or, do you want to know if the RED Widget is in the Shopping Cart?

    Do you want to know if the RED LARGE Widget is in the Shopping Cart?

    What about the GREEN SMALL Widget?

    Or do you just need to know that the Widget is in the Shopping Cart in some shape or form?
    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: v1.5.5]
    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!

  10. #10
    Join Date
    Sep 2005
    Posts
    189
    Plugin Contributions
    0

    Default Re: Product_ID for product on product_info page

    Hello Ajeh,

    For a particular product i have defined a coverOrderId attribute. There are other products which do not have the coverOrderId attribute defined.

    I want to know if a product, that is displayed in the product_info page has a "CoverOrderID" attribute defined, and if so, if it has already an identifier string assigned.

    In case it has not, i would generate a new (unique) one, and assign it to the product displayed, otherwise i would display the existing one ...

    thanks,

    Daniel

    ps. BTW, The assignment is currently done by providing a default value to the attributes xhtml input field, thereby passing a value on when the user presses the add button -- to add the product into the shopping cart.
    Last edited by grossd; 23 Jul 2006 at 06:17 AM.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Custom html_header.php for product_info page - How?
    By profitshock in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 28 Jun 2010, 09:58 PM
  2. looking for product_id to implement 3rd party tool in my site
    By Greywacke in forum General Questions
    Replies: 1
    Last Post: 2 Feb 2010, 01:02 PM
  3. product listing on product_info page
    By roooot in forum Setting Up Categories, Products, Attributes
    Replies: 7
    Last Post: 1 Dec 2009, 07:41 AM
  4. Replies: 6
    Last Post: 23 May 2007, 08:47 PM
  5. Random Product Script - missing product_id
    By unisupuk in forum General Questions
    Replies: 1
    Last Post: 14 Jun 2006, 06:37 AM

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