小编Kay*_* Li的帖子

jquery具有AND OR条件的多个选择器

如果我有一个有4000行的表

<table>
<tr class="a b c d e f g"><td>xxx</td></tr>
<tr class="a c d e f g"><td>xxx</td></tr>
<tr class="d e f g"><td>xxx</td></tr>
<tr class="a d e f g"><td>xxx</td></tr>
.
.
.
.
.
</table>
Run Code Online (Sandbox Code Playgroud)

如果我想选择具有类(a或b或c)和(d或e)和(a或g)的行

如何编写选择器语句?

谢谢

html javascript jquery jquery-selectors

5
推荐指数
1
解决办法
892
查看次数

magento - 使用addAttributeToSort为自定义属性对产品集合进行排序 - 无法正常工作

我想通过getLoadedProductCollection进行排序.

对于产品属性,我有一个自定义属性'featured_product'

这是我的代码:

$sort=$_GET['s'];
$_productCollection=$this->getLoadedProductCollection()->addAttributeToSelect('featured_product');

$_productCollection->clear();
$_productCollection->getSelect()->reset(Zend_Db_Select::ORDER);

switch($sort)
{
    case 'lp':
    $_productCollection->addAttributeToSort('price', 'ASC');
    break;
    case 'hp':
    $_productCollection->addAttributeToSort('price', 'DESC');
    break;
    case 'fp':
    $_productCollection->addAttributeToSort('featured_product');

    break;
}
Run Code Online (Sandbox Code Playgroud)

对于前两种情况,它没有问题.

但第三个根本不起作用.

我想将所有特色产品移到收藏列表的开头.

如何更改实现第三种情况的代码?

谢谢

php sorting magento

4
推荐指数
1
解决办法
6911
查看次数

标签 统计

html ×1

javascript ×1

jquery ×1

jquery-selectors ×1

magento ×1

php ×1

sorting ×1