Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

RMA Returns error for 2.2 MS2


Guest

Recommended Posts

Hi David,

 

one question before getting into details - was your returns.php file working BEFORE you did the GV changes I posted ?

 

It sounds like there is an error within your code if you even can't see the comment bar on the retuns.php page when you edit a return. The checkbox to complete a return is comming up later in the code - so we need to figure out what is going wrong. It might help if you post (or PM) your returns.php code ...

 

Sebastian

Link to comment
Share on other sites

Hi Sebastian,

 

Thanks for taking a look at my code. Below are the code for admin/returns.php.

 

<?php

/*

 $id author Puddled Internet - http://www.puddled.co.uk

 email [email protected]

  osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com

 

 Copyright (c) 2002 osCommerce

 

 Released under the GNU General Public License

*/

 

 require('includes/application_top.php');

 

 require(DIR_WS_CLASSES . 'currencies.php');

 $currencies = new currencies();

 include(DIR_WS_LANGUAGES . $language . '/' . 'returns.php');

 $orders_statuses = array();

 $orders_status_array = array();

 $orders_status_query = tep_db_query("select returns_status_id, returns_status_name from " . TABLE_RETURNS_STATUS . " where language_id = '" . $languages_id . "'");

 while ($orders_status = tep_db_fetch_array($orders_status_query)) {

   $orders_statuses[] = array('id' => $orders_status['returns_status_id'],

                              'text' => $orders_status['returns_status_name']);

   $orders_status_array[$orders_status['returns_status_id']] = $orders_status['returns_status_name'];

 }

 

 switch ($HTTP_GET_VARS['action']) {

   case 'update_order':

     $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

     $status = tep_db_prepare_input($HTTP_POST_VARS['status']);

     $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);

       $order_updated = false;

 

      if ($HTTP_POST_VARS['restock_charge'] == 'on') {

         $restock_query = tep_db_query("SELECT configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'DEFAULT_RESTOCK_VALUE'");

         $restock = tep_db_fetch_array($restock_query);

         $tax = $restock['configuration_value'];

        // $refund_with_tax = tep_add_tax($HTTP_POST_VARS['refund_amount'], $HTTP_POST_VARS['add_tax']);

         $refund_with_tax = $HTTP_POST_VARS['refund_amount'];

          $work_out_charge = (($refund_with_tax / 100) * $tax);

         $final_price =  ($refund_with_tax - $work_out_charge);

         $payment_method_query = tep_db_query("SELECT refund_method_name FROM " . TABLE_REFUND_METHOD . " where refund_method_id = '" . $HTTP_POST_VARS['department'] . "'");

         $payment_method = tep_db_fetch_array($payment_method_query);

 

           $payment_method = $payment_method['refund_method_name'];

           $payment_ref = $HTTP_POST_VARS['refund_reference'];

           $payment_date = $HTTP_POST_VARS['refund_date'];

 

           $sql_data_array = array('customer_method' => $payment_method,

                                    'refund_payment_value' => $final_price,

                                    'refund_payment_date' => 'now()',

                                    'refund_payment_reference' => $payment_ref,

                                    'refund_payment_deductions' => $work_out_charge,

                                    );

 

           tep_db_perform(TABLE_RETURN_PAYMENTS, $sql_data_array,  'update', 'returns_id = \'' . $oID . '\'');

          $order_update = true;

       } else {

          // $refund_with_tax = tep_add_tax($HTTP_POST_VARS['refund_amount'], $HTTP_POST_VARS['add_tax']);

           $refund_with_tax = $HTTP_POST_VARS['refund_amount'];

           $final_price = $refund_with_tax;

           $payment_method = $payment_method['payment_option_name'];

           $payment_ref = $HTTP_POST_VARS['refund_reference'];

           $payment_date = $HTTP_POST_VARS['refund_date'];

           $work_out_charge = '0';

           $sql_data_array = array('customer_method' => $HTTP_POST_VARS['department'],

                                    'refund_payment_value' => $final_price,

                                    'refund_payment_date' => 'now()',

                                    'refund_payment_reference' => $payment_ref,

                                    'refund_payment_deductions' => $work_out_charge,

                                    );

                                   

           tep_db_perform(TABLE_RETURN_PAYMENTS, $sql_data_array,  'update', 'returns_id = \'' . $oID . '\'');

            $order_updated= true;

    }

   

     // query and send routine for gv-refund / exchange product refund

     if ($HTTP_POST_VARS['gv_refund'] == 'on') {

         include('includes/languages/english/gv_mail.php');

         $refund_amount_query = tep_db_query("select r.refund_payment_value, m.customers_email_address, m.customers_name FROM " . TABLE_RETURN_PAYMENTS . " r, " . TABLE_RETURNS . " m where m.returns_id = r.returns_id and r.returns_id = '" . $oID . "'");

         $refund_amount = tep_db_fetch_array($refund_amount_query);

         $refund = $refund_amount['refund_payment_value'];

         $address = $refund_amount['customers_email_address'];

         $gv_comments = $HTTP_POST_VARS['gv_comments'];

         $salt=$address;

         $gvid = md5(uniqid("","salt"));

         $gvid .= md5(uniqid("","salt"));

         $gvid .= md5(uniqid("","salt"));

         $gvid .= md5(uniqid("","salt"));

         srand((double)microtime()*1000000); // seed the random number generator

         $random_start = @rand(0, (128-16));

         $id1=substr($gvid, $random_start,16);

         $message = tep_db_prepare_input($gv_comments);

         $message .= "\n\n" . TEXT_GV_WORTH  .  $currencies->format($refund) . "\n\n";

         $message .= TEXT_TO_REDEEM;

         $message .= TEXT_WHICH_IS . $id1 . TEXT_IN_CASE . "\n\n";

         $message .= HTTP_SERVER  . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no='.$id1 . "\n\n";

         $message .= TEXT_OR_VISIT . HTTP_SERVER  . DIR_WS_CATALOG . 'gv_redeem.php' . TEXT_ENTER_CODE . $id1;

 

         //Let's build a message object using the email class

         $mimemessage = new email(array('X-Mailer: osCommerce bulk mailer'));

         // add the message to the object

         $mimemessage->add_text($message);

         $mimemessage->build_message();

 

         $mimemessage->send($customers_name, $address, '', STORE_OWNER, $subject);

         // now create the tracking entry

         $gv_query=tep_db_query("insert into gv_tracking (gv_number, date_created, customer_id_sent, sent_firstname, sent_surname, emailed_to, gv_amount) values ('".$id1."', NOW(),'0','Sent by','Admin','".$address."','".$refund."')");

         // now update the refund table to reflect gv as refund method, and set the payment reference as the gv id

         $payment_name = 'Gift Voucher';

         $gv_update_sql = array('customer_method' => $payment_name,

                                'refund_payment_value' => $refund,

                                'refund_payment_reference' => $id1,

                                'refund_payment_date' => 'now()',

 

                                );

         tep_db_perform(TABLE_RETURN_PAYMENTS, $gv_update_sql, 'update', 'returns_id = \'' . $oID . '\'');

         $order_update = true;

         $refund_by_gv = true;

 

    }

 

 

 

     $check_status_query = tep_db_query("select customers_name, customers_email_address, returns_status, date_purchased, comments from " . TABLE_RETURNS . " where returns_id = '" . tep_db_input($oID) . "'");

     $check_status = tep_db_fetch_array($check_status_query);

     if ($check_status['returns_status'] != $status) {

       tep_db_query("update " . TABLE_RETURNS . " set returns_status = '" . tep_db_input($status) . "', last_modified = now() where returns_id = '" . tep_db_input($oID) . "'");

 

    }

 

 

   // tep_db_query("UPDATE " . TABLE_RETURN_PAYMENTS . " set refund_payment_value = '" . $final_price . "' where returns_id = '" . $HTTP_GET_VARS['oID'] . "' ");

 

       $customer_notified = '0';

       if ($HTTP_POST_VARS['notify'] == 'on') {

         $notify_comments = '';

         if ($HTTP_POST_VARS['notify_comments'] == 'on') {

           $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";

         }

         $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);

         tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

         $customer_notified = '1';

       }

 

      // tep_db_query("insert into " . TABLE_RETURNS_STATUS_HISTORY . " (returns_id, new_value, old_value, date_added, customer_notified) values ('" . tep_db_input($oID) . "', '" . tep_db_input($status) . "', '" . $check_status['orders_status'] . "', now(), '" . $customer_notified . "')");

 

       $order_updated = true;

 

     if ($HTTP_POST_VARS['complete'] == 'on') {

        $notify_comments = '';

        tep_db_query("UPDATE " . TABLE_RETURNS . " set returns_date_finished = now(), date_finished = now() where returns_id = '" . $oID . "'");

        $order_update = true;

        $return_complete = true;

 

      }

 

     if ($HTTP_POST_VARS['restock_products'] == 'on') {

         $order_query_restock = tep_db_query("SELECT products_quantity FROM " . TABLE_RETURNS_PRODUCTS_DATA . " where returns_id = '" . $oID . "'");

         //tep_db_query("UPDATE " . TABLE_RETURNS . " set returns_date_finished = '1' where returns_id = '" . $oID . "'");

         $order_query = tep_db_fetch_array($order_query_restock);

         tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order_query['products_quantity'] . " where products_id = '" . $order['products_id'] . "'");

 

         $order_update = true;

         $restock_complete = true;

 

     }

 

     if ($check_status['comments'] != $comments) {

       tep_db_query("update " . TABLE_RETURNS . " set comments = '" . tep_db_input($comments) . "' where returns_id = '" . tep_db_input($oID) . "'");

       $order_updated = true;

     }

 

     if ($order_updated) {

      $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');

        if ($refund_by_gv) {

            $messageStack->add_session(SUCCESS_RETURNED_GIFT, 'success');

        }

       

        if($return_complete) {

            $messageStack->add_session(SUCCESS_RETURN_CLOSED, 'success');

        }

       

        if($restock_complete) {

            $messageStack->add_session(SUCCESS_PRODUCT_TO_STOCK, 'success');

        }

       

     } else {

       $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');

     }

 

     tep_redirect(tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('action')) . 'action=edit'));

     break;

   case 'deleteconfirm':

     $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

 

     tep_remove_return($oID, $HTTP_POST_VARS['restock']);

 

     tep_redirect(tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('oID', 'action'))));

