Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
855ab21
Update general settings to use new forms
nfourtythree Aug 25, 2026
a68867a
Create extendable settings controller and tidy up general and transfe…
nfourtythree Aug 25, 2026
6379de1
ensure settings controllers extend the base one
nfourtythree Aug 25, 2026
fc8d7a2
Base naming convention
nfourtythree Aug 25, 2026
9045107
Move transfer fields to form components
nfourtythree Aug 25, 2026
397ef3e
Merge branch '6.x' into feature/6.x-templating
nfourtythree Aug 26, 2026
beef299
WIP product types settings controller
nfourtythree Sep 1, 2026
354f90a
Merge branch '6.x' into feature/6.x-templating
nfourtythree Sep 1, 2026
2eccb18
WIP stores settings index action
nfourtythree Sep 1, 2026
b001566
WIP edit store
nfourtythree Sep 1, 2026
9f11785
fixed importing correct classes
nfourtythree Sep 2, 2026
baa782e
Use html columns where required
nfourtythree Sep 2, 2026
4e881d5
Fixed fallbacks
nfourtythree Sep 2, 2026
6fd0d70
Merge branch '6.x' into feature/6.x-templating
nfourtythree Sep 9, 2026
7100b54
Site/stores association using form components
nfourtythree Sep 9, 2026
7b0b51e
Order field layout designer converted
nfourtythree Sep 9, 2026
ad69576
fix cs
nfourtythree Sep 10, 2026
1a8778e
Small PHPStan fix
nfourtythree Sep 10, 2026
f4eb858
Merge branch '6.x' into feature/6.x-templating
nfourtythree Sep 10, 2026
dc0d47d
Tweak plugin get instance after merge
nfourtythree Sep 10, 2026
5d385ff
Create store management namespace
nfourtythree Sep 11, 2026
9d1e927
Fix condition builder errors
nfourtythree Sep 11, 2026
16ce190
Fix order status cp edit URL
nfourtythree Sep 11, 2026
cb5cd5e
Convert order status controller to form components
nfourtythree Sep 11, 2026
18051fb
Fix action button to be dropdown
nfourtythree Sep 11, 2026
31f3ce0
fix cs
nfourtythree Sep 11, 2026
f7056fe
Convert line item statuses controller
nfourtythree Sep 14, 2026
e7bbfc1
Convert pdfs controller
nfourtythree Sep 14, 2026
b09cceb
Convert emails controller
nfourtythree Sep 14, 2026
ba2e0e4
Convert gateways controller to form components
nfourtythree Sep 14, 2026
536c87e
Tidy up crumbs
nfourtythree Sep 15, 2026
cfe92d1
Move controller into store management
nfourtythree Sep 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions routes/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,36 @@
use CraftCms\Commerce\Http\Controllers\CartController;
use CraftCms\Commerce\Http\Controllers\DonationsController;
use CraftCms\Commerce\Http\Controllers\OrdersController;
use CraftCms\Commerce\Http\Controllers\Settings\CatalogPricingController;
use CraftCms\Commerce\Http\Controllers\Settings\CatalogPricingRulesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\CatalogPricingController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\CatalogPricingRulesController;
use CraftCms\Commerce\Http\Controllers\DownloadsController;
use CraftCms\Commerce\Http\Controllers\EmailPreviewController;
use CraftCms\Commerce\Http\Controllers\Settings\DiscountsController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\DiscountsController;
use CraftCms\Commerce\Http\Controllers\Settings\EmailsController;
use CraftCms\Commerce\Http\Controllers\FormulasController;
use CraftCms\Commerce\Http\Controllers\Settings\GatewaysController;
use CraftCms\Commerce\Http\Controllers\Settings\GeneralSettingsController;
use CraftCms\Commerce\Http\Controllers\InventoryController;
use CraftCms\Commerce\Http\Controllers\InventoryLocationsController;
use CraftCms\Commerce\Http\Controllers\Settings\LineItemStatusesController;
use CraftCms\Commerce\Http\Controllers\Settings\OrderSettingsController;
use CraftCms\Commerce\Http\Controllers\Settings\OrderStatusesController;
use CraftCms\Commerce\Http\Controllers\Settings\PaymentCurrenciesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\PaymentCurrenciesController;
use CraftCms\Commerce\Http\Controllers\PaymentSourcesController;
use CraftCms\Commerce\Http\Controllers\PaymentsController;
use CraftCms\Commerce\Http\Controllers\Settings\PdfsController;
use CraftCms\Commerce\Http\Controllers\Settings\ProductTypesController;
use CraftCms\Commerce\Http\Controllers\Settings\SalesController;
use CraftCms\Commerce\Http\Controllers\Settings\SettingsController;
use CraftCms\Commerce\Http\Controllers\Settings\ShippingCategoriesController;
use CraftCms\Commerce\Http\Controllers\Settings\ShippingMethodsController;
use CraftCms\Commerce\Http\Controllers\Settings\ShippingRulesController;
use CraftCms\Commerce\Http\Controllers\Settings\ShippingZonesController;
use CraftCms\Commerce\Http\Controllers\Settings\StoreManagementController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\SalesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\ShippingCategoriesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\ShippingMethodsController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\ShippingRulesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\ShippingZonesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\StoreManagementController;
use CraftCms\Commerce\Http\Controllers\Settings\StoresController;
use CraftCms\Commerce\Http\Controllers\Settings\TaxCategoriesController;
use CraftCms\Commerce\Http\Controllers\Settings\TaxRatesController;
use CraftCms\Commerce\Http\Controllers\Settings\TaxZonesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\TaxCategoriesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\TaxRatesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\TaxZonesController;
use CraftCms\Commerce\Http\Controllers\Settings\TransferSettingsController;
use CraftCms\Commerce\Http\Controllers\TransfersController;
use CraftCms\Commerce\Http\Controllers\UserOrdersController;
use CraftCms\Commerce\Http\Controllers\WebhooksController;
Expand Down Expand Up @@ -81,8 +82,8 @@
Route::post('gateways/archive', [GatewaysController::class, 'archive']);
Route::post('gateways/reorder', [GatewaysController::class, 'reorder']);

