rendered paste body function get_web_skus_by_type_and_brand($type_id, $brand_id) {
$array = array();
$get_web_skus = mysql_query("SELECT web_sku_products.*, products.* FROM web_sku_products INNER JOIN products ON web_sku_products.product_id = products.product_id WHERE products.type_id = '$type_id' && products.brand_id = '$brand_id' GROUP BY web_sku_products.web_sku_id", $this->conn) or die(mysql_error());
while($web_skus = mysql_fetch_array($get_web_skus)) {
$web_sku_id = $web_skus['web_sku_id'];
$array = $this->get_web_skus("SELECT * FROM web_skus WHERE web_sku_id = '$web_sku_id'") + $array;
}
return $array;
}
function get_web_skus($query) {
$get_web_skus = mysql_query($query, $this->conn) or die(mysql_error());
if(mysql_num_rows($get_web_skus)) {
$array = array();
while($web_skus = mysql_fetch_array($get_web_skus)) {
$array[$web_sku_id]['title'] = $web_skus['title'];
$array[$web_sku_id]['price'] = $web_skus['price'];
$array[$web_sku_id]['savings'] = $web_skus['savings'];
}
return $array;
} else {
return;
}
}
function display_product_box($products_array, $web_skus_array) {
$display = '';
if(isset($products_array)) {
foreach($products_array as $product_id => $product) {
$display .= "<table class=\"product_box_table\">
<tr>
<td class=\"product_box_image\"><a href=\"product.php?product_id=".$product_id."\" alt=\"".$product['product']."\"><img src=\"".$product['image']."\" alt=\"".$product['product']."\"></a></td>
<td class=\"product_box_details\">
<font style=\"font-size:12px; color:#7db240; font-weight: bold;\">Compatible ".$this->get_type($product['type_id'])." cartridge</font><BR><BR>
<b>REF #: </b> ".$product['ref']."<BR>
<b>PART #: </b> <a href=\"product.php?product_id=".$product_id."\" alt=\"".$product['product']."\" class=\"product_box_link\">".$product['product']."</a><BR>
<b>COLOR: </b> ".$product['color']."<BR>
</td>
<td class=\"product_box_price\">
".number_format($product['price'], 2)."\$
</td>
<td class=\"product_box_cart\">
<form name=\"add_to_cart\" action=\"store_cart.php\" method=\"POST\">
<input type=\"hidden\" name=\"product_id\" value=\"".$product_id."\">
QTY: <input type=\"text\" name=\"quantity\" value=\"1\" class=\"product_box_quantity\"><BR>
<input type=\"image\" src=\"images/buy_now.jpg\">
</form>
</td>
</tr>
</table>";
}
}
if(isset($web_skus_array)) {
foreach($web_skus_array as $web_sku_id => $web_sku) {
$display .= "<table class=\"product_box_table\">
<tr>
<td class=\"product_box_image\"><img src=\"images/combo.jpg\" alt=\"".$web_sku['title']."\"></td>
<td class=\"product_box_details\">
<font style=\"font-size:12px; color:#7db240; font-weight: bold;\">".$web_sku['title']."</font><BR><BR>";
foreach($web_sku['products'] as $web_sku_product_id => $web_sku_product) {
$display .= "<B>".$web_sku_product['quantity'] ." x <a href=\"product.php?product_id=".$product_id."\" alt=\"".$product['product']."\" class=\"product_box_link\">". $web_sku_product['product']."</a> ".$web_sku_product['color']."</b><BR>";
}
$display .= " </font>
</td>
<td class=\"product_box_price\">
".number_format($web_sku['price'], 2)."\$
</td>
<td class=\"product_box_cart\">
<form name=\"add_to_cart\" action=\"store_cart.php\" method=\"POST\">
<input type=\"hidden\" name=\"web_sku_id\" value=\"$web_sku_id\">
QTY: <input type=\"text\" name=\"quantity\" value=\"1\" class=\"product_box_quantity\"><BR>
<input type=\"image\" src=\"images/buy_now.jpg\">
</form>
</td>
</tr>
</table>";
}
}
return $display;
}