Explorar el Código

Merge branch 'develop'

master
Guillaume Bourgeois hace 3 meses
padre
commit
1147d86317
Se han modificado 4 ficheros con 36 adiciones y 6 borrados
  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 fichero

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 :

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

*/ */
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;
} }


} }

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

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 = '';

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

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);
} }

Cargando…
Cancelar
Guardar