HI i have made a module in which i have a controller which adds product to the cart through url . I have add a error messages from controller if the product is not valid.
The problem is the error message is shown above the content area .I need to show those in the content area.I have also tried to add these blocks in
checkout.xml in content area
<reference name="content">
<block type="checkout/cart" name="checkout.cart">
<block type="core/messages" name="global_messages" as="global_messages"/>
<block type="core/messages" name="messages" as="messages"/>
but still it not loads the messages in the content area and show above the content area. Can you please suggest me how can i do this.
What are you using to generate these errors - default magento handlers? they generate errors just above the breadcrumb area.
One option would be to give it a id/class and manipulate through javascript.
OR,
Generate custom errors.
You can either unset/re-add blocks as needed with the following methods:
<action method="unsetChild"><name>global_notices</name></action>
<action method="unsetChild"><name>global_messages</name></action>
<action method="unsetChild"><name>messages</name></action>
<block type="page/html_notices" name="global_notices" as="global_notices" template="page/html/notices.phtml" />
<block type="core/messages" name="global_messages" as="global_messages"/>
<block type="core/messages" name="messages" as="messages"/>
If adding these as needed using template hints to confirm does not work, find the following line in
app\design\frontend\base\default\template\checkout\cart.phtml
<?php echo $this->getMessagesBlock()->toHtml() ?>
And comment it out/move it to where you wish to render it.
Related
I have used mobileshoppe theme for magento and trying to display recently viewed product list at product details page but some how its not working...
Added code below at catalog.xml
<catalog_product_view translate="label">
<reference name="content">
<block type="reports/product_viewed" name="product.recently.viewed" as="product_recently_viewed" template="reports/product_viewed.phtml"/>
</reference>
</catalog_product_view>
and below code at app\design\frontend\default\mobileshoppe\template\catalog\product\ view.phtml
<?php echo $this->getChildHtml('product_recently_viewed') ?>
I have tried the same with default theme and its also not working, can any one help me to figure out this issue ?
Thanks...
On the the product detail template (view.phtml) you have to be more specific in the xml where you want to place the block. See the example below using local.xml in the theme layout directory (app/design/frontend/your package/your theme/layout/local.xml) to insert the block. Here's an example from a site I'm working on. Ironically we are having problems with it displaying consistently, which I'm trying to figure out right now, but this is working most of the time! Try getting more specific in your catalog.xml and it should work. The xml is in local.xml, the echo is in catalog/product/view.phtml
<?php echo $this->getChildHtml('recently_viewed') ?>
<catalog_product_view>
<reference name="content">
<reference name="product.info">
<block type="reports/product_viewed" name="left.reports.product.viewed" template="reports/product_viewed.phtml" as="recently_viewed" />
</reference>
</reference>
Can you please replace xml reference content to left.
Instead of this
<reference name="content">
Use below and check
<reference name="left">
As it is a part of sidebar so it should work with left / right column as you want to display in page.
Cheers!
I would like to show two different products on the product view page. Basically, after displaying the first product like it normally would, the page should then show another product with all it's details, images and of course the "Add to Cart" button.
Both products should be fully displayed on the product view page, so I can't use any of the existing blocks like catalog/product_list_related or catalog/product_list_upsell.
My idea was to simply add another catalog/product_view block to the catalog_product_view layout definition, like so:
catalog.xml:
<layout version="0.1.0">
...
<catalog_product_view translate="label">
...
<reference name="content">
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
...
</block>
</reference>
...
<!-- Changes start here -->
<reference name="content">
<block type="catalog/product_view" name="product.info2" template="catalog/product/view.phtml">
<action method="setProductId"><product_id>123</product_id></action>
</block>
</reference>
</catalog_product_view>
However, this does not seem to work. Various elements of the block don't seem to load correctly, as you can see on this screenshot:
All the product images are missing as well as the price and the buttons. Also, my call to setProductId() doesn't seem to have any effect.
You can delete this catalog.xml, then magento usa base catalog.xml
From my /checkout/onepage/ there is a popup window for the AGB: /germansetup/frontend/agreements/id/1/
Problem is that this page does not show any text. Just a background image from the template.
The popup is defined in germansetup.xml:
<germansetup_frontend_agreements>
<reference name="root">
<action method="setTemplate"><template>page/popup.phtml</template></action>
</reference>
<reference name="content">
<block type="core/text" name="agreement" />
</reference>
</germansetup_frontend_agreements>
I don't know what block he is trying to load here but I would like him to show my static block mrg_business_terms.
This appears to have changed at some point. For me (using Magento 1.9.2.4), what worked was adding 'cms/block' to the list of whitelisted blocks.
Have a look at Sales > Terms and Conditions (German: Verkäufe > Bestellbedingungen).
Here you see the list of checkout agreements. In my case I needed to change the content block id:
{{block type="cms/block" block_id="mrg_business_terms"}}
In the file $MAGENTO_PATHapp/design/frontend/base/default/template/catalog/product/view/options/wrapper.phtml, I see the following line of code:
<?php echo $this->getChildHtml('', true, true);?>
This is responsible for printing the product options on the product page. I want to understand and modify the html content that this line of code produces, but I can't seem to locate the view or controller relevant to it. For example, let's say I want to programmatically add the characters to the innerHTML of each option element in a drop down, which phtml, php or html file do I edit?
I'm hoping an answer to this question will help me understand how to retrieve product options, which in turn will help me solve this more immediate problem:
Magento - Query for Product Options
When passing an empty value to any of the getChild functions all the children are used. In this case getChildHtml(''... returns the result of each of their toHtml outputs.
To find out what it's children are we need to refer to the catalog.xml layout file:
<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>
You might be able to see from that jumbled mess that your wrapper block has an 'options' grandchild which has several renderers for the different types of possible options. For the drop-down you'll probably need to edit catalog/product/view/options/type/select.phtml.
I have this section in one of my layout files:
<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"/>
</reference>
</blog_post_view>
This first block shows a post and the second block shows some social bookmarking icons. The problem is the section which displays the post also displays the 'add comments' section. I want to add the social icons between the post and the comments.
How can I do this? Ie. add the Social block in the middle of the Post block?
Thanks!
Change it to:
<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>
and then inside the post template (aw_blog/post.phtml) put the following where you want the bookmark-things to appear:
<?php echo $this->getChildHtml('bookmarks'); ?>