In addition to the settings available in the CP Commerce > Settings
screen, the config items below can be placed into a commerce.php
file in your craft/config
directory:
Determines whether the customer's last used shipping and billing addresses should automatically be set on new carts.
Can be set to true
or false
(default is true
).
A php Date Interval
Default: 3 months. (P3M
).
How long the cookie storing the cart should last. The cart exists independently of the Craft users' session.
Allows for the overriding of the template used to perform POST redirects to the payment gateway.
The template path that this item points to must contain a form that submits itself to the actionUrl
variable, and outputs all hidden inputs with the inputs
variable. Below is an example template:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Redirecting...</title>
</head>
<body onload="document.forms[0].submit();">
<form action="{{ actionUrl|raw }}" method="post">
<p>Redirecting to payment page...</p>
<p>
{{ inputs|raw }}
<input type="submit" value="Continue" />
</p>
</form>
</body>
</html>
Since this template is simply used for redirecting, it only appears for a few seconds, so we suggest making it loads fast with minimal images and inlined styles to reduce http requests.
Allows for the overriding of Payment Method settings. You still need to configure the Payment Method in the control panel so you can reference the ID as the key to the Payment Method's settings. Example:
<?php
return [
// he * must be present to enable multi-environment configs, even if empty
'*' => array(
),
// DEV Details - i.e. your Paypal sandbox details for example
'dev.whatever.net' => array(
'paymentMethodSettings' => [
//eWay Sandbox
'1' => [
'testMode' => true,
'apiKey' => 'whatever',
'password' => 'whatever',
'CSEKey' => 'whatever',
],
// 4 - Paypal Express
'4' => [
'testMode' => true,
'password' => 'whatever',
'username' => 'whatever',
'signature' => 'whatever'
],
],
),
// PRODUCTION Details - live payment stuff here
'whatever.com' => array(
'paymentMethodSettings' => [
//eWay LIVE
'1' => [
'testMode' => false,
'apiKey' => 'whatever',
'password' => 'whatever',
'CSEKey' => 'whatever',
],
// 4 - Paypal Express
'4' => [
'testMode' => false,
'password' => 'whatever',
'username' => 'whatever',
'signature' => 'whatever'
],
],
),
];
Default: letter
The size of the paper to use for generated order PDF files (letter, legal, A4, etc.). A full list of paper size values can be found here.
Default: portrait
The orientation of the paper to use for generated order PDF files. Valid values are portrait
or landscape
.
Default: True
Should Commerce purge old inactive carts from the database. See the purgeInactiveCartsDuration
setting to control how old the cart needs to be.
A php Date Interval
Default: 3 months. (P3M
).
Inactive carts older than this interval from their last update will be purged (deleted).
{tip} The interval check for purging of inactive carts is only run when visiting the Order Index screen in the control panel.
Determines whether the billing address needs to exist on the cart in order to submit successfully to the commerce/payment/pay
action.
Can be set to true
or false
(default is false
).
Determines whether payment requests made to the commerce/payments/pay
controller action requires a shipping address to be present on an order before attempting payment.
Can be set to true
or false
(default is false
).
Determines whether payment requests made to the commerce/payments/pay
controller action requires a shipping method selection to be present on an order before attempting payment.
Can be set to true
or false
(default is false
).
Determines whether to use the billing address of the cart to calculate taxes. By default the shipping address is used for tax calculations.
Can be set to true
or false
(default is false
).