Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Coding for multiple images in your Infobox background!


Guest

Recommended Posts

Hi,

 

After waiting and waiting and getting no responce!

 

ACCEPT FROM SO CALLED MEMBERS WHO WANT TO CHARGE ME A FEE TO CODE IT!!!

"THAT'S TOTALLY UNCOOL FOR AN OPEN SOURCE FORUM"

 

Anyway, I started coding it myself. After several attemps I found a easy solution.

Go to the includes/boxes for tutorial purposes take the categories.php file and open it in

a text editor.

 

Look for this text <!-- categories //--> it's around line 61 and 138. All your gouing to do is

add html code to setup your tables and graphics, it's super simple.. :thumbsup:

 

 

 

Here's the original code unmodified.

 

<?php

/*

$Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

function tep_show_category($counter) {

global $tree, $categories_string, $cPath_array;

 

for ($i=0; $i<$tree[$counter]['level']; $i++) {

$categories_string .= " ";

}

 

$categories_string .= '<a href="';

 

if ($tree[$counter]['parent'] == 0) {

$cPath_new = 'cPath=' . $counter;

} else {

$cPath_new = 'cPath=' . $tree[$counter]['path'];

}

 

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '<b>';

}

 

// display category name

$categories_string .= $tree[$counter]['name'];

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '</b>';

}

 

if (tep_has_category_subcategories($counter)) {

$categories_string .= '->';

}

 

$categories_string .= '</a>';

 

if (SHOW_COUNTS == 'true') {

$products_in_category = tep_count_products_in_category($counter);

if ($products_in_category > 0) {

$categories_string .= ' (' . $products_in_category . ')';

}

}

 

$categories_string .= '<br>';

 

if ($tree[$counter]['next_id'] != false) {

tep_show_category($tree[$counter]['next_id']);

}

}

?>

<!-- categories //-->

<tr>

<td>

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

 

new infoBoxHeading($info_box_contents, true, false);

 

$categories_string = '';

$tree = array();

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

while ($categories = tep_db_fetch_array($categories_query)) {

$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],

'parent' => $categories['parent_id'],

'level' => 0,

'path' => $categories['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $categories['categories_id'];

}

 

$parent_id = $categories['categories_id'];

 

if (!isset($first_element)) {

$first_element = $categories['categories_id'];

}

}

 

//------------------------

if (tep_not_null($cPath)) {

$new_path = '';

reset($cPath_array);

while (list($key, $value) = each($cPath_array)) {

unset($parent_id);

unset($first_id);

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

if (tep_db_num_rows($categories_query)) {

$new_path .= $value;

while ($row = tep_db_fetch_array($categories_query)) {

$tree[$row['categories_id']] = array('name' => $row['categories_name'],

'parent' => $row['parent_id'],

'level' => $key+1,

'path' => $new_path . '_' . $row['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $row['categories_id'];

}

 

$parent_id = $row['categories_id'];

 

if (!isset($first_id)) {

$first_id = $row['categories_id'];

}

 

$last_id = $row['categories_id'];

}

$tree[$last_id]['next_id'] = $tree[$value]['next_id'];

$tree[$value]['next_id'] = $first_id;

$new_path .= '_';

} else {

break;

}

}

}

tep_show_category($first_element);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => $categories_string);

 

new infoBox($info_box_contents);

?>

</td>

</tr>

<!-- categories_eof //-->

 

 

Here's the same categories file with a jpg image thats been split into three seperate backgound pics! It also ha the html code

for a custom heading image inluded. You can make these simple alterations to all the boxes and any new box you create. The new html code is in Blue Text

the Image placement code is in Red Text.

 

<?php

/*

$Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

function tep_show_category($counter) {

global $tree, $categories_string, $cPath_array;

 

for ($i=0; $i<$tree[$counter]['level']; $i++) {

$categories_string .= " ";

}

 

$categories_string .= '<a href="';

 

if ($tree[$counter]['parent'] == 0) {

$cPath_new = 'cPath=' . $counter;

} else {

$cPath_new = 'cPath=' . $tree[$counter]['path'];

}

 

$categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '<b>';

}

 

// display category name

$categories_string .= $tree[$counter]['name'];

 

if (isset($cPath_array) && in_array($counter, $cPath_array)) {

$categories_string .= '</b>';

}

 

if (tep_has_category_subcategories($counter)) {

$categories_string .= '->';

}

 

$categories_string .= '</a>';

 

if (SHOW_COUNTS == 'true') {

$products_in_category = tep_count_products_in_category($counter);

if ($products_in_category > 0) {

$categories_string .= ' (' . $products_in_category . ')';

}

}

 

$categories_string .= '<br>';

 

if ($tree[$counter]['next_id'] != false) {

tep_show_category($tree[$counter]['next_id']);

}

}

?>

<!-- categories //-->

<tr>

<td>

<table width="165" height="52" border="0" cellspacing="0" cellpadding="0">

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="100%" height="52" align="center" valign="middle" background="background="you-image goes here.gif">

<table width="160" height="52" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td height="33" valign="bottom"><img src="background="you-image goes here.gif" width="160" height="30"></td>

</tr>

<tr>

<td height="19"> </td>

</tr>

</table></td>

</tr>

<td width="165" cellpadding="3" cellspacing="0" height="100%" align="left" valign="top" background="background="you-image goes here.gif"><?php

$info_box_contents = array();

$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

 

new infoBoxHeading($info_box_contents, true, false);

 

$categories_string = '';

$tree = array();

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

while ($categories = tep_db_fetch_array($categories_query)) {

$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],

'parent' => $categories['parent_id'],

'level' => 0,

'path' => $categories['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $categories['categories_id'];

}

 

$parent_id = $categories['categories_id'];

 

if (!isset($first_element)) {

$first_element = $categories['categories_id'];

}

}

 

//------------------------

if (tep_not_null($cPath)) {

$new_path = '';

reset($cPath_array);

while (list($key, $value) = each($cPath_array)) {

unset($parent_id);

unset($first_id);

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

if (tep_db_num_rows($categories_query)) {

$new_path .= $value;

while ($row = tep_db_fetch_array($categories_query)) {

$tree[$row['categories_id']] = array('name' => $row['categories_name'],

'parent' => $row['parent_id'],

'level' => $key+1,

'path' => $new_path . '_' . $row['categories_id'],

'next_id' => false);

 

if (isset($parent_id)) {

$tree[$parent_id]['next_id'] = $row['categories_id'];

}

 

$parent_id = $row['categories_id'];

 

if (!isset($first_id)) {

$first_id = $row['categories_id'];

}

 

$last_id = $row['categories_id'];

}

$tree[$last_id]['next_id'] = $tree[$value]['next_id'];

$tree[$value]['next_id'] = $first_id;

$new_path .= '_';

} else {

break;

}

}

}

tep_show_category($first_element);

 

$info_box_contents = array();

$info_box_contents[] = array('text' => $categories_string);

 

new infoBox($info_box_contents);

?>

</td>

</tr>

<tr>

<td width="165" height="25" align="left" valign="bottom" background="you-image goes here.gif"> </td>

</tr>

</table></td>

</tr>

</table>

<!-- categories_eof //-->

 

 

Hope this Little TUT Helps You New Coders Out! :thumbsup: :thumbsup:

 

Best of All It's Free The Way It Should Be!!!!

 

Please leave a reply if this helps you! Make it easy for others to find!

 

Azati_Prime

Link to comment
Share on other sites

Thanks for the info, I am not sure if it will help me or not yet tho, all I am trying to do for the moment is to get a rectangular image to display in the empty left by removing the what's new box from the main catalog page. Would I have to make a new box and put it there?

Link to comment
Share on other sites

Hi matrix2223,

 

The code supports 3 images for the background. It also has the code added in to place a custom gif heading at the top .

 

Here the HTML Code that creates a 3 row 1 colum table, with an extra table in the first row for your custom gif heading

 

Copy & Paste the code below tio Dreamweaver or any Web Designing Proggie you'll under stand what it's doing right away.

 

 

<table width="165" height="52" border="0" cellspacing="0" cellpadding="0">

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="100%" height="52" align="center" valign="middle" background="includes/boxes/header_box.jpg">

<table width="160" height="52" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td height="33" valign="bottom"><img src="includes/boxes/azati-news.gif" width="160" height="30"></td>

</tr>

<tr>

<td height="19"> </td>

</tr>

</table></td>

</tr>

<td width="165" height="100%" align="left" valign="top" background="includes/boxes/body_box.jpg">

</td>

</tr>

<tr>

<td width="165" height="25" align="left" valign="bottom" background="includes/boxes/footer_box.jpg"> </td>

</tr>

</table></td>

</tr>

</table>

 

Super easy to use.

 

Seth

Link to comment
Share on other sites

Thanks for the info, I am not sure if it will help me or not yet tho, all I am trying to do for the moment is to get a rectangular image to display in the empty left by removing the what's new box from the main catalog page. Would I have to make a new box and put it there?

 

Where can I veiw your store? I can add a single image to the background. Post the what's new code for me. I'll set it up for you.. :thumbsup: :thumbsup:

 

Then you can copy it back to your file.

 

Seth

Link to comment
Share on other sites

Where can I veiw your store? I can add a single image to the background. Post the what's new code for me. I'll set it up for you.. :thumbsup: :thumbsup:

 

Then you can copy it back to your file.

 

Seth

Hi Seth, Thanks for your reply! That is part of the problem tho, I am not sure what file it would be in. The area I mean is the center of the screen area between the left and right columns area on the screen. It used to have the what's new box with products showing there, after i got rid of them there is now nothing there, just white area. Sorry this is hard to explain I guess, hope I am making sense. I have not put the store online yet, just still working on all this. I would be glad to send you the file if I new which it was.

Thanks

Link to comment
Share on other sites

Hi lordofcb,

 

Do you happen to remember the last file you made mods to?

 

So the left and right columns are visable? Sounds like you might need to replace your product_listing.php file.

 

includes/modules/product_listing.php. I would try uploading a fresh copy..

Just rename the current product_listing.php file to something like product_listing-bkup.php so you don't lose it.

Then upload the new product_listing.php. Go to your Browser and hit refresh, see if the center info appears.

Link to comment
Share on other sites

  • 3 months later...
If you are only using, say 2 images. 1 for the info box header and 1 for the body of the info box. You could have saved a whole bunch of time by switching to the stylesheet.css

 

Any details on this?

 

Thanks...

Chris

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...