I don't think it is used any more. Maybe it should be removed, it might be useful to uniquely identify a product, but UUID module is probably better for this.
What is the use case of unique_hash column in uc_products table
» Remove unique_hash column in uc_products table
Category:
support
» task
Yeah, that's a leftover from Drupal 5 / Ubercart 1, which used to have a built-in uc_importer module to do XML import/export of products. They needed a unique identifier for products that would work across different machines - nid is the primary key for the table but nids are machine-specific. You can read more about it if you're interested by searching ubercart.org: http://www.ubercart.org/search/node/unique_hash
Product import/export is best done these days through a general purpose module that can deal with all types of nodes, not just products. I'm not sure why unique_hash wasn't removed 5 years ago; we've been unknowingly carrying it around for years and it's no longer needed.
I am writing a module "Ubercart product field" which leveraging field to store product info, I add unique_hash to field schema, but I get a error message on it. if it is useless, i will not support it. it works after i remove it from field schema.
The attached patch removes this column and all code that refers to it. The only thing that still used it was uc_product_uc_product_class() which used it as a way of identifying rows in uc_products without any data when converting an existing content type into a product class. There is a simpler way to do this in SQL, and I added a test to confirm this still works.
Comments
Comment #1
longwaveI don't think it is used any more. Maybe it should be removed, it might be useful to uniquely identify a product, but UUID module is probably better for this.
Comment #2
tr commentedYeah, that's a leftover from Drupal 5 / Ubercart 1, which used to have a built-in uc_importer module to do XML import/export of products. They needed a unique identifier for products that would work across different machines - nid is the primary key for the table but nids are machine-specific. You can read more about it if you're interested by searching ubercart.org: http://www.ubercart.org/search/node/unique_hash
Product import/export is best done these days through a general purpose module that can deal with all types of nodes, not just products. I'm not sure why unique_hash wasn't removed 5 years ago; we've been unknowingly carrying it around for years and it's no longer needed.
Changing this to a task ...
Comment #3
g089h515r806 commentedI am writing a module "Ubercart product field" which leveraging field to store product info, I add unique_hash to field schema, but I get a error message on it. if it is useless, i will not support it. it works after i remove it from field schema.
Comment #4
longwaveThe attached patch removes this column and all code that refers to it. The only thing that still used it was uc_product_uc_product_class() which used it as a way of identifying rows in uc_products without any data when converting an existing content type into a product class. There is a simpler way to do this in SQL, and I added a test to confirm this still works.
Comment #5
longwaveCommitted #4.