Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Cubecart Search Form Help

Featured Replies

Hello me again :) right basically the guy who does most of the work on the development side is on holiday for two weeks so I've been left to finish things off, fix bugs etc, which I can find until I have to do some in php. Basically the search box on the home page wont search all categories like it should please see here :

 

http://development.ask-models.com/shop/index.php

 

This is the code I've been left with : Basically I need it to search all categories if it is left on 'All categories' I hope that makes sense, I'm rubish at explaing things!

 

if (!defined('CC_INI_SET')) die("Access Denied");

// include lang file
$lang = getLang("includes".CC_DS."boxes".CC_DS."searchForm.inc.php");
$box_content = new XTemplate ("boxes".CC_DS."searchForm.tpl");

// Categories
$results = $db->select(sprintf("SELECT cat_id, cat_father_id, cat_name FROM %sCubeCart_category WHERE hide = '0' AND (cat_desc != '##HIDDEN##' OR cat_desc IS NULL) AND noProducts >= 1 GROUP BY cat_father_id, cat_id", $glob['dbprefix']));

foreach ($results as $result) {
$options[$result['cat_id']] = getCatDir($result['cat_name'], $result['cat_father_id'], $result['cat_id']);
}

asort($options);

foreach ($options as $option_id => $option_name) {

$selected = null;

if (isset($_GET['category'][0]) && (int)$_GET['category'][0] == $option_id) {
	$selected = 'selected';
}

$box_content->assign('OPTION_VALUE', $option_id);
$box_content->assign('OPTION_TITLE', $option_name);
$box_content->assign('OPTION_SELECTED', $selected);
$box_content->parse("search_form.search_category");
}

// The Rest
$box_content->assign("LANG_SEARCH_FOR",$lang['searchForm']['search_for']);

if (isset($_GET['searchStr'])) {
$box_content->assign("SEARCHSTR", sanitizeVar($_GET['searchStr']));
} else {
$box_content->assign("SEARCHSTR", '');
}

$box_content->assign("LANG_GO", $lang['searchForm']['go']);
$box_content->assign("LANG_ADVANCED_SEARCH", $lang['searchForm']['search_advanced']);

$box_content->parse("search_form");
$box_content = $box_content->text("search_form");
?>

 

<!-- BEGIN: search_form -->
<form action="index.php" id="search-form" method="get">

<a class="advance-search" href="index.php?_a=search">Click here for Advanced Search</a>

<h3>{LANG_SEARCH_FOR}</h3>

<input name="searchStr" type="text" class="input" size="26" value="{SEARCHSTR}" onfocus="this.value=''" size="18" />

<select name="category[]" class="select">
	<option value="0">All Categories</option>
	  <!-- BEGIN: search_category -->
		<option value="{OPTION_VALUE}" {OPTION_SELECTED}>{OPTION_TITLE}</option>
	  <!-- END: search_category -->
</select>

<input class="button" name="Submit" type="submit" value="{LANG_GO}" />

<input type="hidden" name="_a" value="viewCat" />

</form>
<!-- END: search_form -->

Not sure if it'll work but try changing

 

<option value="0">All Categories</option>

 

to

 

<option value="">All Categories</option>

 

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.