getChild method in a module doesn't seem to refer to a child(?) - magento

I am using the Meanbee Infinite Scroll module in my project. I have it working for normal category product listings. But now I'm attempting to have it activate on my custom made module.
However I am stumped over line 68 in Script.php:
66 return (
67 $block !== false &&
68 $block->getChild('toolbar') !== false && // <-- This line
69 $this->_getPagerBlock() !== false &&
70 $this->_getPagerBlock()->getCollection()
71 );
There is no xml element that has attribute name of toolbar. Even in the normal category xml that is working. So what is "toolbar" refering to?
A var_dump($block->getChild('toolbar')); returns false on my page but not on the normal category product listing page.
My XML is as follows (for clarity):
<block type="mynamespace/mymodule" name="mymodule.view" template="mynamespace/mymodule/view.phtml">
<block type="catalog/product_list" name="product_list" template="toxicfox/giftfinder/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
And the core XML (which works with the Infinite Scroll module) is:
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
As you can see, neither block of XML has any element with an attribute name of "toolbar". The only difference is line 1.
Any help is appreciated.

In the Mage_Catalog_Block_Product_List::_beforeToHtml() method, the toolbar block is retrieved from the layout with the name that was indicated by the setToolbarBlockName action, then set as a child block of the products list with the toolbar alias.
In your case, the problem may be that the $block hasn't been output yet with toHtml(), so that it doesn't know yet about its toolbar child, or something of this kind (hard to say because the extension is commercial).

Related

How to move a block from content to custom place

The block below is added to the bottom of content. I want this block to be called from within the catalog/product/view.phtml. So i can place it with $this->getChildHtml().
</PRODUCT_TYPE_bundle>
<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_bundle.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_bundle.phtml"/>
<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart_bundle.phtml"/>
</block>
</reference>
</PRODUCT_TYPE_bundle>
How to do this ? Do I add a new reference ? like :
<reference name="content">
<reference name="blockname">
<block></block>
</reference>
</reference>

My custom option not working on Right panel on view page

I am working on a Magento store, the requirement is to move the custom option to right panel.
I already did it, by moving some lines in catalog.xml file.
<reference name="content">
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
<!--
<action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/summary.phtml</template></action>
<action method="addReviewSummaryTemplate"><type>short</type><template>review/helper/summary_short.phtml</template></action>
<action method="addReviewSummaryTemplate"><type>...</type><template>...</template></action>
-->
<block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>
<block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
<label>Alert Urls</label>
</block>
<action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action>
<block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml">
<action method="setColumnCount"><columns>4</columns></action>
<action method="setItemLimit"><type>upsell</type><limit>4</limit></action>
</block>
<block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" />
<block type="catalog/product_view_description" name="product.description" as="description" template="catalog/product/view/description.phtml">
<action method="addToParentGroup"><group>detailed_info</group></action>
</block>
<block type="catalog/product_view_attributes" name="product.attributes" as="additional" template="catalog/product/view/attributes.phtml">
<action method="addToParentGroup"><group>detailed_info</group></action>
</block>
<block type="catalog/product_view" name="product.info.addto" as="addto" template="catalog/product/view/addto.phtml"/>
<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart.phtml"/>
<block type="core/text_list" name="product.info.extrahint" as="extrahint" translate="label">
<label>Product View Extra Hint</label>
</block>
</block>
</reference>
<reference name="right">
<!--#####################################################-->
<block type="catalog/product_view" name="product.info.options.wrapper" as="product_options_wrapper" template="catalog/product/view/options/wrapper.phtml" translate="label">
<label>Info Column Options Wrapper</label>
<block type="core/template" name="options_js" template="catalog/product/view/options/js.phtml"/>
<block type="catalog/product_view_options" name="product.info.options" as="product_options" template="catalog/product/view/options.phtml">
<action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action>
<action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action>
<action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action>
<action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action>
</block>
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
</block>
<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.addtocart</block></action>
<action method="append"><block>product.info.addto</block></action>
</block>
<block type="core/template_facade" name="product.info.container1" as="container1">
<action method="setDataByKey"><key>alias_in_layout</key><value>container1</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>
<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>
<action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
<action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
<!--#####################################################-->
<block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/>
</reference>
Now it is on right panel and price change also working fine,
But the problem is that when i am going to submit it by select one
it showing me an error like "Please specify the product required option(s)."
this is for unable to take the attribute vale.
like size (XL, XXL)
If any one know this, please help me thank you
The problem is that the options block appeares out of the main product form, and validator highlights you an error after submitting the form.
The solution
Do not move the options block out of the "product.info" block in layout, because this block contains the main product form. You need to modify catalog/product/view.phtml template to achieve the desired result.

