Jump to content
Latest News: (loading..)
FWR Media

KissIT Image Thumnailer

Recommended Posts

Hello Rainer @raiwa

First to clarify I have 2.3.4bs Edge.

Sorry this is my error, I did not see the further option of adding another large image below the image I had just selected.

Thank you for your time, this is a great addon.

Regards Shaun

Share this post


Link to post
Share on other sites

@raiwa

hey Rainer,

After installing this addon including the product_info.php mods on my new BS Edge, I went into Admin > Configure > Images and tried to find the control to remove the watermark. I removed the watermark file name and reset the thumbs, then cleared the store cache and did a hard refresh (F5) on the browser, but the watermark file is still covering the image on the product_info page.

Also, I assume that the thumbs reset option is a regeneration of all thumbs and should only be set to "reset" for that purpose and then reversed back to "false".. is that correct?

So, is there a better way to disable the watermark or should I try adding a 1px transparent file as the watermark?

 

 

Edited by Demitry

Share this post


Link to post
Share on other sites

I read the instructions and setting the watermark size to 0 and resetting the thumbs cache afterwards did not work either.

Share this post


Link to post
Share on other sites

@raiwa

I did that and the problem persists in the 2 browsers I checked. However, there is a bit more to this issue. I initially did this on A Bug's Life sample prod and when I went to the home page and then checked the other product pages, they are fine and following the setting I made in the admin section for those images.

However, when I go back to that product page for A Bug's Life, the watermark is there and the image is not upsized (as per my setting to allow upsizing).

Share this post


Link to post
Share on other sites

I opened a 3rd browser (FF, Chrome, and now IE) that does not have any cache of this page and I cleared the cache before loading the product page for A Bug's life,... same problem. For some reason the thumbs cache reset is not clearing the cache for this initial product page I loaded. This is not a browser cache problem. Any suggestions please?

Share this post


Link to post
Share on other sites

ok, I fixed it, but this is a bug with this addon, because the fix was to go into /images/thumbs/ and delete all folders of thumbs and then regenerate them by re-loading the home page again.

Share this post


Link to post
Share on other sites

@raiwa

hey Rainer,

Could you please check & test the tep_destroy_thumbs_dir() function in /includes/functions/general.php? I think this is where my thumbs problem is coming from. The chmod in that function is not setting anything to 777, and when I reset the thumbs in Admin > Configuration > Images, it does not remove the thumbs directory or any of its contents as I think the function is supposed to do. Thanks.

 

Share this post


Link to post
Share on other sites

@Demitry,

within the tep_image_function

if(!is_dir($thumbs_dir))mkdir($thumbs_dir, 0777);

within the tep_destroy_thumbs_dir function

chmod($dir . '/' . $file, 0777); 

This add-on is published since more than a year and no one else has reported these problems. I'm using it myself on a live store and no problems.

The only possible explanation for me is that your server may need different chmod settings.

Edited by raiwa

Share this post


Link to post
Share on other sites

@raiwa

thank you for the reply, Rainer.

I've been testing this problem with changing the file permissions manually on the folders and files for that thumbs folder and it is not making a difference. My hosting server settings are to create folders with 755 permissions and files with 644. However, I have an older version of this addon for an MS2.2 site and though the chmod code does not change the file or folder permissions to 777, I've never had this problem on that site.

The way I understand this process, is that when I change the Admin > Configure > Images > KissIT Reset Thumbs setting to "reset" and save, it should delete that /image/thumbs/ directory and all of its contents. Then recreate it with each tep_image() call accessed via site page load along with the new settings from the configuration table. Is this correct? ...because it if is, this is not happening with this BS Edge install regardless of folder & file permissions.

 

Edited by Demitry

Share this post


Link to post
Share on other sites

@raiwa

Hi Rainer,

I solved it! ..and it was not a bug in the code. It was completely my fault. I apologize to you and everyone else following this thread.

After spending a lot of time trying to find the coding issue in tep_destroy_thumbs_dir(), I looked at tep_cfg_reset_thumbs_cache() and noticed that the $dir value of DIR_FS_CATALOG_IMAGES is for the admin image folder definition.

After that, I looked at the BootStrap installation document in the addon package and realized that I added those two functions to the /includes/functions/general.php instead of the /admin/includes/functions/general.php file.

After making this correction I tested and it solved all the issues I was having. ..really sorry, and thank you for your time.

Demitry

Edited by Demitry

Share this post


Link to post
Share on other sites
Just now, wHiTeHaT said:

Anyone encounter problems with image dimensions over 4000x4000?

Here pages even stop showing any of the products if one of them could not be converted.

Server php memory_limit!

Who pretends to use such image sizes on WEB?:biggrin::biggrin:

Share this post


Link to post
Share on other sites

