how can i extend engine/shopware/core/sExport.php in my plugin?

I have an additional field attr21 in table s_articles_attributes.

In order to export it, i need to add this field to sCreateSql() function inside engine/shopware/core/sExport.php as follows

              $sql=" …

                d.weight,
                d.position,

                at.attr1, at.attr2, at.attr3, at.attr4, at.attr5, at.attr6, at.attr7, at.attr8, at.attr9, at.attr10,
                at.attr11, at.attr12, at.attr13, at.attr14, at.attr15, at.attr16, at.attr17, at.attr18, at.attr19, at.attr20, at.attr21,

                s.name as supplier,
                u.unit

                …";

But the problem is i cant add it directly over here, so I need to extend sExport.php class and add attr21 through my plugin?

how can i extend sExport.php?

Inside Install use after hook.

Than something like

public function afterCoreExportCreateSql(Enlight_Hook_HookArgs $args){
$sql = $args->getReturn();

//modify $sql

$args->setReturn($sql);
}

 

1 „Gefällt mir“

Thanks alot Steinsoftware,

just one more thing that against which event should i register afterCoreExportCreateSql that is:

private function registerEvents()
{
        $this->subscribeEvent(
            ‘???’,
            ’ afterCoreExportCreateSql ’
        );

.

.

.}

use an after hook

‚sExport::sCreateSql::after‘

1 „Gefällt mir“

wow great! thanks a ton Thumb-Up