Zencart template modification (details)

Source: Internet
Author: User

The following describes how to modify the zencart website template.

Mostly modified: (commonly used)Code)
I. Head
The file is (example): D: \ appserv \ www \ zencart12698 \ includes \ Templates \ theme3 \ common -- tpl_header.php

1. Search module function :-------------------
Title: <? PHP echo box_heading_search;?> :
First, enable "single display" in the background and add the following code (search form)
<? PHP require (dir_ws_modules. 'sideboxes/search_header.php ');?>

2. Shopping Cart module code :----------------------
<Strong> <? PHP echo (box_heading_shopping_cart);?> </Strong> & nbsp;
<? PHP echo box_shopping_cart_nowyou;?> & Nbsp; <a href = "<? PHP echo (zen_href_link (filename_shopping_cart);?> ">
<? PHP echo ($ _ session ['cart']-> count_contents ();?> <? PHP echo box_shopping_cart_items;?> </A>
3. Currency module code :----------------
Currency title: <? PHP echo box_heading_currencies;?>
Currency: <? PHP $ column_box_default = "tpl_box_header.php"; require (dir_ws_modules. 'sideboxes/currencies. php');?>

4. Language module code :---------------
Language title: <? PHP echo box_heading_ages?> :
Language: <? PHP $ column_box_default = "tpl_box_header.php"; require (dir_ws_modules. 'sideboxes/ages. php');?>

5. log on to the registration module :---------------------
<Div>
<? PHP echo '<a href = "'. http_server. dir_ws_catalog. '">';?> <? PHP echo header_title_catalog;?> </A>
& Nbsp; | & nbsp; <? PHP if ($ _ session ['customer _ id']) {?>
<A href = "<? PHP echo zen_href_link (filename_logoff, '', 'ssl ');?> "> <? PHP echo header_title_logoff;?> </A> & nbsp; | & nbsp;
<A href = "<? PHP echo zen_href_link (filename_account, '', 'ssl ');?> "> <? PHP echo header_title_my_account;?> </A> & nbsp; | & nbsp;
<? PHP} else {
If (store_status = '0') {?>
<A href = "<? PHP echo zen_href_link (filename_login, '', 'ssl ');?> "> <? PHP echo header_title_login;?> </A> & nbsp; | & nbsp;
<? PHP }}?>
<? PHP if ($ _ session ['cart']-> count_contents ()! = 0) {?>
<A href = "<? PHP echo zen_href_link (filename_shopping_cart, '', 'nonssl ');?> "> <? PHP echo header_title_cart_contents;?> </A> & nbsp; | & nbsp;
<A href = "<? PHP echo zen_href_link (filename_checkout_shipping, '', 'ssl ');?> "> <? PHP echo header_title_checkout;?> </A> <? PHP }?>
</Div>

6. header navigation bar: -----------------------------


get_template_dir ('tpl _ ezpages_bar_header.php ', dir_ws_template, $ current_page_base, 'templates').'/done');?>

