Jump to content

Solved: Override for PaymentModule.php forces an error


Rhapsody

Recommended Posts

Edit:  The solution for this problem is provided by bellini13 in post #2

 

I am able to modify /classes/PaymentModule.php so that additional customer fields are passed to emails sent.  It works fine if I insert the required code in the core.  I've tried to do this as an override under /override/classes/PaymentModule.php but get the error ...

Warning: include(/home/content/68/10690368/html/shop/cache/class_index.php) [function.include]: failed to open stream: No such file or directory in /home/content/68/10690368/html/shop/classes/Autoload.php on line 58

Warning: include() [function.include]: Failed opening '/home/content/68/10690368/html/shop/cache/class_index.php' for inclusion (include_path='.:/usr/local/php5_3/lib/php') in /home/content/68/10690368/html/shop/classes/Autoload.php on line 58

Fatal error: Class 'Tools' not found in /home/content/68/10690368/html/shop/config/config.inc.php on line 65

The code is inserted in the public function validateOrder so I assume all that is needed in the override file is:

<?php
abstract class PaymentModule extends PaymentModuleCore
{

    public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown',
        $message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
        $secure_key = false, Shop $shop = null)
    {
        $this->context->cart = new Cart($id_cart);

.... the entire function code with the modification is included here ending with...

            } // End foreach $order_detail_list
            // Use the last order as currentOrder
            $this->currentOrder = (int)$order->id;
            return true;
        }
        else
        {
            $error = Tools::displayError('Cart cannot be loaded or an order has already been placed using this cart');
            Logger::addLog($error, 4, '0000001', 'Cart', intval($this->context->cart->id));
            die($error);
        }
    }

}


Does anyone have ideas on what is needed to make this work as an override?  This is PS 1.5.6.1

Edited by Rhapsody (see edit history)
Link to comment
Share on other sites

hey there, long time, hope all is well.

 

Have you tried to delete the following file after you install the override?

/shop/cache/class_index.php

 

If not, install the override file, delete the class_index.php file, and then reload the home page and see if that helps.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...