Пример #1
1
 public function getVersion()
 {
     $m = new Mage();
     $version = $m->getVersion();
     if (in_array($version, array('1.5.0.0', '1.5.0.1', '1.5.1.0', '1.6.0.0', '1.9.1.1', '1.10.0.2', '1.10.1.1', '1.11.0.0'))) {
         return true;
     } else {
         return false;
     }
 }
Пример #2
1
 protected function _prepareColumns()
 {
     $this->addColumn('period', array('header' => Mage::helper('sales')->__('Period'), 'index' => 'period', 'width' => 100, 'sortable' => false, 'period_type' => $this->getPeriodType(), 'renderer' => 'adminhtml/report_sales_grid_column_renderer_date', 'totals_label' => Mage::helper('sales')->__('Total'), 'html_decorators' => array('nobr')));
     $this->addColumn('orders_count', array('header' => Mage::helper('sales')->__('Orders'), 'index' => 'orders_count', 'type' => 'number', 'total' => 'sum', 'sortable' => false));
     $this->addColumn('total_qty_ordered', array('header' => Mage::helper('sales')->__('Sales Items'), 'index' => 'total_qty_ordered', 'type' => 'number', 'total' => 'sum', 'sortable' => false));
     $this->addColumn('total_qty_invoiced', array('header' => Mage::helper('sales')->__('Items'), 'index' => 'total_qty_invoiced', 'type' => 'number', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => array('show_actual_columns')));
     if ($this->getFilterData()->getStoreIds()) {
         $this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
     }
     $currencyCode = $this->getCurrentCurrencyCode();
     $rate = $this->getRate($currencyCode);
     $this->addColumn('total_income_amount', array('header' => Mage::helper('sales')->__('Sales Total'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_income_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate));
     $this->addColumn('total_revenue_amount', array('header' => Mage::helper('sales')->__('Revenue'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_revenue_amount', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => array('show_actual_columns'), 'rate' => $rate));
     $this->addColumn('total_profit_amount', array('header' => Mage::helper('sales')->__('Profit'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_profit_amount', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => array('show_actual_columns'), 'rate' => $rate));
     $this->addColumn('total_invoiced_amount', array('header' => Mage::helper('sales')->__('Invoiced'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_invoiced_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate));
     $this->addColumn('total_paid_amount', array('header' => Mage::helper('sales')->__('Paid'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_paid_amount', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => array('show_actual_columns'), 'rate' => $rate));
     $this->addColumn('total_refunded_amount', array('header' => Mage::helper('sales')->__('Refunded'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_refunded_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate));
     $this->addColumn('total_tax_amount', array('header' => Mage::helper('sales')->__('Sales Tax'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_tax_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate));
     $this->addColumn('total_tax_amount_actual', array('header' => Mage::helper('sales')->__('Tax'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_tax_amount_actual', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => array('show_actual_columns'), 'rate' => $rate));
     $this->addColumn('total_shipping_amount', array('header' => Mage::helper('sales')->__('Sales Shipping'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_shipping_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate));
     $this->addColumn('total_shipping_amount_actual', array('header' => Mage::helper('sales')->__('Shipping'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_shipping_amount_actual', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => array('show_actual_columns'), 'rate' => $rate));
     $this->addColumn('total_discount_amount', array('header' => Mage::helper('sales')->__('Sales Discount'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_discount_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate));
     $this->addColumn('total_discount_amount_actual', array('header' => Mage::helper('sales')->__('Discount'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_discount_amount_actual', 'total' => 'sum', 'sortable' => false, 'visibility_filter' => array('show_actual_columns'), 'rate' => $rate));
     $this->addColumn('total_canceled_amount', array('header' => Mage::helper('sales')->__('Canceled'), 'type' => 'currency', 'currency_code' => $currencyCode, 'index' => 'total_canceled_amount', 'total' => 'sum', 'sortable' => false, 'rate' => $rate));
     $this->addExportType('*/*/exportSalesCsv', Mage::helper('adminhtml')->__('CSV'));
     $this->addExportType('*/*/exportSalesExcel', Mage::helper('adminhtml')->__('Excel XML'));
     return parent::_prepareColumns();
 }
Пример #3
1
 public function getTag()
 {
     if (!$this->_tag) {
         $this->_tag = Mage::registry('tagModel');
     }
     return $this->_tag;
 }
Пример #4
1
 public function getAllOptions()
 {
     if (!$this->_options) {
         $this->_options = Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm(true, true);
     }
     return $this->_options;
 }
Пример #5
1
 /**
  * Options getter
  *
  * @return array
  */
 public function toGridOptionArray()
 {
     return array(
         self::IMAGE => Mage::helper('adminhtml')->__('Image'),
         self::PRODUCT => Mage::helper('adminhtml')->__('Product')
     );
 }
 public function getRatingSummary()
 {
     if (!$this->getRatingSummaryCache()) {
         $this->setRatingSummaryCache(Mage::getModel('rating/rating')->getReviewSummary($this->getReviewId()));
     }
     return $this->getRatingSummaryCache();
 }
Пример #7
1
 /**
  * Check whether redirect should be set
  *
  * @return Mage_Adminhtml_Model_System_Config_Backend_Admin_Custom
  */
 protected function _beforeSave()
 {
     if ($this->getOldValue() != $this->getValue()) {
         Mage::register('custom_admin_path_redirect', true, true);
     }
     return $this;
 }
 /**
  * Return Links Section Title for order item
  *
  * @return string
  */
 public function getLinksTitle()
 {
     if ($this->_purchasedLinks->getLinkSectionTitle()) {
         return $this->_purchasedLinks->getLinkSectionTitle();
     }
     return Mage::getStoreConfig(Mage_Downloadable_Model_Link::XML_PATH_LINKS_TITLE);
 }
 /**
  * Block constructor
  */
 public function __construct()
 {
     $this->_controller = 'sitemap';
     $this->_headerText = Mage::helper('sitemap')->__('Google Sitemap');
     $this->_addButtonLabel = Mage::helper('sitemap')->__('Add Sitemap');
     parent::__construct();
 }
Пример #10
1
 /**
  * Action before save
  *
  * @param Mage_Core_Model_Abstract $object
  * @return Mage_Api_Model_Resource_Acl_Role
  */
 protected function _beforeSave(Mage_Core_Model_Abstract $object)
 {
     if (!$object->getId()) {
         $this->setCreated(Mage::getSingleton('core/date')->gmtDate());
     }
     return $this;
 }
Пример #11
1
 /**
  * Prepare to render
  */
 protected function _prepareToRender()
 {
     $this->addColumn('customer_group_id', array('label' => Mage::helper('Mage_Customer_Helper_Data')->__('Customer Group'), 'renderer' => $this->_getGroupRenderer()));
     $this->addColumn('min_sale_qty', array('label' => Mage::helper('Mage_CatalogInventory_Helper_Data')->__('Minimum Qty'), 'style' => 'width:100px'));
     $this->_addAfter = false;
     $this->_addButtonLabel = Mage::helper('Mage_CatalogInventory_Helper_Data')->__('Add Minimum Qty');
 }
Пример #12
1
 public function indexAction()
 {
     //echo 'Hello Index!';
     header('Content-Type: text/plain');
     echo $config = Mage::getConfig()->loadModulesConfiguration('system.xml')->getNode()->asXML();
     exit;
 }
Пример #13
1
 /**
  * Change columns position
  *
  * @param string $table
  * @param string $column
  * @param boolean $after
  * @param boolean $first
  * @return Enterprise_SalesArchive_Model_Resource_Helper_Mysql4
  */
 public function changeColumnPosition($table, $column, $after = false, $first = false)
 {
     if ($after && $first) {
         if (is_string($after)) {
             $first = false;
         } else {
             $after = false;
         }
     } elseif (!$after && !$first) {
         // If no new position specified
         return $this;
     }
     if (!$this->_getWriteAdapter()->isTableExists($table)) {
         Mage::throwException(Mage::helper('enterprise_salesarchive')->__('Table not found'));
     }
     $columns = array();
     $adapter = $this->_getWriteAdapter();
     $description = $adapter->describeTable($table);
     foreach ($description as $columnDescription) {
         $columns[$columnDescription['COLUMN_NAME']] = $adapter->getColumnDefinitionFromDescribe($columnDescription);
     }
     if (!isset($columns[$column])) {
         Mage::throwException(Mage::helper('enterprise_salesarchive')->__('Column not found'));
     } elseif ($after && !isset($columns[$after])) {
         Mage::throwException(Mage::helper('enterprise_salesarchive')->__('Positioning column not found'));
     }
     if ($after) {
         $sql = sprintf('ALTER TABLE %s MODIFY COLUMN %s %s AFTER %s', $adapter->quoteIdentifier($table), $adapter->quoteIdentifier($column), $columns[$column], $adapter->quoteIdentifier($after));
     } else {
         $sql = sprintf('ALTER TABLE %s MODIFY COLUMN %s %s FIRST', $adapter->quoteIdentifier($table), $adapter->quoteIdentifier($column), $columns[$column]);
     }
     $adapter->query($sql);
     return $this;
 }
Пример #14
0
 /**
  * Retrieve all attribute options
  *
  * @return array
  */
 public function getAllOptions()
 {
     if (!$this->_options) {
         $this->_options = array(array('label' => Mage::helper('giftmessage')->__('Yes'), 'value' => 1), array('label' => Mage::helper('giftmessage')->__('No'), 'value' => 0), array('label' => Mage::helper('giftmessage')->__('Use config'), 'value' => 2));
     }
     return $this->_options;
 }
Пример #15
0
 /**
  * @param $quote
  * @return Mage_Sales_Model_Order
  */
 public function convertQuoteToOrder($quote)
 {
     /* @var $service Mage_Sales_Model_Service_Quote */
     $service = Mage::getModel('sales/service_quote', $quote);
     $service->submitAll();
     return $service->getOrder();
 }
 /**
  * Block constructor
  */
 public function __construct()
 {
     $this->_controller = 'system_variable';
     $this->_headerText = Mage::helper('adminhtml')->__('Custom Variables');
     parent::__construct();
     $this->_updateButton('add', 'label', Mage::helper('adminhtml')->__('Add New Variable'));
 }
 public function __construct()
 {
     $this->_controller = 'report_review_product';
     $this->_headerText = Mage::helper('reports')->__('Products Reviews');
     parent::__construct();
     $this->_removeButton('add');
 }
Пример #18
0
 public function getConfig()
 {
     if ($this->getData('config') == null) {
         $this->setConfig(new Varien_Object(Mage::getStoreConfig(self::CONFIG_BASE_PATH . $this->_configKey, $this->getSitemap()->getStoreId())));
     }
     return $this->getData('config');
 }
Пример #19
0
 /**
  * Saving currency rates
  *
  * @param   array $rates
  * @return  Mage_Directory_Model_Currency_Import_Abstract
  */
 protected function _saveRates($rates)
 {
     foreach ($rates as $currencyCode => $currencyRates) {
         Mage::getModel('directory/currency')->setId($currencyCode)->setRates($currencyRates)->save();
     }
     return $this;
 }
Пример #20
0
 public function addItemCountExpr()
 {
     $orderTable = $this->getEntity()->getEntityTable();
     $orderItemEntityTypeId = Mage::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;
 }
 /**
  * Initialize edit tabs
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setId('customer_attribute_tabs');
     $this->setDestElementId('edit_form');
     $this->setTitle(Mage::helper('enterprise_customer')->__('Attribute Information'));
 }
Пример #22
0
 protected function _beforeToHtml()
 {
     $this->addTab('selling', array('label' => Mage::helper('M2ePro')->__('Selling Settings'), 'title' => Mage::helper('M2ePro')->__('Selling Settings'), 'content' => $this->getLayout()->createBlock('M2ePro/adminhtml_common_amazon_listing_add_tabs_selling')->toHtml()));
     $this->addTab('search', array('label' => Mage::helper('M2ePro')->__('Search Settings'), 'title' => Mage::helper('M2ePro')->__('Search Settings'), 'content' => $this->getLayout()->createBlock('M2ePro/adminhtml_common_amazon_listing_add_tabs_search')->toHtml()));
     $this->setActiveTab($this->getRequest()->getParam('tab', 'selling'));
     return parent::_beforeToHtml();
 }
Пример #23
0
 /**
  * Return url for iframe source
  *
  * @return string
  */
 public function getIframeSourceUrl()
 {
     if (!Mage_AdminNotification_Model_Survey::isSurveyUrlValid() || Mage::getSingleton('install/installer')->getHideIframe()) {
         return null;
     }
     return Mage_AdminNotification_Model_Survey::getSurveyUrl();
 }
Пример #24
0
 public function archivedPosts($showMonths = true)
 {
     $id = $this->getRequest()->getParam('id');
     $collection = Mage::getModel('gallery/gallery')->getCollection()->addFieldToFilter('status', 3)->addFieldToFilter('parent_id', $id);
     $collection->setOrder('created_time ', 'desc');
     $pageSize = Mage::getStoreConfig('gallery/trendsettings/looksperpage');
     if (!$pageSize) {
         $pageSize = 8;
     }
     if ($pageSize != 0) {
         $pager = $this->getLayout()->createBlock('page/html_pager', 'archive.pager');
         $pager->setLimit($pageSize);
         $pager->setTemplate('gallery/pager/archive.phtml');
         $pager->setCollection($collection);
         $this->setChild('pager', $pager);
         $backpager = $this->getLayout()->createBlock('page/html_pager', 'archive.backpager');
         $backpager->setLimit($pageSize);
         $backpager->setTemplate('gallery/pager/backlink.phtml');
         $backpager->setCollection($collection);
         $this->setChild('backpager', $backpager);
         $fwdpager = $this->getLayout()->createBlock('page/html_pager', 'archive.fwdpager');
         $fwdpager->setLimit($pageSize);
         $fwdpager->setTemplate('gallery/pager/fwdlink.phtml');
         $fwdpager->setCollection($collection);
         $this->setChild('fwdpager', $fwdpager);
     }
     //print $collection->getSelect();
     return $collection;
 }
Пример #25
0
 /**
  * Get layer state key
  *
  * @return string
  */
 public function getStateKey()
 {
     if ($this->_stateKey === null) {
         $this->_stateKey = 'Q_' . Mage::helper('catalogsearch')->getQuery()->getId() . '_' . parent::getStateKey();
     }
     return $this->_stateKey;
 }
Пример #26
0
 protected function _beforeToHtml()
 {
     $this->moduleName = Mage::helper('M2ePro/Module')->getName();
     $this->moduleVersion = Mage::helper('M2ePro/Module')->getVersion();
     $this->moduleRevision = Mage::helper('M2ePro/Module')->getRevision();
     return parent::_beforeToHtml();
 }
Пример #27
0
 protected function _construct()
 {
     $this->_init('catalogindex/price');
     $this->_getResource()->setStoreId(Mage::app()->getStore()->getId());
     $this->_getResource()->setRate(Mage::app()->getStore()->getCurrentCurrencyRate());
     $this->_getResource()->setCustomerGroupId(Mage::getSingleton('customer/session')->getCustomerGroupId());
 }
Пример #28
0
 /**
  * Initialize custom resource model
  */
 public function __construct()
 {
     parent::_construct();
     $this->setModel('adminhtml/report_item');
     $this->_resource = Mage::getResourceModel('sales/report')->init('sales/order_aggregated_created');
     $this->setConnection($this->getResource()->getReadConnection());
 }
Пример #29
0
 /**
  * license the app
  * 
  */
 public static function license($activationKey, $productToken)
 {
     $url = 'https://ls.amazonaws.com/';
     $client = new Varien_Http_Client($url);
     $client->setMethod(Zend_Http_Client::GET);
     $client->setParameterGet("Action", "ActivateDesktopProduct");
     $client->setParameterGet("ActivationKey", $activationKey);
     $client->setParameterGet("ProductToken", $productToken);
     $response = $client->request();
     if ($response->isSuccessful()) {
         $body = $response->getRawBody();
         $xml = new SimpleXMLElement($body);
         $result = array();
         $result["access"] = $xml->ActivateDesktopProductResult->AWSAccessKeyId;
         $result["secret"] = $xml->ActivateDesktopProductResult->SecretAccessKey;
         $result["usertoken"] = $xml->ActivateDesktopProductResult->UserToken;
         // uncomment to debug raw submission response
         //Mage::log("result=" . print_r($result,true));
         return $result;
     } else {
         Mage::log("Activation failed to URL: " . $url . ", HTTP response code was not 200");
         Mage::log("Raw response: " . print_r($response, true));
         return false;
     }
 }
Пример #30
0
 public function __construct()
 {
     $this->_controller = 'sales_invoice';
     $this->_headerText = Mage::helper('sales')->__('Invoices');
     parent::__construct();
     $this->_removeButton('add');
 }