As mentioned "ObjectManager is absolutely prohibited" and "Registry is deprecated", the following atwix registry alternative appears to represent the current correct approach to the original question by using Service and ViewModel.
The error means Magento can't find your phtml file.
your phtml file should be in either following location:
Though, I assume your module is actually named "Module" and ...
You have several options:
You can use a tool like Hotjar to track the clicks on the banners.
You can track with js the 'onclick' events and make an ajax call to a controller which could record the element and number of clicks on it.
You could again use js to track the 'onclick' event and trigger sending data to dataLayer if you have Google Tag Manager ...
I advise you to create a custom block and load a product collection filtered by your conditions. You would have control over what is loaded there. The collection retrieval would look something like this:
public function getLimitedProductCollection($categoryId, $limit)
$collection = Mage::getResourceModel('catalog/product_collection')
Try to move it instead:
<move element="wishlist_sidebar" destination="mylocation.block" before="-"/>
Also make sure to clear the cache, sometimes not even when running flush and clear cache, magento stop using cached. When it happens I need to clear static files.
I recommend disable full_page and block_html cache while ...
Your method is not working because your blocks are siblings and do not have a parent/child relationship. The key is the word child in getChildHtml.
If you nest your wishlist block inside the location block that will work.
Also, header.panel is a container, not a block. See https://github.com/magento/magento2/blob/5e57ddd6b0452121e26ce93c74029cf58c4b1d6b/app/...
First of all core/template is not a part of Magento 2.
To add any phtml file you need a block or layout file to define a path of your phtml file.
type is use to define your Block class which is connected to your
phtml file. So you can access block methods in your phtml file.
name is used to set a name of your block. It must be unique.
A general practice in many frameworks is that if you want to reuse the same function in multiple places you write the function in a lightweight helper
If you want a function that is there in a controller and you want to reuse it in a block, it would be best to move that function in a helper class and inject the object of the helper class in the constructor ...
Please follow the below step to call the controller function in the block.
Create a function in the controller file like below.
public function getControllerFunction()
return __('Controller Function');
After that call controller class in block construct and call controller function like ...
First, match your live server configuration with the dev server configuration. Then run below commands on your dev server Magento root:
rm -rf vendor/*
rm -rf generated/*
php bin/magento s:up
php bin/magento s:d:c
<!-- For Production mode -->
php bin/magento s:s:d
<!-- For developer mode -->
php bin/magento s:s:d -f
You need to create a model that will represent your table and will hold your class also, then you need to have resource model and collections, then in your layout file using collections and the method defined in your block of $block->getName() will execute will give you the correct result.
This code class="Magento\Contact\Block\ContactForm" means that in your template you have access to all methods of the class vendor/magento/module-contact/Block/ContactForm.php or Magento\Framework\View\Element\Template
In that class you have no getName method.