@@ -241,7 +241,7 @@ class OrderShopBuilder | |||
if ($orderProductAdd->getQuantityOrder() > 0) { | |||
$updated = false; | |||
$this->orderProductBuilder->init($orderProductAdd); | |||
$productFamily = $this->productFamilyStore->getOneBySlug( | |||
$productFamily = $this->productFamilyStore->setSection($orderShop->getSection())->getOneBySlug( | |||
$orderProductAdd->getProduct()->getProductFamily()->getSlug() | |||
); | |||
@@ -4,11 +4,12 @@ namespace Lc\CaracoleBundle\Model\Order; | |||
use Doctrine\ORM\Mapping as ORM; | |||
use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait; | |||
use Lc\SovBundle\Doctrine\EntityInterface; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
*/ | |||
abstract class OrderProductReductionCatalogModel | |||
abstract class OrderProductReductionCatalogModel implements EntityInterface | |||
{ | |||
use ReductionTrait; | |||
@@ -3,12 +3,13 @@ | |||
namespace Lc\CaracoleBundle\Model\Order; | |||
use Doctrine\ORM\Mapping as ORM; | |||
use Lc\SovBundle\Doctrine\EntityInterface; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
*/ | |||
abstract class OrderProductRefundModel | |||
abstract class OrderProductRefundModel implements EntityInterface | |||
{ | |||
/** | |||
* @ORM\Column(type="integer") |
@@ -6,11 +6,12 @@ use Doctrine\ORM\Mapping as ORM; | |||
use Lc\CaracoleBundle\Doctrine\Extension\ReductionInterface; | |||
use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait; | |||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | |||
use Lc\SovBundle\Doctrine\EntityInterface; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
*/ | |||
abstract class OrderReductionCreditModel implements ReductionInterface | |||
abstract class OrderReductionCreditModel implements ReductionInterface, EntityInterface | |||
{ | |||
use ReductionTrait; | |||
@@ -143,6 +143,7 @@ class ProductFamilyStore extends AbstractStore | |||
return []; | |||
} | |||
// findByTerms | |||
public function getByTerms( | |||
$terms, |
@@ -53,6 +53,7 @@ trait PriceSolverTrait | |||
$withTax = true, | |||
$round = true | |||
): ?float { | |||
if ($reductionCatalog) { | |||
$reductionCatalogValue = $reductionCatalog->getValue(); | |||
$reductionCatalogUnit = $reductionCatalog->getUnit(); | |||
@@ -82,20 +83,20 @@ trait PriceSolverTrait | |||
} | |||
} | |||
if (isset($reductionCatalogValue) && isset($reductionCatalogUnit) && isset($reductionCatalogBehaviorTaxRate)) { | |||
if (isset($reductionCatalogValue) && isset($reductionCatalogUnit)) { | |||
if ($reductionCatalogUnit == 'percent') { | |||
$priceWithTax = $this->applyReductionPercent( | |||
$priceWithTax, | |||
$reductionCatalogValue | |||
); | |||
} elseif ($reductionCatalogUnit == 'amount') { | |||
} elseif ($reductionCatalogUnit == 'amount' && isset($reductionCatalogBehaviorTaxRate)) { | |||
if ($reductionCatalogBehaviorTaxRate == 'tax-excluded') { | |||
$priceWithTax = $this->applyTax( | |||
$this->applyReductionAmount( | |||
$price, | |||
$reductionCatalogValue * $quantity | |||
), | |||
$entity->getTaxRateInherited()->getValue() | |||
$this->productFamilySolver->getTaxRateInherited($entity)->getValue() | |||
); | |||
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') { | |||
$priceWithTax = $this->applyReductionAmount( | |||
@@ -109,7 +110,7 @@ trait PriceSolverTrait | |||
if ($withTax) { | |||
$priceReturn = $priceWithTax; | |||
} else { | |||
$priceReturn = $this->applyPercentNegative($priceWithTax, $entity->getTaxRateInherited()->getValue()); | |||
$priceReturn = $this->applyPercentNegative($priceWithTax, $this->productFamilySolver->getTaxRateInherited($entity)->getValue()); | |||
} | |||
if ($round) { | |||
return $this->round($priceReturn); |