本文整理汇总了PHP中AO类的典型用法代码示例。如果您正苦于以下问题:PHP AO类的具体用法?PHP AO怎么用?PHP AO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AO类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: addWishlistCount
public function addWishlistCount()
{
$wishlistItemTable = AO::getSingleton('core/resource')->getTableName('wishlist/item');
$this->getSelect()->from(array('wi' => $wishlistItemTable), 'count(wishlist_item_id) as wishlists')->where('wi.product_id=e.entity_id')->group('wi.product_id');
$this->getEntity()->setStore(0);
return $this;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Mysql4_Wishlist_Product_Collection.php
示例2: getSharedCount
public function getSharedCount()
{
$collection = AO::getResourceModel('customer/customer_collection');
$collection->getSelect()->from(array('wt' => $this->getWishlistTable()))->where('wt.customer_id=e.entity_id')->where('wt.shared=1')->group('wt.wishlist_id');
$collection->load();
return $collection->count();
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Mysql4_Wishlist_Collection.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: getErrorMessage
public function getErrorMessage()
{
if (!$this->getData('error_message')) {
$this->setData('error_message', AO::helper('shipping')->__('This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.'));
}
return $this->getData('error_message');
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Rate_Result_Error.php
示例5: __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();
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:System_Convert_Profile.php
示例6: getItemTypes
/**
* Returns Google Base recommended Item Types
*
* @param string $targetCountry Two-letters country ISO code
* @return array
*/
public function getItemTypes($targetCountry)
{
$locale = AO::getSingleton('googlebase/config')->getCountryInfo($targetCountry, 'locale');
$location = self::ITEM_TYPES_LOCATION . '/' . $locale;
$feed = $this->getGuestService()->getFeed($location);
$itemTypes = array();
foreach ($feed->entries as $entry) {
$type = $entry->extensionElements[0]->text;
$item = new Varien_Object();
$item->setId($type);
$item->setName($entry->title->text);
$item->setLocation($entry->id->text);
$itemTypes[$type] = $item;
$typeAttributes = $entry->extensionElements[1]->extensionElements;
$attributes = array();
if (is_array($typeAttributes)) {
foreach ($typeAttributes as $attr) {
$name = $attr->extensionAttributes['name']['value'];
$type = $attr->extensionAttributes['type']['value'];
$attribute = new Varien_Object();
$attribute->setId($name);
$attribute->setName($name);
$attribute->setType($type);
$attributes[$name] = $attribute;
}
}
ksort($attributes);
$item->setAttributes($attributes);
}
ksort($itemTypes);
$this->_itemTypes = $itemTypes;
return $itemTypes;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:39,代码来源:Service_Feed.php
示例7: __construct
public function __construct()
{
parent::__construct();
$this->setTemplate('widget/view/container.phtml');
$this->_addButton('back', array('label' => AO::helper('adminhtml')->__('Back'), 'onclick' => 'window.location.href=\'' . $this->getUrl('*/*/') . '\'', 'class' => 'back'));
$this->_addButton('edit', array('label' => AO::helper('adminhtml')->__('Edit'), 'class' => 'edit', 'onclick' => 'window.location.href=\'' . $this->getEditUrl() . '\''));
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Widget_View_Container.php
示例8: 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
示例9: _joinFields
protected function _joinFields()
{
$tagTable = AO::getSingleton('core/resource')->getTableName('tag/tag');
$tagRelationTable = AO::getSingleton('core/resource')->getTableName('tag/relation');
$this->addAttributeToSelect('name');
$this->getSelect()->join(array('relation' => $tagRelationTable), "relation.product_id = e.entity_id")->join(array('t' => $tagTable), "t.tag_id =relation.tag_id", array('tag_id', 'status', 'tag_name' => 'name'));
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Mysql4_Tag_Product_Collection.php
示例10: saveRel
public function saveRel(Mage_Admin_Model_Rules $rule)
{
$this->_getWriteAdapter()->beginTransaction();
try {
$roleId = $rule->getRoleId();
$this->_getWriteAdapter()->delete($this->getMainTable(), "role_id = {$roleId}");
$masterResources = AO::getModel('admin/roles')->getResourcesList2D();
$masterAdmin = false;
if ($postedResources = $rule->getResources()) {
foreach ($masterResources as $index => $resName) {
if (!$masterAdmin) {
$permission = in_array($resName, $postedResources) ? 'allow' : 'deny';
$this->_getWriteAdapter()->insert($this->getMainTable(), array('role_type' => 'G', 'resource_id' => trim($resName, '/'), 'privileges' => '', 'assert_id' => 0, 'role_id' => $roleId, 'permission' => $permission));
}
if ($resName == 'all' && $permission == 'allow') {
$masterAdmin = true;
}
}
}
$this->_getWriteAdapter()->commit();
} catch (Mage_Core_Exception $e) {
throw $e;
} catch (Exception $e) {
$this->_getWriteAdapter()->rollBack();
}
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:26,代码来源:Mysql4_Rules.php
示例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;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:26,代码来源:Adminhtml_Import_Edit_Tab_General.php
示例12: getUrl
public function getUrl($params = array())
{
static $reservedKeys = array('module' => 1, 'controller' => 1, 'action' => 1, 'array' => 1);
if (is_string($params)) {
$paramsArr = explode('/', $params);
$params = array('controller' => $paramsArr[0], 'action' => $paramsArr[1]);
}
$url = AO::getBaseUrl($params);
if (!empty($params['frontName'])) {
$url .= $params['frontName'] . '/';
} else {
$url .= $this->_config->getName() . '/';
}
if (!empty($params)) {
$paramsStr = '';
foreach ($params as $key => $value) {
if (!isset($reservedKeys[$key]) && '_' !== $key[0] && !empty($value)) {
$paramsStr .= $key . '/' . $value . '/';
}
}
if (empty($params['controller']) && !empty($paramsStr)) {
$params['controller'] = 'index';
}
$url .= empty($params['controller']) ? '' : $params['controller'] . '/';
if (empty($params['action']) && !empty($paramsStr)) {
$params['action'] = 'index';
}
$url .= empty($params['action']) ? '' : $params['action'] . '/';
$url .= $paramsStr;
$url .= empty($params['array']) ? '' : '?' . http_build_query($params['array']);
}
return $url;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:33,代码来源:Router.php
示例13: __construct
public function __construct()
{
$this->_controller = 'report_customer_totals';
$this->_headerText = AO::helper('reports')->__('Customers by orders total');
parent::__construct();
$this->_removeButton('add');
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Report_Customer_Totals.php
示例14: getResource
public function getResource()
{
if (!$this->_resource) {
$this->_resource = AO::getResourceSingleton('catalog_entity/convert');
}
return $this->_resource;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Convert_Adapter_Catalog.php
示例15: addItemCountExpr
/**
* Add order items count expression
*
* @return Mage_Sales_Model_Mysql4_Order_Collection
*/
public function addItemCountExpr()
{
$orderTable = $this->getEntity()->getEntityTable();
$orderItemEntityTypeId = AO::getResourceSingleton('sales/order_item')->getTypeId();
$this->getSelect()->join(array('items' => $orderTable), 'items.parent_id=e.entity_id and items.entity_type_id=' . $orderItemEntityTypeId, array('items_count' => new Zend_Db_Expr('COUNT(items.entity_id)')))->group('e.entity_id');
return $this;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:12,代码来源:Mysql4_Order_Collection.php
示例16: getStateKey
/**
* Get layer state key
*
* @return string
*/
public function getStateKey()
{
if ($this->_stateKey === null) {
$this->_stateKey = 'Q_' . AO::helper('catalogSearch')->getQuery()->getId() . '_' . parent::getStateKey();
}
return $this->_stateKey;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:12,代码来源:Layer.php
示例17: 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>';
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:System_Store_Grid_Render_Group.php
示例18: __construct
public function __construct()
{
parent::__construct(AO::getSingleton('core/resource')->getConnection('admin_read'));
$this->_roleTable = AO::getSingleton('core/resource')->getTableName('admin/role');
$this->_select->from($this->_roleTable);
$this->setItemObjectClass(AO::getConfig()->getModelClassName('admin/acl_role'));
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:7,代码来源:Mysql4_Acl_Role_Collection.php
示例19: _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;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:30,代码来源:Profiler.php
示例20: _prepareForm
protected function _prepareForm()
{
if (!$this->_form) {
$this->_form = new Varien_Data_Form();
$fieldset = $this->_form->addFieldset('main', array('no_container' => true));
$addressModel = AO::getModel('customer/address');
foreach ($addressModel->getAttributes() as $attribute) {
if (!$attribute->getIsVisible()) {
continue;
}
if ($inputType = $attribute->getFrontend()->getInputType()) {
$element = $fieldset->addField($attribute->getAttributeCode(), $inputType, array('name' => $attribute->getAttributeCode(), 'label' => $this->__($attribute->getFrontend()->getLabel()), 'class' => $attribute->getFrontend()->getClass(), 'required' => $attribute->getIsRequired()))->setEntityAttribute($attribute);
if ($inputType == 'select' || $inputType == 'multiselect') {
$element->setValues($attribute->getFrontend()->getSelectOptions());
}
}
}
if ($regionElement = $this->_form->getElement('region')) {
$regionElement->setRenderer($this->getLayout()->createBlock('adminhtml/customer_edit_renderer_region'));
}
if ($regionElement = $this->_form->getElement('region_id')) {
$regionElement->setNoDisplay(true);
}
$this->_form->setValues($this->getFormValues());
}
return $this;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:27,代码来源:Sales_Order_Create_Form_Address.php
注:本文中的AO类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论