Route::post('settings/save-settings', [SettingsController::class, 'saveSettings']);
Route::post('settings/save-transfer-settings', [SettingsController::class, 'saveTransferSettings']);
Route::post('settings/save-settings', [GeneralSettingsController::class, 'saveSettings']);
Route::post('settings/save-transfer-settings', [TransferSettingsController::class, 'saveTransferSettings']);
Route::post('order-settings/save', [OrderSettingsController::class, 'save']);

Route::post('stores/save-store', [StoresController::class, 'saveStore']);
Expand Down
36 changes: 20 additions & 16 deletions routes/cp.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,33 @@
use CraftCms\Cms\Http\Controllers\Elements\EditElementController;
use CraftCms\Cms\Http\Middleware\RequireAdmin;
use CraftCms\Commerce\Http\Controllers\DonationsController;
use CraftCms\Commerce\Http\Controllers\Settings\CatalogPricingController;
use CraftCms\Commerce\Http\Controllers\Settings\CatalogPricingRulesController;
use CraftCms\Commerce\Http\Controllers\Settings\DiscountsController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\CatalogPricingController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\CatalogPricingRulesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\DiscountsController;
use CraftCms\Commerce\Http\Controllers\Settings\EmailsController;
use CraftCms\Commerce\Http\Controllers\Settings\GatewaysController;
use CraftCms\Commerce\Http\Controllers\InventoryController;
use CraftCms\Commerce\Http\Controllers\InventoryLocationsController;
use CraftCms\Commerce\Http\Controllers\OrdersController;
use CraftCms\Commerce\Http\Controllers\Settings\GeneralSettingsController;
use CraftCms\Commerce\Http\Controllers\Settings\LineItemStatusesController;
use CraftCms\Commerce\Http\Controllers\Settings\OrderSettingsController;
use CraftCms\Commerce\Http\Controllers\Settings\OrderStatusesController;
use CraftCms\Commerce\Http\Controllers\Settings\PaymentCurrenciesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\PaymentCurrenciesController;
use CraftCms\Commerce\Http\Controllers\Settings\PdfsController;
use CraftCms\Commerce\Http\Controllers\ProductsController;
use CraftCms\Commerce\Http\Controllers\Settings\ProductTypesController;
use CraftCms\Commerce\Http\Controllers\Settings\SalesController;
use CraftCms\Commerce\Http\Controllers\Settings\SettingsController;
use CraftCms\Commerce\Http\Controllers\Settings\ShippingCategoriesController;
use CraftCms\Commerce\Http\Controllers\Settings\ShippingMethodsController;
use CraftCms\Commerce\Http\Controllers\Settings\ShippingRulesController;
use CraftCms\Commerce\Http\Controllers\Settings\ShippingZonesController;
use CraftCms\Commerce\Http\Controllers\Settings\StoreManagementController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\SalesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\ShippingCategoriesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\ShippingMethodsController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\ShippingRulesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\ShippingZonesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\StoreManagementController;
use CraftCms\Commerce\Http\Controllers\Settings\StoresController;
use CraftCms\Commerce\Http\Controllers\Settings\TaxCategoriesController;
use CraftCms\Commerce\Http\Controllers\Settings\TaxRatesController;
use CraftCms\Commerce\Http\Controllers\Settings\TaxZonesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\TaxCategoriesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\TaxRatesController;
use CraftCms\Commerce\Http\Controllers\StoreManagement\TaxZonesController;
use CraftCms\Commerce\Http\Controllers\Settings\TransferSettingsController;
use CraftCms\Commerce\Http\Controllers\TransfersController;
use CraftCms\Commerce\Http\Controllers\Users\UsersController;
use CraftCms\Commerce\Http\Controllers\VariantsController;
Expand All @@ -41,11 +42,12 @@
Route::middleware(RequireAdmin::class)->group(function () {
Route::get('commerce/settings/gateways', [GatewaysController::class, 'index']);
Route::get('commerce/settings/gateways/new', [GatewaysController::class, 'edit']);
Route::post('commerce/settings/gateways/render-form', [GatewaysController::class, 'renderForm']);
Route::get('commerce/settings/gateways/{id}', [GatewaysController::class, 'edit'])->whereNumber('id');

Route::get('commerce/settings/general', [SettingsController::class, 'edit']);
Route::get('commerce/settings/general', [GeneralSettingsController::class, 'edit']);
Route::get('commerce/settings/ordersettings', [OrderSettingsController::class, 'edit']);
Route::get('commerce/settings/transfers', [SettingsController::class, 'editTransferSettings']);
Route::get('commerce/settings/transfers', [TransferSettingsController::class, 'editTransferSettings']);

Route::get('commerce/settings/stores', [StoresController::class, 'storesIndex']);
Route::get('commerce/settings/stores/new', [StoresController::class, 'editStore']);
Expand All @@ -62,10 +64,12 @@

Route::get('commerce/settings/producttypes', [ProductTypesController::class, 'productTypeIndex']);
Route::get('commerce/settings/producttypes/new', [ProductTypesController::class, 'editProductType']);
Route::post('commerce/settings/producttypes/render-form', [ProductTypesController::class, 'renderForm']);
Route::get('commerce/settings/producttypes/{productTypeId}', [ProductTypesController::class, 'editProductType'])->whereNumber('productTypeId');

Route::get('commerce/settings/emails', [EmailsController::class, 'index']);
Route::get('commerce/settings/emails/{storeHandle}/new', [EmailsController::class, 'edit']);
Route::post('commerce/settings/emails/render-form', [EmailsController::class, 'renderForm']);
Route::get('commerce/settings/emails/{storeHandle}/{id}', [EmailsController::class, 'edit'])->whereNumber('id');

Route::get('commerce/settings/pdfs', [PdfsController::class, 'index']);
Expand Down
18 changes: 3 additions & 15 deletions src-yii2/templates/settings/gateways/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -109,35 +109,23 @@
}) }}

