Jump to content

Archived

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

ivalea

if statement help

Recommended Posts

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:
[code]$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']);
    }
  }[/code]

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

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!  :)

Share this post


Link to post
Share on other sites
on line 97 - right after this code which displays the checkbox to receive notifications on items just purchased:
[code]
$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;
  }[/code]


Share this post


Link to post
Share on other sites
try this


[code]


$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 '';
}



[/code]

edit had typo

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.