break;

 

// Remove CVV Number

 

 }

 

 if ( ($HTTP_GET_VARS['action'] == 'edit') && ($HTTP_GET_VARS['oID']) ) {

   $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

 

   $orders_query = tep_db_query("select returns_id from " . TABLE_RETURNS . " where returns_id = '" . tep_db_input($oID) . "'");

   $order_exists = true;

   if (!tep_db_num_rows($orders_query)) {

     $order_exists = false;

     $messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error');

   }

 }

 

 

 include(DIR_WS_CLASSES . 'returns.php');

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->

<?php

 require(DIR_WS_INCLUDES . 'header.php');

?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

 <tr>

   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

   </table></td>

<!-- body_text //-->

   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

 if ( ($HTTP_GET_VARS['action'] == 'edit') && ($order_exists) ) {

   $order = new order($oID);

   

 $support_departments = array();

 $support_department_array = array();

 $support_department_query = tep_db_query("select * from " . TABLE_REFUND_METHOD . " ");

 while ($support_department = tep_db_fetch_array($support_department_query)) {

   $support_departments[] = array('id' => $support_department['refund_method_name'],

                              'text' => $support_department['refund_method_name']);

   $support_department_array[$support_department['refund_method_id']] = $support_department['refund_method_name'];

 }

 

 

 

 

 $restock_query = tep_db_query("SELECT configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'DEFAULT_RESTOCK_VALUE'");

 $restock = tep_db_fetch_array($restock_query);

 

$return_complete_query = tep_db_query("SELECT returns_date_finished FROM " . TABLE_RETURNS . " where returns_id = '" . $oID . "'");

$return_complete = tep_db_fetch_array($return_complete_query);

 

if ($return_complete['returns_date_finished'] != '0000-00-00 00:00:00') {

?>

  <tr>

       <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

         <tr>

           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>

           <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><table width="100%" border="0" cellspacing="0" cellpadding="2">

         <tr>

           <td colspan="3"><?php echo tep_draw_separator(); ?></td>

         </tr>

         <tr>

           <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">

             <tr>

               <td class="main" valign="top"><b><?php echo ENTRY_CUSTOMER; ?></b></td>

               <td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, ' ', '<br>'); ?></td>

             </tr>

             <tr>

               <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>

             </tr>

             <tr>

               <td class="main"><b><?php echo ENTRY_TELEPHONE; ?></b></td>

               <td class="main"><?php echo $order->customer['telephone']; ?></td>

             </tr>

             <tr>

               <td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>

               <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td>

             </tr>

           </table></td>

           <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">

             <tr>

               <td class="main" valign="top"><b>Shipping Address</b></td>

               <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>

             </tr>

           </table></td>

           <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">

             <tr>

               <td class="main" valign="top"><b>Billing Address</b></td>

               <td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></td>

             </tr>

           </table></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr>

       <td><table border="0" cellspacing="0" cellpadding="2">

     </tr>

     <?php

// BOF: WebMakers.com Added: Show Order Info

?>

<!-- add Order # // -->

<tr>

<td class="main"><b><?php echo TEXT_INVOICE_NO; ?></b></td>

<td class="main"><?php echo tep_db_input($oID); ?></td>

</tr>

<!-- add date/time // -->

<tr>

<td class="main"><b><?php echo TEXT_DATE_TIME; ?></b></td>

<td class="main"><?php echo tep_datetime_short($order->info['date_purchased']); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo TEXT_IP_ADDRESS; ?></b></td>

<td class="main"><?php echo $order->info['rma_value']; ?></td>

</tr>

 

<?php

// EOF: WebMakers.com Added: Show Order Info

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

 

 

<?php

   if ( (($order->info['cc_type']) || ($order->info['cc_owner']) || ($order->info['cc_number']) || ($order->info['cvvnumber'])) ) {

?>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td>

           <td class="main"><?php echo $order->info['cc_type']; ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td>

           <td class="main"><?php echo $order->info['cc_owner']; ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>

           <td class="main"><?php echo $order->info['cc_number']; ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td>

           <td class="main"><?php echo $order->info['cc_expires']; ?></td>

         </tr>

 

    <?

}

?>

 

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

         <tr class="dataTableHeadingRow">

           <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>

           <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>

           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>

           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>

           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>

           <td class="dataTableHeadingContent" align="right">Deductions</td>

           <td class="dataTableHeadingContent" align="right">Refund Amount</td>

 

         </tr>

<?php

// for ($i=0; $i<sizeof($order->products); $i++) {

      $refunds_payment_query = tep_db_query("SELECT * FROM " . TABLE_RETURN_PAYMENTS . " where returns_id = '" . $oID . "'");

      $refund = tep_db_fetch_array($refunds_payment_query);

 

 

 

     echo '          <tr class="dataTableRow">' . "\n" .

          '            <td class="dataTableContent" valign="top" align="right">' . $order->products['qty'] . ' x</td>' . "\n" .

          '            <td class="dataTableContent" valign="top">' . $order->products['name'];

 

 

 

     echo '            </td>' . "\n" .

          '            <td class="dataTableContent" valign="top">' . $order->products['model'] . '</td>' . "\n" .

          '            <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products['tax']) . '%</td>' . "\n" .

          '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products['final_price'] * $order->products['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .

          '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products['final_price'], $order->products['tax']) * $order->products['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .

           '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($refund['refund_payment_deductions']) . '</b></td>' . "\n" .

          '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($refund['refund_payment_value']) . '</b></td>' . "\n";

      echo '          </tr>' . "\n";

//}

?>

         <tr>

           <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">

<?php

   for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {

     echo '              <tr>' . "\n" .

          '                <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .

          '                <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" .

          '              </tr>' . "\n";

   }

?>

           </table></td>

         </tr>

       </table></td>

     </tr>

 

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>

     </tr>

     <tr><?php echo tep_draw_form('status', FILENAME_RETURNS, tep_get_all_get_params(array('action')) . 'action=update_order'); ?>

 

     </tr>

       <?

       $order_status_query = tep_db_query("SELECT returns_status_name FROM " . TABLE_RETURNS_STATUS . " where returns_status_id = '" . $order->info['orders_status'] . "'");

       $order_status  = tep_db_fetch_array($order_status_query);

?>

 

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr>

       <td><table border="0" cellspacing="0" cellpadding="2">

         <tr>

           <td><table border="0" cellspacing="0" cellpadding="2">

             <tr>

                <td class="main" valign=top><b>Returns Comments:</b></td><td class=main><?php echo nl2br($order->info['comments']); ?></td>

              </tr>

              <tr>

              <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

             </tr>

             <tr>

               <td class="main" width=25%><b><? echo ENTRY_STATUS; ?></b></td><td width=65% class=main><?php echo $order_status['returns_status_name']; ?></td>

             </tr>

             <tr>

              <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

             </tr>

             <tr>

               <td class="main" width=25% valign=top><b><?php echo CUSTOMER_PREFERENCE; ?></b></td><td width=65% class=main><? echo $order->info['department']; ?></td>

             </tr>

             <tr>

               <td class="main" width=25% valign=top><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td><td width=65% class=main><? echo $order->info['customer_method']; ?></td>

             </tr>

             <tr>

               <td class="main" width=25% valign=top><b><?php echo ENTRY_PAYMENT_REFERENCE; ?></b></td><td width=65% class=main><? echo $order->info['payment_reference']; ?></td>

             </tr>

             <?

              $price_new = $order->info['refund_amount'];

 

             ?>

 

             <tr>

               <td class="main" width=25%><b><? echo ENTRY_PAYMENT_AMOUNT; ?></b></td><td width=65% class=main><? echo $currencies->format($price_new ); ?></td>

             </tr>

             <tr>

               <td class="main" width=25%><b><? echo ENTRY_PAYMENT_DATE; ?></b></td><td width=65% class=main><? echo tep_date_short($order->info['refund_date']); ?></td>

             </tr>

             <?

             $restock_query = tep_db_query("SELECT configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'DEFAULT_RESTOCK_VALUE'");

             $restock = tep_db_fetch_array($restock_query);

             $tax = $restock['configuration_value'];

             $work_out_charge = ((tep_add_tax($order->info['refund_amount'],$order->products['tax']) / 100) * $tax);

             echo '<input type=hidden name=add_tax value=' . $order->products['tax'] . '>';

             ?>

 

             <tr>

               <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

             </tr>

 

           </table></td>

 

 

 

         </tr>

       </table></td>

     </form></tr>

 

 

<?php

// }

 ?>

 

 

<?

} else {

?>

 

     <tr>

       <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

         <tr>

           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>

           <td class="pageHeading" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><table width="100%" border="0" cellspacing="0" cellpadding="2">

         <tr>

           <td colspan="3"><?php echo tep_draw_separator(); ?></td>

         </tr>

         <tr>

           <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">

             <tr>

               <td class="main" valign="top"><b><?php echo ENTRY_CUSTOMER; ?></b></td>

               <td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, ' ', '<br>'); ?></td>

             </tr>

             <tr>

               <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>

             </tr>

             <tr>

               <td class="main"><b><?php echo ENTRY_TELEPHONE; ?></b></td>

               <td class="main"><?php echo $order->customer['telephone']; ?></td>

             </tr>

             <tr>

               <td class="main"><b><?php echo ENTRY_EMAIL_ADDRESS; ?></b></td>

               <td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td>

             </tr>

           </table></td>

           <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">

             <tr>

               <td class="main" valign="top"><b><?php echo ENTRY_SHIPPING_ADDRESS; ?></b></td>

               <td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>

             </tr>

           </table></td>

           <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">

             <tr>

               <td class="main" valign="top"><b><?php echo ENTRY_BILLING_ADDRESS; ?></b></td>

               <td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, ' ', '<br>'); ?></td>

             </tr>

           </table></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr>

       <td><table border="0" cellspacing="0" cellpadding="2">

     </tr>