But shouldn't there be an error in the server logs for that?

Good is that i can increase it.

Now that i think of it....

The image itself is around 4mb, there are other images even 6 or 8mb who not gave a problem and are converted.

So i assumed it is the dimensions.

Share this post


Link to post
Share on other sites

Hello Lecarl @discxpress,

There is no alt tag used for the big product images in core product_info.php. Only for the small image if no big product images are available.

You can add the code to use the products name for alt tag, but if you have more than one image, you'll need to add the numbering in order to have different tags.

Try this for standard without kiss it image thumbnailer line 121:

          echo tep_image('images/' . $pi['image'], addslashes($product_info['products_name']) . ' ' . $pi_counter, '', '', 'id="piGalImg_' . $pi_counter . '"');

For kiss it image thumbnail version it is already done in the product_info.php modifications in the last version r30.

 

rgds

Rainer

Share this post


Link to post
Share on other sites
14 hours ago, raiwa said:

Hello Lecarl @discxpress,

There is no alt tag used for the big product images in core product_info.php. Only for the small image if no big product images are available.

You can add the code to use the products name for alt tag, but if you have more than one image, you'll need to add the numbering in order to have different tags.

Try this for standard without kiss it image thumbnailer line 121:


          echo tep_image('images/' . $pi['image'], addslashes($product_info['products_name']) . ' ' . $pi_counter, '', '', 'id="piGalImg_' . $pi_counter . '"');

For kiss it image thumbnail version it is already done in the product_info.php modifications in the last version r30.

 

rgds

Rainer

@raiwa where do I apply that code change? Where do I get r30?

Thank you.

Share this post


Link to post
Share on other sites

@raiwa I just discovered that the image alt tag is in the code. It's existence is proven when you hover over the image. 

However, it is not present when you view the page source on a desktop. So it will throw a red flag when ran through validators.

One question remains. Do the search engines know what the image is when the alt is empty?

Thanks

Share this post


Link to post
Share on other sites

@discxpress,

the main image is tagged for search engines in this line:

      echo tep_image('images/' . $product_info['products_image'], NULL, NULL, NULL, 'itemprop="image" style="display:none;"');

and yes, the actual version is r27, r30 is not yet released, my faut, sorry. r27 includes already the alt tag like you said.

Edited by raiwa

Share this post


Link to post
Share on other sites

@raiwa

Hi Raiwa,

First of all thank you very much for the wonderful addon.

I installed the BS Edge version last year, I think i added addons.oscommerce.com/info/9506 ( Add-On Compatibility support for OsCommerce 2.3.4 BS EDGE versions since September 2016 )

and tried to installed some BS addons. So far so good...when i tried to install your KissIT BS version, I found the admin site and the front end after add your code, it all go BLANK. So my solution is to go download the 234.1 version, and replace catalog/includes/functions/html_output.php and admin/includes/functions/general.php and then add your codes. It then working ok.

The original code is as below: (it show the page format ok, but i notice there is one different is that the original searching box is matching with all the other skin, please find image attached so you can understand what i mean. The image captured before I replaced the 234.1 version )image.png.d1d2e07129b73138704bcab44f4f75d5.png

	<?php
/*
  $Id$
	  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
	  Copyright (c) 2010 osCommerce
	  Released under the GNU General Public License
*/
	////
// 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;
	    $page = tep_output_string($page);
	    if (!tep_not_null($page)) {
      die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>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('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL</strong><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 (isset($_sid)) {
      $link .= $separator . tep_output_string($_sid);
    }
	    while (strpos($link, '&&') !== false) $link = str_replace('&&', '&', $link);
	    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
      $link = str_replace('?', '/', $link);
      $link = str_replace('&', '/', $link);
      $link = str_replace('=', '/', $link);
    } else {
      $link = str_replace('&', '&amp;', $link);
    }
	    return $link;
  }
	////
