0
votes

I want to get some data which are loaded to backend. I have to convert some values and I would rather do it in php part than in extjs.

I know I can hook in shopware's action like this:

...
    'Shopware_Controllers_Backend_EtsyPrepare::delete::before' => 'onBeforeDelete',
...

    public function onBeforeDelete(\Enlight_Event_EventArgs $args)
        {
            /** @var \Shopware_Controllers_Backend_Article $subject */
            $subject = $args->getSubject();
            $params = $subject->Request()->getParams();

But I can not find way to get data which are in response. Something like:

            /** @var \Shopware_Controllers_Backend_Article $subject */
            $subject = $args->getSubject();
            $params = $subject->**Response()**->getParams();

That Response object is there but I can not find any data?

Does anybody know how to solve this, or I am wrong?

1

1 Answers

0
votes

Found solution. It is a different hook if you want to catch response!

public function onLoadEtsyPrepareData(\Enlight_Hook_HookArgs $args)
    {
        /** @var \Shopware_Controllers_Backend_Article $subject */
        $subject = $args->getSubject();
        $data = $subject->View()->getAssign('data');

        $data = $this->converter->arrayTinyIntToString($data);
        $data = $this->converter->arrayUnderscoreAndLCToSpaceUCFirst($data);

        $data['price'] = $this->converter->priceToFloat($data['price']);

        $subject->View()->assign(['data' => $data]);
    }