OpenCart is a powerful open source shopping cart system. It has many features that enables you to setup your e-commerce business easily. Although the system is multilingual and templatable, its default theme doesn't support RTL. Here's how to add it..
<opencart_root>/catalog/language. It should include at least the english folder; copy that folder to another one named arabic, and rename the english.php file in the new folder to arabic.php (as we specified the Directory and Filename in the previous step)arabic.php file to find a list of localized variables. In our RTLing process, we only care about the direction which can be found at line #4 as:$_['direction'] = 'ltr'
change the value to be:
$_['direction'] = 'rtl'
and also update the
$_['code'] = 'en'
to be
$_['code'] = 'ar'
dir='rtl' in the html based on the $_['direction'] = 'rtl' in our language installation.Now that we prepared our multilingual OpenCart system. It's time to make it multidirectional.
<opencart_root>/catalog/view/theme/default/stylesheet.css and ie6.css. Copy these to rtl.stylesheet.css and rtl.ie6.css respectively and RTL the directional rules while ommiting the non directional ones ( e.g display:inline; ). (use the third method explained in the tutorial on how to RTL your CSS).Once you're done, all what we have to do is including these RTLed CSS in the template when an RTL language is being used. This is usually done in the ,<head> section. So..
<opencart_root>/catalog/view/theme/default/template/common/stylesheet.css is being added at line #19. Add your RTLed file after it if the direction is rtl like this:
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $template; ?>/stylesheet/stylesheet.css" />
<?php if($direction=='rtl'){?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $template; ?>/stylesheet/rtl.stylesheet.css" />
<?php }?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/ie6.css" />
<?php if($direction=='rtl'){?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $template; ?>/stylesheet/rtl.ie6.css" />
<?php }?>
And that's it =) You can download the RTLed default theme(but not localized) below. Should you find any bugs or better suggestions on how to achieve this, please do mention it in the comments form below.
Note:There are some cool folks who localized the whole thing to Arabic over here. But it totally replaces the default theme to strictly use the RTL layout and you can't use the theme in a multilingual site. You can use their language files with the theme we just RTLed to get a multilingual and bidirectional theme
There are currently 0 users online.
Comments
makeityour (not verified)
Wed, 14/12/2011 - 10:59
Permalink
makeityourring diamond engagement rings
I was just browsing for related blog posts for my project research and I happened to discover yours. Thanks for the excellent information!
Add new comment