Because of lack of knowledge, I currently have many parts using objectManager in my project.But I'm not sure whether I should create a module and create many functions for these various parts running by objectManager. For example, in app/design/frontend/CustomTheme/default/Magento_Catalog/templates/product/list.phtml, I'm using 4 different results just using objectManager.
$_product = $objectManager->create('Magento\Catalog\Model\Product')->load($_item->getId()); $storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface'); $cartlist = $objectManager->create('\Magento\Checkout\Model\Cart')->getQuote(); $context = $ObjectManager->get('Magento\Framework\App\Http\Context');
If I create a module and a Block, is it okay to add 4 different functions in just one Block? In other files, I am going to use this Block class to remove the parts running by objectManager.