{"id":199526,"date":"2025-05-03T13:36:13","date_gmt":"2025-05-03T05:36:13","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199526\/"},"modified":"2025-05-03T13:36:13","modified_gmt":"2025-05-03T05:36:13","slug":"ecshop%e8%b0%83%e7%94%a8%e6%8c%87%e5%ae%9a%e6%a0%8f%e7%9b%ae%e4%b8%8b%e7%9a%84%e5%95%86%e5%93%81%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199526\/","title":{"rendered":"ecshop\u8c03\u7528\u6307\u5b9a\u680f\u76ee\u4e0b\u7684\u5546\u54c1\u7684\u65b9\u6cd5"},"content":{"rendered":"<p> ecshop\u8c03\u7528\u6307\u5b9a\u680f\u76ee\u4e0b\u7684\u5546\u54c1,\u7b2c\u4e00\u6b65<\/p>\n<p> \u5728ecshop\u7cfb\u7edf\u76ee\u5f55\u6587\u4ef6\u627e\u5230includes\/lib_goods.php &nbsp;\u8fd9\u4e2a\u6587\u4ef6\u6253\u5f00<\/p>\n<p> \u5728\u6b64\u9875\u6700\u5e95\u90e8\u52a0\u5165\u4ee5\u4e0b\u51fd\u6570\u4ee3\u7801<\/p>\n<pre>\r\n\/**\r\n \r\n * \u9996\u9875\u83b7\u53d6\u6307\u5b9a\u5206\u7c7b\u4ea7\u54c1\r\n \r\n *\r\n \r\n * @access      public\r\n \r\n * @param       string      $cat_id53_best_goods\r\n \r\n * @param       array       $cat_id53_best_goods\r\n \r\n * @return      array\r\n \r\n *\/\r\n \r\n  \r\n \r\nfunction index_get_cat_id_goods_best_list($cat_id = '', $num = '')\r\n \r\n{\r\n \r\n$sql = 'Select g.goods_id, g.cat_id,c.parent_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .\r\n \r\n\"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, \".\r\n \r\n\"promote_start_date, promote_end_date, g.goods_brief, g.goods_thumb, goods_img, \" .\r\n \r\n\"g.is_best, g.is_new, g.is_hot, g.is_promote \" .\r\n \r\n'FROM ' . $GLOBALS['ecs']-&gt;table('goods') . ' AS g ' .\r\n \r\n'LEFT JOIN ' . $GLOBALS['ecs']-&gt;table('category') . ' AS c ON c.cat_id = g.cat_id ' .\r\n \r\n\"LEFT JOIN \" . $GLOBALS['ecs']-&gt;table('member_price') . \" AS mp \".\r\n \r\n\"ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' \".\r\n \r\n\"Where g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 \".\r\n \r\n$sql .= \" AND (c.parent_id =\" . $cat_id. \" OR g.cat_id = \" . $cat_id .\" OR g.cat_id \". db_create_in(array_unique(array_merge(array($cat_id), array_keys(cat_list($cat_id, 0, false))))) .\")\";\r\n \r\n$sql .= \" LIMIT $num\";\r\n \r\n$res = $GLOBALS['db']-&gt;getAll($sql);\r\n \r\n$goods = array();\r\n \r\nforeach ($res AS $idx =&gt; $row)\r\n \r\n{\r\n \r\n$goods[$idx]['id'] = $row['article_id'];\r\n \r\n$goods[$idx]['id'] = $row['goods_id'];\r\n \r\n$goods[$idx]['name'] = $row['goods_name'];\r\n \r\n$goods[$idx]['brief'] = $row['goods_brief'];\r\n \r\n$goods[$idx]['brand_name'] = $row['brand_name'];\r\n \r\n$goods[$idx]['goods_style_name'] = add_style($row['goods_name'],$row['goods_name_style']);\r\n \r\n$goods[$idx]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] &gt; 0 ?\r\n \r\nsub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];\r\n \r\n$goods[$idx]['short_style_name'] = add_style($goods[$idx]['short_name'],$row['goods_name_style']);\r\n \r\n$goods[$idx]['market_price'] = price_format($row['market_price']);\r\n \r\n$goods[$idx]['shop_price'] = price_format($row['shop_price']);\r\n \r\n$goods[$idx]['thumb'] = empty($row['goods_thumb']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_thumb'];\r\n \r\n$goods[$idx]['goods_img'] = empty($row['goods_img']) ? $GLOBALS['_CFG']['no_picture'] : $row['goods_img'];\r\n \r\n$goods[$idx]['url'] = build_uri('goods', array('gid' =&gt; $row['goods_id']), $row['goods_name']);\r\n \r\n}\r\n \r\nreturn $goods;\r\n \r\n}<\/pre>\n<p> \u7b2c\u4e8c\u6b65<\/p>\n<p> \u6253\u5f00\u7cfb\u7edf\u6839\u76ee\u5f55\u4e0bindex.php\u6587\u4ef6\u52a0\u5165\u5982\u4e0b\u4ee3\u7801<\/p>\n<pre>\r\n$smarty-&gt;assign('cat_id53_best_goods', index_get_cat_id_goods_best_list(53,9));    \/\/ \u6307\u5b9a\u5546\u54c1\u8c03\u7528<\/pre>\n<p> \u5176\u4e2d53\u6307\u7684\u8c03\u7528\u7684\u680f\u76eeID\uff0c9\u6307\u7684\u662f\u8c03\u7528\u5546\u54c1\u7684\u6570\u91cf\u3002<\/p>\n<p> \u7b2c\u4e09\u6b65<\/p>\n<p> \u5728\u9996\u9875\u6a21\u7248\u4e2d\u8c03\u7528\u5373\u53ef\uff0c\u5982\u4e0b<\/p>\n<pre>\r\n&lt;!--{foreach from=$cat_id53_best_goods item=women}--&gt;\r\n \r\n    &lt;li&gt; &lt;a href=\"{$women.url}\" target=\"_blank\"&gt;&lt;img src=\"{$women.thumb}\" alt=\"{$women.name|escape:html}\" \/&gt;&lt;\/a&gt; &lt;span class=\"a_title\"&gt;&lt;a href=\"{$women.url}\" title=\"{$women.name|escape:html}\" target=\"_blank\"&gt;{$women.short_style_name}&lt;\/a&gt;&lt;\/span&gt;\r\n \r\n    &lt;div style=\"text-indent: 5px;\"&gt;\u5e02\u573a\u4ef7 &lt;span class=\"del\"&gt;{$women.market_price}&lt;\/span&gt;&lt;\/div&gt;&lt;div style=\"text-indent: 5px;\"&gt;&lt;span class=\"red\"&gt;\u552e \u4ef7 {$women.shop_price}&lt;\/span&gt;&lt;\/div&gt;&lt;\/li&gt;\r\n \r\n&lt;!--{\/foreach}--&gt;<\/pre>\n<p> \u6d4b\u8bd5\u8fc7\uff0c\u6210\u529f\u8c03\u7528\u6307\u5b9a\u5546\u54c1\u5206\u7c7b\u4e0b\u7684\u5185\u5bb9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ecshop\u8c03\u7528\u6307\u5b9a\u680f\u76ee\u4e0b\u7684\u5546\u54c1&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-199526","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=199526"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199526\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}