1

I would like to ask if there is a way to override the design of the custom 3rd party module in magento 2 where I can put my own design and still fetch the data from the database. I'd appreciate any help with regards to this. thanks!

Miguel Intoy
  • 127
  • 2
  • 14

2 Answers2

2

You can add your own custom css file and override the module css.Refer below for more guidelines. How to add a custom CSS file in Magento 2

tru.d
  • 325
  • 1
  • 2
  • 17
1

if you need any specific function from custom module you can easily get by injecting class of Custom Module in Your Module.

class yourClass extends parentCLass
{
    public function __construct(
        \Vendor\CustomModule\Block\Class $customClass,
        \Magento\Backend\App\Action\Context $context,
    ) {
        $this->customClass   =   $customClass;
        parent::__construct($context);
    }
    public function execute()
    {
       \\use specfic funtio
        $this->customModule->neededFuntion(); 

    }
}

If you want to entrupt a function and do your own task you can use Plugin

In your

vendor\yourModule\etc\frontend\di.xml

<type name="Vendor\CustomModule\Block\Class>
       <plugin name="your_custom_plugin" type="Vendor\YourModule\Plugin\YourPlugin" sortOrder="10"/>
</type>

Now in

Vendor\YourModule\Plugin\YourPlugin

class YourPlugin
{
    public function __construct(
    ) {
    }
    \\ Here you can override any funtion from the custom Module By Follwing hree ways
    public function beforeCuntomFuntion(
    }
    public function aroundCuntomFuntion(
    }
    public function afterCuntomFuntion(
    }
}
Partab Saifuddin Zakir
  • 1,238
  • 1
  • 18
  • 43
Waqar Ali
  • 2,319
  • 16
  • 44