|
Ich versuche mich zur Zeit mit dem Magento Template System vertraut zu machen und dachte mir es ist vielleicht für jemand anderen sinnvoll wenn ich meine Fragen und Erkentnisse hier dokumentiere:
Ich habe zuerst wie im Designers Guide angeraten meinen Shop in Blöcke aufgeteilt. Für den Anfang fahre ich eine sehr einfache Struktur, bestehend aus 4 StrukturDivs (structural_header / structural_content / structural_bottombar und structural_footer >> siehe auch der beigefügte Grafik “structural_blocks.png")
<head> </head> <body> <div id="wrapper"> <div id="structural_header"></div> <div id="structural_content"></div> <div id="structural_bottombar"></div> <div id="structural_footer"></div> </div> </body> </html>
Soweit so gut. Nun muss man ja den StrukturDivs mitteilen welche “StructuralBlocks” geladen werden sollen, was in etwa so aussehen könnte:
<head> <?php echo $this->getChildHtml('head') ?> </head> <body <?php echo $this->getBodyClass()?'class="'.$this->getBodyClass().'"':'' ?>> <div id="wrapper"> <div id="structural_header"><?php echo $this->getChildHtml('header') ?></div> <div id="structural_content"><?php echo $this->getChildHtml('content') ?></div> <div id="structural_bottombar"><?php echo $this->getChildHtml('left') ?></div> <div id="structural_footer"><?php echo $this->getChildHtml('footer') ?></div> </div> </body> </html>
Hier beginnt nun auch meine Verständnisfrage:
1.) Betrachtet man den DIV mit der id="structural_bottombar", so fällt auf das ich dort den StrukturBlock getChildHtml("left") aufrufe. Ich mache dies momentan da ich nicht weiß wie und ob man einen eigenen StructurBlock anlegen kann. So wie es aussieht geht das nicht:
ohminu - 22 February 2008 10:04 AM TimC-
You can’t just add a block in the layout update and have something to show through in the front. A block is tied to a huge array of logically assembled functionality/modules that needs to be available for the block to work with - Just putting block type="page/page_html" isn’t going to give you much.
You can however create a static block to place in your store pages by using a CMS block.
In order to create a CMS block, go to Admin -> CMS -> Static Blocks and from there create a new CMS block inside which you can add your HTML for the block. Make note of the ‘identifier’ of the CMS block, because you will now use it to create a layout update.
Open page.xml (assuming you want this to show up on all the pages). Inside <block name="footer"> (I’m using the footer as an example, but technically you can put it anywhere), put in a line like this:
<block type="cms/block" name="your_block_name"><action method="setBlockId"><block_id>your_block_name</block_id></action></block>
You will now see your block in the store front.
If you want to position your CMS static block in a particular area of the footer, put a <?=$this->getChildHtml('your_block_name')?> method in your footer.phtml template file, and your CMS HTML will show up in that particular position within your markup.
Ich muss demnach mit einem von Magento vorgefertigetem Strukturblock vorlieb nehmen? Wenn ja, was gibt es für StrukturBlöcke? Gibt es irgendwo eine Liste über die möglichen typen/Arten/Variationen drüber? Und wie könnte man zum Beispiel einen “Mini Cart” Div a`la “Sie haben x Teile in Ihrem Warenkorb” erzeugen (siehe angehangener Grafik “content_blocks.png” oben rechts)?
Als nächstes müsste man sich nun also damit beschäfftigen wie man den erzeugten StrukturBlöcken “ContentBlöcke” zuweisen kann. Dies geschieht soweit mir bekannt über das sogenannte “layout” also seperaten .xml files. An dieser Stelle möchte ich aber erst einmal unterbrechen und abwarten was für Antworten auf die Frage mit den StrukturBlöcken kommen …
… wird fortgesetzt.
Image Attachments

Click thumbnail to see full-size image
|