Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Remove function causing Fatal error


BarryTait

Recommended Posts

Why does the 11th line of code below cause a fatal error?

paypal_remove_order($order_id);

 

 

function tep_remove_order($order_id, $restock) {
    if ($restock == 'on') {
        $order_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
        while ($order = tep_db_fetch_array($order_query)) {
            tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " where products_id = '" . (int)$order['products_id'] . "'");
        }
    }

    //begin PayPal_Shopping_Cart_IPN 2.8 DMG
    include_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/functions/general.func.php');
    paypal_remove_order($order_id);
    //end PayPal_Shopping_Cart_IPN
    tep_db_query("delete from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
    tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
    tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "'");
    tep_db_query("delete from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order_id . "'");
    tep_db_query("delete from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "'");

    $status_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_GOOGLECHECKOUT_STATUS'");
    while ($status = tep_db_fetch_array($status_query)) {
        $status_flag = $status['configuration_value'];
    }
    if ($status_flag == 'True') {
        require_once('../includes/modules/payment/googlecheckout.php');
        $googlepayment = new googlecheckout();
        tep_db_query("delete from " . $googlepayment->table_order . " where orders_id = '" . (int)$order_id . "'");
    }
}
 

Link to comment
Share on other sites

I can see that but am baffled how a function could just disappear.  I did a search on "all files" and could not find it.

It worked fine until recently---makes me think hackers might want to stop me deleting user profiles but I can delete them but can't delete orders that are not paid. 

Perhaps it is something to do with Paypal.

I doubt if changinf tep to paypal would solve it do you?

Thanks,

Barry.

Link to comment
Share on other sites

@@BarryTait

 

First, if it were me, I would try changing the paypal_remove_order() to tep_remove_order(), and see what happens.

 

Second, this block of code:

    //begin PayPal_Shopping_Cart_IPN 2.8 DMG
    include_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/functions/general.func.php');
    paypal_remove_order($order_id);
    //end PayPal_Shopping_Cart_IPN

leads me to believe that an addon (perhaps the Paypal app) was added to your store. Can you confirm that the following file exists:

 

/catalog/includes/modules/payment/paypal/functions/general.func.php

 

If so, is there a paypal_remove_order() function defined within it?

 

HTH

 

Malcolm

Link to comment
Share on other sites

 

First, if it were me, I would try changing the paypal_remove_order() to tep_remove_order(), and see what happens.

 

I think that the first thing to happen is that you will have infinite recursion, as the paypal_remove_order() call appears to be within tep_remove_order()!

 

Much more likely, a PayPal add-on wasn't completely removed. The definition for paypal_remove_order() went away, but the call to it remained.

Link to comment
Share on other sites

Artclon

 

@@BarryTait

 

First, if it were me, I would try changing the paypal_remove_order() to tep_remove_order(), and see what happens.

 

Second, this block of code:

    //begin PayPal_Shopping_Cart_IPN 2.8 DMG
    include_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/functions/general.func.php');
    paypal_remove_order($order_id);
    //end PayPal_Shopping_Cart_IPN

leads me to believe that an addon (perhaps the Paypal app) was added to your store. Can you confirm that the following file exists:

 

/catalog/includes/modules/payment/paypal/functions/general.func.php

 

If so, is there a paypal_remove_order() function defined within it?

 

HTH

 

Malcolm

No Malcolm, I can't find any reference to the above general.func.php

 

This was the original notice:

Fatal error: Call to undefined function paypal_remove_order() in /home/harveycp/public_html/bkharveycp/includes/functions/general.php on line 1279

Link to comment
Share on other sites

@@BarryTait

 

What version of osCommerce is the site? Is this a brand new site, or are you trying to 'fix' an existing site? I see that you have a GoogleCheckout payment add-on installed, which leads me to believe that this is an existing site. Did you build this site, or did you inherit it?

 

As @@MrPhil said, it looks like the site had a Paypal add-on that was partially removed. If this is the case, you can *probably* remove all of this:

    //begin PayPal_Shopping_Cart_IPN 2.8 DMG
    include_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/functions/general.func.php');
    paypal_remove_order($order_id);
    //end PayPal_Shopping_Cart_IPN

Lastly, can you tell me what line 1297 in /catalog/includes/functions/general.php says? In all of the versions of osCommerce I have here, none of them have anything in that line that would relate to the problem you are having.

 

HTH

 

Malcolm

Link to comment
Share on other sites

Malcolm, this site is over ten years old.  We had it built back around 2004.  The osCommerce has been revised at least once.  Here is the header:

/*
 $Id: general.php,v 1.1.1.1 2004/03/04 23:39:53 ccwjr Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright © 2003 osCommerce

Chain Reaction Works, Inc
Copyright © 2005 - 2006 Chain Reaction Works, Inc.

Last Modified by $Author$
Last Modifed on : $Date$
Latest Revision : $Revision: 5504 $

Released under the GNU General Public License */

 

There were two warnings as well as the fatal error.  Here they are:

 

Warning: include_once(/home/harveycp/public_html//includes/modules/payment/paypal/functions/general.func.php): failed to open stream: No such file or directory in /home/harveycp/public_html/bkharveycp/includes/functions/general.php on line 1278

Warning: include_once(): Failed opening '/home/harveycp/public_html//includes/modules/payment/paypal/functions/general.func.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/harveycp/public_html/bkharveycp/includes/functions/general.php on line 1278

Fatal error: Call to undefined function paypal_remove_order() in /home/harveycp/public_html/bkharveycp/includes/functions/general.php on line 1279

 

Line 1279 is the call for: paypal_remove_order($order_id);

I think the idea that Paypal removed something and this is a left over is the most probable cause of this but I don't remember getting any notice.

I will try taking out the above four lines you suggested and will let you know the results.

Thanks again,

Barry.

Link to comment
Share on other sites

Thanks everyone.  Deleting these lines did the trick:

    //begin PayPal_Shopping_Cart_IPN 2.8 DMG
    include_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/functions/general.func.php');
    paypal_remove_order($order_id);
    //end PayPal_Shopping_Cart_IPN

Perhaps it was a left over by Paypal.

 

Burt, I don't understand your saying the site is not osCommerce.  My understanding is that it is but I will look into it.  Thanks, Barry.

Link to comment
Share on other sites

@@BarryTait

Thanks everyone.  Deleting these lines did the trick:

    //begin PayPal_Shopping_Cart_IPN 2.8 DMG
    include_once(DIR_FS_CATALOG_MODULES . 'payment/paypal/functions/general.func.php');
    paypal_remove_order($order_id);
    //end PayPal_Shopping_Cart_IPN

Perhaps it was a left over by Paypal.

 

Paypal didn't leave it there ... whoever maintained your store did it when they (not Paypal) removed the Paypal payment module.

 

 

Burt, I don't understand your saying the site is not osCommerce.  My understanding is that it is but I will look into it.  Thanks, Barry.

 

Since osCommerce is an open-source program, other people have taken the source code and spun off their own shopping carts. Once someone spins off their own version, osCommerce can not support that spin off, as we do not know what the other people have changed. CRELoaded is one such spin-off.

 

HTH

 

Malcolm

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...