<?php

// BOF: WebMakers.com Added: Show Order Info

?>

<!-- add Order # // -->

<tr>

<td class="main"><b><?php echo TEXT_INVOICE_NO; ?></b></td>

<td class="main"><?php echo tep_db_input($oID); ?></td>

</tr>

<!-- add date/time // -->

<tr>

<td class="main"><b><?php echo TEXT_DATE_TIME; ?></b></td>

<td class="main"><?php echo tep_datetime_short($order->info['date_purchased']); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo TEXT_IP_ADDRESS; ?></b></td>

<td class="main"><?php echo $order->info['rma_value']; ?></td>

</tr>

 

<?php

// EOF: WebMakers.com Added: Show Order Info

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>

<td class="main"><?php echo $order->info['payment_method']; ?></td>

</tr>

 

 

<?php

   if ( (($order->info['cc_type']) || ($order->info['cc_owner']) || ($order->info['cc_number']) || ($order->info['cvvnumber'])) ) {

?>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_CREDIT_CARD_TYPE; ?></td>

           <td class="main"><?php echo $order->info['cc_type']; ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_CREDIT_CARD_OWNER; ?></td>

           <td class="main"><?php echo $order->info['cc_owner']; ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_CREDIT_CARD_NUMBER; ?></td>

           <td class="main"><?php echo $order->info['cc_number']; ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo ENTRY_CREDIT_CARD_EXPIRES; ?></td>

           <td class="main"><?php echo $order->info['cc_expires']; ?></td>

         </tr>

 

<?

   }

