Magento 2 : template file not overridden correctly - magento2

I have wrote the below code to override magento 2 frontend customer edit form.
customer_account_edit.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<referenceBlock name="customer_edit">
<action method="setTemplate">
<argument name="template" xsi:type="string">Test_Modul::customer/form/edit.phtml</argument>
</action>
</referenceBlock>
</referenceContainer>
</body>
</page>
But it is not working. Please help me to fix it?

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<referenceBlock name="customer_edit">
<action method="setTemplate">
<argument name="template" xsi:type="string">Emipro_Module::customer/form/edit.phtml</argument>
</action>
</referenceBlock>
</referenceContainer>
</body>
</page>
I have used above code and its work fine for me.
Also Your code seems right. Did you make your phtml file under proper location like: Vendor/Module_Name/view/frontend/templates/customer/form/edit.phtml
Also check that if there is no any spell mistake in your module name or path.

customer_account_edit.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<referenceBlock name="customer_edit">
<action method="setTemplate">
<argument name="template" xsi:type="string">Test_Module::customer/form/edit.phtml</argument>
</action>
</referenceBlock>
</referenceContainer>
</body>
you need to create a template file for this on the Path.
app/code/Test/Module/view/frontend/templates/customer/form/edit.phtml

Related

Magento 2: Left Category Sidebar from Sebwite

I'm using Magento 2 and still struggle implementing this category listing url:
https://github.com/Sebwite/magento2-category-sidebar
What is the proper way to do this line below? Which file should i edit?
You should implement the block Sebwite\Sidebar\Block\Sidebar in your theme to make this extension work.
As i am new to this, i cannot find any instruction regarding this knowing i should have missed something here.
I have try several attempts but it seems the left category still not showing.
I have tried to edit /vendor/magento/theme-frontend-luma/Magento_Catalog/layout/default.xml but still no luck.
Below is my default.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="header-wrapper">
<container name="compare-link-wrapper" label="Compare Link Wrapper" as="compare-link-wrapper" after="top.search" htmlTag="ul" htmlClass="compare wrapper">
<block class="Magento\Framework\View\Element\Template" name="catalog.compare.link" before="-" template="Magento_Catalog::product/compare/link.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="compareProducts" xsi:type="array">
<item name="component" xsi:type="string">Magento_Catalog/js/view/compare-products</item>
</item>
</item>
</argument>
</arguments>
</block>
</container>
</referenceContainer>
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<block class="Sebwite\Sidebar\Block\Sidebar" name="category-sidebar" template="Sebwite_Sidebar::sidebar.phtml" />
</body>
</page>
Any suggestions is very appreciated.
Thank you
So this works for me.
Go to your magento luma catalog-layout default.xml and change it to below:
<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="header-wrapper">
<container name="compare-link-wrapper" label="Compare Link Wrapper" as="compare-link-wrapper" after="top.search" htmlTag="ul" htmlClass="compare wrapper">
<block class="Magento\Framework\View\Element\Template" name="catalog.compare.link" before="-" template="Magento_Catalog::product/compare/link.phtml">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="compareProducts" xsi:type="array">
<item name="component" xsi:type="string">Magento_Catalog/js/view/compare-products</item>
</item>
</item>
</argument>
</arguments>
</block>
</container>
</referenceContainer>
<referenceContainer name="sidebar.additional">
<block class="Sebwite\Sidebar\Block\Sidebar" name="category-sidebar" template="Sebwite_Sidebar::sidebar.phtml" />
</referenceContainer>
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
</body>
</page>

magento 2 cms_index_index not working

/app/design/frontend/some/theme/Magento_Cms/layout/cms_index_index.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block type="\Magento\Cms\Block\Block" name="index.banner">
<arguments>
<argument name="block_id" xsi:type="string">index_banner</argument>
<arguments>
</block>
</referenceContainer>
</body>
It does not show index_banner static on the home page.
What do the error?
What needs to be done in the background or setting?
Their mistakes
<block class="Magento\Cms\Block\Block" name="index_banner">
<arguments>
<argument name="block_id" xsi:type="string">index_banner</argument>
</arguments>

How to remove "My Wish List" and "Compare Products" blocks from Magento 2.0 Luma template?

