Ver código fonte

Merge branch 'develop'

master
Guillaume Bourgeois 2 meses atrás
pai
commit
1147d86317
4 arquivos alterados com 36 adições e 6 exclusões
  1. +2
    -1
      Builder/Order/OrderShopBuilder.php
  2. +17
    -2
      Model/Order/OrderProductModel.php
  3. +16
    -0
      Solver/Order/OrderProductSolver.php
  4. +1
    -3
      Solver/Product/ProductFamilySolver.php

+ 2
- 1
Builder/Order/OrderShopBuilder.php Ver arquivo

@@ -493,7 +493,8 @@ class OrderShopBuilder
public function applyDeductAvailabilityProduct(
OrderShopInterface $orderShop,
ProductInterface $product,
int $quantityOrder
int $quantityOrder,
float $quantityProduct = null
): void {
switch ($product->getProductFamily()->getBehaviorCountStock()) {
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE :

+ 17
- 2
Model/Order/OrderProductModel.php Ver arquivo

@@ -41,6 +41,11 @@ abstract class OrderProductModel implements PriceInterface, EntityInterface, Ord
*/
protected $title;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $titleVariation;

/**
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderProductReductionCatalogInterface", cascade={"persist", "remove"})
*/
@@ -129,6 +134,18 @@ abstract class OrderProductModel implements PriceInterface, EntityInterface, Ord
return $this;
}

public function getTitleVariation(): ?string
{
return $this->titleVariation;
}

public function setTitleVariation(?string $titleVariation): self
{
$this->titleVariation = $titleVariation;

return $this;
}

public function getOrderProductReductionCatalog(): ?OrderProductReductionCatalogInterface
{
return $this->orderProductReductionCatalog;
@@ -140,6 +157,4 @@ abstract class OrderProductModel implements PriceInterface, EntityInterface, Ord

return $this;
}


}

+ 16
- 0
Solver/Order/OrderProductSolver.php Ver arquivo

@@ -115,6 +115,22 @@ class OrderProductSolver
return $title;
}

public function getTitleProduct(OrderProductInterface $orderProduct): string
{
$product = $orderProduct->getProduct();
$productFamily = $product->getProductFamily();
$title = ($product->getTitle() && strlen($product->getTitle()) > 0) ? $product->getTitle() : '';

if ($this->productFamilySolver->hasProductsWithVariousWeight($productFamily)) {
if(strlen($title) > 0) {
$title .= ' - ';
}
$title .= $this->productSolver->getQuantityLabelInherited($product);
}

return $title;
}

public function getTitleSummaryAfterAddCart(OrderProductInterface $orderProduct)
{
$title = '';

+ 1
- 3
Solver/Product/ProductFamilySolver.php Ver arquivo

@@ -6,6 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Order\OrderShopInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel;
use Lc\CaracoleBundle\Model\Product\ProductInterface;
@@ -106,12 +107,9 @@ class ProductFamilySolver
switch ($productFamily->getBehaviorCountStock()) {
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE :
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY :

$availableQuantity = $productFamily->getAvailableQuantity();
break;

case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT :

foreach ($this->getProductsOnline($productFamily) as $product) {
$availableQuantity += $this->productSolver->getAvailableQuantityInherited($product);
}

Carregando…
Cancelar
Salvar