1.Magento运行出现错误的解决方法
Magento根目录下的lib/Varien/Simplexml中的config.php文件,在顶段加上error_reportting(0);来屏蔽php的错误或异常捕捉就行了,不过,只是在Warning提示时才好用,如果时Error的话建议另辟蹊径
2.How to get currency symbol?
Here’s another way that might work for you:
Mage::app()->getLocale()->currency(Mage::app()->getStore()->
getCurrentCurrencyCode())->getSymbol()
or if you want to pass a certain currency code simply specify it:
Mage::app()->getLocale()->currency(’EUR’)->getSymbol()
3.核心类的详细介绍
http://freegento.com/doc/d0/d58/class_varien___object.html
4
magento connect manage出现404或者500内部错误的解决办法
Directory /downloader/ set to 755
file /downloader/index.php set to 644
5
后台产品页显示产品缩略图的插件
Key:magento-community/TBT_Enhancedgrid-1.2
6
magento不错的博客地址:
http://blog.csdn.net/xinhaozheng/category/524202.aspx
7
Magento中如何调用SQL语句
I 创建表结构和测试数据
create table rooms(id int not null auto_increment, name varchar(100), primary key(id));
insert into rooms values(1,'Royal Room');
insert into rooms values(2,'Standard Room');
II.创建 controllers/RoomController.php:
源码copy to clipboard打印?
1. <?php
2. class Cartz_Hotel_RoomController extends Mage_Core_Controller_Front_Action{
3. public function listingAction() {
4. $handle = Mage::getSingleton('core/resource')->getConnection('core_write');
5.
6. $query = $handle->query('select name from rooms');
7. while ($row = $query->fetch()) {
8. $row = new Varien_Object($row);
9. echo "<strong>" . $row->getName() . "</strong><br/>";
10. }
11.
12. }
13. }?>
<?php class Cartz_Hotel_RoomController extends Mage_Core_Controller_Front_Action{
public function listingAction() {
$handle = Mage::getSingleton('core/resource')->getConnection('core_write');
$query = $handle->query('select name from rooms');
while ($row = $query->fetch()) {
$row = new Varien_Object($row);
echo "<strong>" . $row->getName() . "</strong><br/>";
}
}
}
?>
在地址栏中输入: http://localhost/magento/index.php/hotel/room/listing, 页面将输出:
Royal Room
Standard Room