magento产品

magento产品,magento,Magento,我已经在万磁论坛上发布了这个问题,但两周内还没有发布任何内容,所以我将在这里发布,希望能获得更多的见解 “我一直在浏览论坛,研究如何更改一个产品的视图,我在论坛上找到了一篇很好的帖子,让我可以随心所欲地更改视图,但我的页面似乎是由两个不同的文件创建的。其中一个在app/design/frontend/base/default/template/catalog/product中名为view.phtml,另一个在同一路径中名为default.phtml,位于另外两个目录view/type/。我需要修

我已经在万磁论坛上发布了这个问题,但两周内还没有发布任何内容,所以我将在这里发布,希望能获得更多的见解

“我一直在浏览论坛,研究如何更改一个产品的视图,我在论坛上找到了一篇很好的帖子,让我可以随心所欲地更改视图,但我的页面似乎是由两个不同的文件创建的。其中一个在app/design/frontend/base/default/template/catalog/product中名为view.phtml,另一个在同一路径中名为default.phtml,位于另外两个目录view/type/。我需要修改的代码是default.phtml,但当我这样做并将其设置为display时,它将停止显示页面的另一半或view.phtml部分

我在用

<reference name="product.info">
<action method="setTemplate">              
<template>catalog/product/view/type/default1.phtml</template></action>
</reference>

//
它不起作用的原因是view.phtml有点像产品视图页面的父块,因此当您禁用它时,它只显示大小部分,而当您启用它时,您会得到错误的大小部分

您需要做的是在view.phtml中告诉它有关新大小调整模板的信息

这是通过首先创建一个块,然后为其分配一个模板,然后在view.phtml文件中调用它来完成的

最简单的方法是找出第一个尺寸块的名称,然后在xml中查找并复制它,然后将其名称更改为唯一的名称,并将模板更改为新文件

然后进入view.phtml文件并按要显示的名称调用块

在您的情况下,我认为以下几行需要更改:

<?php if ($_product->isSaleable() && $this->hasOptions()):?>
    <?php echo $this->getChildChildHtml('container2', '', true, true) ?>
<?php endif;?>

应改为:

<?php if ($_product->isSaleable() && $this->hasOptions()):?>
    <?php echo $this->getChildHtml('your_new_block_name') ?>
<?php endif;?>

好的,我找到了包含我的尺码表块的代码

 <?php echo $this->getChildHtml('product_type_data') ?>

当我把它评论出来时,我得到了我期望的结果,我的尺码表也消失了 在Catalog.xml中,我找到了我认为的代码(有几个Catalog.xml文件,有没有办法确保我找到了正确的文件?)

不管怎样,我在那里找到的代码是

<PRODUCT_TYPE_simple translate="label" module="catalog">
        <label>Catalog Product View (Simple)</label>
        <reference name="product.info">
            <block type="catalog/product_view_type_simple" name="product.info.simple"as="product_type_data" template="catalog/product/view/type/default.phtml">
            <block type="core/text_list" name="product.info.simple.extra" as="product_type_data_extra" translate="label">
                <label>Product Extra Info</label>
            </block>
        </block>
    </reference>
</PRODUCT_TYPE_simple>
<PRODUCT_TYPE_configurable translate="label" module="catalog">
    <label>Catalog Product View (Configurable)</label>
    <reference name="product.info">
        <block type="catalog/product_view_type_configurable" name="product.info.configurable" as="product_type_data" template="catalog/product/view/type/default.phtml">
            <block type="core/text_list" name="product.info.configurable.extra" as="product_type_data_extra" translate="label">
                <label>Product Extra Info</label>
            </block>
        </block>
    </reference>
    <reference name="product.info.options.wrapper">
        <block type="catalog/product_view_type_configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable.phtml"/>
    </reference>
</PRODUCT_TYPE_configurable>

目录产品视图(简单)
产品附加信息
目录产品视图(可配置)
产品附加信息
我补充说

