Magento - 如何将Mageworx下载块放入模板主 - 轻松选项卡,自定义选项卡

时间:2013-03-21 09:42:26

标签: magento tabs

我安装了Mageworx下载扩展程序和模板主程序 - Easy tabs扩展程序。可以通过管理员配置产品视图页面上的下载信息,但无法告诉它将其放在“简易标签”自定义选项卡中。

我找到了编辑所需的位置,但我不确定正确的语法:

downloads.xml:

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <reference name="head">
            <action method="addJs" ifconfig="mageworx_cms/downloads/enabled"><script>mageworx/downloads.js</script></action>
            <action method="addCss" ifconfig="mageworx_cms/downloads/enabled"><stylesheet>css/mageworx/downloads.css</stylesheet></action>
        </reference>
        <reference name="after_body_start">
            <block type="core/template" template="downloads/init_popup.phtml" name="init_video_popup" />
        </reference>
        <reference name="before_body_end">
            <block type="core/template" template="downloads/video_popup.phtml" name="video_popup" />
        </reference>
    </default>

    <catalog_product_view>
        <reference name="product.info">
            <block type="downloads/product" name="downloads.product" />
        </reference>
    </catalog_product_view>

    <!--catalog_category_layered>
        <reference name="product_list">
            <action ifconfig="mageworx_cms/downloads/enable_files_on_category_pages" method="setTemplate"><template>downloads/catalog-product-list.phtml</template></action>
        </reference>
    </catalog_category_layered>

    <catalog_category_default>
        <reference name="product_list">
            <action ifconfig="mageworx_cms/downloads/enable_files_on_category_pages" method="setTemplate"><template>downloads/catalog-product-list.phtml</template></action>
        </reference>
    </catalog_category_default>

    <catalogsearch_result_index>
        <reference name="search_result_list">
            <action ifconfig="mageworx_cms/downloads/enable_files_on_category_pages" method="setTemplate"><template>downloads/catalog-product-list.phtml</template></action>
        </reference>
    </catalogsearch_result_index>

    <catalogsearch_advanced_result>
        <reference name="search_result_list">
            <action ifconfig="mageworx_cms/downloads/enable_files_on_category_pages" method="setTemplate"><template>downloads/catalog-product-list.phtml</template></action>
        </reference>
    </catalogsearch_advanced_result-->
</layout>

