Magento

eCommerce Software for Online Growth

Magento Forum

From setting up your store to managing your products, pages and promotions to generating detailed reports, the Magento User Guide empowers the user to utilize the platform for all of its vast capacity.
Available in eBook and Print formats – Download Now!!!
   
Page 1 of 2
little confusion with “ <?=$this->getChildHtml(’right’)?>”
 
chinesedream
Enthusiast
 
Avatar
Total Posts:  971
Joined:  2007-08-31
 

In the “getChildHtml(’right’)”, it brings up the following :

1) mini-cart (resides in checkout/cart/sidebar.phtml)
2) mini-compare-products (resides in catalog/product/compare/sidebar.phtml)
3) Back to school (callouts/right_col.phtml)
4) Newsletter (newsletter/subscribe.phtml)
5) Poll (poll/active.phtml)

However I can’t fine a file called “right.phtml’ so that I can remove some of the element above

I want to change:
<div class="col-right side-col">
<?=$this->getChildHtml('right')?>
 
</div>

to :

<div id="right">
<?=$this->getChildHtml('right')?>
</div>

and I want only
1) mini-cart (resides in checkout/cart/sidebar.phtml)
2) my custom callouts (just simple html blocks) - although not desired, I supposed I can still replace the code from (callouts/right_col.phtml) to get it working

Where do I remove the :
2) mini-compare-products (resides in catalog/product/compare/sidebar.phtml)
4) Newsletter (newsletter/subscribe.phtml)
5) Poll (poll/active.phtml)

My logic tells me they should be in the ‘right.phtml’ but I can’t the file.

Thanks!

 Signature 

Latest release : Display Magento feed on WP Blog : Art Shop Premium Magento-WordPress Theme
Wellness Magento-WordPress Theme / New Green Natural living

 
Magento Community Magento Community
Magento Community
Magento Community
 
ohminu
Magento Team
 
Avatar
Total Posts:  173
Joined:  2007-08-07
Portland, OR
 

Ah, your logic need reconditioning wink

The php method getChildHtml(’right’) does not refer in any way to right.phtml. “right” is simply an identifier in order for templates and the layout file to interact with each other in order to structure and bring content to the page. Remember, changing the layouts of a page in Magento means no longer relying on manual XHTML inclusion in one large structural block template such as col_right.phtml. Think of it this way:

There are now three parts to modifying page layout. One is the structural templates, two, content templates, and three is what Magento calls “layouts”.
Structure templates are templates that simply creates the structural layout of a page - such template exists only to designate real estate for content inclusion. A sample structural template would look something like the following:

<div class="header"><?=$this->getChildHtml('header')?></div>
<
div class="col-left"><?=$this->getChildHtml('left')?></div>
<
div class="col-main"><?=$this->getChildHtml('content')?></div>
<
div class="col-right"><?=$this->getChildHtml('right')?></div>
<
div class="footer"><?=$this->getChildHtml('footer')?></div>

You can see how the XHTML used in a skeleton template is only there to build structural.

A layout arranges the content blocks such as product tags, category listing, mini cart, mini wishlist..etc, then delivers it to the structural block to be parsed in the assigned order.
All this in human language is basically “Grab all the mini cart, grab the compare products, grab the poll and the grab the newsletter sign up box, and put all this inside the <div class="col-right">." The one that orders this whole operation, is the layout. Each of the mini-cart, compare products..etc are the content blocks. The <div class="col-right"></div> is the structural block.

The layout only knows where to include all the content blocks via the getChildHtml() method used in the structural template. Using the assigned identifier called “right” as in getChildHtml(’right’), the layout knows where to put all the content blocks it gathered - inside the <div class="col-right"></div>

For each design theme, you have a default layout, and the subsequent layout updates. The default, is what sets the default layout for the whole store, and the layout updates is the layout that modifies(updates) the default layout per store page. So if the default layout says, use 3 columns, but you want your product info page to use 2 columns only, you’d update the <catalog_product_view> “handle” inside main.xml to reflect this. Main.xml is pretty well commented - read through it carefully with open eyes and you’ll see what’s happening there. Also the Magento team is here to assist you with any questions - 24 hours a day 7 days a week - (we are born with each finger stuck to a keyboard...and we have mutating tentacles to accommodate all the other keys we can’t cover with the 10 fingers)

