Magento首页设置显示指定目录的产品

先查看Magento这种设置指定目录产品到首页
的方法的效果图:

Magento首页显示指定目录产品的效果图

1.在Page的home里添加:{{block type="catalog/product_list" category_id="28" products_count="9" template="catalog/product/home.phtml"}}

注:category_id是指定的目录ID,products_count是要显示的产品数。

2.home.phtml的内容为

<?php
    $_products=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
?>
<?php if(!$_products->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<h2 class="subtitle"><?php echo $this->__('BMD Exclusives') ?></h2>
<?php $_columnCount =3;$limit=isset($this->products_count)?(int)$this->products_count:6; ?>
    <?php $i=0;foreach ($_products as $_product): ?>
    <?php if ($limit<=$i){ break;} ?>
        <?php if ($i++%$_columnCount==0): ?>
        <ul class="products-grid">
        <?php endif ?>
            <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
                <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135) ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($_product->getName()) ?>" /></a>
                <h3 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>"><?php echo $this->htmlEscape($_product->getName()) ?></a></h3>
                <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                <?php echo $this->getPriceHtml($_product, true, '-new') ?>
                <div class="actions">
                    <?php if($_product->isSaleable()): ?>
                        <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
                    <?php else: ?>
                        <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                    <?php endif; ?>
                    <ul class="add-to-links">
                        <?php if ($this->helper('wishlist')->isAllow()) : ?>
                            <li><a href="<?php echo $this->getAddToWishlistUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
                        <?php endif; ?>
                        <?php if ($_compareUrl = $this->getAddToCompareUrl($_product)): ?>
                            <li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
                        <?php endif; ?>
                    </ul>
                </div>
            </li>
        <?php if ($i%$_columnCount==0 || $i==count($_products)): ?>
        </ul>
        <?php endif ?>
    <?php endforeach; ?>
<?php endif; ?>

跟以前Magento首页显示什么什么的一样。。代码备份文

10个js小脚本代码

脚本1:进入主页以后自动播放声音

<embed src="pnm://yourURL" hidden=true autostart=true loop=true>

脚本2:进入主页后自动最大话,省的去在自己单击了

<script>
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
</script>

脚本3:显示现在时间的脚本

<script language=vbscript>document.write now</script>

脚本4:显示最后修改时间的脚本

<script>document.write(document.lastModified)</script>

脚本5:设为首页,加为收藏,加入频道,启动outlook发信

<a style="cursor:hand" 
onclick="this.style.behavior="url(#default#homepage)";
this.setHomePage("yourURL">设为首页</a> <a style="cursor:hand"
onclick="window.external.AddFavorite(location.href,document.title);"> 加入收藏</a> <a href=javascript:window.external.addChannel("typhoon.cdf")>加入频道</a& gt; <a href="youEmail">与我联系</a>

脚本6:状态栏动态显示现在时间

<script>
function see(){
window.setTimeout("see()",1000);
today = new Date();
self.status = today.toString();
}
</script>
<body onload=see()>

脚本7:关闭窗口的脚本

<a href=javascript:close()>[关闭窗口]</a>

脚本8:按下F12键,直接返回首页

<script>function look(){
if(event.keyCode==123){document.location.href=http://10.13.31.90/~kayvin/}
}
if(document.onkeydown==null)
{document.onkeydown=look}
</script>

脚本9:后退,刷新,前进

<input type=button value=后退 onclick=history.go(-1)>
<input type=button value=刷新 onclick=history.go(-0)>
<input type=button value=前进 onclick=history.go(+1)>

脚本10:设定时间弹出窗口,4000=4秒,当然你可以自定义

<script>function l() {
window.open("yourURL","name","width=500,height=150,border=0")
}
setTimeout("l()",4000)
</script>

Linux:网站项目发布要做哪些配置

发布服务器:

SFTP用户名:

SFTP密码:

TelNet用户名:

TelNet密码:

MySql 5.0及以上版本

Php 5.0及以上版本

Apache 2.0及以上版本

主站绑定域名:www.v-ec.com

默认首页:index.html

设置php解析htm和html扩展名

博客绑定域名:www.w3cgroup.com

默认首页:index.php

网站目录结构:

        v-ec(主站)

                upload: 写权限

        w3cgroup(博客)

                upload: 写权限

 

Apache、Php及MySql设置

 

httpd.conf配置:
Linux路径:/usr/local/apache/conf/httpd.conf


#忽略大小写
LoadModule speling_module modules/mod_speling.so
CheckSpelling On

#设置默认首页
DirectoryIndex index.htm index.html index.php

#设置php能解析的文件
AddType application/x-httpd-php .php
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html

#设置多域名绑定,请将192.168.11.11更改为真实服务器IP
NameVirtualHost 192.168.11.11:80

#绑定主域名www.v-ec.com,请将192.168.11.11更改为真实服务器IP
<VirtualHost 192.168.11.11:80>
DocumentRoot /www/docs/v-ec
ServerName www.sjolzy.cn
ServerAlias www.sjolzy.cn
# ErrorLog logs/www.v-ec.com-error_log
# CustomLog logs/www.v-ec.com-access_log common
</VirtualHost>

#绑定博客域名www.sjolzy.cn,请将192.168.11.11更改为真实服务器IP
<VirtualHost 192.168.11.11:80>
# ServerAdmin webmaster@mail.veriyou.com
DocumentRoot /www/docs/sjolzy
ServerName www.sjolzy.cn
ServerAlias www.sjolzy.cn
# ErrorLog logs/www.sjolzy.cn-error_log
# CustomLog logs/www.sjolzy.cn-access_log common
</VirtualHost>

 

php.ini设置:
Linux路径:/usr/local/Zend/etc/php.ini


;设置开始短标签模式
short_open_tag = On

;开启显示错误,调试状态设置为On,正式上线设置为Off
display_errors = Off

;设置错误报告方式
error_reporting = E_ALL & ~E_NOTICE

;启用gd库
extension=php_gd2.dll

;启用mysql
extension=php_mysql.dll

;设置时区
date.timezone = PRC

 

my.cnf(windows系统下名为my.ini)设置:
Linux路径:/etc/my.cnf

 

;默认字符
default-character-set=utf8

;表名、字段名的不区分大小写
lower_case_table_names = 1

;允许同时连接的数量
max_connections = 1024

;关闭连接前的等待时间
wait_timeout = 7200

简洁的加入收藏夹代码,兼容ie,firefox,opera等浏览器

<a href="//sjolzy.cn" onclick="window.external.addFavorite(this.href,this.title);return false;" title="小屋" rel="sidebar">加入收藏</a>

设为首页JS,加入收藏夹js,加入收藏夹代码,设为首页代码,火狐和ie兼容

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>兼容FF 加入收藏夹和设为首页</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败,请使用Ctrl+D进行添加");
        }
    }
}
function SetHome(obj,vrl){
        try{
                obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
        }
        catch(e){
                if(window.netscape) {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                        }
                        catch (e) {
                                alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");
                        }
                        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                        prefs.setCharPref('browser.startup.homepage',vrl);
                 }
        }
}
//-->
</SCRIPT>
</head>
<body>
<a onclick="AddFavorite(window.location,document.title)">加入收藏</a>
<a onclick="SetHome(this,window.location)">设为首页</a>
</body>
</html>