Переглянути джерело

Merge branch 'develop'

master
Guillaume 4 роки тому
джерело
коміт
3a4351bc88
5 змінених файлів з 31 додано та 2 видалено
  1. +3
    -0
      ShopBundle/Controller/Backend/ProductFamilyController.php
  2. +1
    -1
      ShopBundle/Controller/Frontend/CartController.php
  3. +17
    -0
      ShopBundle/Repository/OrderProductRepository.php
  4. +1
    -0
      ShopBundle/Services/Order/OrderUtils.php
  5. +9
    -1
      ShopBundle/Services/Order/OrderUtilsCartTrait.php

+ 3
- 0
ShopBundle/Controller/Backend/ProductFamilyController.php Переглянути файл

@@ -175,7 +175,10 @@ class ProductFamilyController extends AdminController
$this->processProducts($entity);
$this->processPrice($entity);
}

parent::updateEntity($entity);

$this->orderUtils->updatePriceByProductFamily($entity);
}

public function persistProductFamilyEntity($entity, $newForm)

+ 1
- 1
ShopBundle/Controller/Frontend/CartController.php Переглянути файл

@@ -70,7 +70,7 @@ class CartController extends BaseController
$form->handleRequest($request);

if ($form->isSubmitted() && $form->isValid()) {
$orderShop = $this->orderUtils->getCartCurrent() ;
$orderShop = $this->orderUtils->getCartCurrent(true) ;
$data = $form->getData() ;
foreach($data as $orderProduct) {
if($orderProduct instanceof OrderProductInterface) {

+ 17
- 0
ShopBundle/Repository/OrderProductRepository.php Переглянути файл

@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\Repository;

use Lc\ShopBundle\Context\DefaultRepositoryInterface;
use Lc\ShopBundle\Context\OrderProductInterface;
use Lc\ShopBundle\Model\OrderStatus;

/**
* @method OrderProductInterface|null find($id, $lockMode = null, $lockVersion = null)
@@ -18,5 +19,21 @@ class OrderProductRepository extends BaseRepository implements DefaultRepository
return OrderProductInterface::class;
}

public function findOrderProductsInCartsByProduct($product){
$qb = $this->createQueryBuilder('e');
$qb->andWhere('e.product = :product');
$qb->andWhere('e.redelivery = false OR e.redelivery IS NULL');
$qb->setParameter('product', $product);
$qb->leftJoin('e.orderShop', 'orderShop');
$qb->andWhere('orderShop.merchant = :currentMerchant');
$qb->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent());
$qb->leftJoin('orderShop.orderStatus', 'orderStatus');
$qb->andWhere('orderStatus.alias IN (:alias)');
$qb->setParameter('alias',OrderStatus::ALIAS_CART);

return $qb->getQuery()->getResult();

}


}

+ 1
- 0
ShopBundle/Services/Order/OrderUtils.php Переглянути файл

@@ -99,6 +99,7 @@ class OrderUtils

public function addOrderProduct($orderShop, $orderProductAdd, $persist = true)
{

$return = false;

$user = $this->security->getUser();

+ 9
- 1
ShopBundle/Services/Order/OrderUtilsCartTrait.php Переглянути файл

@@ -21,7 +21,7 @@ trait OrderUtilsCartTrait
}


public function getCartCurrent()
public function getCartCurrent($createIfNotExist = false)
{
$paramsSearchOrderShop = [];

@@ -63,6 +63,14 @@ trait OrderUtilsCartTrait
}
}

if($createIfNotExist && !$orderShop) {
$orderShop = $this->createOrderShop([
'user' => $user,
'visitor' => $visitor,
'merchant' => $this->merchantUtils->getMerchantCurrent()
]);
}

return $orderShop;
}


Завантаження…
Відмінити
Зберегти