Jump to content



Photo
* * * * - 2 votes

RMA Returns error for 2.2 MS2


  • Please log in to reply
660 replies to this topic

#1   Golden Boy

Golden Boy
  • Members
  • 33 posts
  • Real Name:Max Grabowski
  • Location:Lancaster, New York, USA

Posted 07 October 2003 - 00:00

Installed 2.2 MS2
Installed Discount and Gift Voucher class
Just installed RMA Returns System v2.1

Searched BBS but no answer. /sad.gif' class='bbc_emoticon' alt=':(' />

From Admin->Customer Returns->Returned Products I get this line to the right of the Header "Product Returns":

Fatal error: Call to undefined function: tep_array_merge() in c:\apache group\apache\htdocs\catalog\admin\returns.php on line 771

Line 771 of returns.php reads as:

<?php echo HEADING_TITLE_STATUS . ' ' . tep_draw_pull_down_menu('status', tep_array_merge(array(array('id' => '', 'text' => 'All returns')), $orders_statuses), '', 'onChange="this.form.submit();"'); ?>

Where is tep_array_merge() supposed to be? I checked "refund_functions.php", but there was no such function.

However, in admin/includes/functions/compatibility.php I found:


if (!function_exists('array_merge')) {
   function array_merge($array1, $array2, $array3 = '') {
      if ($array3 == '') $array3 = array();

      while (list($key, $val) = each($array1)) $array_merged[$key] = $val;
      while (list($key, $val) = each($array2)) $array_merged[$key] = $val;

      if (sizeof($array3) > 0) while (list($key, $val) = each($array3)) $array_merged[$key] = $val;

      return (array)$array_merged;
    }
}


Is this not being called? Is this supposed to be called?

So far this is the only error I have with the RMA module. Please help /smile.gif' class='bbc_emoticon' alt=':)' />
PHP may one day be destined to save the world!  Then again, maybe not.

#2   puddled

puddled
  • Members
  • 113 posts
  • Real Name:David Howarth
  • Location:UK

Posted 07 October 2003 - 08:10

On line 771 of returns.php, change the tep_array_merge to array_merge, and htat should sort the problem
Instant idiot......Just add mud !!

#3   Golden Boy

Golden Boy
  • Members
  • 33 posts
  • Real Name:Max Grabowski
  • Location:Lancaster, New York, USA

Posted 07 October 2003 - 23:06

/biggrin.gif' class='bbc_emoticon' alt=':D' /> Works like a charm now!!!! Whoohoo! Thanks a bunch!
PHP may one day be destined to save the world!  Then again, maybe not.

#4   Golden Boy

Golden Boy
  • Members
  • 33 posts
  • Real Name:Max Grabowski
  • Location:Lancaster, New York, USA

Posted 08 October 2003 - 19:20

Below is a quote from a message I recieved from Qwiz. I have put this up so that all may benefit.

Good evening, I hate to bother you my fellow osc user, but I wanted to ask u a question if i might. Did I understand u to post that u have ms2 and installed the RMA Returns System v2.1 and only made the one change listed on the forums to get it to work?

Thanks for any other info you offer.

Regards,
Tom


100% correct! Warning, I am long-winded, read below at your own risk!

The thing is, I installed MySQL, PHP 4.2 and Apache 1.x (2.2 is buggy) on my Win2k box at home. The install I am referring to is on my local machine, not a webhost. I don't know if this would make a difference, but I don't think so. I wanted to test before uploading (conserves bandwith).

Since the documentation on osCommerce is so poor, it is hard to find where stuff goes. To install modules I print out the instructions, then put checks on the sheet of paper as I go along. This ensures that I am doing everything listed. I'm just meticulous. In the case of the RMA system, the instructions are almost exact. Here is a little explanation (I'm at work now, so I can't remember all the specifics):

