0

Can we use 2 different modules(say CatalogSearch and LayeredNavigation) in a single custom overridden vendor.

ie) I have

Vendor/MyCatalogSearch and

Vendor/MyLayeredNavigation

both the modules under single "Vendor"

Or should i use as below?

Vendor1/MyCatalogSearch

Vendor2/MyLayeredNavigation

2
  • Is this the Magento2 standard of using under 2 different Vendors or can it be used as the 1st way as shown!
    – Sushivam
    Commented Aug 16, 2016 at 6:17
  • You can use single vendor for multiple modules. Commented Aug 16, 2016 at 6:17

1 Answer 1

1

You can use single vendor (naming convention) for multiple modules.

For example

Mycommonvendor/Moduleone

Mycommonvendor/Moduletwo

One

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Mycommonvendor/Moduleone',
    __DIR__
);

Two

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Mycommonvendor/Moduletwo',
    __DIR__
);

Note : Not recommended to use core modules naming convention.

Hope this helps.

5
  • Actually my doubt was... Say for eg i am overriding Result.php from CatalogSearch module... Now i want to override this class in 2 different custom modules...Should i override the same class in 2 different modules?
    – Sushivam
    Commented Aug 16, 2016 at 7:44
  • Which custom modules 'type' in di will it consider?
    – Sushivam
    Commented Aug 16, 2016 at 7:46
  • If Module "A" is overriding result.php. You need to override module 'A' by other module (Module "B") to override result.php again. Commented Aug 16, 2016 at 8:12
  • Can u check this magento.stackexchange.com/questions/131556/… have described what i asked
    – Sushivam
    Commented Aug 16, 2016 at 8:14
  • Assume the question intention is Naming convention. Still have doubts please ask new question with what you have tried. Commented Aug 16, 2016 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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