suche nach eigenen Felder und Anzeige

18.01.2016 23:18
#1
tomhalder1959
Joomshopping forum user no avatar
Name: tomhalder1959
17.01.2011
Posts: 4
Quote
suche nach eigenen Felder und Anzeige

Hallo zusammen,
ich habe in der Datenbank weitere Felder für die Produkte angelegt. Jetzt möchte ich auch mit der Suche gezielt nach diesen Feldern suchen, also nicht nur Freitext oder dat from etc, sonder nach eigenen Felder. wo muss ich Änderungen in den PHP Dateien vornehmen, damit daus auch richtig gesucht wird. In der Version unter Joomla 1.5 habe ich das in result.php realisiert, aber die gibt es im neue shop nicht mehr


Joomla: joomal 4.3
JoomShopping: 4
PHP: http://test.antiquariat-birk.de/index.php
 
19.01.2016 07:53
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25922
Quote
Aw: suche nach eigenen Felder und Anzeige

lib/default_config.php

$config->product_search_fields = array(
'prod.ml:name',
'prod.ml:short_description',
'prod.ml:description',
'prod.product_ean'
);

 
19.01.2016 13:21
#3
tomhalder1959
Joomshopping forum user no avatar
Name: tomhalder1959
17.01.2011
Posts: 4
Quote
Aw: suche nach eigenen Felder und Anzeige

OK Danke. Jetzt würde mich aber noch interessieren, wo die Suche stattfindet. Wenn in einem Feld ein Suchwert drinsteht, z.B. Verlag: Reclam, dann sollen alle Produkte angezeigt werden, deren Eintrag im Feld Verlag Reclam haben. LG

 
24.01.2016 22:21
#4
tomhalder1959
Joomshopping forum user no avatar
Name: tomhalder1959
17.01.2011
Posts: 4
Quote
Aw: suche nach eigenen Felder und Anzeige

Gibt es hierzu keine Lösung ?
In joomshooping unter Joomla 1.5 habe ich das selber realisieren können, aber im neuen shop durchschaue ich die such und Ergebnisfolge nicht ganz. Kann mir jemand sagen, welche models, controllers und templates hier angezogen werden. Ich möchte schlicht und einfach ein Ergebnis der Suche erhalten, wenn in der Suchanfrage ein bestimmtes Feld mit einem wert versehn ist. Ähnlich wie die Suche nach price from.
Liebe Grüße
thomas
Aw: suche nach eigenen Felder und Anzeige

 
25.01.2016 07:47
#5
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 25922
Quote
Aw: suche nach eigenen Felder und Anzeige

model / search

function buildAdvQuery

 
25.01.2016 23:00
#6
tomhalder1959
Joomshopping forum user no avatar
Name: tomhalder1959
17.01.2011
Posts: 4
Quote
Aw: suche nach eigenen Felder und Anzeige

