本文整理汇总了PHP中Mage_Core_Model_Mysql4_Collection_Abstract类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Mysql4_Collection_Abstract类的具体用法?PHP Mage_Core_Model_Mysql4_Collection_Abstract怎么用?PHP Mage_Core_Model_Mysql4_Collection_Abstract使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Core_Model_Mysql4_Collection_Abstract类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: toOptions
public function toOptions(Mage_Core_Model_Mysql4_Collection_Abstract $collection, array $fields)
{
$key = key($fields);
$value = $fields[$key];
$data = $collection->toArray(array($key, $value));
$result = '';
foreach ($data['items'] as $item) {
$result[$item[$key]] = $item[$value];
}
return $result;
}
开发者ID:rafaelferreiraxd,项目名称:modulos-magento,代码行数:11,代码来源:Data.php
示例2: _removeHiddenCollectionItems
/**
* Remove hidden items from a product or category collection
*
* @param Mage_Eav_Model_Entity_Collection_Abstract|Mage_Core_Model_Mysql4_Collection_Abstract $collection
*/
public function _removeHiddenCollectionItems($collection)
{
// Loop through each category or product
foreach ($collection as $key => $item) {
$catData = Mage::getModel("catalog/category")->load($item->getEntityId());
// If it is a category
if ($item->getEntityTypeId() == 3 && $item->getLevel() != 2) {
if (strtolower($catData->getUrlKey()) != 'get-the-look' && strtolower($catData->getUrlKey()) != 'new-arrivals') {
if ($this->getProductCountCustom($catData) <= 0) {
$collection->removeItemByKey($key);
}
}
}
}
}
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:20,代码来源:Observer.php
示例3: _init
/**
* Standard resource collection initalization
*
* @param string $model
* @return Mage_Core_Model_Mysql4_Collection_Abstract
*/
protected function _init($model, $resourceModel = null)
{
parent::_init($model, $resourceModel);
$this->_relationTable = $this->getMainTable() . '_relation';
$this->_localeTable = $this->getMainTable() . '_locale';
return $this;
}
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:13,代码来源:Abstract.php
示例4: _afterLoad
/**
* Unserialize additional_information in each item
* @return Mage_Core_Model_Mysql4_Collection_Abstract
*/
protected function _afterLoad()
{
foreach ($this->_items as $item) {
$this->getResource()->unserializeFields($item);
}
return parent::_afterLoad();
}
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:11,代码来源:Collection.php
示例5: _getMatchedIds
protected function _getMatchedIds($query)
{
if (!is_array($this->_attributes) || !count($this->_attributes)) {
Mage::throwException('Searchable attributes not defined');
}
$query = Mage::helper('core/string')->splitWords($query, true, 100);
$select = $this->_collection->getSelect();
$having = array();
foreach ($query as $word) {
$subhaving = array();
foreach ($this->_attributes as $attr => $weight) {
$subhaving[] = $this->_getCILike($attr, $word, array('position' => 'any'));
}
$having[] = '(' . implode(' OR ', $subhaving) . ')';
}
$havingCondition = implode(' AND ', $having);
if ($havingCondition != '') {
$select->having($havingCondition);
}
$read = Mage::getSingleton('core/resource')->getConnection('core_read');
$stmt = $read->query($select);
$result = array();
while ($row = $stmt->fetch(Zend_Db::FETCH_ASSOC)) {
$result[$row[$this->_primaryKey]] = 0;
}
return $result;
}
开发者ID:cesarfelip3,项目名称:clevermage_new,代码行数:27,代码来源:Search.php
示例6: _initSelect
protected function _initSelect()
{
parent::_initSelect();
$modelCat = Mage::getResourceSingleton('downloads/categories');
$this->getSelect()->joinLeft(array('relation' => $this->getTable('downloads/relation')), 'main_table.file_id = relation.file_id', array('products_count' => 'COUNT(relation.product_id)'))->joinLeft(array('cat' => $modelCat->getMainTable()), 'main_table.category_id = cat.category_id', array('title'))->group('main_table.file_id');
return $this;
}
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:7,代码来源:Collection.php
示例7: _afterLoad
protected function _afterLoad()
{
/*$items = $this->getColumnValues('post_id');
if (count($items)) {
$select = $this->getConnection()->select()
->from($this->getTable('store'))
->where($this->getTable('store').'.post_id IN (?)', $items);
if ($result = $this->getConnection()->fetchPairs($select)) {
foreach ($this as $item) {
if (!isset($result[$item->getData('post_id')])) {
continue;
}
if ($result[$item->getData('post_id')] == 0) {
$storeCode = key(Mage::app()->getStores(false, true));
} else {
$storeCode = Mage::app()->getStore($result[$item->getData('post_id')])->getCode();
}
$item->setData('store_code', $storeCode);
}
}
}*/
if (count($this) > 0) {
Mage::dispatchEvent("fontis_blog_post_collection_load_after", array("collection" => $this));
}
return parent::_afterLoad();
}
开发者ID:ikommerce,项目名称:fontis_blog,代码行数:26,代码来源:Collection.php
示例8: addFieldToFilter
public function addFieldToFilter($attribute, $condition = null)
{
if ($attribute == 'status') {
$attribute = 'main_table.' . $attribute;
}
return parent::addFieldToFilter($attribute, $condition);
}
开发者ID:Gilbertoavitia1,项目名称:AHBS,代码行数:7,代码来源:Collection.php
示例9: _initSelect
/**
*
*
* (overrides parent method)
*/
public function _initSelect()
{
parent::_initSelect();
// Add a simplified version of the transfer references (1 reference per 1 transfer)
$this->_addTransferReferences($this->_getSingleReferenceSelect());
return $this;
}
开发者ID:rajarshc,项目名称:Rooja,代码行数:12,代码来源:Collection.php
示例10: load
public function load($printQuery = false, $logQuery = false)
{
Varien_Profiler::start("aw::advancedreports::aggregator::load_collection");
parent::load($printQuery, $logQuery);
Varien_Profiler::stop("aw::advancedreports::aggregator::load_collection");
return $this;
}
开发者ID:webmaster4world,项目名称:manual-indexing,代码行数:7,代码来源:Collection.php
示例11: _initSelect
protected function _initSelect()
{
parent::_initSelect();
$select = $this->getSelect();
$select->join(array('cust' => $this->getTable('rewardpoints/customer_entity')), 'rewardpoints_referral_parent_id = cust.entity_id');
return $this;
}
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:7,代码来源:Collection.php
示例12: _afterLoad
/**
* After load processing - adds store information to the datasets
*
*/
protected function _afterLoad()
{
$connection = $this->getConnection();
foreach ($this as $item) {
$page_stores = array();
if ($alias = $item->getData("alias")) {
$cms_page = Mage::getModel("cms/page")->load($alias, "identifier");
if ($cms_page->getPageId()) {
$page_stores = $cms_page->getStoreId();
$select = $connection->select()->from(array('cps' => $this->getTable('cms/page_store')))->where('cps.page_id = (?)', $cms_page->getPageId());
if ($result = $connection->fetchPairs($select)) {
if ($result[$cms_page->getPageId()] == 0) {
$stores = Mage::app()->getStores(false, true);
$storeId = current($stores)->getId();
$storeCode = key($stores);
} else {
$storeId = $result[$cms_page->getPageId()];
$storeCode = Mage::app()->getStore($storeId)->getCode();
}
$item->setData('_first_store_id', $storeId);
$item->setData('store_code', $storeCode);
}
$stores = isset($stores) && $stores ? $stores : array(0);
$item->setData("store_id", $page_stores);
}
}
}
parent::_afterLoad();
}
开发者ID:booklein,项目名称:bookle,代码行数:33,代码来源:Collection.php
示例13: _afterLoad
/**
* @return Varien_Data_Collection_Db
*/
public function _afterLoad()
{
foreach ($this->getItems() as $item) {
$this->getResource()->unserializeFields($item);
}
return parent::_afterLoadData();
}
开发者ID:protechhelp,项目名称:gamamba,代码行数:10,代码来源:Collection.php
示例14: _initSelect
protected function _initSelect()
{
parent::_initSelect();
// $this->getSelect()->where('main_table.post_type=?', 'post')
// ->where('main_table.post_status=?', 'publish');
return $this;
}
开发者ID:AleksNesh,项目名称:pandora,代码行数:7,代码来源:Collection.php
示例15: _afterLoad
protected function _afterLoad()
{
parent::_afterLoad();
$this->_loadLabels();
$this->_loadPrices();
return $this;
}
开发者ID:arslbbt,项目名称:mangentovies,代码行数:7,代码来源:Collection.php
示例16: _afterLoad
protected function _afterLoad()
{
parent::_afterLoad();
if (VPROF) {
Varien_Profiler::start('TTT1:' . __METHOD__);
}
$this->_addProductAttributes();
if (VPROF) {
Varien_Profiler::stop('TTT1:' . __METHOD__);
}
if (VPROF) {
Varien_Profiler::start('TTT2:' . __METHOD__);
}
$this->_addAssociatedProductFilters();
if (VPROF) {
Varien_Profiler::stop('TTT2:' . __METHOD__);
}
if (VPROF) {
Varien_Profiler::start('TTT3:' . __METHOD__);
}
$this->_loadLabels();
if (VPROF) {
Varien_Profiler::stop('TTT3:' . __METHOD__);
}
if (VPROF) {
Varien_Profiler::start('TTT4:' . __METHOD__);
}
$this->_loadPrices();
if (VPROF) {
Varien_Profiler::stop('TTT4:' . __METHOD__);
}
return $this;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:33,代码来源:Resource_Eav_Mysql4_Product_Type_Configurable_Attribute_Collection.php
示例17: _afterLoad
protected function _afterLoad()
{
foreach ($this->_items as $i) {
$i->afterLoad();
}
return parent::_afterLoad();
}
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:7,代码来源:Collection.php
示例18: _afterLoadData
protected function _afterLoadData()
{
foreach ($this->getItems() as $item) {
Mage::getResourceModel('aw_giftcard/history')->unserializeFields($item);
}
return parent::_afterLoadData();
}
开发者ID:buttasg,项目名称:cowgirlk,代码行数:7,代码来源:Collection.php
示例19: _afterLoad
/**
* After load processing - adds store information to the datasets
*
*/
protected function _afterLoad()
{
if ($this->_previewFlag) {
$items = $this->getColumnValues('verticalmenu_id');
if (count($items)) {
$select = $this->getConnection()->select()->from($this->getTable('ves_verticalmenu/verticalmenu_store'))->where($this->getTable('ves_verticalmenu/verticalmenu_store') . '.verticalmenu_id IN (?)', $items);
if ($result = $this->getConnection()->fetchPairs($select)) {
foreach ($this as $item) {
if (!isset($result[$item->getData('verticalmenu_id')])) {
continue;
}
if ($result[$item->getData('verticalmenu_id')] == 0) {
$stores = Mage::app()->getStores(false, true);
$storeId = current($stores)->getId();
$storeCode = key($stores);
} else {
$storeId = $result[$item->getData('verticalmenu_id')];
$storeCode = Mage::app()->getStore($storeId)->getCode();
}
if ($item->getData('is_default') == 1) {
$this->setData('is_default', Mage::helper('ves_verticalmenu')->__('<span class="hightlight">Default</span>'));
} else {
$this->setData('is_default', Mage::helper('ves_verticalmenu')->__('No'));
}
$item->setData('_first_store_id', $storeId);
$item->setData('store_code', $storeCode);
}
}
}
}
parent::_afterLoad();
}
开发者ID:booklein,项目名称:bookle,代码行数:36,代码来源:Collection.php
示例20: _renderFiltersBefore
/**
* Join store relation table if there is store filter
*/
protected function _renderFiltersBefore()
{
if ($this->getFilter('store')) {
$this->getSelect()->join(array('store_table' => $this->getTable('category_store')), 'main_table.category_id = store_table.category_id', array())->group('main_table.category_id');
}
return parent::_renderFiltersBefore();
}
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:10,代码来源:Collection.php
注:本文中的Mage_Core_Model_Mysql4_Collection_Abstract类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论