本文整理汇总了PHP中Mage::printException方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::printException方法的具体用法?PHP Mage::printException怎么用?PHP Mage::printException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::printException方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _loadEntities
/**
* Load unique entities records into items
*
* @param bool $printQuery
* @param bool $logQuery
* @throws Exception
* @return Mage_ConfigurableSwatches_Model_Resource_Catalog_Product_Type_Configurable_Product_Collection
*/
public function _loadEntities($printQuery = false, $logQuery = false)
{
if ($this->_pageSize) {
$this->getSelect()->limitPage($this->getCurPage(), $this->_pageSize);
}
$this->printLogQuery($printQuery, $logQuery);
try {
/**
* Prepare select query
* @var string $query
*/
$query = $this->_prepareSelect($this->getSelect());
$rows = $this->_fetchAll($query);
} catch (Exception $e) {
Mage::printException($e, $query);
$this->printLogQuery(true, true, $query);
throw $e;
}
foreach ($rows as $v) {
if (!isset($this->_items[$v['entity_id']])) {
$object = $this->getNewEmptyItem()->setData($v)->setParentIds(array($v['parent_id']));
$this->addItem($object);
if (isset($this->_itemsById[$object->getId()])) {
$this->_itemsById[$object->getId()][] = $object;
} else {
$this->_itemsById[$object->getId()] = array($object);
}
} else {
$parents = $this->_items[$v['entity_id']]->getParentIds();
$parents[] = $v['parent_id'];
$this->_items[$v['entity_id']]->setParentIds($parents);
}
}
return $this;
}
示例2: getopt
$options = getopt('m::');
if (isset($options['m'])) {
if ($options['m'] == 'always') {
$cronMode = 'always';
} elseif ($options['m'] == 'default') {
$cronMode = 'default';
} else {
Mage::throwException('Unrecognized cron mode was defined');
}
} else {
if (!$isShellDisabled) {
$fileName = basename(__FILE__);
$baseDir = dirname(__FILE__);
shell_exec("/bin/sh {$baseDir}/cron.sh {$fileName} -mdefault 1 > /dev/null 2>&1 &");
shell_exec("/bin/sh {$baseDir}/cron.sh {$fileName} -malways 1 > /dev/null 2>&1 &");
exit;
}
}
}
Mage::getConfig()->init()->loadEventObservers('crontab');
Mage::app()->addEventArea('crontab');
if ($isShellDisabled) {
Mage::dispatchEvent('always');
Mage::dispatchEvent('default');
} else {
Mage::dispatchEvent($cronMode);
}
} catch (Exception $e) {
Mage::printException($e);
exit(1);
}
示例3: installFailure
public function installFailure($observer)
{
echo "<h2>There was a problem proceeding with Magento installation.</h2>";
echo "<p>Please contact developers with error messages on this page.</p>";
echo Mage::printException($observer->getEvent()->getException());
}
示例4: _loadAttributes
/**
* Load attributes into loaded entities
*
* @throws Exception
* @return Mage_Eav_Model_Entity_Collection_Abstract
*/
public function _loadAttributes($printQuery = false, $logQuery = false)
{
if (empty($this->_items) || empty($this->_itemsById) || empty($this->_selectAttributes)) {
return $this;
}
$entity = $this->getEntity();
$tableAttributes = array();
$attributeTypes = array();
foreach ($this->_selectAttributes as $attributeCode => $attributeId) {
if (!$attributeId) {
continue;
}
$attribute = Mage::getSingleton('eav/config')->getCollectionAttribute($entity->getType(), $attributeCode);
if ($attribute && !$attribute->isStatic()) {
$tableAttributes[$attribute->getBackendTable()][] = $attributeId;
if (!isset($attributeTypes[$attribute->getBackendTable()])) {
$attributeTypes[$attribute->getBackendTable()] = $attribute->getBackendType();
}
}
}
$selects = array();
foreach ($tableAttributes as $table => $attributes) {
$select = $this->_getLoadAttributesSelect($table, $attributes);
$selects[$attributeTypes[$table]][] = $this->_addLoadAttributesSelectValues($select, $table, $attributeTypes[$table]);
}
$selectGroups = Mage::getResourceHelper('eav')->getLoadAttributesSelectGroups($selects);
foreach ($selectGroups as $selects) {
if (!empty($selects)) {
try {
$select = implode(' UNION ALL ', $selects);
$values = $this->getConnection()->fetchAll($select);
} catch (Exception $e) {
Mage::printException($e, $select);
$this->printLogQuery(true, true, $select);
throw $e;
}
foreach ($values as $value) {
$this->_setItemAttributeValue($value);
}
}
}
return $this;
}
示例5: _loadAttributes
/**
* Load attributes into loaded entities
*
* @return Mage_Eav_Model_Entity_Collection_Abstract
*/
public function _loadAttributes($printQuery = false, $logQuery = false)
{
if (empty($this->_items) || empty($this->_itemsById) || empty($this->_selectAttributes)) {
return $this;
}
$entity = $this->getEntity();
$entityIdField = $entity->getEntityIdField();
$tableAttributes = array();
foreach ($this->_selectAttributes as $attributeCode => $attributeId) {
$attribute = Mage::getSingleton('eav/config')->getCollectionAttribute($entity->getType(), $attributeCode);
if ($attribute && !$attribute->isStatic()) {
$tableAttributes[$attribute->getBackendTable()][] = $attributeId;
}
}
foreach ($tableAttributes as $table => $attributes) {
$select = $this->_getLoadAttributesSelect($table);
try {
$values = $this->_fetchAll($select, $attributes);
} catch (Exception $e) {
Mage::printException($e, $select);
$this->printLogQuery(true, true, $select);
throw $e;
}
foreach ($values as $value) {
$this->_setItemAttributeValue($value);
}
}
return $this;
}
示例6: _loadEntities
/**
* Load entities records into items
*
* Removed page limiting SQL from this method to prevent issues with paging and Klevu.
*
* @throws Exception
* @return Mage_Eav_Model_Entity_Collection_Abstract
*/
public function _loadEntities($printQuery = false, $logQuery = false)
{
if (!$this->isExtensionConfigured()) {
return parent::_loadEntities($printQuery, $logQuery);
}
// API results are already filtered, so include only the products
// returned by the API in the collection
$this->getSelect()->reset(Zend_Db_Select::WHERE);
$this->addFieldToFilter('entity_id', array('in' => $this->_getProductIds()));
// API results are ordered using the selected sort order, so enforce
// the collection order to match the API results
$this->getSelect()->reset(Zend_Db_Select::ORDER);
$this->getSelect()->reset(Zend_Db_Select::LIMIT_OFFSET);
if (count($this->_getProductIds())) {
// Use "FIELD (column, 1[,2,3,4]) ASC" for ordering, where "1[,2,3,4]" is the list of IDs in the order required
$this->getSelect()->order(sprintf('FIELD(`e`.`entity_id`, %s) ASC', implode(',', $this->_getProductIds())));
}
$this->printLogQuery($printQuery, $logQuery);
try {
/**
* Prepare select query
* @var string $query
*/
if (is_callable(array($this, "_prepareSelect"))) {
$query = $this->_prepareSelect($this->getSelect());
} else {
$query = $this->getSelect();
}
$rows = $this->_fetchAll($query);
} catch (Exception $e) {
Mage::printException($e, $query);
$this->printLogQuery(true, true, $query);
throw $e;
}
foreach ($rows as $v) {
$object = $this->getNewEmptyItem()->setData($v);
$this->addItem($object);
if (isset($this->_itemsById[$object->getId()])) {
$this->_itemsById[$object->getId()][] = $object;
} else {
$this->_itemsById[$object->getId()] = array($object);
}
}
return $this;
}
示例7: _loadAttributes
/**
* Load attributes into loaded entities
*
* @return Mage_Eav_Model_Entity_Collection_Abstract
*/
public function _loadAttributes($printQuery = false, $logQuery = false)
{
if (empty($this->_items) || empty($this->_itemsById) || empty($this->_selectAttributes)) {
return $this;
}
$entity = $this->getEntity();
$entityIdField = $entity->getEntityIdField();
foreach ($entity->getAttributesByTable() as $table => $attributes) {
$select = $this->_getLoadAttributesSelect($table);
try {
$values = $this->_fetchAll($select);
} catch (Exception $e) {
Mage::printException($e, $select);
$this->printLogQuery(true, true, $select);
throw $e;
}
foreach ($values as $value) {
$this->_setItemAttributeValue($value);
}
}
return $this;
}
示例8: _loadEntities
/**
* Load entities records into items
*
* @param bool $printQuery
* @param bool $logQuery
*
* @throws Exception
* @throws Mage_Core_Exception
*
* @return Mage_Eav_Model_Entity_Collection_Abstract
*/
public function _loadEntities($printQuery = false, $logQuery = false)
{
// get product IDs from Fact-Finder
$productIds = $this->_getSearchHandler()->getSearchResult();
if (!empty($productIds)) {
$idFieldName = Mage::helper('factfinder/search')->getIdFieldName();
// add Filter to Query
$this->addFieldToFilter($idFieldName, array('in' => array_keys($productIds)));
$this->_pageSize = null;
$this->getSelect()->reset(Zend_Db_Select::LIMIT_COUNT);
$this->getSelect()->reset(Zend_Db_Select::LIMIT_OFFSET);
$this->printLogQuery($printQuery, $logQuery);
Mage::helper('factfinder/debug')->log('Search SQL Query: ' . $this->getSelect()->__toString());
try {
$rows = $this->_fetchAll($this->getSelect());
} catch (Exception $e) {
Mage::printException($e, $this->getSelect());
$this->printLogQuery(true, true, $this->getSelect());
throw $e;
}
$items = array();
foreach ($rows as $v) {
$items[trim($v[$idFieldName])] = $v;
}
foreach ($productIds as $productId => $additionalData) {
if (empty($items[$productId])) {
continue;
}
$v = array_merge($items[$productId], $additionalData->toArray());
$object = $this->getNewEmptyItem()->setData($v);
$this->addItem($object);
if (isset($this->_itemsById[$object->getId()])) {
$this->_itemsById[$object->getId()][] = $object;
} else {
$this->_itemsById[$object->getId()] = array($object);
}
}
}
return $this;
}
示例9: _loadEntities
/**
* Load entities records into items
*
* @param bool $printQuery
* @param bool $logQuery
*
* @throws Exception
*
* @return FACTFinder_Campaigns_Model_Resource_Pushedproducts_Collection
*/
public function _loadEntities($printQuery = false, $logQuery = false)
{
$productIds = array();
$campaigns = $this->_getCampaigns();
if (!$campaigns) {
return $this;
}
foreach ($campaigns->getPushedProducts() as $record) {
$productIds[$record->getId()] = new Varien_Object(array('similarity' => $record->getSimilarity(), 'position' => $record->getPosition()));
}
$idFieldName = Mage::helper('factfinder_campaigns')->getIdFieldName();
if (!empty($productIds)) {
// add Filter to Query
$this->addFieldToFilter($idFieldName, array('in' => array_keys($productIds)));
$this->_pageSize = null;
$this->getSelect()->reset(Zend_Db_Select::LIMIT_COUNT);
$this->getSelect()->reset(Zend_Db_Select::LIMIT_OFFSET);
$this->printLogQuery($printQuery, $logQuery);
Mage::helper('factfinder/debug')->log('Search SQL Query: ' . $this->getSelect()->__toString());
try {
$rows = $this->_fetchAll($this->getSelect());
} catch (Exception $e) {
Mage::printException($e, $this->getSelect());
$this->printLogQuery(true, true, $this->getSelect());
throw $e;
}
$items = array();
foreach ($rows as $v) {
$items[$v[$idFieldName]] = $v;
}
foreach ($productIds as $productId => $additionalData) {
if (empty($items[$productId])) {
continue;
}
$v = array_merge($items[$productId], $additionalData->toArray());
$object = $this->getNewEmptyItem()->setData($v);
$this->addItem($object);
if (isset($this->_itemsById[$object->getId()])) {
$this->_itemsById[$object->getId()][] = $object;
} else {
$this->_itemsById[$object->getId()] = array($object);
}
}
}
return $this;
}