当前位置: 首页>>代码示例>>PHP>>正文


PHP AO::getResourceSingleton方法代码示例

本文整理汇总了PHP中AO::getResourceSingleton方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::getResourceSingleton方法的具体用法?PHP AO::getResourceSingleton怎么用?PHP AO::getResourceSingleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AO的用法示例。


在下文中一共展示了AO::getResourceSingleton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getResource

 public function getResource()
 {
     if (!$this->_resource) {
         $this->_resource = AO::getResourceSingleton('catalog_entity/convert');
     }
     return $this->_resource;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Convert_Adapter_Catalog.php

示例2: getQueueCollection

 /**
  * Return queue collection with loaded neversent queues
  *
  * @return Mage_Newsletter_Model_Mysql4_Queue_Collection
  */
 public function getQueueCollection()
 {
     if (is_null($this->_queueCollection)) {
         $this->_queueCollection = AO::getResourceSingleton('newsletter/queue_collection')->addTemplateInfo()->addOnlyUnsentFilter()->load();
     }
     return $this->_queueCollection;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:12,代码来源:Newsletter_Subscriber.php

示例3: joinCustomers

 public function joinCustomers()
 {
     $customer = AO::getResourceSingleton('customer/customer');
     //TODO: add full name logic
     $firstnameAttr = $customer->getAttribute('firstname');
     $firstnameAttrId = $firstnameAttr->getAttributeId();
     $firstnameTable = $firstnameAttr->getBackend()->getTable();
     if ($firstnameAttr->getBackend()->isStatic()) {
         $firstnameField = 'firstname';
         $attrCondition = '';
     } else {
         $firstnameField = 'value';
         $attrCondition = ' AND _table_customer_firstname.attribute_id = ' . $firstnameAttrId;
     }
     $this->getSelect()->joinInner(array('_table_customer_firstname' => $firstnameTable), '_table_customer_firstname.entity_id=detail.customer_id' . $attrCondition, array());
     $lastnameAttr = $customer->getAttribute('lastname');
     $lastnameAttrId = $lastnameAttr->getAttributeId();
     $lastnameTable = $lastnameAttr->getBackend()->getTable();
     if ($lastnameAttr->getBackend()->isStatic()) {
         $lastnameField = 'lastname';
         $attrCondition = '';
     } else {
         $lastnameField = 'value';
         $attrCondition = ' AND _table_customer_lastname.attribute_id = ' . $lastnameAttrId;
     }
     $this->getSelect()->joinInner(array('_table_customer_lastname' => $lastnameTable), '_table_customer_lastname.entity_id=detail.customer_id' . $attrCondition, array())->from("", array('customer_name' => "CONCAT(_table_customer_firstname.{$firstnameField}, ' ', _table_customer_lastname.{$lastnameField})", 'review_cnt' => "COUNT(main_table.review_id)"))->group('detail.customer_id');
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:28,代码来源:Mysql4_Review_Customer_Collection.php

示例4: addItemCountExpr

 /**
  * Add order items count expression
  *
  * @return Mage_Sales_Model_Mysql4_Order_Collection
  */
 public function addItemCountExpr()
 {
     $orderTable = $this->getEntity()->getEntityTable();
     $orderItemEntityTypeId = AO::getResourceSingleton('sales/order_item')->getTypeId();
     $this->getSelect()->join(array('items' => $orderTable), 'items.parent_id=e.entity_id and items.entity_type_id=' . $orderItemEntityTypeId, array('items_count' => new Zend_Db_Expr('COUNT(items.entity_id)')))->group('e.entity_id');
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:12,代码来源:Mysql4_Order_Collection.php

示例5: getEntity

 public function getEntity()
 {
     if (!$this->_entityType) {
         if (!($entityType = $this->getVar('entity_type')) || !($entity = AO::getResourceSingleton($entityType)) instanceof Mage_Eav_Model_Entity_Interface) {
             $this->addException(AO::helper('eav')->__('Invalid entity specified'), Varien_Convert_Exception::FATAL);
         }
         $this->_entity = $entity;
     }
     return $this->_entity;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:10,代码来源:Convert_Adapter_Grid.php

示例6: _prepareCollection

 /**
  * Prepare collection for grid
  *
  * @return Mage_Adminhtml_Block_Customer_Online_Grid
  */
 protected function _prepareCollection()
 {
     $collection = AO::getResourceSingleton('log/visitor_collection')->useOnlineFilter();
     $this->setCollection($collection);
     parent::_prepareCollection();
     foreach ($this->getCollection()->getItems() as $item) {
         $item->addIpData($item)->addQuoteData($item);
     }
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:15,代码来源:Customer_Online_Grid.php

示例7: _beforeSave

 /**
  * Check for email dublicates before saving customers sharing options
  *
  * @return Mage_Customer_Model_Config_Share
  * @throws Mage_Core_Exception
  */
 public function _beforeSave()
 {
     $value = $this->getValue();
     if ($value == self::SHARE_GLOBAL) {
         if (AO::getResourceSingleton('customer/customer')->findEmailDuplicates()) {
             AO::throwException(AO::helper('customer')->__('Can\'t share customer accounts global. Because some customer accounts with same emails exist on multiple websites and cannot be merged.'));
         }
     }
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:16,代码来源:Config_Share.php

示例8: _prepareCollection

 /**
  * Prepare collection for grid
  *
  * @return Mage_Adminhtml_Block_Widget_Grid
  */
 protected function _prepareCollection()
 {
     $collection = AO::getResourceSingleton('newsletter/subscriber_collection');
     /* @var $collection Mage_Newsletter_Model_Mysql4_Subscriber_Collection */
     $collection->showCustomerInfo(true)->addSubscriberTypeField()->showStoreInfo();
     if ($this->getRequest()->getParam('queue', false)) {
         $collection->useQueue(AO::getModel('newsletter/queue')->load($this->getRequest()->getParam('queue')));
     }
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:16,代码来源:Newsletter_Subscriber_Grid.php

示例9: getResource

 /**
  * @return Mage_Catalog_Model_Mysql4_Convert
  */
 public function getResource()
 {
     if (!$this->_resource) {
         $this->_resource = AO::getResourceSingleton('catalog_entity/convert');
         #->loadStores()
         #->loadProducts()
         #->loadAttributeSets()
         #->loadAttributeOptions();
     }
     return $this->_resource;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:14,代码来源:Convert_Parser_Product.php

示例10: start

 /**
  * Conigure and start session
  *
  * @param string $sessionName
  * @return Mage_Core_Model_Session_Abstract_Varien
  */
 public function start($sessionName = null)
 {
     if (isset($_SESSION)) {
         return $this;
     }
     if (VPROF) {
         Varien_Profiler::start(__METHOD__ . '/setOptions');
     }
     if (is_writable(AO::getBaseDir('session'))) {
         session_save_path($this->getSessionSavePath());
     }
     if (VPROF) {
         Varien_Profiler::stop(__METHOD__ . '/setOptions');
     }
     switch ($this->getSessionSaveMethod()) {
         case 'db':
             ini_set('session.save_handler', 'user');
             $sessionResource = AO::getResourceSingleton('core/session');
             /* @var $sessionResource Mage_Core_Model_Mysql4_Session */
             $sessionResource->setSaveHandler();
             break;
         case 'memcache':
             ini_set('session.save_handler', 'memcache');
             session_save_path($this->getSessionSavePath());
             break;
         default:
             session_module_name('files');
             break;
     }
     AO::dispatchEvent('core_session_before_set_cookie_params');
     // set session cookie params
     session_set_cookie_params($this->getCookie()->getLifetime(), $this->getCookie()->getPath(), $this->getCookie()->getDomain(), $this->getCookie()->isSecure(), $this->getCookie()->getHttponly());
     if (!empty($sessionName)) {
         session_name($sessionName);
     }
     // potential custom logic for session id (ex. switching between hosts)
     $this->setSessionId();
     if (VPROF) {
         Varien_Profiler::start(__METHOD__ . '/start');
     }
     if ($sessionCacheLimiter = AO::getConfig()->getNode('global/session_cache_limiter')) {
         session_cache_limiter((string) $sessionCacheLimiter);
     }
     session_start();
     if (VPROF) {
         Varien_Profiler::stop(__METHOD__ . '/start');
     }
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:55,代码来源:Session_Abstract_Varien.php

示例11: _prepareData

 protected function _prepareData()
 {
     $product = AO::registry('product');
     /* @var $product Mage_Catalog_Model_Product */
     $this->_itemCollection = $product->getRelatedProductCollection()->addAttributeToSelect('required_options')->addAttributeToSort('position', 'asc')->addStoreFilter();
     AO::getResourceSingleton('checkout/cart')->addExcludeProductFilter($this->_itemCollection, AO::getSingleton('checkout/session')->getQuoteId());
     $this->_addProductAttributesAndPrices($this->_itemCollection);
     //        AO::getSingleton('catalog/product_status')->addSaleableFilterToCollection($this->_itemCollection);
     AO::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($this->_itemCollection);
     $this->_itemCollection->load();
     foreach ($this->_itemCollection as $product) {
         $product->setDoNotUseCategoryId(true);
     }
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:15,代码来源:Product_List_Related.php

示例12: loadAttributeOptions

 /**
  * Load attribute options
  *
  * @return Mage_CatalogRule_Model_Rule_Condition_Product
  */
 public function loadAttributeOptions()
 {
     $productAttributes = AO::getResourceSingleton('catalog/product')->loadAllAttributes()->getAttributesByCode();
     $attributes = array();
     foreach ($productAttributes as $attribute) {
         /* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
         if (!$attribute->isAllowedForRuleCondition() || !$attribute->getIsUsedForPriceRules()) {
             continue;
         }
         $attributes[$attribute->getAttributeCode()] = $attribute->getFrontendLabel();
     }
     $this->_addSpecialAttributes($attributes);
     asort($attributes);
     $this->setAttributeOption($attributes);
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:21,代码来源:Rule_Condition_Product.php

示例13: _initCollection

 protected function _initCollection()
 {
     $isFilter = $this->getParam('store') || $this->getParam('website') || $this->getParam('group');
     $this->_collection = AO::getResourceSingleton('reports/order_collection')->prepareSummary($this->getParam('period'), 0, 0, $isFilter);
     if ($this->getParam('store')) {
         $this->_collection->addAttributeToFilter('store_id', $this->getParam('store'));
     } else {
         if ($this->getParam('website')) {
             $storeIds = AO::app()->getWebsite($this->getParam('website'))->getStoreIds();
             $this->_collection->addAttributeToFilter('store_id', array('in' => implode(',', $storeIds)));
         } else {
             if ($this->getParam('group')) {
                 $storeIds = AO::app()->getGroup($this->getParam('group'))->getStoreIds();
                 $this->_collection->addAttributeToFilter('store_id', array('in' => implode(',', $storeIds)));
             }
         }
     }
     $this->_collection->load();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:19,代码来源:Order.php

示例14: __construct

 public function __construct()
 {
     $this->_objectId = 'order_id';
     $this->_controller = 'sales_order';
     $this->_mode = 'view';
     parent::__construct();
     $this->_removeButton('delete');
     $this->_removeButton('reset');
     $this->_removeButton('save');
     $this->setId('sales_order_view');
     if ($this->_isAllowedAction('edit') && $this->getOrder()->canEdit()) {
         $onclickJs = 'deleteConfirm(\'' . AO::helper('sales')->__('Are you sure? This order will be cancelled and a new one will be created instead') . '\', \'' . $this->getEditUrl() . '\');';
         $this->_addButton('order_edit', array('label' => AO::helper('sales')->__('Edit'), 'onclick' => $onclickJs));
         // see if order has non-editable products as items
         $nonEditableTypes = array_keys(AO::getResourceSingleton('sales/order')->aggregateProductsByTypes($this->getOrder()->getId(), array_keys(AO::getConfig()->getNode('adminhtml/sales/order/create/available_product_types')->asArray()), false));
         if ($nonEditableTypes) {
             $this->_updateButton('order_edit', 'onclick', 'if (!confirm(\'' . AO::helper('sales')->__('This order contains (%s) items and therefore cannot be edited through the admin interface at this time, if you wish to continue editing the (%s) items will be removed, the order will be cancelled and a new order will be placed', implode(', ', $nonEditableTypes), implode(', ', $nonEditableTypes)) . '\')) return false;' . $onclickJs);
         }
     }
     if ($this->_isAllowedAction('cancel') && $this->getOrder()->canCancel()) {
         $message = AO::helper('sales')->__('Are you sure you want to cancel this order?');
         $this->_addButton('order_cancel', array('label' => AO::helper('sales')->__('Cancel'), 'onclick' => 'deleteConfirm(\'' . $message . '\', \'' . $this->getCancelUrl() . '\')'));
     }
     if ($this->_isAllowedAction('creditmemo') && $this->getOrder()->canCreditmemo()) {
         $this->_addButton('order_creditmemo', array('label' => AO::helper('sales')->__('Credit Memo'), 'onclick' => 'setLocation(\'' . $this->getCreditmemoUrl() . '\')'));
     }
     if ($this->_isAllowedAction('hold') && $this->getOrder()->canHold()) {
         $this->_addButton('order_hold', array('label' => AO::helper('sales')->__('Hold'), 'onclick' => 'setLocation(\'' . $this->getHoldUrl() . '\')'));
     }
     if ($this->_isAllowedAction('unhold') && $this->getOrder()->canUnhold()) {
         $this->_addButton('order_unhold', array('label' => AO::helper('sales')->__('Unhold'), 'onclick' => 'setLocation(\'' . $this->getUnholdUrl() . '\')'));
     }
     if ($this->_isAllowedAction('invoice') && $this->getOrder()->canInvoice()) {
         $this->_addButton('order_invoice', array('label' => AO::helper('sales')->__('Invoice'), 'onclick' => 'setLocation(\'' . $this->getInvoiceUrl() . '\')'));
     }
     if ($this->_isAllowedAction('ship') && $this->getOrder()->canShip()) {
         $this->_addButton('order_ship', array('label' => AO::helper('sales')->__('Ship'), 'onclick' => 'setLocation(\'' . $this->getShipUrl() . '\')'));
     }
     if ($this->_isAllowedAction('reorder') && $this->getOrder()->canReorder()) {
         $this->_addButton('order_reorder', array('label' => AO::helper('sales')->__('Reorder'), 'onclick' => 'setLocation(\'' . $this->getReorderUrl() . '\')'));
     }
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:42,代码来源:Sales_Order_View.php

示例15: getItemCollection

 /**
  * Retrieve item collection
  *
  * @return mixed
  */
 public function getItemCollection()
 {
     $productCollection = $this->getData('item_collection');
     if (is_null($productCollection)) {
         // get products to skip
         $skipProducts = array();
         if ($collection = $this->getCreateOrderModel()->getCustomerCompareList()) {
             $collection = $collection->getItemCollection()->useProductItem(true)->setStoreId($this->getStoreId())->setCustomerId($this->getCustomerId())->load();
             foreach ($collection as $_item) {
                 $skipProducts[] = $_item->getProductId();
             }
         }
         // prepare products collection and apply visitors log to it
         $productCollection = AO::getModel('catalog/product')->getCollection()->addAttributeToSelect('name')->addAttributeToSelect('price')->addAttributeToSelect('small_image');
         AO::getResourceSingleton('reports/event')->applyLogToCollection($productCollection, Mage_Reports_Model_Event::EVENT_PRODUCT_COMPARE, $this->getCustomerId(), 0, $skipProducts);
         $productCollection->load();
         $this->setData('item_collection', $productCollection);
     }
     return $productCollection;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:25,代码来源:Sales_Order_Create_Sidebar_Pcompared.php


注:本文中的AO::getResourceSingleton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。