Displaying an Add To Cart link in the Results Page
Since products can have multiple skus, there is not a simple method to display all skus with an add to cart link on the results page. However, if you have a store with one sku per product, it is simple enough. Make a function at the top of the page to grab the sku for each product:
function getSku($productId) {
global $cartweaver;
/* Get SKU Data */
$query_rsCWGetSKUs = "SELECT SKU_ID
FROM tbl_skus
WHERE SKU_ProductID = $productId";
$rsCWGetSKUs = $cartweaver->db->executeQuery($query_rsCWGetSKUs);
$rsCWGetSKUs_recordCount = $cartweaver->db->recordCount;
$row_rsCWGetSKUs = $cartweaver->db->db_fetch_assoc($rsCWGetSKUs);
return $row_rsCWGetSKUs['SKU_ID'];
}
then in the results loop, probably in a table cell:
<a href="details.php?prodId=<?php echo($row_rsCWResults["product_ID"]);?>&skuid=<?php echo(getSku($row_rsCWResults["product_ID"]));?>&addtocart=true">Add to Cart</a>
Make sure you are using Cartweaver 2.5.2 or higher, as previous versions did not have the ability to pass information to the cart on the URL.