Jump to content

[fix] Block newsletter - save email according to user selected language


jon88

Recommended Posts

My first topic, hope will help somebody.

 

Usage:

For websites with more that one language.

 

This modification will assing the language id (into ps_newsletter table) used by customers when they subscribe through block newsletter.

 

One file to modify in modules/blocknewsletter/blocknewsletter.php

 

1.

after:

id_shop` INTEGER UNSIGNED NOT NULL DEFAULT \'1\',

add:

`language` INTEGER UNSIGNED NULL,

2.

replace:

$sql = 'INSERT INTO '._DB_PREFIX_.'newsletter (id_shop, id_shop_group,  email, newsletter_date_add, ip_registration_newsletter, http_referer, active)
                VALUES
                ('.$this->context->shop->id.',
                '.$this->context->shop->id_shop_group.',
                \''.pSQL($email).'\',
                NOW(),

with:

$sql = 'INSERT INTO '._DB_PREFIX_.'newsletter (id_shop, id_shop_group, language,  email, newsletter_date_add, ip_registration_newsletter, http_referer, active)
                VALUES
                ('.$this->context->shop->id.',
                '.$this->context->shop->id_shop_group.',
                '.$this->context->language->id.',
                \''.pSQL($email).'\',
                NOW(),

3.

add language column in ps_newsletter

 ALTER TABLE `ps_newsletter` ADD `language` INT( 10 ) UNSIGNED NOT NULL 

Done!

 

  • Like 2
Link to comment
Share on other sites

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...