<Div> <? PHP Include (dir_ws_modules. zen_get_module_directory ('ezpages _ bar_header.php ');?>
<? PHP if (sizeof ($ var_linkslist) >=1) {?>
<Div id = "navezpagestop"> <ul>
<? PHP for ($ I = 1, $ n = sizeof ($ var_linkslist); $ I <= $ N; $ I ++) {if ($ I = 1) {?> <Li> <? PHP} else {?> <Li> <? PHP }?>
<A href = "<? PHP echo $ var_linkslist [$ I] ['link'];?> "> <? PHP echo $ var_linkslist [$ I] ['name'];?> </A> <? PHP echo ($ I <$ n? Ezpages_separator_header: '')." \ n ";?>
<? PHP} // end for loop?> </LI> </ul> <? PHP }?>

7. LOGO call:
<? PHP echo '<a href = "'. http_server. dir_ws_catalog. '"> '. zen_image ($ template-> get_template_dir (header_logo_image, dir_ws_template, $ current_page_base, 'images '). '/'. header_logo_image, header_alt_text ). '</a>';?>

2. Bottom: almost all are consistent
The file is (example): D: \ appserv \ www \ zencart12698 \ includes \ Templates \ theme3 \ common -- tpl_footer.php

PayPal: icon code ------ <? PHP echo zen_image (paypal_logo, paypal_button);?>

Iii. Intermediate part:
Left: tpl_box_default_left.php (public part on the left) category list: tpl_categories.php
Right side: tpl_box_default_right.php (public part on the right)
Middle: tpl_main_page.php (the overall file contains the header, middle, and end ).

1. The modification content page of the three items in the navigation bar is: (the style must be consistent and must be modified at the same time for future calls)
New products/all products/Featured Products

D: \ appserv \ www \ zencart \ shortdes \ Templates \ zencart12998 \ Templates \ tpl_modules_products _... _ listing. php

2. three pages in the middle of the home page: Special/New/featured/(consistent style)
D: \ appserv \ www \ zencart \ des \ modules

3. Modify the subcategory page under the Primary category:
Tpl_index_categories.php/

How zencart defines simple pages:
1. Create a page in the background: tool-> ez-pages.
2. Add the following method to the function_general.php file: (Note: select the table name .)
Function zen_define_page_content ($ title ){
Global $ dB;
$ Title = $ db-> prepare_input ($ title );
$ SQL = "select 'pages _ html_text 'from ". table_ezpages. "_ content where 'pages _ title' = '{$ title}' and 'AGES _ id' = {$ _ session ['AGES _ id']}";
$ Pages = $ db-> execute ($ SQL );
Return $ pages-> fields ['pages _ html_text '];
}
3. Call and output this method at the position to be displayed on the foreground. For example: <? PHP echo zen_define_page_content ('test _ ezpage ');?>

For sites with multiple images, refer to the "huangsllc" banner_box_all. This ad group can add countless ads. You only need to set the group name of the ad.

4. (Zen-cart) add http: // 172.16.2.35: 8035/lfcoolfr/index. php? Main_page = test:
in the template D: create a new folder named "test" under the \ appserv \ www \ lfcoolfr \ des \ modules \ pages directory to copy the file header_php.php in page_2 under the directory, put the file
in the "test" directory. Then, D: \ appserv \ www \ lfcoolfr \ shortdes \ Templates \ peachblossomboutique \ templates create a new file and name it: for example, (tlp_test_default.php)
after the above operations are completed, you can view the effect on: http: // 172.16.2.35: 8035/lfcoolfr/index. PHP? Main_page = test the subject content of this page will show the content contained in tlp_test_default.php

The following is a summary of my colleagues (reference to share with you !)
standard template design document
the imitation template is http://osc.template-help.com/zencart_24240/index.php
1. collection
use teleport pro to collect sites to be imitated
2. add a new template
Use Zen-cart to create a new site and add a new template under \ shortdes \ templates, the template directory name is the same as the template directory of the site to be imitated (theme210). Copy all the files under the default template template_default to the new template folder and modify the template_info.php file, set the $ template_name variable to the current Template Name.
3. Copy the collected files to the template folder
copy the collected files (CSS style sheets, images, etc.) to the corresponding folder of the new module.
4. modify CSS and delete statements like this
In Macromedia, replace and select the regular expression search box and enter/\ * t (.) * \ */leave blank in the replacement box. replace all with vertices.
5. set the left and right columns in the background
enter the background and modify the default template as the newly added template. Set the status and width of the left and right columns in the background store according to the website to be imitated → set the layout settings, set the status and sequence of the left and right columns in tools> visual control ).
6. set the navigation bar of the header and the navigation bar at the bottom in the background
go to the background tool → simple page management, and set the header and footer (Status and order) according to the navigation bar of the module to be imitated ), choose shop Settings> navigation bar delimiter to set the navigation bar delimiter.
7. Understand the overall layout of the website to be imitated
use Firefox to open the site to be imitated, and use firebug to view the overall layout of the website, including the header, middle part, and bottom. This website is enclosed by a large Div whose classs is main_t. the header is the DIV whose class is header_t and the middle is the DIV on the class content_t, the bottom is the DIV whose class is footer_t. The DIV in the middle contains a table with a row and three columns. The first column is a small image in the left column and the second column is used to split the first and third columns, the third column is the public part in the middle.

7. Modify the tpl_main_page.php file under common
After learning about the overall layout, modify the overall layout template file tpl_main_page.php of the template,
Because the ID of the body on his homepage is indexbody rather than indexhomebody, change indexhome to index, change the property id = "mainwrapper" of the DIV outside the default template to the property class = "main_t" of the site to be imitated. Because an advertisement space is displayed only on the homepage, therefore, use $ this_is_home_page to determine whether the page is displayed again.
8. Modify the tpl_header.php file under common
Add the logo module, currency, language, logon, simple page header, and search in sequence according to the simulated website tag, because the language and currency modules are not displayed on the checkout page by default, change $ show_currencies = false in the source file to $ show_currencies = true; the language module is also modified.
9. Modify the columns on the left
The template corresponding to the left-side module is under the sideboxes directory, and each module uses tpl_box_default_left.php under common to output the template.
10. Modify the tpl_footer.php file under common
Add a simple page for the foot and an advertisement space to the bottom file.
11. Homepage recommendation product Module
The template corresponding to the Recommendation product module on the homepage is tpl_modules_featured_products.php, and the data processing is featured_products.php under modules. This file will get a three-dimensional array $ row representing the row and $ Col representing the column, the Params key represents the title parameter, the text key represents the content, and the display is to load tpl_columnar_display.php under common. It cyclically outputs the array generated by the featured_products.php module, tpl_columnar_display.php has multiple public styles, so if several public styles are the same, change tpl_columnar_display.php. If they are different, change featured_products.php under modules.
12. New Products, all product modules
For new products, the layout of all product modules is similar. The template corresponding to the new product is tpl_products_new_default.php. The product list uses tpl_modules_products_new_listing.php, change the two files to the same style as the imitation website. All product modules are similar to new products.
13. Special offer
The module corresponding to the special offer is tpl_specials_default.php, which is used in the product table tpl_columnar_display.php. data processing is done in modules \ pages \ specials \ main_template_vars.php. Modify these two files in the same way as the template.
14. Reviews
Modify tpl_reviews_default.php.
15. Classification Table Module
There are two category tables. One is that the category contains a subcategory, and the other is that the category does not contain a subcategory.
The default template that contains the sub-category is tpl_index_categories.php, which will use category. The file contains category_row.php for data processing, and tpl_columnar_display.php for output. The default template that does not contain the sub-category is tpl_index_product, tpl_modules_product_listing.php will be used in the product list. This file will reference product_listing.php for data processing and use tpl_tabular_display.php for data output.
16. product details Module
The template for the product details module is tpl_product_info_display.php. You can modify this file.

2012 Spring new Korean version female stretch pants color pencil pants slim leggings jeans casual pants large size plus velvet pencil pants thick Pants pants slice pants cotton jeans warm cotton pants leggings children autumn and winter

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.