EmicoEcommerce / Magento2TweakwiseExport-archived

Magento 2 module for Tweakwise export
Other
6 stars 16 forks source link

Adding created at and update at to export #92

Closed maxserv-woostelbos closed 4 years ago

maxserv-woostelbos commented 4 years ago

Issue Brief

Hi,

Is it possible to add the 'created at' and 'updated at' values of a product to the tweakwise export module?

Thanks in advance.

edwinljacobs commented 4 years ago

Hi,

You can do that by preferencing or use an after plugin on src/Model/Write/Products/IteratorInitializer.php method initializeAttributes

/**
     * Select all attributes who should be exported
     *
     * @param EavIterator $iterator
     */
    public function initializeAttributes(EavIterator $iterator)
    {
        // Add default attributes
        $iterator->selectAttribute('name');
        $iterator->selectAttribute('sku');
        $iterator->selectAttribute('url_key');
        $iterator->selectAttribute('status');
        $iterator->selectAttribute('visibility');
        $iterator->selectAttribute('type_id');

        foreach ($this->productAttributes->getAttributesToExport() as $attribute) {
            $iterator->selectAttribute($attribute->getAttributeCode());
        }
    }

If you add

$iterator->selectAttribute('created_at');
$iterator->selectAttribute('updated_at');

then these attributes will be present in the feed

We will not support that globally as it is only relevant (so far as we know) for your case.

With kind regards