Jump to content

Extending OrderCore problems. Class 'Order' not found...


contentengineer

Recommended Posts

We are experiencing some issues (we believe) with the class autoloader.

 

We have overridden the OrderCore class using the following definition:

<?php
/* ...
 * ...
*/

//Workaround
Order::$definition['fields']['customerref'] = array('type' => ObjectModel::TYPE_STRING,'validate' => 'isString', 'size' => 30);

class Order extends OrderCore
{
    public $customerref;

    public function __construct($id_order = null, $id_lang = null)
    {
        parent::__construct($id_order, $id_lang);
    }

}

After a period of time we then get the dreaded "white screen" in AdminOrders and front office screens. Looking at php_errors.log it is reporting:

[14-Oct-2014 15:12:35] PHP Fatal error:  Class 'Order' not found in /var/www/html/override/classes/order/Order.php on line 
[14-Oct-2014 15:12:41] PHP Fatal error:  Class 'Order' not found in /var/www/html/override/classes/order/Order.php on line 
[14-Oct-2014 15:12:57] PHP Fatal error:  Class 'Order' not found in /var/www/html/override/classes/order/Order.php on line


Can anybody shed any light?  Should there be an include_once to reference OrderCore.php?  Should we just be overriding  getFields() instead?

 

 

 

Link to comment
Share on other sites

It would appear to be complaining about this line:

Order::$definition['fields']['customerref] = array('type' => ObjectModel::TYPE_STRING,'validate' => 'isString', 'size' => 30);

I have seen alternative approaches such as:

class Order extends OrderCore
{
     public $customerref;
     public function getFields()
     {
         $fields = parent::getFields();
         $fields['customerref'] = pSQL($this->customerref);
         return $fields;
     }
}

But this doesn't include the validation...?

 

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