Saturday, 23 October 2010

How do I add javascript to specific page headers?

These files are defined under...

modules/pages/PAGETYPE/jscript_main.php

eg the javascript for the product info page is saved at

modules/pages/product_info/jscript_main.php

How do I add a second stylesheet?

The header elements are created under /yourtemplate/common/html_header.php

It works by adding any css file named "style*.css" under your template's css folder to the page head, or you can hard code the link here.

How do I link to the shopping cart?

Use the zen_href_link function as follows...

<a href="'.zen_href_link(FILENAME_SHOPPING_CART).'">

How to I change the "ea." in the shopping cart?

This is generated by a variable called BOX_SHOPPING_CART_DIVIDER.

This is set in includes/languages/english.php

Friday, 22 October 2010

How do I upload multiple images?

1. Name your images NAMEOFIMAGE.jpg, NAMEOFIMAGE_01.jpg, NAMEOFIMAGE_02.jpg
with the ones with numbers as the sub images.

2. Upload a numbered one when you create your product.

3. Edit the product, and select another numbered item to upload.

4. When all numbered items are uploaded, upload the original NAMEOFIMAGE.jpg one.

Tuesday, 19 October 2010

How do I move the product attributes above the buy button?

The file templates/*yourtemplate*/templates/tpl/products/info_display.php

has comment tags showing where each section begins and ends, so simply move the bit which starts

<!--bof Attributes Module -->

and ends

<!--eof Attributes Module -->

above the

<!--bof Add to Cart Box -->

section.

Monday, 18 October 2010

How do I disable products appearing as "sold out"?

These settings are under configuration - stock.

If a product is manually set to out of stock on the product page, it will simply vanish from the site.

where is the sold out button generated in zen cart?

includes/functions/functions_general.php

How do I replace the "... more info" text.

This is under includes/languages/english.php

The line you want is...

// more info in place of buy now
define('MORE_INFO_TEXT','...more info');

Which file creates the "featured products" section?

this is saved here...
includes/modules/featured_products.php

the prices are pulled out here...
includes/functions/functions_prices.php

Saturday, 16 October 2010

How do I insert a category image using the zen_image() function

<?php
$categories_image = zen_get_categories_image(1);
echo zen_image(DIR_WS_IMAGES . $categories_image, $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT);

?>



changing the '1' in zen_get_categories_image(1) to the category id

How do I reference the row or column of a category in the category list, with css.

The category list is generated in the file includes/modules/category_row.php

If you change the line starting $list_box_contents[$row][$col] to

$list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . '', 'text' => '<div class="categorybox colbox'.$col.' rowbox'.$row.'"><a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '"><span class="categoryimage">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</span><span class="categorynamex">' . $categories->fields['categories_name'] . '</span></a></div>');

Then this provides new classes to reference -
categorybox = the image and title
categoryimage = the image
categorynamex = the title

It also provides two classes which change depending on the row or column you are in.

colbox0 is applied to the category of every first column element,
colbox1 is applied to the second etc.

rowbox0, rowbox1... is the same, but with the rows.

Where do I add new colours to the colours attribute?

Under catalogue - attributes controller.

Select Values, and under that you can select the "colours" option name and enter a new one.

Friday, 15 October 2010

Where do I update the main product image size?

Under configuration - images.

This sets a maximum image size, but smaller images can be uploaded.

How do I make the product page pull out a full size image, rather than a popup?

In your templates folder, under "templates", there is a file called tpl_modules_main_product_image.php.

Change this bit...

<script language="javascript" type="text/javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . zen_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $_GET['products_id']) . '\\\')">' . zen_image($products_image_medium, addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT) . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>'; ?>');
//--></script>

to...

<?php echo zen_image($products_image_medium, addslashes($products_name), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT); ?>

How do I turn off tell-a-friend?

This is under catalog - product types.

Select 'edit layout'. It is one of the options on this page.

How do I add a class to the input box on the search sidebox?

in the file...
includes/templates/yourtemplate/sideboxes/tpl_search.php

change...

