Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Posts
    11
    Plugin Contributions
    0

    Default a question about shoppingCart->contents[$key] for products with attributes

    i've noticed in the shoppingCart object that the key for products with attributes stored in they contents array seem to be the product id followed by what appears to be an md5 hash. it almost looks like a salted hash.

    can anybody elaborate on the process to generate this information? i need to store some items in the shopping cart from a custom form, but it doesn't look like i'll be able to do it properly without this information.

    thanks in advance.

  2. #2
    Join Date
    Aug 2007
    Posts
    11
    Plugin Contributions
    0

    Default Re: a question about shoppingCart->contents[$key] for products with attributes

    hmm, i guess the question i'm coming to form is do i really need the md5ed attributes if i simply create items that don't HAVE any attributes?

    even if i discover that i do not, though, my curiosity is killing me. i've found references to zen_get_prid in shopping_cart.php, and the second argument for that function is $attributes, but the way $attributes is formed in add_cart() doesn't really illuminate anything for me.

    i suppose the actual hash is arbitrary, so long as all the products have a good amount of detail in what is actually hashed. so if the attributes are, say, color and size, then i'd want to pull those attributes from the database, store them in an array with a consistent key => value scheme, and that will help to determine whether items with similar product ids should increment the quantity or be added the list separately because they have different attributes.

    for the project i'm working on, i don't think i'll need to worry about the prid with the hashed attributes, but i'm still not satisfied.

  3. #3
    Join Date
    Jul 2005
    Posts
    537
    Plugin Contributions
    0

    Default Re: a question about shoppingCart->contents[$key] for products with attributes

    I've not studied the hash code, but I do know that the attribute details only store the numbers of the values selected when the product was added to the cart. The numbers correspond to the option names+option values pairs applicable to the product.
    I would guess that any attribute information you add that's unrelated to already-defined option name/value details is gonna be lost during later stages unless you find some other way of storing something that those numbers could relate to?

 

 

Similar Threads

  1. Question about Paypal Express Checkout with Digital Products
    By NWCE in forum PayPal Express Checkout support
    Replies: 2
    Last Post: 23 Oct 2013, 01:58 PM
  2. Question about 'Featured Products for month'
    By TzuLady in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 26 May 2013, 06:43 AM
  3. Editing cart contents -- esp products with attributes
    By justinhunt in forum All Other Contributions/Addons
    Replies: 165
    Last Post: 6 May 2013, 07:31 PM
  4. Question About Payment Processing with Downloadable products
    By TheMayhem in forum Managing Customers and Orders
    Replies: 1
    Last Post: 31 May 2011, 05:13 AM
  5. Confused about how to set up categories/products and attributes for them
    By nanciadd in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 28 Oct 2007, 11:37 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