本文整理汇总了PHP中AO::getResourceModel方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::getResourceModel方法的具体用法?PHP AO::getResourceModel怎么用?PHP AO::getResourceModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AO
的用法示例。
在下文中一共展示了AO::getResourceModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareCollection
protected function _prepareCollection()
{
//TODO: add full name logic
$collection = AO::getResourceModel('reports/customer_collection')->addAttributeToSelect('firstname')->addAttributeToSelect('lastname');
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例2: _prepareCollection
protected function _prepareCollection()
{
$collection = AO::getResourceModel('reports/product_collection');
$collection->getEntity()->setStore(0);
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例3: getAllOptions
public function getAllOptions()
{
if (is_null($this->_options)) {
$this->_options = AO::getResourceModel('core/store_collection')->load()->toOptionArray();
}
return $this->_options;
}
示例4: _prepareCollection
protected function _prepareCollection()
{
$collection = AO::getResourceModel('reports/wishlist_product_collection')->addAttributeToSelect('entity_id')->addAttributeToSelect('name')->addWishlistCount();
$this->setCollection($collection);
parent::_prepareCollection();
return $this;
}
示例5: _prepareCollection
protected function _prepareCollection()
{
$collection = AO::getResourceModel('admin/role_collection');
$collection->setRolesFilter();
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例6: getAllOptions
public function getAllOptions()
{
if (!$this->_options) {
$this->_options = AO::getResourceModel('directory/region_collection')->load()->toOptionArray();
}
return $this->_options;
}
示例7: load
public function load($printQuery = false, $logQuery = false)
{
$this->_select = $this->_read->select();
$entityTable = $this->getEntity()->getEntityTable();
$paidTable = $this->getAttribute('grand_total')->getBackend()->getTable();
$idField = $this->getEntity()->getIdFieldName();
$this->getSelect()->from(array('sales' => $entityTable), array('store_id', 'lifetime' => 'sum(sales.base_grand_total)', 'avgsale' => 'avg(sales.base_grand_total)', 'num_orders' => 'count(sales.base_grand_total)'))->where('sales.entity_type_id=?', $this->getEntity()->getTypeId())->group('sales.store_id');
if ($this->_customer instanceof Mage_Customer_Model_Customer) {
$this->getSelect()->where('sales.customer_id=?', $this->_customer->getId());
}
$this->printLogQuery($printQuery, $logQuery);
try {
$values = $this->_read->fetchAll($this->getSelect()->__toString());
} catch (Exception $e) {
$this->printLogQuery(true, true, $this->getSelect()->__toString());
throw $e;
}
$stores = AO::getResourceModel('core/store_collection')->setWithoutDefaultFilter()->load()->toOptionHash();
if (!empty($values)) {
foreach ($values as $v) {
$obj = new Varien_Object($v);
$storeName = isset($stores[$obj->getStoreId()]) ? $stores[$obj->getStoreId()] : null;
$this->_items[$v['store_id']] = $obj;
$this->_items[$v['store_id']]->setStoreName($storeName);
$this->_items[$v['store_id']]->setAvgNormalized($obj->getAvgsale() * $obj->getNumOrders());
foreach ($this->_totals as $key => $value) {
$this->_totals[$key] += $obj->getData($key);
}
}
if ($this->_totals['num_orders']) {
$this->_totals['avgsale'] = $this->_totals['lifetime'] / $this->_totals['num_orders'];
}
}
return $this;
}
示例8: _prepareCollection
protected function _prepareCollection()
{
//TODO: add full name logic
$collection = AO::getResourceModel('sales/order_collection')->addAttributeToSelect('increment_id')->addAttributeToSelect('created_at')->addAttributeToSelect('grand_total')->addAttributeToSelect('order_currency_code')->addAttributeToSelect('store_id')->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id')->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id')->addAttributeToFilter('customer_id', AO::registry('current_customer')->getId());
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例9: save
public function save()
{
foreach ($this->getData() as $i => $row) {
$this->setExceptionLocation('Line: ' . $i);
$entity = AO::getResourceModel($this->getEntity());
if (!empty($row['entity_id'])) {
try {
$entity->load($row['entity_id']);
$this->setPosition('Line: ' . $i . (isset($row['entity_id']) ? ', entity_id: ' . $row['entity_id'] : ''));
} catch (Exception $e) {
$this->addException(AO::helper('eav')->__('Problem loading a record, aborting. Error: %s', $e->getMessage()), Varien_Convert_Exception::FATAL);
}
if (!$entity->getId()) {
$this->addException(AO::helper('eav')->__('Invalid entity_id, skipping the record'), Varien_Convert_Exception::ERROR);
continue;
}
}
try {
$entity->addData($row)->save();
} catch (Exception $e) {
$this->addException(AO::helper('eav')->__('Problem saving a record, aborting. Error: ', $e->getMessage()), Varien_Convert_Exception::FATAL);
}
}
return $this;
}
示例10: _toHtml
protected function _toHtml()
{
$rssObj = AO::getModel('rss/rss');
$order = AO::registry('current_order');
$title = AO::helper('rss')->__('Order # %s Notification(s)', $order->getIncrementId());
$newurl = AO::getUrl('sales/order/view', array('order_id' => $order->getId()));
$data = array('title' => $title, 'description' => $title, 'link' => $newurl, 'charset' => 'UTF-8');
$rssObj->_addHeader($data);
$resourceModel = AO::getResourceModel('rss/order');
$results = $resourceModel->getAllCommentCollection($order->getId());
$entityTypes = $resourceModel->getEntityTypeIdsToTypes();
$incrementIds = $resourceModel->getEntityIdsToIncrementIds();
if ($results) {
foreach ($results as $result) {
$urlAppend = 'view';
$type = $entityTypes[$result['entity_type_id']];
if ($type && $type != 'order') {
$urlAppend = $type;
}
$title = AO::helper('rss')->__('Details for %s #%s', ucwords($type), $incrementIds[$result['parent_id']]);
$description = '<p>' . AO::helper('rss')->__('Notified Date: %s<br/>', $this->formatDate($result['created_at'])) . AO::helper('rss')->__('Comment: %s<br/>', $result['comment']) . '</p>';
$url = AO::getUrl('sales/order/' . $urlAppend, array('order_id' => $order->getId()));
$data = array('title' => $title, 'link' => $url, 'description' => $description);
$rssObj->_addEntry($data);
}
}
$title = AO::helper('rss')->__('Order #%s created at %s', $order->getIncrementId(), $this->formatDate($order->getCreatedAt()));
$url = AO::getUrl('sales/order/view', array('order_id' => $order->getId()));
$description = '<p>' . AO::helper('rss')->__('Current Status: %s<br/>', $order->getStatusLabel()) . AO::helper('rss')->__('Total: %s<br/>', $order->formatPrice($order->getGrandTotal())) . '</p>';
$data = array('title' => $title, 'link' => $url, 'description' => $description);
$rssObj->_addEntry($data);
return $rssObj->createRssXml();
}
示例11: getAllOptions
public function getAllOptions()
{
if (!$this->_options) {
$this->_options = AO::getResourceModel('tax/class_collection')->addFieldToFilter('class_type', 'CUSTOMER')->load()->toOptionArray();
}
return $this->_options;
}
示例12: toOptionArray
public function toOptionArray()
{
if (!$this->_options) {
$this->_options = AO::getResourceModel('cms/page_collection')->load()->toOptionArray();
}
return $this->_options;
}
示例13: _prepareCollection
protected function _prepareCollection()
{
//TODO: add full name logic
$collection = AO::getResourceModel('sales/order_Creditmemo_collection')->addAttributeToSelect('increment_id')->addAttributeToSelect('created_at')->addAttributeToSelect('order_currency_code')->addAttributeToSelect('state')->addAttributeToSelect('grand_total')->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left')->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left')->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left')->joinAttribute('order_created_at', 'order/created_at', 'order_id', null, 'left');
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例14: _prepareCollection
protected function _prepareCollection()
{
$collection = AO::getResourceModel('reports/tag_product_collection');
$collection->addUniqueTagedCount()->addAllTagedCount()->addStatusFilter(AO::getModel('tag/tag')->getApprovedStatus())->addGroupByProduct();
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例15: __construct
public function __construct()
{
parent::__construct();
//TODO: add full name logic
$orders = AO::getResourceModel('sales/order_collection')->addAttributeToSelect('*')->joinAttribute('shipping_firstname', 'order_address/firstname', 'shipping_address_id', null, 'left')->joinAttribute('shipping_lastname', 'order_address/lastname', 'shipping_address_id', null, 'left')->addAttributeToFilter('customer_id', AO::getSingleton('customer/session')->getCustomer()->getId())->addAttributeToFilter('state', array('in' => AO::getSingleton('sales/order_config')->getVisibleOnFrontStates()))->addAttributeToSort('created_at', 'desc')->setPageSize('5')->load();
$this->setOrders($orders);
}