Upgrade addon to V4.01

Hello i am trying to upgrade a customer addon to new cs-cart 4.01, but i am receiving a error…



Fatal error: Class 'Registry' not found on line 25




```php

/***************************************************************************
* *
* Copyright (c) 2004 Simbirsk Technologies Ltd. All rights reserved. *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/

//
// $Id: send_to_friend.php 10229 2010-07-27 14:21:39Z 2tl $
//
if ( !defined('AREA') ) { die('Access denied'); }
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($mode == 'send') {
[b] if (Registry::get('addons.question.use_image_verification') == 'Y' && fn_image_verification('question', empty($_REQUEST['verification_answer']) ? '' : $_REQUEST['verification_answer']) == false)[/b] {
fn_save_post_data();
return array(CONTROLLER_STATUS_REDIRECT);
}
if (!empty($_REQUEST['send_data']['to_email'])) {
$view_mail->assign('send_data', $_REQUEST['question_data']);
$lnk = fn_query_remove($_REQUEST['redirect_url'], 'selected_section');
$http_path = Registry::get('config.http_path');
if (!empty($http_path) && strpos($lnk, $http_path) !== false) {
$lnk = str_replace(Registry::get('config.http_path'), '', $lnk);
} else {
$lnk = '/' . ltrim($lnk, '/');
}
$view_mail->assign('link', Registry::get('config.http_location') . $lnk);
}

$department_email = (Registry::get('addons.question.email_address')) ? Registry::get('addons.question.email_address') : Registry::get('settings.Company.company_support_department');
if (!empty($department_email)) {
$view_mail->assign('send_data', $_REQUEST['send_data']);
if (fn_send_mail($department_email, Registry::get('settings.Company.company_orders_department'), 'addons/question/mail_subj.tpl', 'addons/question/mail.tpl', '', CART_LANGUAGE, $_REQUEST['send_data']['from_email'])) {
fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('text_email_sent'));
}
} else {
fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('error_no_recipient_address'));
}
return array(CONTROLLER_STATUS_REDIRECT);
}
}
?>

```





can anyone help me with this issue?

[quote name='Hoko' timestamp='1373556177' post='165185']

Hello i am trying to upgrade a customer addon to new cs-cart 4.01, but i am receiving a error…



Fatal error: Class 'Registry' not found on line 25




```php

/***************************************************************************
* *
* Copyright (c) 2004 Simbirsk Technologies Ltd. All rights reserved. *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/

//
// $Id: send_to_friend.php 10229 2010-07-27 14:21:39Z 2tl $
//
if ( !defined('AREA') ) { die('Access denied'); }
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($mode == 'send') {
[b] if (Registry::get('addons.question.use_image_verification') == 'Y' && fn_image_verification('question', empty($_REQUEST['verification_answer']) ? '' : $_REQUEST['verification_answer']) == false)[/b] {
fn_save_post_data();
return array(CONTROLLER_STATUS_REDIRECT);
}
if (!empty($_REQUEST['send_data']['to_email'])) {
$view_mail->assign('send_data', $_REQUEST['question_data']);
$lnk = fn_query_remove($_REQUEST['redirect_url'], 'selected_section');
$http_path = Registry::get('config.http_path');
if (!empty($http_path) && strpos($lnk, $http_path) !== false) {
$lnk = str_replace(Registry::get('config.http_path'), '', $lnk);
} else {
$lnk = '/' . ltrim($lnk, '/');
}
$view_mail->assign('link', Registry::get('config.http_location') . $lnk);
}

$department_email = (Registry::get('addons.question.email_address')) ? Registry::get('addons.question.email_address') : Registry::get('settings.Company.company_support_department');
if (!empty($department_email)) {
$view_mail->assign('send_data', $_REQUEST['send_data']);
if (fn_send_mail($department_email, Registry::get('settings.Company.company_orders_department'), 'addons/question/mail_subj.tpl', 'addons/question/mail.tpl', '', CART_LANGUAGE, $_REQUEST['send_data']['from_email'])) {
fn_set_notification('N', fn_get_lang_var('notice'), fn_get_lang_var('text_email_sent'));
}
} else {
fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('error_no_recipient_address'));
}
return array(CONTROLLER_STATUS_REDIRECT);
}
}
?>

```





can anyone help me with this issue?

[/quote]



There is a guide on updating addons here: http://docs.cs-cart…ting-addon-3to4

You will have to define the namespace and then review every line of code for V4 compatibility. There are tons of pointless changes that must be addressed.

Thanks is working.