开发者

How to load Product from nid

开发者 https://www.devze.com 2023-03-05 16:58 出处:网络
开发者_如何学运维How Can I load a Product from the db based on the nid? $product = db_fetch_object(db_query(\"SELECT * FROM {uc_products} WHERE nid = \'%s\'\", *nid here*));

开发者_如何学运维How Can I load a Product from the db based on the nid?


$product = db_fetch_object(db_query("SELECT * FROM {uc_products} WHERE nid = '%s'", *nid here*));

print_r($product);


Doing a direct db call is an option; however, it is not the Drupal way and does not utilize the benefits of fields, revisions, etc that Drupal's node/CCK system offers. Since uc_products are nodes in Drupal, simply call:

$product = node_load($nid);
0

精彩评论

暂无评论...
验证码 换一张
取 消