Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

'On The Fly' Auto Thumbnailer using GD Library 2.1


mloeffen

Recommended Posts

First of all: thanks for the contrib! Everything works fine, exept for one thing:

 

I replaced the standard oscommerce pictures (Table_background_default, table_background_products_new etc) with a custom set which I found in the contributions section. These pictures are in fact just transparant ones, so the default pictures aren't displayed. This worked great, until I installed this contribution. When I visit my website now, these pictures show as white squares with a red cross (image can't be displayed).

 

Anyone knows what this might be? Is there a way to delete these images completely from the code? Thanks in advance!

 

Edit: Never mind that, need to search more carefully next time ;)

Edited by Moltifao
Link to comment
Share on other sites

  • Replies 556
  • Created
  • Last Reply

Top Posters In This Topic

Just wanna say thanks. Awesome contrib. Makes my thumbnails look how they should.

 

If i was to make any comments, the HTML instructions could do with adjustments in layout and explaination in a few areas.

More than most osC hackers can easily understand them, which is all thats really needed.

 

Uhm handling of w/h values passed to the script, do they need to be globals? not that it matters once again, coz its server generated code. But when using images that dont fit the ratio of the w/h values you have set, you end up with category or 'last viewed items' boxes that arnt very grid aligned. I know thats neither here nor there, but appearance matters.

 

If you get bored on improvements to make, theres a few things to focus on.

 

All in all, thanks heaps, made short work out of a mod id otherwise have just started writing for myself.

 

cheers.

Link to comment
Share on other sites

everything works at me, except i cannot get thumbnails into other directory.

My images are in /images/glasbeniki/

 

i have created thumb dir images/glasbeniki/thumbnails/ and everything is chmoded .. but still thumbs are in /glasbeniki folder

 

any idea?

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

 

I just installed this contribution & everything seems to be working fine except for the images in my "Favourite Sellers" box, they are huge! You can only view part of the image, they do not fit in the box. :blink:

 

You can see what I mean here.

 

Was there something I forgot to do when installing?

 

If someone could help it would be much appreciated

Link to comment
Share on other sites

Hi

 

I have this working, but I would like to change the product_info.php page so it doesn't produce a thumbnail & click to enlarge. Reason : I think that if the customer clicks on a thumbnail in the product listing etc they want to see a full picture & description. I would like to get rid of the need to click another few more times.

 

I do not understand the working of this great contribution, so do not know what affect this would have or if it is possible?

 

I "think" :huh: this is the code, but please how can I amend it, so it doesn't make the whole contribution fail?

 

<?php
if (tep_not_null($product_info['products_image'])) {
?>
	  <table border="0" cellspacing="0" cellpadding="2" align="right">
		<tr>
		  <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
		  </td>
		</tr>
	  </table>
<?php
}
?>

 

Does my images need to all be a certain size for this to work, & how can it be done without making it a slow load time?

 

Thanks

Julie

Link to comment
Share on other sites

  • 3 weeks later...

Hi, I've installed this contribution before, but I'm trying to put it on another site now and I'm having problems. When I try to run the "auto thumbnailer admin.SQL" file on my database, I get the following error:

 

SQL query: 

# Create the config group to hold the settings on their own admin page
INSERT INTO configuration_group
SET configuration_group_id =100,
configuration_group_title = 'Thumbnails',
configuration_group_description = '\'On the Fly\' Auto Thumbnailer configuration settings',
sort_order = '5',
visible = "1" 
MySQL said:  

#1146 - Table 'db230589201.configuration_group' doesn't exist

 

Can anybody help me figure out what I need to do to correct this? Any help is appreciated!

Link to comment
Share on other sites

Yep, I agree, I think its a bit of a dead thread.

I guess it depends upon which version you are using?

 

I used v1.5.1 because I know that Nates one worked before & the problems I had were resolved. I cannot say for the future ones. This is the one I chose for the second install as I wasn't too sure about the others.

 

Answer to my question...yes *2 does work at increasing the products_info.php images only (as stated in the instructions but I had missed them)

 

Ruth I looked at your site, got warning messages (security) & when I clicked on a category & product everything froze??

 

Julie

