本文整理汇总了PHP中Mage::getVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::getVersion方法的具体用法?PHP Mage::getVersion怎么用?PHP Mage::getVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::getVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareCollection
/**
* prepare collection for block to display
*
* @return Magestore_Shopbybrand_Block_Adminhtml_Shopbybrand_Grid
*/
protected function _prepareCollection()
{
$store = $this->getRequest()->getParam('store', 0);
$collection = Mage::getModel('shopbybrand/brand')->getCollection()->setStoreId($store);
if (version_compare(Mage::getVersion(), '1.4.1.1', '>=')) {
$sfog = Mage::getModel('core/resource')->getTableName('sales_flat_order_grid');
} else {
$sfog = Mage::getModel('core/resource')->getTableName('sales_order');
}
$collection->getSelect()->join(array('sfoi' => Mage::getModel('core/resource')->getTableName('sales_flat_order_item')), 'FIND_IN_SET(sfoi.product_id, main_table.product_ids)', array('qty_ordered', 'base_row_total'))->join(array('sfog' => $sfog), 'sfoi.order_id = sfog.entity_id AND sfog.status = "complete"', array(""));
if ($store) {
$collection->addFieldToFilter('sfoi.store_id', $store);
}
$collection->getSelect()->group('brand_id')->columns(array('brand_qty_ordered' => 'SUM(IF( qty_ordered > 0, qty_ordered, 0 ))', 'brand_base_row_total' => 'SUM(IF( base_row_total > 0, base_row_total, 0 ))'));
$filter = Mage::app()->getRequest()->getParam('filter');
$date = Mage::helper('adminhtml')->prepareFilterString($filter);
$array = array('date' => true);
if (isset($date['report_from'])) {
$array['from'] = $date['report_from'];
}
if (isset($date['report_to'])) {
$array['to'] = $date['report_to'];
}
if (isset($date['report_from']) || isset($date['report_to'])) {
$collection->addFieldtoFilter('sfoi.created_at', $array);
}
$collection->setIsGroupCountSql(TRUE);
$this->setCollection($collection);
return parent::_prepareCollection();
}
示例2: editAction
public function editAction()
{
if ((double) substr(Mage::getVersion(), 0, 3) > 1.3) {
$this->_title($this->__('Web-forms'))->_title($this->__('Edit Field'));
}
$fieldsId = $this->getRequest()->getParam('id');
$webformsId = $this->getRequest()->getParam('webform_id');
$store = $this->getRequest()->getParam('store');
$field = Mage::getModel('webforms/fields')->setStoreId($store)->load($fieldsId);
if ($field->getWebformId()) {
$webformsId = $field->getWebformId();
}
$webformsModel = Mage::getModel('webforms/webforms')->setStoreId($store)->load($webformsId);
if ($field->getId() || $fieldsId == 0) {
Mage::register('webforms_data', $webformsModel);
Mage::register('field', $field);
$this->loadLayout();
$this->_setActiveMenu('webforms/webforms');
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('WebForms'), Mage::helper('adminhtml')->__('Web-forms'));
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
$this->_addContent($this->getLayout()->createBlock('webforms/adminhtml_fields_edit'))->_addLeft($this->getLayout()->createBlock('webforms/adminhtml_fields_edit_tabs'));
$this->renderLayout();
} else {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('webforms')->__('Field does not exist'));
$this->_redirect('*/adminhtml_webforms/edit', array('id' => $webformsId));
}
}
示例3: uploadAction
public function uploadAction()
{
try {
$pattern = "/([0-9]+\\.[0-9]+\\.[0-9]+)(?:\\.[0-9]+)*/";
$matches = array();
preg_match($pattern, Mage::getVersion(), $matches);
if (version_compare($matches[1], '1.5.1', '<')) {
$uploader = new Varien_File_Uploader('image');
} else {
$uploader = new Mage_Core_Model_File_Uploader('image');
}
$uploader->setAllowedExtensions(array('jpg', 'jpeg', 'gif', 'png'));
$uploader->addValidateCallback('catalog_product_image', Mage::helper('catalog/image'), 'validateUploadFile');
$uploader->setAllowRenameFiles(true);
$uploader->setFilesDispersion(true);
$result = $uploader->save($this->getMagicslideshowBaseMediaPath());
/**
* Workaround for prototype 1.7 methods "isJSON", "evalJSON" on Windows OS
*/
$result['tmp_name'] = str_replace(DS, "/", $result['tmp_name']);
$result['path'] = str_replace(DS, "/", $result['path']);
$result['url'] = $this->getMagicslideshowMediaUrl($result['file']);
$result['file'] = $result['file'];
$result['cookie'] = array('name' => session_name(), 'value' => $this->_getSession()->getSessionId(), 'lifetime' => $this->_getSession()->getCookieLifetime(), 'path' => $this->_getSession()->getCookiePath(), 'domain' => $this->_getSession()->getCookieDomain());
} catch (Exception $e) {
$result = array('error' => $e->getMessage(), 'errorcode' => $e->getCode());
}
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
示例4: editAction
public function editAction()
{
$id = $this->getRequest()->getParam('id');
$model = Mage::getModel('banner/effects')->load($id);
if ($model->getEffectId() || $id == 0) {
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
if (!empty($data)) {
$model->setData($data);
}
Mage::register('effects_data', $model);
$this->loadLayout();
$this->_setActiveMenu('banner/items');
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
$this->_addContent($this->getLayout()->createBlock('banner/adminhtml_effects_edit'))->_addLeft($this->getLayout()->createBlock('banner/adminhtml_effects_edit_tabs'));
$version = substr(Mage::getVersion(), 0, 3);
if (($version == '1.4' || $version == '1.5') && Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
$this->renderLayout();
} else {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('banner')->__('Item does not exist'));
$this->_redirect('*/*/');
}
}
示例5: setValidationFilter
public function setValidationFilter($websiteId, $customerGroupId, $couponCode = '', $now = null)
{
if (version_compare(Mage::getVersion(), '1.4.1.0') < 0) {
return parent::setValidationFilter($websiteId, $customerGroupId, $couponCode, $now);
}
if ($this->getFlag('validation_filter')) {
return $this;
}
if ($couponCode) {
$couponCode = explode(',', $couponCode);
}
// multiple coupon compatibility
$this->getSelect()->reset();
$this->getSelect()->from(array('main_table' => $this->getTable('salesrule/rule')));
$this->addWebsiteGroupDateFilter($websiteId, $customerGroupId, $now);
if ($couponCode) {
$this->getSelect()->joinLeft(array('c' => $this->getTable('salesrule/coupon')), 'main_table.rule_id = c.rule_id ', array('code'));
// Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON is not defined
$this->getSelect()->where($this->getSelect()->getAdapter()->quoteInto(' main_table.coupon_type = ?', 1) . $this->getSelect()->getAdapter()->quoteInto(' OR c.code IN(?)', $couponCode));
$this->getSelect()->group('main_table.rule_id');
} else {
$this->getSelect()->where('main_table.coupon_type = ?', 1);
}
$this->getSelect()->order('sort_order');
$this->setFlag('validation_filter', true);
return $this;
}
示例6: _prepareLayout
protected function _prepareLayout(){
parent::_prepareLayout();
if((float)substr(Mage::getVersion(),0,3) > 1.3 && substr(Mage::getVersion(),0,5)!= '1.4.0')
if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled()) {
$this->getLayout()->getBlock('head')->setCanLoadTinyMce(true);
}
}
示例7: execute
/**
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @return int|void
* @throws RuntimeException
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$initialized = false;
try {
$this->detectMagento($output);
$initialized = $this->initMagento();
} catch (\Exception $e) {
// do nothing
}
$consoleOutput = new ShellOutput();
$config = new Configuration();
$shell = new Shell($config);
if ($initialized) {
$ok = Charset::convertInteger(Charset::UNICODE_CHECKMARK_CHAR);
$edition = $this->getApplication()->isMagentoEnterprise() ? 'EE' : 'CE';
$consoleOutput->writeln('<fg=black;bg=green>Magento ' . \Mage::getVersion() . ' ' . $edition . ' initialized.</fg=black;bg=green> ' . $ok);
} else {
$consoleOutput->writeln('<fg=black;bg=yellow>Magento is not initialized.</fg=black;bg=yellow>');
}
$help = <<<'help'
At the prompt, type <comment>help</comment> for some help.
To exit the shell, type <comment>^D</comment>.
help;
$consoleOutput->writeln($help);
$shell->run($input, $consoleOutput);
}
示例8: paypalPrepareLineItems
/**
* transfer reward points discount to Paypal gateway
*
* @param type $observer
*/
public function paypalPrepareLineItems($observer)
{
if (version_compare(Mage::getVersion(), '1.4.2', '>=')) {
if ($paypalCart = $observer->getPaypalCart()) {
$salesEntity = $paypalCart->getSalesEntity();
$baseDiscount = $salesEntity->getRewardpointsInvitedBaseDiscount();
if ($baseDiscount < 0.0001 && $salesEntity instanceof Mage_Sales_Model_Quote) {
$baseDiscount = Mage::getSingleton('checkout/session')->getRewardpointsInvitedBaseDiscount();
}
if ($baseDiscount > 0.0001) {
$paypalCart->updateTotal(Mage_Paypal_Model_Cart::TOTAL_DISCOUNT, (double) $baseDiscount, Mage::helper('rewardpointsreferfriends')->__('Offer Discount'));
}
}
return $this;
}
$salesEntity = $observer->getSalesEntity();
$additional = $observer->getAdditional();
if ($salesEntity && $additional) {
$baseDiscount = $salesEntity->getRewardpointsBaseDiscount();
if ($baseDiscount > 0.0001) {
$items = $additional->getItems();
$items[] = new Varien_Object(array('name' => Mage::helper('rewardpointsreferfriends')->__('Offer Discount'), 'qty' => 1, 'amount' => -(double) $baseDiscount));
$additional->setItems($items);
}
}
}
示例9: _prepareForm
public function _prepareForm()
{
/* @var $model AM_RevSlider_Model_Slider */
$model = Mage::registry('revslider');
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset('general_fieldset', array('legend' => Mage::helper('revslider')->__('Mobile Touch')));
$f = $fieldset->addField('touchenabled', 'select', array('name' => 'touchenabled', 'label' => Mage::helper('revslider')->__('Touch Enabled'), 'title' => Mage::helper('revslider')->__('Touch Enabled'), 'values' => $model->getOnOffOptions(), 'value' => $model->getData('touchenabled') ? $model->getData('touchenabled') : 'on', 'note' => Mage::helper('revslider')->__('Enable Swipe Function on touch devices')));
$f1 = $fieldset->addField('swipe_velocity', 'text', array('name' => 'swipe_velocity', 'class' => 'validate-number', 'label' => Mage::helper('revslider')->__('Swipe Velocity (0 - 1)'), 'title' => Mage::helper('revslider')->__('Swipe Velocity'), 'value' => $model->getData('swipe_velocity') ? $model->getData('swipe_velocity') : '0.7', 'note' => Mage::helper('revslider')->__('Defines the sensibility of gestures. Smaller values mean a higher sensibility')));
$f2 = $fieldset->addField('swipe_min_touches', 'text', array('name' => 'swipe_min_touches', 'class' => 'validate-number', 'label' => Mage::helper('revslider')->__('Swipe Min Touches'), 'title' => Mage::helper('revslider')->__('Swipe Min Touches'), 'value' => $model->getData('swipe_min_touches') ? $model->getData('swipe_min_touches') : '1', 'note' => Mage::helper('revslider')->__('Defines how many fingers are needed minimum for swiping')));
/*$f3 = $fieldset->addField('swipe_max_touches', 'text', array(
'name' => 'swipe_max_touches',
'class' => 'validate-number',
'label' => Mage::helper('revslider')->__('Swipe Max Touches'),
'title' => Mage::helper('revslider')->__('Swipe Max Touches'),
'value' => $model->getData('swipe_max_touches') ? $model->getData('swipe_max_touches') : '1',
'note' => Mage::helper('revslider')->__('Defines how many fingers are allowed for swiping at the same time')
));*/
$f4 = $fieldset->addField('drag_block_vertical', 'select', array('name' => 'drag_block_vertical', 'label' => Mage::helper('revslider')->__('Drag Block Vertical'), 'title' => Mage::helper('revslider')->__('Drag Block Vertical'), 'values' => $model->getOnOffOptions(), 'value' => $model->getData('drag_block_vertical') ? $model->getData('drag_block_vertical') : 'off', 'note' => Mage::helper('revslider')->__('Prevent vertical scroll during swipe')));
$this->setForm($form);
if ($model->getId()) {
$form->setValues($model->getData());
}
if (version_compare(Mage::getVersion(), '1.7.0.0') < 0) {
$dependenceElement = $this->getLayout()->createBlock('amext/adminhtml_widget_form_element_dependence');
} else {
$dependenceElement = $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence');
}
$this->setChild('form_after', $dependenceElement->addFieldMap($f->getHtmlId(), $f->getName())->addFieldMap($f1->getHtmlId(), $f1->getName())->addFieldMap($f2->getHtmlId(), $f2->getName())->addFieldMap($f4->getHtmlId(), $f4->getName())->addFieldDependence($f1->getName(), $f->getName(), 'on')->addFieldDependence($f2->getName(), $f->getName(), 'on')->addFieldDependence($f4->getName(), $f->getName(), 'on'));
return parent::_prepareForm();
}
示例10: isAvailable
public function isAvailable($quote = null)
{
$checkResult = new StdClass();
$isActive = (bool) (int) $this->getConfigData('active', $quote ? $quote->getStoreId() : null);
$allowedIps = Mage::getStoreConfig('dev/restrict/allow_ips', Mage::app()->getStore());
if (!$isActive && !empty($allowedIps) && Mage::getStoreConfig('payment/redsys/developermode', Mage::app()->getStore()) && Mage::helper('core')->isDevAllowed()) {
$isActive = true;
}
$checkResult->isAvailable = $isActive;
$checkResult->isDeniedInConfig = !$isActive;
// for future use in observers
Mage::dispatchEvent('payment_method_is_active', array('result' => $checkResult, 'method_instance' => $this, 'quote' => $quote));
if ($checkResult->isAvailable && $quote) {
$magentoVersion = Mage::getVersion();
if (version_compare($magentoVersion, '1.8', '>=')) {
$checkResult->isAvailable = $this->isApplicableToQuote($quote, self::CHECK_RECURRING_PROFILES);
} else {
$implementsRecurring = $this->canManageRecurringProfiles();
if ($quote && !$implementsRecurring && $quote->hasRecurringItems()) {
$checkResult->isAvailable = false;
}
}
}
return $checkResult->isAvailable;
}
示例11: _setAttributeValue
/**
* Initialize attribute value for object
*
* @param Glace_Blog_Model_Abstract $object
* @param array $valueRow
* @return Glace_Blog_Model_Resource_Abstract
*/
protected function _setAttributeValue($object, $valueRow)
{
$attribute = $this->getAttribute($valueRow['attribute_id']);
if ($attribute) {
$attributeCode = $attribute->getAttributeCode();
$isDefaultStore = $valueRow['store_id'] == $this->getDefaultStoreId();
if (isset($this->_attributes[$valueRow['attribute_id']])) {
if ($isDefaultStore) {
$object->setAttributeDefaultValue($attributeCode, $valueRow['value']);
} else {
$object->setAttributeDefaultValue($attributeCode, $this->_attributes[$valueRow['attribute_id']]['value']);
}
} else {
$this->_attributes[$valueRow['attribute_id']] = $valueRow;
}
$value = $valueRow['value'];
$valueId = $valueRow['value_id'];
$object->setData($attributeCode, $value);
if (!$isDefaultStore) {
$object->setExistsStoreValueFlag($attributeCode);
}
if (Mage::getVersion() > '1.6.2.0') {
$attribute->getBackend()->setEntityValueId($object, $valueId);
} else {
$attribute->getBackend()->setValueId($object, $valueId);
}
}
return $this;
}
示例12: _prepareLayout
public function _prepareLayout()
{
parent::_prepareLayout();
$head = $this->getLayout()->getBlock('head');
$slider = Mage::registry('revslider');
$slide = Mage::registry('revslide');
$backUrl = $this->getUrl('*/*/edit', array('id' => $slider->getId(), 'activeTab' => 'slide_section'));
$deleteUrl = $this->getUrl('*/*/deleteSlide', array('id' => $slide->getId(), 'sid' => $slider->getId()));
$this->updateButton('delete', 'onclick', "setLocation('{$deleteUrl}');");
$this->updateButton('save', 'onclick', 'revLayer.save();');
$this->updateButton('back', 'onclick', 'setLocation(\'' . $backUrl . '\');');
$this->_addButton('sac', array('label' => Mage::helper('revslider')->__('Save and Continue Edit'), 'class' => 'save', 'onclick' => "revLayer.save(true);"));
if (version_compare(Mage::getVersion(), '1.7.0.0') < 0) {
$head->addJs('am/extensions/prototype/dragdrop.js');
}
if ($slider->getId()) {
if ($slider->getData('load_googlefont') == 'true') {
$fonts = $slider->getData('google_font');
if (is_array($fonts)) {
foreach ($fonts as $font) {
$href = Mage::helper('revslider')->getCssHref($font);
$head->addLinkRel('stylesheet', $href);
}
}
}
}
return $this;
}
示例13: getProductStockQty
public function getProductStockQty()
{
if (Mage::getVersion() <= '1.4.2.0') {
return $this->getProduct()->getStockItem()->getQty();
}
return $this->getProduct()->getStockItem()->getStockQty();
}
示例14: getRegionTableAlias
/**
* Retrieve table alias for region table depending
* on Magento version. If Magento version lower
* then 1.6 result will 'region' and in other case 'main_table'.
*
* @return string
*/
public function getRegionTableAlias()
{
if (version_compare('1.6', Mage::getVersion()) == 1) {
return 'region';
}
return 'main_table';
}
示例15: _prepareLayout
protected function _prepareLayout()
{
parent::_prepareLayout();
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post'));
$form->setFieldNameSuffix('quickresponse');
$id = $this->getRequest()->getParam('id');
$fieldset = $form->addFieldset('quickresponse_fieldset', array('legend' => Mage::helper('webforms')->__('Quick Response')));
$fieldset->addField('title', 'text', array('label' => Mage::helper('webforms')->__('Title'), 'class' => 'required-entry', 'required' => true, 'style' => 'width:700px;', 'name' => 'title'));
$editor_type = 'textarea';
$config = '';
if ((double) substr(Mage::getVersion(), 0, 3) > 1.3 && substr(Mage::getVersion(), 0, 5) != '1.4.0' || Mage::helper('webforms')->getMageEdition() == 'EE') {
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('tab_id' => $this->getTabId()));
$wysiwygConfig["files_browser_window_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index');
$wysiwygConfig["directives_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive');
$wysiwygConfig["directives_url_quoted"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive');
$wysiwygConfig["add_widgets"] = false;
$wysiwygConfig["add_variables"] = false;
$wysiwygConfig["widget_plugin_src"] = false;
$plugins = $wysiwygConfig->setData("plugins", array());
$editor_type = 'editor';
$config = $wysiwygConfig;
}
$fieldset->addField('message', $editor_type, array('label' => Mage::helper('webforms')->__('Message'), 'title' => Mage::helper('webforms')->__('Message'), 'style' => 'width:700px; height:300px;', 'name' => 'message', 'required' => true, 'config' => $config));
if (Mage::getSingleton('adminhtml/session')->getFormData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getFormData());
Mage::getSingleton('adminhtml/session')->setFormData(false);
} elseif (Mage::registry('quickresponse')->getId()) {
$form->setValues(Mage::registry('quickresponse')->getData());
}
$form->addField('quickresponse_id', 'hidden', array('name' => 'quickresponse_id', 'value' => $id));
$form->addField('saveandcontinue', 'hidden', array('name' => 'saveandcontinue'));
$form->setUseContainer(true);
$this->setForm($form);
}
开发者ID:monarcmoso,项目名称:beta2,代码行数:34,代码来源:VladimirPopov_WebForms_Block_Adminhtml_Quickresponse_Edit_Form.php