Bladeren bron

Implémentation OrginProduct

feature/export_comptable
Fab 4 jaren geleden
bovenliggende
commit
03efa732c2
2 gewijzigde bestanden met toevoegingen van 19 en 4 verwijderingen
  1. +11
    -0
      ShopBundle/Model/ProductFamily.php
  2. +8
    -4
      ShopBundle/Services/ProductFamilyUtils.php

+ 11
- 0
ShopBundle/Model/ProductFamily.php Bestand weergeven

@@ -802,4 +802,15 @@ abstract class ProductFamily extends AbstractDocumentEntity implements ProductPr
}
}
}

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

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

+ 8
- 4
ShopBundle/Services/ProductFamilyUtils.php Bestand weergeven

@@ -40,10 +40,14 @@ class ProductFamilyUtils

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) {
return $productFamily;

Laden…
Annuleren
Opslaan