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/
Related
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,
Having just got myself acquainted (enough) with Magento 1.9, and able to make the customisations required, I've been told that once it's out, we're moving to Magento v2.0.
Having found the differences in the file structure, I believe I can see where to place my code for the custom pages we use, but how can I add this page from my project to a static block for later use?
Previously, the method used was as follows (I realise this may not follow the best practise, but it worked):
Create element folder within theme or core templates directory.
eg. /app/design/frontend/<theme>/default/template/myelement/mypage.phtml
Add this page/element to a static block using the following in the content editor:
{{block type="<theme>/default" template="myelement/mypage.phtml"}}
This block can then be added to the category pages as required.
In Magento 2, I have tried what I believe to be required, which is replicating the file structure and adding phtml files to this, so the template file now resides in:
/app/code/<supplier>/<module>/view/frontend/templates/mypage.phtml
Adding to the content editor the following:
{{block type="<supplier>/<module>" template="mypage.phtml"}}
Unfortunately, this does not display the intended page (element). It doesn't display the calling "{{block" entry either, which usually happens when the line is invalid, so I can only assume that I'm missing something with the link to this template.
If anyone can offer some assistance with this, I would be most grateful.
EDIT:
Continued research on this has led me to the following assumptions:
Magento 2 requires more than just a new .phtml page, even for simple customizations.
I'm still missing something.....
Having gone through 3 different tutorials on creating new modules for Magento 2, each providing slightly different methods, but fundamentally being the same thing, I now have what I believe should be all the code elements to make a new .phtml template for display in a static block.
This has led to an additional problem though.
While I have the required code, I cannot add the module. Adding the module to etc/config.php, as suggested in 2 out of the 3 tutorials, simply crashed M2, both admin and frontend when you try to clear the cache. This is the case after manually clearing cache folders in the var directory.
Also, still unable to add the .phtml template file to a static block or page using content editor.
Not much hair left to pull out here, so looking for help! Thanks in advance
There are a few samples on GitHub, including https://github.com/magento/magento2-samples/tree/master/sample-module-newpage which shows a module adding a new page with a very simple PHTML template file. This example does not use CMS content editing however - it is a sample based on using layout files.
You mentioned you were getting crashes. Would need more details to help on that one. If you got it solved, could you update this question and accept a response to close it out? Thx!
You Should try "class" instead of "type". So your code should look like.
{{block class="<package>\<module>\Block\MyBlock" template="mypage.phtml"}}
You Should try "VenderName_Modulename::myelement/mypage.phtml" instead of "myelement/mypage.phtml". So your code should look like.
{{block class="VenderNameModulename\Block\MyBlock" template="VenderName_Modulename::myelement/mypage.phtml"}}
I'm new to magento. Need basic knowledge about magento programming, and magento customization.
Struggle to print content inside frontend.
I followed below site to print content but error shows inside layout,where the content displayed.
Can help me what is what in magento
You can easy learn i have searched it
It's a great and simple tutorial which help you step by step(After covering this tutorial you will be able to handle admin panel of the magento)
http://www.templatemonster.com/help/ecommerce/magento/magento-tutorials/
http://leveluptuts.com/tutorials/magento-community-tutorials
I'm sure there is a much simpler solution for what I am trying to do here, but I am running out of ideas. Essentially I need to create a phpBB forum what exists within my Magento install so that the header and footer from my Magento store are always visible.
The thought is to use a CMS static page for the forum and then style it accordingly. Is there a way to accomplish what I want to do without significant modification? Or, do I just create a one off .phtml file that calls my header, footer and forum? Am I on the right page or am I over/under thinking this?
You'll need to get around Magento's bootstrap (/index.php), because phpBB won't function if Magento is intercepting every URL.
There's also the issue of Magento and phpBB not sharing authentication systems, so users have to log into one, neither, or both. That's not a great UX if you ask me, but solving that problem is a very complicated issue.
Other than that you shouldn't have many problems.
In my CMS contact-us page, I have the following code:
{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}
Which pulls in Magento's standard Contact Form. I have installed a new module from Fontis called recaptcha to prevent spam. This is located my_theme/default/template/fontis/recaptcha/contacts.phtml.
Is anyone able to tell me how I correctly modify the above code to use the new form please?
I have tried changing: template="contacts/form.phtml" to template="fontis/recaptcha/contacts.phtml" but this doesnt seem to work, not sure if I need to alter the block type to make it work.
Thanks in advance for any help
John
Your modification is generally correct to change a template path. Specifically, what do you mean when you say it "doesn't" work? Without more information on what you're seeing, it's difficult to help you debug this issue.
Thanks!
Joe
Sounds like a caching issue to me, or that you're changing the template on the wrong declaration. First, turn off all caching on your site and try again. If that doesn't work, turn on template path hints and make sure that you are editing what you think you are.