Configuration

Customize your storefront

While we try and keep descriptive comments in the default documentation, below is a more thorough outline of what's available.

Most configuration resides in config/getcandy.php unless specified otherwise.

The hub may get it's own config file at some point.

hub_access

Define the user roles which should have access to the hub.

Expects: array

Example

'hub_access' => ['admin']

discounters

Define which indexers should be available in your store

Expects: array

Example

'discounters' => [
    'coupon' => GetCandy\Api\Core\Discounts\Criteria\Coupon::class,
    'customer-groups' => GetCandy\Api\Core\Discounts\Criteria\CustomerGroup::class,
    'products' => GetCandy\Api\Core\Discounts\Criteria\Products::class,
    'users' => GetCandy\Api\Core\Discounts\Criteria\Users::class,
],

orders

All configuration below should live within the orders array.

reference_callback

If you want to have your own custom order reference, you can define the logic here.

Expects: Closure

Example

'reference_callback' => function ($order) {
    return "MY-ORDER-REFERENCE-{$order->id}";
},

mailers

Here you can define mailers for the system, these will be send during various events

Expects: array

Example

'mailers' => [
    'payment-processing' => App\Mail\OrderConfirmation::class // Relates to statuses
]
Each key in the array relates to the order statuses defined in the config.

table_columns

Define the columns to be shown on the orders listing page in the Admin Hub.

Expects: array

Example

'table_columns' => [
    'name', 'reference', 'account_no', 'contact_email', 'account', 'order_total', 'delivery_total', 'date',
],

exports

Define multiple ways in which orders can be exported from the hub

Expects: array

Example

'exports' => [
    'csv' => [
        'label' => 'CSV',
        'format' => 'csv',
        'view' => 'exports.orders.csv'
    ],
],

What's happening?

So here you're defining the available ways to export orders, the view will be loaded with all the orders from the database or the ones currently selected in the Hub. The example view won't exist, you need to create that yourself

statuses

Set order statuses to be triggered within GetCandy's internal event system.

Expects: array

Example

'statuses' => [
    'pending' => 'payment-processing',
    'paid' => 'payment-received',
    'dispatched' => 'dispatched',
];

What's happening?

At various points in an orders lifetime it can be pending , paid or dispatched, here you're basically saying "when the order status is payment-processing it's a pending order and GetCandy will know how to handle the events. (think back to the mailers)

statuses.options

These are your custom order statuses, they can be whatever you want, just make sure that you map the appropriate statuses above.

Expects: array

Example

'options' => [
    'failed' => [
        'label' => 'Failed',
        'color' => '#e4002b',
        'favourite' => true, // This will show as a tab in the hub
    ],
    'payment-received' => [
        'label' => 'Payment Received',
        'color' => '#6a67ce',
    ],
    'awaiting-payment' => [
        'label' => 'Awaiting Payment',
        'color' => '#848a8c',
    ],
    'payment-processing' => [
        'label' => 'Payment Processing',
        'color' => '#b84592',
    ],
],

payments

Define which payment providers your store will offer

Expects: array

Example

'gateway' => 'braintree',
'environment' => env('PAYMENT_ENV'),
'providers' => [
    'offline' => GetCandy\Api\Core\Payments\Providers\Offline::class,
    'braintree' => GetCandy\Api\Core\Payments\Providers\Braintree::class,
    'sagepay' => GetCandy\Api\Core\Payments\Providers\SagePay::class,
],