Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

is it possible to....


willwatson

Recommended Posts

anybody? please help...

 

my immediate guess, would be to make the checkbox (Search In Product Descriptions) as a hidden field and make this selected as default

Link to comment
Share on other sites

my immediate guess, would be to make the checkbox (Search In Product Descriptions) as a hidden field and make this selected as default

 

thats a great idea! now if you could tell me how to do it please? many thanks...

Link to comment
Share on other sites

welll, one way to do it is to in the search box, replace:

 

tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px; border: 1px #ff48e3 solid; background: #ffb5da"') . ' ' . tep_hide_session_id()

 

with:

 

tep_draw_input_field('keywords', '', 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px; border: 1px #ff48e3 solid; background: #ffb5da"') . ' ' . tep_draw_checkbox_fieldadvanced('search_in_description', '1') . '' . tep_hide_session_id()

 

you will have to look through these codes because I have added my own style to the input keyword field. Essentially, I have added tep_draw_checkbox_fieldadvanced('search_in_description', '1') to the string.

 

Now, you have to go into html_output.php and define a new function tep_draw_checkbox_fieldadvanced. so, find:

 

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($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {
  $selection .= ' CHECKED';
}

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

$selection .= ' class="radio">';

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);
 }

 

and directly under this, add:

 

function tep_draw_selection_fieldadvanced($name, $type, $value = '', $checked = false, $parameters = '') {
$selection = '<input type="hidden" name="' . tep_output_string($name) . '"';

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

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

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

$selection .= ' class="radio">';

return $selection;
 }

 function tep_draw_checkbox_fieldadvanced($name, $value = '', $checked = false, $parameters = '') {
return tep_draw_selection_fieldadvanced($name, 'checkbox', $value, $checked, $parameters);
 }

 

This just makes the checkbox hidden.

 

Now, you would also want to edit the advanced_search.php file. So, find:

$info_box_contents[] = array('align' => 'right', 'text' => tep_draw_checkbox_field('search_in_description', '1') . ' ' . TEXT_SEARCH_IN_DESCRIPTION);

 

and replace it with this:

 

$info_box_contents[] = array('align' => 'right', 'text' => tep_draw_checkbox_fieldadvanced('search_in_description', '1') . ' ' . TEXT_SEARCH_IN_DESCRIPTION);

 

and away you go :D

 

Luke

ScandiTan Sweden

Link to comment
Share on other sites

Where do i find the search box? im fairly new to osc...

 

in the catalog/includes/boxes directory

 

If you find string like:

 

<?php require(DIR_WS_BOXES . 'search.php'); ?>

 

then you know it refers to a file in the includes/boxes directory

 

if you find a string like:

 

<?php echo tep_image(DIR_WS_IMAGES . 'sweden_flag.gif'); ?>

 

 

then you know it refers to a file in the /images directory

 

these are just examples. Its very important that if you want to make such changes as you obviously do, then you got to know the structure of oscommerce.

 

:'(

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...