In catalog_product_view.xml in the parent theme there is this, just copied up to one line past the line Im trying to change:
<?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">
<block class="Infortis\Base\Block\Product\View" name="product-view-wrapper" template="product/view.phtml" before="-">
<container name="container_product_image_1" label="Product View, Image Column" />
<container name="container_product_primary_1" label="Product View, Primary Column, Container 1" />
<container name="container_product_primary_2" label="Product View, Primary Column, Container 2" />
<container name="container_product_secondary_1" label="Product View, Secondary Column, Container 1" />
<container name="container_product_secondary_2" label="Product View, Secondary Column, Container 2" />
<container name="container_product_lower_primary_1" label="Product View, Lower Primary Column, Container 1" />
<container name="container_product_lower_primary_2" label="Product View, Lower Primary Column, Container 2" />
<container name="container_product_lower_secondary_1" label="Product View, Lower Secondary Column, Container 1" />
<container name="container_product_lower_secondary_2" label="Product View, Lower Secondary Column, Container 2" />
<block class="Magento\Cms\Block\Block" name="block_product_secondary_bottom">
<arguments>
<argument name="block_id" xsi:type="string">block_product_secondary_bottom</argument>
</arguments>
</block>
</block>
</referenceContainer>
<move element="product.info.main" destination="product-view-wrapper" />
<move element="product.info.media" destination="product-view-wrapper" />
<move element="bundle.options.container" destination="product-view-wrapper" />
<move element="product.info.details" destination="product-view-wrapper" />
<move element="catalog.product.related" destination="product-view-wrapper" />
<move element="product.info.upsell" destination="product-view-wrapper" />
<move element="product.info.overview" destination="product.info.main" before="product.social.links" />
<move element="container_product_primary_1" destination="product.info.main" before="product.info.price" />
But I need to move it somewhere else in my child theme, like so:
<?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>
<move element="product.info.overview" destination="product.info.main" before="product.social.links" />
</body>
</page>
but it doesn't want to extend the parent and as soon as I delete the line from the parent layout file it moves it right where I need it to go. What am I doing wrong?
Edit:
It is in the Infortis > Ultimo theme
The parent xml file:
/app/design/frontend/Infortis/base/Magento_Catalog/layout/catalog_product_view.xml
The child xml file
/app/design/frontend/Infortis/childtemp/Magento_Catalog/layout/catalog_product_view.xml
Are you sure you located the correct path for the layout extend in your custom theme? Seems to me that the fallback is the issue.
Ok I finally figured out the problem. In the theme table in the database the theme was set to "1" instead of "0" like all the rest of the themes.. Im not sure how it got set to 1, but I believe that means Virtual instead of Physical.. which Im not even sure what that means either, but that solved the problem. Now my child xml extends the parent xml just fine. Thank you for your help!
Related
We are able to remove block in Magento1 with unsetBlock() method, but in Magento2 it is not working. So, please help how can remove block in Magento2 programmatically ?
Use unsetElement() method to remove block.
as like
$layout = $this->getLayout();
$block = $layout->getBlock('catalog.topnav'); // block name
$layout->unsetElement('catalog.topnav');
You need to try this way, for example, I am removing compare from the sidebar so I override default.xml to app/design/frontend/Your_Theme/theme_name/Magento_Catalog/layout
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
</body>
To Remove particular block from page, Open your custom layout xml and place the below code under body Tag
<?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">
<body><referenceBlock name="Your_Block" remove="true"/>
</body>
</page>
Change Your_Block this one to your block name need to be remove
Ideally there are different ways to do this. The best way of doing it is using a layout file.
1) If you have build a module you can create a layout which is an xml file in app/code/Namespace/Your_Module/view/frontend/layout/frontname_controllername_controlleraction.xml and add the below code
<?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">
<referenceBlock name="block_name" remove="true" />
</page>
2) If you have not created a custom module of your's you can simply write a custom xml in app/design/frontend/Custom_Theme/Theme_name/Module_Name/layout and add the below code.
<?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">
<referenceBlock name="block_name" remove="true" />
</page>
How to move topmenu inside header wrapper reference
[magentoroot]vendor/magento/module-theme/view/frontend/layout/default.xml
I want to move catalog.topnav inside header-wrapper
<referenceContainer name="page.top">
<block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600"/>
</referenceContainer>
<referenceContainer name="header-wrapper">
</referenceContainer>
Thanks
Add Following code in [magentoroot]vendor/magento/module-theme/view/frontend/layout/default.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<move element="catalog.topnav" destination="header-wrapper" after="logo"/>
</body>
</page>
To get this to work, I had to move the whole navigation.sections block. Otherwise the menu would look broken with mobile resolutions. I'm working with Magento 2.1.1 and my theme inherits from blank.
In /app/design/frontend/<Vendor>/<theme>/Magento_Theme/layout/default.xml add this:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<move element="navigation.sections" destination="header-wrapper" after="logo"/>
</body>
</page>
I suggest you create a structure in your
app/design/frontend/yourVendor/yourTheme/Magento_Theme/page_layout
Inside create your default.xml and paste this:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<move element="catalog.topnav" destination="header-wrapper" after="logo"/>
</body>
</page>
My code :
<reference name="before_body_end">
<block type="test/test" template="test/test.phtml" name="test-test" />
</reference>
when i change to
<reference name="after_body_end">
<block type="test/test" template="test/test.phtml" name="test-test" />
</reference>
then it is not working. please help
It doesn't work because you are referencing ...well...nothing. The block with name after_body_end does not exist.
I will explain how to add it but first I want to make it clear that I don't approve of adding html outside the body tag. This may cause issues on some browsers.
First you need to create the block with name after_body_end.
For this edit the file app/design/frontend/{interface}/{theme}/layout/page.xml and look for this :
<block type="core/text_list" name="before_body_end" as="before_body_end" translate="label">
<label>Page Bottom</label>
</block>
Right under that add the following.
<block type="core/text_list" name="after_body_end" as="after_body_end" translate="label">
<label>Page Unde the body tag</label>
</block>
Now your block exists. You just have to add it to your page. For this edit the following files all located in app/design/frontend/{interface}/{theme}/template/page/:
1column.phtml
2columns-left.phtml
2columns-right.phtml
3columns.phtml
empty.phtml
popup.phtml
print.phtml
For all these files add under the </body> line this:
<?php echo $this->getChildHtml('after_body_end') ?>
Clear the cache and enjoy.
How can I show label on the top of the line in the bar2d graphic?
For example:
|-------------------------
| This is line!
|================= 70%
|
| This is line 2!
|====== 30%
|-------------------------
Thanks.
Natively, FusionCharts does not support this feature. However, what makes FusionCharts really amazing is the number of workaround or tweaks you can come up with to address an issue (makes my job easier too :)
Please try out the following XML snippet using a Single series Bar 2D chart.
<?xml version="1.0" encoding="UTF-8"?>
<chart caption="Monthly Unit Sales" xAxisName="Month" yAxisName="Units" showValues="1" decimals="0" formatNumberScale="0" chartRightMargin="30">
<set label="" value="0" alpha="0.1" displayValue="
Feb" />
<set label="" value="857" />
<set label="" value="0" alpha="0.1" displayValue="
Apr" />
<set label="" value="494" />
</chart>
What we have done here is used empty and invisible data-plot above the data-plots we want to showcase with the Label on top. Thereby, using the displayValue attribute in the invisible data-plot, we can recreate the visual effect of the Labels being on-top of the data-plot being displayed.
Note: The character (new line break) has been used to bring the output of the displayValue attribute, i.e. the apparent Label in this case, closer to the data-plot below.
Alternatively, you may also use the Multi-series Bar 2D chart to re-create the above mentioned effect, using the XML snippet quoted below.
<?xml version="1.0" encoding="UTF-8"?>
<chart palette="2" caption="Business Results: 2005" yaxisname="Revenue (Millions)" hovercapbg="FFFFFF" toolTipBorder="889E6D" divLineColor="999999" divLineAlpha="80" showShadow="0" canvasBgColor="FEFEFE" canvasBaseColor="FEFEFE" canvasBaseAlpha="50" divLineIsDashed="1" divLineDashLen="1" divLineDashGap="2" numberPrefix="$" numberSuffix="M" chartRightMargin="30" useRoundEdges="1" legendBorderAlpha="0">
<categories>
<category label="" />
<category label="" />
<category label="" />
</categories>
<dataset seriesname="Domestic" color="8EAC41">
<set value="0" alpha="0.1" displayValue="Hardware" />
<set value="0" alpha="0.1" displayValue="Software" />
<set value="0" alpha="0.1" displayValue="Service" />
</dataset>
<dataset seriesname="International" color="607142">
<set value="116" />
<set value="237" />
<set value="83" />
</dataset>
</chart>
I hope this helps. :D
Hoping someone can help me with a slight hurdle I've come up against in regards to re-rendering of RichFaces components after an a4j link/button has performed it's action. A simplified version of my problem is as follows:
I have 2 output components displaying a text value which are rendered based on some value in my manager class:
<h:outputText id="on" value="ON" rendered="#{manager.isOn}" />
<h:outputText id="off" value="OFF" rendered="#{not manager.isOn}" />
I also have 2 a4j links that call some action and then re-render the above outputText components:
<a4j:commandLink ajaxSingle="true" value="Set On" action="#{manager.setOn(true)}" reRender="on,off" />
<a4j:commandLink ajaxSingle="true" value="Set Off" action="#{manager.setOn(false)}" reRender="on,off" />
What I would expect to happen is, when I click the 'Set On' button, the 'ON' outputText component would unhide, and the 'OFF outputText component would show. However, this does not happen.
Does anyone have the answer as to why this is so, and how I go about re-rendering these components after the a4j component action has completed?
Wrap the outputText components in an s:div and re-render that as follows:
<s:div id="myDiv">
<h:outputText id="on" value="ON" rendered="#{manager.isOn}" />
<h:outputText id="off" value="OFF" rendered="#{not manager.isOn}" />
</s:div>
<a4j:commandLink ajaxSingle="true" value="Set On"
action="#{manager.setOn(true)}" reRender="myDiv" />
<a4j:commandLink ajaxSingle="true" value="Set Off"
action="#{manager.setOn(false)}" reRender="myDiv" />
I agree with Gene but the best way I could find is to surround the content with
<a4j:outputpanel id="whatever_id" />
for example,
<a4j:outputpanel id="myDiv">
<h:outputText id="on" value="ON" rendered="#{manager.isOn}" />
<h:outputText id="off" value="OFF" rendered="#{not manager.isOn}" />
</a4j:outputpanel>
You rerender the parent. It doesn't have to be a Seam tag.
I suppose that your h:outputText elements on and off are not rendered at load time of the page.
RichFaces will not rerender these components later even if the value of rendered changed to true.