Link to comment
Share on other sites

Yep, I agree, I think its a bit of a dead thread.

Hi there,

 

I'm really sorry but I've been taken away from osCommerce by other projects. I don't use osCommerce any longer since my last osCommerce client project folded. If anyone is interested, I'm now using Drupal (CMS) and Ubercart (ecommerce module for Drupal, highly recommended), Google it since I don't think I'm allowed to post links to competing projects on these forums.

 

I'd be grateful if someone would take over the maintenance and support of this contribution.

Link to comment
Share on other sites

Hi there,

 

I'm really sorry but I've been taken away from osCommerce by other projects. I don't use osCommerce any longer since my last osCommerce client project folded. If anyone is interested, I'm now using Drupal (CMS) and Ubercart (ecommerce module for Drupal, highly recommended), Google it since I don't think I'm allowed to post links to competing projects on these forums.

 

I'd be grateful if someone would take over the maintenance and support of this contribution.

Seems like there have been many updates to the contrib since I last looked. Hopefully someone will pick up the support of this thread.

Link to comment
Share on other sites

Hopefully someone will pick up the support of this thread.

 

yes, that would certainly be nice.. i'll post my question again sometime after it gets lost, i dont believe anybody pays attention to it anyway.. ive already installed & unistalled & re-installed the whole OSCommerce package 3 or 4 times because of this contribution..

Link to comment
Share on other sites

Ruth I looked at your site, got warning messages (security) & when I clicked on a category & product everything froze??

 

Julie

 

I know, theres something wrong with it. Not quite sure what. I found one bug and fixed it, theres still another Im yet to find. Its like trying to find a needle in a hay stack!

Link to comment
Share on other sites

When youve found your fix, post it here just in case someone else happens to have the same problem

 

;)

 

i would but i have no idea what the fix was.. :( i just kept messing around with it until it worked, i think i re-installed the whole package several times..

Link to comment
Share on other sites

i would but i have no idea what the fix was.. :( i just kept messing around with it until it worked, i think i re-installed the whole package several times..

 

Hi Everyone, Please check out this post...I cut and pasted the fix and it worked like a charm! :thumbsup:

 

http://www.oscommerce.com/forums/index.php?sho...id=1188192&

Link to comment
Share on other sites

  • 2 weeks later...
Hello, I'm trying to install this contrib, but being the noob i am, i'm getting a bit stuck.

 

Not sure what to do with the sql file. How do I 'Run it on the database"? as stated in step 6 of the install instructions?

 

 

Go to cPanel -> phpMyAdmin -> click the database you wish it to be installed on (located on the left) -> click SQL icon at the top -> then paste the code in the space box and press go.

 

Thats it. :)

Link to comment
Share on other sites

Go to cPanel -> phpMyAdmin -> click the database you wish it to be installed on (located on the left) -> click SQL icon at the top -> then paste the code in the space box and press go.

 

Thats it. :)

thanks, that helped point me in the right direction, i got step 6 done, lol.

Link to comment
Share on other sites

  • 2 weeks later...

hi

 

i installed this contribution and i used it with wamp 5 and everything fines. but

when i upload it to real site , thumbnail images are not displayed

 

anyone have idea.?

 

i take backup from wamp 5 database and import db on real site

 

and i replaced files from wamp server to web site?

 

anyone have idea what problem or mistake i had done?

Link to comment
Share on other sites

hi

 

i installed this contribution and i used it with wamp 5 and everything fines. but

when i upload it to real site , thumbnail images are not displayed

 

anyone have idea.?

 

i take backup from wamp 5 database and import db on real site

 

and i replaced files from wamp server to web site?

 

anyone have idea what problem or mistake i had done?

 

i got the answer...

i have to change the permission requests...........first i had write access to image folder only for owner and group but i also have to give writes access to everyone..........although it looks little bit unsafe

Link to comment
Share on other sites

  • 2 weeks later...

I had disable the no image funciont by commenting the lines

 

if no file exists display the 'no image' file

