Vous êtes sur la page 1sur 25

ZEN CART V.1.3.

8 – TUTORIALS
Please as far as you go with the system, write all what you have learn here. Share the
knowledge!

Por favor, tan lejos como vayas en el sistema, escribe todo lo que has aprendido aquí.
Comparte el conocimiento!
CHANGE MENU OF THE ADMIN

apartments/admin_mtg/includes/header_navigation.php

CATEGORY PRODUCTS LIST

This is for the page, if you go to a category and the whole list of product is shown or if you
search and the way the list is displayed.

THIS FILES ARE TO MODIFIED THE GENERAL PAGE OF PRODUCTS LIST INSIDE A
GALLERY, ONLY THE LIST

../templates/tendency/templates/tpl_index_product_list.php

../templates/tendency/templates/tpl_modules_product_listing.php

THIS FILE IS TO MODIFIED THE WAY ONE PRODUCT IS SHOWN ON A LIST


includes/templates/tendency/common/tpl_tabular_display.php

THIS FILE IS TO MODIFIED THE LIST OF PRODUCT INSIDE A GALLERY, ORDER

include/modules/product_listing.php

by Andres Lemonk – October 20, 2009

HOW TO USE TEMPLATES


http://tutorials.zen-cart.com/index.php?article=142

By Andres Lemonk – October 20, 2009

CREATE FILTERS

http://tutorials.zen-cart.com/index.php?article=114

http://support.smallbusinesspages.org/zen-cart-custom-product-types/chapter-2-
research.html

Changing header and footer and main pages

/includes/templates/your_template/common/tpl_header.php

/includes/templates/your_template/common/tpl_footer.php

ADD MORE THAN 1 IMAGE FOR A PRODUCT

http://tutorials.zen-cart.com/index.php?article=58

CHANGE HOME PAGE

includes/templates/CUSTOM/COMMON/tpl_main_page.php and upload to your server.

CHANGE META TAGS

includes/languages/english/YOUR_TEMPLATE/meta_tags.php

AGREGAR PROPIEDADES O ATRIBUTOS A UN PRODUCTO

Existen 2 maneras:
A. Is adding an attribute to a product, from the admin, what happens with this method is
that you are not able to fully manipulate it. And you are no able to leave an input field
when the administrator is creating products. With this method in the admin area, exist it’s
own section. I didn’t find it very useful.

http://tutorials.zen-cart.com/index.php?article=57

B. With this method, you are able to do whatever you want with the new property or
attribute of the product.

http://www.zen-cart.com/forum/showthread.php?t=57924&highlight=add+field+product

Instructions:

How to add new properties to general products (like guarantee time, color, oem-number,
compatible models, whatsoever).

1. Think, decide which new properties you want to add to your products (in this example
we take guarantee-time (in months) and color).

2. db manipulation

Open the table "products" in your zencart-database and insert new rows at the end of the
table called "products_guarantee" and "products_color"

ALTER TABLE `zencart_products` ADD `products_guarantee` INT NOT NULL , ADD


`products_color` VARCHAR( 32 ) NOT NULL;

3. Edit 'collect_info.php' (in /admin/includes/modules/product/)

Here in 'collect_info.php' is the file on the admin, when you are creating a new product.
Where all the input fields exist, to add values to the new product.

3.1. At the very beginning there is the variable $parameters set. add your row-names to
the end:

'products_guarantee' => '0', 'products_color' => '' );

