Skip to content

Commit bf3eed9

Browse files
authored
Fix empty cart error when on GET/cart (#18)
1 parent 73b21be commit bf3eed9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Config/module.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<language>en_US</language>
1414
<language>fr_FR</language>
1515
</languages>
16-
<version>3.1.12</version>
16+
<version>3.1.13</version>
1717
<authors>
1818
<author>
1919
<name>Bertrand Tourlonias</name>

Service/GoogleTagService.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace GoogleTagManager\Service;
44

5+
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
56
use Symfony\Component\HttpFoundation\RequestStack;
67
use Thelia\Core\HttpFoundation\Session\Session;
78
use Thelia\Model\Base\CartQuery;
@@ -32,6 +33,7 @@ class GoogleTagService
3233
public function __construct(
3334
private RequestStack $requestStack,
3435
private TaxEngine $taxEngine,
36+
private EventDispatcherInterface $dispatcher
3537
)
3638
{
3739
}
@@ -487,7 +489,7 @@ protected function getOrderTotalAmount($view)
487489
switch ($view) {
488490
case 'cart' :
489491
case 'order-delivery' :
490-
return $this->requestStack->getSession()->getSessionCart()->getTaxedAmount($this->taxEngine->getDeliveryCountry());
492+
return $this->requestStack->getSession()->getSessionCart($this->dispatcher)->getTaxedAmount($this->taxEngine->getDeliveryCountry());
491493
case 'order-placed' :
492494
$order = OrderQuery::create()->findPk($this->requestStack->getCurrentRequest()->get('order_id'));
493495
return $order->getTotalAmount($tax, false) - $tax;
@@ -496,4 +498,4 @@ protected function getOrderTotalAmount($view)
496498
}
497499
}
498500

499-
}
501+
}

0 commit comments

Comments
 (0)