1.为什么我的网站在后台system->web->unsecure/secure设置网站域名后,带www.与不带www的会产生302重定向问题.
答:system->web->url options->Redirect to Base URL if requested URL doesn't match it 设置为NO
2.为什么我的网站打开时,链接上总是会显示一个index.php的东东.
答:system->web->search Engines optimization->use web server rewrte=>yes
若修改后,链接已经生成不带index.php 但链接依然无法访问,请检查根目录下面的.htaccess文件是否有可写权限!
若文件内无内容,请复制以下内容进去
############################################
## you can put here your magento root folder
## path relative to web root
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/media/
RewriteCond %{REQUEST_URI} !^/skin/
RewriteCond %{REQUEST_URI} !^/js/
RewriteCond %{REQUEST_URI} !^/var/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . index.php [L]
################ End ###############################
3.关于块的引用那点事!
eg:<block type="directory/currency" name="currency" as="currency" template="directory/currency.phtml"/>
这个问题是我在首页header调用货币时遇到的,刚接触mg 对mg这种模板模式还非常的陌生吧。想在头部显示这东西,找到很久,都没找到,
后来就参照系统默认调用language的方式,来写,发现成功了!
以下是个人的认识,大有可能不正确!
block中 type="directory/currency" 这个type是mg自带的,不能修改
name 应该起到一个标识作用
as 为phtml文档中调用的名称
template 模板路径
4.删除某父节点下面的所有子节点
<action method="unsetChildren"></action>
5.删除指定节点
<action method="unsetChild"><name>reorder</name></action>
6.缺货产品无法显示
system->configuraction->inventory->stock options
Display out of stock products=>yes
7.产品页根目录伪静态功能!
system->configurcation->category->search engine optimizations
Use categories path for product URLs=>No
8.system->configuraction->web->url option
Redirect to Base URL if requested URL doesn't match it=>Yes
9.调用特定分类下面的产品
xml写法
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<action method="setCategoryId"><category_id>14</category_id></action>
</block>
html写法
{{block type="catalog/product_list" name="product_list" category_id="14" template="catalog/product/list.phtml"}}
10.取得相应路径
$this->getSkinUrl('images/buttom.gif')
11.取得购物车数量与总价
<?php echo $cart = Mage::helper('checkout/cart')->getCart()->getItemsCount();?>
<?php echo $total = Mage::getSingleton('checkout/session')->getQuote()->getGrandTotal(); ?>
12.如何取得session中的客户数据
if (Mage::getSingleton('customer/session')->isLoggedIn()) {
$customer = Mage::getSingleton('customer/session')->getCustomer();
}
13.推荐分类
安装KEY:magento-community/SFC_FeaturedCategories
Link:http://www.magentocommerce.com/magento-connect/StoreFrontConsulting/extension/3593/sfc_featuredcategories
14.生成xml文档
后台->catalog/google sitemap
/downloader/sitemap.xml