Magento blocks doubling after migration from 1.9.1.0 to 1.9.2
<reference name="right">
<block type="core/template" name="adsone" template="callouts/right_col.phtml">
<action method="setImgSrc"><src>images/advertise-section/adsone.png</src></action>
<action method="setImgAlt" translate="alt" module="catalog"><alt>Advertisement</alt></action>
</block></reference>
Related
I'm new in Magento. Now im trying to understand how blocks and layouts working. Here is my layout file `
<layout>
<custom_index_getallfaq>
<reference name="head">
<action method="setTitle">
<arg>All FAQ's</arg>
</action>
</reference>
<reference name="content">
<block type="custom/type" name="root" template="view.phtml" />
</reference>
</custom_index_getallfaq>
<custom_index_addnewfaq>
<reference name="head">
<action method="setTitle">
<arg>All FAQ's</arg>
</action>
</reference>
<reference name="content">
<block type="custom/type" name="root" template="form.phtml" />
</reference>
</custom_index_addnewfaq>
</layout>`
First handler working properly. It displaying template view.phtml
The problem is second handler working unexpected for me. It displaying index page of my site instead of form.phtml
Thank you for help
I'm developing extension for magento 2.0. I can not add add tab to edit product page in back end. I try to use event core_block_abstract_prepare_layout_after but I'm not success. Can you help me how to do that.
Thank
In order to add a new tab in the product admin page you need to add a new 'Block' in view -> adminhtml. The layout has to be named catalog_product_new.xml. This is the content of my file (from my personnal module).
<?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>
<referenceBlock name="product_tabs">
<block class="Okalm\Igram\Block\Adminhtml\Product\Edit\Tab" name="product.test">
<arguments>
<argument name="label" xsi:type="string" translate="true">Test</argument>
<argument name="url" xsi:type="url" path="test/moderate/index">
<param name="_current">1</param>
</argument>
<argument name="class" xsi:type="string">ajax</argument>
<argument name="group_code" xsi:type="string">advanced</argument>
</arguments>
</block>
<action method="addTab">
<argument name="name" xsi:type="string">product-instagram</argument>
<argument name="block" xsi:type="string">product.test</argument>
</action>
</referenceBlock>
How to rewrite Mage_Catalog_Block_Product_Price only for handle catalog_product_view? This block haven't specific name in Layout.
<catalog_product_view>
<reference name="???">
<block type="test/price" name="test.price />
</reference>
</catalog_product_view>
Since in magento the product type is defining the block that is used to render the price, it is a little bit tricky. Maybe this can work:
go to your favorite layout xml file and add this
<catalog_product_view>
<reference name="catalog_product_price_template">
<action method="addPriceBlockType"><type>simple</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>virtual</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>grouped</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>downloadable</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>configurable</type><block>yourmodule/catalog_product_price</block><template>catalog/product/price.phtml</template></action>
<action method="addPriceBlockType"><type>bundle</type><block>yourmodule/bundle_catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action>
</reference>
</catalog_product_view>
iam not 100% sure that this will work but its maybe a start for you
I'm trying to add a css file to my CMS homepage by going to CMS > Pages > Home > Design then updating the Layout XML however it keeps adding in /base to the url to show the following:
<reference name="head">
<action method="addJs">
<script>nivo-slider/jquery.nivo.slider.js</script>
</action>
<action method="addCss">
<script>../bootstrap/theme_name/css/nivo-slider.css
</script></action>
</reference>
which outputs the following in view source:
<link rel="stylesheet" type="text/css" href="/skin/frontend/base/default/bootstrap/theme_name/css/nivo-slider.css" media="all" />
I've tried ../ and adding in the absolute link however it just adds it after the /base/
Is there a way I can override the theme trying to add in /base/
Assuming theme_name is your active theme, try to replace <action method="addCss">...</action> with this node:
<action method="addItem"><type>skin_css</type><file>css/nivo-slider.css</file></action>
Base folder is loaded due to the magento fallback. It searchs last in base folder, that's why base is added.
try with below code
<?xml version="1.0">
<layout>
<default>
<reference name="head">
<action method="addItem"><type>skin_css</type><file>css/nivo-slider.css</file></action>
</reference>
</default>
</layout>
hope this will sure help you.
New to Struts2. I am running this project for the first time and I am getting this error message when browsing to all the resources. It looks like struts.xml is not seen at all.
I have the feeling that it must be something to do with some misconfiguration and/or a missing jar. That "defined for ''" (with that empty space between quotes) is the bit that worries me the most.
The project is a web app and is built with maven. Any idea, advice or just thoughts are welcome.
My struts.xml includes my struts-xxx.xml like this
<include file="struts-xxx.xml"/>
In struts-xxx.xml:
<package name="xxx-admin" namespace="/admin/myresource" extends="my-default">
<default-action-ref name="default"/>
<default-class-ref class="com.xxx.action.domain.MyAction"/>
<global-results>
<result type="redirectAction">list</result>
<result name="detail">/WEB-INF/jsp/xxx/detail.jsp</result>
<result name="input">/WEB-INF/jsp/xxx/detail.jsp</result>
</global-results>
<action name="default">
<result type="redirectAction">
<param name="actionName">list</param>
</result>
</action>
<action name="view" method="view"/>
<action name="create" method="create"/>
<action name="update" method="update"/>
<action name="delete" method="delete"/>
<action name="commit_create" method="createCommit">
<result name="detail" type="redirectAction">create</result>
<!--stay creating-->
</action>
<action name="commit_update" method="updateCommit">
<result name="detail" type="redirectAction">
<!--stay updating-->
<param name="parse">true</param>
<param name="actionName">update</param>
<param name="id">%{id}</param>
</result>
</action>
<action name="commit_delete" method="deleteCommit"/>
<action name="search" method="search" class="com.xxx.action.domain.OneMoreAction">
<result>/WEB-INF/jsp/xxx/search.jsp</result>
</action>
<action name="list" method="list" class="com.xxx.action.domain.OneMoreAction">
<result>/WEB-INF/jsp/xxx/list.jsp</result>
<result name="input">/WEB-INF/jsp/xxx/search.jsp</result>
<result name="unique_result">/WEB-INF/jsp/xxx/list.jsp</result>
</action>
</package>
There was nothing wrong with Struts2 config (or Spring config). The project I was trying to run was coded with Java 1.6 while I was using Java 1.7 ... thanks for your answers and comments
If working with struts and Spring, In Struts.xml, we define actions for particular class and then in the application-context.xml of your project the actual bean of this Action class should be created. Missing bean definition in application-context.xml, struts doesn't find the bean at run time when the Action is called. Hence this error.