本文整理汇总了PHP中AO类的典型用法代码示例。如果您正苦于以下问题:PHP AO类的具体用法?PHP AO怎么用?PHP AO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
示例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();
}
示例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');
}
示例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();
}
示例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;
}
示例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() . '\''));
}
示例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;
}
示例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'));
}
示例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();
}
}
示例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: 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;
}
示例13: __construct
public function __construct()
{
$this->_controller = 'report_customer_totals';
$this->_headerText = AO::helper('reports')->__('Customers by orders total');
parent::__construct();
$this->_removeButton('add');
}
示例14: getResource
public function getResource()
{
if (!$this->_resource) {
$this->_resource = AO::getResourceSingleton('catalog_entity/convert');
}
return $this->_resource;
}
示例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;
}