Monday, 1 December 2014

Ubuntu 14.04 : Add 1280 x 1024 screen resolution

Spent around 2 hours to set new resolution for Ubuntu 14.04 and when come to know the right way it took only 5 minutes. So, writing this post so that it can save someone else's time.

Following are the steps to add 1280 x 1024 screen resolution in Ubuntu 14.04

1) Create /etc/X11/xorg.conf file with following content:

Section "Monitor"
    Identifier    "Monitor0"
    Modeline "1280x1024_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync

Section "Screen"
    Identifier     "Screen0"
    Device         "Card0"
    Monitor        "Monitor0"
    SubSection "Display"
        Modes       "1280x1024_60.00"

Section "Device"
    Identifier    "Card0"
    Driver        "intel"

2) Restart Ubuntu

That's it.

Notes :

a) To get Modeline use following command:

cvt <h-resolution> <v-resolution>

e.g $ cvt 1280 1024

it will return : Modeline "1280x1024_60.00"  109.00  1280 1368 1496 1712  1024 1027 1034 1063 -hsync +vsync

b) To get Device Driver use following command :

lshw -class display | grep "driver"

For intel graphic chip driver is intel only.

Sunday, 23 November 2014

Odoo/OpenERP : Populate one2many list using on_change method

Following is the method to update/populate simple field value using on_change method:

return {'value' : {'field_name' : <field_value>}}

Most of the OpenERP developers will be aware of it.

What we will do if we have to add one2many list using on_change method? For example : I want to display list of leaves allotted, leaves taken and leaves pending of an employee. So on_change employee_id I want to show related updated leave list. leave_ids is one2many field in my main table.

what we have to do is as follow:

leave_ids = []       
for record in records:
    if record:
        leave_ids.append([0,0, {'holiday_status_id':record,'max_leaves':records[record]['max_leaves'],'leaves_taken':records[record]['leaves_taken'],'remaining_leaves':records[record]['remaining_leaves']}])

return {'value' : {'leave_ids' : leave_ids}}

Hopefully it will help someone.

If you need more detail on this. Please post your valuable comments.

Thanks!!!!!!!!!!!! Enjoy Programming :)

Reference Link :

Saturday, 15 November 2014

Odoo/OpenERP: Create multiple sequence codes from single file

You can create multiple sequence codes from single sequence file. For example, if you want to create different employee codes for 'Regular Employee' and 'Trainee Employee' you can use single sequence file and achieve your results. As follow:

If you don't know at all about sequences, how to create sequence in Odoo/OpenERP, Please click here.


<?xml version="1.0" encoding="utf-8"?>

    <!-- Sequences for Regular Employee code -->
    <record id="emp_code_sequence" model="ir.sequence.type">  
        <field name="name">Employee Code</field>
        <field name="code">hr.employee</field>

    <record id="seq_hr_employee" model="ir.sequence">
        <field name="name">Employee Code</field>
        <field name="code">hr.employee</field>
        <field name="padding">5</field>
        <field name="company_id" eval="False"/>
    <!-- End of code for employee code sequence-->

    <!-- Sequences for Trainee code -->
    <record id="trainee_code_sequence" model="ir.sequence.type">
        <field name="name">Trainee Code</field>
        <field name="code">hr.trainee</field>
    <record id="seq_hr_trainee" model="ir.sequence">
        <field name="name">Trainee Code</field>
        <field name="code">hr.trainee</field>
        <field name="padding">5</field>
        <field name="prefix">TR</field>
        <field name="company_id" eval="False"/>
    <!-- End of code for Trainee code sequence-->




<button name="generate_emp_code" string="Generate Employee Code" type="object" class="oe_highlight" attrs="{'invisible':[('emp_code','!=',False),]}" groups="base.group_hr_manager" context="{'employment_type_id':employment_type_id}" />

