Magento 1.5.01 - 覆盖客户模块后我无法加载模板

发布于 2024-11-08 06:51:11 字数 3012 浏览 0 评论 0原文

这是我在这里的第一篇文章,所以请提前原谅我:)

我一直在努力覆盖客户模块以实现某些特定的功能 功能取决于用户组;我想复制并 附加到针对特定用户的用户注册表 团体。

我已经成功地覆盖并扩展了我的方式 但是我想使用控制器、模型和块类 当我重写块类时,我指向的布局不是 渲染时间更长。

这是布局代码的相关块:

<customer_account_vcreate translate="label">
    <label>Customer Account Registration Form</label>
    <!-- Mage_Customer -->
    <remove name="right"/>
    <remove name="left"/>

    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>
    <reference name="content">
        <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
            <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
                <label>Form Fields Before</label>
            </block>
        </block>
    </reference>
</customer_account_vcreate>

我知道它现在只是指向常规块/模板,但即使这样也不会加载。该块加载得很好(我可以从构造函数输出),似乎布局文件不再被加载。

我也尝试过覆盖类似问题的登录表单,有人可以帮忙吗?

杰夫

编辑- 这是登录块的更完整的问题: 这是我的配置:

<?xml version="1.0"?>
<config>
<modules>
    <Izoox_Customer>
        <version>1.0.1</version>
    </Izoox_Customer>
</modules>
<frontend>
    <routers>
        <customer>
            <args>
                <modules>
                    <Izoox_Customer before="Mage_Customer">Izoox_Customer_Customer</Izoox_Customer>
                </modules>
            </args>
        </customer>
    </routers>
    <layout>
      <updates>
        <customer>
          <file>izooxcustomer.xml</file>
        </customer>
      </updates>
    </layout>
</frontend>
<global>
    <blocks>
        <customer>
            <rewrite><form_login>Izoox_Customer_Block_Form_Login</form_login>
            </rewrite>
        </customer>
    </blocks>
</global>
</config>

当我从上面的配置中删除块代码时,它会起作用,除非我没有从块中获取任何自定义代码。

上面我已经重写了 Customer 模块以在此处使用我自己的代码,并使用我自己的块重写了 customer_login 块。我可以看到自定义块通过回显 _prepareLayout() 函数来加载,但视图文件 (login.phtml) 似乎没有加载。这是布局(izooxcustomer.xml),它也可以正常加载。

<customer_account_login translate="label">
    <label>Customer Account Login Form</label>
    <!-- Mage_Customer -->


    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>

    <reference name="content">
        <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
    </reference>
</customer_account_login>

我错过了什么,还是这根本不可能?

谢谢, 杰夫

This is my first post here, so please forgive me in advance :)

I've been working on overriding the Customer module for some specific
functionality depending on the user group; I want to duplicate and
append to the user registration form that targets the specific user
group.

I have successfully overridden and extended my way through the
controller, model, and block classes that I would like to use, however
when I override the block class, the layout i'm pointing to is no
longer rendered.

Here's the relevant chunk of the layout code:

<customer_account_vcreate translate="label">
    <label>Customer Account Registration Form</label>
    <!-- Mage_Customer -->
    <remove name="right"/>
    <remove name="left"/>

    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>
    <reference name="content">
        <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
            <block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
                <label>Form Fields Before</label>
            </block>
        </block>
    </reference>
</customer_account_vcreate>

I know that it just points to the regular block/template right now, but even that isn't loading. The block loads just fine (I can output from the constructor), it just seems that the layout file is not being loaded anymore.

I've also tried to override the login form with similar problems, can anyone help?

Geoff

EDIT -
Here's a more complete question for the login block:
Here's my config:

<?xml version="1.0"?>
<config>
<modules>
    <Izoox_Customer>
        <version>1.0.1</version>
    </Izoox_Customer>
</modules>
<frontend>
    <routers>
        <customer>
            <args>
                <modules>
                    <Izoox_Customer before="Mage_Customer">Izoox_Customer_Customer</Izoox_Customer>
                </modules>
            </args>
        </customer>
    </routers>
    <layout>
      <updates>
        <customer>
          <file>izooxcustomer.xml</file>
        </customer>
      </updates>
    </layout>
</frontend>
<global>
    <blocks>
        <customer>
            <rewrite><form_login>Izoox_Customer_Block_Form_Login</form_login>
            </rewrite>
        </customer>
    </blocks>
</global>
</config>

It works when I remove the block code from the above config, except then I'm not getting any of my custom code from the block.

Above I have overridden the Customer module to use my own code here, and have overridden the customer_login block with my own block. I can see that the custom block loads by echoing out of the _prepareLayout() function, but the view file (login.phtml) doesn't seem to load. Here's the layout (izooxcustomer.xml), which also loads fine.

<customer_account_login translate="label">
    <label>Customer Account Login Form</label>
    <!-- Mage_Customer -->


    <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>

    <reference name="content">
        <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
    </reference>
</customer_account_login>

Am I missing something, or is this just not possible?

Thanks,
Geoff

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

狠疯拽 2024-11-15 06:51:11

看起来您的主布局标签拼写错误。它应该是。在创建之前你有一个“v”。

Looks like you have your main layout tag misspelled. It should be <customer_account_create>. You have a 'v' in there before create.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文