<hr>
{% set orderConditionInput %}
{{ gateway.getOrderCondition().getBuilderHtml(readOnly)|raw }}
{% endset %}

{{ forms.field({
label: 'Match Order'|t('commerce'),
instructions: 'Create rules that allow this gateway to match the order.'|t('commerce'),
errors: gateway.getErrors('orderCondition'),
}, orderConditionInput) }}

{% set billingAddressConditionInput %}
{{ gateway.getBillingAddressCondition().getBuilderHtml(readOnly)|raw }}
{% endset %}
}, orderConditionHtml) }}

{{ forms.field({
label: 'Match Billing Address'|t('commerce'),
instructions: 'Create rules that allow this gateway to match the billing address.'|t('commerce'),
errors: gateway.getErrors('billingAddressCondition'),
}, billingAddressConditionInput) }}

{% set shippingAddressConditionInput %}
{{ gateway.getShippingAddressCondition().getBuilderHtml(readOnly)|raw }}
{% endset %}
}, billingAddressConditionHtml) }}

{{ forms.field({
label: 'Match Shipping Address'|t('commerce'),
instructions: 'Create rules that allow this gateway to match the shipping address.'|t('commerce'),
errors: gateway.getErrors('shippingAddressCondition'),
}, shippingAddressConditionInput) }}
}, shippingAddressConditionHtml) }}