O.K.!! we got the concept over with. Now let’s get our hands dirty, stinky, muddy, cracking, invigorated, satisfied...happy.
Comment out the following codes from main.xml

<block type="core/template" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>

<reference name="right">
           <
block type="newsletter/subscribe" name="right.newsletter" template="newsletter/subscribe.phtml"/>
        </
reference>
<reference name="right">
            <
block type="poll/activePoll" name="right.poll">
                <
action method="setPollTemplate"><template>poll/active.phtml</template><type>poll</type></action>
                <
action method="setPollTemplate"><template>poll/result.phtml</template><type>results</type></action>
            </
block>
        </
reference>

Now reload the page. That’s all-

 
Magento Community Magento Community
Magento Community
Magento Community
 
chinesedream
Enthusiast
 
Avatar
Total Posts:  971
Joined:  2007-08-31
 

Hi ohminu,

Thank you! Kiss you (on your forehead only)!

You detailed explanation save me from asking many more stupid questions tongue laugh

 Signature 

Latest release : Display Magento feed on WP Blog : Art Shop Premium Magento-WordPress Theme
Wellness Magento-WordPress Theme / New Green Natural living

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jesse Stewart
Sr. Member
 
Avatar
Total Posts:  78
Joined:  2008-02-18
Salt Lake City, Utah
 

can’t seem to find main.xml

 Signature 

Cognate Creative
Utah graphic design and web.

 
Magento Community Magento Community
Magento Community
Magento Community
 
chinesedream
Enthusiast
 
Avatar
Total Posts:  971
Joined:  2007-08-31
 

Hello!
main.xml had retired long time ago.

Everything used to be in the main.xml are now reside in the designe\frontend\default\default\layout.

The page.xml controls the default layout.

 Signature 

Latest release : Display Magento feed on WP Blog : Art Shop Premium Magento-WordPress Theme
Wellness Magento-WordPress Theme / New Green Natural living

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jesse Stewart
Sr. Member
 
Avatar
Total Posts:  78
Joined:  2008-02-18
Salt Lake City, Utah
 

Thank you, best response I’ve got all day. What I’m really trying to find is where the mini-cart is being included.

 Signature 

Cognate Creative
Utah graphic design and web.

 
Magento Community Magento Community
Magento Community
Magento Community
 
chinesedream
Enthusiast
 
Avatar
Total Posts:  971
Joined:  2007-08-31
 

Relax! You have just had 17 post smile
Patient is the virtue to learn to use Magento, it will only get better, not worse long as you stick to it.

All templates are controlled by phtml files and located in the template directory, after 7 months, Magento team has made it so easy to find as it’s quite self-explanatory.
The designer guide, though outdated, but still helpful for you to understand layouts, blocks and templates relationship. Once you get the concept, you will know where to look for blocks and layouts.

Also, I found that using a software (TextMate in my case) that can show drawers next to the document view is very useful.

Image Attachments
mini-cart.jpg
 Signature 

Latest release : Display Magento feed on WP Blog : Art Shop Premium Magento-WordPress Theme
Wellness Magento-WordPress Theme / New Green Natural living

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sean Yeomans
Jr. Member
 
Avatar
Total Posts:  29
Joined:  2008-04-02
Winnipeg
 
chinesedream - 01 April 2008 11:19 AM

The designer guide, though outdated, but still helpful for you to understand layouts

Shouldn’t someone go in and make it “in-dated” now that it’s obvious there are errors?

I searched for main.xml for quite some time, along with a few other discrepancies. so not only is this application a biotch to learn, the documentation is making it ‘’biotchier’’

gah!

Image Attachments
886062664_11fa33d9c3.jpg
 Signature 

Sean Yeomans | visit my site

 
Magento Community Magento Community
Magento Community
Magento Community
 
karynn
Member
 
Avatar
Total Posts:  70
Joined:  2008-02-07
 
chinesedream - 01 April 2008 11:19 AM

All templates are controlled by phtml files and located in the template directory, after 7 months, Magento team has made it so easy to find as it’s quite self-explanatory.

Self-explanatory? Hardly! Perhaps after 7 months of looking at it, but I don’t have that kind of time.

After reading the design guide, I was so impressed, I thought it would be really simple to change the layout of the various content blocks, but after going to the files, I’ve found this is very much NOT the case.