?>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">

         <tr class="dataTableHeadingRow">

           <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>

           <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>

           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>

           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>

           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>

         </tr>

<?php

  // for ($i=0; $i<sizeof($order->products); $i++) {

 

     echo '          <tr class="dataTableRow">' . "\n" .

          '            <td class="dataTableContent" valign="top" align="right">' . $order->products['qty'] . ' x</td>' . "\n" .

          '            <td class="dataTableContent" valign="top">' . $order->products['name'];

 

 

 

     echo '            </td>' . "\n" .

          '            <td class="dataTableContent" valign="top">' . $order->products['model'] . '</td>' . "\n" .

          '            <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products['tax']) . '%</td>' . "\n" .

          '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products['final_price'] * $order->products['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .

          '            <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products['final_price'], $order->products['tax']) * $order->products['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";

     echo '          </tr>' . "\n";

  // }

?>

         <tr>

           <td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">

<?php

   for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {

     echo '              <tr>' . "\n" .

          '                <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .

          '                <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" .

          '              </tr>' . "\n";

   }

?>

           </table></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td class="main"><br><b><?php echo TABLE_HEADING_COMMENTS; ?></b></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>

     </tr>

     <tr><?php echo tep_draw_form('status', FILENAME_RETURNS, tep_get_all_get_params(array('action')) . 'action=update_order'); ?>

       <td class="main"><?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $order->info['comments']); ?></td>

     </tr>

 

     <tr><t

Link to comment
Share on other sites

David : This can't be your whole returns.php file ... if it is - it can not work - there are about 235 lines missing in the code !!! Compare your returns.php file with the one in the RMA package (2.2e) ...

 

Or search - in the code you posted - for

 

<tr><t

 

which is the last line - REMOVE '<tr><t' AND insert this code which is missing :

 

      <tr><td><?php include ("comment_bar_return.html"); ?></td></tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" cellspacing="0" cellpadding="2">
         <tr>
           <td><table border="0" cellspacing="0" cellpadding="2">
             <tr>
               <td class="main" width=25%><b><? echo ENTRY_STATUS; ?></b></td><td width=65% class=main><?php echo tep_draw_pull_down_menu('status', $orders_statuses, $order->info['orders_status']); ?></td>
             </tr>
             <tr>
              <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
             </tr>
             <tr>
               <td class="main" width=25% valign=top><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td><td width=65% class=main><? echo tep_draw_pull_down_menu('department', $support_departments); ?></td>
             </tr>
             <tr>
             <td class=main width=25% valign=top><b><? echo TEXT_CUSTOM_PREF_METHOD; ?></b></td><td width=65% class=main><b><? echo $order->info['department']; ?></b></td>
             </tr>
             <tr>
               <td class="main" width=25% valign=top><b><?php echo ENTRY_PAYMENT_REFERENCE; ?></b></td><td width=65% class=main><? echo tep_draw_input_field('refund_reference', $order->info['payment_reference']); ?></td>
             </tr>
             <?
              $price_new = $order->info['refund_amount'];
             
             ?>

             <tr>
               <td class="main" width=25%><b><? echo ENTRY_PAYMENT_AMOUNT; ?></b></td><td width=65% class=main><? echo tep_draw_input_field('refund_amount', $price_new ); ?></td>
             </tr>
             <tr>
               <td class="main" width=25%><b><? echo ENTRY_PAYMENT_DATE; ?></b></td><td width=65% class=main><? echo tep_draw_input_field('refund_date', tep_date_short($order->info['refund_date'])); ?></td>
             </tr>
             <?
             $restock_query = tep_db_query("SELECT configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'DEFAULT_RESTOCK_VALUE'");
             $restock = tep_db_fetch_array($restock_query);
             $tax = $restock['configuration_value'];
             $work_out_charge = ((tep_add_tax($order->info['refund_amount'],$order->products['tax']) / 100) * $tax);
             echo '<input type=hidden name=add_tax value=' . $order->products['tax'] . '>';
             ?>
             <tr>
             <td class="main" width=25%><b><? echo ENTRY_RESTOCK_CHARGE; ?></b></td><td width=65% class=main><?php echo tep_draw_checkbox_field('restock_charge', '', true); ?>  (<?echo $currencies->format($work_out_charge); ?>)</td>
             </tr>
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
             </tr>
             <tr>
             <td class="main" width=25%><b><? echo SUCCESS_RETURNED_GIFT; ?></b></td><td width=65% class=main><?php echo tep_draw_checkbox_field('gv_refund', '', false); ?></td>
             </tr>
             <tr>
             <td class=main valign=top><b><? echo TEXT_GIFT_COMMENT; ?></b></td><td class="main"><?php echo tep_draw_textarea_field('gv_comments', 'soft', '60', '5'); ?></td>
             </tr>
             <tr>
               <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
             </tr>
             <tr>
               <td class="main"><b><?php echo ENTRY_NOTIFY_CUSTOMER; ?></b> <?php echo tep_draw_checkbox_field('notify', '', false); ?></td>
               <td class="main"><b><?php echo ENTRY_NOTIFY_COMMENTS; ?></b> <?php echo tep_draw_checkbox_field('notify_comments', '', false); ?></td>
             </tr>
             <tr>
               <td class="main"><b><? echo TEXT_COMPLETE_RETURN; ?></b> <?php echo tep_draw_checkbox_field('complete', '', false); ?></td>
               <td class="main"><b><? echo TEXT_BACK_TO_STOCK; ?></b> <?php echo tep_draw_checkbox_field('restock_products', '', false); ?></td>
             </tr>
           </table></td>

              <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
      <tr>
      <td valign="top" align=right><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
      </TR>
         </tr>
       </table></td>
     </form></tr>

     <tr>
       <td colspan="2" align="right"><?php echo 

   '<a href="' . tep_href_link(FILENAME_RETURNS_INVOICE, 'oID=' . $HTTP_GET_VARS['oID']) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('action'))) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
     </tr>

