Hey guys,
I’m currently setting up an Opencart Website.
When I enter this link http://dev.plasticpassion.com.au/index.php?route=product/search&search=0&genre=3
Three Results Show but the Search Variable is equal to 0
I want it to say “60’s Pop” so I tried
http://dev.plasticpassion.com.au/index.php?route=product/search&search=60s%20Pop&genre=3
I can get the title working but the results are not showing
Why is this the case?
Works as intended for me. What browser are you using? It may be incompatible with the jquery being used.
Hi Star Lion
The Search Title Works but the Search Results are not Displayed
Have you tried encoding the slash between “product/search”
I think this is more a question of not understanding how the Search works…
http://dev.plasticpassion.com.au/index.php?route=product/search&search=Hard%20Day&genre=3
works just fine. The search isnt looking for Genres in it’s scan, so “60s Pop” as the search term is going to come up with nothing. genre=3 tells the search to look only in 60s Pop. the search term seems to be scanning the item titles.
For whatever reason, the genre links on the right generate a search with the search term “0”, instead of just “”.
Hi Mitty
What do you mean encoding between slash?
I think this is more a question of not understanding how the Search works...
Spot on, don’t really understand how the Search Works
Snippet of the code
<div id="content" class="<?php echo $class; ?> search-page">
<h1 class="heading-title"><?php echo $heading_title; ?></h1>
<?php echo $content_top; ?>
<h2><?php echo $entry_search; ?></h2>
<div class="row content">
<div class="col-sm-4">
<input type="text" name="search" value="<?php echo $search; ?>" placeholder="<?php echo $text_keyword; ?>" id="input-search" class="form-control" />
</div>
<div class="col-sm-3 s-cat">
<select name="category_id" class="form-control">
<option value="0"><?php echo $text_category; ?></option>
<?php foreach ($categories as $category_1) { ?>
<?php if ($category_1['category_id'] == $category_id) { ?>
<option value="<?php echo $category_1['category_id']; ?>" selected="selected"><?php echo $category_1['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $category_1['category_id']; ?>"><?php echo $category_1['name']; ?></option>
<?php } ?>
<?php foreach ($category_1['children'] as $category_2) { ?>
<?php if ($category_2['category_id'] == $category_id) { ?>
<option value="<?php echo $category_2['category_id']; ?>" selected="selected"> <?php echo $category_2['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $category_2['category_id']; ?>"> <?php echo $category_2['name']; ?></option>
<?php } ?>
<?php foreach ($category_2['children'] as $category_3) { ?>
<?php if ($category_3['category_id'] == $category_id) { ?>
<option value="<?php echo $category_3['category_id']; ?>" selected="selected"> <?php echo $category_3['name']; ?></option>
<?php } else { ?>
<option value="<?php echo $category_3['category_id']; ?>"> <?php echo $category_3['name']; ?></option>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
</select>
</div>
Found these snippets of code by another developer
if (isset($this->request->post['genre'])) {
$data['genre'] = $this->request->post['genre'];
} elseif (!empty($product_info)) {
$data['genre'] = $product_info['genre'];
} else {
$data['genre'] = '';
}
if (!isset($this->request->post['genre']) || $this->request->post['genre'] == '') {
$this->error['genre'] = $this->language->get('error_genre');
}
$data['entry_country_of_origin'] = $this->language->get('entry_country_of_origin');
$data['entry_release_date'] = $this->language->get('entry_release_date');
$data['entry_grading'] = $this->language->get('entry_grading');
$data['entry_genre'] = $this->language->get('entry_genre');
$this->load->model('localisation/country');
$data['countries'] = $this->model_localisation_country->getCountries();
$data['pdt_grading'] = $this->model_catalog_product->getGrading();
$data['genres'] = $this->model_catalog_product->getGenre();
$this->db->query("UPDATE " . DB_PREFIX . "product SET country_of_origin = '" . $data['country_of_origin'] . "', release_date = '" . $data['release_date'] . "',grading = '" . $data['grading'] . "' ,genre = '" . $data['genre'] . "' WHERE product_id = '" . (int)$product_id . "'");
public function getGenre() {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "genre ORDER BY id ASC");
return $query->rows;
}
$this->db->query("UPDATE " . DB_PREFIX . "product SET country_of_origin = '" . $data['country_of_origin'] . "', release_date = '" . $data['release_date'] . "',grading = '" . $data['grading'] . "' ,genre = '" . $data['genre'] . "' WHERE product_id = '" . (int)$product_id . "'");
like this
… index.php?route=product%2Fsearch&search=Hard%20Day&genre=3
So at some point, the search script must generate a title for the view to use. You’ll have to find where that is if you want to modify the behavior.
So at some point, the search script must generate a title for the view to use. You’ll have to find where that is if you want to modify the behavior.
Going to throw a needle in a haystack as that would be a lot easier to find
Has to have something to do with this
<h1 class="heading-title"><?php echo $heading_title; ?></h1>
or this
<div class="col-sm-4">
<input type="text" name="search" value="<?php echo $search; ?>" placeholder="<?php echo $text_keyword; ?>" id="input-search" class="form-control" />
</div>
If only I knew where $heading_title and $search was getting pulled from
This was in the controller folder
if (isset($this->request->get['search'])) {
$search = $this->request->get['search'];
} else {
$search = '';
}
if (isset($this->request->get['genre']) && $this->request->get['genre']!='') {
$genre = $this->request->get['genre'];
$data['genre_name'] = $this->model_catalog_product->getGenreNameByid($genre);
} else {
$genre = '';
}
if (isset($this->request->get['genre_id'])) {
$genre_id = $this->request->get['genre_id'];
} else {
$genre_id = '';
}
if (isset($this->request->get['search'])) {
$this->document->setTitle($this->language->get('heading_title') . ' - ' . $this->request->get['search']);
} elseif (isset($this->request->get['tag'])) {
$this->document->setTitle($this->language->get('heading_title') . ' - ' . $this->language->get('heading_tag') . $this->request->get['tag']);
} else {
$this->document->setTitle($this->language->get('heading_title'));
}
I give up guys
Thanks for your help anyways
I would say this is your culprit right there, actually…
I think you’re right Star Lion
Don’t know if there is a way to leave the code but put a condition in saying if $genre is available replace $search or $heading_title with a column in mysql $genre called name
Anyways, check this out http://dev.plasticpassion.com.au/index.php?route=product/search&search=60's%20Pop&genre=3
Still missing 1 result
“All You Need Is Love/Baby You’re A Rich Man”
but definitely getting closer
What I think is happenning is there is a TAG in the other 2 products called “60’s Pop” where as the missing product does not have a TAG.
What the previous developer has done is hard code a new field in Opencart called “Genre” the search function ignores this value but can see the product tags.
system
Closed
October 4, 2015, 7:04am
15
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.