本文整理汇总了PHP中AO::helper方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::helper方法的具体用法?PHP AO::helper怎么用?PHP AO::helper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AO
的用法示例。
在下文中一共展示了AO::helper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->_controller = 'report_shopcart_product';
$this->_headerText = AO::helper('reports')->__('Products in carts');
parent::__construct();
$this->_removeButton('add');
}
示例2: __construct
public function __construct()
{
$this->_controller = 'system_convert_profile';
$this->_headerText = AO::helper('adminhtml')->__('Advanced Profiles');
$this->_addButtonLabel = AO::helper('adminhtml')->__('Add New Profile');
parent::__construct();
}
示例3: _construct
protected function _construct()
{
if (!$this->isCustomerLoggedIn()) {
$this->getCheckout()->setStepData('login', array('label' => AO::helper('checkout')->__('Checkout method'), 'allow' => true));
}
parent::_construct();
}
示例4: render
public function render(Varien_Object $row)
{
if (!$row->getData($this->getColumn()->getIndex())) {
return null;
}
return '<a title="' . AO::helper('core')->__('Edit Store') . '" href="' . $this->getUrl('*/*/editGroup', array('group_id' => $row->getGroupId())) . '">' . $row->getData($this->getColumn()->getIndex()) . '</a>';
}
示例5: _toHtml
protected function _toHtml()
{
if (!$this->_beforeToHtml() || !AO::getStoreConfig('dev/debug/profiler') || !AO::helper('core')->isDevAllowed()) {
return '';
}
$timers = Varien_Profiler::getTimers();
#$out = '<div style="position:fixed;bottom:5px;right:5px;opacity:.1;background:white" onmouseover="this.style.opacity=1" onmouseout="this.style.opacity=.1">';
#$out = '<div style="opacity:.1" onmouseover="this.style.opacity=1" onmouseout="this.style.opacity=.1">';
$out = "<a href=\"javascript:void(0)\" onclick=\"\$('profiler_section').style.display=\$('profiler_section').style.display==''?'none':''\">[profiler]</a>";
$out .= '<div id="profiler_section" style="background:white; display:block">';
$out .= '<pre>Memory usage: real: ' . memory_get_usage(true) . ', emalloc: ' . memory_get_usage() . '</pre>';
$out .= '<table border="1" cellspacing="0" cellpadding="2" style="width:auto">';
$out .= '<tr><th>Code Profiler</th><th>Time</th><th>Cnt</th><th>Emalloc</th><th>RealMem</th></tr>';
foreach ($timers as $name => $timer) {
$sum = Varien_Profiler::fetch($name, 'sum');
$count = Varien_Profiler::fetch($name, 'count');
$realmem = Varien_Profiler::fetch($name, 'realmem');
$emalloc = Varien_Profiler::fetch($name, 'emalloc');
if ($sum < 0.001 && $count < 10 && $emalloc < 10000) {
continue;
}
$out .= '<tr>' . '<td align="left">' . $name . '</td>' . '<td>' . number_format($sum, 4) . '</td>' . '<td align="right">' . $count . '</td>' . '<td align="right">' . number_format($emalloc) . '</td>' . '<td align="right">' . number_format($realmem) . '</td>' . '</tr>';
}
$out .= '</table>';
$out .= '<pre>';
$out .= print_r(Varien_Profiler::getSqlProfiler(AO::getSingleton('core/resource')->getConnection('core_write')), 1);
$out .= '</pre>';
$out .= '</div>';
return $out;
}
示例6: 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();
}
}
示例7: checkRelation
public function checkRelation(Mage_Sales_Model_Order $order)
{
/**
* Check customer existing
*/
$customer = AO::getModel('customer/customer')->load($order->getCustomerId());
if (!$customer->getId()) {
$this->_getSession()->addNotice(AO::helper('adminhtml')->__(' The customer doesn\'t exist in the system anymore'));
}
/**
* Check Item products existing
*/
$productIds = array();
foreach ($order->getAllItems() as $item) {
$productIds[] = $item->getProductId();
}
$productCollection = AO::getModel('catalog/product')->getCollection()->addIdFilter($productIds)->load();
$hasBadItems = false;
foreach ($order->getAllItems() as $item) {
if (!$productCollection->getItemById($item->getProductId())) {
$this->_getSession()->addError(AO::helper('adminhtml')->__('The item %s (SKU %s) doesn\'t exist in the catalog anymore', $item->getName(), $item->getSku()));
$hasBadItems = true;
}
}
if ($hasBadItems) {
$this->_getSession()->addError(AO::helper('adminhtml')->__('Some of the ordered items don\'t exist in the catalog anymore and will be removed if you try to edit the order.'));
}
return $this;
}
示例8: getFormKey
/**
* Retrieve Session Form Key
*
* @return string A 16 bit unique key for forms
*/
public function getFormKey()
{
if (!$this->getData('_form_key')) {
$this->setData('_form_key', AO::helper('core')->getRandomString(16));
}
return $this->getData('_form_key');
}
示例9: getAllOptions
/**
* Retrieve all options array
*
* @return array
*/
public function getAllOptions()
{
if (is_null($this->_options)) {
$this->_options = array(array('label' => AO::helper('eav')->__('Yes'), 'value' => 1), array('label' => AO::helper('eav')->__('No'), 'value' => 0));
}
return $this->_options;
}
示例10: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
if ($country = $element->getForm()->getElement('country_id')) {
$countryId = $country->getValue();
} else {
return $element->getDefaultHtml();
}
$regionId = $element->getForm()->getElement('region_id')->getValue();
$html = '<tr>';
$element->setClass('input-text');
$html .= '<td class="label">' . $element->getLabelHtml() . '</td><td class="value">';
$html .= $element->getElementHtml();
$selectName = str_replace('region', 'region_id', $element->getName());
$selectId = $element->getHtmlId() . '_id';
$html .= '<select id="' . $selectId . '" name="' . $selectName . '" class="select required-entry" style="display:none">';
$html .= '<option value="">' . AO::helper('customer')->__('Please select') . '</option>';
$html .= '</select>';
$html .= '<script type="text/javascript">
if ($("' . $country->getHtmlId() . '") != undefined) {
new regionUpdater("' . $country->getHtmlId() . '", "' . $element->getHtmlId() . '", "' . $selectId . '", ' . $this->helper('directory')->getRegionJson() . ');
}
</script>';
$html .= '</td></tr>' . "\n";
return $html;
}
示例11: initForm
function initForm()
{
$model = AO::registry('oscommerce_adminhtml_import');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
if ($model->getId()) {
$form->addField('import_id', 'hidden', array('name' => 'import_id'));
}
$fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('oscommerce')->__('General Information')));
$fieldset->addField('name', 'text', array('label' => $this->__('Name'), 'title' => $this->__('Name'), 'name' => 'name', 'required' => true));
$fieldset->addField('host', 'text', array('label' => $this->__('IP or Hostname'), 'title' => $this->__('IP or Hostname'), 'name' => 'host', 'required' => true));
// $fieldset->addField('port', 'text', array(
// 'label' => $this->__('Port (Default as 3306)'),
// 'title' => $this->__('Port (Default as 3306)'),
// 'name' => 'port',
// 'required' => true,
// 'value' => $model->getData('port') ? $model->getData('port'): Mage_Oscommerce_Model_Oscommerce::DEFAULT_PORT
// ));
$fieldset->addField('db_name', 'text', array('label' => $this->__('DB Name'), 'title' => $this->__('DB Name'), 'name' => 'db_name', 'required' => true));
$fieldset->addField('db_user', 'text', array('label' => $this->__('DB Username'), 'title' => $this->__('DB Username'), 'name' => 'db_user', 'required' => true));
$fieldset->addField('db_password', 'password', array('label' => $this->__('DB Password'), 'title' => $this->__('DB Password'), 'name' => 'db_password'));
$fieldset->addField('table_prefix', 'text', array('label' => $this->__('Prefix'), 'title' => $this->__('Prefix'), 'name' => 'table_prefix'));
$fieldset->addField('send_subscription', 'checkbox', array('label' => $this->__('Send subscription notify to customers'), 'title' => $this->__('Send subscription notify to customers'), 'name' => 'send_subscription', 'values' => $this->getData('send_subscription'), 'checked' => $this->getData('send_subscription')));
$form->setValues($model->getData());
$this->setForm($form);
return $this;
}
示例12: 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;
}
示例13: getAllOptions
public function getAllOptions()
{
if (!$this->_options) {
$this->_options = array(array('value' => Mage_Catalog_Model_Category::DM_PRODUCT, 'label' => AO::helper('catalog')->__('Products only')), array('value' => Mage_Catalog_Model_Category::DM_PAGE, 'label' => AO::helper('catalog')->__('Static block only')), array('value' => Mage_Catalog_Model_Category::DM_MIXED, 'label' => AO::helper('catalog')->__('Static block and products')));
}
return $this->_options;
}
示例14: _prepareForm
protected function _prepareForm()
{
$model = AO::registry('api_user');
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('user_');
$fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('adminhtml')->__('Account Information')));
if ($model->getUserId()) {
$fieldset->addField('user_id', 'hidden', array('name' => 'user_id'));
} else {
if (!$model->hasData('is_active')) {
$model->setIsActive(1);
}
}
$fieldset->addField('username', 'text', array('name' => 'username', 'label' => AO::helper('adminhtml')->__('User Name'), 'id' => 'username', 'title' => AO::helper('adminhtml')->__('User Name'), 'required' => true));
$fieldset->addField('firstname', 'text', array('name' => 'firstname', 'label' => AO::helper('adminhtml')->__('First Name'), 'id' => 'firstname', 'title' => AO::helper('adminhtml')->__('First Name'), 'required' => true));
$fieldset->addField('lastname', 'text', array('name' => 'lastname', 'label' => AO::helper('adminhtml')->__('Last Name'), 'id' => 'lastname', 'title' => AO::helper('adminhtml')->__('Last Name'), 'required' => true));
$fieldset->addField('email', 'text', array('name' => 'email', 'label' => AO::helper('adminhtml')->__('Email'), 'id' => 'customer_email', 'title' => AO::helper('adminhtml')->__('User Email'), 'class' => 'required-entry validate-email', 'required' => true));
if ($model->getUserId()) {
$fieldset->addField('password', 'password', array('name' => 'new_api_key', 'label' => AO::helper('adminhtml')->__('New Api Key'), 'id' => 'new_pass', 'title' => AO::helper('adminhtml')->__('New Api Key'), 'class' => 'input-text validate-password'));
$fieldset->addField('confirmation', 'password', array('name' => 'api_key_confirmation', 'label' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'id' => 'confirmation', 'class' => 'input-text validate-cpassword'));
} else {
$fieldset->addField('password', 'password', array('name' => 'api_key', 'label' => AO::helper('adminhtml')->__('Api Key'), 'id' => 'customer_pass', 'title' => AO::helper('adminhtml')->__('Api Key'), 'class' => 'input-text required-entry validate-password', 'required' => true));
$fieldset->addField('confirmation', 'password', array('name' => 'api_key_confirmation', 'label' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'id' => 'confirmation', 'title' => AO::helper('adminhtml')->__('Api Key Confirmation'), 'class' => 'input-text required-entry validate-cpassword', 'required' => true));
}
if (AO::getSingleton('admin/session')->getUser()->getId() != $model->getUserId()) {
$fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => AO::helper('adminhtml')->__('This account is'), 'id' => 'is_active', 'title' => AO::helper('adminhtml')->__('Account status'), 'class' => 'input-select', 'style' => 'width: 80px', 'options' => array('1' => AO::helper('adminhtml')->__('Active'), '0' => AO::helper('adminhtml')->__('Inactive'))));
}
$fieldset->addField('user_roles', 'hidden', array('name' => 'user_roles', 'id' => '_user_roles'));
$data = $model->getData();
unset($data['password']);
$form->setValues($data);
$this->setForm($form);
return parent::_prepareForm();
}
示例15: _prepareColumns
protected function _prepareColumns()
{
$this->addColumn('in_role_users', array('header_css_class' => 'a-center', 'type' => 'checkbox', 'name' => 'in_role_users', 'values' => $this->_getUsers(), 'align' => 'center', 'index' => 'user_id'));
$this->addColumn('role_user_id', array('header' => AO::helper('adminhtml')->__('User ID'), 'width' => 5, 'align' => 'left', 'sortable' => true, 'index' => 'user_id'));
$this->addColumn('role_user_username', array('header' => AO::helper('adminhtml')->__('User Name'), 'align' => 'left', 'index' => 'username'));
$this->addColumn('role_user_firstname', array('header' => AO::helper('adminhtml')->__('First Name'), 'align' => 'left', 'index' => 'firstname'));
$this->addColumn('role_user_lastname', array('header' => AO::helper('adminhtml')->__('Last Name'), 'align' => 'left', 'index' => 'lastname'));
$this->addColumn('role_user_email', array('header' => AO::helper('adminhtml')->__('Email'), 'width' => 40, 'align' => 'left', 'index' => 'email'));
$this->addColumn('role_user_is_active', array('header' => AO::helper('adminhtml')->__('Status'), 'index' => 'is_active', 'align' => 'left', 'type' => 'options', 'options' => array('1' => AO::helper('adminhtml')->__('Active'), '0' => AO::helper('adminhtml')->__('Inactive'))));
/*
$this->addColumn('grid_actions',
array(
'header'=>AO::helper('adminhtml')->__('Actions'),
'width'=>5,
'sortable'=>false,
'filter' =>false,
'type' => 'action',
'actions' => array(
array(
'caption' => AO::helper('adminhtml')->__('Remove'),
'onClick' => 'role.deleteFromRole($role_id);'
)
)
)
);
*/
return parent::_prepareColumns();
}