Problem mit view Tabelle

Hallo,

ich bekomme folgende Meldung:
Unknown column ‘oxv_oxarticles_1_de.OXID’ in ‘field list’

tmp Verzeichnis hab ich geleert, views neu aufgebaut. Beides mehrmals. Was kann das noch sein?

Liebe Grüße
Ralf

Gibt es nicht. oxv_oxarticles_de.OXID wäre korrekt. Modul oder hast selbst was geschrieben?

Korrigiert. Falsch gelöscht LOL.

Stimmt. Normalerweise: oxv_oxarticles_de.OXID

Welche Version benutzt Du und bei welchem Aufruf kommt diese Fehlermeldung?

Also ich seh die Tabelle so auch in der DB und ist die Rückgabe von ->getViewName()

Die 1 steht dabei ja für den Shop in der EE und de für die Sprache. Das sollte so schon passen

Das ist eine EE 6.4. Ich bau eine SQL Abfrage auf:

$query = $this->getQueryBuilder()
            ->select($selectFields)
            ->from($this->articleTable, 'a')
            ->innerJoin('a', 'oxorderarticles', 'oa', 'a.oxid = oa.oxartid')
            ->innerJoin('oa', 'oxorder', 'o', 'oa.oxorderid = o.oxid')
            ->where('o.oxuserid = :user_id')
            ->andWhere($this->articleObject->getSqlActiveSnippet());

Ich würde mir mal den generierten Query ausgeben lassen

Jup, ist der hier:

SELECT `oxv_oxarticles_1_de`.`oxid`, `oxv_oxarticles_1_de`.`oxmapid`, `oxv_oxarticles_1_de`.`oxshopid`, `oxv_oxarticles_1_de`.`oxparentid`, `oxv_oxarticles_1_de`.`oxactive`, `oxv_oxarticles_1_de`.`oxhidden`, `oxv_oxarticles_1_de`.`oxactivefrom`, `oxv_oxarticles_1_de`.`oxactiveto`, `oxv_oxarticles_1_de`.`oxartnum`, `oxv_oxarticles_1_de`.`oxean`, `oxv_oxarticles_1_de`.`oxdistean`, `oxv_oxarticles_1_de`.`oxmpn`, `oxv_oxarticles_1_de`.`oxtitle`, `oxv_oxarticles_1_de`.`oxshortdesc`, `oxv_oxarticles_1_de`.`oxprice`, `oxv_oxarticles_1_de`.`oxblfixedprice`, `oxv_oxarticles_1_de`.`oxpricea`, `oxv_oxarticles_1_de`.`oxpriceb`, `oxv_oxarticles_1_de`.`oxpricec`, `oxv_oxarticles_1_de`.`oxbprice`, `oxv_oxarticles_1_de`.`oxtprice`, `oxv_oxarticles_1_de`.`oxunitname`, `oxv_oxarticles_1_de`.`oxunitquantity`, `oxv_oxarticles_1_de`.`oxexturl`, `oxv_oxarticles_1_de`.`oxurldesc`, `oxv_oxarticles_1_de`.`oxurlimg`, `oxv_oxarticles_1_de`.`oxvat`, `oxv_oxarticles_1_de`.`oxthumb`, `oxv_oxarticles_1_de`.`oxicon`, `oxv_oxarticles_1_de`.`oxpic1`, `oxv_oxarticles_1_de`.`oxpic2`, `oxv_oxarticles_1_de`.`oxpic3`, `oxv_oxarticles_1_de`.`oxpic4`, `oxv_oxarticles_1_de`.`oxpic5`, `oxv_oxarticles_1_de`.`oxpic6`, `oxv_oxarticles_1_de`.`oxpic7`, `oxv_oxarticles_1_de`.`oxpic8`, `oxv_oxarticles_1_de`.`oxpic9`, `oxv_oxarticles_1_de`.`oxpic10`, `oxv_oxarticles_1_de`.`oxpic11`, `oxv_oxarticles_1_de`.`oxpic12`, `oxv_oxarticles_1_de`.`external_pic1`, `oxv_oxarticles_1_de`.`external_pic2`, `oxv_oxarticles_1_de`.`external_pic3`, `oxv_oxarticles_1_de`.`external_pic4`, `oxv_oxarticles_1_de`.`external_pic5`, `oxv_oxarticles_1_de`.`external_pic6`, `oxv_oxarticles_1_de`.`external_pic7`, `oxv_oxarticles_1_de`.`external_pic8`, `oxv_oxarticles_1_de`.`external_pic9`, `oxv_oxarticles_1_de`.`oxweight`, `oxv_oxarticles_1_de`.`oxstock`, `oxv_oxarticles_1_de`.`oxstockflag`, `oxv_oxarticles_1_de`.`oxstocktext`, `oxv_oxarticles_1_de`.`oxnostocktext`, `oxv_oxarticles_1_de`.`oxdelivery`, `oxv_oxarticles_1_de`.`oxinsert`, `oxv_oxarticles_1_de`.`oxtimestamp`, `oxv_oxarticles_1_de`.`oxlength`, `oxv_oxarticles_1_de`.`oxwidth`, `oxv_oxarticles_1_de`.`oxheight`, `oxv_oxarticles_1_de`.`oxfile`, `oxv_oxarticles_1_de`.`oxsearchkeys`, `oxv_oxarticles_1_de`.`oxtemplate`, `oxv_oxarticles_1_de`.`oxquestionemail`, `oxv_oxarticles_1_de`.`oxissearch`, `oxv_oxarticles_1_de`.`oxisconfigurable`, `oxv_oxarticles_1_de`.`oxvarname`, `oxv_oxarticles_1_de`.`oxvarstock`, `oxv_oxarticles_1_de`.`oxvarcount`, `oxv_oxarticles_1_de`.`oxvarselect`, `oxv_oxarticles_1_de`.`oxvarminprice`, `oxv_oxarticles_1_de`.`oxvarmaxprice`, `oxv_oxarticles_1_de`.`oxbundleid`, `oxv_oxarticles_1_de`.`oxfolder`, `oxv_oxarticles_1_de`.`oxsubclass`, `oxv_oxarticles_1_de`.`oxsort`, `oxv_oxarticles_1_de`.`oxsoldamount`, `oxv_oxarticles_1_de`.`oxnonmaterial`, `oxv_oxarticles_1_de`.`oxfreeshipping`, `oxv_oxarticles_1_de`.`oxremindactive`, `oxv_oxarticles_1_de`.`oxremindamount`, `oxv_oxarticles_1_de`.`oxamitemid`, `oxv_oxarticles_1_de`.`oxamtaskid`, `oxv_oxarticles_1_de`.`oxvendorid`, `oxv_oxarticles_1_de`.`oxmanufacturerid`, `oxv_oxarticles_1_de`.`oxskipdiscounts`, `oxv_oxarticles_1_de`.`oxorderinfo`, `oxv_oxarticles_1_de`.`oxpixiexport`, `oxv_oxarticles_1_de`.`oxpixiexported`, `oxv_oxarticles_1_de`.`oxvpe`, `oxv_oxarticles_1_de`.`esy_minqty`, `oxv_oxarticles_1_de`.`oxrating`, `oxv_oxarticles_1_de`.`oxratingcnt`, `oxv_oxarticles_1_de`.`oxmindeltime`, `oxv_oxarticles_1_de`.`oxmaxdeltime`, `oxv_oxarticles_1_de`.`oxdeltimeunit`, `oxv_oxarticles_1_de`.`oxupdateprice`, `oxv_oxarticles_1_de`.`oxupdatepricea`, `oxv_oxarticles_1_de`.`oxupdatepriceb`, `oxv_oxarticles_1_de`.`oxupdatepricec`, `oxv_oxarticles_1_de`.`oxupdatepricetime`, `oxv_oxarticles_1_de`.`oxisdownloadable`, `oxv_oxarticles_1_de`.`oxshowcustomagreement`, `oxv_oxarticles_1_de`.`zeg_upscalable`, `oxv_oxarticles_1_de`.`zeg_slmserviceratetype`, `oxv_oxarticles_1_de`.`zeg_unitid`, `oxv_oxarticles_1_de`.`esy_itemgrouptype`, `oxv_oxarticles_1_de`.`esy_multilinedisc`, `oxv_oxarticles_1_de`.`esy_enddisc`, `oxv_oxarticles_1_de`.`esy_linedisc`, `oxv_oxarticles_1_de`.`esy_modelgroupid`, `oxv_oxarticles_1_de`.`esy_priceunit`, `oxv_oxarticles_1_de`.`zeg_epc_allowdeviationfrommultipleqty`, `oxv_oxarticles_1_de`.`zeg_subsubitemgroupid`, `oxv_oxarticles_1_de`.`esy_lieferumfang`, `oxv_oxarticles_1_de`.`zeg_shortitemid`, `oxv_oxarticles_1_de`.`zeg_inventstatusid`, `oxv_oxarticles_1_de`.`zeg_externanlitemid`, `oxv_oxarticles_1_de`.`zeg_ham`, `oxv_oxarticles_1_de`.`nfc_pimcore_modificationdate`, `oxv_oxarticles_1_de`.`nfc_pimcore_id`, `oxv_oxarticles_1_de`.`zeg_assortment_id`, `oxv_oxarticles_1_de`.`showarticletext`, max(oa.oxtimestamp) AS date, a.oxtitle AS title FROM oxv_oxarticles_1_de a INNER JOIN oxorderarticles oa ON a.oxid = oa.oxartid INNER JOIN oxorder o ON oa.oxorderid = o.oxid WHERE (o.oxuserid = '3e83309157dc7c96fad347d198b27773') AND (( oxv_oxarticles_1_de.oxactive = 1 and oxv_oxarticles_1_de.oxhidden = 0 and ( ( ( select oxobjectrights.oxobjectid from oxobjectrights where oxobjectrights.oxobjectid = oxv_oxarticles_1_de.oxid and oxobjectrights.oxaction = 1 limit 1 ) is null ) or (( select oxobjectrights.oxobjectid from oxobjectrights where oxobjectrights.oxobjectid = oxv_oxarticles_1_de.oxid and oxobjectrights.oxaction = 1 and ( oxobjectrights.oxgroupidx & 524800 and oxobjectrights.oxoffset = 0 ) limit 1 ) is not null ) ) ) ) GROUP BY oa.oxartid ORDER BY date desc LIMIT 10

