Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2008
    Posts
    15
    Plugin Contributions
    0

    Default shopping cart link with attribute to product info

    I'd like to make a link to a product info page and have an attribute selected. The shopping cart does exactly this when attributes are selected:
    products_id=28:060d12b3f0c4c51e8f3c91ebc9ec776b for this attribute
    products_id=28:a47455e1f1876e14a92bee8068b809ae for that one

    I'm working on a gift registry and don't just want the link from the registry to be to the item but have the attribute selected. It's obviously possible (shopping cart does it) but how/where is that number after the colon generated?

    Thanks

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: shopping cart link with attribute to product info

    I'm afraid that it's not as obviously possible as it might seem. in fact quite the opposite.

    The attribute information is passed in $_POST. To include it in a link it would need to be passed in $_GET.

    In any case, it's not passed into the product info page, which is what you would need, it's passed out of it.

    The prids or uprids that you are seeing (e.g. 28:060d12b3f0c4c51e8f3c91ebc9ec776b) do not tell you what the attributes are. They are simply encrypted strings whose job is to ensure that different products attribute combinations can be distinguished in the shopping cart. The actual attribute information is being stored and extracted from a $_SESSION variable built from the aforementioned passing of data in $_POST from the product_info page.

    To achieve what you want to do, you are going to need to get deep into the includes/modules/attributes.php module, where the attribute data is built ready for display. This is one of the biggest chunks of code in Zen Cart, and although not difficult it can take some time to find your way around.

    I'd rate this as needing intermediate level skills in both php and Zen Cart architectural knowledge.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    Jan 2008
    Posts
    15
    Plugin Contributions
    0

    Default Re: shopping cart link with attribute to product info

    Quote Originally Posted by kuroi View Post
    They are simply encrypted strings whose job is to ensure that different products attribute combinations can be distinguished in the shopping cart.
    Yes, I think that's the info I want

    So when user A is on the product info page and they click Add to Registry I want the attribute combo so I can store that in the db

    Then when user B searches for user A's registry and clicks on the description link to the product info page (just like what's on the shopping cart) or even the Add to Cart button, because the product info page and shopping cart can already figure out what this string means, I just want to reuse functionality that's already in zen cart

    I may be relatively new to zen cart but i've been doing php for years and should be able to get it in the end.
    Thanks

  4. #4
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: shopping cart link with attribute to product info

    You've chopped out the important information immediately before the quote you've latched onto!
    Quote Originally Posted by kuroi View Post
    The prids or uprids that you are seeing (e.g. 28:060d12b3f0c4c51e8f3c91ebc9ec776b) do not tell you what the attributes are.
    For clarity, it's not just *you* who is told nothing about what the attributes are from these strings, there is no information about attributes in these strings, so Zen Cart can't interpret it either. The strings are the result of md5 encryption. This is a one way technique, i.e. there is no realistic way of getting from the result back to the attribute data that generated it. That's a dead end.

    However, Zen Cart does pass attribute information via $_POST to a $_SESSION variable and on into the database for logged in customers. That's the route to mimic.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #5
    Join Date
    Jan 2008
    Posts
    15
    Plugin Contributions
    0

    Default Re: shopping cart link with attribute to product info

    thanks for your help

 

 

Similar Threads

  1. Replies: 3
    Last Post: 4 Jan 2013, 09:26 PM
  2. Shopping cart product link
    By Kcm75 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Nov 2012, 09:21 PM
  3. Linking Product Attribute with adding choice to shopping cart
    By butchx5 in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 21 Jan 2009, 03:14 PM
  4. Skip Product Info and go direct to shopping cart
    By simplemedia in forum Managing Customers and Orders
    Replies: 1
    Last Post: 25 Nov 2008, 06:49 PM
  5. Replies: 9
    Last Post: 23 Jan 2007, 10:38 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