Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

if (tep_db_num_rows ($specials_query)) {


bobsi18

Recommended Posts

I feel like I'm spamming this site... I keep writing posts and then figuring the answer out straight after... Oh well... If you've read any of my latest posts, I'm attempting to create a hack to allow products with price altering attributes have 'specials' (using the standard module that comes with Osc). I'm doing ok so far... The latest problem:

 

I've copied this code from somewhere else in the file (looking at includes/classes/shopping_cart.php)

	$specials_query = tep_db_query("select specials_new_products_price, specials_percentage from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
	  if (tep_db_num_rows ($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];

Basically, I'm trying to say 'If there is a special, do this, otherwise do that'. To do this, I need an 'if' statement that grabs info from the specials table. The above code is working (my if statement reads

if (($specials['specials_new_products_price']) > 0) {

However, it only works for the first attribute, if I have more than one attribute, it sets the 2nd, 3rd etc attributes to the same price as the first one. I think it's something to do with the if (tep_db_num_rows ($specials_query)) { part, but not sure what that does or means. I've tried deleting it, but that's a no go... Can anyone help me out here?

 

Thanks,

~Barbara~

Link to comment
Share on other sites

GOT IT FIGURED OUT (I THINK)!!!

 

So.. the next problem that I'm having... I'm trying to tweak the rest of the affected pages to set it all up. Now working on the specials page.

 

I've got an if statement to check whether a certain product has price altering options:

$attquery = mysql_fetch_array(mysql_query("SELECT * FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE [color=#FF0000]products_id = '" . (int)$products_id . "'[/color] order by options_values_price desc "));

if ($attquery['options_values_price'] > 0) {

But I'm having trouble, this isn't getting the response I want. I think it's something to do with the products_id = '" . (int)$products_id . "', but I've tried playing around with it and aren't getting anywhere.

 

Any ideas?

 

Thanks,

~Barbara~

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...