Added output var to product loop to get the number of PSE for a product
This commit is contained in:
@@ -179,6 +179,8 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
|||||||
$search->innerJoinProductSaleElements('pse');
|
$search->innerJoinProductSaleElements('pse');
|
||||||
$search->addJoinCondition('pse', '`pse`.IS_DEFAULT=1');
|
$search->addJoinCondition('pse', '`pse`.IS_DEFAULT=1');
|
||||||
|
|
||||||
|
$search->innerJoinProductSaleElements('pse_count');
|
||||||
|
|
||||||
$priceJoin = new Join();
|
$priceJoin = new Join();
|
||||||
$priceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'pse', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'price');
|
$priceJoin->addExplicitCondition(ProductSaleElementsTableMap::TABLE_NAME, 'ID', 'pse', ProductPriceTableMap::TABLE_NAME, 'PRODUCT_SALE_ELEMENTS_ID', 'price');
|
||||||
$priceJoin->setJoinType(Criteria::LEFT_JOIN);
|
$priceJoin->setJoinType(Criteria::LEFT_JOIN);
|
||||||
@@ -396,6 +398,8 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
|||||||
$search->withColumn('`pse`.WEIGHT', 'weight');
|
$search->withColumn('`pse`.WEIGHT', 'weight');
|
||||||
$search->withColumn('`pse`.EAN_CODE', 'ean_code');
|
$search->withColumn('`pse`.EAN_CODE', 'ean_code');
|
||||||
|
|
||||||
|
$search->withColumn('COUNT(`pse_count`.ID)', 'pse_count');
|
||||||
|
|
||||||
$orders = $this->getOrder();
|
$orders = $this->getOrder();
|
||||||
|
|
||||||
foreach ($orders as $order) {
|
foreach ($orders as $order) {
|
||||||
@@ -518,6 +522,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
|||||||
->set("TAXED_PROMO_PRICE" , $taxedPromoPrice)
|
->set("TAXED_PROMO_PRICE" , $taxedPromoPrice)
|
||||||
->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
|
->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
|
||||||
->set("IS_NEW" , $product->getVirtualColumn('is_new'))
|
->set("IS_NEW" , $product->getVirtualColumn('is_new'))
|
||||||
|
->set("PSE_COUNT" , $product->getVirtualColumn('pse_count'))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@@ -571,8 +576,10 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
|||||||
$search->where(" CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
|
$search->where(" CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END ".Criteria::LIKE." ?", "%".$title."%", \PDO::PARAM_STR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* number of pse
|
||||||
|
$search->innerJoinProductSaleElements('pse_count');
|
||||||
|
$search->withColumn('COUNT(`pse_count`.ID)', 'pse_count');
|
||||||
|
*/
|
||||||
|
|
||||||
$category = $this->getCategory();
|
$category = $this->getCategory();
|
||||||
$categoryDefault = $this->getCategoryDefault();
|
$categoryDefault = $this->getCategoryDefault();
|
||||||
@@ -985,8 +992,8 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
|||||||
->set("BEST_PRICE" , $price)
|
->set("BEST_PRICE" , $price)
|
||||||
->set("BEST_PRICE_TAX" , $taxedPrice - $price)
|
->set("BEST_PRICE_TAX" , $taxedPrice - $price)
|
||||||
->set("BEST_TAXED_PRICE" , $taxedPrice)
|
->set("BEST_TAXED_PRICE" , $taxedPrice)
|
||||||
->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
|
->set("IS_PROMO" , $product->getVirtualColumn('is_promo'))
|
||||||
->set("IS_NEW" , $product->getVirtualColumn('is_new'))
|
->set("IS_NEW" , $product->getVirtualColumn('is_new'))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<li class="item">
|
<li class="item">
|
||||||
{assign var="hasSubmit" value = false}
|
{if $PSE_COUNT > 1}
|
||||||
|
{assign var="hasSubmit" value = false}
|
||||||
|
{else}
|
||||||
|
{assign var="hasSubmit" value = true}
|
||||||
|
{/if}
|
||||||
{assign var="productTitle" value="{$TITLE}"}
|
{assign var="productTitle" value="{$TITLE}"}
|
||||||
{if not $product_id}
|
{if not $product_id}
|
||||||
{assign var="product_id" value=$ID}
|
{assign var="product_id" value=$ID}
|
||||||
|
|||||||
Reference in New Issue
Block a user