Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help inserting images into catogory boxes


Peper

Recommended Posts

Need help inserting images into catogory boxes e.g to currency box. I'm bit new and doesn't seem to find correct page to edit.

Thanx :rolleyes:

Getting the Phoenix off the ground

Link to comment
Share on other sites

Edit Catalog/Includes/Boxes/Currencies.php

 

Should be in there what you are looing for.

 

The rest of the infoboxes should be in that folder aswell,

I know,

if I add image it will display outside the box on the bottom of e.g. right column :(

Getting the Phoenix off the ground

Link to comment
Share on other sites

Try putting this HTML code BEFORE your image code:

 

<tr>
<td>

And this code AFTER your image code:

 

</td>
</tr>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

My file catalog/includes/boxes/currencies.php

I need to add the following pictures:

 

<img src="../catalog/setcomimg/setcom2.gif" alt="setcom" width="83" height="63" /><img src="../catalog/setcomimg/thawte.jpg" alt="thawte" width="83" height="63" />

 

even before or after closing php script it does the same.

Maybe I'm editing wrong file!

 

<?php
/*
 $Id: currencies.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 if (isset($currencies) && is_object($currencies)) {
?>
<!-- currencies //-->

<tr>
<td>
<?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_CURRENCIES);

   new infoBoxHeading($info_box_contents, false, false);

   reset($currencies->currencies);
   $currencies_array = array();
   while (list($key, $value) = each($currencies->currencies)) {
     $currencies_array[] = array('id' => $key, 'text' => $value['title']);
   }

   $hidden_get_variables = '';
   reset($HTTP_GET_VARS);
   while (list($key, $value) = each($HTTP_GET_VARS)) {
     if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {
       $hidden_get_variables .= tep_draw_hidden_field($key, $value);
     }
   }

   $info_box_contents = array();
   $info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'),
                                'align' => 'center',
                                'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id());

   new infoBox($info_box_contents);
?>

<!-- currencies_eof //-->

</td>
   </tr>
    <tr>
<td>
<img src="../catalog/setcomimg/setcom2.gif" alt="setcom" width="83" height="63" /><img src="../catalog/setcomimg/thawte.jpg" alt="thawte" width="83" height="63" />

</tr></td>
<?php
 }
?> 

Getting the Phoenix off the ground

Link to comment
Share on other sites

Is:

 

<tr>
 <td>
<img src="../catalog/setcomimg/setcom2.gif" alt="setcom" width="83" height="63" /><img src="../catalog/setcomimg/thawte.jpg" alt="thawte" width="83" height="63" />
 </tr>
</td>

Should be:

 

<tr>
 <td>
<img src="../catalog/setcomimg/setcom2.gif" alt="setcom" width="83" height="63" /><img src="../catalog/setcomimg/thawte.jpg" alt="thawte" width="83" height="63" />
 </td>
</tr>

The two HTML tags at the end are switched.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

post the whole code of you categories.php file here and we might be able to five you further assistance. And also if you could give us a screenshot of your site and give us a pointer of where you want your image to show up.

Link to comment
Share on other sites

testing localhost - no picture but I can e-mail you

 

Images to go inside currencies box - right column box

Thanks for helping me

:(

 

<?php
/*
 $Id: categories.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 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 //-->

Getting the Phoenix off the ground

Link to comment
Share on other sites

Here's my currencies box

 

<?php
/*
 $Id: currencies.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if (isset($currencies) && is_object($currencies)) {
?>
<!-- currencies //-->
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_CURRENCIES);

new infoBoxHeading($info_box_contents, false, false);

reset($currencies->currencies);
$currencies_array = array();
while (list($key, $value) = each($currencies->currencies)) {
  $currencies_array[] = array('id' => $key, 'text' => $value['title']);
}

$hidden_get_variables = '';
reset($HTTP_GET_VARS);
while (list($key, $value) = each($HTTP_GET_VARS)) {
  if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {
	$hidden_get_variables .= tep_draw_hidden_field($key, $value);
  }
}

$info_box_contents = array();
$info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'),
							 'align' => 'center',
							 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id());

new infoBox($info_box_contents);
?>

<!-- currencies_eof //-->
</td></tr>
<?php
 }
?>

Thats the php code for the Categories Box. Do you want the picture in the category box or in the currencies box?

Getting the Phoenix off the ground

Link to comment
Share on other sites

It doesn't seem like you can add an image in the middle of the box because of the way the php code is in one big cluster to display the infobox. Have you tried defining a new class for the currencies.php page and then in your stylesheet attaching an image that way? Because if you change in your stylesheet the current infobox content part it will change everyone. So creating a new one, and then setting the class in currencies.php i imagine will fix that.

Link to comment
Share on other sites

It doesn't seem like you can add an image in the middle of the box because of the way the php code is in one big cluster to display the infobox. Have you tried defining a new class for the currencies.php page and then in your stylesheet attaching an image that way? Because if you change in your stylesheet the current infobox content part it will change everyone. So creating a new one, and then setting the class in currencies.php i imagine will fix that.

 

Thanks, I'll give it a beat.!!

Getting the Phoenix off the ground

Link to comment
Share on other sites

This will work:

 

In your currencies.php find this code:

 

	$info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'),
							 'align' => 'center',
							 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables.tep_hide_session_id());

JUST AFTER IT ADD THIS CODE:

 

	$info_box_contents[] = array( 'align' => 'center',
										 'text' => '<img src="../catalog/setcomimg/setcom2.gif" alt="setcom" width="83" height="63" />');

$info_box_contents[] = array( 'align' => 'center',
										 'text' => ' <img src="../catalog/setcomimg/thawte.jpg" alt="thawte" width="83" height="63" />');

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...