1 reply [Last post]
a_lawry2's picture
Offline
Joined: 02/10/2010
Juice: 0

Hi,

Just a quick question.

How can I load a product node using SKU/model instead of with node ID. Is there an Ubercart function for this? Can it be done with node_load()?

All I really need is a function that will return me the node ID of a given SKU/model value and I'll call node_load.

Thanks for your help.

Andrew

MichaelWenzel's picture
Offline
Joined: 03/09/2009
Juice: 7
Re: Load a product by SKU/model

I never found a function to do this directly, but I imagine it wouldn't be hard to write.
You can use this simple query:

SELECT nid FROM {uc_products} WHERE model = '%s';

Edit: Try to avoid using this, as it is so simple it does not deal with revisions, etc, and you won't always get good results.