{% endblock %}

Expand Down
24 changes: 4 additions & 20 deletions src-yii2/templates/store-management/discounts/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -236,45 +236,29 @@

<div id="conditions" class="hidden flex-fields">

{% set orderConditionInput %}
{{ discount.orderCondition.getBuilderHtml()|raw }}
{% endset %}

{{ forms.field({
label: 'Match Order'|t('commerce'),
instructions: 'Create rules that allow this discount to match the order.'|t('commerce'),
errors: discount.getErrors('orderCondition')
}, orderConditionInput) }}

{% set customerConditionInput %}
{{ discount.customerCondition.getBuilderHtml()|raw }}
{% endset %}
}, orderConditionHtml) }}

{{ forms.field({
label: 'Match Customer'|t('commerce'),
instructions: 'Create rules that allow this discount to match the order’s customer.'|t('commerce'),
errors: discount.getErrors('customerCondition')
}, customerConditionInput) }}

{% set shippingAddressConditionInput %}
{{ discount.shippingAddressCondition.getBuilderHtml()|raw }}
{% endset %}
}, customerConditionHtml) }}

{{ forms.field({
label: 'Match Shipping Address'|t('commerce'),
instructions: 'Create rules that allow this discount to match the order’s shipping address.'|t('commerce'),
errors: discount.getErrors('shippingAddressCondition')
}, shippingAddressConditionInput) }}

{% set billingAddressConditionInput %}
{{ discount.billingAddressCondition.getBuilderHtml()|raw }}
{% endset %}
}, shippingAddressConditionHtml) }}

{{ forms.field({
label: 'Match Billing Address'|t('commerce'),
instructions: 'Create rules that allow this discount to match the order’s billing address.'|t('commerce'),
errors: discount.getErrors('billingAddressCondition')
}, billingAddressConditionInput) }}
}, billingAddressConditionHtml) }}

{{ forms.dateTimeField({
label: "Start Date"|t('commerce'),
Expand Down
24 changes: 4 additions & 20 deletions src-yii2/templates/store-management/pricing-rules/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -50,52 +50,36 @@

<hr>

{% set productConditionInput %}
{{ catalogPricingRule.productCondition.getBuilderHtml()|raw }}
{% endset %}

{{ forms.field({
id: 'productCondition',
label: 'Match Product'|t('commerce'),
errors: catalogPricingRule.getErrors('productCondition')
}, productConditionInput) }}

{% set variantConditionInput %}
{{ catalogPricingRule.variantCondition.getBuilderHtml()|raw }}
{% endset %}
}, productConditionHtml) }}

{{ forms.field({
id: 'variantCondition',
label: 'Match Variant'|t('commerce'),
errors: catalogPricingRule.getErrors('variantCondition')
}, variantConditionInput) }}
}, variantConditionHtml) }}

<a class="fieldtoggle {% if catalogPricingRule.purchasableCondition.getConditionRules()|length > 0 %}expanded{% endif %}"
data-target="cpr-purchasable-condition">{{ 'Advanced'|t('commerce') }}</a>
<div id="cpr-purchasable-condition"
class="{% if catalogPricingRule.purchasableCondition.getConditionRules()|length < 1 %}hidden{% endif %}">
{% set purchasableConditionInput %}
{{ catalogPricingRule.purchasableCondition.getBuilderHtml()|raw }}
{% endset %}

{{ forms.field({
id: 'purchasableCondition',
label: 'Match Purchasable'|t('commerce'),
errors: catalogPricingRule.getErrors('purchasableCondition')
}, purchasableConditionInput) }}
}, purchasableConditionHtml) }}
</div>

