默认下 ShopNC 对商品详情的属性设置为"不限",这样的设置很奇怪,比如我创建了一个"发布年份"的属性,值总不能为“无限”吧?所以这里要解决两个问题:
1. 默认值的修改
2. 产品详情显示的问题(未设置的,不显示才比较友好)
1. [代码]添加一个 “请选择” 的选项
#file: /shop/templates/simplenc/seller/store_goods_add.step2.php #line: 202 # 添加一个 “请选择” 的选项 <select name="" attr="attr[<?php echo $k;?>][__NC__]" nc_type="attr_select"> <option value='' nc_type='-1'>请选择</option> <option value='不限' nc_type='0'>不限</option> <?php foreach ($val['value'] as $v){?> <option value="<?php echo $v['attr_value_name']?>" <?php if(isset($output['attr_checked']) && in_array($v['attr_value_id'], $output['attr_checked'])){?>selected="selected"<?php }?> nc_type="<?php echo $v['attr_value_id'];?>"> <?php echo $v['attr_value_name'];?></option> <?php }?> </select>
2. [代码]判断属性值是否为空
#file: \shop\templates\simplenc\store\goods.php #line: 269 # 判断属性值是否为空 <?php if(is_array($output['goods']['goods_attr']) && !empty($output['goods']['goods_attr'])){?> <?php foreach ($output['goods']['goods_attr'] as $val) { $val= array_values($val); if ($val[1]) { echo '<li>'.$val[0].$lang['nc_colon'].$val[1].'</li>'; } }?> <?php }?>
以上就是ShopNC 隐藏未设置的商品详情属性(默认为不限)的内容,更多相关内容请关注PHP中文网(www.php.cn)!

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