/*if (!is_file($src)) {

$src = "images/no_image.jpg";

}

 

because it was converting the warning.gif image on the messageStack into a giant no image. It seems to be a bug somewhere in which OTF Th... makes images outside "/images" to turn into the default image. The message stack grabs the warning image from root/icons/warning.gif

 

Any ideas how to prevent this?

Link to comment
Share on other sites

Fresh OSC RC2A install + STSv4.5.8_1_2+ ultimate_seo_urls(new'est) and then adding OTF_AutoThumb_2.3a =

 

 

 

Fatal error: Call to a member function image() on a non-object in /home/voodoostyling/shop4u.lt/includes/functions/html_output.php on line 181

 

 

on the index page

 

 

the html_output.php looks like that

 

 

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

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

 Copyright (c) 2007 osCommerce

 Released under the GNU General Public License
*/

////
// Ultimate SEO URLs v2.1
// The HTML href link wrapper function
if (SEO_ENABLED == 'true') { //run chemo's code
 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
	global $seo_urls;
			if ( !is_object($seo_urls) ){
					if ( !class_exists('SEO_URL') ){
							include_once(DIR_WS_CLASSES . 'seo.class.php');
					}
					global $languages_id;
					$seo_urls = new SEO_URL($languages_id);
			}
	return preg_replace('/&/','&',$seo_urls->href_link($page, $parameters, $connection, $add_session_id));
 }
} else { //run original code
// The HTML href link wrapper function
 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
global $request_type, $session_started, $SID;

if (!tep_not_null($page)) {
  die('<br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>');
}

if ($connection == 'NONSSL') {
  $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
} elseif ($connection == 'SSL') {
  if (ENABLE_SSL == true) {
	$link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
  } else {
	$link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
  }
} else {
  die('<br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');
}

if (tep_not_null($parameters)) {
  $link .= $page . '?' . tep_output_string($parameters);
  $separator = '&';
} else {
  $link .= $page;
  $separator = '?';
}

while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);

// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
  if (tep_not_null($SID)) {
	$_sid = $SID;
  } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
	if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {
	  $_sid = tep_session_name() . '=' . tep_session_id();
	}
  }
}

if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
  while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);

  $link = str_replace('?', '/', $link);
  $link = str_replace('&', '/', $link);
  $link = str_replace('=', '/', $link);

  $separator = '?';
}

if (isset($_sid)) {
  $link .= $separator . $_sid;
}

return $link;
 }
}


////
// The HTML image wrapper function
 // "On the Fly" Auto Thumbnailer using GD Library, servercaching and browsercaching
// Scales product images dynamically, resulting in smaller file sizes, and keeps
// proper image ratio. Used in conjunction with product_thumb.php t/n generator.
function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {

 // if no file exists display the 'no image' file
 if (!is_file($src)) {
 $src = "images/no_image.jpg";
 }
// Set default image variable and code
$image = '<img src="' . $src . '"';

// Don't calculate if the image is set to a "%" width
if (strstr($width,'%') == false || strstr($height,'%') == false) {
	$dont_calculate = 0;
} else {
	$dont_calculate = 1;
}

// Dont calculate if a pixel image is being passed (hope you dont have pixels for sale)
if (!strstr($image, 'pixel')) {
	$dont_calculate = 0;
} else {
	$dont_calculate = 1;
}

// Do we calculate the image size?
if (CONFIG_CALCULATE_IMAGE_SIZE && !$dont_calculate) {

	// Get the image's information
	if ($image_size = @getimagesize($src)) {

		$ratio = $image_size[1] / $image_size[0];

		// Set the width and height to the proper ratio
		if (!$width && $height) {
			$ratio = $height / $image_size[1];
			$width = intval($image_size[0] * $ratio);
		} elseif ($width && !$height) {
			$ratio = $width / $image_size[0];
			$height = intval($image_size[1] * $ratio);
		} elseif (!$width && !$height) {
			$width = $image_size[0];
			$height = $image_size[1];
		}

		// Scale the image if not the original size
		if ($image_size[0] != $width || $image_size[1] != $height) {
			$rx = $image_size[0] / $width;
			$ry = $image_size[1] / $height;

			if ($rx < $ry) {
				$width = intval($height / $ratio);
			} else {
				$height = intval($width * $ratio);
			}

			$image = '<img src="product_thumb.php?img=' . $src . '&w=' .
			tep_output_string($width) . '&h=' . tep_output_string($height) . '"';
		}

	} elseif (IMAGE_REQUIRED == 'false') {
		return '';
	}
}

// Add remaining image parameters if they exist
if ($width) {
	$image .= ' width="' . tep_output_string($width) . '"';
}

if ($height) {
	$image .= ' height="' . tep_output_string($height) . '"';
}

if (tep_not_null($params)) $image .= ' ' . $params;

$image .= ' border="0" alt="' . tep_output_string($alt) . '"';

if (tep_not_null($alt)) {
	$image .= ' title="' . tep_output_string($alt) . '"';
}

$image .= '>';

return $image;
}
			 {

// START STS v4.4:
  global $sts; 
	  $sts->image($src); // Take image from template folder if exists.
// END STS v4.4

if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
  return false;
}

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
$image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