def generate_emp_code(self, cr,uid, ids, context=None):
    if context == None:
        return False
    if not context.get('employment_type_id', False):
        return False

    employment_type_id = context.get('employment_type_id')
    emp_code_details = self.pool.get('employment.type').read(cr, uid, employment_type_id, ['name'])
    if emp_code_details['name'] == 'Trainee':
        emp_code_val=self.pool.get('ir.sequence').get(cr, uid,'hr.trainee')
        emp_code_val=self.pool.get('ir.sequence').get(cr, uid,'hr.employee')

    res=super(hr_employee, self).write(cr, uid, ids, {'emp_code':emp_code_val})

        return res

That's it.

Thanks!!!!!!!!!! Enjoy Programming :)

Saturday, 8 November 2014

Odoo/OpenERP : Module files sequence in

This post is regarding, how to add module files in sequence in file. If you are not adding files in proper sequence you will face an error. For example:

Wrong sequence:

    'name': 'Employee Data Module',
    'version': '1.0',
    'category': 'Human Resources',
    'description':"""Add details of employee""",
    'author':'Shiv Shankar',
    'website': '',
    'images': [],
    'depends':['base','mail', 'hr',],

In above data files sequence - view & workflow files has been loaded before group and rule files. So if we are using any group defined in user_groups.xml file, in view files it will throw an error because group is still not loaded. It will always be good if we can use the following sequence :

Correct Sequence:

Hopefully it will help someone.

Thanks!!!!!!!!!!!! Enjoy Programming :)

Saturday, 1 November 2014

Oddo/OpenERP: Overwrite ACL permissions

To overwrite ACL permission in Odoo, you have to overwrite id of that ACL record. For example by default in Employee Appraisals module Human Resource/ Officer user group is given full permissions as follow.

id - access_survey_page_hr_user
name -
model_id:id - survey.model_survey_page
group_id:id - base.group_hr_user
perm_read - 1
perm_write - 1
perm_create - 1
perm_unlink - 1

and later in your customized module you decide to revoke unlink permission for that user group you have to just keep exact id and change permissions section. ACL record will be as follow:

id - access_survey_page_hr_user
name -
model_id:id - survey.model_survey_page
group_id:id - base.group_hr_user
perm_read - 1
perm_write - 1
perm_create - 1
perm_unlink - 0

Hopefully it will help someone.

Thanks!!!!!!!!!!!!! Enjoy Programming :)

Reference Link:

Saturday, 25 October 2014

Odoo/OpenERP : Call function on button

There are three ways to add functionality on button in OpenERP/Odoo:

1. Call function directly on button: You can directly call the function defined in model/class using type="object" attribute.


<button string="Check availability" name="check_username_availability" type="object" class="oe_highlight" />

In this case you have to define 'check_username_availablilty' function in model.

2. Using Workflow: Workflow is the most used functionality in OpenERP/Odoo to process flow of the activity. Default type of button is workflow i.e type="workflow".  Workflow itself is an vital topic so can't talk much about this here.

<button string="Accept" name="signal_accept" type="workflow" class="oe_highlight" />

3. Using action: You have to user type="action" if you want to call any action defined in the .xml file. For example if you want to open any wizard you can use following code snippet:

<button name="%(action_id)d" string="Button Label" type="action">

or you can replace %(action_id)d with action id from database.

Reference Links:

Thanks!!!!!!!!!! Enjoy Programming :)

Sunday, 5 October 2014

Odoo/OpenERP: one2one relational field example

one2one relational field is deprecated in OpenERP version>5 but you can achieve the same using many2one relational field. You can achieve it in following two ways :

1) using many2one field in both the objects (

2)  using inheritance by deligation

You can easily find the first solution with little search over internet so let's start with 2nd solution.

Scenario : 

I want to create a one2one relation between two objects of openerp




What I should do 

i. Add _inherits section in hr_employee class
ii. Add field medical_detail_id in hr_employee class

