magento-2-banner-slider
magento-2-banner-slider copied to clipboard
Undefined Offset - AddBlock.php line 88
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?
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 Thanks, I'll give this a go hopefully within the next few days and provide an update on my findings :)
@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 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