Merkwürdiges Problem mit der "Schnäppchen"-Liste

Da auf der Startseite die “Schnäppchen”-Liste nicht angezeigt wurde, habe ich den Ablauf debugged, und folgendes Problem festgestellt:

Die Abfrage der “Schnäppchen”-Liste wird im Shop mit folgendem SQL ausgeführt:

select 
    oxv_oxarticles_de.oxid 
from 
    oxactions2article
    left join 
        oxv_oxarticles_de on oxv_oxarticles_de.oxid = oxactions2article.oxartid
    left join 
        oxactions on oxactions.oxid = oxactions2article.oxactionid
where 
    oxactions2article.oxshopid = 'oxbaseshop' and
    oxactions2article.oxactionid = 'oxbargain' and
    (   OXV_OXACTIONS_DE.OXACTIVE = 1  or  ( oxv_oxactions_de.oxactivefrom < '2011-10-09 06:10:38' and oxv_oxactions_de.oxactiveto > '2011-10-09 06:10:38' ) ) and
    oxv_oxarticles_de.oxid is not null and
    (  OXV_OXARTICLES_DE.OXACTIVE = 1   and ( oxv_oxarticles_de.oxstockflag != 2 or ( oxv_oxarticles_de.oxstock + oxv_oxarticles_de.oxvarstock ) > 0  )  and
    IF( oxv_oxarticles_de.oxvarcount = 0, 1, ( select 1 from oxv_oxarticles_de as art where art.oxparentid=oxv_oxarticles_de.oxid and ( art.oxactive = 1  ) and ( art.oxstockflag != 2 or art.oxstock > 0 ) limit 1 ) )  ) 
order by 
    oxactions2article.oxsort

Da im Code damit keine Liste entstand, habe ich das SQL mit PHPMyAdmin direkt auf die DB angewendet, und bekam folgende Fehlermeldung:

#1054 - Unknown column ‘oxv_oxactions_de.oxactive’ in ‘where clause’
In der DB-Struktur ist das Feld “oxactive” aber vorhanden!

Weiß im Moment gerade nicht, was das soll…

Fällt dazu vielleicht jemand etwas ein?

Hallo!

die WHERE Klausel sagt quasi in [B]oxv_oxarticles_de[/B] zu suchen, obwohl es gar nicht da ist, da es nicht vom sql join “eingefügt” wurde. Ersetzt man “oxactions” durch “oxv_oxactions_de”, so müsste es funktionieren. Im 2. Schritt hat die Abfrage dnan wegen caps lock gemeckert.

So hat es dann bei mir funktioniert:

select 
    oxv_oxarticles_de.oxid 
from 
    oxactions2article
    left join 
        oxv_oxarticles_de on oxv_oxarticles_de.oxid = oxactions2article.oxartid
    left join 
        oxv_oxactions_de on oxv_oxactions_de.oxid = oxactions2article.oxactionid
where 
    oxactions2article.oxshopid = 'oxbaseshop' and
    oxactions2article.oxactionid = 'oxbargain' and
    ( oxv_oxactions_de.oxactive = 1  or  ( oxv_oxactions_de.oxactivefrom < '2011-10-09 06:10:38' and oxv_oxactions_de.oxactiveto > '2011-10-09 06:10:38' ) ) and
    oxv_oxarticles_de.oxid is not null and
    (  oxv_oxarticles_de.oxactive = 1   and ( oxv_oxarticles_de.oxstockflag != 2 or ( oxv_oxarticles_de.oxstock + oxv_oxarticles_de.oxvarstock ) > 0  )  and
    IF( oxv_oxarticles_de.oxvarcount = 0, 1, ( select 1 from oxv_oxarticles_de as art where art.oxparentid=oxv_oxarticles_de.oxid and ( art.oxactive = 1  ) and ( art.oxstockflag != 2 or art.oxstock > 0 ) limit 1 ) )  ) 
order by 
    oxactions2article.oxsort

Da ich nun wirklich wenig Ahnung von SQL und Views habe, würde ich mich selbst auf meinen Lösungsansatz nicht verlassen. Vielleicht meldet sich ja jemand aus dem developer Team :slight_smile:

Viele Grüße
und einen schönen Sonntag euch noch

[QUOTE=vanilla thunder;70281]Hallo!

die WHERE Klausel sagt quasi in [B]oxv_oxarticles_de[/B] zu suchen, obwohl es gar nicht da ist, da es nicht vom sql join “eingefügt” wurde. Ersetzt man “oxactions” durch “oxv_oxactions_de”, so müsste es funktionieren. Im 2. Schritt hat die Abfrage dnan wegen caps lock gemeckert.

So hat es dann bei mir funktioniert:

select 
    oxv_oxarticles_de.oxid 
from 
    oxactions2article
    left join 
        oxv_oxarticles_de on oxv_oxarticles_de.oxid = oxactions2article.oxartid
    left join 
        oxv_oxactions_de on oxv_oxactions_de.oxid = oxactions2article.oxactionid
where 
    oxactions2article.oxshopid = 'oxbaseshop' and
    oxactions2article.oxactionid = 'oxbargain' and
    ( oxv_oxactions_de.oxactive = 1  or  ( oxv_oxactions_de.oxactivefrom < '2011-10-09 06:10:38' and oxv_oxactions_de.oxactiveto > '2011-10-09 06:10:38' ) ) and
    oxv_oxarticles_de.oxid is not null and
    (  oxv_oxarticles_de.oxactive = 1   and ( oxv_oxarticles_de.oxstockflag != 2 or ( oxv_oxarticles_de.oxstock + oxv_oxarticles_de.oxvarstock ) > 0  )  and
    IF( oxv_oxarticles_de.oxvarcount = 0, 1, ( select 1 from oxv_oxarticles_de as art where art.oxparentid=oxv_oxarticles_de.oxid and ( art.oxactive = 1  ) and ( art.oxstockflag != 2 or art.oxstock > 0 ) limit 1 ) )  ) 
order by 
    oxactions2article.oxsort

Da ich nun wirklich wenig Ahnung von SQL und Views habe, würde ich mich selbst auf meinen Lösungsansatz nicht verlassen. Vielleicht meldet sich ja jemand aus dem developer Team :slight_smile:

Viele Grüße
und einen schönen Sonntag euch noch[/QUOTE]
Das macht doch schon mal sehr viel Sinn, und löst, so weit ich sehen kann, auch das Problem!

Vielen Dank für Deine Mühe.:slight_smile:

Ist das ein grundsätzliches Problem? Trägt das dann jemand in den Bugtracker ein?

[QUOTE=Hebsacker;70324]Ist das ein grundsätzliches Problem? Trägt das dann jemand in den Bugtracker ein?[/QUOTE]
Nein, ist es nicht…

Ich hatte diese Routine in einem Modul überladen, und noch nicht auf die aktuelle Version (mit den Views) aktualisiert.

Der Standard funktioniert…

ach so - ok, danke :slight_smile: