本文整理汇总了PHP中AO::getModel方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::getModel方法的具体用法?PHP AO::getModel怎么用?PHP AO::getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AO
的用法示例。
在下文中一共展示了AO::getModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareCollection
protected function _prepareCollection()
{
$collection = AO::getModel('sitemap/sitemap')->getCollection();
/* @var $collection Mage_Sitemap_Model_Mysql4_Sitemap_Collection */
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例2: getEntitySummary
public function getEntitySummary($product, $storeId = 0)
{
$summaryData = AO::getModel('review/review_summary')->setStoreId($storeId)->load($product->getId());
$summary = new Varien_Object();
$summary->setData($summaryData->getData());
$product->setRatingSummary($summary);
}
示例3: _getUrlModel
protected function _getUrlModel()
{
if (is_null($this->_url)) {
$this->_url = AO::getModel('adminhtml/url');
}
return $this->_url;
}
示例4: _prepareCollection
protected function _prepareCollection()
{
$collection = AO::getResourceModel('reports/tag_product_collection');
$collection->addTagedCount()->addProductFilter($this->getRequest()->getParam('id'))->addStatusFilter(AO::getModel('tag/tag')->getApprovedStatus())->addStoresVisibility()->setActiveFilter()->addGroupByTag()->setRelationId();
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例5: getWishlist
/**
* Retrieve wishlist by logged in customer
*
* @return Mage_Wishlist_Model_Wishlist
*/
public function getWishlist()
{
if (is_null($this->_wishlist)) {
$this->_wishlist = AO::getModel('wishlist/wishlist')->loadByCustomer($this->_getCurrentCustomer());
}
return $this->_wishlist;
}
示例6: _construct
protected function _construct()
{
$this->_init('catalogindex/indexer_price');
$this->_currencyModel = AO::getModel('directory/currency');
$this->_customerGroups = AO::getModel('customer/group')->getCollection();
return parent::_construct();
}
示例7: login
/**
* Try to login user in admin
*
* @param string $username
* @param string $password
* @param Mage_Core_Controller_Request_Http $request
* @return Mage_Admin_Model_User|null
*/
public function login($username, $password, $request = null)
{
if (empty($username) || empty($password)) {
return;
}
try {
/* @var $user Mage_Admin_Model_User */
$user = AO::getModel('admin/user');
$user->login($username, $password);
if ($user->getId()) {
if (AO::getSingleton('adminhtml/url')->useSecretKey()) {
AO::getSingleton('adminhtml/url')->renewSecretUrls();
}
$session = AO::getSingleton('admin/session');
$session->setIsFirstVisit(true);
$session->setUser($user);
$session->setAcl(AO::getResourceModel('admin/acl')->loadAcl());
if ($requestUri = $this->_getRequestUri($request)) {
header('Location: ' . $requestUri);
exit;
}
} else {
AO::throwException(AO::helper('adminhtml')->__('Invalid Username or Password.'));
}
} catch (Mage_Core_Exception $e) {
if ($request && !$request->getParam('messageSent')) {
AO::getSingleton('adminhtml/session')->addError($e->getMessage());
$request->setParam('messageSent', true);
}
}
return $user;
}
示例8: _loadAttribute
protected function _loadAttribute($id)
{
if (!isset($this->_attributeCache[$id])) {
$this->_attributeCache[$id] = AO::getModel('eav/entity_attribute')->load($id);
}
return $this->_attributeCache[$id];
}
示例9: _prepareForm
protected function _prepareForm()
{
if (!$this->_form) {
if ($this->getQuote()->getCustomerIsGuest()) {
$display = array('email' => 1);
} else {
$display = array('group_id' => 1, 'email' => 2);
}
$this->_form = new Varien_Data_Form();
$fieldset = $this->_form->addFieldset('main', array());
$customerModel = AO::getModel('customer/customer');
foreach ($customerModel->getAttributes() as $attribute) {
if (!array_key_exists($attribute->getAttributeCode(), $display)) {
continue;
}
if ($inputType = $attribute->getFrontend()->getInputType()) {
$element = $fieldset->addField($attribute->getAttributeCode(), $inputType, array('name' => $attribute->getAttributeCode(), 'label' => $attribute->getFrontend()->getLabel(), 'class' => $attribute->getFrontend()->getClass(), 'required' => $attribute->getIsRequired()))->setEntityAttribute($attribute);
if ($inputType == 'select' || $inputType == 'multiselect') {
$element->setValues($attribute->getFrontend()->getSelectOptions());
}
$element->setSortOrder($display[$attribute->getAttributeCode()]);
}
}
/*
* want to sort element only when there are more than one element
*/
if ($fieldset->getElements()->count() > 1) {
$fieldset->getElements()->usort(array($this, '_sortMethods'));
}
$this->_form->addFieldNameSuffix('order[account]');
$this->_form->setValues($this->getCustomerData());
}
return $this;
}
示例10: _prepareCollection
protected function _prepareCollection()
{
$collection = AO::getModel('core/website')->getCollection()->joinGroupAndStore();
$this->setCollection($collection);
parent::_prepareCollection();
return $this;
}
示例11: downloadCustomOptionAction
/**
* Custom options downloader
*/
public function downloadCustomOptionAction()
{
$quoteItemOptionId = $this->getRequest()->getParam('id');
$secretKey = $this->getRequest()->getParam('key');
$option = AO::getModel('sales/quote_item_option')->load($quoteItemOptionId);
if ($option->getId()) {
try {
$info = unserialize($option->getValue());
if ($secretKey != $info['secret_key']) {
throw new Exception();
}
$filePath = AO::getBaseDir() . $info['order_path'];
if (!is_file($filePath) || !is_readable($filePath)) {
// try get file from quote
$filePath = AO::getBaseDir() . $info['quote_path'];
if (!is_file($filePath) || !is_readable($filePath)) {
throw new Exception();
}
}
$this->getResponse()->setHttpResponseCode(200)->setHeader('Pragma', 'public', true)->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)->setHeader('Content-type', $info['type'], true)->setHeader('Content-Length', $info['size'])->setHeader('Content-Disposition', 'inline' . '; filename=' . $info['title']);
$this->getResponse()->clearBody();
$this->getResponse()->sendHeaders();
readfile($filePath);
} catch (Exception $e) {
$this->_forward('noRoute');
}
} else {
$this->_forward('noRoute');
}
}
示例12: __construct
public function __construct()
{
$this->_addButtonLabel = AO::helper('review')->__('Add New Review');
parent::__construct();
$this->_controller = 'review';
// lookup customer, if id is specified
$customerId = $this->getRequest()->getParam('customerId', false);
$customerName = '';
if ($customerId) {
$customer = AO::getModel('customer/customer')->load($customerId);
$customerName = $customer->getFirstname() . ' ' . $customer->getLastname();
}
if (AO::registry('usePendingFilter') === true) {
if ($customerName) {
$this->_headerText = AO::helper('review')->__('Pending reviews of customer `%s`', $customerName);
} else {
$this->_headerText = AO::helper('review')->__('Pending reviews');
}
$this->_removeButton('add');
} else {
if ($customerName) {
$this->_headerText = AO::helper('review')->__('All reviews of customer `%s`', $customerName);
} else {
$this->_headerText = AO::helper('review')->__('All Reviews');
}
}
}
示例13: __construct
public function __construct()
{
parent::__construct();
$this->setTemplate('sales/order/details.phtml');
$this->setOrder(AO::getModel('sales/order')->load($this->getRequest()->getParam('order_id')));
AO::registry('action')->getLayout()->getBlock('root')->setHeaderTitle(AO::helper('sales')->__('Order Details'));
}
示例14: _saveRates
/**
* Saving currency rates
*
* @param array $rates
* @return Mage_Directory_Model_Currency_Import_Abstract
*/
protected function _saveRates($rates)
{
foreach ($rates as $currencyCode => $currencyRates) {
AO::getModel('directory/currency')->setId($currencyCode)->setRates($currencyRates)->save();
}
return $this;
}
示例15: getShipment
/**
* Retrieve Shipment instance
*
* @return Mage_Sales_Model_Order_Shipment
*/
public function getShipment()
{
if (!$this->_shipment instanceof Mage_Sales_Model_Order_Shipment) {
$this->_shipment = AO::getModel('sales/order_shipment')->load($this->getParentId());
}
return $this->_shipment;
}