class hr_employee(osv.osv):
    _name = 'hr.employee'
    _inherits = {'hr.employee.medical.details': "medical_detail_id"}
    _inherit = 'hr.employee'    
    _columns = {
             'emp_code':fields.char('Employee Code', size=6, readonly=True),
             'medical_detail_id':fields.many2one('hr.employee.medical.details', 'Medical       
             Details',help="Link this employee to it's medical details", ondelete="cascade", required=True),

You don't have to do anything with 'hr.employee.medical.details' object

iii. Add fields in hr_employee_view.xml file

<group col="4" string="Medical Details">            
    <field name="medical_detail_id" invisible="1" required="0" colspan="4" />
    <field name="blood_group" />
    <field name="medicine" />
    <field name="medicine_desc" />
    <field name="allergies" />
    <field name="allergies_desc" />

and you are done. It will create exactly one record each employee entry in
hr.employee.medical.details table.

Please let me know if you are facing any issue to implement it.

Thanks!!!!!!!!!!!!!!!! Enjoy Programming :)

Saturday, 4 October 2014

Odoo/OpenERP: Generate Employee Code

Employee code can be generated in following three simple steps:

1. Create a sequence file


<?xml version="1.0" encoding="utf-8"?>
        <!-- Sequences for employee code -->
        <record id="emp_code_sequence" model="ir.sequence.type">
            <field name="name">Employee Code</field>
            <field name="code">hr.employee</field>

        <record id="seq_hr_employee" model="ir.sequence">
            <field name="name">Employee Code</field>
            <field name="code">hr.employee</field>
           <field name="prefix">EMP</field>
            <field name="padding">5</field>
            <field name="company_id" eval="False"/>
        <!-- End of Sequence code for employee code -->


2. Add new field to class

class hr_employee(osv.osv):
    _name = 'hr.employee'
    _inherit = 'hr.employee'    
    _columns = {
                'emp_code':fields.char('Employee Code', size=8, readonly=True)

3. Update database

def create(self, cr, uid, vals, context=None):
        vals['emp_code']=self.pool.get('ir.sequence').get(cr, uid,'hr.employee')
        res=super(hr_employee, self).create(cr, uid, vals)
        return res

create function will be called only when new employee is added.

and you are done.

Employee code will start from EMP00001

You can generate emp_code without sequence file as well and write code directly in create function as well. But standard way is using sequence file only.

Note: Don't forget to include 'emp_code_sequence_view.xml' file in data section of '' file.

Thanks!!!!!!!!! Enjoy Programming :)

Saturday, 20 September 2014

Odoo/OpenERP : _rec_name and name_get()

_rec_name = ‘name’ (by default) 

where ‘name’ is field of the model. If ‘name’ field is not there then you have to assign any other filed name to this ‘_rec_name’ variable from columns.

Note : If ‘name’ field is there in your columns then there is no need to specify '_rec_name'.

Let’s try to dig more using an example.

Case I:

If you are having hr.employee module with name field and you are using it as reference in other module, say hr.employee.detail to provide other employee details then you will use it as:

'employee_id' : fields.many2one('hr.employee', 'Employee')

and it will show you the employee name in selection list.

But, In a company, more than one employee can share the same name. So name field can’t be used to differentiate them from each other. But, employee code will be unique for each employee. In such cases, we will take a column field like ‘emp_code’ and will assign it to ‘_rec_name’

_rec_name = ‘emp_code’

So that it can show employee code in dropdown instead of employee name.

Note : In both above cases 'id' will only be store in database. If will affect only the display part.

Case II: 

In same above example if your manager asks you to show combination of both i.e Employee Name, Employee Code what you will do?

In this case we will override name_get() method in hr.employee module

def name_get(self, cr, uid, ids, context={}):
        if not len(ids):
            return []


        for emp in self.browse(cr, uid, ids,context=context):
   res.append((, + ', ' + emp.emp_code))    

        return res

and it will display combination of both in drop-down.

Thanks!!!!!!!!!! Enjoy Programming :)

Sunday, 10 August 2014

Odoo/ OpenERP: Calculate difference between two dates

from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta

date_format = '%Y-%m-%d'

joining_date = '2013-08-23'
current_date = (

d1 = datetime.strptime(joining_date, date_format).date()
d2 = datetime.strptime(current_date, date_format).date()
r = relativedelta(d2,d1)

print r.years
print r.months
print r.days

Thanks!!!!!!!!! Enjoy Programming :)

