Tuesday, July 21, 2009

Os Commerce Tutorial

  • To change the logo and the side images go to includes- header.php and change the first table.

  • To change left and right column width go to includes- application_top.php line 61 and change the width as you like for example.

Ex:-

//customization for the design layout

Define(‘BOX_WIDTH’, 200);

  • To change arrow image in right and left column’s then go to includes- classes- boxes.php line 110.

  • If we want to remove the images of corner_left, corner_right, corner_left_right then go to includes- classes- boxes.php line 105,107, 115, 155, 159 and remove the images name no need to change the code. If we want to change the images we can change the images names.

  • To change the header menu color then go to stylesheet.css and tr header navigation, td header navigation and change the color of the header menu and what ever the styles we want.

  • To change the footer then go to stylesheet.css and tr footer, td footer and make the changes we want.

  • To change the footer information then go to includes- footer.php and make the changes.

  • If we want to add footer banner we can add it to the bottom of the page includes- footer.php.

  • The heading replacement text can be done through includes- languages- English.php. that is for example if we want to change the text My Account to Account Details then we go to includes- languages- English.php and change


Ex:-

define ('HEADER_TITLE_MY_ACCOUNT', 'My Account');

to

define (‘HEADER_TITLE_MY_ACCOUNT’,’Account Details’);


  • We also put an image in place of text

Ex:-

Define(‘HEADER_TITLE_MY_ACCOUNT’,’’);

  • To delete arrow mark and the number beside the link in categories which is in left column then, go to includes- boxes- categories.php and comment line 41 to 43 and 47 to 52.

  • Line 41 to 43 shows the arrow mark and Line 47 to 52 shows count of the categories in the product.

  • To create a static page first we need to define Header Title in the page includes- languages- english.php as

define(‘HEADER_TITLE_OUR REQUIRED NAME’,’NAME’);

Ex: - define(‘HEADER_TITLE_CONTACTUS’,’Contact Us’);

  • Then define the filename in the page includes- filesnames.php

define(‘FILENAME_OUR REQUIREDNAME’, ‘NAME’);

EX: - define(‘FILENAME_CONTACTUS’, ‘contactus.php’);

  • Then create a page in includes- languages- english- pagename.php here in this page define the navigation bar title, title of the page or any other words you want. Here the pagename is contactus.php

Ex: - define(‘NAVBAR_TITLE’, ‘Contact us’);

Here Contact us is an example name.

  • Then create a main page this page may contain the data of the static page. If we want create any form also we can create. Here in the example the main page name is contactus.php

  • Finally we have to add the link in the header page with filename and text with the header title.

Ex: - ” class=”headerNavigation”>

  • If we want to add new box in left column or right column, then create a new file and save the file in includes- boxes- requiredfilename.php and in that file the code will be

//my new box//

$info_box_contents = array();

$info_box_contents[] = array(‘text’ => BOX_HEADING_MY_NEW_BOX);

new infoBoxHeading($info_box_contents, false, false);

$info_box_contents = array();

$info_box_contents [] =array (‘text’=>’’.BOX_MY_NEW_BOX_PAGE1 .’
’.

’.BOX_MY_NEW_BOX_PAGE1. ’
’.

’.BOX_MY_NEW_BOX_PAGE2. ‘
’.

’.BOX_MY_NEW_BOX_PAGE3.‘
’.

’.BOX_MY_NEW_BOX_PAGE4. ‘’);

new infoBox ($info_box_contents );

?>

  • Then the new box must be included in the place where we want either in left side or right side. If we want to include in left side go to includes- column_left.php

  • In that, select the position where we want to include the box and write it as

require (DIR_WS_BOXES . ‘requiredfilename.php’);

  • Next the new title and pages that go in the newly made box must be changed. In includes- languages- english.php add new title of the page and the additional pages of the new box.

Define(‘BOX_HEADING_MY_NEW_BOX’ , ’My new box’);

Define(‘BOX_MY_NEW_BOX_PAGE1’ , ‘Page1’);

Define(‘BOX_MY_NEW_BOX_PAGE2’ , ‘Page2’);

Define(‘BOX_MY_NEW_BOX_PAGE3’ , ‘Page3’);

Define(‘BOX_MY_NEW_BOX_PAGE4’ , ‘Page4’);

  • Then we can add new boxes to either left column or right column of the page where we required.

  • If we want to remove box then go to includes- column_left.php or column_right.php and comment the line which we want to remove the box.

  • If we want to add images in place of box headings then go to includes- languages- english.php and make the change as

