天天看點

magento操作彙總

怎麼去修改語言

1、下載下傳語言包(app > locale)替換

2、登陸admin後 台 > Manage stores ,建立一個新的store view【如果是一個網站多個語言則可以考慮】

3、到admin panel System > Configuration > general

然後選擇 store view “Chinese” locale options > locale > Chinese【或者是其它的語言】

怎麼移除首頁以及商品連結中的index.php

In order to remove the index.php from the URL for the online Magento store you can follow the steps given below: 【同時要保證在apache下,.htaccess的檔案配置】

First Login to Magento backend and navigate to menu System->Configuration->Web->Search Engine Optimization

Set Use Web Server Rewrites to ‘yes’ 

<IfModule mod_rewrite.c>      
RewriteEngine On      
RewriteBase /      
RewriteRule ^index\.php$ - [L]      
RewriteCond %{REQUEST_FILENAME} !-f      
RewriteCond %{REQUEST_FILENAME} !-d      
RewriteRule . /index.php [L]      
</IfModule>      

how to modify the block position

如何去修改清單頁的産品顯示(每行顯示多少個,是預設以清單顯示還是以表格顯示)

In your custom theme open up catalog.xml and find the following line on around line 100:
<action method="setDefaultGridPerPage"><limit>3</limit></action>
                      <action method="addPagerLimit"><mode>grid</mode><limit>15</limit></action>
                      <action method="addPagerLimit" translate="label"><mode>grid</mode><limit>all</limit><label>All</label></action>      

add ad for left slider

The callouts are hardcoded in the default layout xml to be files on your server.  I think you can change them to be static blocks instead, so you can manipulate them in the admin instead of in the layout files.

Update:

I got my head wrapped around how to do this now.

In the default theme, the catalog.xml file has this for the left callout:

<reference name="left">
       <block type="core/template" name="left.permanent.callout" template="callouts/left_col.phtml">
           <action method="setImgSrc"><src>images/media/col_left_callout.jpg</src></action>
           <action method="setImgAlt" translate="alt" module="catalog"><alt>Our customer service is available 24/7. Call us at (800) DEMO-NUMBER.</alt></action>
           <action method="setLinkUrl"><url>checkout/cart</url></action>
       </block>
   </reference>
I changed it to this: (just use custom block to replace default block)
<reference name="left">
       <block type="cms/block" name="left.permanent.callout">
           <action method="setBlockId"><block_id>left_column_block</block_id></action>
       </block>
   </reference>      

and added a CMS Static Block with an ID of left_column_block. I can put whatever I want in there from the backend(including empty) and it will show in the left column. I did the same thing with the right column, and can add more in strategic places for future editing by the client in the backend.  This worked even when I hadn’t created the static block yet

change default currency setting

Selected default display currency is not available in allowed currencies

解決辦法:

将緩存 清空

同時将 資料換成  Allowed Currencies  等一系列的貨币要要包含相應的貨币類型

how to configuration multiple website

change the template layout  批量的修改商品布局視圖

open  page.xml file.

<reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
 </reference>      

去除預設的logo[并且進行替換]

1. Go to System | Configuraon | Advanced | Advanced. You should see the Disable

modules output page.

2. Locate the module labeled Mage_Newsleer and/or Mage_Poll, and select Disable.

3. Click on the Save Config button.

how to add  special category content  [you can put it in home page or other pages]

<reference name="content">
    <block type="catalog/product_list" name="featured" template="catalog/product/list.phtml">
         <action method="setCategoryId"><category_id>[category id here]</category_id></action>
     </block>
 </reference>      

Development Reference

Database:

日志以及記錄使用者行為的資料占用了大量的資料庫磁盤空間

TRUNCATE table `log_url_info`;
 TRUNCATE table `log_url`;
 TRUNCATE table `report_event`;
 TRUNCATE table `log_visitor_info`;
 TRUNCATE table `log_visitor`;
 TRUNCATE table `index_event`;
 TRUNCATE table `report_viewed_product_index`;
 TRUNCATE table  `dataflow_batch_export`;
 TRUNCATE table  `index_process_event`;
 TRUNCATE table  `dataflow_batch_import`;      

使用資料庫的方式來修改model

<?php
require_once 'app/Mage.php';
 Mage::app();
 // instatiate Product
 $product = Mage::getModel('catalog/product');
 $product->setWebsiteIds(array(1));
 $product->setSku('rand-sku-' . rand());
 $product->setPrice(rand(100,2000));
 $product->setAttributeSetId(4); 
 $product->setCategoryIds(array(3));
 $product->setType('Simple Product');
 $product->setName('Product Name'.rand(1,200000));
 $product->setDescription('The Product Description');
 $product->setShortDescription('Brief Description');
 $product->setStatus(1); 
 $product->setTaxClassId('2');
 $product->setWeight(0); 
 $product->setCreatedAt(strtotime('now'));
 /* ADDITIONAL OPTIONS 
    $product->setCost();
    $product->setInDepth();
    $product->setKeywords();
 */
 $product->save();
 // "Stock Item" still required regardless of whether inventory
 // control is used, or stock item error given at checkout!
 $stockItem = Mage::getModel('cataloginventory/stock_item');
 $stockItem->loadByProduct($product->getId());
 $stockItem->setData('is_in_stock', 1);
 $stockItem->save();
 header("Location: /checkout/cart/add/product/".$product->getId()."/); 
 ?>      

Get the Total Price of items currently in the Cart: