I want to make a new pop-up and I want to copy an existing login-form modal for it.
So I have done the following things:
1) create the new modal file shipping.modal.phtml and save it under app/design/frontend/sm-maxshop/default/template/checkout
2) the new modal should work for the cart.phtml, so i have add the following code into the cart.phtml from the folder app/design/frontend/sm-maxshop/default/template/checkout -
<?php echo $this->getChildHtml('checkout_shipping_modal'); ?>
3) I have edited the page.xml (because the new modal will work for different sites) in this way
<block type="checkout/template" name="checkout_shipping_modal" after="-" template="checkout/shipping.modal.phtml" />
I think now it should work, but the code of the new "shipping.modal.html" is not included in the page.
What's wrong with my code?
I think your issue With block type..
can you give more detail what is in shipping.modal.phtml file
Related
On the login page's phtml file there is a line that adds the html for a remember me checkbox using: <?php echo $this->getChildHtml('persistent.remember.me'); ?>
I want this same checkbox to also appear in a different part of the website, but when I add this same line to that section's phtml, nothing shows up. I logged out the classes of the $this object in the two files, for the login page its Mage_Customer_Block_Form_Login, and for the other section its Mage_Page_Block_Html_Header.
I'm guessing the difference in classes causes the remember me to not be found in the other sections call to add it. Is there any way to add this remember me html to this page even though their $this classes are not the same?
You can use following code in place of your code
$this->getLayout()->createBlock('persistent/form_remember')->setTemplate('persistent/remember_me.phtml')->toHtml();
Or add following code to add block in your page's handle to use your same code with $this
<block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
How can I add a new layout in magento using local.xml? I want it to appear in layouts list when I make new CMS page.
Layout in magento using local.xml
please go and follow this code.
http://www.codeboss.in/web-funda/2009/07/07/create-new-layout-in-magento/
Look at the very last block of code on this page. You can go into app/code/core/Mage/Page/etc/config.xml and add lines like this:
<TEMPLATE_LABEL module="page" translate="label">
<label>TEMPLATE NAME</label>
<template>page/TEMPLATE-FILENAME.phtml</template>
<layout_handle>page_HANDLE_NAME</layout_handle>
</TEMPLATE_LABEL>
replacing the capitalized words, e.g.
<home_format module="page" translate="label">
<label>Home Format</label>
<template>page/home-page.phtml</template>
<layout_handle>page_home_format</layout_handle>
</home_format>
Right before the end of the <page> ... </page> block of code.
Note: if you do it this way, you may not be able to upgrade Magento without losing your custom layout, as config.xml is a core file.
I want to add same login form in my site
is there any module available for that or we can have something else coding changes for this
please suggest me something
i want something like this :
http://livedemo00.template-help.com/magento_42632/
You could create a block of type customer/form_login. Using the XML as follows
<block type="customer/form_login" name="customer_small_login" template="customer/form/small-login.phtml" />
You can view the customer/form/login.phtml form for reference of what kind of fields your block is expecting.0
You can then add this to your sidebar using
<?php $this->getChildHtml('customer_small_login'); ?>
NOTE: Ensure your adding you XML block as a child node of the sidebar which you wish to include it in.
I am trying to work out how to create custom phtml files to include on view.phtml (and ultimately to be called from any default Magento phtml file).
I have created a seperate phtml file with the content I want in it called productbadges.phtml
This will be pulled through as the last item in
I understand the callout usually is
<?php echo $this->getChildHtml('phtmlfilename') ?>
However I know I need to do add something to catalog.xml so Magento recognizes the callout and can source the correct file. But I do not properly understand Magento's XML syntax.
Could anyone assist?
vicch's response is the correct way of doing it.
However, it's also helpful to know that there is an alternate method:
$block = $this->getLayout()->createBlock(
'Mage_Core_Block_Template',
'choose_a_block_name',
array('template' => 'folder/myphtmlfile.phtml')
);
I am posting this for general knowledge. This is not the accepted way of doing this, since it is not consistent with how Magento templates and blocks are used.
you can use
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('goodtest/test.phtml')->toHtml(); ?>
see also here:
How do i call .phtml block at specfic page in magento?
and
want to call one phtml file in another phtml file using anchor tag
Given the information you provided, I can only give a general solution.
First you need to find the layout XML for this view.phtml. You should be looking for something like:
<block type="..." name="..." ... template="../view.phtml">
To add the declaration of the new template directly under the wrapping block, it should be:
<block type="..." name="..." ... template="../view.phtml">
<block type="..." name="phtmlfilename" template="../phtmlfilename.phtml"/>
...
</block>
It is also possible to reference the outter block somewhere else:
<reference name="[name_of_view.phtml_block]">
<block type="..." name="phtmlfilename" template="../phtmlfilename.phtml"/>
</reference>
Type of the new template is the class name, which should be core/template or a subtype of it.
The answer to this question is below codes,just change "directory/acc_drop.phtml" to your file path name.
<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('directory/acc_drop.phtml')->toHtml(); ?>
Hi I have added the inchoo featured products but want them to show in the header so show on everypage, i tried moving the code, i tried:
echo $this->getLayout()->createBlock('Mage_Adminhtml_Block_Template', 'block-name')->setData('template', 'inchoo/block_featured_products.phtml')->toHtml()
Im kind of new to magento so i don't know
thanks
Graham
Create a CMS static block and give a identifier name to that, lets say "featured_product".
Open page.xml file from app/design/frontend/default/YOURTEMPLATE/layout/page.xml
Find the section html_header, now add the following code
<block type="cms/block" name="header_block"><action method="setBlockId"><block_id>featured_product</block_id></action></block>
Next open the app/design/frontend/default/YOURTEMPLATE/template/page/html/header.phtml file.
Find the area to design and add the following code in there :
<?php echo $this->getChildHtml('featured_product') ?>
Clean cache and test your page.