<?php

}
 } else {
?>
     <tr>
       <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>
           <td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr><?php echo tep_draw_form('returns', FILENAME_RETURNS, '', 'get'); ?>
               <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('cID', '', 'size="15"') . tep_draw_hidden_field('action', 'edit'); ?></td>
             </form></tr>
             <tr><?php echo tep_draw_form('status', FILENAME_RETURNS, '', 'get'); ?>
               <td class="smallText" align="right"><?php echo HEADING_TITLE_STATUS . ' ' . tep_draw_pull_down_menu('status', array_merge(array(array('id' => '', 'text' => 'All returns')), $orders_statuses), '', 'onChange="this.form.submit();"'); ?></td>
             </form></tr>            
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow">
               <tr class="dataTableHeadingRow">
<?php // ADDED BY BURT ?>
               <td class="dataTableHeadingContent" align="center">RMA #</td>
<?php // END BURT ?>
               <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ORDER_TOTAL; ?></td>
               <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td>

               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
               <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
             </tr>
<?php
   if ($HTTP_GET_VARS['cID']) {
     $cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);
// NEW "IF ELSEIF ELSE" ADDED BY BURT SO REPLACE THE OLD ONE WITH THIS

     $orders_query_raw = "select o.returns_id, o.customers_name, o.rma_value, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.return_reason_name, op.final_price, o.returns_date_finished from " . TABLE_RETURNS . " o left join " . TABLE_RETURNS_PRODUCTS_DATA . " op on (o.returns_id = op.returns_id), " . TABLE_RETURN_REASONS . " s where o.returns_reason = s.return_reason_id and s.language_id = '" . $languages_id . "' and o.rma_value = '" . $cID . "' order by o.returns_id DESC";
    } elseif ($HTTP_GET_VARS['status']) {
     $status = tep_db_prepare_input($HTTP_GET_VARS['status']);

    $orders_query_raw = "select o.returns_id, o.customers_name, o.rma_value, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.return_reason_name, op.final_price, o.returns_date_finished from " . TABLE_RETURNS . " o left join " . TABLE_RETURNS_PRODUCTS_DATA . " op on (o.returns_id = op.returns_id), " . TABLE_RETURN_REASONS . " s where o.returns_reason = s.return_reason_id and s.language_id = '" . $languages_id . "' and o.returns_status = '" . $status . "' order by o.returns_id DESC";

     } else {
     $orders_query_raw = "select o.returns_id, o.customers_name, o.rma_value, o.payment_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.return_reason_name, op.final_price, o.returns_date_finished from " . TABLE_RETURNS . " o left join " . TABLE_RETURNS_PRODUCTS_DATA . " op on (o.returns_id = op.returns_id), " . TABLE_RETURN_REASONS . " s where o.returns_reason = s.return_reason_id and s.language_id = '" . $languages_id . "' order by o.returns_id DESC";
   }
// END BURT
   $orders_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $orders_query_raw, $orders_query_numrows);
   $orders_query = tep_db_query($orders_query_raw);
   while ($orders = tep_db_fetch_array($orders_query)) {
     if (((!$HTTP_GET_VARS['oID']) || ($HTTP_GET_VARS['oID'] == $orders['returns_id'])) && (!$oInfo)) {
       $oInfo = new objectInfo($orders);
     }

     if ( (is_object($oInfo)) && ($orders['returns_id'] == $oInfo->returns_id) ) {
       echo '              <tr class="dataTableRowSelected">' . "\n";
     } else {
       echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['returns_id']) . '\'">' . "\n";
     }
?>
<?php // ADDED BY BURT ?>
               <td class="dataTableContent" align="center"><b><?php echo $orders['rma_value']; ?></b></a>
<?php // END BURT ?>
               <td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $orders['returns_id'] . '&action=edit') . '">' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . ' ' . $orders['customers_name'] . '</a>'; ?></td>
               <td class="dataTableContent" align="right"><?php echo $currencies->format($orders['final_price']); ?></td>
               <td class="dataTableContent" align="center"><?php echo tep_datetime_short($orders['date_purchased']); ?></td>

               <td class="dataTableContent" align="right"><?php echo $orders['return_reason_name']; ?></td>
               <td class="dataTableContent" align="right"><?php if ( (is_object($oInfo)) && ($orders['returtns_id'] == $oInfo->returns_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('oID')) . 'oID=' . $orders['returns_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>
             </tr>
<?php
   }
?>
             <tr>
               <td colspan="6"><table border="0" width="100%" cellspacing="0" cellpadding="2">
                 <tr>
                   <td class="smallText" valign="top"><?php echo $orders_split->display_count($orders_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_ORDERS); ?></td>
                   <td class="smallText" align="right"><?php echo $orders_split->display_links($orders_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'oID', 'action'))); ?></td>
                 </tr>
               </table></td>
             </tr>
           </table></td>
<?php
 $heading = array();
 $contents = array();
 switch ($HTTP_GET_VARS['action']) {
   case 'delete':
     $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_ORDER . '</b>');

     $contents = array('form' => tep_draw_form('orders', FILENAME_RETURNS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->returns_id . '&action=deleteconfirm'));
     $contents[] = array('text' => TEXT_INFO_DELETE_INTRO . '<br><br><b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>');
     $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('restock') . ' ' . TEXT_INFO_RESTOCK_PRODUCT_QUANTITY);
     $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->returns_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
     break;
   default:
     if (is_object($oInfo)) {
       $heading[] = array('text' => '<b>[' . $oInfo->returns_id . ']  ' . tep_datetime_short($oInfo->date_purchased) . '</b>');

       $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->returns_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_RETURNS, tep_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->returns_id . '&action=delete') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
       $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_RETURNS_INVOICE, 'oID=' . $oInfo->returns_id) . '" TARGET="_blank">' . tep_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) .

// Begin IceTheNet Repair Packing Slip Mod
// If you really need a packing slip then you can modify admin/packingslip.php
// and add IMAGE_ORDER_PACKINGSLIP to application_top_refund.php