// The HTML image wrapper function
  function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $responsive = true, $bootstrap_css = '') {
    if ( (empty($src) || ($src == '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) . '" 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 = (int)($image_size[0] * $ratio);
        } elseif (tep_not_null($width) && empty($height)) {
          $ratio = $width / $image_size[0];
          $height = (int)($image_size[1] * $ratio);
        } 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) . '"';
    }
	    $image .= ' class="';
	    if (tep_not_null($responsive) && ($responsive === true)) {
      $image .= 'img-responsive';
    }
	    if (tep_not_null($bootstrap_css)) $image .= ' ' . $bootstrap_css;
	    $image .= '"';
	    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;
	    $image_submit = '<input type="image" src="' . tep_output_string('includes/languages/' . $language . '/images/buttons/' . $image) . '" 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;
	    return tep_image('includes/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('images/' . $image, '', $width, $height);
  }
	////
// Output a form
  function tep_draw_form($name, $action, $method = 'post', $parameters = '', $tokenize = false) {
    global $sessiontoken;
	    $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 .= '>';
	    if ( ($tokenize == true) && isset($sessiontoken) ) {
      $form .= '<input type="hidden" name="formid" value="' . tep_output_string($sessiontoken) . '" />';
    }
	    return $form;
  }
	////
// Output a form input field
  function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true, $class = 'class="form-control"') {
    $field = '<input type="' . tep_output_string($type) . '" name="' . tep_output_string($name) . '"';
	    if ( ($reinsert_value == true) && ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) ) {
      if (isset($_GET[$name]) && is_string($_GET[$name])) {
        $value = stripslashes($_GET[$name]);
      } elseif (isset($_POST[$name]) && is_string($_POST[$name])) {
        $value = stripslashes($_POST[$name]);
      }
    }
	    if (tep_not_null($value)) {
      $field .= ' value="' . tep_output_string($value) . '"';
    }
	    if (tep_not_null($parameters)) $field .= ' ' . $parameters;
	    if (tep_not_null($class)) $field .= ' ' . $class;
	    $field .= ' />';
	    return $field;
  }
/*
////
// Output a form password field
// DEPRECATED AS OF 12 June 2015
  function tep_draw_password_field($name, $value = '', $parameters = '') {
    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 = '') {
    $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($_GET[$name]) && is_string($_GET[$name]) && (($_GET[$name] == 'on') || (stripslashes($_GET[$name]) == $value))) || (isset($_POST[$name]) && is_string($_POST[$name]) && (($_POST[$name] == 'on') || (stripslashes($_POST[$name]) == $value))) ) {
      $selection .= ' checked="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
// The $wrap parameter is no longer used in the core xhtml template
  function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
    $field = '<textarea class="form-control" name="' . tep_output_string($name) . '" cols="' . tep_output_string($width) . '" rows="' . tep_output_string($height) . '"';
	    if (tep_not_null($parameters)) $field .= ' ' . $parameters;
	    $field .= '>';
	    if ( ($reinsert_value == true) && ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) ) {
      if (isset($_GET[$name]) && is_string($_GET[$name])) {
        $field .= tep_output_string_protected(stripslashes($_GET[$name]));
      } elseif (isset($_POST[$name]) && is_string($_POST[$name])) {
        $field .= tep_output_string_protected(stripslashes($_POST[$name]));
      }
    } elseif (tep_not_null($text)) {
      $field .= tep_output_string_protected($text);
    }
	    $field .= '</textarea>';
	    return $field;
  }
	////
// Output a form hidden field
  function tep_draw_hidden_field($name, $value = '', $parameters = '') {
    $field = '<input type="hidden" name="' . tep_output_string($name) . '"';
	    if (tep_not_null($value)) {
      $field .= ' value="' . tep_output_string($value) . '"';
    } elseif ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) {
      if ( (isset($_GET[$name]) && is_string($_GET[$name])) ) {
        $field .= ' value="' . tep_output_string(stripslashes($_GET[$name])) . '"';
      } elseif ( (isset($_POST[$name]) && is_string($_POST[$name])) ) {
        $field .= ' value="' . tep_output_string(stripslashes($_POST[$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) {
    $field = '<select name="' . tep_output_string($name) . '"';
	    if (tep_not_null($parameters)) $field .= ' ' . $parameters;
	    $field .= ' class="form-control">';
	    if (empty($default) && ( (isset($_GET[$name]) && is_string($_GET[$name])) || (isset($_POST[$name]) && is_string($_POST[$name])) ) ) {
      if (isset($_GET[$name]) && is_string($_GET[$name])) {
        $default = stripslashes($_GET[$name]);
      } elseif (isset($_POST[$name]) && is_string($_POST[$name])) {
        $default = stripslashes($_POST[$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="selected"';
      }
	      $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '</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);
  }
	////
// Output a jQuery UI Button
  function tep_draw_button($title = null, $icon = null, $link = null, $priority = null, $params = null, $style = null) {
    static $button_counter = 1;
	    $types = array('submit', 'button', 'reset');
	    if ( !isset($params['type']) ) {
      $params['type'] = 'submit';
    }
	    if ( !in_array($params['type'], $types) ) {
      $params['type'] = 'submit';
    }
	    if ( ($params['type'] == 'submit') && isset($link) ) {
      $params['type'] = 'button';
    }
	    if (!isset($priority)) {
      $priority = 'secondary';
    }
	    $button = NULL;
	    if ( ($params['type'] == 'button') && isset($link) ) {
      $button .= '<a id="btn' . $button_counter . '" href="' . $link . '"';
	      if ( isset($params['newwindow']) ) {
        $button .= ' target="_blank"';
      }
    } else {
      $button .= '<button ';
      $button .= ' type="' . tep_output_string($params['type']) . '"';
    }
	    if ( isset($params['params']) ) {
      $button .= ' ' . $params['params'];
    }
	    $button .= ' class="btn ';
	    $button .= (isset($style)) ? $style : 'btn-default';
	    $button .= '">';
	    if (isset($icon) && tep_not_null($icon)) {
      $button .= ' <span class="' . $icon . '"></span> ';
    }
	    $button .= $title;
	    if ( ($params['type'] == 'button') && isset($link) ) {
      $button .= '</a>';
    } else {
      $button .= '</button>';
    }
	    $button_counter++;
	    return $button;
  }
	  // review stars
  function tep_draw_stars($rating = 0) {
    $stars = str_repeat('<span class="fa fa-star"></span>', (int)$rating);
    $stars .= str_repeat('<span class="fa fa-star-o"></span>', 5-(int)$rating);
    return $stars;
  }

After replaced with 234.1 version file and add your code, the search box somehow doesn't show the same, please find the attached image below:

image.png.eb4b171bb29424fb2e027ec6da89ad94.png

the below code is 234.1 version

	<?php
/*
  $Id$
	  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
	  Copyright (c) 2010 osCommerce
	  Released under the GNU General Public License
*/
	////
