English 中文(简体)
Magento 不以我认为应该的方式行事的图谋
原标题:Magento addAttributeToFilter not working the way I think it should
  • 时间:2011-02-28 18:53:12
  •  标签:
  • php
  • magento

我有一份产品称号,我已经将网站(从理论上讲,每个界定的网站都有所不同)。

然而,出于某种原因,我用在补充词中,似乎忽略了这一点。

请允许我向各位介绍我正在使用的法典:

$total_products_obj = Mage::getModel( catalog/product )
  ->getCollection()
  ->addAttributeToSelect( * )
  ->addAttributeToFilter( discontinued , array( neq  => 1) )
  ->addAttributeToFilter( video_url , array( notnull  =>   ) );

我的属性是录像。 和 我说,其范围已定在网站,因为网站已停办,是一个全球特征。

我没有真正与网站特性做许多工作,我是否还需要做些什么才能使这一特性不被忽略? 现在,我正在收集所有停产的产品,这些产品不等于1种。

最佳回答

我放弃了旧金加log产品,并开始按预期工作。

问题回答

我已经找到了工作。 相反,使用这种方法的阵列本实际上是为了形成一种OR条件。 这产生了正确的结构。

E.g.

->addAttributeToFilter( array( array( attribute => video_url , notnull => ) ))

这只是很奇怪的,但允许你仍然使用固定的log。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签