skip to Main Content

Magento 2 show wrong title for every module on website, example module warranty and payment (Create new customer account). It show for title path vendor/magento/module-theme/view/frontend/templates/html/title.phtml

How i can solve this problem?

2

Answers


  1. Fixed setting the title in my custom modules, at VendorModuleControllerIndex, per example.

    /**
     * @var MagentoFrameworkViewResultPageFactory
     */
    protected $_resultPageFactory;
    
    /**
     * @param Context $context, 
     * @param MagentoFrameworkViewResultPageFactory $resultPageFactory,
     */
    public function __construct(Context $context, MagentoFrameworkViewResultPageFactory $resultPageFactory)
    {
        $this->_resultPageFactory = $resultPageFactory;
        parent::__construct($context);
    }
    
    /**
     * return page factory
     */
    public function execute()
    {
        $resultPage = $this->_resultPageFactory->create();
        $resultPage->getConfig()->getTitle()->set(__('My Module Title'));
        return $resultPage;
    }
    
    Login or Signup to reply.
  2. Check that you don’t have an extension adding a block into the customer area that extends from the MagentoSalesBlockOrderHistory block. This block sets the page title in the constructor. I have seen an extension that did this and several account sections then had the page title of “My Orders”.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search