Browse Source

Implémentation OrginProduct

feature/export_comptable
Fab 4 years ago
parent
commit
03efa732c2
2 changed files with 19 additions and 4 deletions
  1. +11
    -0
      ShopBundle/Model/ProductFamily.php
  2. +8
    -4
      ShopBundle/Services/ProductFamilyUtils.php

+ 11
- 0
ShopBundle/Model/ProductFamily.php View File

} }
} }
} }

public function getOriginProductOnline()
{
$originProduct = $this->getOriginProduct() ;

if($originProduct->getStatus()==1){
return $originProduct;
}else{
return false;
}
}
} }

+ 8
- 4
ShopBundle/Services/ProductFamilyUtils.php View File



private function getCheapestOrMostExpensiveProduct($productFamily, $comparisonFunction, $returnSelfIfNotActiveProducts) private function getCheapestOrMostExpensiveProduct($productFamily, $comparisonFunction, $returnSelfIfNotActiveProducts)
{ {
$products = $productFamily->getProductsOnline()->getValues() ;
if (count($products) > 0) {
usort($products, $comparisonFunction);
return $products[0];
if($productFamily->getActiveProducts()) {
$products = $productFamily->getProductsOnline()->getValues();
if (count($products) > 0) {
usort($products, $comparisonFunction);
return $products[0];
}
}else{
return $productFamily->getOriginProduct();
} }
if ($returnSelfIfNotActiveProducts) { if ($returnSelfIfNotActiveProducts) {
return $productFamily; return $productFamily;

Loading…
Cancel
Save