Dear community,
I think I may found something unwanted.
Theres a layout default.xml for the contact page in
vendor/magento/module-contact/view/layout/ => default.xml
Line 13:
<argument name="label" xsi:type="string" translate="true">Contact Us</argument>
When I make an duplicate of this file and copy it to
app/design/frontend/ThemeName/Namespace/Magento_Contact/layout/ => default.xml
and change the line from "Contact us" to something else, the changes make no change in the
Is this intended or a bug, or am I just simply doing something wrong here. What I want to do is to change the
This could be a feature in future releases, in order to keep Magento translateable.
@grasdaggel
Thank you for reporting this issue!
To allow us research the issue, please, provide the used version and description according to the template.
We are using Magento 2.0.4
I've created an internal ticket MAGETWO-58021 for this issue and linked it to this one.
Any update on this? Its been a while.
Hello @grasdaggel,
You should create a contact_index_index.xml file into your layout folder.
Then, change the title in it:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<title>New contact page title</title>
</head>
</page>
BUT you won't be able to translate it, the issue #2951 is still open and is talking about this bug.
I have tried to change the page title of the Contacts page on Magento 2.2 with XML and it still not working. This issue has been open for over 1 year. When is it going to be fixed?
@grasdaggel, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.3.0-dev, 2.2.0, 2.1.9
@grasdaggel, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.3.0-dev, 2.2.0, 2.1.9
Any solution?
Hello @valeriaabo
You can change it using override Magento\Contact\Block\ContactForm and add code like below
CustomModule/Module/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Contact\Block\ContactForm" type="CustomModule\Module\Block\ContactUs\ContactForm" />
</config>
CustomModule/Module/Block/ContactUs/ContactForm.php
namespace CustomModuleModule\Block\ContactUs;
use Magento\Framework\View\Element\Template;
class ContactForm extends Magento\Contact\Block\ContactForm
{
public function _prepareLayout()
{
$this->pageConfig->getTitle()->set(__('Contact Us')); // add title here
}
}
This is works for me
Let me know if any
Thanks,
Anant Prajapati
@Anantkprajapati : your solution worked very fine for me, thank you very much !
Most helpful comment
Hello @valeriaabo
You can change it using override Magento\Contact\Block\ContactForm and add code like below
CustomModule/Module/etc/di.xml
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\Contact\Block\ContactForm" type="CustomModule\Module\Block\ContactUs\ContactForm" /> </config>CustomModule/Module/Block/ContactUs/ContactForm.php
This is works for me
Let me know if any
Thanks,
Anant Prajapati