Modifying Order Schema

Hi,

I'm fairly new to developing in CS Cart.

I'm trying to update the schema for the orders so that I can set a variable within a hook and possibly display data on the Invoice template.

I've been doing (a lot) of research and can get everything to work if I add my var in the OrderVariable.php file; but since this is a core file I don't want to do that.

I found some instructions about changing the schema here: https://docs.cs-cart.com/latest/developer_guide/core/documents/documents.html underneath the Variables section, but I just either can't get my head around it or just can't get it to work... :-)

So in the my_changes add-on I've created dirs schemas > documents > order.post.php.

In that file I have the following:

return array(
    'order' => array(
        'class' => 'Tygh/Template/Documen/Invoice/Variables/OrderVariable',
        'arguments' => array('#context', '#config', '@formatter'),
        'alias' => 'o',
        'attributes' => array(
            'order_id', 'company_id', 'issuer_id', 'user_id', 'tracking_number', 'shippings_method',
            'total', 'subtotal', 'discount', 'subtotal_discount', 'payment_surcharge',
            'display_subtotal', 'shipping_cost', 'timestamp', 'notes', 'details', 'company', 'payment_id',
            'tax_exempt', 'tax_name', 'tax_total', 'lang_code', 'ip_address', 'tax_exempt_text', 'tax_name', 'tax_total',
            'tax_subtotal', 'display_shipping_cost', 'secondary_currency', 'coupon_code', 'invoice_header', 'invoice_id_text', 'order_code',
            'products' => array(
                '[0..N]' => array(
                    'item_id', 'product_id', 'product_code', 'price', 'amount', 'product', 'product_status',
                    'discount', 'base_price', 'original_price', 'cart_id', 'tax_value', 'subtotal', 'display_subtotal'
                )
            ),
            'taxes' => array(
                '[0..N]' => array(
                    'rate_type', 'rate_value', 'price_includes_tax', 'regnumber', 'tax_subtotal', 'description'
                )
            ),
            'shipping' => array(
                '[0..N]' => array(
                    'shipping_id', 'shipping', 'delivery_time', 'rate_calculation', 'destination',
                    'min_weight', 'max_weight', 'service_code', 'module', 'rate', 'group_name'
                )
            ),
            'product_groups' => array(
                '[0..N]' => array(
                    'name', 'company_id',
                    'products' => array(
                        '[0..N]' => array(
                            'item_id', 'product_id', 'product_code', 'price', 'amount', 'product', 'product_status',
                            'discount', 'base_price', 'original_price', 'cart_id', 'tax_value', 'subtotal', 'display_subtotal'
                        )
                    ),
                    'package_info' => array(
                        'shipping_freight',
                        'origination' => array(
                            'name', 'address', 'city', 'country', 'state', 'zipcode', 'phone', 'fax'
                        )
                    ),
                    'free_shipping'
                )
            ),
            'status' => array(
                'description', 'type', 'status', 'status_id', 'params' => array(
                    'allow_return', 'repay', 'notify', 'inventory', 'color', 'appearance_type'
                )
            ),
            'raw' => array(
                'timestamp', 'notes', 'display_subtotal', 'discount', 'subtotal_discount', 'payment_surcharge',
                'display_shipping_cost', 'total'
            ),
        )
    )
);

Really, the only thing I am adding is the "order_code" attribute.

Can anyone point out what exactly I am doing wrong?? I thought it might be that I need a relative path in the "class" index but even modifying that to point directly at the file didn't fix it.

-Anthony