I have spent a lot of hours trying to remove "My Wish List" and "Compare Products" blocks from Luma template. Besides, I need to change and remove some of the bottom links.
I cannot find where to modify. Can you help me, please?
Thanks
I've tried following step it worked for me.
1. My Wish List
For wish List you need to remove it via Admin > Stores > Configuration > Customers > Wish list > General Options
make to enabled to no and then save it.
2. Compare Product
Here you need to do some coding level changes. follow me
Go to vendor > magento > theme-frontend-luma > Magento_Catalog > layout > default.xml
Open this file find this tag "" and before body end tag put the following code
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
Make sure this will remove compare product from category product
listing however you can uses this to any layout.
Once you done with this don't forget to clearing cache if enable otherwise you will not get desirable output.
Let me know if you have still any query
Magento 2.2.3 - Get rid of the compare
So I had the same issue, but found out I needed to add a way more to the default.xml to get rid of the compare:
<referenceBlock name="catalog.compare.sidebar" remove="true"/> <!-- Remove sidebar -->
<referenceBlock name="catalog.compare.link" remove="true"/> <!-- Remove link in header -->
<referenceBlock name="related.product.addto.compare" remove="true"/> <!-- Related product -->
<referenceBlock name="category.product.addto.compare" remove="true"/> <!-- Category add compare -->
<referenceBlock name="view.addto.compare" remove="true" /> <!-- Product addto compare -->
instead to remove parent block just remove to the point block
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="wishlist_sidebar" remove="true"/>
Update :for Magento 2.1
<referenceContainer name="content">
<referenceBlock name="catalog.compare.sidebar" remove="true" />
<referenceContainer name="sidebar.additional" remove="true" />
</referenceContainer
A quick note for Enterprise users: you may need to remove the "multiple wishlist" block as well:
<referenceBlock name="multiple-wishlist_sidebar" remove="true" />
I used all of these to remove traces of wishlist and compare from category and product page + the related and upsells on product page. Tested on v2.3.5-p1:
<referenceBlock name="wishlist_sidebar" remove="true" />
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="upsell.product.addto.wishlist" remove="true" />
<referenceBlock name="related.product.addto.wishlist" remove="true" />
<referenceBlock name="related.product.addto.compare" remove="true" />
<referenceBlock name="view.addto.wishlist" remove="true" />
<referenceBlock name="view.addto.compare" remove="true" />
Login to Magento back end. Goto Store->Configuration.
Under Customer ->wishlist you can able to disable the option.
(M2.1)
If you don't want to create a custom theme and/or prefer to work from the backend, you can do the following in the backend.
Navigate to the cms page, category or product page you want to alter.
Example for Category Page: under Design -> Layout Update XML add the following code:
<referenceContainer name="content">
<referenceBlock name="catalog.compare.sidebar" remove="true" />
<referenceContainer name="sidebar.additional" remove="true" />
</referenceContainer>
Note: if you want additional blocks to remain in the sidebar, set the additional container to "false" like this:
<referenceContainer name="content">
<referenceContainer name="sidebar.additional" remove="false" />
</referenceContainer>
For removing compare links
<referenceBlock name="catalog.compare.sidebar" remove="true"/> <!-- Remove sidebar -->
<referenceBlock name="catalog.compare.link" remove="true"/> <!-- Remove link in header -->
<referenceBlock name="related.product.addto.compare" remove="true"/> <!-- Related product -->
<referenceBlock name="category.product.addto.compare" remove="true"/> <!-- Category add compare -->
<referenceBlock name="view.addto.compare" remove="true" /> <!-- Product addto compare -->
For wish List:
You can remove it in Admin > Stores > Configuration > Customers > Wish list > General Options make to enabled to no and then save it.
or
<referenceBlock name="wishlist_sidebar" remove="true"/>
It's almost the very same way
<referenceBlock name="block.name.wantoberemoved" remove="true"/>
Remove compare products from the sidebar
<referenceBlock name="catalog.compare.sidebar" remove="true" />
Remove Wishlist from the sidebar
<referenceBlock name="wishlist_sidebar" remove="true" />
Override core module like below:
code/Custom/Wishlist:
code/Custom/Wishlist/registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Custom_Wishlist',
__DIR__
);
code/Custom/Wishlist/composer.json
{
"name": "custom/wishlist-magento2",
"description": "N/A",
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0"
},
"type": "magento2-module",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"version": "1.0.0",
"authors": [
{
"name": "Pramod Kharade",
"email": "support#blazeclan.com",
"homepage": "https://www.blazeclan.com/",
"role": "Developer"
}
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Custom\\wishlist\\": ""
}
}
}
code/Custom/Wishlist/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Custom_Wishlist" setup_version="1.0.0" >
<sequence>
<module name="Magento_Wishlist" />
</sequence>
</module>
</config>
code/Custom/Wishlist/etc/view/frontend/layout/default.xml
<?xml version="1.0"?>
<referenceContainer name="sidebar.additional" remove="true">
<block class="Magento\Wishlist\Block\Customer\Sidebar" name="wishlist_sidebar" as="wishlist" template="Magento_Wishlist::sidebar.phtml"/>
</referenceContainer>
</body>