<?php
/**
* @version 4.11.0 18.12.2014
* @author MAXXmarketing GmbH
* @package Jshopping
* @copyright Copyright (C) 2010 webdesigner-profi.de. All rights reserved.
* @license GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
Echo "search"
class jshopSearch{

private $search = '';
private $filters = array();
private $date_to;
private $date_from;
private $search_type;
private $order;
private $orderby;
private $adv_query;
private $adv_from;
private $adv_result;
private $order_query;
private $buildAdvQuery;
private $Jahr;


public function setSearch($val){
$this->search = $val;
}

public function setFilters($val){
$this->filters = $val;
}

public function setDateTo($val){
$this->date_to = $val;
}
public function setJahr($val){
$this->Jahr = $val;
}

public function setDateFrom($val){
$this->date_from = $val;
}

public function setSearchType($val){
$this->search_type = $val;
}

public function setOrder($val){
$this->order = $val;
}

public function setOrderby($val){
$this->orderby = $val;
}

public function getTotal(){
$db = JFactory::getDBO();
$this->buildAdvQuery();

$query = "SELECT count(distinct prod.product_id) FROM `#__jshopping_products` AS prod
LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id
LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id
".$this->adv_from."
WHERE prod.product_publish = '1' AND cat.category_publish='1'
".$this->adv_query;
$db->setQuery($query);
return $db->loadResult();
}

public function getProducts($limitstart = null, $limit = null){
$db = JFactory::getDBO();
$this->buildAdvQuery();

$query = "SELECT ".$this->adv_result." FROM `#__jshopping_products` AS prod
LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id
LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id
".$this->adv_from."
WHERE prod.product_publish = '1' AND cat.category_publish='1'
".$this->adv_query."
GROUP BY prod.product_id ".$this->order_query;
$db->setQuery($query, $limitstart, $limit);
$rows = $db->loadObjectList();
$rows = listProductUpdateData($rows);
addLinkToProducts($rows, 0, 1);
return $rows;
}

private function buildAdvQuery(){
if ($this->buildAdvQuery==1) return 0;
$jshopConfig = JSFactory::getConfig();
$dispatcher = JDispatcher::getInstance();
$db = JFactory::getDBO();
$product = JSFactory::getTable('product', 'jshop');
$orderbyq = getQuerySortDirection($this->order, $this->orderby);
$adv_query = "";
$adv_from = "";

$adv_result = $product->getBuildQueryListProductDefaultResult();
$product->getBuildQueryListProduct("search", "list", $this->filters, $adv_query, $adv_from, $adv_result;);

if ($this->date_to && checkMyDate($this->date_to)) {
$adv_query .= " AND prod.product_date_added <= '".$db->escape($this->date_to)."'";
}
if ($this->date_from && checkMyDate($this->date_from)) {
$adv_query .= " AND prod.product_date_added >= '".$db->escape($this->date_from)."'";
if ($this->$Jahr )) {
$adv_query .= " AND prod.product_Jahr =$Jahr '".$db->escape($this->Jahr)."'";
}

$where_search = "";
if ($this->search_type=="exact"){
$word = addcslashes($db->escape($this->search), "_%");
$tmp = array();
foreach($jshopConfig->product_search_fields as $field){
$tmp[] = "LOWER(".getDBFieldNameFromConfig($field).") LIKE '%".$word."%'";
}
$where_search = implode(' OR ', $tmp);
}else{
$words = explode(" ", $this->search);
$search_word = array();
foreach($words as $word){
$word = addcslashes($db->escape($word), "_%");
$tmp = array();
foreach($jshopConfig->product_search_fields as $field){
$tmp[] = "LOWER(".getDBFieldNameFromConfig($field).") LIKE '%".$word."%'";
}
$where_search_block = implode(' OR ', $tmp);
$search_word[] = "(".$where_search_block.")";
}
if ($this->search_type=="any"){
$where_search = implode(" OR ", $search_word);
}else{
$where_search = implode(" AND ", $search_word);
}
}
if ($where_search){
$adv_query .= " AND ($where_search)";
}

$orderbyf = $jshopConfig->sorting_products_field_s_select[$this->order];
$order_query = $product->getBuildQueryOrderListProduct($orderbyf, $orderbyq, $adv_from);

$dispatcher->trigger('onBeforeQueryGetProductList', array("search", &$adv_result, &$adv_from, &$adv_query, &$order_query, &$this->filters) );

$this->adv_result = $adv_result;
$this->adv_from = $adv_from;
$this->adv_query = $adv_query;
$this->order_query = $order_query;

$this->buildAdvQuery==1;
return 1;
}

}


Ist das so korrekt, ich bekomme nach der Suche immer alle Produkte angezeigt !

Hier noch die Form.PHP

<script type="text/javascript">var liveurl = '<?php print JURI::root()?>';</script>
<div class="jshop">
<h1><?php print _JSHOP_SEARCH ?></h1>
<h3>Suchen Sie mit dem Suchformular
oder treffen Sie eine Vorauswahl ueber die Kategorie.</h3>

<form action = "<?php print JURI::base()?>index.php" name = "form_ad_search" method = "get" onsubmit = "return validateFormAdvancedSearch('form_ad_search')">
<input type = "hidden" name = "option" value = "com_jshopping" />
<input type = "hidden" name = "controller" value = "search" />
<input type = "hidden" name = "task" value = "result" />
<input type = "hidden" name = "Itemid" value = "<?php print $this->Itemid ?>" />



<table class = "jshop" cellpadding = "6" cellspacing="0">
<TABLE BGCOLOR="#BBCCD1" WIDTH="525" BORDER="0" CELLPADDING="6" CELLSPACING="0" BGCOLOR="#ECE8D1">

<tr>
<td width="120">
<?php print _JSHOP_SEARCH_TEXT?>
</td>
<td>
<input type = "text" name = "search" class = "inputbox" style = "width:300px" />
</td>
<tr>
<td>
<?php print "Verfasser" ?>
</td>
<td>
<input type = "text" class = "inputbox" name = "Verfasser" id = "Verfasser" />
</td>
</tr>
<tr>
<td>
<?php print Titel?>
</td>
<td>
<input type = "text" name = "Titel" id = "Titel" class = "inputbox" style = "width:300px" />
</td>
<tr>
<td>
<?php print _JSHOP_SEARCH_VERLAG ?>
</td>
<td>
<input type = "text" class = "inputbox" name = "Verlag" id = "Verlag" />
</td>
</tr>
<tr>
<td>
<?php print "Erscheinungsjahr" ?>
<td>
<input type = "text" class = "inputbox" name = "Jahr" id = "Jahr" />
</td>
<tr>
</tr>
<tr>
<td>
<?php print _JSHOP_SEARCH_CATEGORIES ?>
</td>
<td>
<?php print $this->list_categories ?><br />
<input type = "checkbox" name = "include_subcat" id = "include_subcat" value = "1" />
<label for = "include_subcat"><?php print _JSHOP_SEARCH_INCLUDE_SUBCAT ?></label>
</td>
</tr>
<tr>
<td>
<?php /*print _JSHOP_SEARCH_MANUFACTURERS */?>
</td>
<td>
<?php /* print $this->list_manufacturers */ ?>
</td>










<td colspan="2" id="list_characteristics"><?php print $this->characteristics?></td>
</tr>

</table>

<div style="padding:6px;">
<input type = "submit" class="button" value = "<?php print _JSHOP_SEARCH ?> " />
</div>
</form>
</div>

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.