You are here: Shopping Carts Magento Commerce Tips and Tricks

Tips And Tricks

Launching your store in a production environment, configuring taxes tips.

Defining tax rates and zones is mostly taken care of right before launch and such an effort and configuration is typically specific to your business requirements and rules. Importing tax rates using the CSV import is an frequent issue. Users were editing with Microsoft Excel, will creating the CSV file to import. All the CSV file to be enclosed with double quotation marks and Excel removes these, since Magento requires double quotation. Magento will not be able to read the CSV file properly (Applicable to all CSV import files in Magento).

Example of files edited in Excel (while opening on notepad or any other text editor

Code,Country,State,Zip/Post Code,Rate,default
US-NY-12007-Rate 1,US,NY,12007,4,
US-NY-12009-Rate 1,US,NY,12009,4,
US-NY-12023-Rate 1,US,NY,12023,4,
US-NY-12041-Rate 1,US,NY,12041,4,

Proper file format with double quotation marks

"Code","Country","State","Zip/Post Code","Rate","default"
"US-NY-12007-Rate 1","US","NY","12007","4",
"US-NY-12009-Rate 1","US","NY","12009","4",
"US-NY-12023-Rate 1","US","NY","12023","4",
"US-NY-12041-Rate 1","US","NY","12041","4",

Magento’s default setting is the complete opposite, please keep in mind, if you need to apply tax to the shipping fees. However this can be modified by selecting on the dropdown located under System> Configuration > Sales > Tax > Tax Classes > Tax Class for Shipping the desired tax class for your selected carrier’s fees.

WYSIWYG Editors

Still Magento Version 1.0 doesn’t turn on WYSIWYG functionality by default. WYSIWYG editors are a convenient way to add content pages, products and categories; also it is more human-readable.

There is a TinyMCE developed by MoxieCode WYSIWYG editor installed with Magento. If you are not a fan or big fan of TinyMCE or want to try new, FCKeditor can easily get installed.

TinyMCE:

TinyMCE doesn’t work for Category description fields is the only drawback of it.

Where to get it

Download the files from http://tinymce.moxiecode.com/download.php and upload to your Magento installation. Use the directory /js/tiny_mce/ (from downloaded archive take the directory tinymce/jscripts/tiny_mce/).

Working

This text works on product page for version 1.1.6. UPDATED the tiny MCE code for unescaped " and it works now for the CMS example

 

Embed the code into the pages containing textarea elements you wish to attach the WYSIWYG to. Sure it the path is correct to the .js file also the elements used in the tinyMCE init function.

Where to insert it

  • Add the code around line 54 (line 49 on 1.1.1) of app/design/adminhtml/defaut/default/template/catalog/product/edit.phtml, for the product. To match your setup change the path to the javascript file in the code below.
  • Edit the function getElementHtml() around line 45 of lib/Varien/Data/Form/Element/Editor.php, for the CMS.
 

Check the path to the js file, getElementHtml function also has an if statement so the code you’ve added won’t be executed unless you change the field type to WYSIWYG.

       if( $this->getWysiwyg() === true)

Also you can do this in /magento/app/code/core/Mage/Adminhtml/Block/Cms/Page/Edit/Tab/Main.php, near the bottom:

TinyMCE should look like this: when you get it working.
You can also change width and height of the editor in /magento/skin/adminhtml/.../.../boxes.css in line 405 and 406 (v1.1.1). To change the size of the editor on the fly, TinyMCE has nice features, so this is not absolutely needed.

FCKeditor

 

Where to get it

FCKEditor can get downloaded from the FCKeditor website

How to install it

Unzip the fckeditor folder as per choice of location, the best places for it are your Magento install’s root or inside the js folder.

Working

Insert the following code, to call FCKeditor on any page.

Without any customization FCKeditor looks like on the category page:

For CMS pages

Go in /app/code/core/Mage/Adminhtml/Block/CMS/Page/Edit/Tab/Main.php and modify

Go in /lib/Varien/Data/Form/Element/Editor.php and replace $html = ‘...’; by

Without touching the core files

You dont have to touch the core files of Magento because these are workarounds.

Method 1:

Add the code around line 12 of “app/design/adminhtml/default/default/template/page/head.phtml”.
After:

Method 2:

Insert the following code into magento/app/design/adminhtml/default/default/template/page/head.phtml:

Method 3:

Insert the following code into magento/app/design/adminhtml/default/default/template/page/head.phtml: Start on the ?> line and insert this

Make it BIGGER

For magento 1.0 release for WYSIWYG on CMS, replace in skin/adminhtml/default/default/boxes.css:

Additional Tips and Tricks

Use fckEdit to upload images

1. To store uploaded files Create directory.
2. ChMod newly created dir to 777
3. Edit connector files under /js/fckeditor/editor/filemanager/connectors/php/config.php
Change:  

  1. $Config['Enabled'] = true ;
  2. // WARNING !
  3. // Set it to hard coded 'true' is a SECURITY hole, you must check it against the PHP admin session ...
  4. // Something like (not tested !!) :
  5. // session_name('adminhtml');
  6. // session_start();
  7. // $Config['Enabled'] = array_key_exists('user', $_SESSION);
  8. //
  9. // http://www.mail-archive.com/ This e-mail address is being protected from spambots. You need JavaScript enabled to view it /msg00006.html
  10. //
  11. $Config['UserFilesPath'] = '/media/upload/' ;

Description apply to Apache/PHP installation. For Windows/other look at others catalogues to find proper connector.

Problems?

When creating new products, categories, and cms pages. Magento wouldn’t recognize the information enterted into FCK’s editing field. To get around this add the following javascript, which injects some text into the textarea prior to being converted to FCKEditor.

...

Enter" />

For people, which dont have any idea where to put above code there is other solution for saving new files created in fckEditor. Please look at: http://www.magentocommerce.com/boards/viewthread/7596/
In newly created pages use fckEditor build-in SAVE button first


Whom are using Magento version 1.0.19870.4 and couldn’t get things working using the above tutorial.
For some reason if anyone didn’t have the tinyMCE folder in the js folder, manually download TinyMCE 3.1.0.1 from http://tinymce.moxiecode.com/ and put the javascript files in a selfmade /js/tiny_mce folder. (The javascript files are in the folder where the file ‘tiny_mce.js’ is located)
Change file app/code/core/Mage/Admin/html/Block/Cms/Page/Edit/Tab/Main.php and put the wysiwyg value on line 100 to true so it looks like this:

Notice the url http://www.your-domain.com/skin/frontend/interface/theme/css/styles.css which you should replace with the correct values to see the right styles.
Change file app/design/admin/html/default/default/template/page.phtml and add the following code after line 37:

<script type="text/javascript" src="<?php echo $this->getJsUrl('tiny_mce/tiny_mce.js') ?>" language="javascript"></script>

Warning: This is not the most correct way to include the javascript, but it was the only solution to include it in the right place and the right way.


Who ever had trouble for getting the FCKeditor to display properly in the category admin page (Magento version 1.3.2.4). Add a few work arounds.
First off in the adminhtml head file (/app/design/adminhtml/default/default/template/page/head.phtml) move the script call into its own function and call that function from the window.onload:
<script type=”text/javascript” src=”/js/fckeditor/fckeditor.js”></script> <script type=”text/javascript”> function wysiwyg() {

This now makes FCKeditor show up when editing all category pages.