<PRODUCT_TYPE_simple translate="label" module="catalog">
    <label>Catalog Product View (Simple)</label>
    <reference name="product.info">
        <block type="catalog/product_view_type_simple" name="product.info.simple" as="product_type_data1" template="catalog/product/view/type/default1.phtml">
            <block type="core/text_list" name="product.info.simple.extra" as="product_type_data_extra" translate="label">
                <label>Product Extra Info</label>
            </block>
        </block>
    </reference>
</PRODUCT_TYPE_simple>

目录产品视图(简单)
产品附加信息


目录产品视图(可配置)
产品附加信息
然后我把调用php的代码改成

<?php echo $this->getChildHtml('product_type_data1') ?>


但是我在翻译中遗漏了一些东西,这些东西可以通过启用“调试模式”来帮助您找到页面上使用的块。您可以通过进入管理面板并转到系统->配置来启用它,然后在左侧导航中将“当前配置范围”从“默认配置”切换到“您的商店名称Web商店”

页面将自动刷新,然后在“高级”部分的左导航底部单击“开发人员”,然后在手风琴的“调试”部分,您将看到“模板路径提示”和“将块名称添加到提示”将每个选择字段切换为“是”,然后单击页面右上角的“保存配置”按钮


调试模式激活后,所有块都将以红色勾勒,并标有模板位置和块名称参考。希望这对将来有所帮助

我真的很感谢你花时间回答我的问题,我理解你告诉我的,我不确定我是否理解如何实施它。这是我的第一个Magento网站,我在这里找到了关于模板和布局的教程,我需要仔细阅读并理解它,但是客户已经等了一周左右了,我该如何跟踪带有尺寸块的xml文件?当然,很乐意提供帮助:)您所能做的就是浏览您的phtml文件,每次遇到“echo$this->getChildhtml('name_of_block')”或“echo$this->getChildhtml('name_of_block')”时,将其注释掉,并查看哪一个去掉了尺寸块。一旦您知道了块的名称,就可以检查“catalog.xml”来查找它。如果没有,您可以通过grep搜索所有xml文件(但应该在catalog.xml中)。如果您还有其他问题,请毫不犹豫地提问:)在这里寻找更多的指导pzirkind,您看到我哪里出错了吗?您需要的catalog.xml就是主题布局文件夹中的catalog.xml(您可以在后端系统->配置->设计中找到您的主题,并查看“包”和“主题”部分以获得正确的目录)。您可能还需要刷新缓存。另外,通过添加带有数据的标记来进行故障排除,以查看它是否命中phtml文件猜测谁得到了可接受的答案!!是的!恕我直言,我不愿意承认这一点,但“刷新缓存”是问题所在!很长时间没有考虑此选项,这是一个真正的省时功能。
<PRODUCT_TYPE_simple translate="label" module="catalog">
    <label>Catalog Product View (Simple)</label>
    <reference name="product.info">
        <block type="catalog/product_view_type_simple" name="product.info.simple" as="product_type_data1" template="catalog/product/view/type/default1.phtml">
            <block type="core/text_list" name="product.info.simple.extra" as="product_type_data_extra" translate="label">
                <label>Product Extra Info</label>
            </block>
        </block>
    </reference>
</PRODUCT_TYPE_simple>
<PRODUCT_TYPE_configurable translate="label" module="catalog">
    <label>Catalog Product View (Configurable)</label>
    <reference name="product.info">
        <block type="catalog/product_view_type_configurable" name="product.info.configurable" as="product_type_data1" template="catalog/product/view/type/default1.phtml">
            <block type="core/text_list" name="product.info.configurable.extra" as="product_type_data_extra" translate="label">
                <label>Product Extra Info</label>
            </block>
        </block>
    </reference>
    <reference name="product.info.options.wrapper">
        <block type="catalog/product_view_type_configurable" name="product.info.options.configurable" as="options_configurable" before="-" template="catalog/product/view/type/options/configurable.phtml"/>
    </reference>
</PRODUCT_TYPE_configurable>
<?php echo $this->getChildHtml('product_type_data1') ?>