if (tep_not_null($alt)) {
  $image .= ' title=" ' . tep_output_string($alt) . ' "';
}

if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
  if ($image_size = @getimagesize($src)) {
	if (empty($width) && tep_not_null($height)) {
	  $ratio = $height / $image_size[1];
	  $width = intval($image_size[0] * $ratio); // Patch osc-060817
	} elseif (tep_not_null($width) && empty($height)) {
	  $ratio = $width / $image_size[0];
	  $height = intval($image_size[1] * $ratio); // Patch osc-060817
	} elseif (empty($width) && empty($height)) {
	  $width = $image_size[0];
	  $height = $image_size[1];
	}
  } elseif (IMAGE_REQUIRED == 'false') {
	return false;
  }
}

if (tep_not_null($width) && tep_not_null($height)) {
  $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
}

if (tep_not_null($parameters)) $image .= ' ' . $parameters;

$image .= '>';

return $image;
////
// The HTML form submit button wrapper function
// Outputs a button in the selected language
 function tep_image_submit($image, $alt = '', $parameters = '') {
global $language;

	// START STS v4.4:
  global $sts;
	  $src = $sts->image_button($image,$language);
	  if ($src!='')
		$image_submit = '<input type="image" src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';
		else 
  // END STS v4.4
$image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';

if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';

if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;

$image_submit .= '>';

return $image_submit;
 }

////
// Output a function button in the selected language
 function tep_image_button($image, $alt = '', $parameters = '') {
global $language;

// START STS v4.4:
  global $sts;
	$src = $sts->image_button($image, $language, true); // 3rd parameter to tell tep_image that file check has been already done
	if ($src!='') { // Take image from template folder if exists.
	  return tep_image ($src);
	}
// END STS v4.4

return tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image, $alt, '', '', $parameters);
 }

////
// Output a separator either through whitespace, or with an image
 function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {
return tep_image(DIR_WS_IMAGES . $image, '', $width, $height);
 }

////
// Output a form
 function tep_draw_form($name, $action, $method = 'post', $parameters = '') {
$form = '<form name="' . tep_output_string($name) . '" action="' . tep_output_string($action) . '" method="' . tep_output_string($method) . '"';

if (tep_not_null($parameters)) $form .= ' ' . $parameters;

$form .= '>';

return $form;
 }

////
// Output a form input field
 function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) {
global $HTTP_GET_VARS, $HTTP_POST_VARS;

$field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

if ( ($reinsert_value == true) && ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) ) {
  if (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) {
	$value = stripslashes($HTTP_GET_VARS[$name]);
  } elseif (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) {
	$value = stripslashes($HTTP_POST_VARS[$name]);
  }
}

if (tep_not_null($value)) {
  $field .= ' value="' . tep_output_string($value) . '"';
}

if (tep_not_null($parameters)) $field .= ' ' . $parameters;

$field .= '>';

return $field;
 }

////
// Output a form password field
 function tep_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {
return tep_draw_input_field($name, $value, $parameters, 'password', false);
 }