/* '</a> <a href="' . tep_href_link(FILENAME_RETURNS_PACKINGSLIP, 'oID=' . $oInfo->returns_id) . '" TARGET="_blank">' . tep_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) .
*/
//End IceTheNet Fix Packing Slip Mod

'</a>');   // don?t forget this very important

       $contents[] = array('text' => '<br>' . TEXT_DATE_ORDER_CREATED . ' ' . tep_date_short($oInfo->date_purchased));
       if (tep_not_null($oInfo->last_modified)) $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . tep_date_short($oInfo->last_modified));
       $contents[] = array('text' => '<br>' . TEXT_INFO_PAYMENT_METHOD . ' '  . tep_date_short($oInfo->returns_date_finished));
     }
     break;
 }

 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
   echo '            <td width="25%" valign="top">' . "\n";

   $box = new box;
   echo $box->infoBox($heading, $contents);

   echo '            </td>' . "\n";
 }
?>
         </tr>
       </table></td>
     </tr>
<?php
 }
?>
   </table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php
   require(DIR_WS_INCLUDES . 'footer.php');
?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

Now you should have a working returns.php. The more simple way is to copy the file from the 2.2e package over your file.

 

NOTE : There are no ccGV modifications made in the code - you NEED to do the mod's if you want RMA to work with ccGV ... but this should be the next step after it is working.

 

Sebastian

Link to comment
Share on other sites

Hi Sebastian,

 

Checking through the return.php file, it does include the codes that you have posted. For some reason when I was posting the previous thread, it cut off my codes. It still seems to be hardcoded. Do you have any other suggestions?

 

Thanks,

David

Link to comment
Share on other sites

Hi again David,

 

my very first suggestion would be - try the returns.php which came with the 2.2e package Cathy made (thanks again Cathy for updating again and again). Just to make shure that it is not my modifications causing your error.

 

I would love to post my returns.php file but I think it is useless because of my heavy modified admin area :(

 

Sebastian

Link to comment
Share on other sites

Hi Sebastian,

 

Thanks for the quick reply. I just did a compare with 2.2d and found that the problem is:

 

if ($return_complete['returns_date_finished'] != '0000-00-00 00:00:00') {

 

AND

 

if ($HTTP_POST_VARS['complete'] == 'on') {
        $notify_comments = '';
        tep_db_query("UPDATE " . TABLE_RETURNS . " set returns_date_finished = now(), date_finished = now() where returns_id = '" . $oID . "'");
        $order_update = true;
        $return_complete = true;

      }

 

When I replace them back with the original code, it works and I am able to see the comment bar box and able to select and apply the changes.

 

Thanks,

David

Link to comment
Share on other sites

Aha - now I know what the error is (and where it came from):

 

Have a look at the install instructions - there is ONE step missing. Install instructions in 2.2b read like the following:

 

INSTALLATION

 

Run the enclosed SQL 

 

OR alter and create new database info ====Add====>

 

ALTER TABLE returned_products CHANGE returns_date_finished returns_date_finished DATETIME DEFAULT "00-00-00 00:00:00";

 

This part is missing in the install instructions of Version 2.2e but is VERY important!

 

AND even there is a BUG in - the correct sql line should read:

 

 

INSTALLATION

 

Run the enclosed SQL 

 

OR alter and create new database info ====Add====>

 

ALTER TABLE returned_products CHANGE returns_date_finished returns_date_finished DATETIME DEFAULT "0000-00-00 00:00:00";

 

A DateTime field has to have the correct DEFAUT value - it CAN'T BE 00-00-00 00:00:00 - it HAS to be 0000-00-00 00:00:00

 

This is the reason for your error case - my code correction

 

if ($return_complete['returns_date_finished'] != '0000-00-00 00:00:00') {

 

is looking for an entry in this field - if it does not match - there is your error ...

 

 

Hope everything is fine now

Sebastian

 

 

P.S. Cathy - If you do another update - please not this and put it in the install instructions. My modifications will ONLY work with this sql line !

Link to comment
Share on other sites

Additional: If you would like to finish (close) a RMA you should got back to page 15 of this thread - all changes I posted there (Posted: Jun 25 2004, 12:57 PM) are working with the correct entries in this DateTime field ...

Link to comment
Share on other sites

Dear Doing,

 

I have made a trail order from your site. I did not see any of the RMA function in the order histroy.

 

Would you set this up and let me do a test drive? I am really want to know how you make this RMA works.

 

Thanks.

Link to comment
Share on other sites

@kkkqqq

 

You are right - RMA / ccGV is NOT installed on my demo shop. I've got both of them installed on my testsystem (local server). As I like contributions which work the way they are supposed to work I am testing my system to find out if there are any bugs left (better me than any customer).

 

There will be a major update to my demo shop within the next weeks. This update will include a combination of Multi Store WITH B2B suite, RMA, ccgV AND Master Products ... checking this and correcting takes time :)

 

Here are some screenshots:

 

1.) RMA page after clicking return on account_history_info

 

2.) admin page of an open RMA (part1)

 

3.) admin admin page of an open RMA (part2)

 

4.) admin page showing a closed (finished) RMA

 

5.) admin overview

 

 

Sebastian

Edited by doing
Link to comment
Share on other sites

Doing,

 

Thank you for your screen shot.

 

I never get to the screen of "RMA page after clicking return on account_history_info". I don't know what is wrong with me. I am using 2.2e. Seems you are using a German version. Which version is that?

 

By the way, do you think this RMA works if you install your store under the root directory? (not under a shop or catalog directory)

Link to comment
Share on other sites

The page now known as 'RMA page after clicking return on account_history_info' is return_product.php :)

 

I am using 2.2b with german language files created. I based all my mod's on this version and posted the changes I made (exept some design changes). I did not try 2.2e so I can't really say what's going on in your system - sorry.

 

There should be no problems running the RMA system in the root directory if your shop is installed there and configure.php files are ok with their path's

 

Sebastian

Link to comment
Share on other sites

Sorry about not posting in awhile, been busy and was counting on being notified thru email that another post was made to this, and nothing. Just by chance I decided to check the thread and more posts were added! I have my settings to notify me, but for some reason its not doing it now. Anyway.....

 

:o You mean I missed a NOTE line in 2.2e!!!! Jeez, I'll get that corrected.

 

Although, as for the commenting out the GV stuff, I did try that and for some reason couldn't get it to stop erroring. So, maybe after the 2.2f release fixing the notes, I'll put in the thread line for the people using GV to use Sebastians fixes and they can manually add them and see if it works for them that way. Since I don't have the GV installed its hard for me to tell if I was getting errors because of that or not.

 

Hmmmm...99 lines you say! Sounds scarey!!!

Link to comment
Share on other sites

