Magento: Allow Other File Types in Wysiwyg Editor

While the Wysiwyg editor built-in to Magento is great, especially not having to install a wysiwyg module for every Magento installation, it lacks in any way to configure it. I am kind of shocked by this, but, that’s just the way it is right now (at least as of currently). If you want to be able to upload other types of files besides the few limited image types and media types, I’ll walk you through the ‘right’ way to do it, without modifying core code. We are going to make a very simple module with just 2 files. Here’s how you do it: Configuration File Create this file: app/code/local/Prattski/WysiwygFiles/etc/config.xml with the following code: <?xml version="1.0" encoding="UTF-8"?> <config> <modules> <Prattski_WysiwygFiles> <version>1.0.0</version> </Prattski_WysiwygFiles> </modules> <adminhtml> <cms> <browser> <extensions> <allowed> <jpg>1</jpg> <jpeg>1</jpeg> <png>1</png> <gif>1</gif> <pdf>1</pdf> </allowed> </extensions> </browser> </cms> </adminhtml> </config> This configuration file will just build off of Magento’s configuration file, adding allowed extensions (the original configuration file is app/code/core/Mage/Cms/etc/config.xml). As you can see, I added pdf as an allowed extension. Just follow the same format for other extensions if you’d like to add more. Module File Create the following file: app/etc/modules/Prattski_WysiwygFiles.xml with the following code: true local This is what enables the module and allows Magento to recognize it’s there and active. Once that is done, you should see the module listed in System >> Configuration >> Advanced, and it should work...

Read More

Magento Admin / Customer login problem

Problem: I had a new installation of magento. But I was unable to login as an administrator. I went to the admin login page, entered correct username and password but was redirected to the same login page. I could not enter the dashboard page. Error message is displayed when I enter wrong username or password. But nothing is displayed and I am redirected to the same login page when I insert correct username and password. Solution: I googled and found these solutions:- 1) Use instead of localhost in your url, i.e. using instead of http://localhost/magento/index.php/admin . But this didn’t solve my problem. 2) Since I am using Windows XP, I was suggested to open “host” file from C:\WINDOWS\system32\drivers\etc and have point to something like magento.localhost or even point to . But this also didn’t work either. 3) This solution finally helped me out of this problem. The solution was to modify the core Magento code. Open app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. Comment out the lines 80 to 83. The line number may vary according to the Magento version. But these lines are present somewhere near line 80. You have to comment the comma (,) in line: $this->getCookie()->getPath()//, // set session cookie params session_set_cookie_params( $this-&gt;getCookie()-&gt;getLifetime(), $this-&gt;getCookie()-&gt;getPath()//, //$this-&gt;getCookie()-&gt;getDomain(), //$this-&gt;getCookie()-&gt;isSecure(), //$this-&gt;getCookie()-&gt;getHttponly() ); Well, I am out of this problem. Hope, this solution you also help you. Update (For Magento 1.4.*) In Magento 1.4, you have to comment code from line 86 to 98 in app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. Like this:- /*  if (!$cookieParams['httponly']) { unset($cookieParams['httponly']); if (!$cookieParams['secure']) { unset($cookieParams['secure']); if (!$cookieParams['domain']) { unset($cookieParams['domain']); } } } if (isset($cookieParams['domain'])) { $cookieParams['domain'] = $cookie-&gt;getDomain(); } */ I found this useful code at...

Read More

Magento Javascript Validation Classes

Magento Javascript Validation Classes There are many more validation classes you can assign and I list them here as a reference. For more information on this please use Google, experiment with the code or contact me via my email or the contact form. validate-select Please select an option required-entry This is a required field validate-number Please enter a valid number in this field validate-digits Please use numbers only in this field. please avoid spaces or other characters such as dots or commas validate-alpha Please use letters only (a-z or A-Z) in this field. validate-code Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter. validate-alphanum Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed validate-street Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field validate-phoneStrict Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890 validate-phoneLax Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890 validate-fax Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890 validate-date Please enter a valid date validate-email Please enter a valid email address. For example validate-emailSender Please use only letters (a-z or A-Z), numbers (0-9) , underscore(_) or spaces in this field. validate-password Please enter 6 or more characters. Leading or trailing spaces will be ignored validate-admin-password Please enter 7 or more characters. Password should contain both numeric and alphabetic characters validate-cpassword Please make sure your passwords match validate-url Please enter a valid URL. http:// is required validate-clean-url Please enter a valid URL. For example or validate-identifier Please enter a valid Identifier. For example example-page, example-page.html or anotherlevel/example-page validate-xml-identifier Please enter a valid XML-identifier. For example something_1, block5, id-4 validate-ssn Please enter a valid social security number. For example 123-45-6789 validate-zip Please enter a valid zip code. For example 90602 or 90602-1234 validate-zip-international Please enter a valid zip code validate-date-au Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006 validate-currency-dollar Please enter a valid $ amount. For example $100.00 validate-one-required Please select one of the above options. validate-one-required-by-name Please select one of the options. validate-not-negative-number Please enter a valid number in this field validate-state Please select State/Province validate-new-password Please enter 6 or more characters. Leading or trailing spaces will be ignored validate-greater-than-zero Please enter a number greater than 0 in this field validate-zero-or-greater Please enter a number 0 or greater in this field validate-cc-number Please enter a valid credit card number. validate-cc-type Credit card number doesn\’t match credit...

Read More