本文整理汇总了PHP中Mage类的典型用法代码示例。如果您正苦于以下问题:PHP Mage类的具体用法?PHP Mage怎么用?PHP Mage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getVersion
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: _prepareColumns
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: getTag
public function getTag()
{
if (!$this->_tag) {
$this->_tag = Mage::registry('tagModel');
}
return $this->_tag;
}
示例4: getAllOptions
public function getAllOptions()
{
if (!$this->_options) {
$this->_options = Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm(true, true);
}
return $this->_options;
}
示例5: toGridOptionArray
/**
* Options getter
*
* @return array
*/
public function toGridOptionArray()
{
return array(
self::IMAGE => Mage::helper('adminhtml')->__('Image'),
self::PRODUCT => Mage::helper('adminhtml')->__('Product')
);
}
示例6: getRatingSummary
public function getRatingSummary()
{
if (!$this->getRatingSummaryCache()) {
$this->setRatingSummaryCache(Mage::getModel('rating/rating')->getReviewSummary($this->getReviewId()));
}
return $this->getRatingSummaryCache();
}
示例7: _beforeSave
/**
* 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;
}
示例8: getLinksTitle
/**
* 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);
}
示例9: __construct
/**
* 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: _beforeSave
/**
* 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: _prepareToRender
/**
* 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: indexAction
public function indexAction()
{
//echo 'Hello Index!';
header('Content-Type: text/plain');
echo $config = Mage::getConfig()->loadModulesConfiguration('system.xml')->getNode()->asXML();
exit;
}
示例13: changeColumnPosition
/**
* 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: getAllOptions
/**
* 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: convertQuoteToOrder
/**
* @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();
}