Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

RMA Returns error for 2.2 MS2


Guest

Recommended Posts

Installed 2.2 MS2

Installed Discount and Gift Voucher class

Just installed RMA Returns System v2.1

 

Searched BBS but no answer. :(

 

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

Link to comment
Share on other sites

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" :) .

 

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 ;) ), 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" :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.

Link to comment
Share on other sites

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:

 

Please help.

Link to comment
Share on other sites

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 # <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 # <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 :) After all, what is the point of this being open-source if we all don't help to make it better.

Link to comment
Share on other sites

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 :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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

<td class="main" valign="top">' . $order->products[$i]['name'] . '   ' . $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.

Link to comment
Share on other sites

I think I see the problem,

 

looking at the code you posted:

 

<td class="main" valign="top">' . $order->products[$i]['name'] . '   ' . $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'] . '   ' . $return_link  . '<br><small><i>' . $desc['products_description'] . '</i></small>';

 

Hope this helps.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

If you don't want customers to be able to click on the "Return this product" link to get to the return_product page and then easily go in the URL, change order_id=xxx to any number they want and bring up another customer's info, you need to add

  if (!isset($HTTP_GET_VARS['order_id']) || (isset($HTTP_GET_VARS['order_id']) && !is_numeric($HTTP_GET_VARS['order_id']))) {
   tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
 }
 
 $customer_info_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". (int)$HTTP_GET_VARS['order_id'] . "'");
 $customer_info = tep_db_fetch_array($customer_info_query);
 if ($customer_info['customers_id'] != $customer_id) {
   tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
 }  

 

after

   if (!tep_session_is_registered('customer_id')) {
    $navigation->set_snapshot();
    tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

 

in return_product.php. It may be required in other files as well if it was missed, but I haven't gotten that far in my "modding". Make this change ASAP if it hasn't been covered in this thread already...

Link to comment
Share on other sites

I'm trying to use Rma Returns 2.1 with milestone 2.2 and a Local Windows system with Easyphp 1.7.

This is a very good contribution, but i have those problems:

 

After the log-in i go to my account page and click on "return this product" than i compile the return module and i' m redirect to the login page.

 

When i click on "Track a return" there is the same problem.

 

Finally when i try to insert my track' s number in the search engine i have no results.

 

Rma is a very important contribution and i' d like to have it fully functional on my website, so please what can i do to resolve my problems?

 

Thank you for your pacience and compliments for your work.

Link to comment
Share on other sites

  • 2 weeks later...

My problem is when I click on the Customers-->Orders menu in Admin, I get a parse error for admin/orders.php on line 233.

 

Line 233 is

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

 

My php editing software color codes the text. Maroon is for text and variables. It seems like after 233, almost everything is being coded in maroon. Any ideas?

Link to comment
Share on other sites

Found a minor problem in the admin section.

 

The Total (ex) and Total (inc) seem to be multiplied by the quantity of the products returned.

 

For example:

Order total = $71.98 with a quantity of 2 of the same products being returned

So in the admin when processing the return is showing

Total (ex) = $143.96

Total (inc) = $143.96

 

I can't seem to locate the coding section in the jungle of code :unsure: that determines these numbers. Any help would be greatly appreciated!

 

Thanks,

Greg

I only do what my Rice Krispies tell me to do!

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...