Magento中如何调用SQL语句------magento----摘来的其他不错的!
2010-12-29 00:58
344 查看
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
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
相关文章推荐
- Magento中如何调用SQL语句------magento----摘来的其他不错的!
- Magento中如何调用SQL语句
- Magento中如何调用SQL语句
- 黄聪:WordPress 多站点建站教程(三):主站如何调用子站的文章内容、SQL语句如何写?
- zencart+magento 如何清空商品演示数据和没有商品数据的sql执行语句
- 如何在Nhiberante中直接调用sql语句和存储过程
- 如何通过JS调用某段SQL语句
- 如何通过JS调用某段SQL语句
- 实际——如何给SQL查询添加合计行(sqlserver2008。但是db2的case when 语句end后不能添加其他字段)
- SQL语句如何调用序列
- 如何通过JS调用某段SQL语句
- Java中如何拼接sql或者其他含有变量语句
- 如何在JAVA代码中执行 exec master..xp_cmdshell @cmd // 当作SQL语句调用就成了 或者调用 Runtime.getRuntime().exec
- 如何通过sql语句查看数据库的大小
- am 使用SQL语句 调用存诸过程
- SQL语句在数据库中是如何执行的
- PD中如何使其生成的sql语句不带双引号的方法
- OAF学习笔记-8-在AM中直接调用sql 语句(PLSQL函数)
- 如何优化SQL语句
- 如何正确的进行大规模SQL语句的批量操作