Saturday, 2 August 2014

File upload not working on PHP Server

Few days back, our team faced a new issue in file upload on server. It was restricting user to upload file size over 8KB while the following parameters were already set :

php_value file_uploads  On
php_value upload_max_filesize 200M
php_value memory_limit  512M
php_value post_max_size 200M
php_value max_execution_time 1000
php_value max_input_time 300

but still file uploading was not working.

Searched over internet and found that above problem was due to LimitRequestBody Directive of Apache. This parameter Restricts the total size of the HTTP request body sent from the client.

"The LimitRequestBody directive allows the user to set a limit on the allowed size of an HTTP request message body within the context in which the directive is given (server, per-directory, per-file or per-location). If the client request exceeds that limit, the server will return an error response instead of servicing the request. The size of a normal request message body will vary greatly depending on the nature of the resource and the methods allowed on that resource."

If, for example, you are permitting file upload to a particular location, and wish to limit the size of the uploaded file to 100K, you might use the following directive:

LimitRequestBody 102400

Please chekc the following link for full description :

Thanks!!!!!!!! Enjoy Programming :)

Friday, 18 July 2014

Odoo/ OpenERP Common Errors

From last one month started working on OpenERP. While customizing code daily facing one or the other issue. So thought of keeping all of them at one place with solutions for future use and may be can help someone else as well :

1) AttributeError: 'NoneType' object has no attribute '_columns'

Solution : Problem is with your file. Check depends attribute.

Reference Links :

2) Openerp : new module is not showing into module list?

Solution : If you have developed a new module and it's in the addons folder but still not showing in the module list than follow following steps :

a) Restart OpenERP server by using command :

./openerp-server --addons-path=XXXX/XXXXXXX/addons/ (path of addons directory)

b) Go to the browser and open

localhost:8069 or

c) Login into OpenERP; Go to Settings menu; Users; Select your user, edit it and check the check-box of 'Technical Features', save it and reload the web page.

d) Again Go to Settings, you will find two more options under Modules section

  • Update Modules List
  • Apply Scheduled Upgrades

Click on 'Update Modules list' option. Update modules.

e) Now search your module using 'Installed Modules' option.

That's it.

Reference Links :

3) Model XXX is declared but cannot be added/loaded

Solution : Problem is with xxx model entry in ir_model table.

a) Login to PostgeSQL database using psql or pgAdmin III

b) Run following commands :

Delete from ir_model_constraint where model=(Select id from ir_model where name='xxx');

Delete from ir_model where name='xxx';

Hopefully this will fix your problem.

Reference Links :

4) KeyError: 22

Solution: Most of the times this error is due to the wrong way of returning values from function. For more information, please check following reference link:

Reference Link:

Many more to come.....

Saturday, 5 July 2014

Odoo/ OpenERP: Customize one2many relational field

I was working on one2many relational field to integration one functionality. Worked on python code and then wrote an xml file for the same. Restarted my server. It showed me the row with headers and 'Add an item' button. When clicked on that it opened a pop-up to provide inputs. It shows all the fields with in sequence of it's own.

Q1. I need input fields in other sequence or don't need all fields.

A.   In xml you would have wrote code like this :

<field name="dirtyhandsphp" widget="one2many_list" colspan="4" nolabel="1">
<tree string="Details">
             <field name="field1" />
             <field name="field2" />
             <field name="designation" />

Add form section inside and mention all the fields you needed, as follow :

<field name="dirtyhandsphp" widget="one2many_list" colspan="4" nolabel="1">
<tree string="Details">
             <field name="field1" />
             <field name="field2" />
             <field name="designation" />
        <form string="Details" editable="bottom">
             <field name="field1" />
             <field name="field2" />
             <field name="designation" />

Q2. Fields are few so want to edit at the same place. No separate pop-up.

A. Add editable attribute to tree tag as follow

<tree string="Details" editable="bottom">


<tree string="Details" editable="top">

Thanks!!!!!!!! Enjoy Programming:)

Friday, 4 July 2014

Odoo/OpenERP: Custom unique name constraint with ignore case

