1、magento快捷格式化商品价格:
2、格式化magento时间:
最后一个参数是’false’或’true’,是否显示时分秒。 3、快捷获取magento LOGO:
4、用户中心菜单增删改:
修改: $_links['address_book']['label']='我的地址簿'; $_links的所有’name’ account(账户显示板) account_edit(账户信息) address_book(地址薄) orders(我的订单) billing_agreements(记账协议) recurring_profiles(循环设定档) reviews(我的产品评价) tags(我的标签) wishlist(我的收藏) OAuth Customer Tokens(我的应用程序) newsletter(新闻邮件订阅) downloadable_products(我的可下载产品) 5、添加删除一个系统Attribute
增加:<?php $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->addAttribute('customer', 'customcode', array( 'label' => 'customcode', 'type' => 'varchar', 'visible' => true, 'required' => false, 'sort_order' = > 10 )); ?>
删除:<?php $setup = new Mage_Eav_Model_Entity_Setup('core_setup'); $setup->removeAttribute('customer', 'customcode'); ?>
修改:$installer->updateAttribute('catalog_product','short_description','is_required',0);
6、Magento获取客户端IP:
7、Magento: Get checkout cart total details | Subtotal/Grandtotal/Discount/Tax:
$totalItemsInCart = Mage::helper('checkout/cart')->getItemsCount(); //total items in cart
$totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); //Total object
$subtotal = round($totals["subtotal"]->getValue()); //Subtotal value
$grandtotal = round($totals["grand_total"]->getValue()); //Grandtotal value
if(isset($totals['discount']) && $totals['discount']->getValue()) {
$discount = round($totals['discount']->getValue()); //Discount value if applied
} else {
$discount = '';
}
if(isset($totals['tax']) && $totals['tax']->getValue()) {
$tax = round($totals['tax']->getValue()); //Tax value if present
} else {
$tax = '';
}
获取订单地址信息:$order->getShippingAddress()->getData()
获取订单支付信息:$order->getPayment()->getData()
$order->getPayment()->getMethodInstance()->getCode()
8、Magento – 获取订单支付信息:
<?pph
$order_id = 2314; //use your own order id
$order = Mage::getModel("sales/order")->load($order_id); //load order by order id
$payment_method_code = $order->getPayment()->getMethodInstance()->getCode();
//eg. checkmo
?>
9、获取网站基本信息: Echo Store ID:<?php echo Mage::app()->getStore()->getId(); ?> Echo Store View Name: <?php echo Mage::app()->getStore()->getName(); ?> Echo Store Group Name: <?php echo Mage::app()->getStore()->getGroup()->getName(); ?> Echo Website Name: <?php echo Mage::app()->getWebsite()->getName(); ?>
10、获取订单状态:
<?php foreach ($this->getOrder()->getStatusHistoryCollection(true) as $_item): ?>
$this->helper('core')->formatDate($_item->getCreatedAtDate(), 'medium')//操作时间
$_item->getStatusLabel()//状态名称
<?php if ($this->isCustomerNotificationNotApplicable($_item)): ?>//是否通知用户
<?php echo $this->helper('sales')->__('Notification Not Applicable') ?>
<?php elseif ($_item->getIsCustomerNotified()): ?>
<?php echo $this->helper('sales')->__('Notified') ?>
<img src="<?php echo $this->getSkinUrl('images/ico_success.gif') ?>" width="16" height="16" alt="" />
<?php else: ?>
<?php echo $this->helper('sales')->__('Not Notified') ?>
<?php endif; ?>
//备注描述
<?php if ($_item->getComment()): ?>
<br/><?php echo $this->escapeHtml($_item->getComment(), array('b','br','strong','i','u')) ?>
<?php endif; ?>
<?php endforeach; ?>
11、top.link的添加删除:
(责任编辑:最模板) |

ecshop仿bianli100便利商城模
人气:5637
shopex绿色类凡客模板
人气:546
ecshop服装批发模板
人气:1389
Amass时尚潮流综合商城ma
人气:102
designershoes 外贸鞋子ecsho
人气:619
ecshop专业汽车用品英文外
人气:1021