瀏覽代碼

Modifications mineures OrderUtils et UserUtils

master
Guillaume 4 年之前
父節點
當前提交
ebb8826ab1
共有 2 個檔案被更改,包括 15 行新增7 行删除
  1. +8
    -5
      ShopBundle/Services/OrderUtils.php
  2. +7
    -2
      ShopBundle/Services/UserUtils.php

+ 8
- 5
ShopBundle/Services/OrderUtils.php 查看文件

@@ -6,6 +6,7 @@ use App\Entity\OrderProductReductionCatalog;
use App\Entity\OrderShop;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\ProductFamilyUtilsInterface;
use Lc\ShopBundle\Context\UserInterface;
@@ -223,15 +224,17 @@ class OrderUtils

public function getOrderDatas($order = null)
{
$data = [] ;
if(!$order) {
$order = $this->getCartCurrent() ;
}

$data = [] ;
$data['order'] = $order ;
$data['count'] = $this->countQuantities($order) ;
$data['total_with_tax'] = $this->priceUtils->getTotalWithTaxAndReduction($order) ;
$data['order_products_by_category'] = $this->getOrderProductsByParentCategory($order) ;

if($order) {
$data['count'] = $this->countQuantities($order) ;
$data['total_with_tax'] = $this->priceUtils->getTotalWithTaxAndReduction($order) ;
$data['order_products_by_category'] = $this->getOrderProductsByParentCategory($order) ;
}

return $data ;
}

+ 7
- 2
ShopBundle/Services/UserUtils.php 查看文件

@@ -2,6 +2,7 @@

namespace Lc\ShopBundle\Services ;

use ConnectHolland\CookieConsentBundle\Cookie\CookieChecker;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Symfony\Component\HttpFoundation\Cookie ;
@@ -17,9 +18,10 @@ class UserUtils
protected $requestStack ;
protected $visitorRepository ;
protected $merchantUtils ;
protected $cookieChecker ;

public function __construct(ParameterBagInterface $parameterBag, EntityManagerInterface $em, Utils $utils,
RequestStack $requestStack, MerchantUtilsInterface $merchantUtils)
RequestStack $requestStack, MerchantUtilsInterface $merchantUtils, CookieChecker $cookieChecker)
{
$this->em = $em ;
$this->parameterBag = $parameterBag ;
@@ -27,6 +29,7 @@ class UserUtils
$this->requestStack = $requestStack ;
$this->visitorRepository = $this->em->getRepository($this->em->getClassMetadata(VisitorInterface::class)->getName()) ;
$this->merchantUtils = $merchantUtils ;
$this->cookieChecker = $cookieChecker ;
}

public function getCookieNameVisitor()
@@ -46,7 +49,9 @@ class UserUtils

public function setCookieVisitor($response, $cookie)
{
$response->headers->setCookie(Cookie::create($this->getCookieNameVisitor(), $this->cryptCookie($cookie), 0, '/', $this->utils->getCookieDomain()));
if($this->cookieChecker->isCategoryAllowedByUser('site')) {
$response->headers->setCookie(Cookie::create($this->getCookieNameVisitor(), $this->cryptCookie($cookie), 0, '/', $this->utils->getCookieDomain()));
}
}

public function getVisitor($cookie)

Loading…
取消
儲存