Ok RMA returns system 2.2f is now uploaded to the contributions area adding in the SQL notes that were forgotten in 2.2e. I also recopied over the 2.2b SQL to play it safe.

 

Thread link to include fixes if you are using the Gift Voucher contribution (CCGV 5.10), refer to Sebastians fixes in this thread as this contribution does not have GV installed:

http://www.oscommerce.com/forums/index.php?sho...ic=61077&st=160

Link to comment
Share on other sites

@cathy ... I AM sorry - you still have this SQL bug in 2.2f :huh:

 

The corrected SQL line is 8 postings ago - it should read:

 

ALTER TABLE returned_products CHANGE returns_date_finished returns_date_finished DATETIME DEFAULT "0000-00-00 00:00:00";

 

Sebastian

Link to comment
Share on other sites

What exactly does that script do? I have it on mine from the original creators install and I don't get errors from it. Or is it something that isn't showing up on my Admin pages that I'm not aware of?

 

Nevermind...I see the diff...the 0000 for the year!

 

Thanks!

Edited by only2empires
Link to comment
Share on other sites

In the sql file coming with the package(2.2b-2.2f), there is the following definition for table 'returned_products' in your database

 

#

# Table structure for table `returned_products`

#

 

DROP TABLE IF EXISTS returned_products;

CREATE TABLE returned_products (

  returns_id int(11) NOT NULL auto_increment,

  customers_id int(11) NOT NULL default '0',

  rma_value varchar(15) NOT NULL default '0',

  order_id int(11) NOT NULL default '0',

  customers_name varchar(64) NOT NULL default '',

  customers_acct varchar(32) default NULL,

  customers_company varchar(32) default NULL,

  customers_street_address varchar(64) NOT NULL default '',

  customers_suburb varchar(32) default NULL,

  customers_city varchar(32) NOT NULL default '',

  customers_postcode varchar(10) NOT NULL default '',

  customers_state varchar(32) default NULL,

  customers_country varchar(32) NOT NULL default '',

  customers_telephone varchar(32) NOT NULL default '',

  customers_fax varchar(32) NOT NULL default '',

  customers_email_address varchar(96) NOT NULL default '',

  customers_address_format_id int(5) NOT NULL default '0',

  delivery_name varchar(64) NOT NULL default '',

  delivery_company varchar(32) default NULL,

  delivery_street_address varchar(64) NOT NULL default '',

  delivery_suburb varchar(32) default NULL,

  delivery_city varchar(32) NOT NULL default '',

  delivery_postcode varchar(10) NOT NULL default '',

  delivery_state varchar(32) default NULL,

  delivery_country varchar(32) NOT NULL default '',

  delivery_address_format_id int(5) NOT NULL default '0',

  billing_name varchar(64) NOT NULL default '',

  billing_acct varchar(32) default NULL,

  billing_company varchar(32) default NULL,

  billing_street_address varchar(64) NOT NULL default '',

  billing_suburb varchar(32) default NULL,

  billing_city varchar(32) NOT NULL default '',

  billing_postcode varchar(10) NOT NULL default '',

  billing_state varchar(32) default NULL,

  billing_country varchar(32) NOT NULL default '',

  billing_address_format_id int(5) NOT NULL default '0',

  payment_method varchar(64) NOT NULL default '',

  cc_type varchar(20) default NULL,

  cc_owner varchar(64) default NULL,

  cc_number varchar(32) default NULL,

  cc_expires varchar(4) default NULL,

  cvvnumber char(3) default NULL,

  last_modified datetime default NULL,

  date_purchased datetime default NULL,

  returns_status int(5) NOT NULL default '0',

  returns_date_finished int(2) default '0',

  comments text,

  currency char(3) default NULL,

  currency_value decimal(14,6) default NULL,

  account_name varchar(32) NOT NULL default '',

  account_number varchar(20) default NULL,

  po_number varchar(12) default NULL,

  date_finished datetime NOT NULL default '00-00-00 00:00:00',

  returns_reason tinyint(5) unsigned default '0',

  PRIMARY KEY  (returns_id)

) TYPE=MyISAM;

 

There are ERRORS in !

 

  returns_date_finished int(2) default '0',

and

  date_finished datetime NOT NULL default '00-00-00 00:00:00',

 

The ADDED line in the install text is trying to correct this error :

 

ALTER TABLE returned_products CHANGE returns_date_finished returns_date_finished DATETIME DEFAULT "00-00-00 00:00:00";

 

BUT even in this correction coming with the install text, there is an ERROR ! The correct entry is :

 

ALTER TABLE returned_products CHANGE returns_date_finished returns_date_finished DATETIME DEFAULT "0000-00-00 00:00:00";

 

Just watch for the date format - it can't be 00-00-00 ... it MUST be 0000-00-00 (2004-07-11).

 

This is the reason why you should ALSO correct the returns.php - corrections :

 

 

1.) Open up catalog/admin/returns.php

 

2.) Search for

 

     if ($HTTP_POST_VARS['complete'] == 'on') {
        $notify_comments = '';
        tep_db_query("UPDATE " . TABLE_RETURNS . " set returns_date_finished = '1' where returns_id = '" . $oID . "'");
        $order_update = true;
        $return_complete = true;

 

at line 150 in the original file

 

Change this to the following code

 

  
    if ($HTTP_POST_VARS['complete'] == 'on') {
        $notify_comments = '';
        tep_db_query("UPDATE " . TABLE_RETURNS . " set returns_date_finished = now(), date_finished = now() where returns_id = '" . $oID . "'");
        $order_update = true;
        $return_complete = true;

      }

 

these lines will store the actual DateTime in the DB - you simply CAN'T write a '1' in a DateTime field !

 

3.) Search for

 

 if ($return_complete['returns_date_finished'] == '1') {

 

within the same file (returns.php) - at line 266

 

Change this to the following code

 

 if ($return_complete['returns_date_finished'] != '0000-00-00 00:00:00') {

 

This correction is now looking for an entry which is NOT 0000-00-00 00:00:00 in the DateTime field.

 

Sebastian

 

 

P.S. What about calling it 2.3 in near future ? - just instead of z :)

Link to comment
Share on other sites

Yep, ok. Got those 2 changes in the updates already from your fixes starting with 2.2e and up. Just double checked to make sure :D

 

About the 2.3, I was going to do that, and then I got to thinking they were using 2.2 for the version of osCommerce in use. And that if they ever come up with a 2.3 version that's what they would use then...not sure. Maybe I'm thinking wrong.

Link to comment
Share on other sites

I forgot this one which is NOT in any install text's but needed to correct the values of date_finished (00-00-00 00:00:00) posted above:

 

ALTER TABLE returned_products CHANGE date_finished date_finished DATETIME DEFAULT "0000-00-00 00:00:00";

 

There are two corrections for this table - sorry

 

 

Sebastian

Link to comment
Share on other sites

Ok...looking at this change in the SQL statement, I'm seeing that if I change the bolded line to show the '0000-00-00 00:00:00' then we wouldn't need the ALTER text line for that in the ReadMe notes as this would be the correct structure. Am I thinking correctly???

 

currency char(3) default NULL,

currency_value decimal(14,6) default NULL,

account_name varchar(32) NOT NULL default '',

account_number varchar(20) default NULL,

po_number varchar(12) default NULL,

date_finished datetime NOT NULL default '0000-00-00 00:00:00', returns_reason tinyint(5) unsigned default '0',

PRIMARY KEY (returns_id)

) TYPE=MyISAM;

 