custom tab to product detail page fro configurable products only

i used below code to add custom tab to product detail page
<block type="catalog/product_view_description" name="product.description" as="description" template="catalog/product/view/description.phtml">
<action method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle" translate="value"><value>Description</value></action>
</block>
now i want to show it only for configurable product what should i do for it ?..
You should add your code in "PRODUCT_TYPE_configurable" handle in catalog.xml instead of "catalog_product_view" .
Start fro 275 line change :
<PRODUCT_TYPE_configurable translate="label" module="catalog">
<label>Catalog Product View (Configurable)</label>
<reference name="product.info">
<block type="catalog/product_view_description" name="product.description" as="description"
template="catalog/product/view/description.phtml">
<action method="addToParentGroup">
<group>detailed_info</group>
</action>
<action method="setTitle" translate="value">
<value>Description</value>
</action>
</block>
<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>

Inchoo’s FB Connect Magento module doesn’t work on custom theme

Inchoo’s FB Connect module doesn't work on custom theme, but does on the default theme. So obviously the custom theme is missing something or having a conflict with it, which I need to figure out.
Are there any general things which I need to look for?
I found out that it attaches its output to after_body_start block, but on custom theme it doesn’t output its FB related markup and script over there. Mage’s Google analytics code is output in the html at the same block and that is working fine, so I am a bit lost here.
Inchoo's fb connect module xml - https://github.com/ivanweiler/Inchoo_Facebook/blob/master/app/design/frontend/default/default/layout/inchoo/facebook.xml
Also page.xml of the custom theme has this reference:
<block type="core/text_list" name="after_body_start" as="after_body_start" />
Complete page.xml of custom theme:
<default translate="label" module="page">
<label>All Pages</label>
<block type="page/html" name="root" output="toHtml" template="page/2columns-left.phtml">
<block type="page/html_head" name="head" as="head">
<action method="addItem"><type>skin_js</type><name>js/jquery-1.4.2.min.js</name></action>
<action method="addItem"><type>skin_js</type><name>slides-carousel/slides.min.jquery.js</name></action>
<action method="addItem"><type>skin_js</type><name>slides-carousel/slides-init.js</name></action>
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addJs" ifconfig="dev/js/deprecation"><script>prototype/deprecation.js</script></action>
<action method="addJs"><script>lib/ccard.js</script></action>
<action method="addJs"><script>prototype/validation.js</script></action>
<action method="addJs"><script>scriptaculous/builder.js</script></action>
<action method="addJs"><script>scriptaculous/effects.js</script></action>
<action method="addJs"><script>scriptaculous/dragdrop.js</script></action>
<action method="addJs"><script>scriptaculous/controls.js</script></action>
<action method="addJs"><script>scriptaculous/slider.js</script></action>
<action method="addJs"><script>varien/js.js</script></action>
<action method="addJs"><script>varien/form.js</script></action>
<action method="addJs"><script>varien/menu.js</script></action>
<action method="addJs"><script>mage/translate.js</script></action>
<action method="addJs"><script>mage/cookies.js</script></action>
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
<action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 8</if></action>
<action method="addCss"><stylesheet>css/niceforms-default.css</stylesheet></action>
<action method="addCss"><stylesheet>css/widgets.css</stylesheet></action>
<action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action>
<action method="addCss"><stylesheet>slides-carousel/slides.css</stylesheet></action>
<action method="addCss"><stylesheet>css/niceforms-default.css</stylesheet></action>
<action method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt IE 7</if></action>
<action method="addItem"><type>skin_js</type><name>js/niceforms.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt IE 7</if></action>
</block>
<block type="core/text_list" name="after_body_start" as="after_body_start"/>
<block type="page/html_notices" name="global_notices" as="global_notices" template="page/html/notices.phtml" />
<block type="page/html_header" name="header" as="header">
<block type="page/template_links" name="top.links" as="topLinks"/>
<block type="page/switch" name="store_language" as="store_language" template="page/switch/flags.phtml"/>
<block type="core/text_list" name="top.menu" as="topMenu"/>
<block type="page/html_wrapper" name="top.container" as="topContainer" translate="label">
<label>Page Header</label>
<action method="setElementClass"><value>top-container</value></action>
</block>
<block type="directory/currency" name="currency" template="directory/currency_small.phtml"/>
<block type="page/switch" name="ie" as="ie" template="page/ie/ie6.phtml"/>
</block>
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
<block type="core/text_list" name="left" as="left" translate="label">
<label>Left Column</label>
</block>
<block type="core/messages" name="global_messages" as="global_messages"/>
<block type="core/messages" name="messages" as="messages"/>
<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
</block>
<block type="core/text_list" name="right" as="right" translate="label">
<label>Right Column</label>
</block>
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
<label>Page Footer</label>
<action method="setElementClass"><value>bottom-container</value></action>
</block>
<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
</block>
<block type="core/text_list" name="before_body_end" as="before_body_end"/>
</block>
<block type="core/profiler" output="toHtml" name="core_profiler"/>
</default>
<print translate="label" module="page">
<label>All Pages (Print Version)</label>
<!-- Mage_Page -->
<block type="page/html" name="root" output="toHtml" template="page/print.phtml">
<block type="page/html_head" name="head" as="head">
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addJs"><script>mage/translate.js</script></action>
<action method="addJs"><script>lib/ccard.js</script></action>
<action method="addJs"><script>prototype/validation.js</script></action>
<action method="addJs"><script>varien/js.js</script></action>
<action method="addCss"><stylesheet>css/styles.css</stylesheet></action>
<action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 8</if></action>
<action method="addCss"><stylesheet>css/widgets.css</stylesheet></action>
<action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action>
<action method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt IE 7</if></action>
<action method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt IE 7</if></action>
</block>
<block type="core/text_list" name="content" as="content" translate="label">
<label>Main Content Area</label>
</block>
</block>
</print>
<!-- Custom page layout handles -->
<page_empty translate="label">
<label>All Empty Layout Pages</label>
<reference name="root">
<action method="setTemplate"><template>page/empty.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
</page_empty>
<page_one_column translate="label">
<label>All One-Column Layout Pages</label>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
</page_one_column>
<page_two_columns_left translate="label">
<label>All Two-Column Layout Pages (Left Column)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
</page_two_columns_left>
<page_two_columns_right translate="label">
<label>All Two-Column Layout Pages (Right Column)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
</page_two_columns_right>
<page_three_columns translate="label">
<label>All Three-Column Layout Pages</label>
<reference name="root">
<action method="setTemplate"><template>page/3columns.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
</page_three_columns>
Where else should I be looking for?
From my understanding ,you want to use inchoo's facebook-connect-magento-extension in your custom theme.However I managed to use fb connect in my custom theme. I did the following changes.
Step 1: After downloading the inchoo's facebook-connect-magento-extension,on opening the app folder ,copied Inchoo folder from /app/code/community/ and paste into /app/code/local/ in your installed magento_folder.
Step 2: Copy 'layout' and 'template' from /app/design/frontend/default/default and paste it under your theme folder theme_folder/.
Step 3: Copy 'Inchoo_Facebook.xml' from app/etc/modules into your app/etc/modules and edit Inchoo_Facebook.xml change <codePool>community</codePool> to <codePool>local</codePool> like this
<config>
<modules>
<Inchoo_Facebook>
<active>true</active>
<codePool>local</codePool>
</Inchoo_Facebook>
</modules>
</config>
Step 4: Copy /app/locale to /app/locale in your magento folderP.S : Apply permission.Hope this helps.

