mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-11-30 02:49:03 +08:00
布局商品搜索新增钩子,商品避免无数据报错
This commit is contained in:
parent
51d13a206e
commit
39af91d625
@ -708,6 +708,15 @@ class BaseLayout
|
||||
$where[] = [$category_field, 'in', $category_id];
|
||||
}
|
||||
|
||||
// 商品搜索列表读取钩子
|
||||
$hook_name = 'plugins_layout_service_search_goods_begin';
|
||||
Hook::listen($hook_name, [
|
||||
'hook_name' => $hook_name,
|
||||
'is_backend' => true,
|
||||
'params' => $params,
|
||||
'where' => &$where,
|
||||
]);
|
||||
|
||||
// 获取商品总数
|
||||
$result['total'] = GoodsService::CategoryGoodsTotal($where);
|
||||
|
||||
@ -814,8 +823,8 @@ class BaseLayout
|
||||
return DataReturn('数据类型未处理['.$params['data_type'].']', -1);
|
||||
}
|
||||
|
||||
// 商品搜索列表读取钩子
|
||||
$hook_name = 'plugins_layout_service_search_goods_begin';
|
||||
// 商品数据列表读取钩子
|
||||
$hook_name = 'plugins_layout_service_goods_data_begin';
|
||||
Hook::listen($hook_name, [
|
||||
'hook_name' => $hook_name,
|
||||
'is_backend' => true,
|
||||
|
@ -68,47 +68,49 @@
|
||||
</div>
|
||||
{{/case}}
|
||||
{{case goods}}
|
||||
{{switch vss.config.view_list_show_style}}
|
||||
{{case rolling}}
|
||||
<div class="am-slider am-slider-default am-slider-carousel module-goods-content {{$vss.config.frontend_config.nav_dot_ent}}" data-am-flexslider="{itemWidth: {{if empty($vss['config']['view_list_show_style_value_arr']) or empty($vss['config']['view_list_show_style_value_arr']['item_width'])}}200{{else /}}{{$vss.config.view_list_show_style_value_arr.item_width}}{{/if}}, itemMargin: {{if empty($vss['config']['view_list_show_style_value_arr']) or empty($vss['config']['view_list_show_style_value_arr']['item_margin'])}}0{{else /}}{{$vss.config.view_list_show_style_value_arr.item_margin}}{{/if}}, slideshow: {{if empty($vss['config']['view_list_show_style_value_arr']) or !isset($vss['config']['view_list_show_style_value_arr']['is_auto_play']) or $vss['config']['view_list_show_style_value_arr']['is_auto_play'] eq 0}}false{{else /}}true{{/if}}, controlNav: {{if empty($vss['config']['view_list_show_style_value_arr']) or !isset($vss['config']['view_list_show_style_value_arr']['is_nav_dot']) or $vss['config']['view_list_show_style_value_arr']['is_nav_dot'] eq 0}}false{{else /}}true{{/if}}}">
|
||||
<div class="am-viewport">
|
||||
<ul class="am-slides module-list-content">
|
||||
{{foreach $vss.config.data_list as $g}}
|
||||
<li>
|
||||
<div class="module-item" style="{{$vss.config.frontend_config.item_style}}">
|
||||
<a href="{{$g.goods_url}}" target="_blank" class="{{$vss.config.frontend_config.media_fixed.media_container_ent}}" style="{{$vss.config.frontend_config.media_fixed.media_container_style}}">
|
||||
<img src="{{$g.images}}" alt="{{$g.title}}" class="{{$vss.config.frontend_config.media_fixed.media_ent}}" />
|
||||
</a>
|
||||
<div class="item-bottom">
|
||||
<div class="module-title">
|
||||
<a href="{{$g.goods_url}}" target="_blank">{{$g.title}}</a></div>
|
||||
<p class="module-price">{{$currency_symbol}}{{$g.price}}</p>
|
||||
{{if !empty($vss['config']['data_list']) and is_array($vss['config']['data_list'])}}
|
||||
{{switch vss.config.view_list_show_style}}
|
||||
{{case rolling}}
|
||||
<div class="am-slider am-slider-default am-slider-carousel module-goods-content {{$vss.config.frontend_config.nav_dot_ent}}" data-am-flexslider="{itemWidth: {{if empty($vss['config']['view_list_show_style_value_arr']) or empty($vss['config']['view_list_show_style_value_arr']['item_width'])}}200{{else /}}{{$vss.config.view_list_show_style_value_arr.item_width}}{{/if}}, itemMargin: {{if empty($vss['config']['view_list_show_style_value_arr']) or empty($vss['config']['view_list_show_style_value_arr']['item_margin'])}}0{{else /}}{{$vss.config.view_list_show_style_value_arr.item_margin}}{{/if}}, slideshow: {{if empty($vss['config']['view_list_show_style_value_arr']) or !isset($vss['config']['view_list_show_style_value_arr']['is_auto_play']) or $vss['config']['view_list_show_style_value_arr']['is_auto_play'] eq 0}}false{{else /}}true{{/if}}, controlNav: {{if empty($vss['config']['view_list_show_style_value_arr']) or !isset($vss['config']['view_list_show_style_value_arr']['is_nav_dot']) or $vss['config']['view_list_show_style_value_arr']['is_nav_dot'] eq 0}}false{{else /}}true{{/if}}}">
|
||||
<div class="am-viewport">
|
||||
<ul class="am-slides module-list-content">
|
||||
{{foreach $vss.config.data_list as $g}}
|
||||
<li>
|
||||
<div class="module-item" style="{{$vss.config.frontend_config.item_style}}">
|
||||
<a href="{{$g.goods_url}}" target="_blank" class="{{$vss.config.frontend_config.media_fixed.media_container_ent}}" style="{{$vss.config.frontend_config.media_fixed.media_container_style}}">
|
||||
<img src="{{$g.images}}" alt="{{$g.title}}" class="{{$vss.config.frontend_config.media_fixed.media_ent}}" />
|
||||
</a>
|
||||
<div class="item-bottom">
|
||||
<div class="module-title">
|
||||
<a href="{{$g.goods_url}}" target="_blank">{{$g.title}}</a></div>
|
||||
<p class="module-price">{{$currency_symbol}}{{$g.price}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/case}}
|
||||
{{default /}}
|
||||
<ul class="module-goods-content module-list-content {{$vss.config.frontend_config.list_ent}}">
|
||||
{{foreach $vss.config.data_list as $g}}
|
||||
<li>
|
||||
<div class="module-item" style="{{$vss.config.frontend_config.item_style}}">
|
||||
<a href="{{$g.goods_url}}" target="_blank" class="{{$vss.config.frontend_config.media_fixed.media_container_ent}}" style="{{$vss.config.frontend_config.media_fixed.media_container_style}}">
|
||||
<img src="{{$g.images}}" alt="{{$g.title}}" class="{{$vss.config.frontend_config.media_fixed.media_ent}}" />
|
||||
</a>
|
||||
<div class="item-bottom">
|
||||
<div class="module-title">
|
||||
<a href="{{$g.goods_url}}" target="_blank">{{$g.title}}</a></div>
|
||||
<p class="module-price">{{$currency_symbol}}{{$g.price}}</p>
|
||||
{{/case}}
|
||||
{{default /}}
|
||||
<ul class="module-goods-content module-list-content {{$vss.config.frontend_config.list_ent}}">
|
||||
{{foreach $vss.config.data_list as $g}}
|
||||
<li>
|
||||
<div class="module-item" style="{{$vss.config.frontend_config.item_style}}">
|
||||
<a href="{{$g.goods_url}}" target="_blank" class="{{$vss.config.frontend_config.media_fixed.media_container_ent}}" style="{{$vss.config.frontend_config.media_fixed.media_container_style}}">
|
||||
<img src="{{$g.images}}" alt="{{$g.title}}" class="{{$vss.config.frontend_config.media_fixed.media_ent}}" />
|
||||
</a>
|
||||
<div class="item-bottom">
|
||||
<div class="module-title">
|
||||
<a href="{{$g.goods_url}}" target="_blank">{{$g.title}}</a></div>
|
||||
<p class="module-price">{{$currency_symbol}}{{$g.price}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{/switch}}
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{/switch}}
|
||||
{{/if}}
|
||||
{{/case}}
|
||||
{{case title}}
|
||||
<div class="module-title-content">
|
||||
|
@ -60,47 +60,49 @@
|
||||
</div>
|
||||
{{/case}}
|
||||
{{case goods}}
|
||||
{{switch vss.config.view_list_show_style}}
|
||||
{{case rolling}}
|
||||
<div class="am-slider am-slider-default am-slider-carousel module-goods-content {{$vss.config.frontend_config.nav_dot_ent}}" data-am-flexslider="{itemWidth: {{if empty($vss['config']['view_list_show_style_value_arr']) or empty($vss['config']['view_list_show_style_value_arr']['item_width'])}}200{{else /}}{{$vss.config.view_list_show_style_value_arr.item_width}}{{/if}}, itemMargin: {{if empty($vss['config']['view_list_show_style_value_arr']) or empty($vss['config']['view_list_show_style_value_arr']['item_margin'])}}0{{else /}}{{$vss.config.view_list_show_style_value_arr.item_margin}}{{/if}}, slideshow: {{if empty($vss['config']['view_list_show_style_value_arr']) or !isset($vss['config']['view_list_show_style_value_arr']['is_auto_play']) or $vss['config']['view_list_show_style_value_arr']['is_auto_play'] eq 0}}false{{else /}}true{{/if}}, controlNav: {{if empty($vss['config']['view_list_show_style_value_arr']) or !isset($vss['config']['view_list_show_style_value_arr']['is_nav_dot']) or $vss['config']['view_list_show_style_value_arr']['is_nav_dot'] eq 0}}false{{else /}}true{{/if}}}">
|
||||
<div class="am-viewport">
|
||||
<ul class="am-slides module-list-content">
|
||||
{{foreach $vss.config.data_list as $g}}
|
||||
<li>
|
||||
<div class="module-item" style="{{$vss.config.frontend_config.item_style}}">
|
||||
<a href="{{$g.goods_url}}" target="_blank" class="{{$vss.config.frontend_config.media_fixed.media_container_ent}}" style="{{$vss.config.frontend_config.media_fixed.media_container_style}}">
|
||||
<img src="{{$g.images}}" alt="{{$g.title}}" class="{{$vss.config.frontend_config.media_fixed.media_ent}}" />
|
||||
</a>
|
||||
<div class="item-bottom">
|
||||
<div class="module-title">
|
||||
<a href="{{$g.goods_url}}" target="_blank">{{$g.title}}</a></div>
|
||||
<p class="module-price">{{$currency_symbol}}{{$g.price}}</p>
|
||||
{{if !empty($vss['config']['data_list']) and is_array($vss['config']['data_list'])}}
|
||||
{{switch vss.config.view_list_show_style}}
|
||||
{{case rolling}}
|
||||
<div class="am-slider am-slider-default am-slider-carousel module-goods-content {{$vss.config.frontend_config.nav_dot_ent}}" data-am-flexslider="{itemWidth: {{if empty($vss['config']['view_list_show_style_value_arr']) or empty($vss['config']['view_list_show_style_value_arr']['item_width'])}}200{{else /}}{{$vss.config.view_list_show_style_value_arr.item_width}}{{/if}}, itemMargin: {{if empty($vss['config']['view_list_show_style_value_arr']) or empty($vss['config']['view_list_show_style_value_arr']['item_margin'])}}0{{else /}}{{$vss.config.view_list_show_style_value_arr.item_margin}}{{/if}}, slideshow: {{if empty($vss['config']['view_list_show_style_value_arr']) or !isset($vss['config']['view_list_show_style_value_arr']['is_auto_play']) or $vss['config']['view_list_show_style_value_arr']['is_auto_play'] eq 0}}false{{else /}}true{{/if}}, controlNav: {{if empty($vss['config']['view_list_show_style_value_arr']) or !isset($vss['config']['view_list_show_style_value_arr']['is_nav_dot']) or $vss['config']['view_list_show_style_value_arr']['is_nav_dot'] eq 0}}false{{else /}}true{{/if}}}">
|
||||
<div class="am-viewport">
|
||||
<ul class="am-slides module-list-content">
|
||||
{{foreach $vss.config.data_list as $g}}
|
||||
<li>
|
||||
<div class="module-item" style="{{$vss.config.frontend_config.item_style}}">
|
||||
<a href="{{$g.goods_url}}" target="_blank" class="{{$vss.config.frontend_config.media_fixed.media_container_ent}}" style="{{$vss.config.frontend_config.media_fixed.media_container_style}}">
|
||||
<img src="{{$g.images}}" alt="{{$g.title}}" class="{{$vss.config.frontend_config.media_fixed.media_ent}}" />
|
||||
</a>
|
||||
<div class="item-bottom">
|
||||
<div class="module-title">
|
||||
<a href="{{$g.goods_url}}" target="_blank">{{$g.title}}</a></div>
|
||||
<p class="module-price">{{$currency_symbol}}{{$g.price}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/case}}
|
||||
{{default /}}
|
||||
<ul class="module-goods-content module-list-content {{$vss.config.frontend_config.list_ent}}">
|
||||
{{foreach $vss.config.data_list as $g}}
|
||||
<li>
|
||||
<div class="module-item" style="{{$vss.config.frontend_config.item_style}}">
|
||||
<a href="{{$g.goods_url}}" target="_blank" class="{{$vss.config.frontend_config.media_fixed.media_container_ent}}" style="{{$vss.config.frontend_config.media_fixed.media_container_style}}">
|
||||
<img src="{{$g.images}}" alt="{{$g.title}}" class="{{$vss.config.frontend_config.media_fixed.media_ent}}" />
|
||||
</a>
|
||||
<div class="item-bottom">
|
||||
<div class="module-title">
|
||||
<a href="{{$g.goods_url}}" target="_blank">{{$g.title}}</a></div>
|
||||
<p class="module-price">{{$currency_symbol}}{{$g.price}}</p>
|
||||
{{/case}}
|
||||
{{default /}}
|
||||
<ul class="module-goods-content module-list-content {{$vss.config.frontend_config.list_ent}}">
|
||||
{{foreach $vss.config.data_list as $g}}
|
||||
<li>
|
||||
<div class="module-item" style="{{$vss.config.frontend_config.item_style}}">
|
||||
<a href="{{$g.goods_url}}" target="_blank" class="{{$vss.config.frontend_config.media_fixed.media_container_ent}}" style="{{$vss.config.frontend_config.media_fixed.media_container_style}}">
|
||||
<img src="{{$g.images}}" alt="{{$g.title}}" class="{{$vss.config.frontend_config.media_fixed.media_ent}}" />
|
||||
</a>
|
||||
<div class="item-bottom">
|
||||
<div class="module-title">
|
||||
<a href="{{$g.goods_url}}" target="_blank">{{$g.title}}</a></div>
|
||||
<p class="module-price">{{$currency_symbol}}{{$g.price}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{/switch}}
|
||||
</li>
|
||||
{{/foreach}}
|
||||
</ul>
|
||||
{{/switch}}
|
||||
{{/if}}
|
||||
{{/case}}
|
||||
{{case title}}
|
||||
<div class="module-title-content">
|
||||
|
Loading…
Reference in New Issue
Block a user