#custom unique name constraint with ignore case

def _check_unique_insesitive(self, cr, uid, ids, context=None):

        list_ids =, uid , [], context=context)

        lst = [ for list_id in self.browse(cr, uid, list_ids, context=context) if and not in ids]

        for self_obj in self.browse(cr, uid, ids, context=context):
            if and in lst:
                return False
            return True

Use as following in your class :

_constraints = [(_check_unique_insesitive, <error_message>, ['<field_name>'])] 

e.g : _constraints = [(_check_unique_insesitive, 'Name already exists', ['name'])] 

Thanks!!!!!!!!!! Enjoy Programming :)

Reference Link :

Wednesday, 2 July 2014

Odoo/OpenERP Warning : invalid module names, ignored

Create a new module and new class. After adding 2 variables in class, I tried to restart OpenERP server with following command :

Command : $./openerp-server -u <module_name> -d <db_name>

Example : $./openerp-server -u my_training -d training

Server got started but showed me following warning message on console :

Warning :  invalid module names, ignored

Checked code and followed all necessary steps to check each and everything but was not getting any clue. After some time found a link and ran following command on console :

Command : $./openerp-server -u base -i <module_name> -d <db_name>

Example : $./openerp-server -u base -i my_training -d training

It worked. What this command will do is; it will install all the base modules and update your new module as well.

I feel like this solution is good but not the best. If someone else is having better one please don't hesitate to post as comments.

Thanks!!!!!! Enjoy Programming :)

Reference Link :

Thursday, 19 June 2014

Creately for Diagramming

In IT world, day-to-day activities, we have to work with projects and provide some wireframes, flowcharts and other graphical diagrams to internal (seniors) and external clients. There are a lot of tools available to create all these diagrams.

Few days back, from one of my senior I come to know about Creately, an online fast tool to create wireframes, flowcharts, graphical diagrams etc. You can draw almost everything using Creately. It’s really user friendly. You will create your diagram; do changes; save it there. You can export it in form of Image, PDF or SVG file.

You can start using it with Google account from here:

Or directly from their website:

I love it the way it works.

You can use Free or Paid account. In case you are using free account you have to share your diagrams publicly. That’s the only and the biggest disadvantage they are having.

Thanks!!!!!!!! Enjoy Programming J

Sunday, 15 June 2014

Use Google as external email service

Undoubtedly, Gmail has become a very important part of each and everyday's life. Through Google Apps, they have given freedom to use Gmail for business purpose as well. Google Apps is having feature to feel like you are sending emails through your own servers, instead of Google server. You can use email id's like, etc.. and on backend emails are sent through Gmail. Let's see how we can handle this whole thing :

1. To set up an external email, first of all, you should have domain name and it's control panel.

2. Go to link : and setup your Google Apps account.

3. Login to your control panel and navigate to Mail Manager. Point DNS Server’s MX records to Google Apps. Add following MX entries :

ASPMX.L.GOOGLE.COM with priority 1
ALT1.ASPMX.L.GOOGLE.COM with priority 5
ALT2.ASPMX.L.GOOGLE.COM with priority 5
ASPMX2.GOOGLEMAIL.COM with priority 10
ASPMX3.GOOGLEMAIL.COM with priority 10

Save them

and will look like this : 

Note : TTL should not more than 3600 seconds for Google records. 

and we are done with set up!!!!

Please let me know if you guys are facing any problem with it.

Thanks!!!!!!!!!! Enjoy Programming :)

Reference Links :

Sunday, 1 June 2014

Important links for bloggers

Add custom field in Odoo/OpenERP

Today, I decided to write a tutorial on topic 'Add custom field in OpenERP' and one video was exact the same i was suppose to write. So thought of sharing that only instead of reinventing the wheel.

Please check here :

If you found any problem in accessing the video or if you are not able to understand the steps from it, Please post you comments.

Thanks!!!!!!!! Enjoy Programming :)

Sunday, 25 May 2014

Odoo/OpenERP opererp-server file

