* Get products by browse type of the program for product view in program list.

This commit is contained in:
dingguodong
2023-09-15 11:27:53 +08:00
parent 707d58bed7
commit 9692f6e11e
+1 -23
View File
@@ -707,29 +707,7 @@ class program extends control
if($this->config->systemMode == 'light' and $orderBy == 'program_asc') $orderBy = 'order_asc';
$queryID = strtolower($browseType) == 'bysearch' ? $param : 0;
$products = strtolower($browseType) == 'bysearch' ? $this->product->getListBySearch($queryID) : $this->product->getList();
/* Filter the program by browse type. */
foreach($products as $index => $product)
{
$programID = $product->program;
/* The product associated with the program. */
if(!empty($programID))
{
$program = $this->program->getByID($programID);
if(!empty($program) && in_array($browseType, array('all', 'unclosed', 'wait', 'doing', 'suspended', 'closed')))
{
if($browseType == 'unclosed' && $program->status == 'closed')
unset($products[$index]);
elseif($browseType != 'unclosed' && $browseType != 'all' && $program->status != $browseType)
unset($products[$index]);
}
}
else
{
/* The product without program only can be viewed when browse type is all and not closed. */
if($browseType != 'all' and $browseType != 'unclosed') unset($products[$index]);
}
}
$products = $this->programZen->getProductsByBrowseType($browseType, $products); /* Filter the program by browse type. */
$productStats = $this->product->getStats(array_keys($products), $orderBy, $pager); /* The product stats list with program data and product data. */
$productStructure = $this->product->statisticProgram($productStats);