Importing local classes in Haxe

I'm starting my first serious project in Haxe, but I've hit somewhat of a snag.
The problem is that if I try writing a class in a file other than my Main.hx, it is not being compiled. I've tried using import but that does not seem to work.
I'm using vim as a my ide with a few nice plugins(Youcompleteme, syntastic and vaxe) and the only haxelib is openfl.
Here is the boilerplate being created when I use the command openfl create project :
Project.xml
<?xml version="1.0" encoding="utf-8"?>
<project>
<meta title="ProjetSession" package="com.sample.projetsession" version="1.0.0" company="Company Name" />
<app main="Main" path="Export" file="ProjetSession" />
<source path="Source" />
<haxelib name="openfl" />
<assets path="Assets" rename="assets" exclude="openfl.svg" />
<icon path="Assets/openfl.svg" />
</project>
ProjetSession.hxproj
<?xml version="1.0" encoding="utf-8"?>
<project version="2">
<!-- Output SWF options -->
<output>
<movie outputType="CustomBuild" />
<movie input="" />
<movie path="project.xml" />
<movie fps="30" />
<movie width="800" />
<movie height="600" />
<movie version="1" />
<movie minorVersion="0" />
<movie platform="Lime" />
<movie background="#FFFFFF" />
<movie preferredSDK=";3;" />
</output>
<!-- Other classes to be compiled into your SWF -->
<classpaths>
<class path="D:\Development\Haxe\openfl" />
<class path="d:\Development\Haxe\lime" />
<class path="Source" />
<class path="Export\html5\haxe" />
</classpaths>
<!-- Build options -->
<build>
<option directives="openfl=3.0.0-beta
lime=2.1.3
tools=2.1.3
no-compilation
openfl-html5
canvas
lime-html5
html5
web
html5" />
<option flashStrict="False" />
<option noInlineOnDebug="False" />
<option mainClass="ApplicationMain" />
<option enabledebug="False" />
<option additional="--remap flash:openfl
--macro allowPackage("flash")" />
</build>
<!-- haxelib libraries -->
<haxelib>
<!-- example: <library name="..." /> -->
</haxelib>
<!-- Class files to compile (other referenced classes will automatically be included) -->
<compileTargets>
<!-- example: <compile path="..." /> -->
</compileTargets>
<!-- Paths to exclude from the Project Explorer tree -->
<hiddenPaths>
<hidden path="obj" />
</hiddenPaths>
<!-- Executed before build -->
<preBuildCommand>"$(CompilerPath)/haxelib" run lime build "$(OutputFile)" $(TargetBuild) -$(BuildConfig) -Dfdb</preBuildCommand>
<!-- Executed after build -->
<postBuildCommand alwaysRun="False" />
<!-- Other project options -->
<options>
<option showHiddenPaths="False" />
<option testMovie="Custom" />
<option testMovieCommand="" />
</options>
<!-- Plugin storage -->
<storage />
</project>
The hml file is automatically generated by vaxe.
Defining a class and importing it, it is not sufficient to have that class compiled in your output. What you need is to actually "use" it. That can be accomplished by referring your class in your main function. To do that just use the class directly or use any other code that refer that class directly or indirectly.
This is a big advantage of the language that doesn't overload the output of your app with unneeded code. That also means that you can use third party libraries with confidence, knowing that only the bits of library you use will be embedded in your output.

Typo3 Fluidtemplate multilanguage how to?

I use this Typoscript code:
lib.search = FLUIDTEMPLATE
lib.search.file = {$partialsTemplatesPath}search.html
Whats the best way to use multilanguage inside this Fluidtemplate?
Using lib.search.variables and GP:L conditions cant be the best way, right?
UPDATE:
Template:
<f:translate key="LLL:{locallangPath}locallang.xlf:search" />
XLF File:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2013-10-21T12:50:51Z" product-name="content">
<header/>
<body>
<trans-unit id="search">
<source>Search</source>
</trans-unit>
</body>
</file>
</xliff>
Translated XLF (de.locallang.xlf):
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="de" datatype="plaintext" original="messages" date="2013-10-21T12:50:51Z" product-name="content">
<header/>
<body>
<trans-unit id="search">
<target>Suche</target>
</trans-unit>
</body>
</file>
</xliff>
This is the right way I guess. But the output is only "Search" and not "Suche". Did I miss something?
For the translated one you have to specify source AND target language:
take a look at:
http://docs.typo3.org/typo3cms/CoreApiReference/6.2/Internationalization/Introduction/Index.html
hope that works for you...
You can use the translate viewhelper inside of your fluidtemplate.
See: https://fedext.net/viewhelpers/fluid/TranslateViewHelper.html