3

I getting crazy with the template system from Magento.

I tried to change the load-order of my "Add to Cart" and "Add To" block for customize article. So that the "Add To" block gets loaded before the "Add to Cart" block. In my template I saw that the blocks are loaded from container1. Cataloge.xml showed me, that container1 is linked to product.info.options.wrapper.bottom . This file contains:

<div class="product-options-bottom">
<?php echo $this->getChildHtml('', true, true);?>
</div>

In my local.xml I edited:

<ajaxcart_index_options>
<reference name="content">
 <block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label">
            <label>Bottom Block Options Wrapper</label>
            <action method="insert"><block>product.tierprices</block></action>
            <block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/>
                <action method="append" before="addtocart"><block>product.info.addto</block></action>
                <action method="append" after="product.info.addto"><block>product.info.addtocart</block></action>
            </block>
</block>
</reference>
</ajaxcart_index_options>

I have no idea what I could do else, I tried after and before statements and I also placed the addto action block before the addtocart block, but nothing works.

Does anyone has an idea how I can change the load-order?

Thanks, Simon

2

Don't rely on before and after attributes because they only work with certain kinds of blocks (core/text_list). So your change as it is shouldn't have any result. More info here: https://stackoverflow.com/questions/14484955/magento-xml-using-before-after-to-place-blocks-hardly-ever-works

Instead, changing the order as you did, but in the right place, will work.

Try this in your local.xml (tested on mine and it is working):

<catalog_product_view translate="label">
        <reference name="content">
                <block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label">
                    <label>Bottom Block Options Wrapper</label>
                    <action method="insert"><block>product.tierprices</block></action>
                    <block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/>
                    <action method="append"><block>product.info.addto</block></action>

                    <action method="append"><block>product.info.addtocart</block></action>
                </block>
       </reference>
</catalog_product_view>
  • I tried it and it crashed my whole template. :/ I guess the statements have to be in the Ajaxcart, because <ajaxcart_index_options> loads also a new template for the addtocart button and this is working. – Simon Jun 2 '15 at 21:01

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.