Modify Ecshop three code for simple optimization

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

The initial use of Ecshop to find not the general complexity, design a good ecshop template, absolutely painstaking, like me and other rookie is certainly not to do, I am a full ten of the poor, buy a business template that is also impossible, so only to find some free templates, make a small adjustment will be used first, But the default to change the place is not just a template of the problem, there are a little bit below, slightly recorded for a rainy.

1, ecshop title optimization

How to modify the Ecshop title, now want to change the title of the site, to achieve the effect of the following site home page title is displayed for the Ecshop Management Center [store title]. and the channel page, shows [channel name + store Name], of course, the product page is displayed [Product name + store Name]
The first step is to remove the powered by Ecshop on the title. In includes/lib_main.php find the lib_main.php file, remove the following code.
. ‘ - ‘ . ' Powered by Ecshop '
In the second step, open the template folder's GOODS.DWT file, locate {$page _title}, and modify it to {$goods. goods_style_name}_{$shop _name}
Step three, find includes/lib_main.php line 143th. Will

$page _title= $GLOBALS [' _cfg '] [' shop_title '];


to:


$page _title= $GLOBALS [' _cfg '] [' shop_name '];


then find 241 lines or so, and find the following code


if (!empty ($STR))


{


$page _title = $str. '_' . $page _title;


$ur _here. = ' <code>> ' . $STR;


}


we need to join
in front of this code.

if ($filename = = ' index ') $page _title= $GLOBALS [' _cfg '] [' shop_title '];


this code.


Well, this ecshop title we have modified, so more in line with SEO.

2, remove the ecshop head between the generator "content=" Ecshop v2.7.1 "

Ecshop put generator in front of the title look very uncomfortable, decided to remove, keep the bottom of the footer copyright on it


<meta name= "generator" content= "Ecshop v2.7.1"/>
Here is how to delete this line of code, so that the system no longer automatically generated.

Open the includes/cls_template.php file,
About 1087 lines, find


$source = preg_replace ('/&lt;head&gt;/i ', "&lt;head&gt;\r\n&lt;meta name=\" generator\ "content=\". APPNAME. ' ' . VERSION. "/&gt;", $source);





 


Delete it or comment it out.

3, Ecshop classification tree in all the pages show all the way

My shop merchandise classification is relatively few, want to all the page to the category tree all show up, the following is to modify the method

Open includes/lib_goods.php, find the Get_categories_tree () function section, and find this paragraph:


function Get_categories_tree ($cat _id = 0)


{


if ($cat _id &gt; 0)


    {


$sql = ' SELECT parent_id from '. $GLOBALS [' ECS ']-&gt;table (' category '). "WHERE cat_id = ' $cat _id '";


 


 

$parent _id = $GLOBALS [' db ']->getone ($sql);
}
Else
{
$parent _id = 0;
}




 


modified into:





 


function Get_categories_tree ($cat _id = 0)


{


if ($cat _id &gt; 0)


    {


$sql = ' SELECT parent_id from '. $GLOBALS [' ECS ']-&gt;table (' category '). "WHERE cat_id = ' $cat _id '";


        


    }


Author: Xiaoyu QQ space Station http://www.93193.cn

Note: Please make a copy of the original file before modifying it so that it can be recovered when needed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.