`
cgzhang
  • 浏览: 71978 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表
在Magento中可以使用SalesRule模块下的Mage_SalesRule_Model_Coupon_Codegenerator类随机生成coupon code。 首选获得code genetator实例,可以调用Mage_SalesRule_Model_Rule的静态方法: $codeGenerator = Mage_SalesRule_Model_Rule::getCouponCodeGenerator() 也可以自己通过下面的方法: $codeGenerator = Mage::getSingleton('salesrule/coupon_codegenerator', a ...
首先,创建一个新的Form Field 类: <?php class Glamour_Glscore_Block_Adminhtml_System_Config_Date extends Mage_Adminhtml_Block_System_Config_Form_Field { protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $date = new Varien_Data_Form_Element_Date; $format = 'yyyy-MM-dd HH ...
获得指定customer 购买的产品信息,如果是configurable的,则取configurable的名字。 $orderedProductsForCustomerData = array(); $orderTable =Mage::getSingleton('core/resource')->getTableName('sales/order'); $orderItemTable = Mage::getSingleton('core/resource')->getTableNa ...
Rewrite Mage_Catalog_Model_Layer: 加入以下代码: <?php class Rayfox_Catalog_Model_Layer extends Mage_Catalog_Model_Layer { public function prepareProductCollection($collection) { if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) { Mage::getM ...
<!--?xml version="1.0" encoding="UTF-8" standalone="no"?--> Install Nginx And PHP-FPM On Mac Lion 安装Nginx 方法1:使用brew. brew install nginx 按提示操作,安装完成后nginx的配置文件在/usr/local/etc/nginx/nginx.conf。 启动nginx:
Before install: 1. Go to app/etc/modules, edit Mage_All.xml, only set the following modules active. Mage_Core Mage_Eav Mage_Page Mage_Install Mage_Admin Mage_Adminhtml Mage_Cron Mage_Directory (need by customer module and system country option) Mage_Customer Mage_Log Mage_Backup Mage_Poll Mage_Ratin ...
In Block class: public function _toHtml(){ Mage::getSingleton('customer/session')->setBeforeAuthUrl($this->getRequest()->getRequestUri()); if (!Mage::getSingleton('customer/session')->isLoggedIn()){ header("Status: 301"); header('Location: '.$this->getU ...
$orders = Mage::getModel('sales/order')->getCollection(); Mage::getSingleton('core/resource_iterator')->walk($orders->getSelect(), array(array($this,'proccessOrder'))); public function proccessOrder($args) { $order = Mage::getModel('sales/order'); $order->setData($args['row']) ...
$orders = Mage::getModel('sales/order')->getCollection(); $orders->getSelect()->reset('columns'); $orders->getSelect()->columns(array('total_amount'=>'sum(grand_total)'));
$rate = Mage::getModel('enterprise_reward/reward_rate'); $rate->fetch(1, Mage::app()->getStore()->getId(),Enterprise_Reward_Model_Reward_Rate::RATE_EXCHANGE_DIRECTION_TO_CURRENCY); echo $rate->calculateToCurrency(100);
Magento是一个十分优秀的电子商务系统,但是有时候我们需要增加一些新的功能或者修改原有的功能,一般情况下通过自己开发的扩展模块(module)可以满足要求。如果需要修改系统的一些默认行为(如结账,注册等),不提倡直接修改Magento本身模块里的代码(修改后无法升级,因为升级后所做的修改会被升级后的文件覆盖),这时候Magento提供的rewrite机制可以满足我们的要求。 Magento中可以rewrite的对象有:Block, Controller(frontend 和admin)以及Model。 最常用的是rewrite controller,参见:Magento重载Control ...
在模块的etc目录下新建system.xml配置文件,内容如下: <?xml version="1.0"?> <config> <sections> <!--要加入的section的标识符,此处为sales, 也可以加入自己的section --> <sales> <groups> <my_settings translate="label"> ...
在模块的controllers目录下创建Adminhtml目录,新建一个Controller类。 class Glamour_CustomerMessage_Adminhtml_MessageController extends Mage_Adminhtml_Controller_Action { //设置当前激活的菜单 protected function _initAction(){ $this->loadLayout() ->_setActiveMenu('customer/message') ->_a ...
在模块的etc目录下增加adminhtml.xml配置文件,用于加入自定义的菜单项。文件内容如下: <?xml version="1.0"?> <config> <menu> <!-- 父菜单项标识,此处是在标题为Customers的菜单下加入子菜单--> <!-- Magento一级管理菜单标识和显示标题--> <!-- dashboard =>Dashboard catalog ...
Magento的cms页面和static block页面中可以用一些指示符来得到相应的信息,如{{skin url=".."}} {{media url="..."}}等。 在Mage_Cms_Block_Page类的_toHtml方法中可以找到下面的代码: $helper = Mage::helper('cms'); $processor = $helper->getPageTemplateProcessor(); $html = $processor->filter($this->getP ...
Global site tag (gtag.js) - Google Analytics