It took some digging to find where to get rid of the Dog with the laptop and the “Back to School” promotion. It seems that so many things are spread across files that I have to open each one up to see what’s inside. That’s not intuitive in the slightest.

Sorry, I’m frustrated as I want to re-order some of the content blocks and I can’t find where they are referenced.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Spek
Member
 
Total Posts:  62
Joined:  2007-11-28
 
karynn - 12 April 2008 06:25 PM

Sorry, I’m frustrated as I want to re-order some of the content blocks and I can’t find where they are referenced.

I agree that sometimes a couple things do not seem logical to me either. You just need a few “a-ha’s!”, especially with the xml’s that are new to a lot of us. What exactly are you trying to move around?

 
Magento Community Magento Community
Magento Community
Magento Community
 
randomutterings
Jr. Member
 
Total Posts:  19
Joined:  2008-02-28
 

Can someone please tell me how to add the newsletter subscription to the left column?  I’ve been looking through files for a couple of hours...intuitive.

 
Magento Community Magento Community
Magento Community
Magento Community
 
battosai
Jr. Member
 
Total Posts:  13
Joined:  2008-01-21
 
karynn - 12 April 2008 06:25 PM

After reading the design guide, I was so impressed, I thought it would be really simple to change the layout of the various content blocks, but after going to the files, I’ve found this is very much NOT the case.

It took some digging to find where to get rid of the Dog with the laptop and the “Back to School” promotion. It seems that so many things are spread across files that I have to open each one up to see what’s inside. That’s not intuitive in the slightest.

Sorry, I’m frustrated as I want to re-order some of the content blocks and I can’t find where they are referenced.

I love what Magento can do, but I’m frustrated with how a single page is scattered in so many bits and pieces.  For instance, editing the home page requires going into the admin tool plus numerous text files with an editor.  Some stuff is done with XML, some with XHTML, some with PHP, ...  I’ve been a programmer for a long time, and I’m very familiar with web design, and I find everything very confusing.  To me, it would make more sense to do everything with XHTML and embedded XML tags like J2EE taglibs or ColdFusion’s tags.  Those tags would be friendly frontends to PHP code that most designers would never see.  If someone needed programatic modifications, then create PHP and make a tag for it.

Sigh...it’s a little late to clean up the mess now.  I wonder how many collective hours have been spent hacking through Magento versus how many hours it would have taken to have someone update documentation AHEAD OF the code releases?  Maybe a 10,000:1 ratio?

I’m sure I’m going to love Magento once I figure it out, but I think I might have to wait till more documentation comes out since I have limited hacking time.

 
Magento Community Magento Community
Magento Community
Magento Community
 
AdamQuadmon
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2008-06-06
Perugia - Italy
 

I’m frustrating too, but I worked on a similar project last year with a team, I know the effort everyone made to explain things each other, is not so simply.

If Varien chose to share with us thery knowledge we have only to say thank you.

They have to do theyr buisness, it’s normal.

I hope that in the near future they can share a solid documentation but now the project is still very dinamic and things change a lot.

The Zend Framework reference too is not so easy to understand…

 Signature 

Finding Solutions

 
Magento Community Magento Community
Magento Community
Magento Community
 
phantacid
Jr. Member
 
Total Posts:  2
Joined:  2008-07-01
Bristol
 

In their defense i think they are hoping, and as with all open source projects, that a community of savvy enthusiasts are going to fill in the gaps on documentation etc.

If I had the time I would love to get to work on a Wordpress style widgets plugin. I think it would fairly logical to put together but would take a lot of work.

 Signature 

if you’re not confused then you don’t understand.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jawshchevyvan
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2008-06-12
 

documentation should get a little over haul… but i know how it is.  plus the forums are helpful if not the de facto standard way of doing things.  thanks all.  this reference had to be tracked to catalog.xml for me. 

cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
Naresh Vajawat
Member
 
Total Posts:  45
Joined:  2008-09-22
India
 

Hi,

I am not able to see the blocks as mentioned in the thread in page.xml and as somebody said i do not have the main.xml in the layout folder. I want to interchange the blocks.

Any ideas ????

Thanks,
Naresh

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 1 of 2
 
© Copyright 2010 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
177734 users|988 users currently online|277180 forum posts