Magento merge javascript omit files - magento

I've found that prototype.js messes up some things whenever I merge javascript on my store. Is there a way to have Magento omit prototype.js when it merges javascript files? I assume I could rewrite whatever function does this, but I'm not sure how to find where this happens. Is there a good way to find what is happening and where in Magento?

You can omit a file from being combined by adding a param. For example, in your page.xml you could change the following line:
<action method="addJs"><script>prototype/prototype.js</script></action>
to:
<action method="addJs"><script>prototype/prototype.js</script><params>prototype</params></action>
All files with the same param are combined together.

The magento merging system does n't work well in a lot of cases. I think for better understanding u should check Here
There is not an option to exclude a file from admin panel but i guess u can separate them by using grouping technology mentioned in the above blog.
Instead of using the default merging system i suggest u sld try FooMan Speedster

install mod_pagespeed by google on server zero configuration for your magento.

Try to load prototype.js link in head.phtml file. This way don't merge your file, and you don't need to add it via xml.
It is not the best practice anyway, but it works perfectly.

Related

Change Joomla 3 page url extension from .html to .htm

I am creating a website using Joomla 3 CMS. I have a requirement from my client that i need to change the existing page url extension from .html to .htm. As this website is redesign of a existing website the old links have .htm extension.
Open ../libraries/cms/router/site.php
Go to line number 144
And change
if ($format = $uri->getVar('format', 'html'))
to
if ($format = $uri->getVar('format', 'htm'))
I hope that helps
If you don't want to edit core files, and that is certainly not advised for sake of future upgrades. Your best solution is using a custom component for managing Joomla's SEF URLs, for example: sh404SEF (Paid) or JoomSEF (Free).
Check out http://extensions.joomla.org/category/site-management/sef for others.
Never ever edit Joomla Core files, otherwise when you upgrade Joomla, all your changes will be gone.
As #Alexxandar said; use SEO/SEF components for your needs. I recommend to use MijoSEF (Free or Paid)
Go to global configuration and remove the l from the suffix.
THis is a Joomla configuration question and a standard joomla configuration (not programming) option.
Now the one thing you will have to worry about is that if there are any old links to the htm pages. FOr this you will probably want to use the built in redirect component. Turn on the redirect plugin and then if you have a small number of pages you can just set up the redirection by hand. If you have more pages you may want to write the sql to create a bunch of redirects. Or you might want to make your own plugin to permanently redirect the old to the new.

magento 2 custom phtml page

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"}}

How to create Directory/Folder when using Magento?

We are running magento on our site www.xsmoke.com. The site is international, so we are using "/country code" - e.g.www.xsmoke.com/de/ etc.
Now we would like to install wordpress in one of the languages only and we want the URL to be "xsmoke.com/de/blog".
But i can't create a folder on that location for the wordpress files because of magento.. Does anyone have an idea for a workaround?
Thanks.
I'm not sure how you've set things up but it would be possible to do this by using the technique involving directories and symlinks for multiple websites (rather than have Magento include the store codes in the url). See the below answer on how to do that;
https://magento.stackexchange.com/questions/13171/multiple-country-specific-stores-on-the-same-domain-show-country-selection-firs#answer-13173
And you'd then just install Wordpress in the /de/blog directory. Otherwise you might be better asking another question tagged with .htaccess and ask for a way to do a rewrite that would handle it in the context of Magento's existing rewrites.

Magento empty page in checkout/cart

Got a problem with adding products to the cart, it goes to the checkout page but the page is empty apart from the surrounding header/footer template.
Ive tried everything i can think of, its not the theme (happens on all themes), i tried diabling compiler and flushing caches etc..
No errors in the server log, i have another magento installation on the same server and that is working fine. Tried disabling all 3rd party extensions too.
Any other places i can look? Im lost!
If header/footer exists it means that script worked from start till end, but might be with some errors. Generally you should first of all try to look for all remove directives in your layout xml files(grep helps). It might be that the content area is simply removed by some xml.
In case XML way thing didn't worked, the things are getting tougher. You should check every template file which should be rendered in the content. it might be that content is somehow commented out.
The other thing to consider is, as far as I remember, the content block should have type list or output="toHtml" so it would be rendered automatically.
At the moment that's all what I might think off. Oh ya! And check that checkout module is enabled and it's output also enabled!
To check if module enabled you should open the Mage_Checkout.xml or Mage_Cart.xml and check if the both enabled at all.
After that in admin panel there is such page as Disable Modules Output where the output of the cart module might be disabled.
Very important note!
Make sure you disable all custom modules and not simply disable their output. Because in latter case you will have module working, simply with no output.
Make sure you check in configuration > advanced
Make sure you check the mage_checkout is enabled both on default but also (more importantly) at your store level (adjust global scope in the top left).
Chances are mage_checkout could just be disabled at your store level for some reason.

Magento - $this->getSkinUrl() returns Wrong theme in homepage

I use a template with 3 columns in homepage, in my file right_col.phtml I use "$this->getSkinUrl()" and that returns me the wrong theme: /default/default/ instead of /default/my_second_theme, but it works good in all other pages.
How can I fix this problem to get the good theme??
Thanks a lot.
Also make sure that the asset actually exists (or that you specify an existing path). If an asset is not found in any theme, Magento will always use default/default as the resulting skin path.
Check the CMS page for the home page, go to the Design tab, and make sure that you didn't set the "Custom Theme" to something that is overriding the theme that you want to use.
Check the $argument you are passing and verify that the target file actually exists. getSkinUrl() does more than just generate the proper URL, it also verifies that the file exists. If it doesn’t find the file within the store’s /default/my_second_theme folder, it will revert to /default.
Refer to: http://www.nvncbl.com/2009/10/magento-this-getskinurl-wrong-template/
I have used this to solve it :
if (Mage::app()->getStore()->getCode()=='deutsch') {
Mage::getDesign()->setTheme('deutsch');
}
It works good now ;)

Resources