Hallo Leute,
ich habe endlich die Lösung gefunden.
Ist zwar nicht die tollste, aber es funktioniert
So habe ich jetzt die Möglichkeit geschaffen, das in der Produktauflistung
ein Dropdown angezeigt wird, das die verschiedenen Schuhgrößen der
Produkte auslistet und damit dann die Artikelauflistung gefiltert werden kann.
[B]Zu sehen unter:[/B] http://www.shoes-berlin.de
[B]Folgende Änderung sind dafür nötig:[/B]
[B]1.)[/B]
/out/basic/list.tpl
( unter ‘<div id=“content”>’ )
[{if $oView->getGenSizeList()}]
<div>
<form action="[{ $oViewConf->getSelfLink() }]" method="get">
<label for="size">Suche nach Verfügbarkeit:</label>
<select name="size" id="size">
<option value="">bitte auswählen ...</option>
[{foreach from=$oView->getGenSizeList() item=sl name=test_sizeList}]
<option value="[{$sl}]" [{if $sl==$oView->getParamSize()}]selected="selected"[{/if}]>Größe [{$sl}]</option>
[{/foreach}]
</select>
<input type="hidden" name="cl" value="[{ $oViewConf->getActiveClassName() }]" />
<input type="hidden" name="cnid" value="[{ $oView->getParamCnid() }]" />
<input type="submit" value="Suchen" />
</form>
</div>
[{/if}]
[B]2.)[/B]
/view/alist.php
( ganz unter unter “function getActiveCategory()” )
function getGenSizeList() {
$sArticleTable = getViewName( 'oxarticles' );
$list = array();
$cnid = $this->getParamCnid();
$sO2CView = getViewName( 'oxobject2category' );
$sSearch = array("ist lieferbar", "st lieferbar", "ist verfügbar", "die Größe", "Größe", "die");
$sReplace = array("","","","","","");
$sSql = "SELECT
oxart.oxvarselect as oxvarselect
FROM $sO2CView as oc
LEFT JOIN $sArticleTable as art ON ( art.oxid = oc.oxobjectid )
LEFT JOIN $sArticleTable as oxart ON ( oxart.oxparentid = art.oxid )
WHERE
oc.oxcatnid = '". $cnid ."' and
art.oxparentid = '' and
oxart.oxparentid != '' and
oxart.oxvarselect != '' and
oxart.oxactive = 1 and
oxart.oxstock > 0
GROUP by oxart.oxid
ORDER by oxart.oxvarselect ASC
";
//echo $sSql;
$rs = oxDb::getDb(true)->execute( $sSql);
if( $rs != false && $rs->recordCount() > 0 ) {
while (!$rs->EOF) {
$nr = trim(str_replace($sSearch, $sReplace, $rs->fields['oxvarselect']));
if( !in_array($nr, $list) ) {
$list[] = $nr;
}
$rs->moveNext();
}
}
asort($list);
return $list;
}
function getParamCnid() {
if ( ( $sVar = oxConfig::getParameter( 'cnid' ) ) ) {
return rawurlencode( rawurldecode( $sVar ) );
}
}
function getParamSize() {
if ( ( $sVar = oxConfig::getParameter( 'size' ) ) ) {
return str_replace("%2C", ",", rawurlencode( rawurldecode( $sVar ) ));
}
}
[B]3.)[/B]
/core/oxarticlelist.php
( in der “function _getCategorySelect(” )
( unter “filtering ?” )
// ----------------------------------
// variante ?
$sArtVariante = '';
$getArtVartiantFilter = $this->_getArtVariantFilter();
if( !empty($getArtVartiantFilter) ) {
$sArtVariante .= " and artvar.oxvarselect LIKE '%". $getArtVartiantFilter ."%'";
$sArtVariante .= " and artvar.oxactive = 1";
$sArtVariante .= " and artvar.oxstock > 0";
}
/*
$sSelect = "SELECT $sFields FROM $sO2CView as oc left join $sArticleTable
ON $sArticleTable.oxid = oc.oxobjectid
WHERE ".$this->getBaseObject()->getSqlActiveSnippet()." and $sArticleTable.oxparentid = ''
and oc.oxcatnid = '$sCatId' $sFilterSql GROUP BY oc.oxcatnid, oc.oxobjectid ORDER BY $sSorting oc.oxpos, oc.oxobjectid ";
*/
$stringSearch = $sArticleTable.".";
$stringReplace = "oxart.";
$extraSQL = str_replace($stringSearch, $stringReplace, $this->getBaseObject()->getSqlActiveSnippet() );
$sFields = str_replace($stringSearch, $stringReplace, $sFields);
$sFilterSql = str_replace($stringSearch, $stringReplace, $sFilterSql);
$sSorting = str_replace($stringSearch, $stringReplace, $sSorting);
$sSelect = "SELECT
$sFields
FROM $sO2CView as oc
left join $sArticleTable as oxart ON ( oxart.oxid = oc.oxobjectid )
left join oxarticles as artvar ON ( artvar.oxparentid = oc.oxobjectid )
WHERE
". $extraSQL ." and
oxart.oxparentid = '' and
oc.oxcatnid = '". $sCatId ."'
$sFilterSql
$sArtVariante
GROUP BY oc.oxcatnid, oc.oxobjectid
ORDER BY $sSorting oc.oxpos, oc.oxobjectid ";
[B]4.) ( NUR BEI ÄLTEREN OXID VERSIONEN NÖTIG )[/B]
/core/axarticle.php
( in der “function getSqlActiveSnippet(” )
( unter “// enabled time range check ?” )
//do not check for variants
/*
if ( $myConfig->getConfigParam( 'blUseStock' ) ) {
$sQ = " $sQ and ( $sTable.oxstockflag != 2 or ( $sTable.oxstock + $sTable.oxvarstock ) > 0 ) ";
//V #M513: When Parent article is not purchaseble, it's visibility should be displayed in shop only if any of Variants is available.
if ( !$myConfig->getConfigParam( 'blVariantParentBuyable' ) ) {
$sQ = " $sQ and ( $sTable.oxvarcount=0 or ( select count(art.oxid) from $sTable as art where art.oxstockflag=2 and art.oxparentid=$sTable.oxid and art.oxstock=0 ) < $sTable.oxvarcount ) ";
}
}
*/
if ( $myConfig->getConfigParam( 'blUseStock' ) ) {
$sQ = " $sQ and ( $sTable.oxstockflag != 2 or ( $sTable.oxstock + $sTable.oxvarstock ) > 0 ) ";
//V #M513: When Parent article is not purchaseble, it's visibility should be displayed in shop only if any of Variants is available.
if ( !$myConfig->getConfigParam( 'blVariantParentBuyable' ) ) {
$sTimeCheckQ = '';
if ( $myConfig->getConfigParam( 'blUseTimeCheck' ) ) {
$sDate = date( 'Y-m-d H:i:s', oxUtilsDate::getInstance()->getTime() );
$sTimeCheckQ = " or ( art.oxactivefrom < '$sDate' and art.oxactiveto > '$sDate' )";
}
$sQ = " $sQ and IF( $sTable.oxvarcount = 0, 1, ( select 1 from $sTable as art where art.oxparentid=$sTable.oxid and ( art.oxactive = 1 $sTimeCheckQ ) and ( art.oxstockflag != 2 or art.oxstock > 0 ) limit 1 ) ) ";
}
}
mfg & have fun,
Sebastian