


Modify the file category.php
Two key places need to be modified
<code><span>if</span> (<span>$_GET</span>[<span>'act'</span>] == <span>'asynclist'</span>) { <span>$sayList</span> = array(); <span>if</span> (is_array(<span>$goodslist</span>)) { foreach (<span>$goodslist</span> as <span>$vo</span>) { <span>$shop_price</span> = empty(<span>$vo</span>[<span>'promote_price'</span>]) ? <span>$vo</span>[<span>'shop_price'</span>]:<span>$vo</span>[<span>'promote_price'</span>]; <span>$watermark_img</span> = empty(<span>$vo</span>[<span>'watermark_img'</span>]) ? <span>''</span>:<span>'<img src="/static/imghwm/default1.png" data-src="'</span>.<span>$config</span>[<span>'site_url'</span>].<span>$vo</span>[<span>'goods_thumb'</span>].<span>'" class="lazy" style="max-width:90%" style="max-width:90%" alt="The mobile etouch based on ecshop implements dynamic acquisition of classified product lists" >.<span>'themes/'</span> . <span>$_CFG</span>[<span>'template'</span>].<span>'/images/'</span>.<span>$vo</span>[<span>'watermark_img'</span>].<span>'.png" alt="基于ecshop的移动端 etouch实现动态获取分类商品列表"</span>.<span>$vo</span>[<span>'goods_name'</span>].<span>'" />'</span>; /* <span>$sayList</span>[] = array( <span>'pro-inner'</span> => <span>' <div> <a href="'</span>.<span>%24vo</span>%5B<span>'url'</span>%5D.<span>'"> <img src="/static/imghwm/default1.png" data-src="'</span>.<span>$config</span>[<span>'site_url'</span>].<span>$vo</span>[<span>'goods_thumb'</span>].<span>'" class="lazy" alt="The mobile etouch based on ecshop implements dynamic acquisition of classified product lists" >.<span>$config</span>[<span>'site_url'</span>].<span>$vo</span>[<span>'goods_thumb'</span>].<span>'" alt="基于ecshop的移动端 etouch实现动态获取分类商品列表"</span>.<span>$vo</span>[<span>'goods_name'</span>].<span>'"> </span></a> </div> <div> <div> <a href="'</span>.<span>%24vo</span>%5B<span>'url'</span>%5D.<span>'">'.<span>$vo</span>[<span>'name'</span>].<span>'</span></a> </div> <div></div> <div> <em>'. <span>$shop_price</span> .<span>'</span></em> </div> <div> <del>'.<span>$vo</span>[<span>'market_price'</span>].<span>'</span></del> </div> <div>月销:<em>'.<span>$vo</span>[<span>'sales_count'</span>].<span>'</span></em> </div> <div>'.<span>$watermark_img</span>.<span>'</span> </div> </div>'</span> );*/ <span>$collectStr</span> = <span>''</span>; <span>if</span>(<span>$vo</span>[<span>'collect'</span>]){ //如果已经搜藏了那么 <span>$collectStr</span> = <span>'<a>$vo</a></span>[<span>'goods_id'</span>].<span>')">'</span>; }<span>else</span>{ //如果没有搜藏那么 <span>$collectStr</span> = <span>'<a>$vo</a></span>[<span>'goods_id'</span>].<span>')">'</span>; } <span>$sayList</span>[] = array( <span>'pro-inner'</span>=><span>' <a href="'</span>.<span>%24vo</span>%5B<span>'url'</span>%5D.<span>'"> <img src="/static/imghwm/default1.png" data-src="'</span>.<span>$config</span>[<span>'site_url'</span>].<span>$vo</span>[<span>'goods_thumb'</span>].<span>'" class="lazy" alt="The mobile etouch based on ecshop implements dynamic acquisition of classified product lists" >.<span>$config</span>[<span>'site_url'</span>].<span>$vo</span>[<span>'goods_thumb'</span>].<span>'" alt="基于ecshop的移动端 etouch实现动态获取分类商品列表"</span>.<span>$vo</span>[<span>'goods_name'</span>].<span>'"> </span></a> <div> <span> '</span>.<span>$vo</span>[<span>'name'</span>].<span>' </span> <p> <span>'</span>. <span>$shop_price</span> .<span>'</span> </p> <p> 月销:'.<span>$vo</span>[<span>'sales_count'</span>].<span>' </span></p> </div> '</span>.<span>$collectStr</span>.<span>' <div> <!--<span data-operation="pre" data-goods-id="'</span>.<span>$vo</span>[<span>'goods_id'</span>].<span>'"></span>--> <input type="number" name="number" value="1" min="1" max="1"> <span data-operation="next" data-goods-id="'</span>.<span>$vo</span>[<span>'goods_id'</span>].<span>'"></span> </div> '</span> ); } } <span>echo</span> json_encode(<span>$sayList</span>); <span>exit</span>; }</span></code>
There is also a function called category_get_goods. This function adds a new field collect return field that can be used to determine whether it has been collected when rendering the front-end page view. And different styles are displayed and different event functions are bound depending on whether it is collected or not
<code><span>/** * 获得分类下的商品 * *<span> @access</span> public *<span> @param</span> string $children *<span> @return</span> array */</span><span><span>function</span><span>category_get_goods</span><span>(<span>$children</span>, <span>$brand</span>, <span>$min</span>, <span>$max</span>, <span>$ext</span>, <span>$size</span>, <span>$page</span>, <span>$sort</span>, <span>$order</span>)</span> {</span><span>$display</span> = <span>$GLOBALS</span>[<span>'display'</span>]; <span>$where</span> = <span>"g.is_on_sale = 1 AND g.is_alone_sale = 1 AND "</span>. <span>"g.is_delete = 0 AND ($children OR "</span> . get_extension_goods(<span>$children</span>) . <span>')'</span>; <span>if</span> (<span>$brand</span> > <span>0</span>) { <span>$where</span> .= <span>"AND g.brand_id=$brand "</span>; } <span>if</span> (<span>$min</span> > <span>0</span>) { <span>$where</span> .= <span>" AND g.shop_price >= $min "</span>; } <span>if</span> (<span>$max</span> > <span>0</span>) { <span>$where</span> .= <span>" AND g.shop_price ; } <span>/* 获得商品列表 */</span><span>$sql</span> = <span>'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, '</span> . <span>"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, g.goods_type, "</span> . <span>'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img '</span> . <span>'FROM '</span> . <span>$GLOBALS</span>[<span>'ecs'</span>]->table(<span>'goods'</span>) . <span>' AS g '</span> . <span>'LEFT JOIN '</span> . <span>$GLOBALS</span>[<span>'ecs'</span>]->table(<span>'member_price'</span>) . <span>' AS mp '</span> . <span>"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' "</span> . <span>"WHERE $where $ext ORDER BY $sort $order"</span>; <span>$res</span> = <span>$GLOBALS</span>[<span>'db'</span>]->selectLimit(<span>$sql</span>, <span>$size</span>, (<span>$page</span> - <span>1</span>) * <span>$size</span>); <span>$arr</span> = <span>array</span>(); <span>while</span> (<span>$row</span> = <span>$GLOBALS</span>[<span>'db'</span>]->fetchRow(<span>$res</span>)) { <span>if</span> (<span>$row</span>[<span>'promote_price'</span>] > <span>0</span>) { <span>$promote_price</span> = bargain_price(<span>$row</span>[<span>'promote_price'</span>], <span>$row</span>[<span>'promote_start_date'</span>], <span>$row</span>[<span>'promote_end_date'</span>]); } <span>else</span> { <span>$promote_price</span> = <span>0</span>; } <span>/* 处理商品水印图片 */</span><span>$watermark_img</span> = <span>''</span>; <span>if</span> (<span>$promote_price</span> != <span>0</span>) { <span>$watermark_img</span> = <span>"watermark_promote_small"</span>; } <span>elseif</span> (<span>$row</span>[<span>'is_new'</span>] != <span>0</span>) { <span>$watermark_img</span> = <span>"watermark_new_small"</span>; } <span>elseif</span> (<span>$row</span>[<span>'is_best'</span>] != <span>0</span>) { <span>$watermark_img</span> = <span>"watermark_best_small"</span>; } <span>elseif</span> (<span>$row</span>[<span>'is_hot'</span>] != <span>0</span>) { <span>$watermark_img</span> = <span>'watermark_hot_small'</span>; } <span>if</span> (<span>$watermark_img</span> != <span>''</span>) { <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'watermark_img'</span>] = <span>$watermark_img</span>; } <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'goods_id'</span>] = <span>$row</span>[<span>'goods_id'</span>]; <span>if</span>(<span>$display</span> == <span>'grid'</span>) { <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'goods_name'</span>] = <span>$GLOBALS</span>[<span>'_CFG'</span>][<span>'goods_name_length'</span>] > <span>0</span> ? sub_str(<span>$row</span>[<span>'goods_name'</span>], <span>$GLOBALS</span>[<span>'_CFG'</span>][<span>'goods_name_length'</span>]) : <span>$row</span>[<span>'goods_name'</span>]; } <span>else</span> { <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'goods_name'</span>] = <span>$row</span>[<span>'goods_name'</span>]; } <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'name'</span>] = <span>$row</span>[<span>'goods_name'</span>]; <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'goods_brief'</span>] = <span>$row</span>[<span>'goods_brief'</span>]; <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'goods_style_name'</span>] = add_style(<span>$row</span>[<span>'goods_name'</span>],<span>$row</span>[<span>'goods_name_style'</span>]); <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'market_price'</span>] = price_format(<span>$row</span>[<span>'market_price'</span>]); <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'shop_price'</span>] = price_format(<span>$row</span>[<span>'shop_price'</span>]); <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'type'</span>] = <span>$row</span>[<span>'goods_type'</span>]; <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'promote_price'</span>] = (<span>$promote_price</span> > <span>0</span>) ? price_format(<span>$promote_price</span>) : <span>''</span>; <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'goods_thumb'</span>] = get_image_path(<span>$row</span>[<span>'goods_id'</span>], <span>$row</span>[<span>'goods_thumb'</span>], <span>true</span>); <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'goods_img'</span>] = get_image_path(<span>$row</span>[<span>'goods_id'</span>], <span>$row</span>[<span>'goods_img'</span>]); <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'url'</span>] = build_uri(<span>'goods'</span>, <span>array</span>(<span>'gid'</span>=><span>$row</span>[<span>'goods_id'</span>]), <span>$row</span>[<span>'goods_name'</span>]); <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'sales_count'</span>] = get_sales_volume(<span>$row</span>[<span>'goods_id'</span>]); <span>//显示月销量 by wang</span><span>if</span> (<span>isset</span>(<span>$_SESSION</span>[<span>'user_id'</span>]) || <span>$_SESSION</span>[<span>'user_id'</span>] != <span>0</span>) { <span>/* 检查是否已经存在于用户的收藏夹 */</span><span>$sql</span> = <span>"SELECT COUNT(*) FROM "</span> .<span>$GLOBALS</span>[<span>'ecs'</span>]->table(<span>'collect_goods'</span>) . <span>" WHERE user_id='$_SESSION[user_id]' AND goods_id = '"</span>.<span>$row</span>[<span>'goods_id'</span>].<span>"'"</span>; <span>if</span> (<span>$GLOBALS</span>[<span>'db'</span>]->GetOne(<span>$sql</span>) > <span>0</span>) { <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'collect'</span>] = <span>1</span>; } <span>else</span> { <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'collect'</span>] = <span>0</span>; } }<span>else</span>{ <span>$arr</span>[<span>$row</span>[<span>'goods_id'</span>]][<span>'collect'</span>] = <span>0</span>; } } <span>return</span><span>$arr</span>; }</span></code>
Client js code reference
<code><span>/* * * 添加商品到收藏夹 */</span><span>var</span> _current_collect = <span>null</span>; <span>var</span> _current_goodsId = <span>0</span>; <span><span>function</span><span>collect</span><span>(_this,goodsId)</span> {</span> _current_collect = _this; _current_goodsId = goodsId; jQuery.get(<span>'user.php?act=collect'</span>,{id:goodsId},collectResponse,<span>"JSON"</span>); } <span><span>function</span><span>uncollect</span><span>(_this,goodsId)</span> {</span> _current_collect = _this; _current_goodsId = goodsId; jQuery.get(<span>'user.php?act=uncollect'</span>,{id:goodsId},collectResponse,<span>"JSON"</span>); } <span>/* * * 处理收藏商品的反馈信息 */</span><span><span>function</span><span>collectResponse</span><span>(result)</span> {</span><span>if</span>(<span>parseInt</span>(result.error) === <span>0</span>){ _current_collect.className = <span>''</span>; _current_collect.className =<span>"ycd-font-icon uncollect"</span>; _current_collect.setAttribute(<span>'onclick'</span>,<span>"uncollect(this,"</span>+_current_goodsId+<span>")"</span>); _current_collect.innerHTML = <span>''</span>; } <span>if</span>(<span>parseInt</span>(result.error) === <span>3</span>){ _current_collect.className = <span>''</span>; _current_collect.className =<span>"ycd-font-icon collect"</span>; _current_collect.setAttribute(<span>'onclick'</span>,<span>"collect(this,"</span>+_current_goodsId+<span>")"</span>); _current_collect.innerHTML = <span>''</span>; } <span>//这里加入成功</span><span>//注意这里引入了一个自己写的基于zepto移动端函数库的一个插件 请参考我以前写的一篇文章里面有这个插件的代码</span> Zepto(<span>'body'</span>).popup({ title:<span>'提示信息'</span> ,id:<span>'alert'</span> ,closeOnOk:<span>true</span> ,ok:<span>'确定'</span>, message:result.message }); }</code>
Summary
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });I used to like PHP very much. I worked on it for a while, so I can basically understand mysql in PHP code. Also learned
Children's shoes without PHP basics can learn PHP basics first
Now the blogger is working hard to specialize in front-end and back-end. Recently, he has learned the new APIs of javascript and html5.
Record your work
The above introduces the mobile terminal etouch based on ecshop to dynamically obtain the list of classified products, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

许多用户在选择智能手表的时候都会选择的华为的品牌,其中华为GT3pro和GT4都是非常热门的选择,不少用户都很好奇华为GT3pro和GT4有什么区别,下面就就给大家介绍一下二者。华为GT3pro和GT4有什么区别一、外观GT4:46mm和41mm,材质是玻璃表镜+不锈钢机身+高分纤维后壳。GT3pro:46.6mm和42.9mm,材质是蓝宝石玻璃表镜+钛金属机身/陶瓷机身+陶瓷后壳二、健康GT4:采用最新的华为Truseen5.5+算法,结果会更加的精准。GT3pro:多了ECG心电图和血管及安

Fujifilm fans were recently very excited at the prospect of the X-T50, since it presented a relaunch of the budget-oriented Fujifilm X-T30 II that had become quite popular in the sub-$1,000 APS-C category. Unfortunately, as the Fujifilm X-T50's launc

TheFiiOCP13cassetteplayerwasannouncedinJanuary.Now,FiiOisexpandingitsportfoliowithtwonewmodels-onewitharedfrontandonewithatransparentfront.Thelatternotonlyperfectlymatchestheretrocharmoftheangulardesign,butalso

为什么截图工具在Windows11上不起作用了解问题的根本原因有助于找到正确的解决方案。以下是截图工具可能无法正常工作的主要原因:对焦助手已打开:这可以防止截图工具打开。应用程序损坏:如果截图工具在启动时崩溃,则可能已损坏。过时的图形驱动程序:不兼容的驱动程序可能会干扰截图工具。来自其他应用程序的干扰:其他正在运行的应用程序可能与截图工具冲突。证书已过期:升级过程中的错误可能会导致此issu简单的解决方案这些适合大多数用户,不需要任何特殊的技术知识。1.更新窗口和Microsoft应用商店应用程

The Klipsch Flexus Core 300 is the top model in the series and is positioned above the already available Flexus Core 200 in the company's soundbar line-up. According to Klipsch, this is the first soundbar in the world whose sound can be adapted to th

WhiletheLightPhone2from2018wasstillequippedwithaneconomicale-inkdisplay,theLightPhone3usesanOLEDdisplaythatcanonlydisplaygrayscale.Thereasonfortheswitchtothe3.92-inchOLEDpanelwithitsresolutionof1,240x1,080isth

第1部分:初始故障排除步骤检查苹果的系统状态:在深入研究复杂的解决方案之前,让我们从基础知识开始。问题可能不在于您的设备;苹果的服务器可能会关闭。访问Apple的系统状态页面,查看AppStore是否正常工作。如果有问题,您所能做的就是等待Apple修复它。检查您的互联网连接:确保您拥有稳定的互联网连接,因为“无法连接到AppStore”问题有时可归因于连接不良。尝试在Wi-Fi和移动数据之间切换或重置网络设置(“常规”>“重置”>“重置网络设置”>设置)。更新您的iOS版本:

Shortly after Tesla launched the Model 3 Highland refresh towards the end of last year, the US federal EV tax incentive rules changed, cutting the potential discount in half for eligible buyers because of Tesla's use of Chinese LFP cells in the new M


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver Mac version
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Notepad++7.3.1
Easy-to-use and free code editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.
