parameter . "
"; $cart = get_cart_data ($hmSQL, $st_tbShoppingCarts, $sc_cart_id); if (is_object($cart) == false) $cart = new_cart ($hmSQL, $st_tbShoppingCarts, $sc_cart_id, $ar_store_configuration); if ($coupon_number != "") $coupon_number = strtolower($coupon_number); if (($REQUEST_METHOD == "POST") && ($submitCoupon != "") && ($coupon_number != "")) { $st_sql = "SELECT * from $st_tbCoupons "; $st_sql .= "WHERE bo_valid = 1 AND "; $st_sql .= "number = '$coupon_number'"; $h3SQL = mysql_query($st_sql, $hmSQL); if($h3SQL > 0) { if (mysql_num_rows($h3SQL) > 0) { $ar_row = mysql_fetch_array($h3SQL); $cart->coupon_id = $ar_row["id"]; update_table ($hmSQL, $st_tbShoppingCarts, "coupon_id", $cart->coupon_id, "numeric", "id", $cart->id, "numeric"); $st_message .= "Your coupon number has been accepted! You may now purchase items from this page."; } else { $coupon_number = ""; $st_message .= "Sorry, the coupon number you entered is not valid. Please try again."; } } else { $coupon_number = ""; $st_message .= "Sorry, the coupon number you entered is not valid. Please try again."; } } else $coupon_number = ""; $st_sql2 = $st_sql; //$st_sql = "select * from $st_tbCategoryItems, $st_tbProducts where category_id = " . $id ." and $st_tbProducts.id = $st_tbCategoryItems.product_id ORDER BY $st_tbProducts.title"; $st_sql = "SELECT $st_tbProducts.*, $st_tbRE_Product_Coupons.coupon_id, "; $st_sql .= "$st_tbRE_Product_Coupons.price AS discount_price "; $st_sql .= "FROM $st_tbProducts, $st_tbCoupons, $st_tbRE_Product_Coupons "; $st_sql .= "WHERE $st_tbProducts.id = $st_tbRE_Product_Coupons.product_id AND "; $st_sql .= "$st_tbCoupons.id = $st_tbRE_Product_Coupons.coupon_id AND "; $st_sql .= "$st_tbCoupons.bo_valid = 1 AND "; // Show products based on the person's coupon number // (the coupon can either be a number in $coupon_number or // an ID in $cart->coupon_id) if (($cart->coupon_id == "") && ($coupon_number != "")) $st_sql .= "$st_tbCoupons.number = '$coupon_number' "; elseif ($cart->coupon_id != "") $st_sql .= "$st_tbCoupons.id = " . $cart->coupon_id . " "; else // This is part of a workaround to show some products even if no coupon number // has been entered. Only one coupon should be marked "default_show" at a time. $st_sql .= "$st_tbCoupons.default_show = 1 "; $st_sql .= "ORDER BY $st_tbProducts.title"; //echo $st_sql . "
"; $h3SQL = mysql_query($st_sql, $hmSQL); if($h3SQL > 0) { if(mysql_num_rows($h3SQL) > 0) { for ($in_A = 0; $in_A < mysql_num_rows($h3SQL); $in_A++) { $ar_row = mysql_fetch_array($h3SQL); $ar_products[$in_A] = new CProduct; $ar_products[$in_A]->id = $ar_row["id"]; $ar_products[$in_A]->sku = $ar_row["sku"]; $ar_products[$in_A]->large_image = $ar_row["large_image"]; $ar_products[$in_A]->large_image_name = $ar_row["large_image_name"]; $ar_products[$in_A]->thumbnail = $ar_row["thumbnail"]; $ar_products[$in_A]->title = $ar_row["title"]; $ar_products[$in_A]->recommended_age = $ar_row["recommended_age"]; $ar_products[$in_A]->written_by = $ar_row["written_by"]; $ar_products[$in_A]->illustrated_by = $ar_row["illustrated_by"]; $ar_products[$in_A]->narrated_by = $ar_row["narrated_by"]; $ar_products[$in_A]->description = $ar_row["description"]; $ar_products[$in_A]->contribution = $ar_row["contribution"]; $ar_products[$in_A]->testimonial_description = $ar_row["testimonial_description"]; $ar_products[$in_A]->price = $ar_row["discount_price"]; // coupon price $ar_products[$in_A]->old_price = $ar_row["price"]; $ar_products[$in_A]->real_animal_image_url = $ar_row["real_animal_image_url"]; $ar_products[$in_A]->new_product = $ar_row["new_product"]; $ar_products[$in_A]->size = $ar_row["size"]; $ar_products[$in_A]->isbn = $ar_row["isbn"]; $ar_products[$in_A]->hsus = $ar_row["hsus"]; $ar_products[$in_A]->bunny_graphic = $ar_row["bunny_graphic"]; $ar_products[$in_A]->title_image = $ar_row["title_image"]; $ar_products[$in_A]->coupon_image = $ar_row["coupon_image"]; $ar_products[$in_A]->name = $ar_row["name"]; } } // No error b/c no products mean the user has not yet entered a coupon //else $st_database_error .= "No products under Category=$id and SubCategory=$subcategory_id"; }else $st_database_error .= mysql_error(); // get the cart footer object and selectively dissable the icons that we do not want displayed $cart_footer = get_shopping_cart_footer_object (); require "$st_web_root" . "/includes/common/mySQL.close.inc"; ?>
 

Redeem your FunBrain Coupon Here!

Enter Coupon #

">

If you don't have a FunBrain coupon,
click here
to get one.
" . $st_message . "

\n"; ?>

 

\n"; echo "

Enter a FunBrain Coupon Number

\n"; echo "

 

\n"; echo "

 

\n"; echo "

 

\n"; } else { if ($cart->coupon_id == "") // We already know that products are being displayed at this point echo "

A coupon number must be entered before any of these products can be purchased.

\n"; for ($in_A = 0; $in_A < count($ar_products); $in_A++) { ?> 0) // Spacing between products { ?>
   

description; ?>
 
size) . " " . stripslashes($ar_products[$in_A]->name); ?>
ISBN isbn; ?>
sku; ?> $old_price; ?>
$price; ?>
coupon_id != "") { // show buy button only if a valid coupon was entered ?>
  For More ReadPlay Items, Click Here