Help error on product stock or discount
Hello, I use dynamic discount value like picture, when a user login a session variable is setted by the userprofile page, and in cart page the discount is applied, if a user is not logged in I set a session variable for discount "0%" in cart page.
<?php
if (!session_id()) session_start();
if (!isset($_SESSION['UserDiscountValue']) && $_SESSION['UserDiscountValue'] < 1){
$_SESSION['UserDiscountValue'] = "0" ;
}
?>
In my database the 0% is the option 1, when a new user complete the registration the value 1 is set by default in discount database.
I don't know if I'm on right way... I need to set discount 0% if a user is not logged in.
When I add a product in cart and I select a quantity more than available, in cart page the message "maximum stock is set" work, but if I add one more from product detail page I get an error :
Warning: Invalid argument supplied for foreach() in C:\...sitename\WA_eCart\WA_eCart_Definition_PHP.php on line 469
I'm going crazy...