本文整理汇总了PHP中Mage::Helper方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage::Helper方法的具体用法?PHP Mage::Helper怎么用?PHP Mage::Helper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage
的用法示例。
在下文中一共展示了Mage::Helper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareForFrontend
public function prepareForFrontend($data)
{
if (empty($data)) {
return $data;
}
list($code, $id) = explode('/', $data);
if ($code == 'product') {
// TODO: Wirklich so laden?
$product = Mage::getModel('catalog/product');
$product->load($id);
return $product->getProductUrl();
} else {
if ($code == 'category') {
// TODO: Wirklich so laden?
/** @var $product Mage_Catalog_Model_Category */
$category = Mage::getModel('catalog/category');
$category->load($id);
return $category->getUrl();
} else {
if (is_numeric($data)) {
return Mage::Helper('cms/page')->getPageUrl($data);
}
}
}
if (substr($data, 0, 4) == 'http' || substr($data, 0, 1) == '.' || substr($data, 0, 1) == '/') {
// do not touch http or relative links
return $data;
}
return Mage::getUrl($data);
}
示例2: render
public function render(Varien_Object $row)
{
$product_id = $row->getEntityId();
if ($product_id) {
$requestData = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('top_filter'));
if (empty($requestData)) {
$requestData = Mage::Helper('inventoryreports')->getDefaultOptionsWarehouse();
}
$warehouse = $requestData['warehouse_select'];
$gettime = Mage::Helper('inventoryreports')->getTimeSelected($requestData);
$datefrom = $gettime['date_from'];
$dateto = $gettime['date_to'];
$warehouse_product = Mage::getModel('inventoryplus/warehouse_product')->getCollection()->addFieldToFilter('warehouse_id', $warehouse);
$supplyneeds = array();
$total_supplyneeds = 0;
$method = Mage::getStoreConfig('inventory/supplyneed/supplyneeds_method');
if ($datefrom && $dateto && $method == 2 && strtotime($datefrom) <= strtotime($dateto)) {
$max_needs = Mage::helper('inventorysupplyneeds')->calMaxAverage($product_id, $datefrom, $dateto, $warehouse);
} elseif ($datefrom && $dateto && $method == 1 && strtotime($datefrom) <= strtotime($dateto)) {
$max_needs = Mage::helper('inventorysupplyneeds')->calMaxExponential($product_id, $datefrom, $dateto, $warehouse);
} else {
$max_needs = 0;
}
if ($max_needs > 0) {
$supplyneeds[$product_id] = $max_needs;
$total_supplyneeds += $max_needs;
}
}
if ($total_supplyneeds == 0) {
return '0';
} else {
return $total_supplyneeds;
}
}
示例3: _prepareCollection
protected function _prepareCollection()
{
$requestData = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('top_filter'));
if (empty($requestData)) {
$requestData = Mage::Helper('inventoryreports')->getDefaultOptionsWarehouse();
}
$gettime = Mage::Helper('inventoryreports')->getTimeSelected($requestData);
$collection = Mage::getModel('inventoryphysicalstocktaking/physicalstocktaking_product')->getCollection();
/* Get product name and sku from catalog, because physicalstocktaking_product does not have them */
if ($storeId = $this->getRequest()->getParam('store', 0)) {
$collection->addStoreFilter($storeId);
}
$productAttributes = array('product_name' => 'name');
foreach ($productAttributes as $alias => $attributeCode) {
$tableAlias = $attributeCode . '_table';
$attribute = Mage::getSingleton('eav/config')->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attributeCode);
$collection->getSelect()->joinLeft(array($tableAlias => $attribute->getBackendTable()), "main_table.product_id = {$tableAlias}.entity_id AND {$tableAlias}.attribute_id={$attribute->getId()}", array($alias => 'value'));
}
$collection->join('catalog/product', 'product_id=`catalog/product`.entity_id', array('product_sku' => 'sku'));
/* Endl get product name and sku from catalog */
/* Join physicalstocktaking to get created_at */
$collection->getSelect()->joinLeft(array('physicalstocktaking' => $collection->getTable('inventoryphysicalstocktaking/physicalstocktaking')), "main_table.physicalstocktaking_id = physicalstocktaking.physicalstocktaking_id", array('created_at', 'warehouse_id'));
/* Endl join physicalstocktaking to get created_at */
$collection->getSelect()->columns(array('difference' => new Zend_Db_Expr("(adjust_qty - old_qty)")));
$collection->getSelect()->where("physicalstocktaking.created_at BETWEEN '" . $gettime['date_from'] . "' AND '" . $gettime['date_to'] . "'");
if (isset($requestData['warehouse_select']) && $requestData['warehouse_select']) {
$warehouse_id = $requestData['warehouse_select'];
$collection->getSelect()->where("physicalstocktaking.warehouse_id = '{$warehouse_id}'");
}
$this->setCollection($collection);
$this->_prepareTotals('adjust_qty,old_qty,difference');
return parent::_prepareCollection();
}
示例4: _prepareForm
protected function _prepareForm()
{
$counrtries = Mage::Helper('stores')->getCountryCollection();
$form = new Varien_Data_Form();
$stores_id = $this->getRequest()->getParam('id');
$fieldset = $form->addFieldset('general', array('legend' => Mage::helper('core')->__('General Settings')));
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('tab_id' => 'page_tabs'));
$formData = Mage::getModel('stores/state')->getStoreData($stores_id);
$fieldset->addField('title', 'text', array('label' => Mage::helper('core')->__('Store Name'), 'title' => Mage::helper('core')->__('Store Name'), 'name' => 'title', 'width' => '50px', 'required' => true));
$fieldset->addField('zip_code', 'text', array('label' => Mage::helper('core')->__('Zip Code'), 'title' => Mage::helper('core')->__('Zip Code'), 'name' => 'zip_code', 'style' => 'width:50px;', 'required' => false));
$fieldset->addField('country', 'select', array('label' => Mage::helper('core')->__('Country'), 'title' => Mage::helper('core')->__('Country'), 'options' => $counrtries, 'name' => 'country', 'style' => 'width:250px;', 'required' => true));
$fieldset->addField('state', 'text', array('label' => Mage::helper('core')->__('State (Full Name)'), 'title' => Mage::helper('core')->__('State (Full Name)'), 'name' => 'state', 'style' => 'width:250px;', 'required' => false));
$fieldset->addField('city', 'text', array('label' => Mage::helper('core')->__('City'), 'title' => Mage::helper('core')->__('City'), 'name' => 'city', 'style' => 'width:250px;', 'required' => true));
$fieldset->addField('address', 'text', array('label' => Mage::helper('core')->__('Address'), 'title' => Mage::helper('core')->__('Address'), 'name' => 'address', 'style' => 'width:250px;', 'required' => true));
$fieldset->addField('is_all_products', 'checkbox', array('label' => Mage::helper('core')->__('Use All Products from WebSite Store'), 'title' => Mage::helper('core')->__('Use All Products from WebSite Store'), 'name' => 'is_all_products', 'checked' => $formData['is_all_products'] == 1 ? true : false, 'required' => false, 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()));
$fieldset->addField('phone', 'text', array('label' => Mage::helper('core')->__('Phone'), 'title' => Mage::helper('core')->__('Phone'), 'name' => 'phone', 'required' => false, 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()));
$fieldset->addField('fax', 'text', array('label' => Mage::helper('core')->__('Fax'), 'title' => Mage::helper('core')->__('Fax'), 'name' => 'fax', 'required' => false, 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()));
$fieldset->addField('picture_desc', 'textarea', array('label' => Mage::helper('core')->__('Description for Store\'s Photo'), 'title' => Mage::helper('core')->__('Description for Store\'s Photo'), 'name' => 'picture_desc', 'required' => false, 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()));
$fieldset->addField('relatlng', 'checkbox', array('label' => Mage::helper('core')->__('Update Lat/Lng after Save'), 'title' => Mage::helper('core')->__('Update Lat/Lng after Save'), 'name' => 'relatlng', 'required' => false, 'checked' => 'checked', 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()));
$fieldset->addField('lng', 'text', array('label' => Mage::helper('core')->__('Latitude'), 'title' => Mage::helper('core')->__('Latitude'), 'name' => 'lng', 'required' => false, 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()));
$fieldset->addField('lat', 'text', array('label' => Mage::helper('core')->__('Longitude'), 'title' => Mage::helper('core')->__('Longitude'), 'name' => 'lat', 'required' => false, 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()));
$formData['desc'] = unserialize($formData['desc']);
$form->addValues($formData);
$form->setFieldNameSuffix('storeform');
$this->setForm($form);
}
示例5: _prepareLayout
/**
* Sets parameters for tempalte
*
* @return Celebros_Conversionpro_Block_Analytics_View
*/
protected function _prepareLayout()
{
//running simulated search, to have the log handle down the page.
//Mage::helper('conversionpro')->getCurrentLayer()->getProductCollection()->getFacetedData('');
$this->setCustomerId(Mage::getStoreConfig('conversionpro/anlx_settings/cid'));
$this->setHost(Mage::getStoreConfig('conversionpro/anlx_settings/host'));
$product = $this->getProduct();
//Set product click tracking params
if (isset($product)) {
$this->setProductSku($product->getSku());
$this->setProductName(str_replace("'", "\\'", $product->getName()));
$this->setProductPrice($product->getFinalPrice());
$webSessionId = isset($_SESSION['core']['visitor_data']['session_id']) ? $_SESSION['core']['visitor_data']['session_id'] : session_id();
$this->setWebsessionId($webSessionId);
} else {
$pageReferrer = Mage::getModel('core/url')->getBaseUrl() . $_SERVER['PHP_SELF'];
$this->setPageReferrer($pageReferrer);
//$this->setQwiserSearchSessionId(Mage::getSingleton('conversionpro/session')->getSearchSessionId());
$this->setQwiserSearchSessionId($this->_generateGUID());
$webSessionId = isset($_SESSION['core']['visitor_data']['session_id']) ? $_SESSION['core']['visitor_data']['session_id'] : session_id();
$this->setWebsessionId($webSessionId);
if (Mage::Helper('conversionpro')->hasSearchResults()) {
$this->setQwiserSearchLogHandle(Mage::Helper('conversionpro')->getSearchResults()->GetLogHandle());
}
}
return parent::_prepareLayout();
}
示例6: controller_action_predispatch
/**
* Hook to record all fron controller events
* @param Varien_Event_Observer $observer
*/
public function controller_action_predispatch(Varien_Event_Observer $observer)
{
try {
if (extension_loaded('newrelic')) {
$controllerAction = $observer->getControllerAction();
$request = $controllerAction->getRequest();
$controllerName = explode("_", $request->getControllerName());
if (Mage::getStoreConfig('newrelic/settings/ignore_admin_routes') && $request->getRouteName() == 'adminhtml' || $request->getModuleName() == 'admin' || in_array('adminhtml', $controllerName)) {
Mage::Helper('newrelic')->setAppName(false);
newrelic_ignore_transaction();
newrelic_ignore_apdex();
return $this;
}
if (mage::helper('newrelic')->ignoreModule($request->getModuleName()) === true) {
Mage::Helper('newrelic')->setAppName(false);
newrelic_ignore_transaction();
newrelic_ignore_apdex();
return $this;
}
if (Mage::getStoreConfig('newrelic/settings/named_transactions')) {
$route = $request->getRouteName() . '/' . $request->getControllerName() . '/' . $request->getActionName();
if (Mage::getStoreConfig('newrelic/settings/add_module_to_named_transactions')) {
$route .= ' (module: ' . $request->getModuleName() . ')';
}
newrelic_name_transaction($route);
Mage::Helper('newrelic')->setAppName(true);
return $this;
}
}
} catch (Exception $e) {
mage::logException($e);
}
}
示例7: _getUrlParams
/**
* Get parameters used for build add product to compare list urls
*
* @param Mage_Catalog_Model_Product $product
* @return array
*/
protected function _getUrlParams($product)
{
if (key_exists(Mage::Helper('salesperson/mapping')->getMapping('id'), $product->Field)) {
$productId = $product->Field[Mage::Helper('salesperson/mapping')->getMapping('id')];
}
return array('product' => $productId, Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl());
}
示例8: _prepareCollection
protected function _prepareCollection()
{
$series = array();
$total_data = array();
$warehouse_name = array();
$productIds = array();
$difference = array();
$phyids = '';
$requestData = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('top_filter'));
if (empty($requestData)) {
$requestData = Mage::Helper('inventoryreports')->getDefaultOptionsWarehouse();
}
$gettime = Mage::Helper('inventoryreports')->getTimeSelected($requestData);
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$installer = Mage::getModel('core/resource');
if ($requestData['warehouse_select']) {
$warehouse_collection = Mage::getModel('inventoryplus/warehouse')->getCollection();
$warehouse_id = $requestData['warehouse_select'];
$query = 'SELECT DISTINCT p.product_id,t.physicalstocktaking_id
FROM ' . $installer->getTableName("erp_inventory_physicalstocktaking t") . '
LEFT JOIN ' . $installer->getTableName("erp_inventory_physicalstocktaking_product p") . '
ON t.physicalstocktaking_id = p.physicalstocktaking_id
WHERE t.status > 0 AND t.warehouse_id = "' . $warehouse_id . '" AND t.created_at BETWEEN "' . $gettime['date_from'] . '" AND "' . $gettime['date_to'] . '"
';
$results = $readConnection->fetchAll($query);
if ($results) {
foreach ($results as $value) {
$productIds[] = $value['product_id'];
if ($phyids == '') {
$phyids = "('" . $value['physicalstocktaking_id'] . "'";
} else {
$phyids .= ',';
$phyids .= "'" . $value['physicalstocktaking_id'] . "'";
}
}
$phyids .= ")";
} else {
$phyids = "('0')";
}
$productIds = Mage::helper('inventoryreports')->checkProductInWarehouse($productIds, $warehouse_id);
$collection = Mage::getModel('catalog/product')->getCollection()->addFieldToFilter('entity_id', array('in' => $productIds));
$collection->joinField('old_qty', 'inventoryphysicalstocktaking/physicalstocktaking_product', 'old_qty', 'product_id=entity_id', '{{table}}.old_qty IS NOT NULL AND {{table}}.old_qty > 0 AND {{table}}.physicalstocktaking_id IN ' . $phyids, 'left');
$collection->joinField('adjust_qty', 'inventoryphysicalstocktaking/physicalstocktaking_product', 'adjust_qty', 'product_id=entity_id', '{{table}}.adjust_qty IS NOT NULL AND {{table}}.adjust_qty > 0 AND {{table}}.physicalstocktaking_id IN ' . $phyids, 'left');
$collection->getSelect()->columns(array('sum_old_qty' => new Zend_Db_Expr("SUM(at_old_qty.old_qty)")));
$collection->getSelect()->columns(array('sum_adjust_qty' => new Zend_Db_Expr("SUM(at_adjust_qty.adjust_qty)")));
$collection->getSelect()->columns(array('difference' => new Zend_Db_Expr("SUM(at_adjust_qty.adjust_qty) - SUM(at_old_qty.old_qty)")));
// $collection->getSelect()->columns(array('name' => new Zend_Db_Expr("e.name")));
$collection->getSelect()->group('e.entity_id');
}
Mage::getSingleton('core/resource_iterator')->walk($collection->addAttributeToSelect('*')->getSelect(), array(array($this, 'collectionCallback')), array());
$filterCollection = new Varien_Data_Collection();
for ($i = 0; $i < count($this->_arr); $i++) {
$filterCollection->addItem($this->_arr[$i]);
}
$this->setCollection($filterCollection);
$this->_prepareTotals('sum_adjust_qty,sum_old_qty,difference');
return parent::_prepareCollection();
}
开发者ID:javik223,项目名称:Evron-Magento,代码行数:59,代码来源:Totalstockdifferentwhenphysicalstocktakingbywarehouse.php
示例9: clearCache
/**
* Clears the images on the CDN and the local cache.
*
* @return string
*/
public function clearCache()
{
parent::clearCache();
$cds = Mage::Helper('imagecdn')->factory();
if ($cds->useCdn()) {
$cds->clearCache();
}
}
示例10: pushEvent
/**
* Static since a store config exception (caused by a module config error) cannot call magento's model objects.
* If a store config exception occurs, the exception class logs it drect.
*
* @param type $e
*/
public static function pushEvent($e, $setAppName = true)
{
if (extension_loaded('newrelic')) {
$message = $e->getMessage();
$message = empty($message) ? get_class($e) : $message;
if ($setAppName) {
Mage::Helper('newrelic')->setAppName();
}
newrelic_notice_error($message, $e);
}
}
示例11: recordEvent
/**
* Record a log event to new relic
*
* @param type $event
* @return type
*/
public function recordEvent($event)
{
if (extension_loaded('newrelic')) {
if (Mage::getStoreConfig('newrelic/settings/record_system_log') && !Mage::helper('newrelic')->ignoreMessage($event['message'], 'system_log')) {
if ($event['priorityName'] == 'DEBUG' && Mage::getStoreConfig('newrelic/settings/system_log_ignore_debug')) {
return;
}
Mage::Helper('newrelic')->setAppName();
newrelic_notice_error($this->_eventType . ': [' . $event['priorityName'] . '] ' . $event['message']);
}
}
}
示例12: getAnlxSearchResultFunction
public function getAnlxSearchResultFunction()
{
if (Mage::getStoreConfig('salesperson/anlx_settings/dc') == "" || Mage::getStoreConfig('salesperson/anlx_settings/cid') == "") {
return "";
}
/*$observer = array('ssid' => Mage::Helper('salesperson')->getSalespersonApi()->results->SearchInformation->SessionId, 'logHandle' => Mage::Helper('salesperson')->getSalespersonApi()->results->GetLogHandle());
Mage::getModel('salesperson/observer')->sendResultAnlxInfo($observer);*/
$dca = Mage::getStoreConfig('salesperson/anlx_settings/dc');
$cid = Mage::getStoreConfig('salesperson/anlx_settings/cid');
$results = Mage::Helper('salesperson')->getSalespersonApi()->results;
$sessionId = $this->_getSession()->getSessionId();
return Mage::getModel('salesperson/api_anlx_analyticsFunctions', array("G_DATA_COLLECTOR_ADDRESS" => $dca, "G_CUSTOMER_ID" => $cid, "G_CUSTOMER_NAME" => $cid, "G_PUBLIC_KEY" => ""))->Celebros_Analytics_SearchResults($results->SearchInformation->SessionId, $results->GetLogHandle(), $sessionId, '1', $sessionId, isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '', (bool) Mage::getStoreConfig('salesperson/anlx_settings/protocol_connection'), true);
}
示例13: setOrderId
public function setOrderId()
{
$active = Mage::Helper('customorderid/data')->custom_order_id_active();
$OrderEntityType = Mage::getModel('eav/entity_type')->load(self::SALES_ORDER, 'entity_type_code')->getData();
$invoiceEntityType = Mage::getModel('eav/entity_type')->load(self::SALES_INVOICE, 'entity_type_code')->getData();
$shipmentEntityType = Mage::getModel('eav/entity_type')->load(self::SALES_SHIPMENT, 'entity_type_code')->getData();
$creditmemoEntityType = Mage::getModel('eav/entity_type')->load(self::SALES_CREDITMEMO, 'entity_type_code')->getData();
$orderEnable = Mage::Helper('customorderid/data')->custom_order_enable();
$invoiceEnable = Mage::Helper('customorderid/data')->custom_invoice_enable();
$shippingEnable = Mage::Helper('customorderid/data')->custom_shipping_enable();
$creditmemoEnable = Mage::Helper('customorderid/data')->custom_creditmemo_enable();
if ($active) {
//** Sales Order New Id
if ($orderEnable) {
$orderIdNew = Mage::Helper('customorderid/customorderid')->order();
$this->newOrderIdSet($orderIdNew, $OrderEntityType['entity_type_id']);
} else {
$this->newOrderIdSet(self::SALES_DEFAULT_ID, $OrderEntityType['entity_type_id']);
}
//** Invoice New Order Id
if ($invoiceEnable) {
$invoiceIdNew = Mage::Helper('customorderid/customorderid')->invoice();
$this->newOrderIdSet($invoiceIdNew, $invoiceEntityType['entity_type_id']);
} else {
$this->newOrderIdSet(self::SALES_DEFAULT_ID, $invoiceEntityType['entity_type_id']);
}
//** Shipment New Order Id
if ($shippingEnable) {
$shipmentNew = Mage::Helper('customorderid/customorderid')->shipment();
$this->newOrderIdSet($shipmentNew, $shipmentEntityType['entity_type_id']);
} else {
$this->newOrderIdSet(self::SALES_DEFAULT_ID, $shipmentEntityType['entity_type_id']);
}
//** CreditMemo New Order Id
if ($creditmemoEnable) {
$creditMemoIdNew = Mage::Helper('customorderid/customorderid')->creditmemo();
$this->newOrderIdSet($creditMemoIdNew, $creditmemoEntityType['entity_type_id']);
} else {
$this->newOrderIdSet(self::SALES_DEFAULT_ID, $creditmemoEntityType['entity_type_id']);
}
// $updateNewOrderId = Mage::getModel('eav/entity_store')->load($OrderEntityType['entity_type_id'], 'entity_type_id')->addData(array('increment_last_id'=> $orderIdNew))->save();
// $OrderEntityStore = Mage::getModel('eav/entity_store')->load($invoiceEntityType['entity_type_id'], 'entity_type_id')->addData(array('increment_last_id'=> $invoiceIdNew))->save();
// $OrderEntityStore = Mage::getModel('eav/entity_store')->load($shipmentEntityType['entity_type_id'], 'entity_type_id')->addData(array('increment_last_id'=> $shipmentNew))->save();
// $OrderEntityStore = Mage::getModel('eav/entity_store')->load($creditmemoEntityType['entity_type_id'], 'entity_type_id')->addData(array('increment_last_id'=> $creditMemoIdNew))->save();
} else {
$this->newOrderIdSet(self::SALES_DEFAULT_ID, $OrderEntityType['entity_type_id']);
$this->newOrderIdSet(self::SALES_DEFAULT_ID, $invoiceEntityType['entity_type_id']);
$this->newOrderIdSet(self::SALES_DEFAULT_ID, $shipmentEntityType['entity_type_id']);
$this->newOrderIdSet(self::SALES_DEFAULT_ID, $creditmemoEntityType['entity_type_id']);
}
}
示例14: getFullTaxInfo
public function getFullTaxInfo()
{
$taxClassAmount = Mage::helper('tax')->getCalculatedTaxes($this->getOrder());
if (!empty($taxClassAmount)) {
$shippingTax = Mage::helper('tax')->getShippingTax($this->getOrder());
$taxClassAmount = array_merge($shippingTax, $taxClassAmount);
$i = 0;
$len = count($taxClassAmount);
foreach ($taxClassAmount as $tax) {
$tableHtmlPseudo = '';
$taxTitle = Mage::Helper('core/string')->cleanString($tax['title']);
$taxTitle = 'tax_' . preg_replace("[^A-Za-z0-9]", "", $taxTitle);
$taxTitle = strtolower($taxTitle);
$percent = $tax['percent'] ? ' (' . floatval($tax['percent']) . '%)' : '';
$tableHtmlPseudo .= '<tr>';
$tableHtmlPseudo .= '<td><span>' . $tax['title'] . ' ' . $percent . '</span></td>';
$tableHtmlPseudo .= '<td><span>' . $this->getAmountPrefix() . $this->getOrder()->formatPriceTxt($tax['tax_amount']) . '</span></td>';
$tableHtmlPseudo .= '</tr>';
if ($i++ == 0) {
$tableHtml = '<table class="table-rates-tax"><tbody>';
}
$tableHtml .= $tableHtmlPseudo;
if ($i == $len) {
$tableHtml .= '</tbody></table>';
}
$tax_info[] = array($taxTitle => array('value' => $this->getAmountPrefix() . $this->getOrder()->formatPriceTxt($tax['tax_amount']), 'label' => Mage::helper('tax')->__($tax['title']) . $percent . ':'), 'pseudotaxtable_data' => array('value' => $tableHtmlPseudo, 'label' => Mage::helper('tax')->__($rate['title']) . $percent . ':'), 'taxtable_data' => array('value' => $tableHtml, 'label' => Mage::helper('tax')->__($rate['title']) . $percent . ':'));
$taxClassAmount = $tax_info;
}
} else {
$rates = Mage::getResourceModel('sales/order_tax_collection')->loadByOrder($this->getOrder())->toArray();
$fullInfo = Mage::getSingleton('tax/calculation')->reproduceProcess($rates['items']);
$tax_info = array();
if ($fullInfo) {
foreach ($fullInfo as $info) {
if (isset($info['hidden']) && $info['hidden']) {
continue;
}
$_amount = $info['amount'];
foreach ($info['rates'] as $rate) {
$percent = $rate['percent'] ? ' (' . $rate['percent'] . '%)' : '';
$taxTitle = Mage::Helper('core/string')->cleanString($rate['title']);
$taxTitle = 'tax_' . preg_replace("[^A-Za-z0-9]", "", $taxTitle);
$taxTitle = strtolower($taxTitle);
$tax_info[] = array($taxTitle => array('value' => $this->getAmountPrefix() . $this->getOrder()->formatPriceTxt($_amount), 'label' => Mage::helper('tax')->__($rate['title']) . $percent . ':'));
}
}
}
$taxClassAmount = $tax_info;
}
return $taxClassAmount;
}
示例15: _prepareColumns
protected function _prepareColumns()
{
$configModel = Mage::getModel('utils/config');
$carriersModel = Mage::getModel('utils/carriers');
$this->addColumn("id", array("header" => Mage::helper("labels")->__("ID"), "align" => "right", "width" => "50px", "index" => "id"));
$this->addColumn("carrier_id", array("header" => Mage::helper("labels")->__("Carrier Name"), "align" => "left", "index" => "carrier_id", "type" => "options", "options" => $configModel->toOptions($carriersModel->getCollection()->load(), array('id' => 'description'))));
$this->addColumn("prefix", array("header" => Mage::helper("labels")->__("Prefix"), "align" => "left", "index" => "prefix"));
$this->addColumn("suffix", array("header" => Mage::helper("labels")->__("Suffix"), "align" => "left", "index" => "suffix"));
$this->addColumn("begin_code", array("header" => Mage::helper("labels")->__("Begin Code"), "align" => "left", "index" => "begin_code"));
$this->addColumn("end_code", array("header" => Mage::helper("labels")->__("End Code"), "align" => "left", "index" => "end_code"));
$this->addColumn("alarm", array("header" => Mage::helper("labels")->__("Alarm"), "align" => "left", "index" => "alarm"));
$this->addColumn("enabled", array("header" => Mage::helper("labels")->__("Enabled"), "align" => "left", "index" => "enabled", "type" => "options", "options" => Mage::Helper('labels')->getYesNo()));
return parent::_prepareColumns();
}