i'm trying to make a simple plugin, after method, as simple as that :

 class Plugin {
    public function afterAddUrlRewrite(\Magento\Catalog\Model\ResourceModel\Collection\AbstractCollection $subject, $result)
    foreach ($result as $item) {

   return $result;

But this doesn't work !! the dump are returing the right values but something else is getting wrong. I'm getting 'Illegal state' in my log and no more info. Is there a way to loop over $result object ?

  • post di.xml also – Pradeep Kumar Dec 30 '15 at 3:48
  • Here is di.xml <config> <type name="Magento\Catalog\Model\ResourceModel\Product\Collection"> <plugin name="net_gasoline_unique_url" type="Netgasoline\Uniqueurls\Model\Source\Plugin" sortOrder="10" disabled="false"/> </type> </config> – Gerome Fresse Dec 30 '15 at 10:36

It seems just impossible to plug on this function, that's it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.