$content .= zen_draw_input_field('keyword', '', 'size="18" maxlength="100" style="width: '

to..

$content .= zen_draw_input_field('keyword', '', 'size="18" class="searchinput" maxlength="100" style="width: '

How do I remove the advanced search option from the side box?

This code is in the file indludes/templates/yourtemplate/sideboxes/tpl_search.php

$content .= '<br /><a href="' . zen_href_link(FILENAME_ADVANCED_SEARCH) . '">' . BOX_SEARCH_ADVANCED_SEARCH . '</a>';

This can just be deleted, or commented out.

How do I style the subcategories in the categories sidebox.

These have the class name ".category-products", so you can add css to that.

It can make for tidier code to remove the normal html indents (configuration - layout settings) and use css instead.

How do I make the categories box into a list, rather than links with line breaks

Edit the file - yourtemplate / sideboxes / tpl_categoires.php

in such a way that mentions of <a> tags are replaced by <li><a>
and <br> tags are replaced by <\li>

You then need to add
$content .= '<ul>';
before the for loop

and
$content .= '</ul>';
after the loop

How do I change the indent to the subcategories on the categories sidebox?

This is in the admin area under configuration->layout settings

The setting is called "Categories Separator between the Category Name and Sub Categories"

Tuesday, 12 October 2010

How do I turn off the left/right box titles?

These titles are inserted in...

includes/templates/NAME_OF_TEMPLATE/common/tpl_box_default_right.php

Just remove this bit too turn off all titles...
<h3 class="rightBoxHeading" id="<?php echo str_replace('_', '-', $box_id) . 'Heading'; ?>"><?php echo $title; ?></h3>

Where are the left/right box titles set?

These are set in the $title variable in the appropriate sidebox file under

includes / modules / sideboxes /

Where is the categories box template's php file?

It's saved under

includes/templates/NAME_OF_TEMPLATE/templates/sideboxes/tpl_categories.php

How do I add a breadcrumb title to a non-shop page?

Create a folder / go to - includes/languages/english/NAME_OF_TEMPLATE

Create a page called NAME_OF_PAGE.php

<?php
define('NAVBAR_TITLE', 'NAME_OF_PAGE');
define('HEADING_TITLE', 'NAME_OF_PAGE');
?>

How do you remove the links beneath the main categories box?

In the admin area, go to configuration - layout settings.

Turn off...

Categories Box - Show Products New Link
Categories Box - Show Specials Link
Categories Box - Show Featured Products Link
Categories Box - Show Products All Link

How do I create a very basic new non-shop page?

At the most basic...

1. Add a new folder to includes/modules/pages/ called the NAME_OF_YOUR_PAGE.

2. Add a new file called header_php.php, which needs to be something like...

<?php
require(DIR_WS_MODULES . 'require_languages.php');
$breadcrumb->add(NAVBAR_TITLE);
?>

3. Create the file includes/templates/YOUR_TEMPLATE/templates/tpl_NAME_OF_YOUR_PAGE_default.php

Add the html here you want to pull out.

The page will be at the url index.php?main_page=NAME_OF_YOUR_PAGE

Monday, 11 October 2010

How do I re-order the left/right boxes?

In the admin area, go to tools -> layout boxes controller, select and edit each box so that each has a "Left/Right column" sort order. The lower the number, the higher the box will appear on the page.

How do I add an image from my template folder to a sidebox

As with the main template, "<? echo DIR_WS_TEMPLATE; ?>" inserts the stem of the template's URL into the page.

So, if your image is uploaded within your template, then the code will be as such...

<img src="<? echo DIR_WS_TEMPLATE; ?>images/logo.png" alt="logo" width="300" height="87"/>

How do I add the page title to my sidebox?

Simply add the code
<?php echo $breadcrumb->last(); ?>

to display the last item of the current page's breadcrumb trail, ie the current page name.

What is zen_category_tree()?

It is a specific function written for the categories sidebox, which defines the structure of the site tree.

How do I build a very basic text module for the left/right box areas?

At it's simplest, ftp to modules / side boxes - and upload a new php file called
NAME_OF_MODULE.php which contains just the html you wish to display.

This will act like an include file, and you will be able to turn it on and off with the Layout Boxes Controler.

How do I add a javascript file to my template?

Javascript files must be renamed from NAME.js to jscript_NAME.js and uploaded to the jscript folder under your template.

They are pulled out alphabetically, so name them appropriately if they have to appear in a defined order.

Where is the message "Congratulations! You have successfully installed your Zen Cart™ E-Commerce Solution." defined?

It's under includes/languages/english and is in the index.php file...

define('HEADING_TITLE', 'Congratulations! You have successfully installed your Zen Cart™ E-Commerce Solution.');

You define the default headings for your store by changing this.

Where is the homepage welcome message defined?

It's in your template's files under templates/tpl_index_default.php.

How do I move the breadcrumb section from the default template?

This is defined in this section of code in tpl_main_page.php -

<?php if (DEFINE_BREADCRUMB_STATUS == '1' || (DEFINE_BREADCRUMB_STATUS == '2' && !$this_is_home_page) ) { ?>
<?php echo $breadcrumb->trail(BREAD_CRUMBS_SEPARATOR); ?>
<?php } ?>

Place this where you want the breadcrumbs to appear on the page, or delete outright if you do not want them.

Where do I update the default homepage content?

includes/languages/english/html_includes/define_main_page.php

This content goes from the log in box, to the featured product boxes.

How do I remove the default header from the default template?

If you do not want to edit the standard header (tpl_header.php), then in tmpl_main_page.php, you can remove the call to the header, which is the following bit of code...

<?php
/**
* prepares and displays header output
*
*/
if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_HEADER_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == '')) {
$flag_disable_header = true;
}
require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');?>

How do I link to an image in the tpl_main_page.php template?

"<? echo DIR_WS_TEMPLATE; ?>" inserts the stem of the template's URL into the page.

So, if your image is uploaded within the template's "images" folder, then use code such as the following...

<img src="<? echo DIR_WS_TEMPLATE; ?>images/logo.png" alt="logo" width="300" height="87"/>

Why do I get no column boxes when I install a new template?

When you set up a new template, the left and right column boxes are all reset to being "off". You must turn them on again as you wish to use them in your new template.