Jump to content

如何让产品名称显示限定数个字符!


Guest Steven_king

Recommended Posts

大家好,

我的网站产品排列变形了,如图,

原因是同一行里有的产品名称太长多占了一行导致的,

想请教如何让显示限定个产品名称字符

如ASP有个LEFT函数,但我不熟PHP,请教大家了!谢谢!

16318_QCiNREE2qAxGEnxcjhWk_t

Link to comment
Share on other sites

prestashop\css\global.css

/* product-list.tpl */

ul#product_list{ list-style-type:none;width:550px; }
ul#product_list li {
background: #d0d3d8 url('../img/block_category_item_bg.jpg') repeat-x;
padding: 1px;
float: left;
border: solid 1px #d0d3d8;
width:129px;
height:180px;
margin-bottom:0.3em;
margin-left:0.1em;
}
ul#product_list li a {
text-decoration:none;
color:#374853;
}

ul#product_list a.product_img_link{
border: solid 1px #d0d3d8;

margin-right:0.6em;
}

ul#product_list a.product_img_link img{
vertical-align:bottom;
}
ul#product_list li h3{ margin:0.4em 0; }
ul#product_list li .new{
background:transparent url(../img/flag_new_bg.jpg) repeat-x scroll 0%;
border:1px solid #488C40;
color:white;
font-size:0.6em;
font-weight:bold;
margin:0pt 1em 0pt 0pt;
padding:0pt 0.4em;
text-transform:uppercase;
vertical-align:0.3em;
}
ul#product_list li p.product_desc{ font-size:0.92em; }
ul#product_list li div.center_block{

width:74%;
}
ul#product_list li div.right_block{

text-align:center;
margin-left:1em;
margin-top:0;
}
ul#product_list li .discount{
color:#da0f00;
text-transform:uppercase;
font-weight:bold;
display: block;
}
ul#product_list li .on_sale{
color:#da0f00;
text-transform:uppercase;
font-weight:bold;
display: block;
}
ul#product_list li .reduction {
display: block;
margin-bottom: 0.3em;
}
ul#product_list li .price{
display: block;
font-size: 1.5em;
margin-bottom: 0.2em;
}
ul#product_list li span.availability{
float: right;
color:#488c40;
font-size:0.9em;
}
ul#product_list li a.button{ margin-top:0.5em; }



这里是我改的CSS,请教要改哪里才能解决上面的这个问题呢?

Link to comment
Share on other sites

  • 2 months later...
在相关的tpl里,有这段代码:{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}。调整truncate:后面的数字来定义产品名称的字符数。看你的附图,我觉得,根本原因是CSS没设置好。


我按照你说的改了,可是字还是那么多……

19849_YRvuYCATr7DxKUicvIhw_t

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...