Jump to content

Prestashop problem with new field to class.


kunegundek
 Share

Recommended Posts

Hi, I am currently reworking Prestashop to suit my needs and ran into a problem - I wanted to add the ability to add values to the ps_orders table, the personal_collection field when placing an order, however after writing the checkout in /override/classes/order/Order.php, nothing totally changes. I even assigned the value 5 to this field at the start, so that it just added to the base, but nothing changes. The php code was obviously opened with a tag, the cache was cleared. :) I would also like to add that if I do not extend the OrderCore class, but simply overwrite it directly, everything works fine, however, I would not like to mess around with reworking clean Presta files for a future presta update. Any idea? Below is the code of the Order.php class I created. Presta version 1.7.8

 

class Order extends OrderCore
{
    public $personal_collection = 5;

     public function __construct($id = null, $id_lang = null)
    {
        parent::__construct($id, $id_lang);
        self::$definition['fields']['personal_collection'] = array('type' => self::TYPE_INT);

    }

    public static function generateReference()
  {
    $last_id = Db::getInstance()->getValue('
        SELECT MAX(id_order)
        FROM '._DB_PREFIX_.'orders');

    return str_pad((int)$last_id + 1, 9, '000000000', STR_PAD_LEFT);
  }
}

 

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More