The RMA system "white pages" (instruction sheet) calls for new files to be added and original files to be EDITED. Whenever I see the word "edit" I see "better do a backup" /smile.gif' class='bbc_emoticon' alt=':)' /> .

NOTE: The download page states that RMA has "integration for the Credit Class GV sytem for making refunds". I took this to mean, "install that first". I followed my "print and check" method for that also.

After a successful install of the Credit Class (that is a whole different story), I started line by line on the instructions. The important point I need to stress is that I go file by file. I don't select a bunch and copy and paste in groups. Also, when I edit, I don't delete, I comment out the code. I label the new stuff with "// RMA addition"(or whatever module I install). This way it is easy to go back and make changes during testing.

Important: when editing one of the files in the RMA install list (after the Credit Class install) there was a discrepency (can't remember which file). In this particular case, there was a file in the RMA download file that could be taken as "copy me over the old file". But, when you look at that file and the original, there is about 20(?) lines of code difference. Actually, after you install the Credit Class, none of the line numbers in the RMA install guide even come close (ex: "look for around line 764" should be "look for around line 810"). Back to the wierd file: I took the new code that wasn't in the old file, and pasted (and commented) that in.

Just a thought, since some people are having problems and others are not, maybe a big difference is that some have the Credit Class installed, and others don't? Version 2.1 of the RMA system may actually be DEPENDANT on that class. If so, that should be added to the "white pages".

The devil is in the details. After I installed the RMA system, I went into the Admin panel to look at the changes. At the bottom left there was the new "Returns" section. I forget the number of links (I'm at work right now /wink.gif' class='bbc_emoticon' alt=';)' /> ), but the last link was the only page that gave me an error (Return Products, or something like that). At first I got an error similar to the one in my post, except it had no page and said "line 0". I went into the code looking for the tep_merge_array() call in returns.php. The key for me was that I knew there is a PHP function called merge_array(), but this had the "tep_" stuck to the front. After an hour going throught the code (better documentation would help a lot, even in the code itself!), I found a file that had a function for "merge_array()" (couldn't find the "tep_" one).

To get the 771 line error, I removed the "tep_", saved, then refreshed. Got the same "line 0" error, so I put the "tep_" back in. Only this time when I refreshed I got the "line 771" error. Seeing as I already did the remove of the "tep_", I wasn't sure if doing it again would couse another error. My motto "one error at a time". This is how I found out what question to ask. At that point, it became either a simple change, or a missing function (that was the only consistency between the 2 errors).

Disclaimer: I am no longer receiving errors when surfing the catalog, or admin area. However, I have not done a test of an actual return. Something could break there. But again, "One error at a time" /biggrin.gif' class='bbc_emoticon' alt=':D' />

BTW: How does a customer initiate a return? My assumption was that you need to do a test purchase, then from the account manager a person would fill in a form. I was going to do this tonight. Any info on that?

Hope this helps. Any more questions don't hesitate to message me.
PHP may one day be destined to save the world!  Then again, maybe not.

#5   Golden Boy

Golden Boy
  • Members
  • 33 posts
  • Real Name:Max Grabowski
  • Location:Lancaster, New York, USA

Posted 09 October 2003 - 00:47

OK. I got another problem. I went into "My Account" and viewed the order details. I got the RMA number, cool. However, when I either do a search for that RMA number in the search field, or by clicking the number in the order details, I get redirected to the Account Manager Login! So what's the dilio yo? /huh.gif' class='bbc_emoticon' alt=':huh:' />

Please help.
PHP may one day be destined to save the world!  Then again, maybe not.

#6   Golden Boy

Golden Boy
  • Members
  • 33 posts
  • Real Name:Max Grabowski
  • Location:Lancaster, New York, USA

Posted 13 October 2003 - 04:38

OK, found out the answer on my own.

It seems that the problem was with the hyperlink that is generated in "account_history_info.php" for the RMA number. On line 142 of the that file is the following that you are supposed to have entered via the RMA instructions.

$return_link = '<font color=blue><b>Return #&nbsp;<a href="returns_track.php?action=returns_show&rma=' . $rma_result['rma_value'] . '">' . $rma_result['rma_value'] . '</a>';

This does not use the tep_href_link function utilized all over by osCommerce. I changed the line to this:

$return_link = '<font color=blue><b>Return #&nbsp;<a href="' . tep_href_link('returns_track.php', 'action=returns_show&rma=' . $rma_result['rma_value'], 'SSL') . '">' . $rma_result['rma_value'] . '</a>';

and thus life is good again! The page shows up correctly. Also, there are some mispelled words on that page, so better changes them in "/catalog/includes/languge/english/return_products.php".

I guess that there are not too many people who are either able or willing to help with this particular module. So, I leave it open to ask here for help, and I will take a look at your problem /smile.gif' class='bbc_emoticon' alt=':)' /> After all, what is the point of this being open-source if we all don't help to make it better.
PHP may one day be destined to save the world!  Then again, maybe not.

#7   MarvinBesz

MarvinBesz
  • Members
  • 6 posts
  • Real Name:Marvin

Posted 14 October 2003 - 13:48

Guys, great contribution!

I've installed the contr. twice and after the installation the file: Checkout_shipping.php won't load. I'am using version 2.2 of Oscm.

Any suggestions?

Marvin

#8   Golden Boy

Golden Boy
  • Members
  • 33 posts
  • Real Name:Max Grabowski
  • Location:Lancaster, New York, USA

Posted 14 October 2003 - 17:05

Hi Marvin,

Before attacking the issue I need to know a couple of things:

1. Did you backup your files before installing RMA?
2. Why did you intall RMA twice?
3. Did you install GV & Discount Class?
4. What do you mean by "Checkout_shipping.php won't load"?

With regards to that last question, what are you seeing? Is there a php error? Is it a blank html page? Is the browser infinitely waiting to load? A little more details please /biggrin.gif' class='bbc_emoticon' alt=':D' />

I will need to look at the white pages to see how "checkout_shipping.php" is altered. Often in php if you forget a ";" or "}" the whole page craps out. But, it also should give an error. If it is an HTML typo and you are viewing it with Netscape 4x (don't know why anybody uses that anymore), the page display breaks.

Like I said, need a little more info.
PHP may one day be destined to save the world!  Then again, maybe not.

#9   ldb

ldb
  • Members
  • 11 posts
  • Real Name:Lisa

Posted 15 October 2003 - 00:26

I have a similer problem. I can log on and go to "My Account" then click on the order but the page comes back blank. I replaced the modified catalog/account_history_info.php and the includes/classes/order.php with the originals and the order page will display. As long as either of these modified files are in place the order history page returns blank. I have more than tripple checked the files for accuracy but see nothing wrong. I get no errors, just a blank page. I am using MS2. I did notice that the instructions call to add code after the following line

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

but the file I have does not contain this exactly but rather has

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

Anyone knowing what I need to do in MS2 to get it working please help.

The admin seems to work fine with the exception of the following after the lists of reasons, methods and other pages.

TEXT_DISPLAY_NUMBER_OF_TICKET_STATUS

#10   ldb

ldb
  • Members
  • 11 posts
  • Real Name:Lisa

Posted 15 October 2003 - 13:56

Since my last post I have been able to isolate my problem to the following:

<td class="main" valign="top">' . $order->products[$i]['name'] . '&nbsp;&nbsp;&nbsp;' . $return_link. .'<br><small><i>' . $desc['products_description'] . '</i></small>';

As long as this part of the mod is in account_history_info the page will be blank, if I revert it back to its original code:

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

the page displays correctly(without the RMA part) even with all the other mods made, any ideas?

As for the problem I had with order.php, I had some misplaced items there, its fixed now.

#11   Golden Boy

Golden Boy
  • Members
  • 33 posts
  • Real Name:Max Grabowski
  • Location:Lancaster, New York, USA

Posted 15 October 2003 - 14:07

I think I see the problem,

looking at the code you posted:

<td class="main" valign="top">' . $order->products[$i]['name'] . '&nbsp;&nbsp;&nbsp;' . $return_link. .'<br><small><i>' . $desc['products_description'] . '</i></small>';

There are 2 "." after "$return_link". Take one out. The "." in php is for concantinating strings and/or variables to other strings and/or variables. Adding a double usually breaks php (wierd that you didn't get an error of some type)

The corrected line should look like this:

<td class="main" valign="top">' . $order->products[$i]['name'] . '&nbsp;&nbsp;&nbsp;' . $return_link  . '<br><small><i>' . $desc['products_description'] . '</i></small>';

Hope this helps.
PHP may one day be destined to save the world!  Then again, maybe not.

#12   ldb

ldb
  • Members
  • 11 posts
  • Real Name:Lisa

Posted 15 October 2003 - 15:11

That took care of the problem, everything works great now. Thanks for your help

#13   ldb

ldb
  • Members
  • 11 posts
  • Real Name:Lisa

Posted 16 October 2003 - 20:37

I have discoverd another problem. After the return has been processed if a customer attempts to view the order the return was made on he will get the following error instead of the order details. (the order pages appears correctly, just the products portion has the below error instead of the products ordered.

1146 - Table 'store.TABLE_RETURNS_PRODUCTS_DATA' doesn't exist

I have chekced the database and the info is there, the return id and all other fields. Any ideas on this one?

#14   MarvinBesz

MarvinBesz
  • Members
  • 6 posts
  • Real Name:Marvin

Posted 18 October 2003 - 13:22

Ok, after installation I get the following error's in checkout_shipping.php

Parse error: parse error in /home/marvin/www/catalog/includes/classes/order.php on line 112

Fatal error: Cannot instantiate non-existent class: order in /home/marvin/www/catalog/checkout_shipping.php on line 43


Line 112 in order.php:
'final_price' => $orders_products['final_price']),

Line 42/43 in checkout_shipping.php:
require(DIR_WS_CLASSES . 'order.php');
$order = new order;

Any ideas?

Best regards, Marvin

#15   MarvinBesz

MarvinBesz
  • Members
  • 6 posts
  • Real Name:Marvin

Posted 18 October 2003 - 15:06

Ok, got it working, there were some problems with other add-ons. My fault!

Thnx for the reply guys!

#16   martinmacca

martinmacca
  • Members
  • 107 posts
  • Real Name:martin

Posted 18 October 2003 - 18:12

Ive also got a problem when trying to access the shopping cart, i get the same error:

Parse error: parse error in /home/custom-p/public_html/includes/classes/order.php on line 112

Fatal error: Cannot instantiate non-existent class: order in /home/custom-p/public_html/checkout_shipping.php on line 43


on line 112 in order.php ive got
'id' => $orders_products['products_id'],

on line 42/43 in checkout_chipping.php ive got
 require(DIR_WS_CLASSES . 'order.php');
  $order = new order;

Also if a customer trys to view previous orders another error occurs :

Parse error: parse error in /home/custom-p/public_html/includes/classes/order.php on line 112

Fatal error: Cannot instantiate non-existent class: order in /home/custom-p/public_html/account_history_info.php on line 37


in account_history_info.php on line 36/37 ive got:
 require(DIR_WS_CLASSES . 'order.php');
  $order = new order($HTTP_GET_VARS['order_id']);

Have i also got a conflict with another mod ?

#17   MarvinBesz

MarvinBesz
  • Members
  • 6 posts
  • Real Name:Marvin

Posted 18 October 2003 - 18:19

The manual states:

about five lines further down look for

'final_price' => $orders_products['final_price'],

and on the next line down, immediately after it add the following

'id' => $orders_products['products_id'],
'return' => $orders_products['products_returned'],
'exchange' => $orders_products['products_exchanged'],
'exchange_id' => $orders_products['products_exchanged_id'],

But put that code inbetween instead of beneath, just like:

'id' => $orders_products['products_id'],
'return' => $orders_products['products_returned'],
'exchange' => $orders_products['products_exchanged'],
'exchange_id' => $orders_products['products_exchanged_id'],[/
'final_price' => $orders_products['final_price'];

Then it works great!!

#18   Golden Boy

Golden Boy
  • Members
  • 33 posts
  • Real Name:Max Grabowski
  • Location:Lancaster, New York, USA

Posted 24 October 2003 - 03:44

I got a major problem.

When a customer submits a return, they are redirected to the account login page. It is almost as if the osCid is lost, because I notice that number changes. If I log back into the account manager (without clicking any other links), then I see the RMA number in big bright blue lettersd as it should be. Anyway to keep from logging ou?

Thanks to anyone who helps.
PHP may one day be destined to save the world!  Then again, maybe not.

#19   custom-pcsystems

custom-pcsystems
  • Members
  • 21 posts
  • Real Name:martin

Posted 26 October 2003 - 13:12

The manual states:

about five lines further down look for

'final_price' => $orders_products['final_price'],

and on the next line down, immediately after it add the following

'id' => $orders_products['products_id'],
'return' => $orders_products['products_returned'],
'exchange' => $orders_products['products_exchanged'],
'exchange_id' => $orders_products['products_exchanged_id'],

But put that code inbetween instead of beneath, just like:

'id' => $orders_products['products_id'],
'return' => $orders_products['products_returned'],
'exchange' => $orders_products['products_exchanged'],
'exchange_id' => $orders_products['products_exchanged_id'],[/
'final_price' => $orders_products['final_price'];

Then it works great!!

Thanks marvin - that worked perfectly /smile.gif' class='bbc_emoticon' alt=':)' />

#20   Golden Boy

Golden Boy
  • Members
  • 33 posts
  • Real Name:Max Grabowski
  • Location:Lancaster, New York, USA

Posted 26 October 2003 - 19:52

Thanks for the info, but I still get looged out with that change. My code looks like this at that part:

$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_returned, products_exchanged, products_exchanged_id, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($order_id) . "'");
 	 while ($orders_products = tep_db_fetch_array($orders_products_query)) {
        $this->products[$index] = array('qty'   => $orders_products['products_quantity'],
                                       'id'    => $orders_products['products_id'],
                                        'name'  => $orders_products['products_name'],
                                        'model' => $orders_products['products_model'],
                                        'tax'   => $orders_products['products_tax'],
                                        'price' => $orders_products['products_price'],
                    // added for RMA
                                        'return'   => $orders_products['products_returned'],
                                        'exchange' => $orders_products['products_exchanged'],
                                        'exchange_id' => $orders_products['products_exchanged_id'],
                                        'final_price' => $orders_products['final_price']);

It seems that the osCid is lost, so the script sends me to the login page. I don't know why the osCid is lost, but I am sure that is it.

I fixed the problem in returns_track.php with the following:

on around line 138 I changed

 $returns  = '<form action="' . $PHP_SELF . '?action=returns_show" method=post>';

to this

 $returns  = tep_draw_form('rma_find', tep_href_link(BOX_RMA_SEARCH_RESULTS, '', 'NONSSL', false), 'get');
 $returns .= tep_hide_session_id();

and at around line 31 I changed

 tep_redirect(tep_href_link('returns_track.php?error=yes'));

to this

 tep_redirect(tep_href_link('returns_track.php', '', 'SSL').'&error=yes');

Then it started working fine. Any idea if there is a similar fix for the return_product.php page? I have strained my eyes for 10 days and no results.
PHP may one day be destined to save the world!  Then again, maybe not.