Magento - Add CMS Block to One Page

I have this code in a xml layout file:
<reference name="left">
<block type="blog/blog" name="left.blog.menu" before="-">
<action method="setTemplate" ifconfig="blog/menu/left">
<template>aw_blog/menu.phtml</template>
</action>
<block type="blog/tags" name="blog_tags" />
</block>
</reference>
I want to add a cms static block to the blog pages using this code:
<block type="cms/block" name="brand_list">
<action method="setBlockId"><block_id>brand_list</block_id></action>
</block>
If I add it in directly after this line:
<reference name="left">
It works but it is then displayed on every page. How can I get it to show only on the blog pages?
Thanks.
Edit: Here is the entire xml file:
<layout version="0.1.0">
<default>
<reference name="footer_links">
<block type="blog/blog" name="add.blog.footer">
<block type="blog/tags" name="blog_tags" />
<action method="addFooterLink" ifconfig="blog/menu/footer"></action>
</block>
</reference>
<reference name="right">
<block type="blog/blog" name="right.blog.menu" before="-">
<action method="setTemplate" ifconfig="blog/menu/right" ifvalue="1">
<template>aw_blog/menu.phtml</template>
</action>
<block type="blog/tags" name="blog_tags" />
</block>
</reference>
<reference name="left">
<block type="blog/blog" name="left.blog.menu" before="-">
<action method="setTemplate" ifconfig="blog/menu/left">
<template>aw_blog/menu.phtml</template>
</action>
<block type="blog/tags" name="blog_tags" />
</block>
</reference>
<reference name="top.links">
<block type="blog/blog" name="add.blog.link">
<action method="addTopLink" ifconfig="blog/menu/top"></action>
<block type="blog/tags" name="blog_tags" />
</block>
</reference>
<reference name="head">
<action method="addItem"><type>skin_css</type><name>aw_blog/css/style.css</name></action>
</reference>
</default>
<blog_index_index>
<reference name="content">
<block type="blog/blog" name="blog" template="aw_blog/blog.phtml"/>
</reference>
</blog_index_index>
<blog_index_list>
<reference name="content">
<block type="blog/blog" name="blog" template="aw_blog/blog.phtml"/>
</reference>
</blog_index_list>
<blog_post_view>
<reference name="content">
<block type="blog/post" name="post" template="aw_blog/post.phtml">
<block type="socialbookmarking/bookmarks" name="bookmarks" template="bookmarks/bookmarks.phtml"/>
</block>
</reference>
</blog_post_view>
<blog_cat_view>
<reference name="content">
<block type="blog/cat" name="cat" template="aw_blog/cat.phtml" />
</reference>
</blog_cat_view>
<blog_rss_index>
<block type="blog/rss" output="toHtml" name="rss.blog.new"/>
</blog_rss_index>
</layout>
if it's going inside a section then it will be applied to all pages, you want to put the and its contents inside the sections (there'll be the listing page and individual post pages - the sections should already exist in the aw_blog.xml file
It appears on all pages, because you probably put the code in the section of the layout xml. Just put into a section named after the route where it should appear.
So try:
<blog>
<reference name="left">
<block type="cms/block" name="brand_list">
<action method="setBlockId"><block_id>brand_list</block_id></action>
</block>
</reference>
</blog>
Change XML inside folder theme/layout for example page.xml add something like this to header:
<block type="page/html_header" name="header" as="header">
<!-- ... some origin code ... -->
<block type="page/html" name="custom_block" as="flashHeader" template="customer/custom_header.phtml"/>
</block>
Create file customer/custom_header.phtml with your custom html code.
Inside template page/html/header.phtml you can add something like this:
$dataCurrentPage = $this->getHelper('cms/page')->getPage()->getData();
$page_id = (isset($dataCurrentPage['identifier'])) ? $dataCurrentPage['identifier'] : null;
if ($page_id == 'home' ) { echo this->getChildHtml('flashHeader') }
Flash banner will be show only on homepage.
You can definitely use the custom layout update to place your own static block on left without any coding.
You need to create a static block and then put its reference into custom layout update
<reference name="left">
<block type="cms/block" name="my_left_block" before="-">
<action method="setBlockId"><block_id>my_left_block</block_id></action>
</block>
to view an example follow the link below
https://lampjs.wordpress.com/2015/07/06/magento-add-static-cms-block-to-category-page-on-left/

Resources