define(‘BOX_HEADING _MY_BOX’,’’);

  • If we want to add a page or more pages in the default box or new boxes by doing this we had more information to our site. For that we have to work on five files.

    • We need to modified three files

      • Includes- filenames.php

      • Includes- languages- english.php

      • Includes- boxes- information.php

  • We need to create two files

    • Oscommerce- filename.php(this is out side the includes)

    • Includes- languages- english- filename.php(this file name should be same as above filename.php

      • Let us suppose that we want to create a page sitemap in the box information we need to follow these steps.

      • Frist create a file sitemap.php in the oscommerce(out side of include) and write the code of shipping.php as same and change the steps

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SITEMAP);

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SITEMAP));


  • Now define the new page sitemap.php in includes- filenames.php

Define(‘FILENAME_SITEMAP’,’sitemap.php’);

  • Here we want to create a new page sitemap in information box so we need to open includes- boxes- information.php and add the code as

’ . BOX_INFORMATION_SITEMAP.

  • Now open includes- languages- english.php and attach the line in information box text

Define('BOX_INFORMATION_SITEMAP' , 'Sitemap');

  • Then we need to create sitemap.php in includes- languages- english- sitemap.php and in that file we need to write

define(‘NAVBAR_TITLE’, ‘Sitemap’);

define(‘HEADING_TITLE’, ‘Sitemap);

define(‘TEXT_INFORMATION’, ‘YOUR SITEMAP TEXT GOES HERE’);

  • We can also add links in boxes to site outside oscommerce. we can add links to any boxes without oscommerce. We just add a simple line in which text box we want after the line $info_box_contents[] = array('text' => $any variable);

$info_box_contents [] = array ('align' => 'left','text' => 'name');

  • If we want to change the style of the boxes then we need to define a class in includes- classes- boxes.php as

Class plainBox extends tableBox{

Function plainBox($contents){

$this->table_data_parameters=’class=”plainBox”’;

$this->tableBox($contents,true);

}

}

  • Then in our style sheet define the class plainBox and put the settings for example as

TD.plainBox {

font-family: Verdana, Arial, sans-serif;

font-size: 10px;

background: #99CCFF;

font-weight:300;

color: #FF0000;

}

  • Then we had to change the code in the files in includes- boxes- where ever we want we just write as

new plainBox($info_box_contents);

  • If we want to change the symbol of >> in header navigation then we have to change includes- header.php as

trail(' » '); ?>

  • In the place of &raquo we can put any symbols or we can place images also some of the symbols are « , < , > , • , ♥ , ♦ , ♣ , ♠ , ∞ , —

  • If we want to remove click to enlarge link and remove that option in product_info.php then simply go to oscommerce- product_info.php(outside the includes) and remove the lines from 108(from script tags) to 113(to end of no script ) and place the code below

  • If we want to change the column number of the images in the new products list which was appearing on index page then we need to change the number in the loop in the file includes- modules- new_products.php

  • HTTP_SERVER, HTTP_COOKIE, DIR_WS, DIR_FS, DB_SERVER, DB_DATABASE are defined in includes- configure.php

  • To change the default text in the index page go to includes- languages- english- index.php file


ADMIN


How to Add a new product in the list?

Go to Admin logon to admin panel and In the Administration- catalog- categories/Products.

Here we find new category and new product buttons. If we want to create new category then we click on the new category buttons and create new category by giving the details.

If we want to create new product then we click on the new product button and give the details of the product.

By giving new product details we appear the new product details in the front end new product page.

How to Add subcategories in a category?

In Admin catalog, Categories/Products in that new category button click on that and it asks for category name and image, fill those and create.

Then a folder created with the category name. Click on the folder then categories: 0 products: 0 and three buttons like back, new category, new product will appear.

If we click on new category and proceed as above then sub category is created.

If we want sub-sub category then click on the sub category and proceed the above.

If we want to add products then we need to add new product and fill the details and description of the product.

If we want to change the manufacturers name then go to catalog- manufacturers and click on insert button, then it asks for manufacturers name and image give the details and save the details then manufacturers names will be changed.

[Note:-Being a newbie to oscommerce, i have written some documentation of oscommerce. So, please kindly help me out if any updations or changes can be made to this post ,which will be helpful for me and many others who can visit my site.All the queries and suggestions are whole heartedly taken up.]