3.2. just below there is the db-query set [$product = $db->Execute("...]

add your rows with a 'p.' in front (before the "from ..." part)

select ......., p.products_guarantee, p.products_color from ....

3.3. now you can add the input fields in the product-mask

(lets say somewhere around line 450 or so):


<tr>

<td class="main">Guarantee Time (in months)</td>

<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') .


'&nbsp;' . zen_draw_input_field('products_guarantee', $pInfo->products_guarantee,
zen_set_field_length(TABLE_PRODUCTS, 'products_guarantee')); ?></td>

</tr><tr>

<td class="main">Color</td>

<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') .


'&nbsp;' . zen_draw_input_field('products_color', $pInfo->products_color,
zen_set_field_length(TABLE_PRODUCTS, 'products_color')); ?></td>

</tr>

4. edit 'preview_info.php' (in /admin/includes/modules/product/)

somewhere around line 10 is the variable $product set. like in step 3.2 add the new
rows with a 'p.' in front just before the 'from'

select ......., p.products_guarantee, p.products_color from ....

5. finally, edit 'update_product.php' (in /admin/includes/modules/)

around line 20 is the $sql_data_array set. add to the last lines before ');' the new
rownames.

$sql_data_array = .......... 'products_guarantee' =>


zen_db_prepare_input($_POST['products_guarantee']), 'products_color' =>
zen_db_prepare_input($_POST['products_color']) );

6. Setup All Done!

.Of course, now we want to display our cool new properties .

7. edit 'main_template_vars.php' (in /includes/modules/pages/product_info/)


around line 46 you find the variable $sql set. like in step 3.2 add the new rows with a
'p.' in front just before the 'from'

select ......., p.products_guarantee, p.products_color from ....

8. last step: display the new info, edit 'tpl_product_info_display.php' (in


/includes/templates/template_default/templates/)

The 'tpl_product_info_display.php' is the product page when you click and see the
whole description and properties of the product in the front end.

now, wherever you want, you can add to the html:

<?php echo $product_info->fields['products_guarantee']; ?> and <?php echo


$product_info->fields['products_color']; ?>

Done.

By Andres Lemonk – October 20, 2009

How Do I Show My Products on the Home Page?

Contributed by Administrator

Friday, 18 January 2008

Last Updated Friday, 18 January 2008

How Do I Show My Products on the Home Page in my Zen Cart Store?

Zen Cart refers to the Home Page as the main page. So in order to show your products on
the Main Page in Zen Cart

follow these steps:

- Navigate to Configuration > Layout Settings

- Click the title/link Categories - Always Show on Main Page

- Set the radio button to ON (choose 1) and click the update button to save your changes.
You can also set the a specific product category by setting the category id. To set a specific
category to show on the

Main Page of your Zen Cart store do the following:

- Navigate to Configuration > Layout Settings

- Click the title/link Main Page - Opens with Category

- Set the category ID#. For example if you have only one category defined, the enter the
number one "1" without

quotations marks and click the update button.

- This will cause your main page in Zen Cart to display your products in the category you
setup. By default the Zen Cart

main page displays your NewProducts. To remove the New Products list from your Main
Page click here. Note: to select

an item in the administrator you can click the title to go directly into edit mode. If you click
the "i" icon, you will see a

description, then you will need to click the edit button.

UNLIMITED STOCKS

In admin > Configuration > Stock, set check stock and subtract stock to false. Make sure
you have a quantity in stock of 1 or more in the product entry/editing page.

Quantity Discounts

Setting up quanity discounts for a product is done through the Product Price Manager. That
is located in the Catalog menu.
Find the product you would like to have the discount for, and click the Edit button.

On the new page click the Add Blank Discounts button and fill in the details for the volume
discounts.

Click the Update button at the botom of the page to apply your new settings.

Those will be visible in the table at the next page

SEARCH

TO MANIPULATE SEARCH

Check this file:

tpl_advanced_search_result.php

And on your template > common > tpl_header.php and then around line 63:

<div id="navMainSearch"><?php require(DIR_WS_MODULES .


'sideboxes/search_header.php'); ?></div>

RESULTING PAGE WHEN YOU SEARCH

http://www.zen-cart.com/forum/showthread.php?t=122117

\includes\templates\CUSTOM\templates\tpl_advanced_search_default.php

You may also want to edit:

\includes\templates\CUSTOM\templates\tpl_advanced_search_result_default.php

as well as:
\includes\templates\CUSTOM\templates\tpl_advanced_search_default.php

SOME TEMPLATES HERE

includes/templates/template_default/common

AND SOME OTHERS HERE

includes/templates/template_default/templates

CHANGE HEADER SEARCH BOX

This is a bit of a hack, but it seems to work...

See my example at http://www.buysouthafrican.co.uk/shop

If you are using a CUSTOM template, then the files that I list in this post must be edited
and saved into your custom folders.

I have a TEST SHOP which uses the CLASSIC template, so this will be my custom template
in my examples below. If you have a different template, then in the directory paths below,
substitute YOUR template wherever you see \classic\.

1. Create a folder called sideboxes, in your custom template: eg:-

( includes\templates\classic\sideboxes\ )

2. Using FTP, navigate to:-

includes\templates\template_default\sideboxes\tpl_search_header.php

and ftp a copy to your hard drive.


3. Open the hard-drive copy of tpl_search_header.php for editing.

Original code starts as:-

PHP Code:

<?php

/**

* Side Box Template

* @package templateSystem

* @copyright Copyright 2003-2006 Zen Cart Development Team

* @copyright Portions Copyright 2003 osCommerce

* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

* @version $Id: tpl_search_header.php 4142 2006-08-15 04:32:54Z drbyte $

*/

$content = "";

Edit it as follows:-

PHP Code:

<?php

/**

* Side Box Template

* @package templateSystem
* @copyright Copyright 2003-2006 Zen Cart Development Team

* @copyright Portions Copyright 2003 osCommerce

* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

* @version $Id: tpl_search_header.php 4142 2006-08-15 04:32:54Z drbyte $

*/

?>

<div id="searchHeaderText"><?php echo SEARCH_HEADER_TEXT; ?></div>

<?php

$content = "";

So, you are INSERTING the following above the $content line

PHP Code:

?>

<div id="searchHeaderText"><?php echo SEARCH_HEADER_TEXT; ?></div>

<?php

Save the file on your hard drive, then FTP it to:-

includes\templates\classic\sideboxes\

(ie: the new sideboxes folder you created in your CUSTOM template).

------------------------------------------------

NEXT STEP

------------------------------------------------

4. FTP a copy of your english.php file to your hard drive. (If you already have english.php
in your custom template, then that is the one to edit. If not, FTP this one:-

\includes\languages\english.php)
5. Open it for editing and find (around line 74)the lines:-

PHP Code:

//text for sidebox heading links

define('BOX_HEADING_LINKS', '&nbsp;&nbsp;[more]');

// categories box text in sideboxes/categories.php

define('BOX_HEADING_CATEGORIES', 'Categories');

6. Insert the following line underneath, using similar spacing:-

PHP Code:

//text for search header label text

define('SEARCH_HEADER_TEXT', 'Search for:');

7. Save the file.

8. FTP it into:

\includes\languages\classic\

---------------------------------------------------------------

NEXT STEP

---------------------------------------------------------------

9. Open your stylesheet.css file (again, you should edit one in your CUSTOM css folder -
\includes\templates\classic\css\stylesheet.css ).
Insert the following lines at the bottom of the stylesheet:-

PHP Code:

#searchHeaderText {

padding-top: 0.5em;

float: left;

10. Save the file, (and if you edited a copy on your hard drive, send it to your custom css
folder.)

You can adjust " padding-top: 0.5em; " to suit your needs... 0.6em, or 0.4em ...

ADVANCE SEARCH

The query for the search feature in the shop is created (for v1.2.x) in:

includes/blocks/blk_advanced_search_result.php

At this time you can not override this file.

If you want to adjust which database columns to search through, you would have to
manipulate the variable $where_str in that file.

Remember that by combining php and html (html would go in the proper template file) you
can use form input, like checkboxes or drop-down menus, to decide how to create the
query.

Sort order

The search results use the same sort order as the other product listings. If you want to use
a separate sort order for search results, you need to adjust the variable $order_str in
includes/blocks/blk_advanced_search_result.php

CUSTOMIZING SEARCH BOX

To tell the search not to use the description, simply set the right parameter: Use the
Developers Toolkit and search the catalog-side template files for search_in_description = 1
and change it to 0 instead of 1 in the appropriate file ... typically either tpl_search.php or
tpl_search_header.php depending on which search box you're using.

This worked for me.

Edit /includes/templates/your_template/sideboxes/tpl_search.php

Note that this applies the change only the quick search sidebox.

search_in_description = 1

but

'search_in_description', '1'

and you can find it in two files:

/includes/templates/template_default/sideboxes/tpl_search.php

and
/includes/templates/template_default/sideboxes/tpl_search_header.php

If you want to change this, move the files to:

/includes/templates/YOUR_CUSTOM_TEMPLATE/sideboxes/

and edit the line

'search_in_description', '1'

to be

'search_in_description', '0'

Hope this helps.

by Andres Lemonk – October 20, 2009

AFTER YOU PRESS THE BUY NOW BTN, this page in shown.

includes\templates\template_default\templates\tpl_shopping_cart_default.php

by Andres Lemonk – October 20, 2009

I would like to make the output conditional upon a value being present in the DB.
Could you expand on your PHP a little bit. I am having a little trouble with the logic.
Guarantee: <?php echo $product_info->fields['products_guarantee']; ?>

Color: <?php echo $product_info->fields['products_color']; ?>

<?php if (!empty($product_info->fields['products_guarantee'])) echo $product_info-


>fields['products_guarantee']; ?>

by Andres Lemonk – October 20, 2009

LANGUAGES

If you want to eliminate “Welcome Guest!” Would you like to log yourself in?” message
completely, turn off the Customer Greeting in your Admin -> Configuration -> Layout
settings -> Customer Greeting -> Show on Index Page and set to 0.

If you want to replace this message with one of your own, start your text editor and open
the includes/languages/ENGLISH/index.php file and locate these lines of code

if (STORE_STATUS == '0') {

define('TEXT_GREETING_GUEST', 'Welcome <span class="greetUser">Guest!</span>


Would you like to <a href="%s">log yourself in</a>?');

} else {

define('TEXT_GREETING_GUEST', 'Welcome, please enjoy our online showcase.');

define('TEXT_GREETING_PERSONAL', 'Hello <span class="greetUser">%s</span>!');

As you can see, there are two Welcome messages depending upon whether you wish Zen
Cart to be a fully functioning store, or just a showroom.
MAIN PAGE TEXT

This content is located in the file at:


includes/languages/english/html_includes/YOUR_TEMPLATE/define_main_page.php

Duplicate Product Descriptions when adding new language

in the file, for example: includes\modules\sideboxes\whats_new.php

original

Code:

$random_whats_new_sidebox_product_query = "select p.products_id, p.products_image,


p.products_tax_class_id, p.products_price, pd.products_name,

p.master_categories_id

from (" . TABLE_PRODUCTS . " p

left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )

where p.products_id = pd.products_id

and p.products_status = 1 " . $display_limit;bằng đoạn code

replacement:

Code:

if ($_SESSION['language'] == "english"){
$random_whats_new_sidebox_product_query= "select distinct p.products_id,
p.products_image, p.products_tax_class_id, p.products_price, pd.products_name,

p.master_categories_id

from (" . TABLE_PRODUCTS . " p

left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id


inner join " . TABLE_LANGUAGES . " l on pd.language_id = l.languages_id)

where p.products_id = pd.products_id and l.name = 'English'

and p.products_status = 1 " . $display_limit;

else if ($_SESSION['language'] == "YOUR_LANGUAGE")

$random_whats_new_sidebox_product_query = "select distinct p.products_id,


p.products_image, p.products_tax_class_id, p.products_price, pd.products_name,

p.master_categories_id

from (" . TABLE_PRODUCTS . " p

left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id


inner join " . TABLE_LANGUAGES . " l on pd.language_id = l.languages_id)

where p.products_id = pd.products_id and l.name = 'YOUR_LANGUAGE'

and p.products_status = 1 " . $display_limit;

INSTALLATION TUTORIAL

1. Go to
http://www.zen-cart.com/

2. Download the latest version

3. Upload the zipfile downloaded from zen cart and put it inside your root folder

4. DesCompress the zipFile and rename it as store

5.

On the server locate the file: /store/includes/dist-configure.php

Rename this file to configure.php and change the permissions to 0777 (read-write-execute
for all)

Next, on the server locate the file: /store/admin/includes/dist-configure.php

Rename this file to configure.php and change the permissions to 0777 (read-write-execute
for all)

6.

Now, change the permissions on the following directories to 0777 (read/write/execute).

* /store/cache

* /store/images

* /store/includes/languages/english/html_includes
* /store/media

* /store/pub

* /store/admin/backups

* /store/admin/images/graphs

and, also:

* /store/images/attributes

* /store/images/banners

* /store/images/categories

* /store/images/large

* /store/images/large/dvd

* /store/images/manufacturers

* /store/images/medium

* /store/images/upload

7. Create a Text File with all the usernames, passwords and information that we are gonna
use, name it security,and leave inside the main folder of the client, never upload this file.

Create a Database, in the CPanel

7.A

MySQL Databases
7.B

On create a New Database: (Write the name), in this case > tendecystore

Alwas has to be very explanative.

7.C.

MySQL User

Add New User : tenuser

PassWord : ******

> Create User

Write this information in the text file.

7.D

Add User to DataBase

Select the User

Select The Database

And select All Proviledges

7.E
Now In the file organize the information above like this:

Database Host:localhost

Database Name:newyorn6_zencart

Database User:newyorn6_lemonk

psw: unitedcolors

Be aware that when you create the Databse Name and UserName the letters newyorn6_
are always attached before the names, use them in this ways.

7.F

Also we need to write the information below, changing it to the corresponding domain or
URL

So for this example we are using the store from the domain tendencygroup.com, replace
the domain information as you need.

THIS IS THE CPANEL PATH, WHERE YOU CAN FIND THE STORE

"The physical path to your new Zen Cart™ directory"

Example: /home/newyorn6/public_html/tendencygroup.com/store
THIS PATH IS WHERE YOU CAN FIND THE STORE

"The Virtual HTTP Path (the URL to your domain and directory for your shop)"

Example: http://www.tendencygroup.com/store

THIS IS THE DOMAIN OF THE STORE

"The Virtual HTTPS Server (the secure URL to your domain)"

Example: https://www.tendencygroup.com

THIS PATH IS WHERE YOU CAN FIND THE STORE

"The Virtual HTTPS Path (the secure URL to your domain and directory for your shop)"

Example: https://www.tendencygroup.com/store

9. Now you are ready to set up the zen cart, so go to the domian and the store folder >>

http://tendencygroup.com/store

10. Zen Cart wellcome you, do next untill you find the DataBase setup, use the information
that you have on the text file to set up this part, and click on SAVE DATABASE SETTINGS
11.

Now you are int the System Setting windows, Zen Cart will detect all the settings that you
need then click on

Save System Settings

12. Now you are in the phpBB setUp, just click Save phpBB Settings

13. Now you are in Store SetUp

Fill Out all the information has you need, and save changes.

14. Now you are in the Admin Setup > Fill the information, the email will always be
info@newyorkdesignlab.com

15.

NEXT STEPS

For security, you will need to reset your configure.php files located in the /admin/includes/
and /includes/ folders back to read-only mode before allowing people to access your store,
so change it to 0444.

Additionally, you'll want to remove the /zc_install folder so that someone can't re-install
your shop again and wipe out your database! Warnings will appear until the folder has
been removed or renamed.

16. AND ITS DONE

Now you can access to the admin area going to http://tendecygroup.com/store/area


or to the store at http://tendecygroup.com/store

And its done !!!

GREAT MODULES

WishList

http://eazyecommerce.com/web-templates/zen-cart/modules/wishlist-manager

FILTERS

http://www.ballparksofbaseball.com/new/docs/product_types_readme.html

CHANGE LOG-IN FORM

templates/tendency/templates/tpl_login_default.php

templates/tendency/templates/tpl_modules_create_account.php

Admin> Configuration> Customer Details to change required filds and more

Vous aimerez peut-être aussi