<hr>

{% set customerConditionInput %}
{{ catalogPricingRule.customerCondition.getBuilderHtml()|raw }}
{% endset %}

{{ forms.field({
id: 'customerCondition',
label: 'Match Customer'|t('commerce'),
errors: catalogPricingRule.getErrors('customerCondition')
}, customerConditionInput) }}
}, customerConditionHtml) }}
</div>

<div id="actions" class="hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,11 @@
errors: catalogPricingRule.getErrors('dateTo'),
}) }}

{% set customerConditionInput %}
{{ catalogPricingRule.customerCondition.getBuilderHtml()|raw }}
{% endset %}

{{ forms.field({
id: 'customerCondition',
label: 'Match Customer'|t('commerce'),
errors: catalogPricingRule.getErrors('customerCondition')
}, customerConditionInput) }}
}, customerConditionHtml) }}
</div>

<div id="actions" class="hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,19 @@
}) }}
</div>

{% set orderConditionInput %}
{{ shippingMethod.orderCondition.getBuilderHtml()|raw }}
{% endset %}

{{ forms.field({
id: 'orderCondition',
label: 'Match Order'|t('commerce'),
errors: shippingMethod.getErrors('orderCondition'),
instructions: 'Conditions here are matched against an order before looking through the rules. This is useful if you want to qualify a method’s availability early, or if there are common conditions to all rules for this method.'|t('commerce'),
}, orderConditionInput) }}

{% set customerConditionInput %}
{{ shippingMethod.customerCondition.getBuilderHtml()|raw }}
{% endset %}
}, orderConditionHtml) }}

{{ forms.field({
id: 'customerCondition',
label: 'Match Customer'|t('commerce'),
errors: shippingMethod.getErrors('customerCondition'),
instructions: 'Conditions here are matched against the order’s customer before looking through the rules. This is useful if you want qualify a method’s availability early or if there are common conditions to all rules for this method.'|t('commerce'),
}, customerConditionInput) }}
}, customerConditionHtml) }}

{% if shippingMethod.id %}
<div id="rules">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,11 @@
<div id="conditions-tab" class="hidden">
<p>{{ "Filtering conditions which describe to which orders this rule is applicable to. Write 0 to skip a condition."|t('commerce') }}</p>

{% set orderConditionInput %}
{{ shippingRule.orderCondition.getBuilderHtml()|raw }}
{% endset %}

{{ forms.field({
id: 'orderCondition',
label: 'Match Order'|t('commerce'),
errors: shippingRule.getErrors('orderCondition')
}, orderConditionInput) }}
}, orderConditionHtml) }}

<a class="fieldtoggle {% if shippingRule.orderConditionFormula %}expanded{% endif %}"
data-target="orderConditionFormula-advanced">{{ 'Advanced'|t('commerce') }}</a>
Expand Down Expand Up @@ -157,15 +153,11 @@

<hr>

{% set customerConditionInput %}
{{ shippingRule.customerCondition.getBuilderHtml()|raw }}
{% endset %}

{{ forms.field({
id: 'customerCondition',
label: 'Match Customer'|t('commerce'),
errors: shippingRule.getErrors('customerCondition')
}, customerConditionInput) }}
}, customerConditionHtml) }}

<hr>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@

{{ forms.field({
label: 'Address Condition'|t('app'),
}, condition.builderHtml) }}
}, conditionHtml) }}
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@

{{ forms.field({
label: 'Address Condition'|t('app'),
}, condition.builderHtml) }}
}, conditionHtml) }}
11 changes: 0 additions & 11 deletions src/Address/Conditions/GatewayAddressCondition.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,7 @@
namespace CraftCms\Commerce\Address\Conditions;

use CraftCms\Cms\Address\Conditions\AddressCondition;
use CraftCms\Cms\Support\Html;
use Override;

class GatewayAddressCondition extends AddressCondition
{
#[Override]
public function getBuilderHtml(bool $readOnly = false): string
{
if ($readOnly) {
return Html::disableInputs(fn() => parent::getBuilderHtml()) ?? '';
}

return parent::getBuilderHtml();
}
}
Loading