Display template in front-end - magento

I followed the tutorial of Inchoo for Magento
How to add custom contact form with email notification I added the files as mentioned now i need to know how to display it in front-end.
Tutorial link: inchoo.net/magento/magento-email/magento-custom-email-contact-form-with-notification-system/
Regards,

Add this in your cms page
{{block type="core/template" name="simple_contact_form" form_action="/inchoo-simplecontact/index/sendemail" template="inchoo/simple_contact.phtml"}}
Check app\code\local\Inchoo\SimpleContact\controllers\IndexController.php
there is sendemailAction() and in it at last $this->_redirect('inchoo-simplecontact/'); this will redirect. So may you want to change redirect it's here.

Related

Facing cache issue on CMS page

I'm facing one issue on magento2.
I have created one CMS page and want to display current CART items on cms page.
So i have created on test.phtml file and call from CMS page.
{{block class="Magento\Framework\View\Element\Template" cacheable="false" template="Magento_Theme::test.phtml"}}
Whatever i have written in test.phtml file will only display if i'll clean my cache. It's not display directly if i'll update anything.
I have already written cacheable="false" but it's not working.
Can anyone please help.
Thanks in advance.
Thanks,

Add link to CMS page from admin panel magento

How to add link to CMS from product description part with admin panel.
You can add relative a link in the product description like this:
Anchor text here
But in order for this to work you need to allow store (media and skin) directives in the description. This can be enabled from System->Configuration->Catalog->Frontend->Allow Dynamic Media URLs in Products and Categories. Set the field to yes and clear the cache.
Place the anchor tag with href as below:
href="{{store url='about-magento-demo-store'}}"
Replace "about-magento-demo-store" with cms page code.
You can normally place an anchor tag to give any link in the Product Description section or you can use the WYSIWYG editor also by clicking on the WYSIWYG editor button just below it.
About US
here about us is just example link you can add your cms page link with just replace with aboutus
hope this help you
I got the solution. Just this href="/faq#washable"
Thanks guys :)

Block Method Calls in CMS Page

Is there any a way to call Block method calls in CMS page?
What I am trying to do is. I have a hyperlink in my CMS Page and I want to retrieve the email address of the customer to pass it as a get variable which another website will use.
e.g. In CMS page I have
(someother website link)
<a href="www.xyz.com?email=<?php $getCutomer->getEmail();?>&&name=<?php $getCutomer->getName();?>
I know we can't add php in CMS pages or block. I have just shown you as an example what I want to achieve.
So is there any way using XML or anything else?
Please Advise. Thanks
Yes as MagePsycho said, you will need to create phtml file for calling block method or getting dynamic data.
In .phtml file, it's simple just call $this->getCustomerEmail() or whatever method you wrote to get customer email.
Why can't you simply include the .phtml file in CMS page or Static block as:
{{block type="core/template" template="path/to/your-custom-template.phtml"}}
and you can now use any php code in that .phtml file.
Cheers!

Get Top/Best Rated Product in Magento

I want to best rated product on a magento homepage. I have product reviewing module configured on my site.
i have tried following this http://www.odino.org/84/retrieve-top-rated-products-in-magento
but am unable to get it working.
My homepage is formed my calling one block from the cms home page {{block type="page/html" template="page/html/home.phtml"}}
and i have tried putting the php code in home.phtml
The link i have posted asks to create a helper, but i don't know how to go about that, so what i did was wrote a normal function within the page and called it.
Any help would be seriously appreciated :)
Thanks
Look at this module from Inchoo, explained with all the required changes you need to make with screenshots. Hopefully this will be helpful
http://inchoo.net/ecommerce/magento/bestseller-products-in-magento/

How can I add custom fields in cms edit page (Admin Panel)?

I am facing an issue in Magento. I want to add some custom fields to Magento Admin Panel CMS Edit Page. I got a page while searching where it describes adding a custom field in CMS page: http://blog.flexishore.com/2011/08/add-custom-field-to-cms-page/ .
I have followed every step in this, but I am still getting an error Call to undefined function getLoad().
Can anyone here explain me how to add custom fields in CMS page?
You can try this article (http://www.atwix.com/magento/adding-custom-attribute-to-a-cms-page/) as well, it's more simple, maybe it will be helpful for you.
Also don't forget about cache, I recommend you disable it when you are testing your own modules.

Resources