Since few days, working with OpenERP backend section. I did some coding changes in Python but was not able to restart OpenERP service due to commented and wrong python file openerp-server. File was at following location of my server : /etc/init.d/openerp-server

Checked over internet and didn't find any relevant answer which could have solved my problem. After spending few hours i corrected my file that's running successfully now. Please check attached file here.


Hopefully it will someone else's issue as well.

Thanks!!!!!!!!!!! Enjoy Programming :)

Tuesday, 13 May 2014

CakePHP TinyMCE Validation Problem

In development world, daily we face lot of problems, some are big while some are minor. Sometimes it takes a lot of time to fix small one than bigger ones. Similar to this, today I faced a small issue with TinyMCE in CakePHP. It was to set an attribute and to figure it out itself took couple of hours of mine. Then I decided to share it with my readers, thinking that it may save those couple of hours of someone else at some point of time.

Problem :

TinyMCE notempty validation was not working fine and it was showing following message on console.

An invalid form control with name='page [description]' is not focusable

Solution : Set required attribute to be false in view file. For example :

                <div class="umstyle3"><?php echo __('Page Description');?></div>
                <div class="umstyle4" ><?php echo $this->Form->input("description" ,array('rows' => 15, 'label' => false, 'div' => false, 'class'=>"umstyle5 w400p", 'required' => false))?></div>                                               

Reason : CakePHP validation rule automatically adds a required attribute to the field. So we have to remove it.

Hopefully, it will help someone.

If you guys are facing any other problem with CakePHP TinyMCE integration please let know. May be, I can help.

Thanks!!!!!!!! Enjoy Programming J

Sunday, 11 May 2014

Aptana IDE

Recently, I attended GDG meet in Chandigarh and 2nd time heard about Aptana IDE. So decided to download and use the same. Downloaded Aptana Studio 3.4.2 from here, installed and run it on my machine. First screen would look like this.

Aptana Studio 3.4.0 is an open source Web development IDE being used by lot of developers across world. This powerful tool is having features like intellisense, integrated debugger and good version control system that gives you the precision control to create the applications you need without wasting time or running multiple programs simultaneously.

Aptana Studio 3.4.0 makes it easy to develop, test, debug and publish your applications within a single environment. If you code in PHP, Python , HTML, CSS, Ruby, Javascript or other languages, Aptana is what you need for top-quality results. If you need to move back and forth between Windows and Mac OS, Aptana makes it happen.

If you have used Netbeans or Eclipse before in development, then you will not feel much difference among them in their appearance. It suits well to Eclipse users. 

Following are the features of Aptana IDE :

1)  Intellisense (Code Assistance) is the biggest feature of Aptana. While editing, Code 
     Assist not only displays a list of matching tags, but it also includes graphical information 
     about the level of support for each element in the major web browsers.

2)  Git implementation is too easy using Aptana. It supports FTP as well.

3)  Integrated Debugger is another great feature in Aptana. There is a fully integrated Ruby & Rails debugger that has all of the features that you would expect from a professional grade product, including the ability to set breakpoints, inspect variables, control execution, etc…Surprisingly weaker is JavaScript debugging.

4)  Aptana Studio is available for all major operating systems (Windows/ Mac OS/ Linux).

5)  It gives you Linux like Console on Windows and can run git commands from Terminal.

So overall, it’s a great open source web development IDE to work with. At least give a try to it.

Thanks!!!!!!!!!!! Enjoy Programming :)

Saturday, 3 May 2014

Magento : Admin backend 404 not found

Have you imported database to new server and you are not able to access Magento admin panel? and it's showing you 404 not found error?

If yes, try to run following commands from phpmyadmin.

UPDATE core_store SET store_id = 0 WHERE code='admin';
UPDATE core_store_group SET group_id = 0 WHERE name='Default';
UPDATE core_website SET website_id = 0 WHERE code='admin';
UPDATE customer_group SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';

It worked for me. Hopefully, this will work for you guys as well.

The reason for this error is that store_id and website_id for admin should be set to 0 (zero). But, when you import database to new server, somehow these values are not set to 0.

