public function applyDeductAvailabilityProduct( | public function applyDeductAvailabilityProduct( | ||||
OrderShopInterface $orderShop, | OrderShopInterface $orderShop, | ||||
ProductInterface $product, | ProductInterface $product, | ||||
int $quantityOrder | |||||
int $quantityOrder, | |||||
float $quantityProduct = null | |||||
): void { | ): void { | ||||
switch ($product->getProductFamily()->getBehaviorCountStock()) { | switch ($product->getProductFamily()->getBehaviorCountStock()) { | ||||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE : | case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE : |
*/ | */ | ||||
protected $title; | protected $title; | ||||
/** | |||||
* @ORM\Column(type="string", length=255, nullable=true) | |||||
*/ | |||||
protected $titleVariation; | |||||
/** | /** | ||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderProductReductionCatalogInterface", cascade={"persist", "remove"}) | * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderProductReductionCatalogInterface", cascade={"persist", "remove"}) | ||||
*/ | */ | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getTitleVariation(): ?string | |||||
{ | |||||
return $this->titleVariation; | |||||
} | |||||
public function setTitleVariation(?string $titleVariation): self | |||||
{ | |||||
$this->titleVariation = $titleVariation; | |||||
return $this; | |||||
} | |||||
public function getOrderProductReductionCatalog(): ?OrderProductReductionCatalogInterface | public function getOrderProductReductionCatalog(): ?OrderProductReductionCatalogInterface | ||||
{ | { | ||||
return $this->orderProductReductionCatalog; | return $this->orderProductReductionCatalog; | ||||
return $this; | return $this; | ||||
} | } | ||||
} | } |
return $title; | 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) | public function getTitleSummaryAfterAddCart(OrderProductInterface $orderProduct) | ||||
{ | { | ||||
$title = ''; | $title = ''; |
use Doctrine\Common\Collections\Collection; | use Doctrine\Common\Collections\Collection; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyInterface; | use Lc\CaracoleBundle\Doctrine\Extension\ProductPropertyInterface; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | |||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | use Lc\CaracoleBundle\Model\Product\ProductFamilyModel; | ||||
use Lc\CaracoleBundle\Model\Product\ProductInterface; | use Lc\CaracoleBundle\Model\Product\ProductInterface; | ||||
switch ($productFamily->getBehaviorCountStock()) { | switch ($productFamily->getBehaviorCountStock()) { | ||||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE : | case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE : | ||||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY : | case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY : | ||||
$availableQuantity = $productFamily->getAvailableQuantity(); | $availableQuantity = $productFamily->getAvailableQuantity(); | ||||
break; | break; | ||||
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT : | case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_PRODUCT : | ||||
foreach ($this->getProductsOnline($productFamily) as $product) { | foreach ($this->getProductsOnline($productFamily) as $product) { | ||||
$availableQuantity += $this->productSolver->getAvailableQuantityInherited($product); | $availableQuantity += $this->productSolver->getAvailableQuantityInherited($product); | ||||
} | } |