本文整理汇总了PHP中Mage::getVersionInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::getVersionInfo方法的具体用法?PHP Mage::getVersionInfo怎么用?PHP Mage::getVersionInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::getVersionInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _exportAddressses
protected function _exportAddressses($data)
{
$version = Mage::getVersionInfo();
if ($version['major'] >= 1 && $version['minor'] >= 7) {
parent::_exportAddressses($data);
} else {
$address = new Varien_Object();
Varien_Object_Mapper::accumulateByMap($data, $address, $this->_billingAddressMap);
$address->setExportedKeys(array_values($this->_billingAddressMap));
$this->_applyStreetAndRegionWorkarounds($address);
$this->setExportedBillingAddress($address);
// assume there is shipping address if there is at least one field specific to shipping
if (isset($data['SHIPTONAME'])) {
$shippingAddress = clone $address;
Varien_Object_Mapper::accumulateByMap($data, $shippingAddress, $this->_shippingAddressMap);
$this->_applyStreetAndRegionWorkarounds($shippingAddress);
// PayPal doesn't provide detailed shipping name fields, so the name will be overwritten
$firstName = $data['SHIPTONAME'];
$lastName = null;
if (isset($data['FIRSTNAME']) && $data['LASTNAME']) {
$firstName = $data['FIRSTNAME'];
$lastName = $data['LASTNAME'];
}
$shippingAddress->addData(array('prefix' => null, 'firstname' => $firstName, 'middlename' => null, 'lastname' => $lastName, 'suffix' => null));
$this->setExportedShippingAddress($shippingAddress);
}
}
}
示例2: getCount
public function getCount($filter, $range)
{
$select = $this->_getSelect($filter);
$connection = $this->_getReadAdapter();
$response = $this->_dispatchPreparePriceEvent($filter, $select);
//$table = $this->_getIndexTableAlias();
$i = Mage::getVersionInfo();
if ($i['minor'] < 7) {
$table = 'price_index';
} else {
$table = 'e';
}
$additional = str_replace('price_index.', 'e.', join('', $response->getAdditionalCalculations()));
$rate = $filter->getCurrencyRate();
$countExpr = new Zend_Db_Expr('COUNT(*)');
$rangeExpr = new Zend_Db_Expr("FLOOR((({$table}.min_price {$additional}) * {$rate}) / {$range}) + 1");
if (($customer = Mage::getModel('customer/session')->getCustomer()) && $customer->getId()) {
$from = $select->getPart('from');
$tablePrefix = (string) Mage::getConfig()->getTablePrefix();
if (!in_array('cp_prices', array_keys($from))) {
$select->joinLeft(array('cp_prices' => $tablePrefix . 'customerprices_prices'), 'cp_prices.product_id=e.entity_id AND cp_prices.customer_id=' . $customer->getId() . ' and qty = 1', array());
}
$col = "IF(cp_prices.special_price > 0, cp_prices.special_price,IF(cp_prices.price > 0,cp_prices.price,IF({$table}.final_price IS NULL, {$table}.min_price,{$table}.final_price)))";
//$col = "IF(cp_prices.special_price > 0, cp_prices.special_price,IF(cp_prices.price > 0,cp_prices.price,IF(price_index.final_price > 0, price_index.final_price,price_index.min_price)))";
//$col = "IF(cp_prices.special_price > 0, cp_prices.special_price,IF(cp_prices.price > 0,cp_prices.price,price_index.final_price))";
$rangeExpr = new Zend_Db_Expr("FLOOR((({$col} {$additional}) * {$rate}) / {$range}) + 1");
}
$select->columns(array('range' => $rangeExpr, 'count' => $countExpr));
$select->group('range');
return $connection->fetchPairs($select);
}
示例3: _fillOptions
/**
* Gathers all of the sales rules on the system
*
* @return array
*/
protected function _fillOptions($default = false)
{
$options = array();
/** @var Mage_SalesRule_Model_Resource_Rule_Collection $rules */
$now = Mage::getModel('core/date')->date('Y-m-d');
$rules = Mage::getModel('salesrule/rule')->getCollection()->addFieldToFilter('is_active', array('eq' => 1))->addFieldToFilter('coupon_type', array('in' => array(Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC, Mage_SalesRule_Model_Rule::COUPON_TYPE_AUTO)))->addFieldToFilter('from_date', array(array('null' => true), array('lteq' => $now)))->addFieldToFilter('to_date', array(array('null' => true), array('gteq' => $now)))->setOrder('sort_order');
if (!Mage::helper('bronto_common')->isVersionMatch(Mage::getVersionInfo(), 1, array(4, 5, 6, 10, 11, array('major' => 9, 'edition' => 'Professional')))) {
$rules->addFieldToFilter('use_auto_generation', array('eq' => 0));
}
// If there are any rules
if ($rules->getSize()) {
// Cycle Through Rules
foreach ($rules as $rule) {
// Handle Coupon Label
$couponLabel = '(Coupon: *Auto Generated*)';
if ($couponCode = $rule->getPrimaryCoupon()->getCode()) {
$couponLabel = "(Coupon: {$couponCode})";
}
// Build Option
$options[] = array('label' => "{$rule->getName()} {$couponLabel}", 'value' => $rule->getRuleId());
}
}
$noneSelected = '-- None Selected --';
if ($default) {
$noneSelected = '-- Use Default --';
}
// Add -- None Selected -- Option
array_unshift($options, array('label' => Mage::helper('bronto_common')->__($noneSelected), 'value' => ''));
return $options;
}
示例4: currentVersion
/**
*
* Retrieve the version of Magento.
* @param string $asType Should be 'array' if we want the method to return array
* @return mixed Either string or array (if the passed param is 'array')
*/
public function currentVersion($asType = '')
{
if ($asType == 'array') {
return Mage::getVersionInfo();
}
return Mage::getVersion();
}
示例5: _disableAndUnlink
/**
* Reset Roundtrip verification status, disable all modules, and unlink all Bronto Transactional Emails
*
* @param bool $includeCommon
*/
protected function _disableAndUnlink($includeCommon = false)
{
$sentry = Mage::getModel('bronto_common/keysentry');
$sentry->disableModules($this->getScope(), $this->getScopeId(), $includeCommon);
if (!Mage::helper('bronto_common')->isVersionMatch(Mage::getVersionInfo(), 1, array(array('edition' => 'Professional', 'major' => 9)))) {
$sentry->unlinkEmails(Mage::getModel('bronto_email/message')->getCollection(), $this->getScope(), $this->getScopeId());
}
}
示例6: submitOrder
public function submitOrder()
{
$version = Mage::getVersionInfo();
if (1 <= $version['major'] && 4 <= $version['minor'] && $version['revision'] <= 1) {
return parent::submitOrder();
}
$this->_deleteNominalItems();
$this->_validate();
$quote = $this->_quote;
$isVirtual = $quote->isVirtual();
$transaction = Mage::getModel('core/resource_transaction');
if ($quote->getCustomerId()) {
$transaction->addObject($quote->getCustomer());
}
$transaction->addObject($quote);
$quote->reserveOrderId();
if ($isVirtual) {
$order = $this->_convertor->addressToOrder($quote->getBillingAddress());
} else {
$order = $this->_convertor->addressToOrder($quote->getShippingAddress());
}
$order->setBillingAddress($this->_convertor->addressToOrderAddress($quote->getBillingAddress()));
if (!$isVirtual) {
$order->setShippingAddress($this->_convertor->addressToOrderAddress($quote->getShippingAddress()));
}
$order->setPayment($this->_convertor->paymentToOrderPayment($quote->getPayment()));
foreach ($this->_orderData as $key => $value) {
$order->setData($key, $value);
}
foreach ($quote->getAllItems() as $item) {
$orderItem = $this->_convertor->itemToOrderItem($item);
if ($item->getParentItem()) {
$orderItem->setParentItem($order->getItemByQuoteItemId($item->getParentItem()->getId()));
}
// elite paint
$this->setItemPaint($orderItem, $item);
$order->addItem($orderItem);
}
$transaction->addObject($order);
$transaction->addCommitCallback(array($order, 'place'));
$transaction->addCommitCallback(array($order, 'save'));
/**
* We can use configuration data for declare new order status
*/
Mage::dispatchEvent('checkout_type_onepage_save_order', array('order' => $order, 'quote' => $quote));
Mage::dispatchEvent('sales_model_service_quote_submit_before', array('order' => $order, 'quote' => $quote));
try {
$transaction->save();
$this->_inactivateQuote();
Mage::dispatchEvent('sales_model_service_quote_submit_success', array('order' => $order, 'quote' => $quote));
} catch (Exception $e) {
Mage::dispatchEvent('sales_model_service_quote_submit_failure', array('order' => $order, 'quote' => $quote));
throw $e;
}
Mage::dispatchEvent('sales_model_service_quote_submit_after', array('order' => $order, 'quote' => $quote));
$this->_order = $order;
return $order;
}
示例7: _construct
public function _construct()
{
parent::_construct();
$this->_templateTable = $this->getResource()->getTable('bronto_email/template');
$this->_brontoTable = $this->getResource()->getTable('bronto_email/message');
if (Mage::helper('bronto_common')->isVersionMatch(Mage::getVersionInfo(), 1, array(4, array('edition' => 'Professional', 'major' => 9)))) {
$this->_select->joinLeft(array($this->_brontoTable), "`{$this->_templateTable}`.`template_id` = `{$this->_brontoTable}`.`core_template_id`");
}
}
示例8: isOldMagento
/**
* Test if this is an older magento
*
* @return boolean
*/
public function isOldMagento()
{
$isEE = Mage::helper('core')->isModuleEnabled('Enterprise_Enterprise');
$magentoVersion = Mage::getVersionInfo();
if ($magentoVersion['minor'] < 9 || $isEE && $magentoVersion['minor'] < 13) {
return true;
}
return false;
}
示例9: versionIsAtLeast16
public function versionIsAtLeast16()
{
$versionInfo = Mage::getVersionInfo();
if ($versionInfo['major'] >= 1) {
if ($versionInfo['minor'] >= 6) {
return true;
}
}
return false;
}
示例10: isPaymentPatchRequired
/**
* Is patch requried for 1.5?
*
* @return string
*/
public function isPaymentPatchRequired()
{
$version = Mage::getVersionInfo();
if ($version['major'] == '1' && $version['minor'] == '5') {
$payment = Mage::getSingleton('sales/order_payment');
if (!method_exists($payment, 'lookupTransaction')) {
return true;
}
return false;
}
}
示例11: _initAction
/**
* Initialize layout.
*
* @return Mage_ImportExport_Adminhtml_ExportController
*/
protected function _initAction()
{
$this->_title($this->__('Import/Export'))->loadLayout()->_setActiveMenu('system/importexport');
// add support of Magento CE 1.6
$version_info = Mage::getVersionInfo();
if ($version_info['major'] == 1 && $version_info['minor'] < 7 && !method_exists('Mage', 'getEdition')) {
$head = $this->getLayout()->getBlock('head');
$head->addItem('js_css', 'prototype/windows/themes/magento.css');
$head->removeItem('skin_css', 'lib/prototype/windows/themes/magento.css');
}
return $this;
}
示例12: toOptionArray
/**
* Generate list of email templates
*
* @return array
*/
public function toOptionArray()
{
// If Collection isn't already in registry, create it
if (!($collection = Mage::registry('config_system_email_template'))) {
// Define Tables
$templateTable = Mage::getSingleton('core/resource')->getTableName('bronto_email/template');
$brontoTable = Mage::getSingleton('core/resource')->getTableName('bronto_email/message');
// Load Collection
$collection = Mage::getModel('bronto_email/template')->getCollection();
// Apply conditional logic to handle 1.9 overriding collection _construct
if (Mage::helper('bronto_common')->isVersionMatch(Mage::getVersionInfo(), 1, array(4, 5, array('edition' => 'Professional', 'major' => 9), 10))) {
$collection->getSelect()->joinLeft($brontoTable, "{$templateTable}.template_id = {$brontoTable}.core_template_id");
}
// If module is enabled
if (Mage::helper('bronto_email')->isEnabled()) {
// If Store Scope
if (Mage::app()->getRequest()->getParam('store')) {
// if Store ID Specified, filter collection
if ($storeCode = Mage::app()->getRequest()->getParam('store')) {
$store = Mage::app()->getStore($storeCode);
$storeId = $store->getId();
$collection->addStoreViewFilter($storeId);
}
}
// Add Where statement to prevent loading templates without core_template_id
$collection->getSelect()->where("{$brontoTable}.core_template_id IS NOT NULL");
}
$collection->addOrder('template_code', 'asc')->load();
Mage::register('config_system_email_template', $collection);
}
// Get Array of Template Options
$options = $collection->toOptionArray();
// Set up Default Template Name
$templateName = Mage::helper('adminhtml')->__('Default Template from Locale');
// Add support for Template configuration page
$pathParts = explode('/', $this->getPath());
if ('bronto_email' == $pathParts[0] && 'templates' == $pathParts[1]) {
$path = str_replace('-', '/', array_pop($pathParts));
} else {
$path = $this->getPath();
}
// Add a 'Do Not Send' option
array_unshift($options, array('value' => 'nosend', 'label' => 'Do Not Send'));
$nodeName = str_replace('/', '_', $path);
$templateLabelNode = Mage::app()->getConfig()->getNode(self::XML_PATH_TEMPLATE_EMAIL . $nodeName . '/label');
if ($templateLabelNode) {
$templateName = Mage::helper('adminhtml')->__((string) $templateLabelNode);
$templateName = Mage::helper('adminhtml')->__('%s (Default Template from Locale)', $templateName);
}
array_unshift($options, array('value' => $nodeName, 'label' => $templateName));
return $options;
}
示例13: watchDisableAction
/**
* Watches for the enable switch to change to disable
*
* event: bronto_disable
*
* @param Varien_Event_Observer $observer
*/
public function watchDisableAction(Varien_Event_Observer $observer)
{
// Get Scope
$scopeParams = Mage::helper('bronto_common')->getScopeParams();
$scope = $scopeParams['scope'];
$scopeId = $scopeParams[$scopeParams['scope'] . '_id'];
// Get Sentry and Disable Modules
$sentry = Mage::getModel('bronto_common/keysentry');
$sentry->disableModules($scope, $scopeId, true);
// Unlink all Emails
if (!Mage::helper('bronto_common')->isVersionMatch(Mage::getVersionInfo(), 1, array(array('edition' => 'Professional', 'major' => 9)))) {
$sentry->unlinkEmails(Mage::getModel('bronto_email/message')->getCollection(), $scope, $scopeId);
}
}
示例14: _prepareCollection
protected function _prepareCollection()
{
/* @var $collection Bronto_Email_Model_Mysql4_Template_Collection */
$collection = Mage::getModel('bronto_email/template')->getCollection();
$templateTable = Mage::getSingleton('core/resource')->getTableName('bronto_email/template');
$brontoTable = Mage::getSingleton('core/resource')->getTableName('bronto_email/message');
// Apply conditional logic to handle 1.9 overriding collection _construct
if (Mage::helper('bronto_common')->isVersionMatch(Mage::getVersionInfo(), 1, array(4, 5, array('edition' => 'Professional', 'major' => 9), 10))) {
$collection->getSelect()->joinLeft($brontoTable, "{$templateTable}.template_id = {$brontoTable}.core_template_id");
}
// Limit grid to show only those templates without message id assigned
$collection->addFieldToFilter("{$brontoTable}.bronto_message_id", array('null' => true));
$this->setCollection($collection);
return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
}
示例15: _afterLoad
/**
* Perform actions after object load
*
* @return Bronto_Reminder_Model_Rule
*/
protected function _afterLoad()
{
Mage_Core_Model_Abstract::_afterLoad();
if (Mage::helper('bronto_verify')->isVersionMatch(Mage::getVersionInfo(), 1, array(array('<=', 6), array('edition' => 'Professional', 'major' => 9), 10, 11))) {
$conditionsArr = unserialize($this->getConditionsSerialized());
if (!empty($conditionsArr) && is_array($conditionsArr)) {
$this->getConditions()->loadArray($conditionsArr);
}
}
$messageData = $this->_getResource()->getMessageData($this->getId());
foreach ($messageData as $data) {
$message = empty($data['message_id']) ? null : $data['message_id'];
$sendType = empty($data['send_type']) ? 'transactional' : $data['send_type'];
$this->setData('store_message_' . $data['store_id'], $message)->setData('store_message_sendtype_' . $data['store_id'], $sendType)->setData('store_message_sendflags_' . $data['store_id'], $data['send_flags']);
}
return $this;
}