Magento EE 1.11 - Customer Attributes Not Visible - magento

Our client wants to add an 'Industry' dropdown to customer registration. We have created a new customer attribute, 'industry' and entered in the appropriate values.
It was not showing on the front-end. I looked into customer/form/register.phtml and it wasn't calling anything for attributes, so I pulled from enterprise/default/template/customer/form/register.phtml the following:
<?php $customerAttributes = $this->getChild('customer_form_user_attributes');?>
<?php if ($customerAttributes): ?>
<?php $customerAttributes->setShowContainer(false);?>
<?php $this->restoreSessionData($customerAttributes->getForm());?>
<?php echo $customerAttributes->toHtml()?>
<?php endif;?>
And then I added in the .xml update found in 'enterprise/layout/customer.xml':
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<block type="page/html_wrapper" name="customer.form.register.fields.before" translate="label">
<label>Form Fields Before</label>
<!--action method="setMayBeInvisible"><value>1</value></action-->
<action method="setElementClass"><value>rewards</value></action>
</block>
<block type="enterprise_customer/form" template="customer/form/userattributes.phtml" name="customer_form_user_attributes">
<action method="setFormCode"><code>customer_account_create</code></action>
<action method="setEntityModelClass"><code>customer/customer</code></action>
</block>
<block type="enterprise_customer/form" template="customer/form/userattributes.phtml" name="customer_form_address_user_attributes">
<action method="setFormCode"><code>customer_register_address</code></action>
<action method="setEntityModelClass"><code>customer/address</code></action>
</block>
<reference name="content">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<action method="append"><block>customer.form.register.fields.before</block> <alias>form_fields_before</alias></action>
<action method="append"><block>customer_form_user_attributes</block> </action>
<action method="append"> <block>customer_form_address_user_attributes</block></action>
</block>
</reference>
<update handle="customer_form_template_handle"/>
At this point, the attributes are not visible on the front-end. If I perform:
<pre>
<?php print_r($customerAttributes->getUserDefinedAttributes()) ?>
</pre>
I am returned the array of attributes as I would expect. What am I missing here?

Found it. Needed this stuff in customer.xml. For some reason using the enterprise/default customer.xml wasn't working, but I added this in and it was good.
<customer_form_template_handle>
<reference name="content">
<block name="customer_form_template" type="enterprise_customer/form_template">
<action method="addRenderer">
<type>text</type>
<renderer_block>enterprise_customer/form_renderer_text</renderer_block>
<template>customer/form/renderer/text.phtml</template>
</action>
<action method="addRenderer">
<type>textarea</type>
<renderer_block>enterprise_customer/form_renderer_textarea</renderer_block>
<template>customer/form/renderer/textarea.phtml</template>
</action>
<action method="addRenderer">
<type>multiline</type>
<renderer_block>enterprise_customer/form_renderer_multiline</renderer_block>
<template>customer/form/renderer/multiline.phtml</template>
</action>
<action method="addRenderer">
<type>date</type>
<renderer_block>enterprise_customer/form_renderer_date</renderer_block>
<template>customer/form/renderer/date.phtml</template>
</action>
<action method="addRenderer">
<type>select</type>
<renderer_block>enterprise_customer/form_renderer_select</renderer_block>
<template>customer/form/renderer/select.phtml</template>
</action>
<action method="addRenderer">
<type>multiselect</type>
<renderer_block>enterprise_customer/form_renderer_multiselect</renderer_block>
<template>customer/form/renderer/multiselect.phtml</template>
</action>
<action method="addRenderer">
<type>boolean</type>
<renderer_block>enterprise_customer/form_renderer_boolean</renderer_block>
<template>customer/form/renderer/boolean.phtml</template>
</action>
<action method="addRenderer">
<type>file</type>
<renderer_block>enterprise_customer/form_renderer_file</renderer_block>
<template>customer/form/renderer/file.phtml</template>
</action>
<action method="addRenderer">
<type>image</type>
<renderer_block>enterprise_customer/form_renderer_image</renderer_block>
<template>customer/form/renderer/image.phtml</template>
</action>
</block>
</reference>
</customer_form_template_handle>

You should check template/customer/form/userattributes.phtml which is controlling user defined attributes. I don't know, does anybody touched this file? Check this first.
<?php foreach ($this->getUserDefinedAttributes() as $attribute):?>
<?php $attributeContent = $this->getAttributeHtml($attribute);?>
<?php if ($attributeContent): ?>
<li><?php echo $attributeContent;?></li>
<?php endif;?>
<?php endforeach;?>

Related

