Hi Daniel,

thank you very much for your answer!
The module I'm making will run under version 4.7.x, beacuse these versions
are used a lot.

I've solved the problem yesterday evening in a comparable way for the
attributes:

SELECT a.oxid, a.oxtitle, (
        SELECT count(*)
        FROM $aArtTable ia, $sO2ATable o2a, $sO2CTable o2c
        WHERE ia.oxid = o2a.oxobjectid
                AND ia.oxid = o2c.oxobjectid
                AND o2c.oxcatnid = '{$this->oxcategories__oxid->value}'
                AND o2a.oxattrid = a.oxid
        ) AS oxused
FROM $aCatTable c, $sC2ATable c2a, $aAttTable a
WHERE
        c.oxid = '{$this->oxcategories__oxid->value}'
        AND c.oxid = c2a.oxobjectid
        AND a.oxid = c2a.oxattrid
ORDER BY a.oxtitle

This retrieves the attributes and the info how often the attribute is
used/assigned by/to the articles of this category.


And for  getting the articles of an category:

SELECT a.oxartnum, a.oxtitle
FROM $aArtTable a, $aCatTable c, $sO2CTable o2c
WHERE
        a.oxid = o2c.oxobjectid
        AND c.oxid = o2c.oxcatnid
        AND c.oxid = '{$this->oxcategories__oxid->value}'
        ORDER BY a.oxtitle


I think until the end of the week, the module will be finished and
published on Github.


Cheers

Joachim Barthel



2013/11/21 Daniel Leicht <[email protected]>

> Hi,
>
> a) in Oxid CE 4.8.0 i found the select-query of the getAttributes() resp.
> oxAttributeList::getCategoryArticles() wich is:
>
> SELECT DISTINCT att.oxid, att.oxtitle, o2a.oxvalue ".
>                         "FROM $sAttTbl as att, $sO2ATbl as o2a ,$sC2ATbl as 
> c2a ".
>                         "WHERE att.oxid = o2a.oxattrid AND c2a.oxobjectid = 
> $sActCatQuoted AND c2a.oxattrid = att.oxid AND o2a.oxvalue !='' AND 
> o2a.oxobjectid IN ($sArtIds) ".
>                         "ORDER BY c2a.oxsort , att.oxpos, att.oxtitle, 
> o2a.oxvalue
>
>
> so it doesn’t look like it’s filtered by active or not. Wich Oxid-Version
> do you use?
> Maybe the documentation could help you ->
> http://docu.oxid-esales.com/CE/sourcecodedocumentation/
>
> b) I’m not sure if you want to get the title or the oxid of the attribute
> while using oxtitle__oxid, but you should know, that the
> object-attributes/variables are built like this: {tablename}__{columnname} .
> So if you want to get the oxid, you should use oxattribute__oxid and if
> you want to get the title, oxattribute__oxtitle.
>
> Hope I could help,
> Daniel Leicht
>
> _______________________________________________
> dev-general mailing list
> [email protected]
> http://dir.gmane.org/gmane.comp.php.oxid.general
>
_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general

Reply via email to