How to optimize Magento 2 Store in templating level - optimization

I am learning Magento 2 and hence, I saw one major issue with Magento 2 is the theme optimization. As we all are facing same issue that Magento 2 theme is not optimized so may I know what steps? what precautions? or what changes and optimization can be done in templating level because rest of the things like default configuration I can do but I don't know the optimization for templating..

What type of optimization are you required? Like layout changes, theme color changes, or some new element want to add home page or category page. banner adding etc.
You can add image banners, product slider or text etc. from Magento admin Content >> Elements >> Pages page.
Regarding, color css changes you can go app/design/frontend/yourthemepackage/yourtheme/web/css/styles.css or you can add your custom theme also. if you add new custom css you need to define this css in default app/design/frontend/yourthemepackage/yourtheme/Magento_Theme/layout/default.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<!------- under head ------------>
<css src="css/Custome.css" />
<!------- under head ------------>
</head>
</page>
if you want to learn more about the magento you can follow up my youtube channel and if you have any issue you can also comment me. I will defiantly help you to learn.
blog: https://php-scripts-form.blogspot.com/
youtube channel : https://www.youtube.com/channel/UChb7DM9SspzrUVh4hnWL50A

As per our discussion i got what you want to do.
you can remove elements and block, containers via xml and also via phtml.
for remove block you can add
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="block.name" remove="true" />
</body>
</page>
And if you want to remove from phtml you can copy template from core theme. vendor/magento/{whichlementyouwanttoreoveendterspecifcmodule}/view/frontend/yourtemeplate.phtml
and copy it in your theme
app/design/frontend/yourthemepackage/yourtheme/yourelement/template/yourtemaplate.phtml
and you can manipulate your content. below i give you a real example for product detail page.
copy core file into your theme :
vendor/magento/module-catalog/view/frontend/templates/product/view/gallery.phtml
your theme path
app/design/frontend/Magento/luma/Magento_Catalog/templates/product/view/gallery.phtml
And after that remove content from gallery.phtml you can see in product detail page gallery will be reomve.
if you understand then good if not so you can connect with me real-time on Skype i will show you via screen share.
Please subscribe my youtube channel. https://www.youtube.com/channel/UChb7DM9SspzrUVh4hnWL50A

Related

Customize Hybris Backoffice login Theme

Anyone has an idea about how to change the default Backoffice Login Theme (Color, Background and image or any of these) ?
It could be helpful if you point out the file(s) responsible for this, or a specific way to customize it.
Using Hybris 6.0 or later.
Replacing Styles of Backoffice Application :
It is possible to replace the standard look and feel of the Backoffice Application. In other words, you can change the style sheet used in login page and main application pages including all components.
Files responsible for changing Backoffice main page style are located in the following key properties :
backoffice.cockpitng.mainpage.css=/cng/css/mainpage_whitelabel.css
backoffice.cockpitng.loginpage.css=/cng/css/loginpage_whitelabel.css
backoffice.cockpitng.overridewidgetsandeditors.css=/cng/css/customWidgetsAndEditors.css
For more about this topic, you can visit this link.

MVC5 MvcSiteMapProvider to display full sitemap

I successfully installed MvcSiteMapProvider, and got the breadcrumbs working and customizing the templates to generate Twitter Bootstrap navbar menu. Everything is honky dory. Now I'd like to have a view which sole purpose would be to display the whole sitemap hierarchy (in a tree structure, nodes would be clickable).
I've found traces of old ASP.NET sitemap solution to XSLT transform the sitemap XML file. That's not only a dead-end because it's old and doesn't look like a good idea, but I also take advantage of the annotation feature of MvcSiteMapProvider.
I don't use external DI framework.
I turn to here because my search attempts came out empty. I guess I could do something like the bootstrap navbar customization, creating some templates. But I'm sure I'm not the first one and I'd be happy to see some working code if there any out there.
Per the documentation:
Html.MvcSiteMap().SiteMap() - Can be used to generate a list of all pages in your sitemap
If that doesn't meet your needs, you could always build your own custom HTML helper to display the SiteMap per your requirements. Have a look at this answer for a demo showing how to create Next and Back links according to the document outline of the SiteMap.

How to customize the page?

I'm attempting to customize the Piranha CMS system. I'm interested in changing the layout, setting up my own styled menu and tweaking where the content on the page shows up.
Is the intent that I modify the _Layout.cshtml file to my liking?
If there's a page in the documentation that covers this, please helpfully provide the link. :)
Piranha CMS is just a framework for content management, not a website template with widgets, themes and stuff like that :) With that said, a basic Piranha CMS project is basically a standard MVC project with two included controllers, one that loads the model for a requested page, and one that loads the model for a requested post.
This means you can do anything that you can do with any normal MVC application when it comes to styling and modification.
There exists some helpers for rendering Menus, Breadcrumbs and so on. Documentation for the helpers can found here:
http://piranhacms.org/docs/api-reference/site-helper
http://piranhacms.org/docs/api-reference/ui-helper
For the helper methods that render html there are hooks for overriding all content rendered so that you can change the standard menu to your own style of html if you need. Documentation for the hooks available can be found here:
http://piranhacms.org/docs/api-reference/hooks
Regarding what can be achieved with Page types and creating templates with different regions you can check the following pages:
http://piranhacms.org/docs/pages/page-types
http://piranhacms.org/docs/pages/page-model
http://piranhacms.org/docs/pages/regions
http://piranhacms.org/docs/extend/extensions
I hope this helps you a bit.
Regards!
HÃ¥kan