Thanks!

Link to comment
Share on other sites

100% correct ;) - this would be the best way to end with these ALTER TABLE changes ...

 

This would be the correct INSERT for 'returned_products' table

 

#
# Table structure for table `returned_products`
#

DROP TABLE IF EXISTS returned_products;
CREATE TABLE returned_products (
 returns_id int(11) NOT NULL auto_increment,
 customers_id int(11) NOT NULL default '0',
 rma_value varchar(15) NOT NULL default '0',
 order_id int(11) NOT NULL default '0',
 customers_name varchar(64) NOT NULL default '',
 customers_acct varchar(32) default NULL,
 customers_company varchar(32) default NULL,
 customers_street_address varchar(64) NOT NULL default '',
 customers_suburb varchar(32) default NULL,
 customers_city varchar(32) NOT NULL default '',
 customers_postcode varchar(10) NOT NULL default '',
 customers_state varchar(32) default NULL,
 customers_country varchar(32) NOT NULL default '',
 customers_telephone varchar(32) NOT NULL default '',
 customers_fax varchar(32) NOT NULL default '',
 customers_email_address varchar(96) NOT NULL default '',
 customers_address_format_id int(5) NOT NULL default '0',
 delivery_name varchar(64) NOT NULL default '',
 delivery_company varchar(32) default NULL,
 delivery_street_address varchar(64) NOT NULL default '',
 delivery_suburb varchar(32) default NULL,
 delivery_city varchar(32) NOT NULL default '',
 delivery_postcode varchar(10) NOT NULL default '',
 delivery_state varchar(32) default NULL,
 delivery_country varchar(32) NOT NULL default '',
 delivery_address_format_id int(5) NOT NULL default '0',
 billing_name varchar(64) NOT NULL default '',
 billing_acct varchar(32) default NULL,
 billing_company varchar(32) default NULL,
 billing_street_address varchar(64) NOT NULL default '',
 billing_suburb varchar(32) default NULL,
 billing_city varchar(32) NOT NULL default '',
 billing_postcode varchar(10) NOT NULL default '',
 billing_state varchar(32) default NULL,
 billing_country varchar(32) NOT NULL default '',
 billing_address_format_id int(5) NOT NULL default '0',
 payment_method varchar(64) NOT NULL default '',
 cc_type varchar(20) default NULL,
 cc_owner varchar(64) default NULL,
 cc_number varchar(32) default NULL,
 cc_expires varchar(4) default NULL,
 cvvnumber char(3) default NULL,
 last_modified datetime default NULL,
 date_purchased datetime default NULL,
 returns_status int(5) NOT NULL default '0',
 returns_date_finished datetime NOT NULL default '0000-00-00 00:00:00',
 comments text,
 currency char(3) default NULL,
 currency_value decimal(14,6) default NULL,
 account_name varchar(32) NOT NULL default '',
 account_number varchar(20) default NULL,
 po_number varchar(12) default NULL,
 date_finished datetime NOT NULL default '0000-00-00 00:00:00',
 returns_reason tinyint(5) unsigned default '0',
 PRIMARY KEY  (returns_id)
) TYPE=MyISAM;

 

 

And again AFTER these changes you MUST EDIT your returns.php - corrections are four postings above ... look for

 

1.) Open up catalog/admin/returns.php

and apply the following changes to returns.php.

 

@cathy - if you put this in the next version it should be save :)

 

 

Sebastian

Link to comment
Share on other sites

Ok... version 2.3 is now up on the block! Removed the ALTER statement from the notes and fixed the sql to read in both places:

 

returns_date_finished datetime NOT NULL default '0000-00-00 00:00:00',

date_finished datetime NOT NULL default '0000-00-00 00:00:00',

 

All the other admin/returns.php were corrected in previous versions and were double checked to make sure before this release.

 

I ran tests from start to finish on my clean oscommerce install and it now shows a date when the return is marked completed.

 

Thanks Sebastian, I added your name with mine to the contribution :D I don't want to take all the credit on the fixes from the original!

Link to comment
Share on other sites

Suggestions based off my install:

 

Move the defines in application_top_refund.php to filenames.php and database_tables.php for better MS 2.2 integretion (and keeping inline with other contributions)

 

In SQL, I added configuration ID values to the plus added the them to a configuration group, in my case I added it to 'Stock'.

 

INSERT INTO configuration VALUES ('222111', 'Default charge for restocking a non faulty item', 'DEFAULT_RESTOCK_VALUE', '12.5', 'This is the charge applied to refund to cover the return of non faulty items which are to be entered back INTO stock for resale', 9, NULL, '2003-03-01 15:22:17', '0001-01-01 00:00:00', NULL, NULL);
INSERT INTO configuration VALUES ('222112', 'Default Return Reason', 'DEFAULT_RETURN_REASON', '2', 'This is the default reason applied to all returns', 9, NULL, '2003-02-27 06:44:29', '0000-00-00 00:00:00', NULL, NULL);
INSERT INTO configuration VALUES ('222113', 'Default Retrun status (pending)', 'DEFAULT_RETURN_STATUS_ID', '1', 'Default return status assigned to all new returns', 9, NULL, '2003-02-28 07:10:04', '0000-00-00 00:00:00', NULL, NULL);
INSERT INTO configuration VALUES ('222114', 'Default refund method', 'DEFAULT_REFUND_METHOD', '1', 'Default method for refund payment', 9, NULL, '2003-03-01 16:46:12', '0000-00-00 00:00:00', NULL, NULL);

 

Otherwise, I was very happy to finally have this contrib. running after many failed installs. Thank you!

Link to comment
Share on other sites

Yep that will work. Will eliminate a few note steps and 2 files. Did a test and everything work the same as if they were there :D

 

As for the 2nd part with the SQL values, not sure what you are getting at. The values you added: 222111, 222112 etc......what do they represent? Is it something that needs changed in the SQL or something an individual would do on their own after installation.

 

Thanks! Once that is all clarified, I will wait a few days to see if anything else might pop-up before diving in for the next update.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...