
magento
文章平均质量分 53
newjueqi
这个作者很懒,什么都没留下…
展开
-
解决安装magento时“Unable to read response, or response is empty” 的错误
在安装magento时有时会出现Url “http://79.170.40.182/cosmeticsfairy.co.uk/magento/” is not accessibleUnable to read response, or response is em原创 2011-09-16 10:41:11 · 4783 阅读 · 0 评论 -
magento负载均衡使用同一个数据库的方法
在magento的负载均衡策略中,其中一个方法是有多台服务来跑同一份代码,使用同一个数据库。例如,有一台服务器A,网址是www.a.com,另外一台服务器B,网址是www.b.com,服务器A和B访问同一个数据库,但这个过程有一个问题,在magento的数据库中,是有url的访问限制,这个问题的解决可通过设置base url为{{base_url}} , 如下图所示注意原创 2012-01-11 16:59:54 · 2357 阅读 · 0 评论 -
magento PE 11.00中Product URL Suffix的一个bug
在SEO中有个需求:Product URL Suffix为“/”,Category URL Suffix为“/”但在实际的测试中,发现:Product URL Suffix为“/”,Category URL Suffix为“/” :失败Product URL Suffix为“-”,Category URL Suffix为“-” :成功Product URL Suff原创 2012-01-30 16:54:55 · 1310 阅读 · 0 评论 -
magento 自定义pager自定义每页显示多少条记录
1. 在xml中,定义catalog/product_list_toolbar为xxxx/xxxxter_toolbar page/3columns.phtml defaultreview/helper/su.ph原创 2012-01-31 18:38:48 · 1635 阅读 · 0 评论 -
magento 添加customer attribute的方法
http://stackoverflow.com/questions/5961290/adding-attributes-to-customer-entity/5962237#5962237$installer = $this;$installer->startSetup();$setup = new Mage_Eav_Model_Entity_Setup('core_setup转载 2012-02-09 16:08:13 · 2059 阅读 · 0 评论 -
magento :如何在后台的form中添加内容可变的select filed
如下图:在product form中添加了一个attribute “spot_spotter”,这个attribute可以选择某个已注册的用户。注意了,由于这个attribute 的内容是动态变化的,所以这个product attribute 的type是select,但却不能通过常规的方法指定option值。最后研究出以下的解决方案:(1)在setup文件中原创 2011-12-12 17:00:02 · 1283 阅读 · 0 评论 -
magneto插件下载
http://freegento.com/ddl-magento-extension.php原创 2012-02-20 09:39:03 · 1086 阅读 · 0 评论 -
高级应用Magento-订单创建流程及程序代码
出处:http://www.wemvc.com/1606.html老规矩,直接看代码吧。下面的代码是如何通过程序创建一个完美订单。<?phprequire_once 'app/Mage.php'; Mage::app('default');//初始化程序,设置当前店铺 $store = Mage::app()->getStore('default');//通转载 2012-01-14 15:35:36 · 2326 阅读 · 0 评论 -
magento的一些小技巧(20120321更新)
1.加载某个attribute: $attributeCode=Mage::getModel('catalog/resource_eav_attribute') ->load($attrbuteId) ->getData("attribute_code");2.原创 2011-11-01 11:09:09 · 8100 阅读 · 0 评论 -
magento下读取CSV文件的简单方法
//load csv file$this->_csvAdapter = Mage::getModel('ImportExport/import_adapter_csv', $filepath);while($this->_csvAdapter->valid()) { $data = $this->_csvAdapter->current(); //ge原创 2012-03-12 09:52:18 · 1735 阅读 · 0 评论 -
解决magento中guest页面cookie保存时间过短问题
在magento新的企业版11,有个新的功能退货(RMA),不仅能退货,还能以guest的身份查看订单的各种信息,但在IE下有个问题:cookies的保存时间太短了,如果需要使用到需要验证权限的操作,就会重定向到 sales/guest/form/ 页面。 查看关键代码,发现跳转是发生在 Mage_Sales_Helper_Guest 类中class Mage_Sa原创 2012-04-24 11:50:45 · 2433 阅读 · 0 评论 -
指定magento后台使用的theme
众所周知,magneto是能后台配置中指定前台使用的是哪个theme,但后台呢?指定后台的theme,需要在添加如下的配置: Newjueqi 这样就指定了原创 2012-04-24 15:11:52 · 1007 阅读 · 0 评论 -
配置magento后台翻译
同事在magento中添加了若干翻译,但总是没法再后台显示,我帮忙查了很久,终于找到问题所在了,原来没有配置对应module的后台翻译文件,所以在后台显示不出翻译。这里贡献一份前后台翻译的配置模板:原创 2012-04-25 16:39:32 · 1645 阅读 · 0 评论 -
magento中的启用https
在Magento的后台管理中 General->web->secure , 有安全链接的设置,所谓安全链接,是指启用了https 协议的链接。百度百科中关于https的介绍( http://baike.baidu.com/view/14121.htm )HTTPS(全称:Hypertext Transfer Protocol over Secure Socket Layer),原创 2012-04-24 09:45:09 · 7910 阅读 · 0 评论 -
magento中生成https链接的简单方法
有关magento中https的基础知识,请看 《magento中的启用https》如果是在项目的后期才决定采用https,那么就要面临一个问题:大量的生成url的代码需要修改,这是一个很大的工作量。我们先来总结一下magento下生成url的方法:1. 从全局上看,有两个方法:Mage::getUrl('xx/xxx/xxxx' , array( '_secure'原创 2012-05-16 11:29:34 · 3748 阅读 · 0 评论 -
为什么magento的rewrite方法对抽象类无效
magento中,是没法通过Mage::getModel("xx/xx")配合xml中的实现abstruct class的rewrite。 为什么?这需要详细了解一下magento中model的rewrite原理。 假设xml中我们定义了如下的rewrite: Newjueqi_Customer_Mode原创 2012-05-25 11:11:21 · 1562 阅读 · 0 评论 -
magento中的attribute 总结
1.加载某个attribute: $attributeCode=Mage::getModel('catalog/resource_eav_attribute') ->load($attrbuteId) ->getData("attribute_code");2.获取某个attribute的所原创 2012-01-19 11:43:22 · 1637 阅读 · 0 评论 -
timewait
netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}’LAST_ACK 16SYN_RECV 348ESTABLISHED 70FIN_WAIT1 229FIN_WAIT2 30CLOSING 33TIME_WAIT 18098原创 2012-01-19 23:02:22 · 856 阅读 · 0 评论 -
Magento Enterprise Full Page Caching
出处:https://aniscartujo.com/webproxy/default.aspx?prx=http://magentophp.blogspot.com/2011/02/magento-enterprise-full-page-caching.html转载 2011-09-20 15:14:10 · 1376 阅读 · 0 评论 -
magento下生成excle文件方法
注意,这种方法本质上是生成xml文件,但excel是能打开这种xml格式,以下是一个demo: $data=array( array('name','birthday'), array('tom','1985'), array原创 2011-10-11 10:19:29 · 1163 阅读 · 0 评论 -
magento创建category时的一些注意点
1. Include in Navigation Menu设置成yes,能显示在导航栏上。2. Is Anchor设置成yes,能在这个category上显示所有子category的产品。注意:要重新reindex才能生效(mangeto不会提示reindex原创 2011-10-13 21:49:29 · 1732 阅读 · 0 评论 -
magento:在controller中添加breadcrumbs
在 controller中: $this->loadLayout(); $breadCrumb = $this->getLayout()->getBlock('breadcrumbs'); //这是 $breadCrumb->addCrumb('home', array( 'label' => Mage::help原创 2011-10-20 10:21:08 · 1790 阅读 · 0 评论 -
magento 通过命令行index的方法
在magento中,reindex是经常需要使用的功能, 这个功能除了可在后台直接使用外,还能通过一个magento自带的脚本运行,这个脚本的位置在shell\indexer.php。脚本的三个常用选项如下:(1)查看哪些选项可以reindex php indexer.php info第一项是参数值,第二项是这个值的解释(也就和在后台上看到的一样)原创 2011-11-14 15:32:52 · 2164 阅读 · 0 评论 -
magento 创建优惠活动“买两件9折”的方法
原创 2011-10-25 17:27:22 · 1366 阅读 · 0 评论 -
发现了magento 中"Shopping Cart Price Rules"一个bug
I Found an issue in magento core source code for "Shopping Cart Price Rules"(by the way , the screenshot is done in your demo ). The issue is follow, in "Shopping Cart Price Rules" conditions,原创 2011-10-25 17:22:14 · 1904 阅读 · 0 评论 -
为validate.js添加新的校验规则
magento中,校验表单使用的是validate.js,但magento默认的版本是很旧的,如果需要增加新的校验规则怎么办?在validate.js,有个方法addAllThese就是用来添加自定义的校验规则,在定义了js object “ Validation” 后,就能添加代码。一个简单的Demo如下: Validation.addAllThese([原创 2011-10-25 17:34:47 · 1540 阅读 · 0 评论 -
Magento 发送邮件代码(使用数据库中模板)
出处:http://hi.baidu.com/silkmark/blog/item/1f0eb7fa0cebb4d47831aa25.html/* @var $translate Mage_Core_Model_Translate */ $translate = Mage::getSingleton('core/translate'); $translate->setT转载 2011-10-27 16:04:39 · 1693 阅读 · 0 评论 -
用Magento的Email模板机制发邮件(创建自定义模板)
出处:http://koda.iteye.com/blog/623678Magento的Mage::getModel('core/email_template')模型可用来发信。步骤I.在你的模块(其实任意Module都可以)的etc/config.xml的根标签下添加代码 1. 2. 3. 4.转载 2011-10-27 16:06:51 · 3291 阅读 · 1 评论 -
magento salerule中关于attribute的一个bug
描述:在salerule的action中,想优惠规则应用于attribute season值为autumn的商品( season是在项目中新添加的一个product attribute),如下图:但在购物车中发现产品的season值为autumn,但总是没法应用优惠价格,debug了一下代码,发现问题在 Mage_SalesRule_Model_Rule_Con原创 2011-11-11 17:04:51 · 880 阅读 · 0 评论 -
Send mail using Gmail SMTP in Magento
http://blog.goods-pro.com/486/replace-mta-with-gmail-smtp-in-magento/我能想到的也是大部分人能想到的——我想用gmail smtp server代替magento内置的sendmail,这么做的好处是用gmail sent mail log all emails sent out by magento。gmai转载 2011-12-19 18:31:12 · 3839 阅读 · 0 评论 -
magento 中查看执行的sql语句
在开发的时候,经常需要看到magento所生成的sql语句,一般来说分为以下的两种情况:(1)只需要查看某个sql语句: $collection_of_products = Mage::getModel('catalog/product')->getCollection(); //var_dump($collection_of_products->getSelect())原创 2011-12-20 11:52:04 · 3645 阅读 · 0 评论 -
magento中单例模式的变形实现
单例模式确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例。这个类称为单例类。单例模式的要点有三个;一是某个类只能有一个实例;二是它必须自行创建这个实例;三是它必须自行向整个系统提供这个实例。一个典型的php单例模式实现如下:<?php/*** php singleton pattern* @author newjueqi* @modify 20原创 2011-12-30 15:44:59 · 1009 阅读 · 0 评论 -
magento项目中使用多个数据库的方法
1. 在app/etc/local.xml 中,添加新的数据库选项<!--/** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in t原创 2012-01-19 11:56:20 · 2315 阅读 · 0 评论 -
magento中在.htaccess设置website code
在.htaccess中,添加以下的内容:SetEnvIf Host www\.newjueqi\.com MAGE_RUN_CODE=newjueqiSetEnvIf Host www\.newjueqi\.com MAGE_RUN_TYPE=websiteSetEnvIf Host ^newjueqi\.com MAGE_RUN_CODE=newjueqiSetEnvIf原创 2012-05-25 18:23:50 · 2084 阅读 · 0 评论