本文整理汇总了PHP中Mage::getModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::getModel方法的具体用法?PHP Mage::getModel怎么用?PHP Mage::getModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::getModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRatingSummary
public function getRatingSummary()
{
if (!$this->getRatingSummaryCache()) {
$this->setRatingSummaryCache(Mage::getModel('rating/rating')->getReviewSummary($this->getReviewId()));
}
return $this->getRatingSummaryCache();
}
示例2: setUp
protected function setUp()
{
$this->_product = Mage::getModel('Mage_Catalog_Model_Product');
$this->_product->load(1);
$this->_block = Mage::app()->getLayout()->createBlock('Mage_Catalog_Block_Product_View_Type_Configurable');
$this->_block->setProduct($this->_product);
}
示例3: _construct
/**
* Initialize template and cache settings
*
*/
protected function _construct()
{
parent::_construct();
$this->setTemplate('inventoryplus/menu.phtml');
$this->_url = Mage::getModel('adminhtml/url');
$this->setCacheTags(array(self::CACHE_TAGS));
}
示例4: _getOptionsCollection
protected function _getOptionsCollection()
{
if (!$this->_collection) {
$this->_collection = Mage::getModel('emjainteractive_shippingoption/option')->getCollection()->applySortOrder()->load();
}
return $this->_collection;
}
示例5: getLinks
/**
* Return Purchased link for order item
*
* @return Mage_Downloadable_Model_Link_Purchased
*/
public function getLinks()
{
$this->_purchasedLinks = Mage::getModel('downloadable/link_purchased')->load($this->getOrder()->getId(), 'order_id');
$purchasedItems = Mage::getModel('downloadable/link_purchased_item')->getCollection()->addFieldToFilter('order_item_id', $this->getItem()->getOrderItem()->getId());
$this->_purchasedLinks->setPurchasedItems($purchasedItems);
return $this->_purchasedLinks;
}
示例6: getCollection
public function getCollection()
{
if (is_null($this->_collection)) {
$this->setCollection(Mage::getModel('reports/grouped_collection'));
}
return $this->_collection;
}
示例7: _prepareCollection
protected function _prepareCollection()
{
$model = Mage::getModel('review/review');
$collection = $model->getProductCollection();
if ($this->getProductId() || $this->getRequest()->getParam('productId', false)) {
$productId = $this->getProductId();
if (!$productId) {
$productId = $this->getRequest()->getParam('productId');
}
$this->setProductId($productId);
$collection->addEntityFilter($this->getProductId());
}
if ($this->getCustomerId() || $this->getRequest()->getParam('customerId', false)) {
$customerId = $this->getCustomerId();
if (!$customerId) {
$customerId = $this->getRequest()->getParam('customerId');
}
$this->setCustomerId($customerId);
$collection->addCustomerFilter($this->getCustomerId());
}
if (Mage::registry('usePendingFilter') === true) {
$collection->addStatusFilter($model->getPendingStatus());
}
$collection->addStoreData();
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例8: __construct
public function __construct()
{
parent::__construct();
$this->setTemplate('sales/order/details.phtml');
$this->setOrder(Mage::getModel('sales/order')->load($this->getRequest()->getParam('order_id')));
Mage::registry('action')->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('sales')->__('Order Details'));
}
示例9: __construct
public function __construct()
{
parent::__construct();
// Initialization block
//------------------------------
$this->setId('ebayFeedback');
$this->_blockGroup = 'M2ePro';
$this->_controller = 'adminhtml_ebay_feedback';
//------------------------------
// Set header text
//------------------------------
$accountTitle = '';
$accountId = $this->getRequest()->getParam('account');
if (!is_null($accountId)) {
$accountTitle = Mage::getModel('M2ePro/Account')->load((int) $accountId)->getTitle();
}
$this->_headerText = Mage::helper('M2ePro')->__('Feedback for account "%s"', $accountTitle);
//------------------------------
// Set buttons actions
//------------------------------
$this->removeButton('back');
$this->removeButton('reset');
$this->removeButton('delete');
$this->removeButton('add');
$this->removeButton('save');
$this->removeButton('edit');
$this->_addButton('goto_orders', array('label' => Mage::helper('M2ePro')->__('Orders'), 'onclick' => 'setLocation(\'' . $this->getUrl('*/adminhtml_ebay_order/index') . '\')', 'class' => 'button_link'));
$this->_addButton('goto_accounts', array('label' => Mage::helper('M2ePro')->__('Accounts'), 'onclick' => 'setLocation(\'' . $this->getUrl('*/adminhtml_ebay_account/index') . '\')', 'class' => 'button_link'));
$this->_addButton('reset', array('label' => Mage::helper('M2ePro')->__('Refresh'), 'onclick' => 'EbayFeedbackHandlerObj.reset_click()', 'class' => 'reset'));
//------------------------------
}
示例10: ajaxAction
public function ajaxAction()
{
$idItem = Mage::app()->getRequest()->getParam('idItem');
Mage::register('current_log', Mage::getModel('amaudit/log')->load($idItem));
$block = $this->getLayout()->createBlock('amaudit/adminhtml_userlog_edit_tab_view_details');
$this->getResponse()->setBody($block->toHtml());
}
示例11: _prepareForm
/**
* Prepare form before rendering HTML
* Setting Form Fieldsets and fields
*
* @return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$this->setForm($form);
$data = Mage::helper('xmlconnect')->getApplication()->getFormData();
$yesNoValues = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
$fieldset = $form->addFieldset('flurryAnalytics', array('legend' => $this->__('Flurry Analytics')));
if (isset($data['conf[native][merchantFlurryTracking][isActive]'])) {
$isActiveValue = $data['conf[native][merchantFlurryTracking][isActive]'];
} else {
$isActiveValue = '0';
}
$enabled = $fieldset->addField('conf/native/merchantFlurryTracking/isActive', 'select', array('label' => $this->__('Enable Flurry Analytics'), 'name' => 'conf[native][merchantFlurryTracking][isActive]', 'values' => $yesNoValues, 'note' => $this->__('Enable Flurry Analytics for the merchant.'), 'value' => $isActiveValue));
$flurryAnalyticsUrl = $this->escapeHtml(Mage::getStoreConfig('xmlconnect/flurry_analytics/statistics_url'));
$fieldset->addField('flurry_analytics_link', 'link', array('title' => $this->__('Flurry Analytics Site'), 'label' => $this->__('Flurry Analytics Site'), 'value' => $flurryAnalyticsUrl, 'href' => $flurryAnalyticsUrl, 'target' => '__blank', 'note' => $this->__('You can watch statistics here.')));
if (isset($data['conf[native][merchantFlurryTracking][accountId]'])) {
$accountIdValue = $data['conf[native][merchantFlurryTracking][accountId]'];
} else {
$accountIdValue = '';
}
$flurryApiCode = $fieldset->addField('conf/native/merchantFlurryTracking/accountId', 'text', array('label' => $this->__('Flurry API Code'), 'name' => 'conf[native][merchantFlurryTracking][accountId]', 'enabled' => true, 'required' => true, 'value' => $accountIdValue));
// field dependencies
$this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')->addFieldMap($flurryApiCode->getHtmlId(), $flurryApiCode->getName())->addFieldMap($enabled->getHtmlId(), $enabled->getName())->addFieldDependence($flurryApiCode->getName(), $enabled->getName(), 1));
return parent::_prepareForm();
}
示例12: _beforeToHtml
protected function _beforeToHtml()
{
$account = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
$magentoOrdersSettings = $account->getData('magento_orders_settings');
$magentoOrdersSettings = !empty($magentoOrdersSettings) ? json_decode($magentoOrdersSettings, true) : array();
// ---------------------------------------
$temp = Mage::getModel('core/website')->getCollection()->setOrder('sort_order', 'ASC')->toArray();
$this->websites = $temp['items'];
// ---------------------------------------
// ---------------------------------------
$temp = Mage::getModel('customer/group')->getCollection()->toArray();
$this->groups = $temp['items'];
// ---------------------------------------
// ---------------------------------------
$selectedStore = !empty($magentoOrdersSettings['listing']['store_id']) ? $magentoOrdersSettings['listing']['store_id'] : '';
$blockStoreSwitcher = $this->getLayout()->createBlock('M2ePro/adminhtml_storeSwitcher', '', array('id' => 'magento_orders_listings_store_id', 'name' => 'magento_orders_settings[listing][store_id]', 'selected' => $selectedStore));
$blockStoreSwitcher->hasDefaultOption(false);
$this->setChild('magento_orders_listings_store_id', $blockStoreSwitcher);
// ---------------------------------------
// ---------------------------------------
$selectedStore = !empty($magentoOrdersSettings['listing_other']['store_id']) ? $magentoOrdersSettings['listing_other']['store_id'] : '';
$blockStoreSwitcher = $this->getLayout()->createBlock('M2ePro/adminhtml_storeSwitcher', '', array('id' => 'magento_orders_listings_other_store_id', 'name' => 'magento_orders_settings[listing_other][store_id]', 'selected' => $selectedStore));
$blockStoreSwitcher->hasDefaultOption(false);
$this->setChild('magento_orders_listings_other_store_id', $blockStoreSwitcher);
// ---------------------------------------
// ---------------------------------------
$productTaxClasses = Mage::getModel('tax/class')->getCollection()->addFieldToFilter('class_type', Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT)->toOptionArray();
$none = array('value' => Ess_M2ePro_Model_Magento_Product::TAX_CLASS_ID_NONE, 'label' => 'None');
array_unshift($productTaxClasses, $none);
$this->productTaxClasses = $productTaxClasses;
// ---------------------------------------
return parent::_beforeToHtml();
}
示例13: getSubscriptionObject
public function getSubscriptionObject()
{
if (is_null($this->_subscription)) {
$this->_subscription = Mage::getModel('newsletter/subscriber')->loadByCustomer($this->getCustomer());
}
return $this->_subscription;
}
示例14: addBlogSection
public function addBlogSection($observer)
{
$sitemapObject = $observer->getSitemapObject();
if (!$sitemapObject instanceof Mage_Sitemap_Model_Sitemap) {
throw new Exception(Mage::helper('blog')->__('Error during generation sitemap'));
}
$storeId = $sitemapObject->getStoreId();
$date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
$baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
/**
* Generate blog pages sitemap
*/
$changefreq = (string) Mage::getStoreConfig('sitemap/blog/changefreq');
$priority = (string) Mage::getStoreConfig('sitemap/blog/priority');
$collection = Mage::getModel('blog/blog')->getCollection()->addStoreFilter($storeId);
Mage::getSingleton('blog/status')->addEnabledFilterToCollection($collection);
$route = Mage::getStoreConfig('blog/blog/route');
if ($route == "") {
$route = "blog";
}
foreach ($collection as $item) {
$xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>', htmlspecialchars($baseUrl . $route . '/' . $item->getIdentifier()), $date, $changefreq, $priority);
$sitemapObject->sitemapFileAddLine($xml);
}
unset($collection);
}
示例15: callbackDescription
public function callbackDescription($value, $row, $column, $isExport)
{
$fullDescription = Mage::getModel('M2ePro/Log_Abstract')->decodeDescription($row->getData('description'));
$row->setData('description', $fullDescription);
$value = $column->getRenderer()->render($row);
preg_match_all('/href="([^"]*)"/', $fullDescription, $matches);
if (!count($matches[0])) {
return $this->prepareLongText($fullDescription, $value);
}
foreach ($matches[1] as $key => $href) {
preg_match_all('/route:([^;]*)/', $href, $routeMatch);
preg_match_all('/back:([^;]*)/', $href, $backMatch);
preg_match_all('/filter:([^;]*)/', $href, $filterMatch);
if (count($routeMatch[1]) == 0) {
$fullDescription = str_replace($matches[0][$key], '', $fullDescription);
$value = str_replace($matches[0][$key], '', $value);
continue;
}
$params = array();
if (count($backMatch[1]) > 0) {
$params['back'] = Mage::helper('M2ePro')->makeBackUrlParam($backMatch[1][$key]);
}
if (count($filterMatch[1]) > 0) {
$params['filter'] = base64_encode($filterMatch[1][$key]);
}
$url = $routeMatch[1][$key];
$fullDescription = str_replace($href, $this->getUrl($url, $params), $fullDescription);
$value = str_replace($href, $this->getUrl($url, $params), $value);
}
return $this->prepareLongText($fullDescription, $value);
}