Forums / Setting Up Categories, Products, Attributes / Items which attributes are not in stock, don't show

Items which attributes are not in stock, don't show

Locked

Views: 1,329

Results 1 to 1 of 1
This thread is locked. New replies are disabled.
19 Sep 2007, 5:47 PM
#1
virogenesis avatar

virogenesis

New Zenner

Join Date:
Sep 2007
Posts:
3
Plugin Contributions:
0

Items which attributes are not in stock, don't show

This is how I wanted to fix it, but it aint working:

File attributes.php

line 62:

$sql = "select stock_attributes from " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK .
" where products_id = '". (int)$_GET['products_id'] . "'" .
" AND quantity = '0'";

			$products_attributes_stock = $db->Execute($sql);
			$products_attributes_outofstock = array();
			$products_attributes_outofstock[] = '61';
			while (!$products_attributes_stock->EOF){
				$products_attributes_outofstock = array_merge($products_attributes_outofstock, explode(",", $products_attributes_stock->fields['stock_attributes']));
				$products_attributes_stock->MoveNext();
			}
			print_r($products_attributes_outofstock);

line 121:

if in_array($products_options->fields['products_attributes_id'], $products_attributes_outofstock)) $products_options->MoveNext();

First of all I make a array of attributes that are missing, and search that array later in the products_options loop, and if the value exists skip to the next :)

Ok so this has lots of bugs namely the if in line 121 should be replaced with WHILE in case the next one is missing as well, but there is something generally wrong with this whole idea :)

I need someone to snap me back to reality and tell me what have I been doing wrong :D

Cheers !!!