// 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;
	    $page = tep_output_string($page);
	    if (!tep_not_null($page)) {
      die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>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('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL</strong><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 (isset($_sid)) {
      $link .= $separator . tep_output_string($_sid);
    }
	    while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
	    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
      $link = str_replace('?', '/', $link);
      $link = str_replace('&', '/', $link);
      $link = str_replace('=', '/', $link);
    } else {
      $link = str_replace('&', '&amp;', $link);
    }
	    return $link;
  }
	////
// The HTML image wrapper function
  function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
    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) . '" 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);
        } elseif (tep_not_null($width) && empty($height)) {
          $ratio = $width / $image_size[0];
          $height = intval($image_size[1] * $ratio);
        } 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;
	    $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" 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;
	    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 = '', $tokenize = false) {
    global $sessiontoken;
	    $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 .= '>';
	    if ( ($tokenize == true) && isset($sessiontoken) ) {
      $form .= '<input type="hidden" name="formid" value="' . tep_output_string($sessiontoken) . '" />';
    }
	    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="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
// The $wrap parameter is no longer used in the core xhtml template
  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) . '" 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);
    }
	    $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="selected"';
      }
	      $field .= '>' . tep_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '</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);
  }
	////
// Output a jQuery UI Button
  function tep_draw_button($title = null, $icon = null, $link = null, $priority = null, $params = null) {
    static $button_counter = 1;
	    $types = array('submit', 'button', 'reset');
	    if ( !isset($params['type']) ) {
      $params['type'] = 'submit';
    }
	    if ( !in_array($params['type'], $types) ) {
      $params['type'] = 'submit';
    }
	    if ( ($params['type'] == 'submit') && isset($link) ) {
      $params['type'] = 'button';
    }
	    if (!isset($priority)) {
      $priority = 'secondary';
    }
	    $button = '<span class="tdbLink">';
	    if ( ($params['type'] == 'button') && isset($link) ) {
      $button .= '<a id="tdb' . $button_counter . '" href="' . $link . '"';
	      if ( isset($params['newwindow']) ) {
        $button .= ' target="_blank"';
      }
    } else {
      $button .= '<button id="tdb' . $button_counter . '" type="' . tep_output_string($params['type']) . '"';
    }
	    if ( isset($params['params']) ) {
      $button .= ' ' . $params['params'];
    }
	    $button .= '>' . $title;
	    if ( ($params['type'] == 'button') && isset($link) ) {
      $button .= '</a>';
    } else {
      $button .= '</button>';
    }
	    $button .= '</span><script type="text/javascript">$("#tdb' . $button_counter . '").button(';
	    $args = array();
	    if ( isset($icon) ) {
      if ( !isset($params['iconpos']) ) {
        $params['iconpos'] = 'left';
      }
	      if ( $params['iconpos'] == 'left' ) {
        $args[] = 'icons:{primary:"ui-icon-' . $icon . '"}';
      } else {
        $args[] = 'icons:{secondary:"ui-icon-' . $icon . '"}';
      }
    }
	    if (empty($title)) {
      $args[] = 'text:false';
    }
	    if (!empty($args)) {
      $button .= '{' . implode(',', $args) . '}';
    }
	    $button .= ').addClass("ui-priority-' . $priority . '").parent().removeClass("tdbLink");</script>';
	    $button_counter++;
	    return $button;
  }
?>
	

I am not sure which part of the code change the appearance of the search box area....

can you please advise me how i can change it to match the format as first image?

 

Thanks!  Lyn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×