magento duplicate block twice in page sales order view

I have an installation of magento 1.9.2.1, I have a duplicate block rendering in some pages this is the code used in my custom theme sales.xml:
<sales_order_view translate="label">
<label>Customer My Account Order View</label>
<update handle="customer_account"/>
<reference name="my.account.wrapper">
<block type="sales/order_info" as="info" name="sales.order.info">
<block type="sales/order_info_buttons" as="buttons" name="sales.order.info.buttons" />
</block>
<block type="sales/order_view" name="sales.order.view">
<block type="sales/order_items" name="order_items" template="sales/order/items.phtml">
<action method="addItemRender"><type>default</type><block>sales/order_item_renderer_default</block><template>sales/order/items/renderer/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>sales/order_item_renderer_grouped</block><template>sales/order/items/renderer/default.phtml</template></action>
<block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
<action method="setLabelProperties"><value>colspan="2" class="a-right"</value></action>
<action method="setValueProperties"><value>class="last a-right"</value></action>
<block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml" />
</block>
</block>
</block>
</reference>
<reference name="sales.order.info">
<action method="addLink" translate="label" module="sales"><name>view</name><path></path><label>Order Information</label></action>
<action method="addLink" translate="label" module="sales"><name>invoice</name><path>*/*/invoice</path><label>Invoices</label></action>
<action method="addLink" translate="label" module="sales"><name>shipment</name><path>*/*/shipment</path><label>Shipments</label></action>
<action method="addLink" translate="label" module="sales"><name>creditmemo</name><path>*/*/creditmemo</path><label>Refunds</label></action>
</reference>
<block type="core/text_list" name="additional.product.info" translate="label">
<label>Additional Product Info</label>
</block>
</sales_order_view>
If anybody has an idea about the origin of this thank you for help.

How to call mini cart in footer in magento?

I want to call mini cart in footer.
i have to use below code in xml file
<reference name="footer">
<block type="checkout/cart_sidebar" name="footer_cart" template="checkout/cart/topcart.phtml" before="-">
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
<block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
<label>Shopping Cart Sidebar Extra Actions</label>
</block>
</block>
</reference>
or <?php echo $this->getChildHtml('top_cart') ?> in footer.phtml.
but its not working for me. please give me any idea for do it.
you name of block is footer_cart so
change
<?php echo $this->getChildHtml('top_cart') ?>
to
<?php echo $this->getChildHtml('footer_cart') ?>
other problem is you are calling the wrong file
change
<block type="checkout/cart_sidebar" name="footer_cart" template="checkout/cart/topcart.phtml" before="-">
to
<block type="checkout/cart_sidebar" name="footer_cart" template="checkout/cart/sidebar.phtml" before="-">

Custom page breadcrumb name in magento

I'm trying to change the breadcrumb that is showed on my blog page.
Now I have something like" Home / Blog ", but I want it to show like " Home / NewNameHere ".
I went to my blog.xml file and where I had this:
<blog_index_index>
<reference name="content">
<block type="blog/blog" name="blog" template="blog/blog.phtml"/>
</reference>
</blog_index_index>
Changed to this:
<blog_index_index>
<reference name="content">
<block type="blog/blog" name="blog" template="blog/blog.phtml"/>
<action method="addCrumb">
<name>newnamehere</name>
<params>
<label>newnamehere</label>
<title>newnamehere</title>
<link> /blog/</link>
</params>
</action>
</reference>
</blog_index_index>
But nothing has changed. Any help would be appreciated.
Try the below code:
<blog_index_index>
<reference name="content">
<block type="blog/blog" name="blog" template="blog/blog.phtml"/>
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs">
<action method="addCrumb">
<name>NewName</name>
<params>
<label>NewName</label>
<title>NewName</title>
<link>/blog/</link>
</params>
</action>
</block>
</reference>
</blog_index_index>
And in your blog.phtml call like this
<?php echo $this->getLayout()->getBlock('breadcrumbs')->toHtml();?>

Magento Page Layout Will Not Change on Advanced Search Results Page

I am trying to change the layout of the advanced search results page (www.website.com/catalogsearch/advanced/result/) from 2columns-right to 2columns-left.
I have tried changing the app/design/frontend/default/theme261/layout/catalogsearch.xml so all references to 2columns-right.phtml are now 2columns-left.phtml. I have also changed the app/design/frontend/base/default/layout/catalogsearch.xml just in case. (I have backup up the original file.)
Regular search results pages are 2columns-left. It is only the advanced search results page that are 2columns-right.
Here's my code for app/design/frontend/default/theme261/layout/catalogsearch.xml:
<layout version="0.1.0">
<default>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="header">
<block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
</reference>
<reference name="footer_links">
<action method="addLink" translate="label title" module="catalogsearch" ifconfig="catalog/seo/search_terms">
<label>Search Terms</label>
<url helper="catalogsearch/getSearchTermUrl" />
<title>Search Terms</title>
</action>
<action method="addLink" translate="label title" module="catalogsearch">
<label>Advanced Search</label>
<url helper="catalogsearch/getAdvancedSearchUrl" />
<title>Advanced Search</title>
</action>
</reference>
<reference name="left">
<block type="sidebarsearch/advanced_sidebar" name="sidebarsearch_advanced_sidebar" template="sidebarsearch/advanced/sidebar.phtml" before="-"/>
</reference>
</default>
<catalogsearch_result_index translate="label">
<label>Quick Search Form</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<!-- <reference name="left"> -->
<!-- <block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/> -->
<!-- </reference> -->
<reference name="content">
<block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
<block type="catalog/product_list" name="search_result_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>
<action method="setListOrders"/>
<action method="setListModes"/>
<action method="setListCollection"/>
</block>
</reference>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
</catalogsearch_result_index>
<catalogsearch_advanced_index translate="label">
<label>Advanced Search Form</label>
<!-- Mage_Catalogsearch -->
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="head">
<action method="setTitle" translate="title" module="catalogsearch"><title>Advanced Search</title></action>
<action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
<action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
<action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
</reference>
<reference name="content">
<block type="catalogsearch/advanced_form" name="catalogsearch_advanced_form" template="catalogsearch/advanced/form.phtml"/>
<block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
</reference>
</catalogsearch_advanced_index>
<!--
Advanced search results
-->
<catalogsearch_advanced_result translate="label">
<label>Advanced Search Result</label>
<!-- <update handle="page_two_columns_left" /> -->
<!-- Mage_Catalogsearch -->
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="content">
<block type="catalogsearch/advanced_result" name="catalogsearch_advanced_result" template="catalogsearch/advanced/result.phtml">
<block type="catalog/product_list" name="search_result_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>3</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>3</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
<action method="setListOrders"/>
<action method="setListModes"/>
<action method="setListCollection"/>
</block>
</reference>
</catalogsearch_advanced_result>
<catalogsearch_term_popular translate="label">
<label>Popular Search Terms</label>
<remove name="right"/>
<remove name="left"/>
<reference name="head">
<action method="setTitle" translate="title" module="catalogsearch"><title>Search Terms</title></action>
</reference>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="catalogsearch/term" name="seo.searchterm" template="catalogsearch/term.phtml"/>
</reference>
</catalogsearch_term_popular>
</layout>
Thanks in advance for any help.
Make sure:
1) your theme theme261 is currently used on the shop (System / Configuration / Web / Design)
2) there is no overwrite for "catalogsearch_advanced_result" inside layout/ by any of your custom extensions (find all occurrences of "catalogsearch_result_index" inside app/design/frontend, they can be in "base" theme pool, outside your theme)
3) refresh your cache
If that doesn't help here's how ninjas do:
In this file app/code/core/Mage/CatalogSearch/controllers/AdvancedController.php add debug to the method resultAction: after string $this->renderLayout(); before the closing bracket } add following:
if($this->getRequest()->getParam('test')){
var_dump(Mage::app()->getLayout()->getXmlString());
die();
}
Visit advanced search page on your site with added request param test=1, i.e:
www.your.site.com/catalogsearch/advanced/result/?q=some-query&test=1
View this page in a "Source code" mode, because otherwise your browser is going to render that xml.
The idea of this method is to look for string "setTemplate". This way you will figure out the issues like if some layout update instruction is done outside of xml file etc.

magento-Assign Custom attribute value (from drop down) programatically

I have to assign custom attributes from drop down menu. means we have lots of books and i create custom attribute for languages like English,Hindi,Punjabi etc. i have tried this
$product_id = Mage::getModel('catalog/product')->load(23340);
echo "Product Name".$product_id->getName();
$product_id->setStoreId(1)->setData(('book_lang'),24)->save();
where 24 is the id of my custom drop down attribute (for English) it works but it not shown in filter attributes.
any response is precious...
hi for custom option check magento admin section and
in catalog.xml see this
<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>
and check the product view.phtml for $this->getChildChildHtml('container2', '', true, true) please provide me some more information may be i will suggest you proper
and for filter try this $productCollection->addAttributeToFilter('costume_attribute_name', $productId);

Resources