////
// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field()
 function tep_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {
global $HTTP_GET_VARS, $HTTP_POST_VARS;

$selection = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';

if (tep_not_null($value)) $selection .= ' value="' . tep_output_string($value) . '"';

if ( ($checked == true) || (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name]) && (($HTTP_GET_VARS[$name] == 'on') || (stripslashes($HTTP_GET_VARS[$name]) == $value))) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name]) && (($HTTP_POST_VARS[$name] == 'on') || (stripslashes($HTTP_POST_VARS[$name]) == $value))) ) {
  $selection .= ' CHECKED';
}

if (tep_not_null($parameters)) $selection .= ' ' . $parameters;

$selection .= '>';

return $selection;
 }

////
// Output a form checkbox field
 function tep_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {
return tep_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);
 }

////
// Output a form radio field
 function tep_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {
return tep_draw_selection_field($name, 'radio', $value, $checked, $parameters);
 }

////
// Output a form textarea field
 function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
global $HTTP_GET_VARS, $HTTP_POST_VARS;

$field = '<textarea name="' . tep_output_string($name) . '" wrap="' . tep_output_string($wrap) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';

if (tep_not_null($parameters)) $field .= ' ' . $parameters;

$field .= '>';

if ( ($reinsert_value == true) && ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) ) {
  if (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) {
	$field .= tep_output_string_protected(stripslashes($HTTP_GET_VARS[$name]));
  } elseif (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) {
	$field .= tep_output_string_protected(stripslashes($HTTP_POST_VARS[$name]));
  }
} elseif (tep_not_null($text)) {
  $field .= tep_output_string_protected($text); // Patch 2.2MS2-051113 added tep_
}

$field .= '</textarea>';

return $field;
 }

////
// Output a form hidden field
 function tep_draw_hidden_field($name, $value = '', $parameters = '') {
global $HTTP_GET_VARS, $HTTP_POST_VARS;

$field = '<input type="hidden" name="' . tep_output_string($name) . '"';

if (tep_not_null($value)) {
  $field .= ' value="' . tep_output_string($value) . '"';
} elseif ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) {
  if ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) ) {
	$field .= ' value="' . tep_output_string(stripslashes($HTTP_GET_VARS[$name])) . '"';
  } elseif ( (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) {
	$field .= ' value="' . tep_output_string(stripslashes($HTTP_POST_VARS[$name])) . '"';
  }
}

if (tep_not_null($parameters)) $field .= ' ' . $parameters;

$field .= '>';

return $field;
 }

////
// Hide form elements
 function tep_hide_session_id() {
global $session_started, $SID;

if (($session_started == true) && tep_not_null($SID)) {
  return tep_draw_hidden_field(tep_session_name(), tep_session_id());
}
 }

////
// Output a form pull down menu
 function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
global $HTTP_GET_VARS, $HTTP_POST_VARS;

$field = '<select name="' . tep_output_string($name) . '"';

if (tep_not_null($parameters)) $field .= ' ' . $parameters;

$field .= '>';

if (empty($default) && ( (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) || (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) ) ) {
  if (isset($HTTP_GET_VARS[$name]) && is_string($HTTP_GET_VARS[$name])) {
	$default = stripslashes($HTTP_GET_VARS[$name]);
  } elseif (isset($HTTP_POST_VARS[$name]) && is_string($HTTP_POST_VARS[$name])) {
	$default = stripslashes($HTTP_POST_VARS[$name]);
  }
}

for ($i=0, $n=sizeof($values); $i<$n; $i++) {
  $field .= '<option value="' . tep_output_string($values[$i]['id']) . '"';
  if ($default == $values[$i]['id']) {
	$field .= ' SELECTED';
  }

  $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '"', '\'' => ''', '<' => '<', '>' => '>')) . '</option>';
}
$field .= '</select>';

if ($required == true) $field .= TEXT_FIELD_REQUIRED;

return $field;
 }

////
// Creates a pull-down list of countries
 function tep_get_country_list($name, $selected = '', $parameters = '') {
$countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
$countries = tep_get_countries();

for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
  $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
}

return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
 }
?>

Edited by matruxas
Link to comment
Share on other sites

OMG I can't believe I have passed this contribution up !!!! Perfect out of the box easy install !!!! Awesome you don't know how much this will make life easier... LOL Its great thanks

 

Nate Welch

mloeffen

homewetbar

and I am sure many others for your work on this contribution...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...