Ver código fonte

Implémentation OrginProduct

feature/export_comptable
Fab 4 anos atrás
pai
commit
03efa732c2
2 arquivos alterados com 19 adições e 4 exclusões
  1. +11
    -0
      ShopBundle/Model/ProductFamily.php
  2. +8
    -4
      ShopBundle/Services/ProductFamilyUtils.php

+ 11
- 0
ShopBundle/Model/ProductFamily.php Ver arquivo

@@ -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 Ver arquivo

@@ -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;

Carregando…
Cancelar
Salvar