@@ -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 : |
@@ -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; | |||
} | |||
} |
@@ -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 = ''; |
@@ -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); | |||
} |