浏览代码

Implémentation OrginProduct

feature/export_comptable
Fab 4 年前
父节点
当前提交
03efa732c2
共有 2 个文件被更改,包括 19 次插入4 次删除
  1. +11
    -0
      ShopBundle/Model/ProductFamily.php
  2. +8
    -4
      ShopBundle/Services/ProductFamilyUtils.php

+ 11
- 0
ShopBundle/Model/ProductFamily.php 查看文件

@@ -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 查看文件

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

正在加载...
取消
保存