magento-2-banner-slider icon indicating copy to clipboard operation
magento-2-banner-slider copied to clipboard

Undefined Offset - AddBlock.php line 88

Open sts-ryan-holton opened this issue 6 years ago • 4 comments

I'm trying to implement my banner slider in Magento 2.2.7 through the CMS as a shortcode. The backend works fine, but I'm getting the following error on the frontend:

1 exception(s):
Exception #0 (Exception): Notice: Undefined offset: 1 in /Applications/MAMP/htdocs/MY-SITE/vendor/mageplaza/module-banner-slider/Observer/AddBlock.php on line 88

Any ideas what I'm missing?

sts-ryan-holton avatar Dec 21 '18 16:12 sts-ryan-holton

They are requiring you pick a location for all your banner sliders, which is dumb if you just want it for a single CMS page.

In that file I added the following lines if (empty($slider->getLocation())) continue; after Line 85: foreach ($this->helperData->getActiveSliders() as $slider) {

Now you don't need to define a location and it'll run like it should.

haxxtick avatar Jan 02 '19 21:01 haxxtick

@haxxtick Thanks, I'll give this a go hopefully within the next few days and provide an update on my findings :)

sts-ryan-holton avatar Jan 03 '19 12:01 sts-ryan-holton

@haxxtick I can confirm that this is working 👍

However, as this is a change that needs to happen within the /vendor directory, outside and driven via composer on my project, have you come up with a solution of making this change permininat and git tracked? Such as copying a file to overwrite in /app/design/ . . . many thanks

sts-ryan-holton avatar Jan 04 '19 14:01 sts-ryan-holton

@sts-ryan-holton I also would like to see fixes for such trivial things like working advanced banner form or slider not having general locations, BUT before that you can just use magento's solution for hotfixes. Meaning that you create hotfix directory inside magento directory and you put there git patches you want to apply after code deployment. Then you just have to create a git patch containg let's say array_filter or if empty like in @haxxtick example

golaod avatar May 27 '19 06:05 golaod