Skip to main content

Posts

Showing posts from 2016

Configuring php ini settings on magento

Depending on your hosting company, you may or may not be able to change the settings of the php. In that case, we have our custom php.ini file in magento. The php.ini file is location under the root of magento installation with the name of php.ini.sample. Open this file and make the necessary changes to php settings as shown below, ; This file is for CGI/FastCGI installations. ; Try copying it to php5.ini, if it doesn't work ; adjust memory limit memory_limit = 64M max_execution_time = 18000 ; disable magic quotes for php request vars magic_quotes_gpc = off ; disable automatic session start ; before autoload was initialized flag session.auto_start = off ; enable resulting html compression zlib.output_compression = on ; disable user agent verification to not break multiple image upload suhosin.session.cryptua = off ; turn off compatibility with PHP4 when dealing with objects   zend.ze1_compatibility_mode = off ; PHP for some reason ignores this set

Magento js validation message translation

Magento includes the translator library to translate the js messages that appear on our site. The translator js is already included at the head. To translate our messages, we just need to add the text to transator. For eg: This translator code needs to be added on our phtml file.  Translator.add('Select a color.', "<?php echo $this->__('Select a color.');?>"); Then we need to add the text to translate at locale file i.e translate.csv at the locale folder. However, this will not work for prototype js validation messages that appear on checkout pages. e.g. "This is a required field." etc. To translate these validation messages, we need to we’ll override Magento’s validate method. For that, we need to create an external js file and place it under js folder. For eg: js/lib/translatejs.js Validation.addAllThese([     ['validate-no-html-tags', Translator.translate('HTML tags are not allowed'), function(v)

OpenCart Custom theme development and integration

Well, Opencart is a lightweight, opensource and relatively fast e-commerce framework. We can easily setup our store with opencart. It's built with PHP and Mysql (for database). So, setting up theme for our store is an important part when creating a web store. The user interface and design plays a key role in any e-commerce store. In Opencart, we can integrate our custom theme too. For this, we need to create a basic html (mockup) of our custom design. 1. Then, install opencart if not installed. If already installed, go to catalog/view/theme folder. 2. There we can see the default theme of opencart. Copy the contents of that theme and create another theme for eg. catalog/view/theme/mytheme. "mytheme" is the new theme. 3. Paste the contents of the default theme on this newly created one. 4. Now, we need to modify the contents of the copied theme. 5. The folder structure of any theme is like as shown below: i. The "font" folder will have the extr

Error Reporting in Php

PHP error reporting. To be enable to switch between error_reporting during development and release phases, one can define say 'php_error_reporting' in the main configuration file. # 0 - Turn off all error reporting # 1 - Running errors # 2 - Running errors + notices # 3 - All errors except notices and warnings # 4 - All errors except notices # 5 - All errors php_error_reporting=4 Setting error_reporting in PHP files would be something like the code below, <?php // setting PHP error reporting switch(case) { case 0: error_reporting(0); break; case 1: error_reporting(E_ERROR | E_WARNING | E_PARSE); break; case 2: error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); break; case 3: error_reporting(E_ALL ^ (E_NOTICE | E_WARNING)); break; case 4: error_reporting(E_ALL ^ E_NOTICE); break; case 5: error_reporting(E_ALL); break; default:     error_reporting(E_ALL);

Setting up virtual host

WAMP or  XAMPP server lets our sites to browse by using the url:   http ://localhost . For eg:  http ://localhost/mysite . But we may need to test out environments which would require different domains, like http://local.server.com. For this, we need to configure the virtual hosts file of our apache server. These are the steps we need to configure vitual host on windows os: 1. Open vhosts.conf file. Location: xampp/apache/conf/extra 2. Add the following code at the end of the file. <VirtualHost *:80>     DocumentRoot "D:\xampp\htdocs"     ServerName localhost </VirtualHost> <VirtualHost local.server.com:80> <!-- this is the vitual host -->     DocumentRoot "D:\xampp\htdocs"     ServerName local.server.com     <Directory "D:\xampp\htdocs">         Order allow,deny         Allow from all     </Directory> </VirtualHost> 3. Edit the windows hosts file residing at C:/Windows/System32/drivers/