Re: Stock thresholds, Workflow-ng, and Taxonomy

Posts: 332
Joined: 08/07/2007
Administrator

I'm not that well knowledged in Drupal's taxonomy system, but I'll be able to answer your 1st 2 questions. First, given a specific SKU you can use the uc_product_stock table to reference the product nid from which you can get the list of attributes in the uc_product_attributes table. From there you can reference the attribute name from the uc_attributes table with the attribute id, aid, that you retrieved from the uc_product_attributes table. You could do this with this query:

<?php
//$sku == to the specific SKU value you wish to retrieve attributes for
$attributes = db_query("SELECT * FROM {uc_product_stock} as s LEFT JOIN {uc_product_attributes} as pa ON s.nid = pa.nid LEFT JOIN {uc_attributes} as a ON pa.aid = a.aid WHERE s.sku = '%s'",$sku);

//using db_fetch_object you can retrieve each row produced by the query
?>

--

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

Stock thresholds, Workflow-ng, and Taxonomy By: thefreefood (2 replies) Mon, 03/03/2008 - 00:55