2

I need to add product options (preference tab) to a new tab along Descrition, Additional, Tags, Review etc like in image. enter image description here

I am using below xml layout in <catalog_product_view>.

<reference name="product.info.additional">
        <action method="unsetChild"><name>product_tag_list</name></action>
        <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs">
            <action method="setTemplate" ><template>catalog/product/view/tabs.phtml</template></action>
            <action method="addTab" translate="title" module="catalog" ><alias>preferences_tabbed</alias><title>Preferences</title><block>catalog/product_view_options</block><template>catalog/product/view/preferences.phtml</template></action>
            <action method="addTab" translate="title" module="catalog" ><alias>description_tabbed</alias><title>Description</title><block>catalog/product_view_description</block><template>catalog/product/view/description.phtml</template></action>
            <action method="addTab" translate="title" module="catalog" ><alias>additional_tabbed</alias><title>Additional</title><block>catalog/product_view_attributes</block><template>catalog/product/view/attributes.phtml</template></action>
            <action method="addTab" translate="title" module="tag" ><alias>tags_tabbed</alias><title>Tags</title><block>tag/product_list</block><template>tag/list.phtml</template></action>
            <action method="addTab" translate="title" module="review" ><alias>review_tabbed</alias><title>Reviews</title><block>review/product_view_list</block><template>review/product_info_review.phtml</template></action>
        </block>
    </reference>

catalog/product/view/preferences.phtml has this bunch of code copied from view.phtml. I know what it does.

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

I don't have idea how to declare container2 as child inside the Preferences tab.

Please help me if you have an idea.

0

2 Answers 2

1

Here is now it can be solved,

It needed to add options block into preferences_tabbed reference in catalog_product_view.

<reference name="product.info.additional">
    <action method="unsetChild"><name>product_tag_list</name></action>
    <block type="catalog/product_view_tabs" name="product.info.tabs" as="info_tabs">
        <action method="setTemplate" ><template>catalog/product/view/tabs.phtml</template></action>
        <action method="addTab" translate="title" module="catalog" ><alias>preferences_tabbed</alias><title>Preferences</title><block>catalog/product_view_options</block><template>catalog/product/view/preferences.phtml</template></action>
        <action method="addTab" translate="title" module="catalog" ><alias>description_tabbed</alias><title>Description</title><block>catalog/product_view_description</block><template>catalog/product/view/description.phtml</template></action>
        <action method="addTab" translate="title" module="catalog" ><alias>additional_tabbed</alias><title>Additional</title><block>catalog/product_view_attributes</block><template>catalog/product/view/attributes.phtml</template></action>
        <action method="addTab" translate="title" module="tag" ><alias>tags_tabbed</alias><title>Tags</title><block>tag/product_list</block><template>tag/list.phtml</template></action>
        <action method="addTab" translate="title" module="review" ><alias>review_tabbed</alias><title>Reviews</title><block>review/product_view_list</block><template>review/product_info_review.phtml</template></action>
    </block>
</reference>

In above xml there is block named/aliased preferences_tabbed. Now let's add options block.

<reference name="preferences_tabbed">
    <block type="core/template_facade" name="product.info.container2" as="container2">
        <action method="setDataByKey"><key>alias_in_layout</key><value>container2</value></action>
        <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
        <action method="append"><block>product.info.options.wrapper</block></action>
        <action method="append"><block>product.info.options.wrapper.bottom</block></action>
    </block>
</reference>

That's it. Now the configuration options will display in the Preferences tab.

NOTE: Please note, you might need to readjust the position <form id="product_addtocart_form" .... and it's closing tag to wrap whole view.phtml page.

0

try this

<block type="catalog/product_view_attributes" name="Your_attribute_name" as="additional" template="catalog/product/view/attributes.phtml"> <action method="addToParentGroup"><group>detailed_info</group></action> <action method="setTitle" translate="value"><value>Your tab name</value></action> </block>

or

Try this Extension free extension

http://www.magentocommerce.com/magento-connect/free-products-tabs-extension-for-magento.html

1
  • #Kothari thanks, but this isn't the solution I am looking for. I already have the attributes into the tab (Additional). I want to add configuration options like (select menu of size/color etc) into above image tab Preferences.
    – rbncha
    Nov 17, 2015 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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