mutter Posted February 11, 2004 Share Posted February 11, 2004 Hi, somebody know how to display only de Pending Orders in account.php? See, i installed a contribution that let the Customer to send me the Bank Deposit Number, Date, Bank Name, etc. this contribution appears like a form block in account.php But i want to make that the customer can choose the Order that he pays in the bank, and i can't make that only appears Pending Orders instead all orders. I take a part of code, that shows the Order History in account.php. <?php $orders_query = tep_db_query("select o.orders_id, o.date_purchased, o.delivery_name, o.delivery_country, o.billing_name, o.billing_country, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . (int)$languages_id . "' order by orders_id desc limit 3"); while ($orders = tep_db_fetch_array($orders_query)) { if (tep_not_null($orders['orders_status_name'])) { $order_name = $orders['delivery_name']; $order_country = $orders['delivery_country']; } else { $order_name = $orders['billing_name']; $order_country = $orders['billing_country']; } ?> <tr <?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL'); ?>"> <td class="main" width="80"><?php echo tep_date_short($orders['date_purchased']); ?></td> <td class="main"><?php echo '#' . $orders['orders_id']; ?></td> <td class="main"><?php echo tep_output_string_protected($order_name) . ', ' . $order_name; ?></td> <td class="main"><?php echo $orders['orders_status_name']; ?></td> <td class="main" align="right"><?php echo $orders['order_total']; ?></td> <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '">' . tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td> </tr> <?php } ?> I was playing with this code for hours, but can't make that only show the Pending Orders of the customer. Someone knows how to do this? Thanks... Link to comment Share on other sites More sharing options...
♥yesudo Posted February 11, 2004 Share Posted February 11, 2004 try this:- <?php $orders_query = tep_db_query("select o.orders_id, o.date_purchased, o.delivery_name, o.delivery_country, o.billing_name, o.billing_country, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and o.orders_status = '1' and s.language_id = '" . (int)$languages_id . "' order by orders_id desc limit 3"); while ($orders = tep_db_fetch_array($orders_query)) { if (tep_not_null($orders['orders_status_name'])) { $order_name = $orders['delivery_name']; $order_country = $orders['delivery_country']; } else { $order_name = $orders['billing_name']; $order_country = $orders['billing_country']; } ?> <tr <?php echo tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL'); ?>"> <td class="main" width="80"><?php echo tep_date_short($orders['date_purchased']); ?></td> <td class="main"><?php echo '#' . $orders['orders_id']; ?></td> <td class="main"><?php echo tep_output_string_protected($order_name) . ', ' . $order_name; ?></td> <td class="main"><?php echo $orders['orders_status_name']; ?></td> <td class="main" align="right"><?php echo $orders['order_total']; ?></td> <td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '">' . tep_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>'; ?></td> </tr> <?php } ?> Your online success is Paramount. Link to comment Share on other sites More sharing options...
mutter Posted February 11, 2004 Author Share Posted February 11, 2004 Thanks Emmet, yesterday i found that only needed to add some code in the db query, the code that you say and this too: and s.orders_status_name = 'Pending' In Pending should say the name that you assign to the orders_status_id number 1 Now i'am trying to add the While code to a variable named $form_block, so when the form loads in account.php the Pending Orders of the customer appears in the form and the customer can check (with checkboxes) the order that he pays. Then the form sends me the Deposit info with the info of the orders that the user checks. This is the form code: <?php $linkform = tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); $form_block = " <FORM METHOD=\"post\" ACTION=\"$linkform\"> <P><strong><font class=\"infoBoxContents\">"._YOURFECHA.":</strong><br> <INPUT type=\"text\" NAME=\"sender_fecha\" VALUE=\"$sender_fecha\" SIZE=30></p> <P><strong><font class=\"infoBoxContents\">"._YOURBANCO.":</strong><br> <INPUT type=\"text\" NAME=\"sender_banco\" VALUE=\"$sender_banco\" SIZE=30></p> <P><strong>"._YOURDEPOSITO.":</strong><br> <INPUT type=\"text\" NAME=\"sender_deposito\" VALUE=\"$sender_deposito\" SIZE=30></p> <P><strong>"._YOURMONTO.":</strong><br> <INPUT type=\"text\" NAME=\"sender_monto\" VALUE=\"$sender_monto\" SIZE=30></p> <P><strong>"._MESSAGE.":</strong><br> <TEXTAREA NAME=\"message\" COLS=30 ROWS=5 WRAP=virtual>$message</TEXTAREA></p> <INPUT type=\"hidden\" name=\"opi\" value=\"ds\"> <P><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\""._SEND."\"></p> </FORM></center>"; if ($opi != "ds") { echo "$form_block"; } elseif ($opi == "ds") { if ($sender_fecha == "") { $fecha_err = "<center><font class=\"infoBoxContents\"><b><i>"._ERROR4."</i></b></font></center>"; $send = "no"; } if ($sender_banco == "") { $name_err = "<center><font class=\"infoBoxContents\"><b><i>"._ERROR1."</i></b></font></center>"; $send = "no"; } if ($sender_deposito == "") { $email_err = "<center><font class=\"infoBoxContents\"><b><i>"._ERROR2."</i></b></font></center>"; $send = "no"; } if ($sender_monto == "") { $email_err = "<center><font class=\"infoBoxContents\"><b><i>"._ERROR3."</i></b></font></center>"; $send = "no"; } if ($send != "no") { $msg .= "Correo: $correo\n"; $msg .= "Nombre: $guest\n"; $msg .= ""._YOURFECHA.": $sender_fecha\n"; $msg .= ""._YOURBANCO.": $sender_banco\n"; $msg .= ""._YOURDEPOSITO.": $sender_deposito\n"; $msg .= ""._YOURMONTO.": $sender_monto\n"; $msg .= ""._MESSAGE.": $message\n\n"; $to = _MAIL; //$mailheaders = "From: $order_name <> \n"; $mailheaders = "From: $guest <> \n"; $mailheaders .= "Reply-To: "._MAIL." \n\n"; $subject = _ASUNTO; mail($to, $subject, $msg, $mailheaders); echo " <font class=\"infoBoxContents\"><b>"._ENVIADO."</b></font>"; } elseif ($send == "no") { echo "$fecha_err"; echo "$name_err"; echo "$email_err"; echo "$message_err"; echo "<br><br>"; echo "$form_block"; }} #FIN FORMULARIO ?> and this the code that show the Pendant Orders. <?php $orders_query = tep_db_query("select o.orders_id, o.date_purchased, o.delivery_name, o.delivery_country, o.billing_name, o.billing_country, ot.text as order_total, s.orders_status_name, s.orders_status_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$customer_id . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and s.orders_status_name = 'Pendiente' and o.orders_status = 1 and s.language_id = '" . (int)$languages_id . "' order by orders_id desc limit 3"); while ($orders = tep_db_fetch_array($orders_query)) { if (tep_not_null($orders['date_purchased'])) { $order_name = $orders['delivery_name']; $order_country = $orders['delivery_country']; } else { $order_name = $orders['billing_name']; $order_country = $orders['billing_country']; } ?> <?php echo tep_date_short($orders['date_purchased']); ?><br> <?php echo '#' . $orders['orders_id']; ?><br> <?php echo tep_output_string_protected($order_name) . ', ' . $order_name; ?><br> <?php echo $orders['orders_status_name']; ?><br> <?php echo $orders['order_total']; ?> <?php } ?> Any ideas? Thanks for your help.. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.