Im DB Tool kommt der gleiche Fehler, obwohl ich die Tabelle sehe…

Korrektur. Neue EE Version angeschaut. War Unsinn.

müste es nicht
SELECT a.oxid, a.oxmapid, … lauten?

Das hab ich auch schon gedacht, aber das kommt aus OXID so, und ich setze ja den Alias

Existiert den Deine View Tabelle auf die Du zugreifen möchtest überhaupt?

aber deine
$selectFields
wissen beim erstellen nicht das du ->from($this->articleTable, ‘a’) nutzen möchtest.

Das kann man auch nirgends setzen oder?

mach da einfach mal ein replace drauf um zu sehen ob es dann ginge.
ich vermute aber auch es wird grundsätzlich nicht anders gehen

Da wird es schon gehen, aber bei dem was OXID hintendran noch baut wahrscheinlich nicht, also diese sub selects und so, was durch getSqlActiveSnippet() gebaut wird. Das Problem ist aber, das ein inner join einen alias will…

Ich sehe es auf deinem weg nicht lösbar, also alles über replace oder den sql selbst aufbauen

Ja, kann ich mich anschließen. Im Prinzip entsteht hier ein Mix von “alten” und “neuen” Code.

Query Builder wäre der neue Code und getSqlActiveSnippet() Methode der alte Code.

Ein Blick in die Dokumentation lohnt dort auch immer Interacting with the database — OXID eShop developer documentation 6.4.0 documentation

Leider verwendet OXID eSales selber den Query Builder noch sehr selten.

Gibt es eine neue funktion für getSqlActiveSnippet()? Das man das nicht mischen muss?

Nicht das ich wüsste. Würde wahrscheinlich die Where Bedingung in neue Query Builder Syntax übertragen.

Vorab könntest als EE Nutzer beim offiziellen Support nachfragen oder Dir den 2. Release Candidate für den 7er Shop angucken ob dort bereits getSqlActiveSnippet() entsprechend ersetzt wurde.

Update: Auch in 7er Shop ist der alte Code noch drin https://github.com/OXID-eSales/oxideshop_ce/blob/v7.0.0-rc.2/source/Application/Model/ArticleList.php#L217 der Query Builder wird noch nicht konsequent genutzt.

Kaka :smiley:

Also ich hab das jetzt mal replaced und bekomme jetzt die Meldung:
The given alias ‘oa’ is not unique in FROM and JOIN clause table. The currently registered aliases are: a, oa.

Kannst du damit was anfangen?