and product output are now optional
This commit is contained in:
@@ -83,6 +83,7 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
|||||||
Argument::createIntTypeArgument('min_stock'),
|
Argument::createIntTypeArgument('min_stock'),
|
||||||
Argument::createFloatTypeArgument('min_weight'),
|
Argument::createFloatTypeArgument('min_weight'),
|
||||||
Argument::createFloatTypeArgument('max_weight'),
|
Argument::createFloatTypeArgument('max_weight'),
|
||||||
|
Argument::createBooleanTypeArgument('with_prev_next_info', false),
|
||||||
Argument::createBooleanTypeArgument('current'),
|
Argument::createBooleanTypeArgument('current'),
|
||||||
Argument::createBooleanTypeArgument('current_category'),
|
Argument::createBooleanTypeArgument('current_category'),
|
||||||
Argument::createIntTypeArgument('depth', 1),
|
Argument::createIntTypeArgument('depth', 1),
|
||||||
@@ -1004,22 +1005,6 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
|||||||
// Find previous and next product, in the default category.
|
// Find previous and next product, in the default category.
|
||||||
$default_category_id = $product->getDefaultCategoryId();
|
$default_category_id = $product->getDefaultCategoryId();
|
||||||
|
|
||||||
$previous = ProductQuery::create()
|
|
||||||
->joinProductCategory()
|
|
||||||
->where('ProductCategory.category_id = ?', $default_category_id)
|
|
||||||
->filterByPosition($product->getPosition(), Criteria::LESS_THAN)
|
|
||||||
->orderByPosition(Criteria::DESC)
|
|
||||||
->findOne()
|
|
||||||
;
|
|
||||||
|
|
||||||
$next = ProductQuery::create()
|
|
||||||
->joinProductCategory()
|
|
||||||
->where('ProductCategory.category_id = ?', $default_category_id)
|
|
||||||
->filterByPosition($product->getPosition(), Criteria::GREATER_THAN)
|
|
||||||
->orderByPosition(Criteria::ASC)
|
|
||||||
->findOne()
|
|
||||||
;
|
|
||||||
|
|
||||||
$loopResultRow
|
$loopResultRow
|
||||||
->set("ID" , $product->getId())
|
->set("ID" , $product->getId())
|
||||||
->set("REF" , $product->getRef())
|
->set("REF" , $product->getRef())
|
||||||
@@ -1041,15 +1026,38 @@ class Product extends BaseI18nLoop implements PropelSearchLoopInterface, SearchL
|
|||||||
->set("POSITION" , $product->getPosition())
|
->set("POSITION" , $product->getPosition())
|
||||||
->set("VISIBLE" , $product->getVisible() ? "1" : "0")
|
->set("VISIBLE" , $product->getVisible() ? "1" : "0")
|
||||||
->set("TEMPLATE" , $product->getTemplateId())
|
->set("TEMPLATE" , $product->getTemplateId())
|
||||||
->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
|
|
||||||
->set("HAS_NEXT" , $next != null ? 1 : 0)
|
|
||||||
->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
|
|
||||||
->set("NEXT" , $next != null ? $next->getId() : -1)
|
|
||||||
->set("DEFAULT_CATEGORY" , $default_category_id)
|
->set("DEFAULT_CATEGORY" , $default_category_id)
|
||||||
->set("TAX_RULE_ID" , $product->getTaxRuleId())
|
->set("TAX_RULE_ID" , $product->getTaxRuleId())
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
if ($this->getBackend_context() || $this->getWithPrevNextInfo()) {
|
||||||
|
// Find previous and next category
|
||||||
|
$previous = ProductQuery::create()
|
||||||
|
->joinProductCategory()
|
||||||
|
->where('ProductCategory.category_id = ?', $default_category_id)
|
||||||
|
->filterByPosition($product->getPosition(), Criteria::LESS_THAN)
|
||||||
|
->orderByPosition(Criteria::DESC)
|
||||||
|
->findOne()
|
||||||
|
;
|
||||||
|
|
||||||
|
$next = ProductQuery::create()
|
||||||
|
->joinProductCategory()
|
||||||
|
->where('ProductCategory.category_id = ?', $default_category_id)
|
||||||
|
->filterByPosition($product->getPosition(), Criteria::GREATER_THAN)
|
||||||
|
->orderByPosition(Criteria::ASC)
|
||||||
|
->findOne()
|
||||||
|
;
|
||||||
|
|
||||||
|
$loopResultRow
|
||||||
|
->set("HAS_PREVIOUS" , $previous != null ? 1 : 0)
|
||||||
|
->set("HAS_NEXT" , $next != null ? 1 : 0)
|
||||||
|
->set("PREVIOUS" , $previous != null ? $previous->getId() : -1)
|
||||||
|
->set("NEXT" , $next != null ? $next->getId() : -1)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
$loopResult->addRow($loopResultRow);
|
$loopResult->addRow($loopResultRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
{* Page Title *}
|
{* Page Title *}
|
||||||
{block name='no-return-functions' append}
|
{block name='no-return-functions' append}
|
||||||
{loop name="product.seo.title" type="product" id="{product attr="id"}"}
|
{loop name="product.seo.title" type="product" id="{product attr="id"}" with_prev_next_info="1"}
|
||||||
{$page_title = {$META_TITLE}}
|
{$page_title = {$META_TITLE}}
|
||||||
{/loop}
|
{/loop}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
{* Meta *}
|
{* Meta *}
|
||||||
{block name="meta"}
|
{block name="meta"}
|
||||||
{loop name="product.seo.meta" type="product" id="{product attr="id"}" limit="1"}
|
{loop name="product.seo.meta" type="product" id="{product attr="id"}" limit="1" with_prev_next_info="1"}
|
||||||
{if $META_DESCRIPTION}<meta name="description" content="{$META_DESCRIPTION}">{/if}
|
{if $META_DESCRIPTION}<meta name="description" content="{$META_DESCRIPTION}">{/if}
|
||||||
{if $META_KEYWORDS}<meta name="keywords" content="{$META_KEYWORDS}">{/if}
|
{if $META_KEYWORDS}<meta name="keywords" content="{$META_KEYWORDS}">{/if}
|
||||||
{/loop}
|
{/loop}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
{* Breadcrumb *}
|
{* Breadcrumb *}
|
||||||
{block name='no-return-functions' append}
|
{block name='no-return-functions' append}
|
||||||
{$breadcrumbs = []}
|
{$breadcrumbs = []}
|
||||||
{loop type="product" name="product_breadcrumb" id="{product attr="id"}" limit="1"}
|
{loop type="product" name="product_breadcrumb" id="{product attr="id"}" limit="1" with_prev_next_info="1"}
|
||||||
{loop name="category_path" type="category-path" category="{$DEFAULT_CATEGORY}"}
|
{loop name="category_path" type="category-path" category="{$DEFAULT_CATEGORY}"}
|
||||||
{$breadcrumbs[] = ['title' => {$TITLE}, 'url'=> {$URL}]}
|
{$breadcrumbs[] = ['title' => {$TITLE}, 'url'=> {$URL}]}
|
||||||
{/loop}
|
{/loop}
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
{* Content *}
|
{* Content *}
|
||||||
{block name="main-content"}
|
{block name="main-content"}
|
||||||
<div class="main">
|
<div class="main">
|
||||||
{loop name="product.details" type="product" id="{product attr="id"}" limit="1"}
|
{loop name="product.details" type="product" id="{product attr="id"}" limit="1" with_prev_next_info="1"}
|
||||||
<article id="product" class="col-main" role="main" itemscope itemtype="http://schema.org/Product">
|
<article id="product" class="col-main" role="main" itemscope itemtype="http://schema.org/Product">
|
||||||
|
|
||||||
<!-- Use the meta tag to specify content that is not visible on the page in any way -->
|
<!-- Use the meta tag to specify content that is not visible on the page in any way -->
|
||||||
|
|||||||
Reference in New Issue
Block a user