Thread: products_prid

Results 1 to 10 of 11

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Posts
    40
    Plugin Contributions
    0

    Default products_prid

    Hi,

    I'm doing an upgrade on a heavily modified site, from v1.25 to 1.38a.
    I started by installing a freash copy of 1.3.8a and then developed a new template based on the old look. However, I'm now at the stage where I'm moving over the data.

    I am comparing each table from the database using a combination of mysql query browser and a file comparison tool, and although slow, it's working well so far :)

    However, I've hit a small problem with the 'orders_products' table. It has an extra column 'products_prid'. Having placed test orders on the new site, I can see that this value isn't a simple NULL or 0.

    How can I populate this field for each record?

    So far the only info I can find is from the Zen Cart wiki DB_changelog...

    #added for future orders editing
    ALTER TABLE orders_products ADD products_prid TINYTEXT NOT NULL;
    ALTER TABLE orders_products_attributes ADD products_prid TINYTEXT NOT NULL;
    ALTER TABLE orders_products_download ADD products_prid TINYTEXT NOT NULL;

    Is it safe to run these statements in this case?

    Many Thanks
    d.

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: products_prid

    Quote Originally Posted by deko View Post

    How can I populate this field for each record?

    So far the only info I can find is from the Zen Cart wiki DB_changelog...

    #added for future orders editing
    ALTER TABLE orders_products ADD products_prid TINYTEXT NOT NULL;
    ALTER TABLE orders_products_attributes ADD products_prid TINYTEXT NOT NULL;
    ALTER TABLE orders_products_download ADD products_prid TINYTEXT NOT NULL;

    Is it safe to run these statements in this case?

    Many Thanks
    d.
    Yes, it will be safe to run those commands. They will add the missing fields, however they WON'T be populated with any data. Whether the lack of data will cause any issues or not I really can't say, but at least the fields will be there for any new products.

    Cheers
    Rod

  3. #3
    Join Date
    Sep 2004
    Posts
    40
    Plugin Contributions
    0

    Default Re: products_prid

    Great thanks Ron!

    But now the plot thickens...

    I have looked at another database of a site I did recently and in the 'order_products' table, the values for 'products_prid' are the same as the values for 'products_id'. Which means we should be able to just copy the contents from one to the other.

    However, according to this thread by mgraphic, 'products_prid' is a randomly generated hash?

    http://www.zen-cart.com/forum/showthread.php?t=51738

    Quote Originally Posted by Ajeh View Post
    The prid is randomly generated and has no real meaning other than to tie things together ...

    If you look in the orders_products_attributes you will see the values for:
    products_options_id
    products_options_values_id
    My 'orders_products_attributes' table is empty?

  4. #4
    Join Date
    Sep 2004
    Posts
    40
    Plugin Contributions
    0

    Default Re: products_prid

    Right, well that seemed to work for orders_product table :)

    First ran the column update...

    ALTER TABLE orders_products ADD products_prid TINYTEXT NOT NULL;

    Then copied values from products_id...

    UPDATE orders_products SET products_prid = products_id;

    Now I can see the list of order totals, which I couldn't see last night.

    Now to populate the other two tables, 'orders_products_attributes' and orders_products_download'. My dev versions are empty, so if anyone has values in these tables, can you paste a few lines so we can see if they follow the same route.

    Of course, all this might be completely wrong yet :)

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: products_prid

    Quote Originally Posted by deko View Post
    Right, well that seemed to work for orders_product table :)

    First ran the column update...

    ALTER TABLE orders_products ADD products_prid TINYTEXT NOT NULL;

    Then copied values from products_id...

    UPDATE orders_products SET products_prid = products_id;

    Now I can see the list of order totals, which I couldn't see last night.

    Now to populate the other two tables, 'orders_products_attributes' and orders_products_download'. My dev versions are empty, so if anyone has values in these tables, can you paste a few lines so we can see if they follow the same route.

    Of course, all this might be completely wrong yet :)
    Based upon the quote you gave from Ajeh, it seems to me that all you'll need to do is copy those same values into the other two tables.

    This is assuming that there is a one-to-one matching across all three tables.

    I suspect this may not be the case though, in which case the orders_products entries will need to be matched with the corresponding entry(s) in the other two tables before pasting the random hashes into them.

    I would also assume that not all products will have a corresponding 'attributes' or 'downloads' entry anyway, and this being the case you'll only need to do those that do exist.

    As per your comment, this could be completely wrong, but it does make sense from a coding perspective.. The hash being little more than a randomly generated 'foreign key' to make things a lot more efficient than a database search when relating the attributes/downloads tables back to the products table.

    Cheers
    Rod.

  6. #6
    Join Date
    Sep 2004
    Posts
    40
    Plugin Contributions
    0

    Default Re: products_prid

    Here's what I'm thinking on this one Rod...

    Anyone who had an active store before those columns were added, will have empty values for all products added before the update, and the appropriate values for all products added since. So it should be safe.

    If I go ahead and try to manually populate those fields myself, I'm in unknown territory.
    Given that this site is my friends sole income and receives thousands of visits a day, I cannot risk an imbalance. So until I know exactly what these new elements do, I best tread carefully.

    Many Thanks
    d.

 

 

Similar Threads

  1. for the products_prid in zencart database, table: orders field
    By vivifashion in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 6 Nov 2009, 04:45 AM
  2. 1054 Unknown column 'products_prid' in field list
    By luckykat in forum General Questions
    Replies: 1
    Last Post: 21 May 2006, 01:14 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