ver. 0.288: BasketCalculator + ShopBasketController migration, cms\Layout removal
- Migrate front\factory\ShopBasket → Domain\Basket\BasketCalculator (4 static methods, 18 callers updated) - Migrate front\controls\ShopBasket → front\Controllers\ShopBasketController (camelCase, instance methods) - Add snake_case→camelCase action dispatch for new controllers in Site::route() - Update title()/page_title() to check front\Controllers\ before fallback - Remove cms\Layout class (replaced by $layoutsRepo->find()) - Add 8 tests for BasketCalculator (484 tests, 1528 assertions) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
<div class="basket-details">
|
||||
<div class="title">Twój koszyk</div>
|
||||
<div class="details">
|
||||
<b><?= ucfirst( $lang['ilosc'] );?></b>: <span id="products-count"><?= $count = \front\factory\ShopBasket::count_products( $this -> basket );?>
|
||||
<b><?= ucfirst( $lang['ilosc'] );?></b>: <span id="products-count"><?= $count = \Domain\Basket\BasketCalculator::countProducts( $this -> basket );?>
|
||||
<?
|
||||
switch ( true )
|
||||
{
|
||||
@@ -17,7 +17,7 @@
|
||||
case ( $count >= 5 ): echo 'produktów'; break;
|
||||
}
|
||||
?></span><br />
|
||||
<b><?= ucfirst( $lang['suma'] );?></b>: <span id="basket-value"><?= \Shared\Helpers\Helpers::decimal( \front\factory\ShopBasket::summary_price( $this -> basket, $this -> coupon ) );?></span> zł
|
||||
<b><?= ucfirst( $lang['suma'] );?></b>: <span id="basket-value"><?= \Shared\Helpers\Helpers::decimal( \Domain\Basket\BasketCalculator::summaryPrice( $this -> basket, $this -> coupon ) );?></span> zł
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
$coupon = \Shared\Helpers\Helpers::get_session( 'coupon' );
|
||||
$transport_cost = \front\factory\ShopTransport::transport_cost( \Shared\Helpers\Helpers::get_session( 'basket-transport-method-id' ) );
|
||||
|
||||
$basket_summary = \front\factory\ShopBasket::summary_price( $basket, $coupon ) + $transport_cost;
|
||||
$basket_summary = \Domain\Basket\BasketCalculator::summaryPrice( $basket, $coupon ) + $transport_cost;
|
||||
?>
|
||||
<? if ( is_array( $this -> payment_methods ) ): foreach ( $this -> payment_methods as $payment_method ):?>
|
||||
<? if ( $payment_method['id'] != 6 or $payment_method['id'] == 6 and $basket_summary >= 40 and $basket_summary <= 1000 ):?>
|
||||
|
||||
@@ -173,7 +173,7 @@
|
||||
event: "begin_checkout",
|
||||
ecommerce: {
|
||||
currency: "PLN",
|
||||
value: <?= \Shared\Helpers\Helpers::normalize_decimal( \front\factory\ShopBasket::summary_price( $this -> basket, $this -> coupon ) );?>,
|
||||
value: <?= \Shared\Helpers\Helpers::normalize_decimal( \Domain\Basket\BasketCalculator::summaryPrice( $this -> basket, $this -> coupon ) );?>,
|
||||
items: [
|
||||
<?= $begin_checkout_items;?>
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user