How to use the Featured Item slider 2.0 in Orchard CMS

I am very new to orchard CMS... i am trying to make a site in orchard CMS as this is my first site in orchard... i am facing a fair bit of problem and hindrances to over come... my background of the CMS for creating websites is wordpress/PHP....
but now there in this project i have a problem for the slider in the home page! how could i implement a slider in the home page... after searching a bit i have found to use the featured image slider.. i have tried to implement it... i have installed the module and made the featured group... now MY PROBLEM IS WHERE I CAN ADD THE IMAGES IN THE SLIDER... AS THE FEATURE ITEM FROM THE MENU ONLY SHOW THREE FIELDS HEADLINE,SUB-HEADLINE, AND LINKURL...
kindly let me know where do i can add the images in this slider and show them on the home page of my site....
Thanks alot in advance....
After hell of the search i have got the solution for that purpose... i am elaborating my answer step wise so that the new guys like me should understand that without an inconvenience...
normally orchard CMS uses nivo slider bydefault... if you want to use other sliders follow the same path as pasted below...
1: if you have download the Orchard CMS there will be a Jquery function in the layout.cshtml and the jquery file will also be linked in the script tag, pointing to the package of Jquery in Js or anyother folder...
2: Get the name of the div for which the Jquery is pointing to... normally the name will be "slider".... Copy that name and paste it in your home from CMS... but make sure to keep the name of the div same as the Jquery function narrates which is ("slider").
3:Link your images in the Div...
and browse the site in the browser and enjoy the slider...
I have a fantastic tutorial on pepfry.com for this issue. I have a complete tutorial where I show you all the steps to successfully install the 'Featured Item Slider' with screenshots.
I also have a video on YouTube where you can see the Image slider working successfully.
Regards!
Sumesh M.S

Modify login page appearance, run javascript/jquery when login fails

I want to modify the appearance of the login page. I've added some jquery and javascript to DesktopModules/AuthenticationServices/DNN/Login.ascx so i could have a virtual keyboard which the user can use to type the username and password. The problem is that when the login fails, it seems to me that the jquery and the javascript scripts are not executed and consequently the virtual keyboard does not appear.
I've done a lot of search on this one. I'm considering making a new login module, but i'm not sure how or if this will enable me to solve the problem.
Any suggestions out there?
DNN Version: 6.1.3
I would advise against changing the core login directly, because it's considered a "core change" and would be overwritten in an upgrade. It would require that you merge your changes before upgrading every time.
Instead, if you require that level of access, I'd suggest creating your own login module.
In looking at your problem though, I don't think that's necessary. You could achieve this same effect by creating and implementing a skin widget. Skin widgets will allow you to manipulate the UI in nearly any way you can think of since you can use jQuery and inject jQuery plugins.
This is a much more elegant solution that can scale, is testable, safe against upgrades, and allows you to reuse it as needed across multiple sites and installations.
Examples of widgets and documentation can be found in the following two links:
DNN Widget Suite Project
Skin Widget Wiki Article with many linked resources
Like Will said you definitely should not edit or add code to the core files as they will get overwritten in DNN upgrades. You should be able to solve this with just Javascript, but you could also look at a 3rd party login module like this one: http://www.dnnspot.com/Modules/DotNetNuke-Custom-Login
Has features to customize the sign in view, logged in view, even error messages. So you should be able to inject different javascript as needed in different situations.
Disclaimer - I am affiliated with DNNspot.
I used this javascript On-Screen-Keyboard (OSK) which is lovely.
(http://www.greywyvern.com/code/javascript/keyboard)
I am using DNN 5.6.8 so I'm not sure if my solution works for DNN 6.x .
I modify the "page.ascx" file of the "skin" I'm using, but I think you can modify the "page.ascx" of the default skin as well.
At the top of the page.ascx, below the list of "Register"'s I wrote this:
<script type="text/javascript" src="/js/keyboard.js" charset="UTF-8"></script>
<link rel="stylesheet" type="text/css" href="/js/keyboard.css">
Those 2 files (keyboard.js and keyboard.css) are the on-screen-keyboard. You may store them in other folders than "/js" of course.
At the bottom of the page.ascx, I put this script:
<script type="text/javascript">
$(document).ready(function () {
if (document.getElementById('dnn_ctr_Login_Login_DNN_txtUsername') != null) {
$("#dnn_ctr_Login_Login_DNN_txtUsername").attr("lang", "es");
$("#dnn_ctr_Login_Login_DNN_txtPassword").attr("lang", "es");
VKI_attach(document.getElementById('dnn_ctr_Login_Login_DNN_txtUsername'));
VKI_attach(document.getElementById('dnn_ctr_Login_Login_DNN_txtPassword'));
}
});
</script>
These names: 'dnn_ctr_Login_Login_DNN_txtUsername' and 'dnn_ctr_Login_Login_DNN_txtPassword' were the ones I saw by right-clicking and "View source code" of my DNN site running, and I think there's no reason to think they can be different in other DNN sites, but nevertheless you can check yours.
Obviously you must have jQuery active in your DNN installation. :)
That's it. It works great!!
HTH!