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


PHP AO::app方法代码示例

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


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

示例1: _prepareForm

 /**
  *
  * return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $model = AO::registry('checkout_agreement');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('checkout')->__('Terms and Conditions Information'), 'class' => 'fieldset-wide'));
     if ($model->getId()) {
         $fieldset->addField('agreement_id', 'hidden', array('name' => 'agreement_id'));
     }
     $fieldset->addField('name', 'text', array('name' => 'name', 'label' => AO::helper('checkout')->__('Condition Name'), 'title' => AO::helper('checkout')->__('Condition Name'), 'required' => true));
     $fieldset->addField('is_active', 'select', array('label' => AO::helper('checkout')->__('Status'), 'title' => AO::helper('checkout')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => AO::helper('checkout')->__('Enabled'), '0' => AO::helper('checkout')->__('Disabled'))));
     $fieldset->addField('is_html', 'select', array('label' => AO::helper('checkout')->__('Show Content as'), 'title' => AO::helper('checkout')->__('Show Content as'), 'name' => 'is_html', 'required' => true, 'options' => array(0 => AO::helper('checkout')->__('Text'), 1 => AO::helper('checkout')->__('HTML'))));
     if (!AO::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => AO::helper('checkout')->__('Store View'), 'title' => AO::helper('checkout')->__('Store View'), 'required' => true, 'values' => AO::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => AO::app()->getStore(true)->getId()));
         $model->setStoreId(AO::app()->getStore(true)->getId());
     }
     $fieldset->addField('checkbox_text', 'editor', array('name' => 'checkbox_text', 'label' => AO::helper('checkout')->__('Checkbox text'), 'title' => AO::helper('checkout')->__('Checkbox text'), 'rows' => '5', 'cols' => '30', 'wysiwyg' => false, 'required' => true));
     $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => AO::helper('checkout')->__('Content'), 'title' => AO::helper('checkout')->__('Content'), 'style' => 'height:24em;', 'wysiwyg' => false, 'required' => true));
     $fieldset->addField('content_height', 'text', array('name' => 'content_height', 'label' => AO::helper('checkout')->__('Content Height (css)'), 'title' => AO::helper('checkout')->__('Content Height'), 'maxlength' => 25, 'class' => 'validate-css-length'));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:29,代码来源:Checkout_Agreement_Edit_Form.php

示例2: getTierPrices

 /**
  * Get tier prices (formatted)
  *
  * @param Mage_Catalog_Model_Product $product
  * @return array
  */
 public function getTierPrices($product = null)
 {
     if (is_null($product)) {
         $product = $this->getProduct();
     }
     $prices = $product->getFormatedTierPrice();
     $res = array();
     if (is_array($prices)) {
         foreach ($prices as $price) {
             $price['price_qty'] = $price['price_qty'] * 1;
             if ($product->getPrice() != $product->getFinalPrice()) {
                 $productPrice = $product->getFinalPrice();
             } else {
                 $productPrice = $product->getPrice();
             }
             if ($price['price'] < $productPrice) {
                 $price['savePercent'] = ceil(100 - 100 / $productPrice * $price['price']);
                 $price['formated_price'] = AO::app()->getStore()->formatPrice(AO::app()->getStore()->convertPrice(AO::helper('tax')->getPrice($product, $price['website_price'])));
                 $price['formated_price_incl_tax'] = AO::app()->getStore()->formatPrice(AO::app()->getStore()->convertPrice(AO::helper('tax')->getPrice($product, $price['website_price'], true)));
                 $res[] = $price;
             }
         }
     }
     return $res;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:31,代码来源:Product_Price.php

示例3: getTotalReviews

 public function getTotalReviews()
 {
     if (!$this->getTotalReviewsCache()) {
         $this->setTotalReviewsCache(AO::getModel('review/review')->getTotalReviews($this->getProductData()->getId(), false, AO::app()->getStore()->getId()));
     }
     return $this->getTotalReviewsCache();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:View.php

示例4: getStoreSwitcherHtml

 public function getStoreSwitcherHtml()
 {
     if (AO::app()->isSingleStoreMode()) {
         return '';
     }
     return $this->getChildHtml('store_switcher');
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Report_Shopcart_Abandoned.php

示例5: _beforeDelete

 protected function _beforeDelete()
 {
     if ($coupon = $this->getCouponCode()) {
         AO::app()->cleanCache('salesrule_coupon_' . $coupon);
     }
     parent::_beforeDelete();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Rule.php

示例6: _prepareColumns

 protected function _prepareColumns()
 {
     $baseUrl = $this->getUrl();
     $this->addColumn('name', array('header' => AO::helper('tag')->__('Tag'), 'index' => 'name'));
     $this->addColumn('total_used', array('header' => AO::helper('tag')->__('Uses'), 'width' => '140px', 'align' => 'right', 'index' => 'uses', 'type' => 'number'));
     $this->addColumn('products', array('header' => AO::helper('tag')->__('Products'), 'width' => '140px', 'align' => 'right', 'index' => 'products', 'type' => 'number'));
     $this->addColumn('customers', array('header' => AO::helper('tag')->__('Customers'), 'width' => '140px', 'align' => 'right', 'index' => 'customers', 'type' => 'number'));
     $this->addColumn('popularity', array('header' => AO::helper('tag')->__('Popularity'), 'width' => '140px', 'align' => 'right', 'index' => 'popularity', 'type' => 'number'));
     /*
     $this->addColumn('status', array(
         'header'    => AO::helper('tag')->__('Status'),
         'width'     => '90px',
         'index'     => 'status',
         'type'      => 'options',
         'filter'    => false,
         'sortable'  => false,
         'options'    => array(
             Mage_Tag_Model_Tag::STATUS_DISABLED => AO::helper('tag')->__('Disabled'),
             Mage_Tag_Model_Tag::STATUS_PENDING  => AO::helper('tag')->__('Pending'),
             Mage_Tag_Model_Tag::STATUS_APPROVED => AO::helper('tag')->__('Approved'),
         ),
     ));
     */
     // Collection for stores filters
     if (!($collection = AO::registry('stores_select_collection'))) {
         $collection = AO::app()->getStore()->getResourceCollection()->load();
         AO::register('stores_select_collection', $collection);
     }
     if (!AO::app()->isSingleStoreMode()) {
         $this->addColumn('visible_in', array('header' => AO::helper('tag')->__('Visible In'), 'type' => 'store', 'index' => 'stores', 'sortable' => false, 'store_view' => true));
     }
     $this->addColumn('actions', array('header' => AO::helper('tag')->__('Actions'), 'width' => '100px', 'type' => 'action', 'sortable' => false, 'filter' => false, 'actions' => array(array('caption' => AO::helper('tag')->__('Edit Tag'), 'url' => $this->getUrl('*/*/edit', array('ret' => 'pending', 'tag_id' => '$tag_id'))), array('caption' => AO::helper('tag')->__('View Products'), 'url' => $this->getUrl('*/*/product', array('ret' => 'pending', 'tag_id' => '$tag_id'))), array('caption' => AO::helper('tag')->__('View Customers'), 'url' => $this->getUrl('*/*/customer', array('ret' => 'pending', 'tag_id' => '$tag_id'))))));
     return parent::_prepareColumns();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:34,代码来源:Tag_Grid_Pending.php

示例7: indexAction

 /**
  * Display search result
  */
 public function indexAction()
 {
     $query = AO::helper('catalogSearch')->getQuery();
     /* @var $query Mage_CatalogSearch_Model_Query */
     $query->setStoreId(AO::app()->getStore()->getId());
     if ($query->getQueryText()) {
         if (AO::helper('catalogSearch')->isMinQueryLength()) {
             $query->setId(0)->setIsActive(1)->setIsProcessed(1);
         } else {
             if ($query->getId()) {
                 $query->setPopularity($query->getPopularity() + 1);
             } else {
                 $query->setPopularity(1);
             }
             if ($query->getRedirect()) {
                 $query->save();
                 $this->getResponse()->setRedirect($query->getRedirect());
                 return;
             } else {
                 $query->prepare();
             }
         }
         AO::helper('catalogSearch')->checkNotes();
         $this->loadLayout();
         $this->_initLayoutMessages('catalog/session');
         $this->renderLayout();
         if (!AO::helper('catalogSearch')->isMinQueryLength()) {
             $query->save();
         }
     } else {
         $this->_redirectReferer();
     }
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:36,代码来源:ResultController.php

示例8: isEnabled

 /**
  * Check is enable catalog product for store
  *
  * @param mixed $store
  * @return bool
  */
 public function isEnabled($store = null)
 {
     if (AO::app()->getStore($store)->isAdmin()) {
         return false;
     }
     return AO::getStoreConfigFlag(self::XML_PATH_USE_PRODUCT_FLAT, $store);
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:13,代码来源:Flat.php

示例9: loadByName

 public function loadByName(Mage_Directory_Model_Region $region, $regionName, $countryId)
 {
     $locale = AO::app()->getLocale()->getLocaleCode();
     $select = $this->_read->select()->from(array('region' => $this->_regionTable))->where('region.country_id=?', $countryId)->where('region.default_name=?', $regionName)->join(array('rname' => $this->_regionNameTable), 'rname.region_id=region.region_id AND rname.locale=\'' . $locale . '\'', array('name'));
     $region->setData($this->_read->fetchRow($select));
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Mysql4_Region.php

示例10: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('googleoptimizer_fields', array('legend' => AO::helper('googleoptimizer')->__('Google Optimizer Scripts')));
     if ($this->getProduct()->getStoreId() == '0') {
         AO::helper('googleoptimizer')->setStoreId(AO::app()->getDefaultStoreView());
     } else {
         AO::helper('googleoptimizer')->setStoreId($this->getProduct()->getStoreId());
     }
     $disabledScriptsFields = false;
     $values = array();
     if ($this->getGoogleOptimizer() && $this->getGoogleOptimizer()->getData()) {
         $disabledScriptsFields = true;
         $values = $this->getGoogleOptimizer()->getData();
         $checkedUseDefault = true;
         if ($this->getGoogleOptimizer()->getStoreId() == $this->getProduct()->getStoreId()) {
             $checkedUseDefault = false;
             $disabledScriptsFields = false;
             $fieldset->addField('code_id', 'hidden', array('name' => 'code_id'));
         }
         // show 'use default' checkbox if store different for default and product has scripts for default store
         if ($this->getProduct()->getStoreId() != '0') {
             $fieldset->addField('store_flag', 'checkbox', array('name' => 'store_flag', 'value' => '1', 'label' => AO::helper('googleoptimizer')->__('Use Default Values'), 'class' => 'checkbox', 'required' => false, 'onchange' => 'googleOptimizerScopeAction()'))->setIsChecked($checkedUseDefault);
         }
     }
     $fieldset->addField('conversion_page', 'select', array('name' => 'conversion_page', 'label' => AO::helper('googleoptimizer')->__('Conversion Page'), 'values' => AO::getModel('googleoptimizer/adminhtml_system_config_source_googleoptimizer_conversionpages')->toOptionArray(), 'class' => 'select googleoptimizer validate-googleoptimizer', 'required' => false, 'onchange' => 'googleOptimizerConversionPageAction(this)'));
     if ($this->getProduct()->getStoreId() == '0' && !AO::app()->isSingleStoreMode()) {
         $fieldset->addField('conversion_page_url', 'note', array('name' => 'conversion_page_url', 'label' => AO::helper('googleoptimizer')->__('Conversion Page URL'), 'text' => AO::helper('googleoptimizer')->__('Please select store view to see the URL')));
     } else {
         $fieldset->addField('conversion_page_url', 'text', array('name' => 'conversion_page_url', 'label' => AO::helper('googleoptimizer')->__('Conversion Page URL'), 'class' => 'input-text', 'readonly' => 'readonly', 'required' => false, 'note' => AO::helper('googleoptimizer')->__('Please copy and paste this value to experiment edit form')));
     }
     $fieldset->addField('export_controls', 'text', array('name' => 'export_controls'));
     $fieldset->addField('control_script', 'textarea', array('name' => 'control_script', 'label' => AO::helper('googleoptimizer')->__('Control Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
     $fieldset->addField('tracking_script', 'textarea', array('name' => 'tracking_script', 'label' => AO::helper('googleoptimizer')->__('Tracking Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
     $fieldset->addField('conversion_script', 'textarea', array('name' => 'conversion_script', 'label' => AO::helper('googleoptimizer')->__('Conversion Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
     $attributes = AO::helper('googleoptimizer')->getProductAttributes($this->getProduct());
     $fieldset->addField('attributes', 'multiselect', array('name' => 'attributes', 'label' => AO::helper('googleoptimizer')->__('Attributes'), 'class' => 'googleoptimizer validate-googleoptimizer validate-googleoptimizer-attributes', 'values' => $attributes, 'required' => false, 'onchange' => 'googleOptimizerAttributesCheckAction(this)', 'note' => AO::helper('googleoptimizer')->__('Limit is 8 attributes only.')));
     if (AO::helper('googleoptimizer')->getConversionPagesUrl() && $this->getGoogleOptimizer() && $this->getGoogleOptimizer()->getConversionPage()) {
         $form->getElement('conversion_page_url')->setValue(AO::helper('googleoptimizer')->getConversionPagesUrl()->getData($this->getGoogleOptimizer()->getConversionPage()));
     }
     if ($disabledScriptsFields) {
         foreach ($fieldset->getElements() as $element) {
             if ($element->getType() == 'textarea' || $element->getType() == 'select') {
                 $element->setDisabled($disabledScriptsFields);
             }
         }
         $form->getElement('export_controls')->setDisabled($disabledScriptsFields);
     }
     $fakeEntityAttribute = AO::getModel('catalog/resource_eav_attribute');
     foreach ($fieldset->getElements() as $element) {
         if ($element->getId() != 'store_flag') {
             $element->setEntityAttribute($fakeEntityAttribute);
         }
     }
     $form->getElement('export_controls')->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_form_renderer_googleoptimizer_import'));
     $form->addValues($values);
     $form->setFieldNameSuffix('googleoptimizer');
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:60,代码来源:Adminhtml_Catalog_Product_Edit_Tab_Googleoptimizer.php

示例11: _beforeToHtml

 public function _beforeToHtml()
 {
     $this->_currency = AO::getModel('directory/currency')->load(AO::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE));
     $this->_collection = AO::getResourceModel('sales/sale_collection')->setCustomerFilter(AO::registry('current_customer'))->load();
     $this->_groupedCollection = array();
     foreach ($this->_collection as $sale) {
         if (!is_null($sale->getStoreId())) {
             $store = AO::app()->getStore($sale->getStoreId());
             $websiteId = $store->getWebsiteId();
             $groupId = $store->getGroupId();
             $storeId = $store->getId();
             $sale->setWebsiteId($store->getWebsiteId());
             $sale->setWebsiteName($store->getWebsite()->getName());
             $sale->setGroupId($store->getGroupId());
             $sale->setGroupName($store->getGroup()->getName());
         } else {
             $websiteId = 0;
             $groupId = 0;
             $storeId = 0;
             $sale->setStoreName(AO::helper('customer')->__('Deleted Stores'));
         }
         $this->_groupedCollection[$websiteId][$groupId][$storeId] = $sale;
         $this->_websiteCounts[$websiteId] = isset($this->_websiteCounts[$websiteId]) ? $this->_websiteCounts[$websiteId] + 1 : 1;
     }
     return parent::_beforeToHtml();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:26,代码来源:Customer_Edit_Tab_View_Sales.php

示例12: _beforeSave

 public function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     $format = AO::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     if ($date = $object->getDateFrom()) {
         $date = AO::app()->getLocale()->date($date, $format, null, false);
         $object->setDateFrom($date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
     } else {
         $object->setDateFrom(null);
     }
     if ($date = $object->getDateTo()) {
         $date = AO::app()->getLocale()->date($date, $format, null, false);
         $object->setDateTo($date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
     } else {
         $object->setDateTo(null);
     }
     if (!is_null($object->getDateFrom()) && !is_null($object->getDateTo()) && strtotime($object->getDateFrom()) > strtotime($object->getDateTo())) {
         AO::throwException(AO::helper('core')->__('Start date can\'t be greater than end date'));
     }
     $check = $this->_checkIntersection($object->getStoreId(), $object->getDateFrom(), $object->getDateTo(), $object->getId());
     if ($check) {
         AO::throwException(AO::helper('core')->__('Your design change for the specified store intersects with another one, please specify another date range'));
     }
     if (is_null($object->getDateFrom())) {
         $object->setDateFrom(new Zend_Db_Expr('null'));
     }
     if (is_null($object->getDateTo())) {
         $object->setDateTo(new Zend_Db_Expr('null'));
     }
     parent::_beforeSave($object);
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:30,代码来源:Mysql4_Design.php

示例13: getStores

 public function getStores()
 {
     if (!$this->_stores) {
         $this->_stores = AO::app()->getStore()->getResourceCollection()->load();
     }
     return $this->_stores;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Data.php

示例14: actionPreDispatchAdmin

 public function actionPreDispatchAdmin($event)
 {
     $session = AO::getSingleton('admin/session');
     /* @var $session Mage_Admin_Model_Session */
     $request = AO::app()->getRequest();
     $user = $session->getUser();
     if ($request->getActionName() == 'forgotpassword' || $request->getActionName() == 'logout') {
         $request->setDispatched(true);
     } else {
         if ($user) {
             $user->reload();
         }
         if (!$user || !$user->getId()) {
             if ($request->getPost('login')) {
                 $postLogin = $request->getPost('login');
                 $username = $postLogin['username'];
                 $password = $postLogin['password'];
                 $user = $session->login($username, $password, $request);
             }
             if (!$request->getParam('forwarded')) {
                 if ($request->getParam('isIframe')) {
                     $request->setParam('forwarded', true)->setControllerName('index')->setActionName('deniedIframe')->setDispatched(false);
                 } elseif ($request->getParam('isAjax')) {
                     $request->setParam('forwarded', true)->setControllerName('index')->setActionName('deniedJson')->setDispatched(false);
                 } else {
                     $request->setParam('forwarded', true)->setRouteName('adminhtml')->setControllerName('index')->setActionName('login')->setDispatched(false);
                 }
                 return false;
             }
         }
     }
     $session->refreshAcl();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:33,代码来源:Observer.php

示例15: _prepareForm

 protected function _prepareForm()
 {
     /** @var Cms_Model_Page */
     $model = AO::registry('cms_page');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('page_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('cms')->__('General Information'), 'class' => 'fieldset-wide'));
     if ($model->getPageId()) {
         $fieldset->addField('page_id', 'hidden', array('name' => 'page_id'));
     }
     $fieldset->addField('title', 'text', array('name' => 'title', 'label' => AO::helper('cms')->__('Page Title'), 'title' => AO::helper('cms')->__('Page Title'), 'required' => true));
     $fieldset->addField('identifier', 'text', array('name' => 'identifier', 'label' => AO::helper('cms')->__('SEF URL Identifier'), 'title' => AO::helper('cms')->__('SEF URL Identifier'), 'required' => true, 'class' => 'validate-identifier', 'after_element_html' => '<p class="nm"><small>' . AO::helper('cms')->__('(eg: domain.com/identifier)') . '</small></p>'));
     /**
      * Check is single store mode
      */
     if (!AO::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => AO::helper('cms')->__('Store View'), 'title' => AO::helper('cms')->__('Store View'), 'required' => true, 'values' => AO::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => AO::app()->getStore(true)->getId()));
         $model->setStoreId(AO::app()->getStore(true)->getId());
     }
     $fieldset->addField('is_active', 'select', array('label' => AO::helper('cms')->__('Status'), 'title' => AO::helper('cms')->__('Page Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => AO::helper('cms')->__('Enabled'), '0' => AO::helper('cms')->__('Disabled'))));
     $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => AO::helper('cms')->__('Content'), 'title' => AO::helper('cms')->__('Content'), 'style' => 'height:36em;', 'wysiwyg' => false, 'required' => true));
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:27,代码来源:Cms_Page_Edit_Tab_Main.php


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