本文整理汇总了PHP中Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::addAttributeToSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::addAttributeToSelect方法的具体用法?PHP Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::addAttributeToSelect怎么用?PHP Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::addAttributeToSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::addAttributeToSelect方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareProductCollection
/**
* Enter description here...
*
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
* @return Mage_Catalog_Model_Layer
*/
public function prepareProductCollection($collection)
{
$collection->addAttributeToSelect('name')->addAttributeToSelect('url_key')->addAttributeToSelect('price')->addAttributeToSelect('special_price')->addAttributeToSelect('special_from_date')->addAttributeToSelect('special_to_date')->joinMinimalPrice()->addAttributeToSelect('description')->addAttributeToSelect('short_description')->addAttributeToSelect('image')->addAttributeToSelect('thumbnail')->addAttributeToSelect('small_image')->addAttributeToSelect('tax_class_id')->addStoreFilter();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
return $this;
}
示例2: prepareProductCollection
/**
* Prepare product collection
*
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
* @return Mage_Catalog_Model_Layer
*/
public function prepareProductCollection($collection)
{
$collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addSearchFilter(Mage::helper('catalogsearch')->getQuery()->getQueryText())->setStore(Mage::app()->getStore())->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addStoreFilter()->addUrlRewrite();
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($collection);
return $this;
}
示例3: doCollection
function doCollection()
{
$collection = new Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection();
$collection->setStoreId(Mage::app()->getStore()->getId());
$collection->addAttributeToSelect('*');
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
// Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
return $collection;
}
示例4: collectValidatedAttributes
/**
* Collect validated attributes
*
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $productCollection
* @return Mage_CatalogRule_Model_Rule_Condition_Product
*/
public function collectValidatedAttributes($productCollection)
{
$attribute = $this->getAttribute();
if ($attribute == 'category_ids' || $this->isFilterCustom($attribute)) {
return $this;
}
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;
}
示例5: prepareProductCollection
/**
* Filter product collection
*
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
* @return Mage_Catalog_Model_Layer
*/
public function prepareProductCollection($collection)
{
$rule = $this->getRule();
if ($rule->getData('show_outofstock') == 2) {
$collection->joinField('stock_status', 'cataloginventory/stock_status', 'stock_status', 'product_id=entity_id', array('stock_status' => Mage_CatalogInventory_Model_Stock_Status::STATUS_IN_STOCK, 'website_id' => Mage::app()->getWebsite()->getWebsiteId()));
}
$collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addMinimalPrice()->addFinalPrice()->addTaxPercents();
/*Filter min, max price*/
$this->currentRate = Mage::app()->getStore()->getCurrentCurrencyRate();
$max = $this->getMaxPriceFilter();
$min = $this->getMinPriceFilter();
if ($min && $max) {
$collection->getSelect()->where(' final_price >= "' . $min . '" AND final_price <= "' . $max . '" ');
}
/*End Filter min, max price*/
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
//$this->_productCollections = $collection;
return $this;
}
示例6: prepareProductCollection
/**
* Initialize product collection
*
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
* @return Mage_Catalog_Model_Layer
*/
public function prepareProductCollection($collection)
{
$collection
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->addMinimalPrice()
->addFinalPrice()
->addTaxPercents()
->addUrlRewrite($this->getCurrentCategory()->getId());
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
return $this;
}
示例7: prepareProductCollection
/**
* Initialize product collection
*
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
* @return Mage_Catalog_Model_Layer
*/
public function prepareProductCollection($collection)
{
if (strtolower($this->getCurrentCategory()->getName()) == "new arrivals") {
$todayDate = date("Y-m-d H:i:s", Mage::getModel('core/date')->timestamp(time()));
//$date_band = Mage::getStoreConfig("inventory/date_setting/old_after");
/*
if($date_band == ""){
$date_band = 100;
}
*/
$collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addUrlRewrite($this->getCurrentCategory()->getId())->addAttributeToFilter('news_from_date', array('lteq' => $todayDate));
//$collection->getSelect()->where("DATE_ADD(`at_news_from_date_default`.value,INTERVAL ".$date_band." DAY) >= ?",$todayDate);
} else {
$collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addUrlRewrite($this->getCurrentCategory()->getId());
}
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
return $this;
}
示例8: collectValidatedAttributes
/**
* Collect validated attributes
*
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $productCollection
* @return Mage_CatalogRule_Model_Rule_Condition_Product
*/
public function collectValidatedAttributes($productCollection)
{
if ($this->getAttribute() == 'category_ids') {
return $this;
}
$attributes = $this->getRule()->getCollectedAttributes();
$attributes[$this->getAttribute()] = true;
$this->getRule()->setCollectedAttributes($attributes);
$productCollection->addAttributeToSelect($this->getAttribute(), 'left');
return $this;
}
示例9: prepareProductCollection
/**
* Initialize product collection
*
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
* @return Mage_Catalog_Model_Layer
*/
public function prepareProductCollection($collection)
{
$collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addUrlRewrite($this->getCurrentCategory()->getId());
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
//Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
$collection->addFieldToFilter('visibility', Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH);
//$collection->addAttributeToFilter('sku', array('eq' => 'TTE7QSA43'));
return $this;
}
示例10: prepareProductCollection
/**
* Initialize product collection
*
* @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
* @return Mage_Catalog_Model_Layer
*/
public function prepareProductCollection($collection)
{
$session = Mage::getSingleton('customer/session');
$isCorporate = FALSE;
if ($session->isLoggedIn()) {
$customer = $session->getCustomer();
$isCorporate = $customer->getZiscorporate();
}
$collection->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())->addMinimalPrice()->addFinalPrice()->addTaxPercents()->addUrlRewrite($this->getCurrentCategory()->getId());
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
if ($isCorporate != 470) {
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);
}
return $this;
}