marellocommerce / marello

Marello
Other
52 stars 18 forks source link

Add order to context action #40

Closed clicktrend closed 4 years ago

clicktrend commented 6 years ago

To add orders to context please extend entity config:

Line 51 in Order.php:

"grid"={
    "default"="order-grid",
    "context"="order-for-context-grid"
}

You also need to define the datagrids

    order-grid:
        source:
            type: orm
            query:
                select:
                    - o
                from:
                    - { table: MarelloOrderBundle:Order, alias: o }
                join:
                    left:
                        billingAddress:
                            join: o.billingAddress
                            alias: ba
                        shippingAddress:
                            join: o.shippingAddress
                            alias: sa
        columns:
            id:
                label:            marello.order.id.label
            orderNumber:
                label:            marello.order.order_number.label
                frontend_type:    string
            orderReference:
                label:            marello.order.order_reference.label
                frontend_type:    string
            grandTotal:
                label:            marello.order.grand_total.label
                type:             localized_number
                method:           formatCurrency
                context_resolver: Marello\Bundle\DataGridBundle\Grid\FormatterContextResolver::getResolverCurrencyClosure
                align:            right
        sorters:
            columns:
                orderNumber:
                    data_name: o.orderNumber
                orderReference:
                    data_name: o.orderReference
            default:
                orderNumber: "%oro_datagrid.extension.orm_sorter.class%::DIRECTION_DESC"
        filters:
            columns:
                orderNumber:
                    type: string
                    data_name: o.orderNumber
                orderReference:
                    type: string
                    data_name: o.orderReference
        properties:
            view_link:
                type:   url
                route:  marello_order_order_view
                params:
                    id: id
        actions:
            view:
                type:       navigate
                link:       view_link
                icon:       eye
                rowAction:  true
        action_configuration: [@marello_order.datagrid.action_permission_provider, "getActionPermissions"]

    order-for-context-grid:
        extends: order-grid
        options:
            entityHint: order
            entity_pagination: true
            toolbarOptions:
                pageSize:
                    default_per_page: 10
            routerEnabled: false

So emails can be connected to orders with the "Add context" button

24198 commented 6 years ago

Hi @clicktrend,

Thank you for the feedback. I think I don't quite understand what the situation and or issue is. As far as I can see, the Order as context can be added to emails when going to an Order when using the 'Send Email' button. In the popup, the Order is being used as context already.

Could you please specify what situation you're running into problems when trying to connect Orders to Emails or where the "Add context" button is?

Kind Regards,

Jaimy Casteleijn

clicktrend commented 6 years ago

Hi @24198 ,

please go to user-emails "email/user-emails" and view an e-mail. Try to add context. Only users can be assigned.