本文整理汇总了PHP中AO::logException方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::logException方法的具体用法?PHP AO::logException怎么用?PHP AO::logException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AO
的用法示例。
在下文中一共展示了AO::logException方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initProduct
/**
* Initialize and check product
*
* @return Mage_Catalog_Model_Product
*/
protected function _initProduct()
{
AO::dispatchEvent('review_controller_product_init_before', array('controller_action' => $this));
$categoryId = (int) $this->getRequest()->getParam('category', false);
$productId = (int) $this->getRequest()->getParam('id');
if (!$productId) {
return false;
}
$product = AO::getModel('catalog/product')->setStoreId(AO::app()->getStore()->getId())->load($productId);
/* @var $product Mage_Catalog_Model_Product */
if (!$product->getId() || !$product->isVisibleInCatalog() || !$product->isVisibleInSiteVisibility()) {
return false;
}
if ($categoryId) {
$category = AO::getModel('catalog/category')->load($categoryId);
AO::register('current_category', $category);
}
AO::register('current_product', $product);
AO::register('product', $product);
try {
AO::dispatchEvent('review_controller_product_init', array('product' => $product));
AO::dispatchEvent('review_controller_product_init_after', array('product' => $product, 'controller_action' => $this));
} catch (Mage_Core_Exception $e) {
AO::logException($e);
return false;
}
return $product;
}
示例2: _initCatagory
/**
* Initialize requested category object
*
* @return Mage_Catalog_Model_Category
*/
protected function _initCatagory()
{
AO::dispatchEvent('catalog_controller_category_init_before', array('controller_action' => $this));
$categoryId = (int) $this->getRequest()->getParam('id', false);
if (!$categoryId) {
return false;
}
$category = AO::getModel('catalog/category')->setStoreId(AO::app()->getStore()->getId())->load($categoryId);
if (!AO::helper('catalog/category')->canShow($category)) {
return false;
}
AO::getSingleton('catalog/session')->setLastVisitedCategoryId($category->getId());
AO::register('current_category', $category);
try {
AO::dispatchEvent('catalog_controller_category_init_after', array('category' => $category, 'controller_action' => $this));
} catch (Mage_Core_Exception $e) {
AO::logException($e);
return false;
}
return $category;
}
示例3: _initProduct
/**
* Initialize requested product object
*
* @return Mage_Catalog_Model_Product
*/
protected function _initProduct()
{
AO::dispatchEvent('catalog_controller_product_init_before', array('controller_action' => $this));
$categoryId = (int) $this->getRequest()->getParam('category', false);
$productId = (int) $this->getRequest()->getParam('id');
if (!$productId) {
return false;
}
$product = AO::getModel('catalog/product')->setStoreId(AO::app()->getStore()->getId())->load($productId);
if (!AO::helper('catalog/product')->canShow($product)) {
return false;
}
if (!in_array(AO::app()->getStore()->getWebsiteId(), $product->getWebsiteIds())) {
return false;
}
$category = null;
if ($categoryId) {
$category = AO::getModel('catalog/category')->load($categoryId);
$product->setCategory($category);
AO::register('current_category', $category);
} elseif ($categoryId = AO::getSingleton('catalog/session')->getLastVisitedCategoryId()) {
if ($product->canBeShowInCategory($categoryId)) {
$category = AO::getModel('catalog/category')->load($categoryId);
$product->setCategory($category);
AO::register('current_category', $category);
}
}
AO::register('current_product', $product);
AO::register('product', $product);
try {
AO::dispatchEvent('catalog_controller_product_init', array('product' => $product));
AO::dispatchEvent('catalog_controller_product_init_after', array('product' => $product, 'controller_action' => $this));
} catch (Mage_Core_Exception $e) {
AO::logException($e);
return false;
}
return $product;
}
示例4: overviewAction
/**
* Multishipping checkout place order page
*/
public function overviewAction()
{
if (!$this->_validateMinimumAmount()) {
return $this;
}
$this->_getState()->setActiveStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_OVERVIEW);
try {
$payment = $this->getRequest()->getPost('payment');
$this->_getCheckout()->setPaymentMethod($payment);
$this->_getCheckout()->getQuote()->getPayment()->importData($payment);
$this->_getState()->setCompleteStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_BILLING);
$this->loadLayout();
$this->_initLayoutMessages('checkout/session');
$this->_initLayoutMessages('customer/session');
$this->renderLayout();
} catch (Mage_Core_Exception $e) {
AO::getSingleton('checkout/session')->addError($e->getMessage());
$this->_redirect('*/*/billing');
} catch (Exception $e) {
AO::logException($e);
AO::getSingleton('checkout/session')->addException($e, $this->__('Can\'t open overview page'));
$this->_redirect('*/*/billing');
}
}
示例5: quickCreateAction
public function quickCreateAction()
{
$result = array();
/* @var $configurableProduct Mage_Catalog_Model_Product */
$configurableProduct = AO::getModel('catalog/product')->setStoreId(0)->load($this->getRequest()->getParam('product'));
if (!$configurableProduct->isConfigurable()) {
// If invalid parent product
$this->_redirect('*/*/');
return;
}
/* @var $product Mage_Catalog_Model_Product */
$product = AO::getModel('catalog/product')->setStoreId(0)->setTypeId(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE)->setAttributeSetId($configurableProduct->getAttributeSetId());
foreach ($product->getTypeInstance()->getEditableAttributes() as $attribute) {
if ($attribute->getIsUnique() || $attribute->getFrontend()->getInputType() == 'gallery' || $attribute->getFrontend()->getInputType() == 'media_image' || !$attribute->getIsVisible()) {
continue;
}
$product->setData($attribute->getAttributeCode(), $configurableProduct->getData($attribute->getAttributeCode()));
}
$product->addData($this->getRequest()->getParam('simple_product', array()));
$product->setWebsiteIds($configurableProduct->getWebsiteIds());
$autogenerateOptions = array();
$result['attributes'] = array();
foreach ($configurableProduct->getTypeInstance()->getConfigurableAttributes() as $attribute) {
$value = $product->getAttributeText($attribute->getProductAttribute()->getAttributeCode());
$autogenerateOptions[] = $value;
$result['attributes'][] = array('label' => $value, 'value_index' => $product->getData($attribute->getProductAttribute()->getAttributeCode()), 'attribute_id' => $attribute->getProductAttribute()->getId());
}
if ($product->getNameAutogenerate()) {
$product->setName($configurableProduct->getName() . '-' . implode('-', $autogenerateOptions));
}
if ($product->getSkuAutogenerate()) {
$product->setSku($configurableProduct->getSku() . '-' . implode('-', $autogenerateOptions));
}
if (is_array($product->getPricing())) {
$result['pricing'] = $product->getPricing();
$additionalPrice = 0;
foreach ($product->getPricing() as $pricing) {
if (empty($pricing['value'])) {
continue;
}
if (!empty($pricing['is_percent'])) {
$pricing['value'] = $pricing['value'] / 100 * $product->getPrice();
}
$additionalPrice += $pricing['value'];
}
$product->setPrice($product->getPrice() + $additionalPrice);
$product->unsPricing();
}
try {
$product->validate();
$product->save();
$result['product_id'] = $product->getId();
$this->_getSession()->addSuccess(AO::helper('catalog')->__('Product was successfully created.'));
$this->_initLayoutMessages('adminhtml/session');
$result['messages'] = $this->getLayout()->getMessagesBlock()->getGroupedHtml();
} catch (Mage_Core_Exception $e) {
$result['error'] = array('message' => $e->getMessage(), 'fields' => array('sku' => $product->getSku()));
} catch (Exception $e) {
AO::logException($e);
$result['error'] = array('message' => $this->__('Product saving error. ') . $e->getMessage());
}
$this->getResponse()->setBody(Zend_Json::encode($result));
}
示例6: createBlock
/**
* Block Factory
*
* @param string $type
* @param string $blockName
* @param array $attributes
* @return Mage_Core_Block_Abstract
*/
public function createBlock($type, $name = '', array $attributes = array())
{
try {
$block = $this->_getBlockInstance($type, $attributes);
} catch (Exception $e) {
AO::logException($e);
return false;
}
if (empty($name) || '.' === $name[0]) {
$block->setIsAnonymous(true);
if (!empty($name)) {
$block->setAnonSuffix(substr($name, 1));
}
$name = 'ANONYMOUS_' . sizeof($this->_blocks);
} elseif (isset($this->_blocks[$name])) {
AO::throwException(AO::helper('core')->__('Block with name "%s" already exists', $name));
}
$block->setType($type);
$block->setNameInLayout($name);
$block->addData($attributes);
$block->setLayout($this);
$this->_blocks[$name] = $block;
return $this->_blocks[$name];
}
示例7: saveOrderAction
public function saveOrderAction()
{
$this->_expireAjax();
$result = array();
try {
if ($requiredAgreements = AO::helper('checkout')->getRequiredAgreementIds()) {
$postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
if ($diff = array_diff($requiredAgreements, $postedAgreements)) {
$result['success'] = false;
$result['error'] = true;
$result['error_messages'] = $this->__('Please agree to all Terms and Conditions before placing the order.');
$this->getResponse()->setBody(Zend_Json::encode($result));
return;
}
}
if ($data = $this->getRequest()->getPost('payment', false)) {
$this->getOnepage()->getQuote()->getPayment()->importData($data);
}
$this->getOnepage()->saveOrder();
$redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
$result['success'] = true;
$result['error'] = false;
} catch (Mage_Core_Exception $e) {
AO::logException($e);
AO::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
$result['success'] = false;
$result['error'] = true;
$result['error_messages'] = $e->getMessage();
$this->getOnepage()->getQuote()->save();
} catch (Exception $e) {
AO::logException($e);
AO::helper('checkout')->sendPaymentFailedEmail($this->getOnepage()->getQuote(), $e->getMessage());
$result['success'] = false;
$result['error'] = true;
$result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try again later.');
$this->getOnepage()->getQuote()->save();
}
/**
* when there is redirect to third party, we don't want to save order yet.
* we will save the order in return action.
*/
if (isset($redirectUrl)) {
$result['redirect'] = $redirectUrl;
}
$this->getResponse()->setBody(Zend_Json::encode($result));
}
示例8: multiCall
/**
* Multiple calls of resource functionality
*
* @param string $sessionId
* @param array $calls
* @param array $options
* @return array
*/
public function multiCall($sessionId, array $calls = array(), $options = array())
{
$this->_startSession($sessionId);
if (!$this->_getSession()->isLoggedIn($sessionId)) {
return $this->_fault('session_expired');
}
$result = array();
$resourcesAlias = $this->_getConfig()->getResourcesAlias();
$resources = $this->_getConfig()->getResources();
foreach ($calls as $call) {
if (!isset($call[0])) {
$result[] = $this->_faultAsArray('resource_path_invalid');
if (isset($options['break']) && $options['break'] == 1) {
break;
} else {
continue;
}
}
$apiPath = $call[0];
$args = isset($call[1]) ? $call[1] : array();
list($resourceName, $methodName) = explode('.', $apiPath);
if (empty($resourceName) || empty($methodName)) {
$result[] = $this->_faultAsArray('resource_path_invalid');
if (isset($options['break']) && $options['break'] == 1) {
break;
} else {
continue;
}
}
if (isset($resourcesAlias->{$resourceName})) {
$resourceName = (string) $resourcesAlias->{$resourceName};
}
if (!isset($resources->{$resourceName}) || !isset($resources->{$resourceName}->methods->{$methodName})) {
$result[] = $this->_faultAsArray('resource_path_invalid');
if (isset($options['break']) && $options['break'] == 1) {
break;
} else {
continue;
}
}
if (!isset($resources->{$resourceName}->public) && isset($resources->{$resourceName}->acl) && !$this->_isAllowed((string) $resources->{$resourceName}->acl)) {
$result[] = $this->_faultAsArray('access_denied');
if (isset($options['break']) && $options['break'] == 1) {
break;
} else {
continue;
}
}
if (!isset($resources->{$resourceName}->methods->{$methodName}->public) && isset($resources->{$resourceName}->methods->{$methodName}->acl) && !$this->_isAllowed((string) $resources->{$resourceName}->methods->{$methodName}->acl)) {
$result[] = $this->_faultAsArray('access_denied');
if (isset($options['break']) && $options['break'] == 1) {
break;
} else {
continue;
}
}
$methodInfo = $resources->{$resourceName}->methods->{$methodName};
try {
$method = isset($methodInfo->method) ? (string) $methodInfo->method : $methodName;
$modelName = $this->_prepareResourceModelName((string) $resources->{$resourceName}->model);
try {
$model = AO::getModel($modelName);
} catch (Exception $e) {
throw new Mage_Api_Exception('resource_path_not_callable');
}
if (is_callable(array(&$model, $method))) {
if (isset($methodInfo->arguments) && (string) $methodInfo->arguments == 'array') {
$result[] = $model->{$method}(is_array($args) ? $args : array($args));
} elseif (!is_array($args)) {
$result[] = $model->{$method}($args);
} else {
$result[] = call_user_func_array(array(&$model, $method), $args);
}
} else {
throw new Mage_Api_Exception('resource_path_not_callable');
}
} catch (Mage_Api_Exception $e) {
$result[] = $this->_faultAsArray($e->getMessage(), $resourceName, $e->getCustomMessage());
if (isset($options['break']) && $options['break'] == 1) {
break;
} else {
continue;
}
} catch (Exception $e) {
AO::logException($e);
$result[] = $this->_faultAsArray('internal');
if (isset($options['break']) && $options['break'] == 1) {
break;
} else {
continue;
}
}
//.........这里部分代码省略.........