Jump to content


Photo

if statement help


  • Please log in to reply
4 replies to this topic

#1 ivalea

ivalea
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 02 October 2006 - 04:49 PM

Hi all - I'm working with oscommerce and am trying to modify my checkout_success page to basically display a form if the customer purchased a certain model number.

right now here is my select statement:
$products_array = array();
    $products_query = tep_db_query("select products_id, products_name, products_model from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$orders['orders_id'] . "' order by products_name");
    while ($products = tep_db_fetch_array($products_query)) {
      $products_array[] = array('id' => $products['products_id'],
                                'text' => $products['products_name'],
								'model' => $products['products_model']);
    }
  }

And this is what I have to display the form:
if ($products_array['model'] == 'm1'){
  	include(form.php);
	}else{
	echo '';
	}

The problem is that even when the correct model is purchased that part of the page is still blank - not even so much as an error code.  Any thoughts on how I can get this working?

Thanks!  :)

#2 keithschm

keithschm
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 02 October 2006 - 04:52 PM

wherein checkout_success.php are you putting the code?
NEED HELP

#3 ivalea

ivalea
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 02 October 2006 - 05:18 PM

on line 97 - right after this code which displays the checkbox to receive notifications on items just purchased:
$products_displayed = array();
    for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {
      if (!in_array($products_array[$i]['id'], $products_displayed)) {
        echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br>';
        $products_displayed[] = $products_array[$i]['id'];
      }
    }

    echo '</p>';
  } else {
    echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;
  }




#4 keithschm

keithschm
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 02 October 2006 - 06:13 PM

try this




$products_array = array();
$products_query = tep_db_query("select products_id, products_name, products_model from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$orders['orders_id'] . "' order by products_name");
    while ($products = tep_db_fetch_array($products_query)) {
      $model = $products['products_model'];
    }

if ($model == 'm1'){
  	include(form.php);
	}else{
	echo '';
	}




edit had typo
NEED HELP

#5 ivalea

ivalea
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 02 October 2006 - 06:58 PM

Thanks much Keith - that seemed to do the trick! - Irene :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users