Thanks!!!!!!!! Enjoy Programming :)

Reference Links : 

Saturday, 26 April 2014

Magento : Disable 'Merchant Email Receipt'

After order has been placed, if customers are getting an email with subject : ‘Merchant Email Receipt’ having  following  content

**Please DO NOT REPLY to this message. E-mail if you have any questions.

========= SECURITY STATEMENT ==========
It is not recommended that you ship product(s) or otherwise grant services relying solely upon this e-mail receipt.

========= GENERAL INFORMATION =========

Merchant : XXXXXXXXXXXX (1356037)
Date/Time : 21-Apr-2014 13:43:26 PDT

========= ORDER INFORMATION =========
Invoice : none
Description : Test transaction for ValidateCustomerPaymentProfile.
Amount : 0.01 (USD)
Payment Method : MasterCard
Type : Authorization Only


and you don’t want to send these type of emails to your customers?

If yes, then here is the solution.

Go to Magento Admin panel -> System -> Configuration -> Sales -> Payment Methods -> -> Email Customer

Set to no and save the configuration.

It worked for me. Hopefully, it will work for others as well.

Thanks!!!!!!!!!!!!! Enjoy Programming :)

Sunday, 20 April 2014

Magento : Admin login not working in Chrome

Workaround #1 : Before Installation

Use when you set up magento in localhost. I prefer this one because no need to make any changes in code.

Workaround #2 : After Installation

1. Go to app\code\core\Mage\Core\Model\Session\Abstract\Varien.php file

2. Go to line number 85 and replace

// session cookie params
$cookieParams = array(
            'lifetime' => $cookie->getLifetime(),
            'path'     => $cookie->getPath(),
            'domain'   => $cookie->getConfigDomain(),
            'secure'   => $cookie->isSecure(),
            'httponly' => $cookie->getHttponly()

code snippet with

// session cookie params
$cookieParams = array(
            'lifetime' => $cookie->getLifetime(),
            'path'     => $cookie->getPath()


Clear browser cache and try again. Hopefully it will work for you as well.

Thanks!!!!!!!! Enjoy Programming :)

Sunday, 6 April 2014

Magento AW Followupemail extension : Show multiple products in email template.

As I discussed in my previous post, due to well-written documentation it was very easy to integrate AW Followupemail extension. I implemented the basic functionality using newsletter templates and it is working very fine. But, there was a confusion in Product Review follow-up email, in case there will be having more than one products in cart. I mean to say I have to loop through the cart items. Let’s do it.

1) Go to Admin Section -> Newsletter->Newsletter Templates

2) Create a Newsletter template with name ‘AW Product Feedback’ and copy following code in Template Content section.

<h1>Dear {{var customer_name}}!</h1>

<p> You have bought these products on {{var order.updated_at|formatDateTime:F j, Y}}</p>

<p>The order contains the following items:</p>

<table border="1" cellspacing="1" cellpadding="5" width="100%">
            <th>No</th> <th>Product</th> <th>Image</th> <th>Leave a Review</th>
        {{foreach var="$order.getAllVisibleItems()" template="nsltr:AW Review Product Row"}}       

<p>Thanks !</p>
<p><a href="{{store url=""}}">{{store url=""}}</a></p>

3) Create another Newsletter template with name ‘AW Review Product Row’ and copy following code in Template Content section.

                 <td>{{var row_item_row_number}}</td>
                  <td><a href="{{store url="catalog/product/view" 
                  <td align="center"><img src="{{thumbnail size="75" 
                   <td align="center"><a href="{{store url="review/product/list" 
                  id="$"}}">Leave a Review</a></td>


That’s it and in follow-up email it will show all the products which were there in the ordered cart. While implementing this please keep in mind following points as well.

Important :
1) Newsletter Templates must be of ‘text’ type not ‘html’ type.

2) In first template we have mentioned following line : template="nsltr:AW Review Product Row"

nsltr : means template will be of newsletter type.
 AW Review Product Row : is name of the other template.

If you need any other help regarding this topic please feel free to comment.

Thanks!!!!!!!! Enjoy Programming :)