0

I need to move a subscription block from MageMonkey module.

Here is the magemonkey.xml file and block that I want to move:

<checkout_onepage_review>
    <reference name="checkout.onepage.review.info.items.after">
        <block type="monkey/checkout_subscribe" name="magemonkey.subscribe"
               template="magemonkey/checkout/subscribe.phtml">
            <block type="monkey/signup" name="left.monkeysignup" template="magemonkey/lists.phtml"/>
        </block>
    </reference>
</checkout_onepage_review>

Here is my checkout.xml file with the review block:

<checkout_onepage_review translate="label">
    <label>One Page Checkout Overview</label>
    <!-- Mage_Checkout -->
    <remove name="right"/>
    <remove name="left"/>

    <block type="checkout/onepage_review_info" name="root" output="toHtml" template="checkout/onepage/review/info.phtml">
        <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/onepage/review/item.phtml</template></action>
        <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/onepage/review/item.phtml</template></action>
        <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/onepage/review/item.phtml</template></action>
        <block type="checkout/cart_totals" name="checkout.onepage.review.info.totals" as="totals" template="checkout/onepage/review/totals.phtml"/>
        <block type="core/text_list" name="checkout.onepage.review.info.items.before" as="items_before" translate="label">
            <label>Items Before</label>
        </block>
        <block type="core/text_list" name="checkout.onepage.review.info.items.after" as="items_after" translate="label">
            <label>Items After</label>
        </block>
          <block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="checkout/onepage/agreements.phtml" />
        <block type="core/template" name="checkout.onepage.review.button" as="button" template="checkout/onepage/review/button.phtml"/>
    </block>
</checkout_onepage_review>

I want to move the magemonkey.subscribe to go below the checkout.onepage.agreements. I tried that but didn't work:

  <checkout_onepage_review>
      <reference name="checkout.onepage.agreements">
          <block type="monkey/checkout_subscribe" name="magemonkey.subscribe"
                 template="magemonkey/checkout/subscribe.phtml" output="toHtml">
              <block type="monkey/signup" name="left.monkeysignup" template="magemonkey/lists.phtml"/>
          </block>
      </reference>
  </checkout_onepage_review>

I can move it to the checkout.onepage.review.info.items.before and it work fine so I am guessing this has something to do with the type of the block I am trying to move it to. I added output="toHtml" but that didn't work either. Any one knows what I am doing wrong?

I also tried:

<!-- Checkout -->
  <checkout_onepage_review>
      <reference name="root">
          <block type="monkey/checkout_subscribe" name="magemonkey.subscribe"
                 template="magemonkey/checkout/subscribe.phtml" output="toHtml" before="checkout.onepage.review.button">
              <block type="monkey/signup" name="left.monkeysignup" template="magemonkey/lists.phtml" />
          </block>
      </reference>
  </checkout_onepage_review>
<!-- Checkout -->

But still no luck.

Am I even looking in the right place? This is driving me insane now...

0

Hands down people. I got it...

In magemonkey.xml file, I only had to change the reference name. So my code looks like this now:

<!-- Checkout -->
      <checkout_onepage_review>
          <reference name="checkout.onepage.agreements">
              <block type="monkey/checkout_subscribe" name="magemonkey.subscribe"
                     template="magemonkey/checkout/subscribe.phtml">
                  <block type="monkey/signup" name="left.monkeysignup" template="magemonkey/lists.phtml" />
              </block>
          </reference>
      </checkout_onepage_review>
    <!-- Checkout -->

Now, in the template file of the block I want it to move to (In this case, agreements.phtml), I had to call the block. So added this one line to the file:

<?php echo $this->getChildHtml('magemonkey.subscribe') ?>

That solved my problem! I hope it will help someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.