TM_EasyTabs.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <TM_EasyTabs>
            <active>true</active>
            <codePool>community</codePool>
            <tm_link><![CDATA[http://templates-master.com/magento-extensions/magento-easy-tabs.html]]></tm_link>
            <depends>
                <Mage_Catalog />
            </depends>
            <!-- Add custom tab for downloads -->
            <action method="addTab" translate="title" module="catalog">
                <alias>downloads</alias>
                <title>Downloads test</title>
                <block>downloads/product</block>
                <template>downloads/block_file_links.phtml</template>
            </action>
         </TM_EasyTabs>   
    </modules>
</config>

正如您所看到的,我已尝试将正确的语法放入其中,但我发现错误,因为当我取消注释时,标签会从产品页面中消失。

编辑:

原来我正在编辑错误的xml文件,我需要编辑的文件是布局文件夹中的easytabs.xml。

我设法添加了一个带有下载内容的标签,但由于我无法完全禁用管理员中的下载,我现在可以获得两个下载标签,一个用于我的自定义标签,另一个用于下载扩展程序应该加入,但不是出于某种原因。

easytabs.xml:

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
    <default>
        <reference name="head">
            <action method="addItem" ifconfig="easy_tabs/general/enabled"><type>skin_css</type><name>css/easytabs.css</name></action>
        </reference>
    </default>

    <catalog_product_view>
        <reference name="product.info">
            <action method="unsetChild" ifconfig="easy_tabs/general/descriptiontabbed"><name>description</name></action>
            <action method="unsetChild" ifconfig="easy_tabs/general/additionaltabbed"><name>additional</name></action>
            <action method="unsetChild" ifconfig="easy_tabs/general/upsellproductstabbed"><name>upsell_products</name></action>
        </reference>
        <reference name="right">
            <action method="unsetChild" ifconfig="easy_tabs/general/relatedtabbed"><name>catalog.product.related</name></action>
        </reference>
        <reference name="product.info.additional">
            <action method="unsetChild" ifconfig="easy_tabs/general/tagstabbed"><name>product_tag_list</name></action>
            <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs">
                <action method="setTemplate" ifconfig="easy_tabs/general/enabled"><template>easytabs/tabs.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/general/descriptiontabbed"><alias>description_tabbed</alias><title>Description</title><block>catalog/product_view_description</block><template>easytabs/description.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/general/additionaltabbed"><alias>additional_tabbed</alias><title>Specification</title><block>catalog/product_view_attributes</block><template>easytabs/attributes.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/general/upsellproductstabbed"><alias>upsell_products_tabbed</alias><title>We Also Recommend</title><block>catalog/product_list_upsell</block><template>catalog/product/list/upsell.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/general/relatedtabbed"><alias>related_tabbed</alias><title>Related Products</title><block>catalog/product_list_related</block><template>easytabs/catalogproductrelated.phtml</template></action>
                <action method="addTab" translate="title" module="tag"     ifconfig="easy_tabs/general/tagstabbed"><alias>tags_tabbed</alias><title>Product Tags</title><block>tag/product_list</block><template>easytabs/catalogproducttags.phtml</template></action>
                <action method="addTab" translate="title" module="review"  ifconfig="easy_tabs/general/reviewtabbed"><alias>review_tabbed</alias><title>Reviews</title><block>review/product_view_list</block><template>easytabs/catalogproductreview.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/custom/customtab"><alias>custom</alias><title>Custom tab</title><block>catalog/product_view</block><template>downloads/block_file_links.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/custom/customtab1"><alias>custom1</alias><title>Custom tab</title><block>catalog/product_view</block><template>easytabs/catalogproductcustom1.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/custom/customtab2"><alias>custom2</alias><title>Custom tab</title><block>catalog/product_view</block><template>easytabs/catalogproductcustom2.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/custom/customtab3"><alias>custom3</alias><title>Custom tab</title><block>catalog/product_view</block><template>easytabs/catalogproductcustom3.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/custom/customtab4"><alias>custom4</alias><title>Custom tab</title><block>catalog/product_view</block><template>easytabs/catalogproductcustom4.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/customcms/tabcms"><alias>cms</alias><title>CMS tab</title><block>core/template</block><template>easytabs/catalogproductcms.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/customcms/tabcms1"><alias>cms1</alias><title>CMS tab</title><block>core/template</block><template>easytabs/catalogproductcms1.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/customcms/tabcms2"><alias>cms2</alias><title>CMS tab</title><block>core/template</block><template>easytabs/catalogproductcms2.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/customcms/tabcms3"><alias>cms3</alias><title>CMS tab</title><block>core/template</block><template>easytabs/catalogproductcms3.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/customcms/tabcms4"><alias>cms4</alias><title>CMS tab</title><block>core/template</block><template>easytabs/catalogproductcms4.phtml</template></action>
                <action method="addTab" translate="title" module="downloads">
                    <alias>downloads_test</alias>
                    <title>Downloads test</title>
                    <block>downloads/product</block>
                    <template>downloads/block_file_links.phtml</template>
                </action>
            </block>
        </reference>
    </catalog_product_view>
</layout>

我现在需要删除额外的标签,但删除我的引用,删除它们......

解决:

在我的addTab操作后添加了这个,并删除了额外的标签:

<action method="unsetChild"><name>downloads_test</name></action>

2 个答案:

答案 0 :(得分:0)

布局/ easytabs.xml:

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
    <default>
        <reference name="head">
            <action method="addItem" ifconfig="easy_tabs/general/enabled"><type>skin_css</type><name>css/easytabs.css</name></action>
        </reference>
    </default>

    <catalog_product_view>
        <reference name="product.info">
            <action method="unsetChild" ifconfig="easy_tabs/general/descriptiontabbed"><name>description</name></action>
            <action method="unsetChild" ifconfig="easy_tabs/general/additionaltabbed"><name>additional</name></action>
            <action method="unsetChild" ifconfig="easy_tabs/general/upsellproductstabbed"><name>upsell_products</name></action>
        </reference>
        <reference name="right">
            <action method="unsetChild" ifconfig="easy_tabs/general/relatedtabbed"><name>catalog.product.related</name></action>
        </reference>
        <reference name="product.info.additional">
            <action method="unsetChild" ifconfig="easy_tabs/general/tagstabbed"><name>product_tag_list</name></action>
            <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs">
                <action method="setTemplate" ifconfig="easy_tabs/general/enabled"><template>easytabs/tabs.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/general/descriptiontabbed"><alias>description_tabbed</alias><title>Description</title><block>catalog/product_view_description</block><template>easytabs/description.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/general/additionaltabbed"><alias>additional_tabbed</alias><title>Specification</title><block>catalog/product_view_attributes</block><template>easytabs/attributes.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/general/upsellproductstabbed"><alias>upsell_products_tabbed</alias><title>We Also Recommend</title><block>catalog/product_list_upsell</block><template>catalog/product/list/upsell.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/general/relatedtabbed"><alias>related_tabbed</alias><title>Related Products</title><block>catalog/product_list_related</block><template>easytabs/catalogproductrelated.phtml</template></action>
                <action method="addTab" translate="title" module="tag"     ifconfig="easy_tabs/general/tagstabbed"><alias>tags_tabbed</alias><title>Product Tags</title><block>tag/product_list</block><template>easytabs/catalogproducttags.phtml</template></action>
                <action method="addTab" translate="title" module="review"  ifconfig="easy_tabs/general/reviewtabbed"><alias>review_tabbed</alias><title>Reviews</title><block>review/product_view_list</block><template>easytabs/catalogproductreview.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/custom/customtab"><alias>custom</alias><title>Custom tab</title><block>catalog/product_view</block><template>downloads/block_file_links.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/custom/customtab1"><alias>custom1</alias><title>Custom tab</title><block>catalog/product_view</block><template>easytabs/catalogproductcustom1.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/custom/customtab2"><alias>custom2</alias><title>Custom tab</title><block>catalog/product_view</block><template>easytabs/catalogproductcustom2.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/custom/customtab3"><alias>custom3</alias><title>Custom tab</title><block>catalog/product_view</block><template>easytabs/catalogproductcustom3.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/custom/customtab4"><alias>custom4</alias><title>Custom tab</title><block>catalog/product_view</block><template>easytabs/catalogproductcustom4.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/customcms/tabcms"><alias>cms</alias><title>CMS tab</title><block>core/template</block><template>easytabs/catalogproductcms.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/customcms/tabcms1"><alias>cms1</alias><title>CMS tab</title><block>core/template</block><template>easytabs/catalogproductcms1.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/customcms/tabcms2"><alias>cms2</alias><title>CMS tab</title><block>core/template</block><template>easytabs/catalogproductcms2.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/customcms/tabcms3"><alias>cms3</alias><title>CMS tab</title><block>core/template</block><template>easytabs/catalogproductcms3.phtml</template></action>
                <action method="addTab" translate="title" module="catalog" ifconfig="easy_tabs/customcms/tabcms4"><alias>cms4</alias><title>CMS tab</title><block>core/template</block><template>easytabs/catalogproductcms4.phtml</template></action>
                <action method="addTab" translate="title" module="downloads">
                    <alias>downloads_test</alias>
                    <title>Downloads test</title>
                    <block>downloads/product</block>
                    <template>downloads/block_file_links.phtml</template>
                </action>
                <action method="unsetChild"><name>downloads_test</name></action>
            </block>
        </reference>
    </catalog_product_view>
</layout>

答案 1 :(得分:0)

MageWorx的文件下载扩展应与TM_EasyTabs完全兼容。 问题最可能的原因是FileDownloads扩展在EasyTabs之前加载。要解决此问题,请尝试编辑文件app / etc / modules / MageWorx_Downloads.xml

From:
<config>
    <modules>
        <MageWorx_Downloads>
            <active>true</active>
            <codePool>local</codePool>
            <extension_name><![CDATA[File Downloads & Product Attachments]]></extension_name>
        </MageWorx_Downloads>
    </modules>
</config>

To:
<config>
    <modules>
        <MageWorx_Downloads>
            <active>true</active>
            <codePool>local</codePool>
            <extension_name><![CDATA[File Downloads & Product Attachments]]></extension_name>
            <depends><TM_EasyTabs /></depends>
        </MageWorx_Downloads>
    </modules>
</config>

如果这没有帮助,请随时联系MageWorx的支持团队。