[FX.php List] Shopping cart question

Gjermund Gusland Thorsen ggt667 at gmail.com
Thu Dec 28 16:14:59 MST 2006


loading an array is done as the following:

$_SESSION['cart'][] = $_POST['recidOfCurrentlyAddedProduct'];

Note [] will add a new row in the array $_SESSION['cart']

if( $r['foundCount'] > 0 ) {
	foreach( $r['data'] as $key => $value ) {
		list( $recid, $modid ) = explode( '.', $key );
		foreach( $_SESSION['cart'] as $v ) {
			if( intval( $v ) == intval( $recid ) ) {
				$disabled = ' disabled';
			} else {
				$disabled = '';
			}
		}
	}
} else {
	$output = 'nothing... perhaps improve your search criteria?!?';
}
ggt667

On 12/27/06, John Moed <john at technames.com> wrote:
>
>
> Dear All,
>
> I have a "working" shopping cart. Items are added to the cart and I can view
> the cart to see items that have been added. For my "shopping cart", items
> should only be able to be added once. I would like to prevent items from
> being added twice to the cart. I think that I should be able to load an
> array with all items that have been added to the cart and check each item in
> the catalag as that page is loaded. Items that are not in the cart should
> get a regular check box and items that have already been added should get a
> greyed out box.
>
> My questions are, how do I load an array and then how do I check to see if a
> value is in the array?
>
> Thanks,
>
> John
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
>


More information about the FX.php_List mailing list