Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

  • 0
Pedalman

In need of much longer order message than core allows

Question

I need to create 6500 chars long order message.

I tried to override ordermessage with an increased max allowed chars but I had to learn that I can only override functions and no definitions.

Can you help me here?

  */
    public static $definition = [
        'table'     => 'order_message',
        'primary'   => 'id_order_message',
        'multilang' => true,
        'fields'    => [
            'date_add' => ['type' => self::TYPE_DATE,                   'validate' => 'isDate'                                           ],
            'name'     => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128 ],
            'message'  => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isMessage',     'required' => true, 'size' => 6500],
        ],
    ];

 

Edited by Pedalman

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
16 minutes ago, Pedalman said:

I need to create 6500 chars long order message.

I tried to override ordermessage with an increased max allowed chars but I had to learn that I can only override functions and no definitions.

Can you help me here?

You can override $definition, but only as a whole, which is not ideal.

To do that, simply create file /override/classes/order/OrderMessage.php with this content:

<?php

class OrderMessage extends OrderMessageCore
{
    public static $definition = [
        'table'     => 'order_message',
        'primary'   => 'id_order_message',
        'multilang' => true,
        'fields'    => [
            'date_add' => ['type' => self::TYPE_DATE,                   'validate' => 'isDate'                                           ],
            'name'     => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128 ],
            'message'  => ['type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isMessage',     'required' => true, 'size' => 6500],
        ],
    ];
}

Don't forget to delete /cache/class_index.php afterwards.

In this case that's all you need to do. In general, you would also have to adjust database schema to match the object model definition. In future version of thirtybees, core updater will take care of this for you automagically. We are not there yet, unfortunately. 

  • Like 1

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

×
×
  • Create New...