Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default uprid. attributes values/arrays are needed?

    I'm trying to generate a uprid to compare against that stored in the orders_products table using zen_get_uprid(product number, attributes array). I understand that it is based on the attributes that are stored. $_POST['id'][$_POST['products_id'][$i]] where I think i is the nth-1 product, but I am not sure which parts of the attributes are needed to generate the uprid. And for some reason I haven't found a "convenient" way or place to show that variable. Superglobals almost always identifies that the POST is empty.

    Anybody know?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #2
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: uprid. attributes values/arrays are needed?

    Quote Originally Posted by mc12345678 View Post
    I'm trying to generate a uprid to compare against that stored in the orders_products table using zen_get_uprid(product number, attributes array). I understand that it is based on the attributes that are stored. $_POST['id'][$_POST['products_id'][$i]] where I think i is the nth-1 product, but I am not sure which parts of the attributes are needed to generate the uprid. And for some reason I haven't found a "convenient" way or place to show that variable. Superglobals almost always identifies that the POST is empty.

    Anybody know?
    Still haven't exactly found what is fed to populate the attributes variable that gets encoded, I'm wondering if it's like: $attributes[] = array('option-id'=>'21','option_values_id'=>'11'); so that the unique id of the attribute is therefore provided, and then that is what is encrypted, if it is every possible non-file attribute aspect, or if it is every possible attribute field filled in as applicable (nulls and everything) that is then encrypted. :/

    I still haven't fully connected the dots from the product info page to the cart encrypting it, but it seems like the design idea would be to make the vriables to be encrypted as easy to fill in as possible and that they would be based on what is presented on screen (html) when managing a product. Further, because an attribute can be defined either by it's unique number which is different between the products attributes and products attributes downloads tables that, the more "universal" option number and option value number would be the route to go as these two values wuld easily lead to other data that is easily retrievable.

    I'm going to give that a shot and see if this random code that is generated is the same as one that has already been generated or if I have to expand my array population to get the same unique number that I'm trying to get.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,948
    Plugin Contributions
    96

    Default Re: uprid. attributes values/arrays are needed?

    Quote Originally Posted by mc12345678 View Post
    I'm trying to generate a uprid to compare against that stored in the orders_products table using zen_get_uprid(product number, attributes array). I understand that it is based on the attributes that are stored. $_POST['id'][$_POST['products_id'][$i]] where I think i is the nth-1 product, but I am not sure which parts of the attributes are needed to generate the uprid. And for some reason I haven't found a "convenient" way or place to show that variable. Superglobals almost always identifies that the POST is empty.

    Anybody know?
    The $_POST variable is empty after an add-to-cart action because the shopping_cart class, after a cart-related action, redirects back to either the shopping_cart or the come-from page. You can view the format of the attributes' information using Superglobals by looking at _SESSION['cart']->products['attributes'].

  4. #4
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: uprid. attributes values/arrays are needed?

    Quote Originally Posted by mc12345678 View Post
    Still haven't exactly found what is fed to populate the attributes variable that gets encoded, I'm wondering if it's like: $attributes[] = array('option-id'=>'21','option_values_id'=>'11'); so that the unique id of the attribute is therefore provided, and then that is what is encrypted, if it is every possible non-file attribute aspect, or if it is every possible attribute field filled in as applicable (nulls and everything) that is then encrypted. :/

    I still haven't fully connected the dots from the product info page to the cart encrypting it, but it seems like the design idea would be to make the vriables to be encrypted as easy to fill in as possible and that they would be based on what is presented on screen (html) when managing a product. Further, because an attribute can be defined either by it's unique number which is different between the products attributes and products attributes downloads tables that, the more "universal" option number and option value number would be the route to go as these two values wuld easily lead to other data that is easily retrievable.

    I'm going to give that a shot and see if this random code that is generated is the same as one that has already been generated or if I have to expand my array population to get the same unique number that I'm trying to get.
    Wow, finally did it, through some brute force/testing and correcting typing mistakes, I figured out what it takes to calculate the uprid for a product.

    The array to feed the function zen_get_uprid is created like such: $variable[$option_id] = $options_values_id
    Do this for all attributes then what I originally did was recreate the store side of the function zen_get_uprid because it offers some more cleanup of the information (text box related) than the admin side and it performed the encryption; however, after some contemplation, I reverted back to simply calling the zen_get_uprid function.

    Ultimately it was through the review of the cart session value that I landed on the above testing method as lat9 has suggested.

    Also, while this method of comparison seems to function for it's purposes, I do believe that the code being tested falls short in actually having to do this comparison. While I've tetsed the above code with dropdowns, I need to see what happens with text boxes and may be a reason this plugin has never been fully completed.

    Thanks for the information lat9, I did get around to figuring it out, had started to close the loop and wanted to verify some things before posting, well then sleep came. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,948
    Plugin Contributions
    96

    Default Re: uprid. attributes values/arrays are needed?

    Remember, too, that the option_id entries in the array are sorted according to their products_options_sort_order; since the prid is an md5-hash, the order in which the options exist in the attributes' array is pertinent.

  6. #6
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: uprid. attributes values/arrays are needed?

    Quote Originally Posted by lat9 View Post
    Remember, too, that the option_id entries in the array are sorted according to their products_options_sort_order; since the prid is an md5-hash, the order in which the options exist in the attributes' array is pertinent.
    Yeah, I had considered that, but hadn't implemented it yet, needing to identify the various ways that ZC offers sorting of the option names and when multiple values can be valid those as well. In my original testing I had arranged my data in a specific sequence to try to avoid that concern and to narrow down the functionality needing to be implemented, but to properly implement requires this consideration.

    So close, but still so far away. :)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: uprid. attributes values/arrays are needed?

    Theoretically the uprid is unique or at least sufficiently unique. I am wondering if the sample size is sufficiently small, what the likelihood of a false equivalent uprid would be if both sort methods typically offered in the includes/modules/YOUR_TEMPLATE/attributes.php file were used to generate the uprids for comparison.

    I guess part of the process could be to compare with one and then compare with the other and the one that has the higher frequency of matching would be the one to go with...

    Thoughts? (Besides that doubling the generation and comparison increases processing power and time for these infrequent operations?)
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v155 Storefront: $_GET variables that are arrays?
    By lat9 in forum General Questions
    Replies: 1
    Last Post: 26 May 2016, 03:22 PM
  2. Where are the "values" of the attributes stored in a session?
    By MrNoBrainer in forum Managing Customers and Orders
    Replies: 2
    Last Post: 26 Apr 2011, 07:27 PM
  3. Option Values are not shown
    By kittykittykitty in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 17 Feb 2010, 06:15 AM
  4. Replies: 1
    Last Post: 22 Aug 2009, 08:12 PM
  5. Pointers, not values, are showing up
    By d0ugparker in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 18 Oct 2008, 05:34 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