
magento Designers
ddjohn
coder
展开
-
How to Get All Product Images in products list page?
<br /><!-- Bring in gallery Images --><br /> <?php $_gallery = Mage::getModel('catalog/product')->load($_product->getId())->getMediaGalleryImages(); ?><br /> <?php $imgcount = Mage::getModel('catalog/product')->loa原创 2010-07-09 19:42:00 · 650 阅读 · 0 评论 -
how to show sku in product list page?
<br />如何在前台列表页显示产品的sku码?<br />讲下面的代码加到你的list.phtml中对应的位置<br /><?php echo $this->htmlEscape($_product->getSku()) ?><br /> <br />然后这样还不够。确保你的sku的Used in Product Listing属性设置为"yes",Visible on Product View Page on Front-end属性也要设置为"yes"<br /> <br />OK,reflesh原创 2010-10-21 10:02:00 · 921 阅读 · 0 评论 -
How to display custom select option on product list page?
<br />here's the code"<br />add it to your list.phtml and chance your stylesheet<br /> <br /> <br /><?php if($_product->isSaleable()): ?><br /> <form action="<?php echo Mage::getBaseUrl(); ?>checkout/cart/add/” method="post" id="product_addtocart_form原创 2010-12-17 20:02:00 · 1175 阅读 · 0 评论 -
How to Edit the Magento Footer & Footer Links
<br />The Magento footer links are collected from a few different layout components:<br />1. About Us | Customer Service<br />-> cms.xml<br />These two links are default static blocks taken from the database. To edit them, go to Magento Admin -> CMS转载 2011-01-26 17:17:00 · 1199 阅读 · 0 评论 -
How to change upsell product display number on product view page?
<br />app/design/frontend/default/THEME/layout/catalog.xml<br /><block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml"> <action method="setColumnCount"><co原创 2011-01-28 21:26:00 · 746 阅读 · 0 评论 -
如何更改Magento指定页面的标题(title)?
<br />1.首先你必须找到模版包下的head.phtml,路径如app/design/frontend/your_package/your_theme/template/page/html/head.phtml<br /> <br />2.查找一下行:<br /><title><?php echo $this->getTitle() ?></title><br /> <br />3.替换为如下的代码:<br /><title><?php echo ($this->getMyTitle()) ?Mag原创 2011-02-28 12:35:00 · 2804 阅读 · 0 评论 -
Magento如何创建自己的CMS layout template?
<br />1.由于Magento的机制,我们需要在local代码库中创建配置文件,目的是保护core完整。找到app/etc/modules/Mage_All.xml,修改page的配置:<br /><Mage_Page><active>true</active><codePool>local</codePool><depends><Mage_Core /></depends></Mage_Page><br /> <br />2.直接把app/code/core/Mage/Page翻译 2011-02-28 18:47:00 · 1476 阅读 · 0 评论 -
Magento how to remove the catelog filter from the layer navigation?
1.首先为了保证内核的完整性,在app/code/local/Mage/Catalog/Block/Layer 下面建立View.php,代码从core里面复制过来2.修改代码找到大约115行的位置 $categoryBlock = $this->getLayout()->createBlock($this->_categoryBlockName) ->setLayer($this->getLayer()) ->init();替换为:$thi原创 2011-03-12 20:14:00 · 1211 阅读 · 0 评论 -
Display your products in random order in magento?(随机排列产品)
<br /><?php$_productCollection=$this->getLoadedProductCollection();$_helper = $this->helper('catalog/output'); if ($_productCollection->count()): $_productCollection = $_productCollection->getItems(); shuffle($_productCollection); $i = 0; fo原创 2011-04-10 19:51:00 · 813 阅读 · 0 评论 -
Magento如何在XML配置文件中自定义页面title?
发现一个修改页面title更简单的方法,直接在对应的page下放置settitle方法,节点为head,比如修改contact us页面的title Contact Us 是不是很简单呢,呵呵~原创 2012-01-07 19:50:29 · 1272 阅读 · 0 评论 -
Get Custom Attribute on frontend list page and cart page(列表页获取自定义属性的三种方法)
假设我后台创建了一个code为acronym的自定义属性:第一种:直接使用getAttributeName的方法:htmlEscape($_product->getAcronym())?>第二种:使用辅助类:productAttribute($_product, nl2br($_product->getAcronym()), 'acronym')?>第三种:使用ge原创 2012-03-25 12:19:45 · 834 阅读 · 0 评论 -
Magento Add Accordion menu for the Layer Navigation(给左侧筛选栏加上jquery滑动效果)
1.下载jquery http://jquery.com/2.将jquery加入page里面,可以使page.xml或者catalog.xmlyour-custom-folder/your-jQuery-scriptname.js3.修改/app/design/frontend/base/default/template/catalog/layer/view.phtml,查找如下代码:原创 2012-03-14 16:32:22 · 1283 阅读 · 0 评论 -
Magento移除特定页面的js或者css(remove such as prototype)
添加js或者css用得多了,移除还真的是没用过,我承认我out了。 jsprototype/prototype.js放在特定的page layout里面,首页的话放在cms custom layout里面,That's all!原创 2012-03-21 23:01:40 · 1883 阅读 · 0 评论 -
使用local.xml和addlink方法来自定义toplinks
以前总是用暴力的方法来自定义top links,方法是直接改links.phtml的html。Links由Mage_Page_Block_Template_Links这个类生成,其实用的是Varien_Object。最近决定更正这个暴力的行为。首先,local.xml我们应该知道,可以覆盖布局的行为。这个在app/code/core/Mage/Core/Model/Layout/Update.原创 2012-04-16 11:36:30 · 2296 阅读 · 0 评论 -
Hide and Don’t Display N/A Attributes in Magento
如何删除或隐藏Magento产品页的属性为N/A的项?加个判断语句吧.找到模版 app\design\frontend\default\your_theme\template\catalog\product\view\attributes.phtml 查找如下位置 htmlEscape($this->__($_dat翻译 2012-04-18 17:16:44 · 635 阅读 · 0 评论 -
Call to a member function addToChildGroup() on a non-object in app/code/core/Mage/Core/Block/Abstrac
出现这个问题 其实绝大多数可能是因为xml layout文件的语法没写正确 导致block指向不存在的模版文件 注意block内属性的间隔 还有缓存和编译器的问题。比如一下block 如果不小心复制粘贴时变成这样: catalog_left_banner 注意仔细看属性之前的没有间隔 用于解析xml的php就会报错。所以,写layout的时候也要小心,他们不是万原创 2012-08-22 10:18:27 · 2111 阅读 · 0 评论 -
关于prototype和使用多个JQuery插件的冲突问题
之前转载过一篇文章 http://blog.youkuaiyun.com/ddjohn/article/details/5767232 讲述关于prototype和jquery冲突的解决办法 最近在制作前端js特效的时候发现还是不太完美实用。如果使用多个jquery插件的话 比如lofJSidernews和jcarousel 不仅各个版本的IE提示脚本错误无法运行 就连ff和chrome都接受不了。经过多番调原创 2012-08-13 13:49:49 · 2056 阅读 · 0 评论 -
Magento前台不显示商品(第二版)
<br />前台不显示商品的原因有以下几种解决办法:<br />1. 商品disable的原因<br />2. 商品out of stock的原因<br />3. 商品categories的原因<br />4. 索引建设的原因或者cache即缓存的原因<br /> <br />如果你已经试过上面的方法还不行,你可以尝试下面的方法:<br /> <br />5. 修正数据库表customer_group的NOT LOGGED IN记录的id为0,有些可能是4或以上,这是magento升级带来的错误,请确保为零原创 2010-10-20 10:04:00 · 2599 阅读 · 0 评论 -
Magento All kinds of Theme
<br />http://www.design4magento.com/category/magento-themes/转载 2010-09-13 16:39:00 · 648 阅读 · 0 评论 -
Search by categories in Magento
<br />http://www.magentocommerce.com/wiki/5_-_modules_and_development/search_and_advanced_search/how_to_add_search_by_category_to_advanced_search原创 2010-09-13 16:38:00 · 720 阅读 · 0 评论 -
开源ECommerce战争: Magento超越OsCommerce而成为最流行开源电子商务系统的秘密
There are so many shopping carts out there, and it is hard to know which one to use for your website. That is a common question for a web community which currently contemplates in eCommerce field truly impressive shift from stable and proven osCommerce to转载 2010-07-09 19:43:00 · 2187 阅读 · 0 评论 -
How to remove a block from the particular page?
<br />For instance,<br /><referencename="your_parent_block_name"><br /> <removename="your_block_name"/><br /></reference><br /><br />that's all...原创 2010-07-09 19:45:00 · 481 阅读 · 0 评论 -
Print the amount of items and total price of Magento's cart
<br />Here's a simple snippet in order to retrieve this 2 useful infos about user's cart.<br /> <br />Here you retrieve the amount of items the user has into the cart:<br />$Qty = $this->helper('checkout/cart')->getSummaryCount();<br />Here you get the tot原创 2010-07-09 19:46:00 · 571 阅读 · 0 评论 -
MAGENETO中如何获取相关URL路径
<br />我们可能都知道,MAGENTO有一个内建的获取URL路径的功能,相关函数是getBaseUrl()在Mage类里面。<br /><br />但是MAGENTO并没有提供相关的文档去阐述如何使用这个函数。只交待了一句“function retrieves $type parameter which is by default equal to ‘base’”.还真不知道怎么翻译,可以理解为,相关功能获取$type参数默认相当于使用“base”函数。我昏了。但这不影响这篇文章下面的部分:<br />转载 2010-07-09 19:47:00 · 818 阅读 · 0 评论 -
Magento内核结构
<br />http://freegento.com/doc/d0/d58/class_varien___object.html 该网址有magento的内核结构!原创 2010-07-09 19:47:00 · 570 阅读 · 0 评论 -
How to get currency symbol?
<br /> <br />Here’s another way that might work for you:<br />Mage::app()->getLocale()->currency(Mage::app()->getStore()-><br />getCurrentCurrencyCode())->getSymbol()<br /><br /> <br />or if you want to pass a certain currency code simply specify it:<br原创 2010-07-09 19:48:00 · 654 阅读 · 0 评论 -
初探magento模板系统
<br />Magento 模块<br /> <br />模块( module )是 Magento 的核心。站点上的任何一个动作( action ),无论是在前台和还是在后台的每一个操作都是通过模块来实现的。模块是可以视为一个容器,它可包含下面这几项:设置 (settings) ,数据库模式 (database schema) ,呈现对象 (rendering object) ,辅助工具类 (utility helpers) ,数据模型 (data models) 或动作控制器 (action contr原创 2010-07-09 19:51:00 · 825 阅读 · 0 评论 -
Magento中Block的应用
template之于block犹如jsp之于javabean.如果你在本机的虚拟目录magento下建立了magento.那么访问:引用 http://localhost/magento/index.php/customer/account/create/将进入用户注册界面。下面就从URL尝试分析Magento调用该页面的过程1. URL中的customer表明当前访问的模块是customer,自动定位到: app/code/core/Mage/Customer2. URL中的account表明当前访转载 2010-07-09 19:53:00 · 601 阅读 · 0 评论 -
Magento运行出现错误的解决方法
<br />Magento根目录下的lib/Varien/Simplexml中的config.php文件,在顶段加上error_reportting(0);来屏蔽php的错误或异常捕捉就行了,不过,只是在Warning提示时才好用,如果时Error的话建议另辟蹊径!<br />个人愚见,经供参考!原创 2010-07-09 19:53:00 · 907 阅读 · 0 评论 -
magneto 1.4中产品不在前台显示的四大因素
很多朋友在安装magento 1.4后会碰到这样的问题:提交产品后不能在前台显示出来。有时候还会有“There are no products matching the selection.”提示。下面是详细解决方法:(继续)1.首先检查网店商城的Root Category 以及跟目录下面的子目录设置是否有误,具体在目录->管理分类->Root Category,查看目录是否激活2.然后检查产品是否enabled3.检查产品是否有库存(in stock)。这点很重要,貌似magneto 1.4版本默认不显示转载 2010-07-09 19:54:00 · 806 阅读 · 0 评论 -
Magento中如何调用SQL语句
<br />I. 创建表结构和测试数据<br />create table rooms(id int not null auto_increment, name varchar(100), primary key(id));<br />insert into rooms values(1,'Royal Room');<br />insert into rooms values(2,'Standard Room');<br />II.创建 controllers/RoomController.php:<br原创 2010-07-09 19:55:00 · 791 阅读 · 0 评论 -
Bestseller products in Magento
Bestseller or best selling product is one of the features people tend to ask for when it comes to Magento?.There are multiple ways to implement this feature.In this example, I’m not using controller or model directories at all; I’m going to show you how to转载 2010-07-09 19:56:00 · 863 阅读 · 0 评论 -
product detail page add to cart button not working?
<br /><br />In my custom theme there was this code for Add to cart button:<br /><button type=”button” class=”button-form” onclick=”productAddToCartForm.submit()”><span><?php echo $this->__(’Add to Cart’) ?></span></button><br />The problem was that nothing原创 2010-07-21 14:17:00 · 1359 阅读 · 0 评论 -
How to get current date in magento?
<br /><?php echo date("Y-m-d", Mage::getModel('core/date')->timestamp(time()))?><br /><br />it will echo for instance "2010-07-21"<br />that's all原创 2010-07-22 10:01:00 · 684 阅读 · 0 评论 -
How to Edit the Magento Footer & Footer Links
The Magento footer links are collected from a few different layout components:1. About Us | Customer Service-> cms.xmlThese two links are default static blocks taken from the database. To edit them, go to Magento Admin -> CMS -> Static Blocks.2. Site Map->转载 2010-07-21 15:08:00 · 711 阅读 · 0 评论 -
jquery prototype 兼容
<br />我对重要的部分做下翻译,希望对大家有所帮助。特别是magneto的js库使用prototype,很多人想用jquery,那么这个兼容就很有 用了。<br />jquery prototype 兼容分两种情况,我们就让prototype可以正常使用,在使用jquery的时候做下代码的兼容处理。<br />第一种:先加载prototype,后加载jquery---------------------------------------------------<br /> <html><br /> <转载 2010-07-26 20:23:00 · 1500 阅读 · 0 评论 -
How to use getBodyClass() in magento?
<br />In this line of code:<br /><body <?php echo $this->getBodyClass()?'class="'.$this->getBodyClass().'"':'' ?>><br />Where is the BodyClass() variable changed?<br />I discovered you can add this in the XML. For example, to add ‘customer’ class to原创 2010-07-27 22:27:00 · 1158 阅读 · 0 评论 -
Magento getChildHtml函数的使用方法
在Magento默认的配置下,HTML输出是从名为“root”的块开始(其实是因为这个块 拥有output属性【EFISH注:任何一个拥有output属性的块都是顶层块,在拥有多个顶层块的情况下Magento将按照块定义的先后顺序输出 HTML】)。我们覆盖了“root”块的模板template="../../../../../code/local/Alanstormdotcom/Hellow转载 2010-09-21 00:20:00 · 6062 阅读 · 5 评论