Something like this should work:
Two files:
1. /includes/classes/observers/class.set_customers_group_pricing.php
Code:
<?php
/**
* @package plugins
* @copyright Copyright 2003-2012 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id$
*
* Designed for v1.3.9-thru-v1.6.0
*
* includes support for COWOA "no-account"
*/
class set_customers_group_pricing extends base {
private $group_rules = array();
function __construct() {
global $zco_notifier;
$zco_notifier->attach($this, array('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_CUSTOMER_RECORD', 'NOTIFY_MODULE_NO_ACCOUNT_ADDED_CUSTOMER_RECORD'));
$this->attach($this, array('NOTIFY_PAYPALEXPRESS_CREATE_ACCOUNT_ADDED_CUSTOMER_RECORD')); // this line only works since v1.6.0
// The group_id number here is from the "ID" column in your Admin->Customers->GroupPricing screen
// CUSTOMIZE HERE: The pattern is [lang_code] = group_id
$this->group_rules['en'] = 3;
$this->group_rules['fr'] = 4;
}
function update(&$class, $eventID, $paramsArray = array())
{
global $db;
$customer_id = $paramsArray['customer_id'];
$sql = "update " . TABLE_CUSTOMERS . "
set customers_group_pricing = " . $this->group_rules[$_SESSION['languages_code']] . "
where customers_id = " . (int)$customer_id;
$db->Execute($sql);
}
}
2. /includes/auto_loaders/config.set_customers_group_pricing.php
Code:
<?php
/**
*
* @package plugins
* @copyright Copyright 2003-2012 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
*/
/**
* Designed for v1.3.9 thru v1.6.0
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
$autoLoadConfig[190][] = array('autoType'=>'class',
'loadFile'=>'observers/class.set_customers_group_pricing.php');
$autoLoadConfig[190][] = array('autoType'=>'classInstantiate',
'className'=>'set_customers_group_pricing',
'objectName'=>'set_customers_group_pricing');
Reference for additional reading on the concepts: http://www.zen-cart.com/entry.php?4-...Observer-Class
Bookmarks