本文整理汇总了PHP中Mage_Catalog_Model_Resource_Product_Collection::addAttributeToSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Resource_Product_Collection::addAttributeToSelect方法的具体用法?PHP Mage_Catalog_Model_Resource_Product_Collection::addAttributeToSelect怎么用?PHP Mage_Catalog_Model_Resource_Product_Collection::addAttributeToSelect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Resource_Product_Collection
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Resource_Product_Collection::addAttributeToSelect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collectValidatedAttributes
/**
* Collect validated attributes
*
* @param Mage_Catalog_Model_Resource_Product_Collection $productCollection
* @return Mage_CatalogRule_Model_Rule_Condition_Product
*/
public function collectValidatedAttributes($productCollection)
{
$attribute = $this->getAttribute();
if ('category_ids' != $attribute) {
if ($this->getAttributeObject()->isScopeGlobal()) {
$attributes = $this->getRule()->getCollectedAttributes();
$attributes[$attribute] = true;
$this->getRule()->setCollectedAttributes($attributes);
$productCollection->addAttributeToSelect($attribute, 'left');
} else {
$this->_entityAttributeValues = $productCollection->getAllAttributeValues($attribute);
}
}
return $this;
}
示例2: prepareProductCollection
/**
* Initialize product collection
*
* @param Mage_Catalog_Model_Resource_Product_Collection $collection
* @return Mage_Catalog_Model_Layer
*/
public function prepareProductCollection($collection)
{
$collection->addAttributeToSelect(Mage::getSingleton('Mage_Catalog_Model_Config')->getProductAttributes())->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addUrlRewrite($this->getCurrentCategory()->getId())->setVisibility(Mage::getSingleton('Mage_Catalog_Model_Product_Visibility')->getVisibleInCatalogIds());
return $this;
}
示例3: _prepareCollection
/**
*
* @param Mage_Catalog_Model_Resource_Product_Collection $collection
* @return Mage_Catalog_Model_Resource_Product_Collection
*/
protected function _prepareCollection($collection)
{
foreach ($this->getConditions() as $condition) {
$collection->addFieldToFilter($condition['attribute'], array($condition['operator'] => $condition['value']));
}
foreach ($this->_columns as $attr => $width) {
$collection->addAttributeToSelect($attr);
}
return $collection;
}
示例4: collectValidatedAttributes
/**
* @param Mage_Catalog_Model_Resource_Product_Collection $productCollection
*
* @return $this
*/
public function collectValidatedAttributes($productCollection)
{
$attribute = $this->getAttribute();
if (!in_array($attribute, array('category_ids', 'qty', 'php'))) {
if ($attribute == 'image_size' || $attribute == 'small_image_size' || $attribute == 'thumbnail_size') {
$attribute = str_replace('_size', '', $attribute);
}
$attributes = $this->getRule()->getCollectedAttributes();
$attributes[$attribute] = true;
$this->getRule()->setCollectedAttributes($attributes);
$productCollection->addAttributeToSelect($attribute, 'left');
}
return $this;
}