Different Email Template For 2 Stores

Not a bug. By design, cs-cart has chosen to provide variable access to only those properties that are specified in the class (I disagree with this choice). That's why you can no longer simply add a column to a table and have it appear in the variables for that object.

company_name is clear, but what does the company_data mean? It looks like a snippet, but not. From my point of view, it should contain subvariables with different parameters of company

company_name is clear, but what does the company_data mean? It looks like a snippet, but not. From my point of view, it should contain subvariables with different parameters of company

I completely agree! I've quit trying to convince cs-cart that what they may have done either doesn't make sense from an addon developer perspective and/or from a merchant perspective. They simply don't listen. I'm tired of every usability issue or design defect being categorized as "working as designed" when the design is flawed.

My response from CS-Cart for this has been:

Unfortunately this variable is not present in backend PHP controller (the corresponding file is app\addons\reward_points\controllers\backend\reward_points.php).

You can modify the mentioned file to register the company_id value in user_data variable. Find the line:

$user_data = db_get_row("SELECT firstname, email, lang_code FROM ?:users WHERE user_id = ?i", $_REQUEST['user_id']);

and replace it with the following:

$user_data = db_get_row("SELECT firstname, email, lang_code, company_id FROM ?:users WHERE user_id = ?i", $_REQUEST['user_id']);

Use a {{ user_data.company_id }} in your templates then.

I hope this information is helpful.

If you are using cs-cart ULTIMATE, the recommendation may fail (or give inaccurate results) if customers are shared across companies. In multivendor, it I think it would also fail. I think what you want is more like (not tested):

$company_id = db_get_field("SELECT company_id FROM ?:usres WHERE user_id=?i", $_REQUEST['user_id']);
if( fn_allowed_for("MULTIVENDOR")  && Registry::get('runtime.company_id') )
  $company_id = Registry::get('runtime.company_id')
elseif( fn_allowed_for("ULTIMATE") && !Registry::get('runtime.company_id') )
  $company_id = fn_get_runtime_company_id();
$user_data['company_id'] = $company_id;

The first setting of $company_id captures the company assigned to the user (most likely in most cases zero unless you're running a single store environment).

The first if sets the company to the current company if NOT in all stores mode

The second if condition gets either the actual runtime.company_id or the runtime.forced_company_id which is what's used for a single site store

Note that iit is possible that $company_id will be zero and your conditions should account for that in displaying the related "all store/vendor" information. Situations where it will be zero are:

1) Multivendor environment and IN all vendors mode

2) ULTIMATE when in all stores mode and customers are shared across storefronts