Example #1
0
function fn_charge_subscription($subscription_id)
{
    $_SESSION['cart'] = isset($_SESSION['cart']) ? $_SESSION['cart'] : array();
    $cart =& $_SESSION['cart'];
    $_SESSION['customer_auth'] = isset($_SESSION['customer_auth']) ? $_SESSION['customer_auth'] : array();
    $customer_auth =& $_SESSION['customer_auth'];
    fn_clear_cart($cart, true);
    $customer_auth = fn_fill_auth();
    $subscription = fn_get_recurring_subscription_info($subscription_id);
    if ($subscription['status'] != 'A') {
        fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('rb_subscription_inactive'));
    } else {
        $product_data = array();
        foreach ($subscription['order_info']['items'] as $k => $item) {
            if (!empty($subscription['order_info']['items'][$k]['extra']['recurring_plan_id']) && $subscription['order_info']['items'][$k]['extra']['recurring_plan_id'] == $subscription['plan_id'] && $subscription['order_info']['items'][$k]['extra']['recurring_duration'] == $subscription['orig_duration']) {
                $product_data[$subscription['order_info']['items'][$k]['product_id']] = array('amount' => $subscription['order_info']['items'][$k]['amount'], 'extra' => array('recurring_plan_id' => $subscription['plan_id'], 'recurring_force_calculate' => true, 'recurring_subscription_id' => $subscription['subscription_id'], 'recurring_plan' => $subscription['order_info']['items'][$k]['extra']['recurring_plan'], 'recurring_duration' => $subscription['order_info']['items'][$k]['extra']['recurring_duration']));
                if (!empty($subscription['order_info']['items'][$k]['extra']['product_options'])) {
                    $product_data[$subscription['order_info']['items'][$k]['product_id']]['product_options'] = $subscription['order_info']['items'][$k]['extra']['product_options'];
                }
            }
        }
        $cart['user_id'] = $subscription['user_id'];
        $u_data = db_get_row("SELECT user_id, user_type, tax_exempt FROM ?:users WHERE user_id = ?i", $cart['user_id']);
        $customer_auth = fn_fill_auth($u_data);
        $cart['user_data'] = array();
        fn_add_product_to_cart($product_data, $cart, $customer_auth);
        $cart['profile_id'] = 0;
        $cart['user_data'] = fn_get_user_info($customer_auth['user_id'], true, $cart['profile_id']);
        if (!empty($cart['user_data'])) {
            $profile_fields = fn_get_profile_fields('O', $customer_auth);
            $cart['ship_to_another'] = fn_check_shipping_billing($cart['user_data'], $profile_fields);
        }
        fn_calculate_cart_content($cart, $customer_auth, 'A', true, 'I');
        $cart['payment_id'] = $subscription['order_info']['payment_id'];
        $cart['payment_info'] = $subscription['order_info']['payment_info'];
        $cart['recurring_subscription_id'] = $subscription_id;
        list($order_id, $process_payment) = fn_place_order($cart, $customer_auth);
        if (!empty($order_id)) {
            $order_info = fn_get_order_info($order_id, true);
            $evt_data = array('subscription_id' => $subscription_id, 'timestamp' => $order_info['timestamp'], 'event_type' => 'C');
            db_query("INSERT INTO ?:recurring_events ?e", $evt_data);
            if ($process_payment == true) {
                fn_start_payment($order_id);
            }
            $edp_data = fn_generate_ekeys_for_edp(array(), $order_info);
            fn_order_notification($order_info, $edp_data);
        }
    }
}
Example #2
0
function fn_qwintry_save_order_invoice($order_id, $area = AREA, $lang_code = CART_LANGUAGE)
{
    $view = Tygh::$app['view'];
    $html = array();
    $view->assign('order_status_descr', fn_get_simple_statuses(STATUSES_ORDER, true, true));
    $view->assign('profile_fields', fn_get_profile_fields('I'));
    $order_info = fn_get_order_info($order_id, false, true, false, true);
    if (empty($order_info)) {
        return;
    }
    if (fn_allowed_for('MULTIVENDOR')) {
        $view->assign('take_surcharge_from_vendor', fn_take_payment_surcharge_from_vendor($order_info['products']));
    }
    list($shipments) = fn_get_shipments_info(array('order_id' => $order_info['order_id'], 'advanced_info' => true));
    $use_shipments = !fn_one_full_shipped($shipments);
    $view->assign('order_info', $order_info);
    $view->assign('shipments', $shipments);
    $view->assign('use_shipments', $use_shipments);
    $view->assign('payment_method', fn_get_payment_data(!empty($order_info['payment_method']['payment_id']) ? $order_info['payment_method']['payment_id'] : 0, $order_info['order_id'], $lang_code));
    $view->assign('order_status', fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], $lang_code, $order_info['company_id']));
    $view->assign('status_settings', fn_get_status_params($order_info['status']));
    $view->assign('company_data', fn_get_company_placement_info($order_info['company_id'], $lang_code));
    fn_disable_live_editor_mode();
    $html[] = $view->displayMail('orders/print_invoice.tpl', false, $area, $order_info['company_id'], $lang_code);
    $filename = QWINTRY_DIR_INVOICES . $order_id . '.pdf';
    if (Pdf::render($html, $filename, true)) {
        return $filename;
    }
    return false;
}
Example #3
0
 /**
  * Creates PO file for specified Language
  *
  * @param string $lang_code 2-letters language code (Example: "en", "ru")
  * @param string $output    Output destination
  *      screen - Output countent direct to browser page
  *      download - Force file downloading
  *      server - upload file to the config.dir.lang_packs directory
  */
 public static function export($lang_code, $output = 'download')
 {
     $mve_lang_variables = array();
     // Translation packs should not include "Not translated" language data
     $allow_overlap = $lang_code == 'en' ? true : false;
     $default_lang = Registry::get('settings.Appearance.backend_default_language');
     $langs = self::get(array('lang_code' => $lang_code));
     $lang = $langs[$lang_code];
     $pack_path = fn_get_cache_path(false) . 'lang_pack/';
     $core_pack_path = $pack_path . 'core.po';
     $mve_pack_path = $pack_path . 'editions/mve.po';
     fn_rm($pack_path);
     fn_mkdir($pack_path);
     if (fn_allowed_for('MULTIVENDOR') && is_file(Registry::get('config.dir.lang_packs') . $default_lang . '/editions/mve.po')) {
         $mve_lang_variables = Po::getValues(Registry::get('config.dir.lang_packs') . $default_lang . '/editions/mve.po');
         Po::createHeader($mve_pack_path, $lang);
     }
     Po::createHeader($core_pack_path, $lang);
     // Export Language values
     list($values) = LanguageValues::getVariables(array(), 0, $lang_code);
     foreach ($values as $_id => $value) {
         $values[$_id]['msgctxt'] = 'Languages' . \I18n_Pofile::DELIMITER . $value['name'];
     }
     $values = fn_array_value_to_key($values, 'msgctxt');
     $addons_lang_vars = array();
     list($addons) = fn_get_addons(array('type' => 'installed'), 0, $lang_code);
     foreach ($addons as $addon_id => $addon) {
         $addons_lang_vars = array_merge($addons_lang_vars, self::exportAddonsPo($addon_id, $pack_path . 'addons/' . $addon_id . '.po', $lang_code, $values));
     }
     $original_values = self::getOriginalValues('Languages');
     $values = array_diff_key($values, $addons_lang_vars);
     foreach ($values as $_id => $value) {
         $values[$_id]['original_value'] = isset($original_values['Languages::' . $value['name']]) ? $original_values['Languages::' . $value['name']]['msgid'] : '';
     }
     $values = Po::convert($values, array(), $allow_overlap);
     list($values, $excluded) = self::excludeEditionVariables('Languages', $values, $mve_lang_variables);
     Po::putValues('Languages', $values, $core_pack_path);
     if (!empty($excluded)) {
         Po::putValues('Languages', $excluded, $mve_pack_path);
     }
     // Export Settings Sections
     $sections = Settings::instance()->getCoreSections($lang_code);
     $original_values = self::getOriginalValues('SettingsSections');
     foreach ($sections as $_id => $value) {
         $sections[$_id]['original_value'] = isset($original_values['SettingsSections::' . $value['section_id']]) ? $original_values['SettingsSections::' . $value['section_id']]['msgid'] : '';
     }
     $_sections = Po::convert($sections, array('id' => 'section_id', 'value' => 'description'), $allow_overlap);
     list($_sections, $excluded) = self::excludeEditionVariables('SettingsSections', $_sections, $mve_lang_variables);
     Po::putValues('SettingsSections', $_sections, $core_pack_path);
     if (!empty($excluded)) {
         Po::putValues('SettingsSections', $excluded, $mve_pack_path);
     }
     unset($_sections);
     $original_options = self::getOriginalValues('SettingsOptions');
     $original_variants = self::getOriginalValues('SettingsVariants');
     $original_tooltips = self::getOriginalValues('SettingsTooltips');
     foreach ($sections as $section) {
         $options = Settings::instance()->getList($section['object_id'], 0, false, null, $lang_code);
         $_options = array();
         $_tooltips = array();
         foreach ($options['main'] as $option) {
             $_options[] = array('name' => $option['name'], 'value' => $option['description'], 'original_value' => isset($original_options['SettingsOptions' . \I18n_Pofile::DELIMITER . $option['name']]) ? $original_options['SettingsOptions' . \I18n_Pofile::DELIMITER . $option['name']]['msgid'] : '');
             if (!empty($option['variants'])) {
                 $_variants = array();
                 foreach ($option['variants'] as $variant_id => $variant) {
                     $_variants[] = array('name' => $variant_id, 'value' => $variant, 'original_value' => isset($original_variants['SettingsVariants' . \I18n_Pofile::DELIMITER . $option['name'] . \I18n_Pofile::DELIMITER . $variant_id]) ? $original_variants['SettingsVariants' . \I18n_Pofile::DELIMITER . $option['name'] . \I18n_Pofile::DELIMITER . $variant_id]['msgid'] : '');
                 }
                 $_variants = Po::convert($_variants, array(), $allow_overlap);
                 list($_variants, $excluded) = self::excludeEditionVariables('SettingsVariants', $_variants, $mve_lang_variables);
                 Po::putValues('SettingsVariants' . \I18n_Pofile::DELIMITER . $option['name'], $_variants, $core_pack_path);
                 if (!empty($excluded)) {
                     Po::putValues('SettingsVariants', $excluded, $mve_pack_path);
                 }
                 unset($_variants);
             }
             if (!empty($option['tooltip'])) {
                 $_tooltips[] = array('name' => $option['name'], 'value' => $option['tooltip'], 'original_value' => isset($original_tooltips['SettingsTooltips' . \I18n_Pofile::DELIMITER . $option['name']]) ? $original_tooltips['SettingsTooltips' . \I18n_Pofile::DELIMITER . $option['name']]['msgid'] : '');
             }
         }
         $_options = Po::convert($_options, array(), $allow_overlap);
         list($_options, $excluded) = self::excludeEditionVariables('SettingsOptions', $_options, $mve_lang_variables);
         Po::putValues('SettingsOptions', $_options, $core_pack_path);
         if (!empty($excluded)) {
             Po::putValues('SettingsOptions', $excluded, $mve_pack_path);
         }
         $_tooltips = Po::convert($_tooltips, array(), $allow_overlap);
         list($_tooltips, $excluded) = self::excludeEditionVariables('SettingsTooltips', $_tooltips, $mve_lang_variables);
         Po::putValues('SettingsTooltips', $_tooltips, $core_pack_path);
         if (!empty($excluded)) {
             Po::putValues('SettingsTooltips', $excluded, $mve_pack_path);
         }
     }
     // Export Profile fields
     $profile_fields = fn_get_profile_fields('ALL', array(), $lang_code);
     $original_values = self::getOriginalValues('ProfileFields');
     $values = array();
     foreach ($profile_fields as $zone => $fields) {
         foreach ($fields as $field_id => $field) {
             $values[] = array('name' => $field['field_name'], 'value' => $field['description'], 'original_value' => isset($original_values['ProfileFields::' . $field['field_name']]) ? $original_values['ProfileFields::' . $field['field_name']]['msgid'] : '');
         }
     }
     $values = Po::convert($values, array(), $allow_overlap);
     list($values, $excluded) = self::excludeEditionVariables('ProfileFields', $values, $mve_lang_variables);
     Po::putValues('ProfileFields', $values, $core_pack_path);
     if (!empty($excluded)) {
         Po::putValues('ProfileFields', $excluded, $mve_pack_path);
     }
     fn_compress_files($lang_code . '.zip', './', $pack_path);
     $filename = $pack_path . $lang_code . '.zip';
     switch ($output) {
         case 'server':
             fn_copy($filename, Registry::get('config.dir.lang_packs') . $lang_code . '.zip');
             break;
         case 'download':
             fn_get_file($filename, $lang_code . '.zip');
             break;
     }
     return true;
 }
Example #4
0
    }
    Tygh::$app['view']->assign('companies', $companies);
    Tygh::$app['view']->assign('search', $search);
} elseif ($mode == 'apply_for_vendor') {
    if (Registry::get('settings.Vendors.apply_for_vendor') != 'Y') {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
    $restored_company_data = fn_restore_post_data('company_data');
    if ($restored_company_data) {
        Tygh::$app['view']->assign('company_data', $restored_company_data);
    }
    $restored_user_data = fn_restore_post_data('user_data');
    if ($restored_user_data) {
        Tygh::$app['view']->assign('user_data', $restored_user_data);
    }
    $profile_fields = fn_get_profile_fields('A', array(), CART_LANGUAGE, array('get_custom' => true, 'get_profile_required' => true));
    Tygh::$app['view']->assign('profile_fields', $profile_fields);
    Tygh::$app['view']->assign('countries', fn_get_simple_countries(true, CART_LANGUAGE));
    Tygh::$app['view']->assign('states', fn_get_all_states());
    fn_add_breadcrumb(__('apply_for_vendor_account'));
    $_SESSION['apply_for_vendor']['return_url'] = !empty($_REQUEST['return_previous_url']) ? $_REQUEST['return_previous_url'] : fn_url('');
} elseif ($mode == 'products') {
    $company_data = !empty($_REQUEST['company_id']) ? fn_get_company_data($_REQUEST['company_id']) : array();
    if (empty($company_data)) {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
    $company_id = $company_data['company_id'];
    fn_add_breadcrumb(__('all_vendors'), 'companies.catalog');
    $params = $_REQUEST;
    $params['company_id'] = $company_id;
    $params['extend'] = array('description');
Example #5
0
    }
    if ($mode == 'delete') {
        if (!empty($_REQUEST['field_id'])) {
            fn_delete_profile_field($_REQUEST['field_id']);
        }
    }
    return array(CONTROLLER_STATUS_OK, 'profile_fields' . $_suffix);
}
if ($mode == 'manage') {
    $profile_fields = fn_get_profile_fields('ALL', array(), DESCR_SL);
    Registry::get('view')->assign('profile_fields_areas', fn_profile_fields_areas());
    Registry::get('view')->assign('profile_fields', $profile_fields);
} elseif ($mode == 'update' || $mode == 'add') {
    if ($mode == 'update') {
        $params['field_id'] = $_REQUEST['field_id'];
        $field = fn_get_profile_fields('ALL', array(), DESCR_SL, $params);
        Registry::get('view')->assign('field', $field);
    }
    Registry::get('view')->assign('profile_fields_areas', fn_profile_fields_areas());
}
// -------------- Functions ----------------
function fn_add_field_values($values = array(), $field_id = 0)
{
    if (empty($values) || empty($field_id)) {
        return false;
    }
    foreach ($values as $_v) {
        if (empty($_v['description'])) {
            continue;
        }
        // Insert main data
Example #6
0
/**
 * Prepare all settings, wich should be passed to js
 */
function fn_twg_get_all_settings()
{
    $settings = fn_twg_get_boot_settings();
    $addon_settings = TwigmoSettings::get();
    $settings['access_id'] = $addon_settings['access_id'];
    $settings['currency'] = Registry::get('currencies.' . CART_SECONDARY_CURRENCY);
    $settings['primaryCurrency'] = Registry::get('currencies.' . CART_PRIMARY_CURRENCY);
    $settings['url_for_facebook'] = isset($addon_settings['url_for_facebook']) ? fn_twg_get_external_info_url($addon_settings['url_for_facebook']) : '';
    $settings['url_for_twitter'] = isset($addon_settings['url_for_twitter']) ? fn_twg_get_external_info_url($addon_settings['url_for_twitter']) : '';
    $settings['lang'] = array_merge(fn_twg_get_default_customer_langvars(), Lang::getCustomerLangVars());
    // Countries/states
    list($countries) = fn_get_countries(array('only_avail' => true));
    $settings = array_merge($settings, Api::getAsList('countries', $countries));
    $settings['states'] = fn_twg_get_states();
    // Info pages
    $pages_location = $addon_settings['home_page_content'] == 'tw_home_page_blocks' ? 'twigmo.post' : 'index.index';
    $pages = TwigmoBlock::getBlocksForLocation($pages_location, array('pages'));
    $settings['info_pages'] = array();
    foreach ($pages as $page) {
        $settings['info_pages'] = array_merge($settings['info_pages'], $page['pages']['page']);
    }
    // If page link begin with # then interpret this link as twigmo page
    foreach ($settings['info_pages'] as $k => $page) {
        if (preg_match('/^\\#.*$/', $page['link'])) {
            $settings['info_pages'][$k]['twigmo_page'] = substr($page['link'], 1);
        }
    }
    // Only required profile fields
    $only_required = isset($addon_settings['only_req_profile_fields']) ? $addon_settings['only_req_profile_fields'] : 'N';
    $settings['profileFields'] = fn_twg_prepare_profile_fields(fn_get_profile_fields(), $only_required);
    $settings['profileFieldsCheckout'] = fn_twg_prepare_profile_fields(fn_get_profile_fields('O'), $only_required);
    $settings['show_product_code'] = isset($addon_settings['show_product_code']) ? $addon_settings['show_product_code'] : 'N';
    $settings['titles'] = array();
    $settings['profile'] = fn_twg_get_user_info($_SESSION['auth']['user_id']);
    $settings['cart'] = fn_twg_api_get_session_cart($_SESSION['cart']);
    $settings['sortings'] = fn_twg_get_sortings();
    $settings['security_hash'] = fn_generate_security_hash();
    $settings['productType'] = PRODUCT_EDITION;
    $settings['languages'] = array_values(Lang::getLanguages());
    $settings['cart_language'] = CART_LANGUAGE;
    $settings['cart_prices_w_taxes'] = Registry::get('settings.Appearance.cart_prices_w_taxes');
    $settings['show_prices_taxed_clean'] = Registry::get('settings.Appearance.show_prices_taxed_clean');
    $settings['no_image_path'] = Registry::get('config.no_image_path');
    // Suppliers
    $settings['suppliers_vendor'] = Registry::get('settings.Suppliers.apply_for_vendor');
    $settings['display_supplier'] = Registry::get('settings.Suppliers.display_supplier') === 'Y' || Registry::get('settings.Vendors.display_vendor') === 'Y';
    $settings['display_supplier'] = $settings['display_supplier'] ? 'Y' : 'N';
    // General section
    $fields = array('use_email_as_login', 'min_order_amount', 'min_order_amount_type', 'allow_negative_amount', 'inventory_tracking', 'allow_anonymous_shopping', 'tax_calculation');
    foreach ($fields as $field) {
        $settings[$field] = Registry::get('settings.General.' . $field);
    }
    $settings = array_merge($settings, fn_twg_get_checkout_settings());
    if (version_compare(PRODUCT_VERSION, '4.0.2', '>=')) {
        $anonymous_shopping_settings_map = array('allow_shopping' => 'Y', 'hide_price_and_add_to_cart' => 'P', 'hide_add_to_cart' => 'B');
        $settings['allow_anonymous_shopping'] = $anonymous_shopping_settings_map[$settings['allow_anonymous_shopping']];
    }
    $settings['default_location'] = array('country' => Registry::get('settings.General.default_country'), 'state' => Registry::get('settings.General.default_state'));
    $settings['show_modifiers'] = Registry::get('settings.General.display_options_modifiers');
    $settings['SEOEnabled'] = Registry::get('addons.seo.status') == 'A';
    $settings['GATrackEcommerce'] = Registry::get('addons.google_analytics.status') == 'A' && Registry::get('addons.google_analytics.track_ecommerce') == 'Y' && file_exists(Registry::get('config.dir.addons') . 'google_analytics/controllers/frontend/checkout.post.php');
    if (fn_allowed_for('MULTIVENDOR')) {
        $settings['company_data'] = !empty($_SESSION['auth']['company_id']) ? fn_get_company_data($_SESSION['auth']['company_id']) : array();
    } else {
        $settings['company_data'] = array();
    }
    $settings['checkout'] = Registry::get('settings.Checkout');
    fn_set_hook('twg_get_all_settings', $settings);
    $settings['lang'] = fn_twg_process_langvars($settings['lang']);
    return $settings;
}
    function content_55e01fce03b6c4_57891956($_smarty_tpl)
    {
        if (!is_callable('smarty_block_hook')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/block.hook.php';
        }
        if (!is_callable('smarty_modifier_replace')) {
            include '/home/coriolan/public_html/lead/app/lib/other/smarty/plugins/modifier.replace.php';
        }
        if (!is_callable('smarty_modifier_date_format')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/modifier.date_format.php';
        }
        fn_preload_lang_vars(array('invoice', 'invoice', 'credit_memo', 'credit_memo', 'order_details', 'invoice_title', 'phone1_label', 'phone2_label', 'fax', 'web_site', 'email', 'order', 'status', 'date', 'payment_method', 'shipping_method', 'tracking_number', 'customer', 'phone', 'fax', 'company', 'url', 'bill_to', 'ship_to', 'product', 'quantity', 'unit_price', 'discount', 'tax', 'subtotal', 'deleted_product', 'sku', 'free', 'free', 'subtotal', 'including_discount', 'order_discount', 'coupon', 'taxes', 'included', 'tax_exempt', 'payment_surcharge', 'shipping_cost', 'total_cost', 'notes'));
        if ($_smarty_tpl->tpl_vars['order_info']->value) {
            ?>

<?php 
            $_smarty_tpl->tpl_vars["order_header"] = new Smarty_variable($_smarty_tpl->__("invoice"), null, 0);
            ?>

<?php 
            if ($_smarty_tpl->tpl_vars['status_settings']->value['appearance_type'] == "I" && $_smarty_tpl->tpl_vars['order_info']->value['doc_ids'][$_smarty_tpl->tpl_vars['status_settings']->value['appearance_type']]) {
                ?>
    <?php 
                ob_start();
                echo $_smarty_tpl->__("invoice");
                $_tmp1 = ob_get_clean();
                $_smarty_tpl->tpl_vars["doc_id_text"] = new Smarty_variable($_tmp1 . " #" . (string) $_smarty_tpl->tpl_vars['order_info']->value['doc_ids'][$_smarty_tpl->tpl_vars['status_settings']->value['appearance_type']], null, 0);
            } elseif ($_smarty_tpl->tpl_vars['status_settings']->value['appearance_type'] == "C" && $_smarty_tpl->tpl_vars['order_info']->value['doc_ids'][$_smarty_tpl->tpl_vars['status_settings']->value['appearance_type']]) {
                ?>
    <?php 
                ob_start();
                echo $_smarty_tpl->__("credit_memo");
                $_tmp2 = ob_get_clean();
                $_smarty_tpl->tpl_vars["doc_id_text"] = new Smarty_variable($_tmp2 . " #" . (string) $_smarty_tpl->tpl_vars['order_info']->value['doc_ids'][$_smarty_tpl->tpl_vars['status_settings']->value['appearance_type']], null, 0);
                ?>
    <?php 
                $_smarty_tpl->tpl_vars["order_header"] = new Smarty_variable($_smarty_tpl->__("credit_memo"), null, 0);
            } elseif ($_smarty_tpl->tpl_vars['status_settings']->value['appearance_type'] == "O") {
                ?>
    <?php 
                $_smarty_tpl->tpl_vars["order_header"] = new Smarty_variable($_smarty_tpl->__("order_details"), null, 0);
            }
            ?>

<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main-table" style="height: 100%; background-color: #f4f6f8; font-size: 12px; font-family: Arial;">
<tr>
    <td align="center" style="width: 100%; height: 100%;">
    <table cellpadding="0" cellspacing="0" border="0" style=" width: 602px; table-layout: fixed; margin: 24px 0 24px 0;">
    <tr>
        <td style="background-color: #ffffff; border: 1px solid #e6e6e6; margin: 0px auto 0px auto; padding: 0px 44px 0px 46px; text-align: left;">
            <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding: 27px 0px 0px 0px; border-bottom: 1px solid #868686; margin-bottom: 8px;">
            <tr>
                <td align="left" style="padding-bottom: 3px;" valign="middle"><img src="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['logos']->value['mail']['image']['image_path'], ENT_QUOTES, 'UTF-8');
            ?>
" width="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['logos']->value['mail']['image']['image_x'], ENT_QUOTES, 'UTF-8');
            ?>
" height="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['logos']->value['mail']['image']['image_y'], ENT_QUOTES, 'UTF-8');
            ?>
" border="0" alt="<?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['logos']->value['mail']['image']['alt'], ENT_QUOTES, 'UTF-8');
            ?>
" /></td>
                <td width="100%" valign="bottom" style="text-align: right;  font: bold 26px Arial; text-transform: uppercase;  margin: 0px;"><?php 
            echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['order_header']->value) === null || $tmp === '' ? $_smarty_tpl->__("invoice_title") : $tmp, ENT_QUOTES, 'UTF-8');
            ?>
</td>

            </tr>
            </table>

            <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tr valign="top">
                <?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "orders:invoice_company_info"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "orders:invoice_company_info"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                ?>

                <td style="width: 50%; padding: 14px 0px 0px 2px; font-size: 12px; font-family: Arial;">
                    <h2 style="font: bold 12px Arial; margin: 0px 0px 3px 0px;"><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_name'], ENT_QUOTES, 'UTF-8');
                ?>
</h2>
                    <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_address'], ENT_QUOTES, 'UTF-8');
                ?>
<br />
                    <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_city'], ENT_QUOTES, 'UTF-8');
                if ($_smarty_tpl->tpl_vars['company_data']->value['company_city'] && ($_smarty_tpl->tpl_vars['company_data']->value['company_state_descr'] || $_smarty_tpl->tpl_vars['company_data']->value['company_zipcode'])) {
                    ?>
,<?php 
                }
                ?>
 <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_state_descr'], ENT_QUOTES, 'UTF-8');
                ?>
 <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_zipcode'], ENT_QUOTES, 'UTF-8');
                ?>
<br />
                    <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_country_descr'], ENT_QUOTES, 'UTF-8');
                ?>

                    <table cellpadding="0" cellspacing="0" border="0">
                    <?php 
                if ($_smarty_tpl->tpl_vars['company_data']->value['company_phone']) {
                    ?>
                    <tr valign="top">
                        <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; text-transform: uppercase; color: #000000; padding-right: 10px;    white-space: nowrap;"><?php 
                    echo $_smarty_tpl->__("phone1_label");
                    ?>
:</td>
                        <td width="100%" style="font-size: 12px; font-family: Arial;"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_phone'], ENT_QUOTES, 'UTF-8');
                    ?>
</td>
                    </tr>
                    <?php 
                }
                ?>
                    <?php 
                if ($_smarty_tpl->tpl_vars['company_data']->value['company_phone_2']) {
                    ?>
                    <tr valign="top">
                        <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; text-transform: uppercase; color: #000000; padding-right: 10px; white-space: nowrap;"><?php 
                    echo $_smarty_tpl->__("phone2_label");
                    ?>
:</td>
                        <td width="100%" style="font-size: 12px; font-family: Arial;"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_phone_2'], ENT_QUOTES, 'UTF-8');
                    ?>
</td>
                    </tr>
                    <?php 
                }
                ?>
                    <?php 
                if ($_smarty_tpl->tpl_vars['company_data']->value['company_fax']) {
                    ?>
                    <tr valign="top">
                        <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; text-transform: uppercase; color: #000000; padding-right: 10px; white-space: nowrap;"><?php 
                    echo $_smarty_tpl->__("fax");
                    ?>
:</td>
                        <td width="100%" style="font-size: 12px; font-family: Arial;"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_fax'], ENT_QUOTES, 'UTF-8');
                    ?>
</td>
                    </tr>
                    <?php 
                }
                ?>
                    <?php 
                if ($_smarty_tpl->tpl_vars['company_data']->value['company_website']) {
                    ?>
                    <tr valign="top">
                        <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; text-transform: uppercase; color: #000000; padding-right: 10px; white-space: nowrap;"><?php 
                    echo $_smarty_tpl->__("web_site");
                    ?>
:</td>
                        <td width="100%" style="font-size: 12px; font-family: Arial;"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_website'], ENT_QUOTES, 'UTF-8');
                    ?>
</td>
                    </tr>
                    <?php 
                }
                ?>
                    <?php 
                if ($_smarty_tpl->tpl_vars['company_data']->value['company_orders_department']) {
                    ?>
                    <tr valign="top">
                        <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; text-transform: uppercase; color: #000000; padding-right: 10px; white-space: nowrap;"><?php 
                    echo $_smarty_tpl->__("email");
                    ?>
:</td>
                        <td width="100%" style="font-size: 12px; font-family: Arial;"><a href="mailto:<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['company_data']->value['company_orders_department'], ENT_QUOTES, 'UTF-8');
                    ?>
"><?php 
                    echo htmlspecialchars(smarty_modifier_replace(smarty_modifier_replace($_smarty_tpl->tpl_vars['company_data']->value['company_orders_department'], ",", "<br>"), " ", ''), ENT_QUOTES, 'UTF-8');
                    ?>
</a></td>
                    </tr>
                    <?php 
                }
                ?>
                    </table>
                </td>
                <?php 
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "orders:invoice_company_info"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>

                <?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "orders:invoice_order_status_info"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "orders:invoice_order_status_info"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                ?>

                <td style="padding-top: 14px;">
                    <h2 style="font: bold 17px Tahoma; margin: 0px;"><?php 
                if ($_smarty_tpl->tpl_vars['doc_id_text']->value) {
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['doc_id_text']->value, ENT_QUOTES, 'UTF-8');
                    ?>
 <br /><?php 
                }
                echo $_smarty_tpl->__("order");
                ?>
&nbsp;#<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['order_id'], ENT_QUOTES, 'UTF-8');
                ?>
</h2>
                    <table cellpadding="0" cellspacing="0" border="0">
                    <tr valign="top">
                        <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; text-transform: uppercase; color: #000000; padding-right: 10px; white-space: nowrap;"><?php 
                echo $_smarty_tpl->__("status");
                ?>
:</td>
                        <td width="100%" style="font-size: 12px; font-family: Arial;"><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_status']->value['description'], ENT_QUOTES, 'UTF-8');
                ?>
</td>
                    </tr>
                    <tr valign="top">
                        <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; text-transform: uppercase; color: #000000; padding-right: 10px; white-space: nowrap;"><?php 
                echo $_smarty_tpl->__("date");
                ?>
:</td>
                        <td style="font-size: 12px; font-family: Arial;"><?php 
                echo htmlspecialchars(smarty_modifier_date_format($_smarty_tpl->tpl_vars['order_info']->value['timestamp'], (string) $_smarty_tpl->tpl_vars['settings']->value['Appearance']['date_format'] . ", " . (string) $_smarty_tpl->tpl_vars['settings']->value['Appearance']['time_format']), ENT_QUOTES, 'UTF-8');
                ?>
</td>
                    </tr>
                    <tr valign="top">
                        <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; text-transform: uppercase; color: #000000; padding-right: 10px; white-space: nowrap;"><?php 
                echo $_smarty_tpl->__("payment_method");
                ?>
:</td>
                        <td style="font-size: 12px; font-family: Arial;"><?php 
                echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['payment_method']->value['payment']) === null || $tmp === '' ? " - " : $tmp, ENT_QUOTES, 'UTF-8');
                ?>
</td>
                    </tr>
                    <?php 
                if ($_smarty_tpl->tpl_vars['order_info']->value['shipping']) {
                    ?>
                    <tr valign="top">
                        <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; text-transform: uppercase; color: #000000; padding-right: 10px; white-space: nowrap;"><?php 
                    echo $_smarty_tpl->__("shipping_method");
                    ?>
:</td>
                        <td style="font-size: 12px; font-family: Arial;">
                            <?php 
                    $_smarty_tpl->tpl_vars["shipping"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["shipping"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['order_info']->value['shipping'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    $_smarty_tpl->tpl_vars["shipping"]->total = $_smarty_tpl->_count($_from);
                    $_smarty_tpl->tpl_vars["shipping"]->iteration = 0;
                    foreach ($_from as $_smarty_tpl->tpl_vars["shipping"]->key => $_smarty_tpl->tpl_vars["shipping"]->value) {
                        $_smarty_tpl->tpl_vars["shipping"]->_loop = true;
                        $_smarty_tpl->tpl_vars["shipping"]->iteration++;
                        $_smarty_tpl->tpl_vars["shipping"]->last = $_smarty_tpl->tpl_vars["shipping"]->iteration === $_smarty_tpl->tpl_vars["shipping"]->total;
                        $_smarty_tpl->tpl_vars['smarty']->value['foreach']["f_shipp"]['last'] = $_smarty_tpl->tpl_vars["shipping"]->last;
                        ?>
                                <?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['shipping']->value['shipping'], ENT_QUOTES, 'UTF-8');
                        if (!$_smarty_tpl->getVariable('smarty')->value['foreach']['f_shipp']['last']) {
                            ?>
, <?php 
                        }
                        ?>
                                <?php 
                        if ($_smarty_tpl->tpl_vars['shipments']->value[$_smarty_tpl->tpl_vars['shipping']->value['group_key']]['tracking_number']) {
                            $_smarty_tpl->tpl_vars["tracking_number_exists"] = new Smarty_variable("Y", null, 0);
                        }
                        ?>
                            <?php 
                    }
                    ?>
</td>
                    </tr>
                    <?php 
                    if ($_smarty_tpl->tpl_vars['tracking_number_exists']->value && !$_smarty_tpl->tpl_vars['use_shipments']->value) {
                        ?>
                        <tr valign="top">
                            <td style="font-size: 12px; font-family: verdana, helvetica, arial, sans-serif; text-transform: uppercase; color: #000000; padding-right: 10px; white-space: nowrap;"><?php 
                        echo $_smarty_tpl->__("tracking_number");
                        ?>
:</td>
                            <td style="font-size: 12px; font-family: Arial;">
                                <?php 
                        $_smarty_tpl->tpl_vars["shipping"] = new Smarty_Variable();
                        $_smarty_tpl->tpl_vars["shipping"]->_loop = false;
                        $_from = $_smarty_tpl->tpl_vars['order_info']->value['shipping'];
                        if (!is_array($_from) && !is_object($_from)) {
                            settype($_from, 'array');
                        }
                        $_smarty_tpl->tpl_vars["shipping"]->total = $_smarty_tpl->_count($_from);
                        $_smarty_tpl->tpl_vars["shipping"]->iteration = 0;
                        foreach ($_from as $_smarty_tpl->tpl_vars["shipping"]->key => $_smarty_tpl->tpl_vars["shipping"]->value) {
                            $_smarty_tpl->tpl_vars["shipping"]->_loop = true;
                            $_smarty_tpl->tpl_vars["shipping"]->iteration++;
                            $_smarty_tpl->tpl_vars["shipping"]->last = $_smarty_tpl->tpl_vars["shipping"]->iteration === $_smarty_tpl->tpl_vars["shipping"]->total;
                            $_smarty_tpl->tpl_vars['smarty']->value['foreach']["f_shipp"]['last'] = $_smarty_tpl->tpl_vars["shipping"]->last;
                            ?>
                                    <?php 
                            if ($_smarty_tpl->tpl_vars['shipments']->value[$_smarty_tpl->tpl_vars['shipping']->value['group_key']]['tracking_number']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['shipments']->value[$_smarty_tpl->tpl_vars['shipping']->value['group_key']]['tracking_number'], ENT_QUOTES, 'UTF-8');
                                if (!$_smarty_tpl->getVariable('smarty')->value['foreach']['f_shipp']['last']) {
                                    ?>
,<?php 
                                }
                            }
                            ?>
                                <?php 
                        }
                        ?>
</td>
                        </tr>
                    <?php 
                    }
                    ?>
                    <?php 
                }
                ?>
                    </table>
                </td>
                <?php 
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "orders:invoice_order_status_info"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>

            </tr>
            </table>
        
            <?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "orders:invoice_customer_info"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "orders:invoice_customer_info"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                ?>

            <?php 
                if (!$_smarty_tpl->tpl_vars['profile_fields']->value) {
                    ?>
            <?php 
                    $_smarty_tpl->tpl_vars["profile_fields"] = new Smarty_variable(fn_get_profile_fields('I'), null, 0);
                    ?>
            <?php 
                }
                ?>
            <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value) {
                    ?>
            <table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding: 32px 0px 24px 0px;">
            <tr valign="top">
                <?php 
                    if ($_smarty_tpl->tpl_vars['profile_fields']->value['C']) {
                        ?>
                <?php 
                        $_smarty_tpl->tpl_vars["profields_c"] = new Smarty_variable(fn_fields_from_multi_level($_smarty_tpl->tpl_vars['profile_fields']->value['C'], "field_name", "field_id"), null, 0);
                        ?>
                <td width="33%" style="font-size: 12px; font-family: Arial;">
                    <h3 style="font: bold 17px Tahoma; padding: 0px 0px 3px 1px; margin: 0px;"><?php 
                        echo $_smarty_tpl->__("customer");
                        ?>
:</h3>
                    <p style="margin: 2px 0px 3px 0px;"><?php 
                        if ($_smarty_tpl->tpl_vars['profields_c']->value['firstname']) {
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['firstname'], ENT_QUOTES, 'UTF-8');
                            ?>
&nbsp;<?php 
                        }
                        if ($_smarty_tpl->tpl_vars['profields_c']->value['lastname']) {
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['lastname'], ENT_QUOTES, 'UTF-8');
                        }
                        ?>
</p>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['profields_c']->value['email']) {
                            ?>
<p style="margin: 2px 0px 3px 0px;"><a href="mailto:<?php 
                            echo htmlspecialchars(rawurlencode($_smarty_tpl->tpl_vars['order_info']->value['email']), ENT_QUOTES, 'UTF-8');
                            ?>
"><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['email'], ENT_QUOTES, 'UTF-8');
                            ?>
</a></p><?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['profields_c']->value['phone']) {
                            ?>
<p style="margin: 2px 0px 3px 0px;"><span style="text-transform: uppercase;"><?php 
                            echo $_smarty_tpl->__("phone");
                            ?>
:</span>&nbsp;<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['phone'], ENT_QUOTES, 'UTF-8');
                            ?>
</p><?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['profields_c']->value['fax'] && $_smarty_tpl->tpl_vars['order_info']->value['fax']) {
                            ?>
<p style="margin: 2px 0px 3px 0px;"><span style="text-transform: uppercase;"><?php 
                            echo $_smarty_tpl->__("fax");
                            ?>
:</span>&nbsp;<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['fax'], ENT_QUOTES, 'UTF-8');
                            ?>
</p><?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['profields_c']->value['company'] && $_smarty_tpl->tpl_vars['order_info']->value['company']) {
                            ?>
<p style="margin: 2px 0px 3px 0px;"><span style="text-transform: uppercase;"><?php 
                            echo $_smarty_tpl->__("company");
                            ?>
:</span>&nbsp;<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['company'], ENT_QUOTES, 'UTF-8');
                            ?>
</p><?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['profields_c']->value['url'] && $_smarty_tpl->tpl_vars['order_info']->value['url']) {
                            ?>
<p style="margin: 2px 0px 3px 0px;"><span style="text-transform: uppercase;"><?php 
                            echo $_smarty_tpl->__("url");
                            ?>
:</span>&nbsp;<?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['url'], ENT_QUOTES, 'UTF-8');
                            ?>
</p><?php 
                        }
                        ?>
                    <?php 
                        echo $_smarty_tpl->getSubTemplate("profiles/profiles_extra_fields.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['C']), 0);
                        ?>

                </td>
                <?php 
                    }
                    ?>
                <?php 
                    if ($_smarty_tpl->tpl_vars['profile_fields']->value['B']) {
                        ?>
                <?php 
                        $_smarty_tpl->tpl_vars["profields_b"] = new Smarty_variable(fn_fields_from_multi_level($_smarty_tpl->tpl_vars['profile_fields']->value['B'], "field_name", "field_id"), null, 0);
                        ?>
                <td width="34%" style="font-size: 12px; font-family: Arial; <?php 
                        if ($_smarty_tpl->tpl_vars['profile_fields']->value['S']) {
                            ?>
padding-right: 10px;<?php 
                        }
                        ?>
 <?php 
                        if ($_smarty_tpl->tpl_vars['profile_fields']->value['C']) {
                            ?>
padding-left: 10px;<?php 
                        }
                        ?>
">
                    <h3 style="font: bold 17px Tahoma; padding: 0px 0px 3px 1px; margin: 0px;"><?php 
                        echo $_smarty_tpl->__("bill_to");
                        ?>
:</h3>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['b_firstname'] && $_smarty_tpl->tpl_vars['profields_b']->value['b_firstname'] || $_smarty_tpl->tpl_vars['order_info']->value['b_lastname'] && $_smarty_tpl->tpl_vars['profields_b']->value['b_lastname']) {
                            ?>
                    <p style="margin: 2px 0px 3px 0px;">
                        <?php 
                            if ($_smarty_tpl->tpl_vars['profields_b']->value['b_firstname']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['b_firstname'], ENT_QUOTES, 'UTF-8');
                                ?>
 <?php 
                            }
                            if ($_smarty_tpl->tpl_vars['profields_b']->value['b_lastname']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['b_lastname'], ENT_QUOTES, 'UTF-8');
                            }
                            ?>
                    </p>
                    <?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['b_address'] && $_smarty_tpl->tpl_vars['profields_b']->value['b_address'] || $_smarty_tpl->tpl_vars['order_info']->value['b_address_2'] && $_smarty_tpl->tpl_vars['profields_b']->value['b_address_2']) {
                            ?>
                    <p style="margin: 2px 0px 3px 0px;">
                        <?php 
                            if ($_smarty_tpl->tpl_vars['profields_b']->value['b_address']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['b_address'], ENT_QUOTES, 'UTF-8');
                                ?>
 <?php 
                            }
                            if ($_smarty_tpl->tpl_vars['profields_b']->value['b_address_2']) {
                                ?>
<br /><?php 
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['b_address_2'], ENT_QUOTES, 'UTF-8');
                            }
                            ?>
                    </p>
                    <?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['b_city'] && $_smarty_tpl->tpl_vars['profields_b']->value['b_city'] || $_smarty_tpl->tpl_vars['order_info']->value['b_state_descr'] && $_smarty_tpl->tpl_vars['profields_b']->value['b_state'] || $_smarty_tpl->tpl_vars['order_info']->value['b_zipcode'] && $_smarty_tpl->tpl_vars['profields_b']->value['b_zipcode']) {
                            ?>
                    <p style="margin: 2px 0px 3px 0px;">
                        <?php 
                            if ($_smarty_tpl->tpl_vars['profields_b']->value['b_city']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['b_city'], ENT_QUOTES, 'UTF-8');
                                if ($_smarty_tpl->tpl_vars['profields_b']->value['b_state']) {
                                    ?>
,<?php 
                                }
                                ?>
 <?php 
                            }
                            if ($_smarty_tpl->tpl_vars['profields_b']->value['b_state']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['b_state_descr'], ENT_QUOTES, 'UTF-8');
                                ?>
 <?php 
                            }
                            if ($_smarty_tpl->tpl_vars['profields_b']->value['b_zipcode']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['b_zipcode'], ENT_QUOTES, 'UTF-8');
                            }
                            ?>
                    </p>
                    <?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['b_country_descr'] && $_smarty_tpl->tpl_vars['profields_b']->value['b_country']) {
                            ?>
                    <p style="margin: 2px 0px 3px 0px;">
                        <?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['b_country_descr'], ENT_QUOTES, 'UTF-8');
                            ?>

                    </p>
                    <?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['b_phone'] && $_smarty_tpl->tpl_vars['profields_b']->value['b_phone']) {
                            ?>
                    <p style="margin: 2px 0px 3px 0px;">
                        <?php 
                            if ($_smarty_tpl->tpl_vars['profields_b']->value['b_phone']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['b_phone'], ENT_QUOTES, 'UTF-8');
                                ?>
 <?php 
                            }
                            ?>
                    </p>
                    <?php 
                        }
                        ?>
                    <?php 
                        echo $_smarty_tpl->getSubTemplate("profiles/profiles_extra_fields.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['B']), 0);
                        ?>

                </td>
                <?php 
                    }
                    ?>
                <?php 
                    if ($_smarty_tpl->tpl_vars['profile_fields']->value['S']) {
                        ?>
                <?php 
                        $_smarty_tpl->tpl_vars["profields_s"] = new Smarty_variable(fn_fields_from_multi_level($_smarty_tpl->tpl_vars['profile_fields']->value['S'], "field_name", "field_id"), null, 0);
                        ?>
                <td width="33%" style="font-size: 12px; font-family: Arial;">
                    <h3 style="font: bold 17px Tahoma; padding: 0px 0px 3px 1px; margin: 0px;"><?php 
                        echo $_smarty_tpl->__("ship_to");
                        ?>
:</h3>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['s_firstname'] && $_smarty_tpl->tpl_vars['profields_s']->value['s_firstname'] || $_smarty_tpl->tpl_vars['order_info']->value['s_lastname'] && $_smarty_tpl->tpl_vars['profields_s']->value['s_lastname']) {
                            ?>
                    <p style="margin: 2px 0px 3px 0px;">
                        <?php 
                            if ($_smarty_tpl->tpl_vars['profields_s']->value['s_firstname']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['s_firstname'], ENT_QUOTES, 'UTF-8');
                                ?>
 <?php 
                            }
                            if ($_smarty_tpl->tpl_vars['profields_s']->value['s_lastname']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['s_lastname'], ENT_QUOTES, 'UTF-8');
                            }
                            ?>
                    </p>
                    <?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['s_address'] && $_smarty_tpl->tpl_vars['profields_s']->value['s_address'] || $_smarty_tpl->tpl_vars['order_info']->value['s_address_2'] && $_smarty_tpl->tpl_vars['profields_s']->value['s_address_2']) {
                            ?>
                    <p style="margin: 2px 0px 3px 0px;">
                        <?php 
                            if ($_smarty_tpl->tpl_vars['profields_s']->value['s_address']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['s_address'], ENT_QUOTES, 'UTF-8');
                                ?>
 <?php 
                            }
                            if ($_smarty_tpl->tpl_vars['profields_s']->value['s_address_2']) {
                                ?>
<br /><?php 
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['s_address_2'], ENT_QUOTES, 'UTF-8');
                            }
                            ?>
                    </p>
                    <?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['s_city'] && $_smarty_tpl->tpl_vars['profields_s']->value['s_city'] || $_smarty_tpl->tpl_vars['order_info']->value['s_state_descr'] && $_smarty_tpl->tpl_vars['profields_s']->value['s_state'] || $_smarty_tpl->tpl_vars['order_info']->value['s_zipcode'] && $_smarty_tpl->tpl_vars['profields_s']->value['s_zipcode']) {
                            ?>
                    <p style="margin: 2px 0px 3px 0px;">
                        <?php 
                            if ($_smarty_tpl->tpl_vars['profields_s']->value['s_city']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['s_city'], ENT_QUOTES, 'UTF-8');
                                if ($_smarty_tpl->tpl_vars['profields_s']->value['s_state']) {
                                    ?>
,<?php 
                                }
                                ?>
 <?php 
                            }
                            if ($_smarty_tpl->tpl_vars['profields_s']->value['s_state']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['s_state_descr'], ENT_QUOTES, 'UTF-8');
                                ?>
 <?php 
                            }
                            if ($_smarty_tpl->tpl_vars['profields_s']->value['s_zipcode']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['s_zipcode'], ENT_QUOTES, 'UTF-8');
                            }
                            ?>
                    </p>
                    <?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['s_country_descr'] && $_smarty_tpl->tpl_vars['profields_s']->value['s_country']) {
                            ?>
                    <p style="margin: 2px 0px 3px 0px;">
                        <?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['s_country_descr'], ENT_QUOTES, 'UTF-8');
                            ?>

                    </p>
                    <?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['s_phone'] && $_smarty_tpl->tpl_vars['profields_s']->value['s_phone']) {
                            ?>
                    <p style="margin: 2px 0px 3px 0px;">
                        <?php 
                            if ($_smarty_tpl->tpl_vars['profields_s']->value['s_phone']) {
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['order_info']->value['s_phone'], ENT_QUOTES, 'UTF-8');
                                ?>
 <?php 
                            }
                            ?>
                    </p>
                    <?php 
                        }
                        ?>
                    <?php 
                        echo $_smarty_tpl->getSubTemplate("profiles/profiles_extra_fields.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['S']), 0);
                        ?>

                </td>
                <?php 
                    }
                    ?>
            </tr>
            </table>
            <?php 
                }
                ?>
            <?php 
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "orders:invoice_customer_info"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>

            
        
        
            
            
            <table width="100%" cellpadding="0" cellspacing="1" style="background-color: #dddddd;">
            <tr>
                <th width="70%" style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
            echo $_smarty_tpl->__("product");
            ?>
</th>
                <th style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
            echo $_smarty_tpl->__("quantity");
            ?>
</th>
                <th style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
            echo $_smarty_tpl->__("unit_price");
            ?>
</th>
                <?php 
            if ($_smarty_tpl->tpl_vars['order_info']->value['use_discount']) {
                ?>
                    <th style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
                echo $_smarty_tpl->__("discount");
                ?>
</th>
                <?php 
            }
            ?>
                <?php 
            if ($_smarty_tpl->tpl_vars['order_info']->value['taxes'] && $_smarty_tpl->tpl_vars['settings']->value['General']['tax_calculation'] != "subtotal") {
                ?>
                    <th style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
                echo $_smarty_tpl->__("tax");
                ?>
</th>
                <?php 
            }
            ?>
                <th style="background-color: #eeeeee; padding: 6px 10px; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
            echo $_smarty_tpl->__("subtotal");
            ?>
</th>
            </tr>
            <?php 
            $_smarty_tpl->tpl_vars["oi"] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars["oi"]->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['order_info']->value['products'];
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars["oi"]->key => $_smarty_tpl->tpl_vars["oi"]->value) {
                $_smarty_tpl->tpl_vars["oi"]->_loop = true;
                ?>
            <?php 
                $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "orders:items_list_row"));
                $_block_repeat = true;
                echo smarty_block_hook(array('name' => "orders:items_list_row"), null, $_smarty_tpl, $_block_repeat);
                while ($_block_repeat) {
                    ob_start();
                    ?>

                <?php 
                    if (!$_smarty_tpl->tpl_vars['oi']->value['extra']['parent']) {
                        ?>
                <tr>
                    <td style="padding: 5px 10px; background-color: #ffffff; font-size: 12px; font-family: Arial;">
                        <?php 
                        echo ($tmp = @$_smarty_tpl->tpl_vars['oi']->value['product']) === null || $tmp === '' ? $_smarty_tpl->__("deleted_product") : $tmp;
                        ?>

                        <?php 
                        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "orders:product_info"));
                        $_block_repeat = true;
                        echo smarty_block_hook(array('name' => "orders:product_info"), null, $_smarty_tpl, $_block_repeat);
                        while ($_block_repeat) {
                            ob_start();
                            ?>

                        <?php 
                            if ($_smarty_tpl->tpl_vars['oi']->value['product_code']) {
                                ?>
<p style="margin: 2px 0px 3px 0px;"><?php 
                                echo $_smarty_tpl->__("sku");
                                ?>
: <?php 
                                echo htmlspecialchars($_smarty_tpl->tpl_vars['oi']->value['product_code'], ENT_QUOTES, 'UTF-8');
                                ?>
</p><?php 
                            }
                            ?>
                        <?php 
                            $_block_content = ob_get_clean();
                            $_block_repeat = false;
                            echo smarty_block_hook(array('name' => "orders:product_info"), $_block_content, $_smarty_tpl, $_block_repeat);
                        }
                        array_pop($_smarty_tpl->smarty->_tag_stack);
                        ?>

                        <?php 
                        if ($_smarty_tpl->tpl_vars['oi']->value['product_options']) {
                            ?>
<br/><?php 
                            echo $_smarty_tpl->getSubTemplate("common/options_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('product_options' => $_smarty_tpl->tpl_vars['oi']->value['product_options']), 0);
                        }
                        ?>
                    </td>
                    <td style="padding: 5px 10px; background-color: #ffffff; text-align: center; font-size: 12px; font-family: Arial;"><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['oi']->value['amount'], ENT_QUOTES, 'UTF-8');
                        ?>
</td>
                    <td style="padding: 5px 10px; background-color: #ffffff; text-align: right; font-size: 12px; font-family: Arial;"><?php 
                        if ($_smarty_tpl->tpl_vars['oi']->value['extra']['exclude_from_calculate']) {
                            echo $_smarty_tpl->__("free");
                        } else {
                            echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['oi']->value['original_price']), 0);
                        }
                        ?>
</td>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['use_discount']) {
                            ?>
                    <td style="padding: 5px 10px; background-color: #ffffff; text-align: right; font-size: 12px; font-family: Arial;"><?php 
                            if (floatval($_smarty_tpl->tpl_vars['oi']->value['extra']['discount'])) {
                                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['oi']->value['extra']['discount']), 0);
                            } else {
                                ?>
&nbsp;-&nbsp;<?php 
                            }
                            ?>
</td>
                    <?php 
                        }
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['order_info']->value['taxes'] && $_smarty_tpl->tpl_vars['settings']->value['General']['tax_calculation'] != "subtotal") {
                            ?>
                        <td style="padding: 5px 10px; background-color: #ffffff; text-align: right; font-size: 12px; font-family: Arial;"><?php 
                            if ($_smarty_tpl->tpl_vars['oi']->value['tax_value']) {
                                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['oi']->value['tax_value']), 0);
                            } else {
                                ?>
&nbsp;-&nbsp;<?php 
                            }
                            ?>
</td>
                    <?php 
                        }
                        ?>
        
                    <td style="padding: 5px 10px; background-color: #ffffff; text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><b><?php 
                        if ($_smarty_tpl->tpl_vars['oi']->value['extra']['exclude_from_calculate']) {
                            echo $_smarty_tpl->__("free");
                        } else {
                            echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['oi']->value['display_subtotal']), 0);
                        }
                        ?>
</b>&nbsp;</td>
                </tr>
                <?php 
                    }
                    ?>
            <?php 
                    $_block_content = ob_get_clean();
                    $_block_repeat = false;
                    echo smarty_block_hook(array('name' => "orders:items_list_row"), $_block_content, $_smarty_tpl, $_block_repeat);
                }
                array_pop($_smarty_tpl->smarty->_tag_stack);
                ?>

            <?php 
            }
            ?>
            <?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "orders:extra_list"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "orders:extra_list"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                ?>

            <?php 
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "orders:extra_list"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>

            </table>
        
            <?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "orders:ordered_products"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "orders:ordered_products"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                ?>

            <?php 
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "orders:ordered_products"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>

            
        
            
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tr>
                <td align="right">
                <table border="0" style="padding: 3px 0px 12px 0px;">
                <tr>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><b><?php 
            echo $_smarty_tpl->__("subtotal");
            ?>
:</b>&nbsp;</td>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
            echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['order_info']->value['display_subtotal']), 0);
            ?>
</td>
                </tr>
                <?php 
            if (floatval($_smarty_tpl->tpl_vars['order_info']->value['discount'])) {
                ?>
                <tr>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><b><?php 
                echo $_smarty_tpl->__("including_discount");
                ?>
:</b>&nbsp;</td>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;">
                        <?php 
                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['order_info']->value['discount']), 0);
                ?>
</td>
                </tr>
                <?php 
            }
            ?>

            
                <?php 
            if (floatval($_smarty_tpl->tpl_vars['order_info']->value['subtotal_discount'])) {
                ?>
                <tr>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
                echo $_smarty_tpl->__("order_discount");
                ?>
:</td>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;">
                        <?php 
                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['order_info']->value['subtotal_discount']), 0);
                ?>
</td>
                </tr>
                <?php 
            }
            ?>

                <?php 
            if ($_smarty_tpl->tpl_vars['order_info']->value['coupons']) {
                ?>
                <?php 
                $_smarty_tpl->tpl_vars["coupon"] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars["coupon"]->_loop = false;
                $_smarty_tpl->tpl_vars["key"] = new Smarty_Variable();
                $_from = $_smarty_tpl->tpl_vars['order_info']->value['coupons'];
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars["coupon"]->key => $_smarty_tpl->tpl_vars["coupon"]->value) {
                    $_smarty_tpl->tpl_vars["coupon"]->_loop = true;
                    $_smarty_tpl->tpl_vars["key"]->value = $_smarty_tpl->tpl_vars["coupon"]->key;
                    ?>
                <tr>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><b><?php 
                    echo $_smarty_tpl->__("coupon");
                    ?>
:</b>&nbsp;</td>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['key']->value, ENT_QUOTES, 'UTF-8');
                    ?>
</td>
                </tr>
                <?php 
                }
                ?>
                <?php 
            }
            ?>
                <?php 
            if ($_smarty_tpl->tpl_vars['order_info']->value['taxes']) {
                ?>
                <tr>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><b><?php 
                echo $_smarty_tpl->__("taxes");
                ?>
:</b>&nbsp;</td>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;">&nbsp;</td>
                </tr>
                <?php 
                $_smarty_tpl->tpl_vars['tax_data'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['tax_data']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['order_info']->value['taxes'];
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['tax_data']->key => $_smarty_tpl->tpl_vars['tax_data']->value) {
                    $_smarty_tpl->tpl_vars['tax_data']->_loop = true;
                    ?>
                <tr>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['tax_data']->value['description'], ENT_QUOTES, 'UTF-8');
                    ?>
&nbsp;<?php 
                    echo $_smarty_tpl->getSubTemplate("common/modifier.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('mod_value' => $_smarty_tpl->tpl_vars['tax_data']->value['rate_value'], 'mod_type' => $_smarty_tpl->tpl_vars['tax_data']->value['rate_type']), 0);
                    if ($_smarty_tpl->tpl_vars['tax_data']->value['price_includes_tax'] == "Y" && ($_smarty_tpl->tpl_vars['settings']->value['Appearance']['cart_prices_w_taxes'] != "Y" || $_smarty_tpl->tpl_vars['settings']->value['General']['tax_calculation'] == "subtotal")) {
                        ?>
&nbsp;<?php 
                        echo $_smarty_tpl->__("included");
                    }
                    if ($_smarty_tpl->tpl_vars['tax_data']->value['regnumber']) {
                        ?>
&nbsp;(<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['tax_data']->value['regnumber'], ENT_QUOTES, 'UTF-8');
                        ?>
)<?php 
                    }
                    ?>
:&nbsp;</td>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
                    echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['tax_data']->value['tax_subtotal']), 0);
                    ?>
</td>
                </tr>
                <?php 
                }
                ?>
                <?php 
            }
            ?>
                <?php 
            if ($_smarty_tpl->tpl_vars['order_info']->value['tax_exempt'] == 'Y') {
                ?>
                <tr>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><b><?php 
                echo $_smarty_tpl->__("tax_exempt");
                ?>
</b></td>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;">&nbsp;</td>
                </tr>
                <?php 
            }
            ?>
            
                <?php 
            if (floatval($_smarty_tpl->tpl_vars['order_info']->value['payment_surcharge']) && !$_smarty_tpl->tpl_vars['take_surcharge_from_vendor']->value) {
                ?>
                <tr>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
                echo htmlspecialchars(($tmp = @$_smarty_tpl->tpl_vars['order_info']->value['payment_method']['surcharge_title']) === null || $tmp === '' ? $_smarty_tpl->__("payment_surcharge") : $tmp, ENT_QUOTES, 'UTF-8');
                ?>
:&nbsp;</td>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><b><?php 
                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['order_info']->value['payment_surcharge']), 0);
                ?>
</b></td>
                </tr>
                <?php 
            }
            ?>
            
            
                <?php 
            if ($_smarty_tpl->tpl_vars['order_info']->value['shipping']) {
                ?>
                <tr>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><b><?php 
                echo $_smarty_tpl->__("shipping_cost");
                ?>
:</b>&nbsp;</td>
                    <td style="text-align: right; white-space: nowrap; font-size: 12px; font-family: Arial;"><?php 
                echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['order_info']->value['display_shipping_cost']), 0);
                ?>
</td>
                </tr>
                <?php 
            }
            ?>
                <?php 
            $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "orders:totals"));
            $_block_repeat = true;
            echo smarty_block_hook(array('name' => "orders:totals"), null, $_smarty_tpl, $_block_repeat);
            while ($_block_repeat) {
                ob_start();
                ?>

                <?php 
                $_block_content = ob_get_clean();
                $_block_repeat = false;
                echo smarty_block_hook(array('name' => "orders:totals"), $_block_content, $_smarty_tpl, $_block_repeat);
            }
            array_pop($_smarty_tpl->smarty->_tag_stack);
            ?>

                
                <tr>
                    <td colspan="2"><hr style="border: 0px solid #d5d5d5; border-top-width: 1px;" /></td>
                </tr>
                <tr>
                    <td style="text-align: right; white-space: nowrap; font: 15px Tahoma; text-align: right;"><?php 
            echo $_smarty_tpl->__("total_cost");
            ?>
:&nbsp;</td>
                    <td style="text-align: right; white-space: nowrap; font: 15px Tahoma; text-align: right;"><strong style="font: bold 17px Tahoma;"><?php 
            echo $_smarty_tpl->getSubTemplate("common/price.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('value' => $_smarty_tpl->tpl_vars['order_info']->value['total']), 0);
            ?>
</strong></td>
                </tr>
                </table>
                </td>
            </tr>
            </table>
        
            
        
            <?php 
            if ($_smarty_tpl->tpl_vars['order_info']->value['notes']) {
                ?>
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tr valign="top">
                <td style="font-size: 12px; font-family: Arial;"><strong><?php 
                echo $_smarty_tpl->__("notes");
                ?>
:</strong></td>
            </tr>
            <tr valign="top">
                <td><div style="overflow-x: auto; clear: both; width: 510px; height: 100%; padding-bottom: 20px; overflow-y: hidden; font-size: 12px; font-family: Arial;"><?php 
                echo nl2br($_smarty_tpl->tpl_vars['order_info']->value['notes']);
                ?>
</div></td>
            </tr>
            </table>
            <?php 
            }
            ?>
        <?php 
        }
        ?>
        
        <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "orders:invoice"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "orders:invoice"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

        <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "orders:invoice"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

        </td>
    </tr>
    </table>
    </td>
</tr>
</table>
<?php 
    }
Example #8
0
 if ($restored_user_data) {
     $user_data = fn_array_merge($user_data, $restored_user_data);
 }
 Registry::set('navigation.tabs.general', array('title' => __('general'), 'js' => true));
 $show_usergroups = true;
 if (Registry::get('settings.General.allow_usergroup_signup') != 'Y') {
     $show_usergroups = fn_user_has_active_usergroups($user_data);
 }
 if ($show_usergroups) {
     $usergroups = fn_get_usergroups('C');
     if (!empty($usergroups)) {
         Registry::set('navigation.tabs.usergroups', array('title' => __('usergroups'), 'js' => true));
         Registry::get('view')->assign('usergroups', $usergroups);
     }
 }
 $profile_fields = fn_get_profile_fields();
 //  echo 'profile fields:'; var_dump($profile_fields);
 //check if the user has uploaded a image
 $target_dir = "/images/user_profile/";
 //insert user id here
 $base_url = $_SERVER['DOCUMENT_ROOT'];
 $ls_image_name = $auth['user_id'] . '.jpg';
 //replace with user id
 $target_file = $base_url . $target_dir . $ls_image_name;
 if (file_exists($target_file)) {
     $ls_user_image = 'file exists';
     //  $view->assign('ls_user_image', $ls_user_image);
     Registry::get('view')->assign('ls_user_profile_image', $ls_user_image);
 }
 Registry::get('view')->assign('profile_fields', $profile_fields);
 Registry::get('view')->assign('user_data', $user_data);
Example #9
0
function fn_calculate_tax_rates($taxes, $price, $amount, $auth, &$cart)
{
    static $destination_id;
    static $tax_description;
    static $user_data;
    $taxed_price = $price;
    if (!empty($cart['user_data'])) {
        $profile_fields = fn_get_profile_fields('O', $auth);
        $billing_population = fn_check_profile_fields_population($cart['user_data'], 'B', $profile_fields);
        $shipping_population = fn_check_profile_fields_population($cart['user_data'], 'S', $profile_fields);
    }
    if (empty($auth['user_id']) && (empty($cart['user_data']) || fn_is_empty($cart['user_data']) || $billing_population != true || $shipping_population != true) && defined('CHECKOUT') && Registry::get('settings.Appearance.taxes_using_default_address') !== 'Y') {
        return false;
    }
    if (empty($destination_id) || $user_data != @$cart['user_data']) {
        // Get billing location
        $location = fn_get_customer_location($auth, $cart, true);
        $destination_id['B'] = fn_get_available_destination($location);
        // Get shipping location
        $location = fn_get_customer_location($auth, $cart);
        $destination_id['S'] = fn_get_available_destination($location);
    }
    if (!empty($cart['user_data'])) {
        $user_data = $cart['user_data'];
    }
    $_tax = 0;
    $previous_priority = 0;
    foreach ($taxes as $key => $tax) {
        if (empty($tax['tax_id'])) {
            $tax['tax_id'] = $key;
        }
        if (empty($tax['priority'])) {
            $tax['priority'] = 1;
        }
        $_is_zero = floatval($taxed_price);
        if (empty($_is_zero)) {
            continue;
        }
        if (!empty($cart['stored_taxes']) && $cart['stored_taxes'] == 'Y' && !empty($tax['rate_type'])) {
            $rate = array('rate_value' => $tax['rate_value'], 'rate_type' => $tax['rate_type']);
        } else {
            if (!isset($destination_id[$tax['address_type']])) {
                continue;
            }
            $rate = db_get_row("SELECT destination_id, apply_to, rate_value, rate_type FROM ?:tax_rates WHERE tax_id = ?i AND destination_id = ?i", $tax['tax_id'], $destination_id[$tax['address_type']]);
            if (!@floatval($rate['rate_value'])) {
                continue;
            }
        }
        $base_price = $tax['priority'] == $previous_priority ? $previous_price : $taxed_price;
        if ($rate['rate_type'] == 'P') {
            // Percent dependence
            // If tax is included into the price
            if ($tax['price_includes_tax'] == 'Y') {
                $_tax = fn_format_price($base_price - $base_price / (1 + $rate['rate_value'] / 100));
                // If tax is NOT included into the price
            } else {
                $_tax = fn_format_price($base_price * ($rate['rate_value'] / 100));
                $taxed_price += $_tax;
            }
        } else {
            $_tax = fn_format_price($rate['rate_value']);
            // If tax is NOT included into the price
            if ($tax['price_includes_tax'] != 'Y') {
                $taxed_price += $_tax;
            }
        }
        $previous_priority = $tax['priority'];
        $previous_price = $base_price;
        if (empty($tax_description[$tax['tax_id']])) {
            $tax_description[$tax['tax_id']] = db_get_field("SELECT tax FROM ?:tax_descriptions WHERE tax_id = ?i AND lang_code = ?s", $tax['tax_id'], CART_LANGUAGE);
        }
        $taxes_data[$tax['tax_id']] = array('rate_type' => $rate['rate_type'], 'rate_value' => $rate['rate_value'], 'price_includes_tax' => $tax['price_includes_tax'], 'regnumber' => @$tax['regnumber'], 'priority' => @$tax['priority'], 'tax_subtotal' => fn_format_price($_tax * $amount), 'description' => $tax_description[$tax['tax_id']]);
    }
    return empty($taxes_data) ? false : $taxes_data;
}
    function content_55d5c7593563b3_67108128($_smarty_tpl)
    {
        if (!is_callable('smarty_block_hook')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/block.hook.php';
        }
        fn_preload_lang_vars(array('enter_data', 'edit', 'section_is_not_completed', 'address_type', 'section_is_not_completed', 'ip_address', 'phone', 'fax', 'company', 'website', 'attention', 'notice_update_customer_details', 'update_customer_info', 'section_is_not_completed', 'select_customer', 'user_data_required', 'customer_information', 'shipping_address', 'billing_address'));
        $_smarty_tpl->tpl_vars["profile_fields"] = new Smarty_variable(fn_get_profile_fields($_smarty_tpl->tpl_vars['location']->value), null, 0);
        ?>

<?php 
        if (!function_exists('smarty_template_function_profile_enter_data_link')) {
            function smarty_template_function_profile_enter_data_link($_smarty_tpl, $params)
            {
                $saved_tpl_vars = $_smarty_tpl->tpl_vars;
                foreach ($_smarty_tpl->smarty->template_functions['profile_enter_data_link']['parameter'] as $key => $value) {
                    $_smarty_tpl->tpl_vars[$key] = new Smarty_variable($value);
                }
                foreach ($params as $key => $value) {
                    $_smarty_tpl->tpl_vars[$key] = new Smarty_variable($value);
                }
                ?>
    <div class="btn-group"><a class="btn cm-dialog-opener" data-ca-target-id="customer_info"  data-ca-scroll="<?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['scroll_to']->value, ENT_QUOTES, 'UTF-8');
                ?>
"><?php 
                echo $_smarty_tpl->__("enter_data");
                ?>
</a></div>
<?php 
                $_smarty_tpl->tpl_vars = $saved_tpl_vars;
                foreach (Smarty::$global_tpl_vars as $key => $value) {
                    if (!isset($_smarty_tpl->tpl_vars[$key])) {
                        $_smarty_tpl->tpl_vars[$key] = $value;
                    }
                }
            }
        }
        ?>


<?php 
        if (!function_exists('smarty_template_function_profile_edit_link')) {
            function smarty_template_function_profile_edit_link($_smarty_tpl, $params)
            {
                $saved_tpl_vars = $_smarty_tpl->tpl_vars;
                foreach ($_smarty_tpl->smarty->template_functions['profile_edit_link']['parameter'] as $key => $value) {
                    $_smarty_tpl->tpl_vars[$key] = new Smarty_variable($value);
                }
                foreach ($params as $key => $value) {
                    $_smarty_tpl->tpl_vars[$key] = new Smarty_variable($value);
                }
                ?>
    <?php 
                if ($_smarty_tpl->tpl_vars['is_edit']->value) {
                    ?>
    <div class="pull-right">
        <a class="hand cm-tooltip icon-edit cm-dialog-opener<?php 
                    if ($_smarty_tpl->tpl_vars['click_to']->value) {
                        ?>
 cm-external-click<?php 
                    }
                    ?>
" data-ca-target-id="customer_info" data-ca-scroll="<?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['scroll_to']->value, ENT_QUOTES, 'UTF-8');
                    ?>
" <?php 
                    if ($_smarty_tpl->tpl_vars['click_to']->value) {
                        ?>
data-ca-external-click-id="<?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['click_to']->value, ENT_QUOTES, 'UTF-8');
                        ?>
"<?php 
                    }
                    ?>
 title="<?php 
                    echo $_smarty_tpl->__("edit");
                    ?>
"></a>
    </div>
    <?php 
                }
                $_smarty_tpl->tpl_vars = $saved_tpl_vars;
                foreach (Smarty::$global_tpl_vars as $key => $value) {
                    if (!isset($_smarty_tpl->tpl_vars[$key])) {
                        $_smarty_tpl->tpl_vars[$key] = $value;
                    }
                }
            }
        }
        ?>



<?php 
        $_smarty_tpl->_capture_stack[0][] = array("billing_address", null, null);
        ob_start();
        ?>
    <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "order_management:profile_billing_address"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "order_management:profile_billing_address"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

    <?php 
            if (!fn_is_empty($_smarty_tpl->tpl_vars['user_data']->value)) {
                ?>
        <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['B']) {
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['b_firstname'] || $_smarty_tpl->tpl_vars['user_data']->value['b_lastname']) {
                        ?>
                <p class="strong"><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['b_firstname'], ENT_QUOTES, 'UTF-8');
                        ?>
 <?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['b_lastname'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['b_address']) {
                        ?>
                <p><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['b_address'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['b_address_2']) {
                        ?>
                <p><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['b_address_2'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['b_city'] || $_smarty_tpl->tpl_vars['user_data']->value['b_state_descr'] || $_smarty_tpl->tpl_vars['user_data']->value['b_zipcode']) {
                        ?>
                <p><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['b_city'], ENT_QUOTES, 'UTF-8');
                        if ($_smarty_tpl->tpl_vars['user_data']->value['b_city'] && ($_smarty_tpl->tpl_vars['user_data']->value['b_state_descr'] || $_smarty_tpl->tpl_vars['user_data']->value['b_zipcode'])) {
                            ?>
,<?php 
                        }
                        ?>
 <?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['b_state_descr'], ENT_QUOTES, 'UTF-8');
                        ?>
 <?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['b_zipcode'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['b_country_descr']) {
                        ?>
<p><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['b_country_descr'], ENT_QUOTES, 'UTF-8');
                        ?>
</p><?php 
                    }
                    ?>
            <?php 
                    echo $_smarty_tpl->getSubTemplate("views/profiles/components/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['B']), 0);
                    ?>

            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['b_phone']) {
                        ?>
                <p><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['b_phone'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
        <?php 
                }
                ?>
    <?php 
            } else {
                ?>
        <p class="muted"><?php 
                echo $_smarty_tpl->__("section_is_not_completed");
                ?>
</p>
        <div class="enter-data">
            <?php 
                smarty_template_function_profile_enter_data_link($_smarty_tpl, array('scroll_to' => "profile_fields_b"));
                ?>

        </div>
    <?php 
            }
            ?>
    <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "order_management:profile_billing_address"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

<?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>


<?php 
        $_smarty_tpl->_capture_stack[0][] = array("shipping_address", null, null);
        ob_start();
        ?>
    <?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('hook', array('name' => "order_management:profile_shipping_address"));
        $_block_repeat = true;
        echo smarty_block_hook(array('name' => "order_management:profile_shipping_address"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>

    <?php 
            if (!fn_is_empty($_smarty_tpl->tpl_vars['user_data']->value)) {
                ?>
        <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['S']) {
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['s_firstname'] || $_smarty_tpl->tpl_vars['user_data']->value['s_lastname']) {
                        ?>
                <p class="strong"><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['s_firstname'], ENT_QUOTES, 'UTF-8');
                        ?>
 <?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['s_lastname'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['s_address']) {
                        ?>
                <p><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['s_address'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['s_address_2']) {
                        ?>
                <p><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['s_address_2'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['s_city'] || $_smarty_tpl->tpl_vars['user_data']->value['s_state_descr'] || $_smarty_tpl->tpl_vars['user_data']->value['s_zipcode']) {
                        ?>
                <p><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['s_city'], ENT_QUOTES, 'UTF-8');
                        if ($_smarty_tpl->tpl_vars['user_data']->value['s_city'] && ($_smarty_tpl->tpl_vars['user_data']->value['s_state_descr'] || $_smarty_tpl->tpl_vars['user_data']->value['s_zipcode'])) {
                            ?>
,<?php 
                        }
                        ?>
  <?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['s_state_descr'], ENT_QUOTES, 'UTF-8');
                        ?>
 <?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['s_zipcode'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['s_country_descr']) {
                        ?>
<p><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['s_country_descr'], ENT_QUOTES, 'UTF-8');
                        ?>
</p><?php 
                    }
                    ?>
            <?php 
                    echo $_smarty_tpl->getSubTemplate("views/profiles/components/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['S']), 0);
                    ?>

            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['s_phone']) {
                        ?>
                <p><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['s_phone'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
            <?php 
                    if ($_smarty_tpl->tpl_vars['user_data']->value['s_address_type']) {
                        ?>
                <p><?php 
                        echo $_smarty_tpl->__("address_type");
                        ?>
: <?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['s_address_type'], ENT_QUOTES, 'UTF-8');
                        ?>
</p>
            <?php 
                    }
                    ?>
        <?php 
                }
                ?>
    <?php 
            } else {
                ?>
        <p class="muted"><?php 
                echo $_smarty_tpl->__("section_is_not_completed");
                ?>
</p>
        <div class="enter-data">
            <?php 
                smarty_template_function_profile_enter_data_link($_smarty_tpl, array('scroll_to' => "profile_fields_s"));
                ?>

        </div>
    <?php 
            }
            ?>
    <?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo smarty_block_hook(array('name' => "order_management:profile_shipping_address"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

<?php 
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>



<?php 
        $_smarty_tpl->_capture_stack[0][] = array("customer_information", null, null);
        ob_start();
        ?>
    <?php 
        if (!fn_is_empty($_smarty_tpl->tpl_vars['user_data']->value)) {
            ?>
        <p class="strong">
            <?php 
            $_smarty_tpl->tpl_vars['user_full_name'] = new Smarty_variable(trim((string) $_smarty_tpl->tpl_vars['user_data']->value['firstname'] . " " . (string) $_smarty_tpl->tpl_vars['user_data']->value['lastname']), null, 0);
            ?>
            <?php 
            if ($_smarty_tpl->tpl_vars['user_full_name']->value) {
                ?>
                <?php 
                if ($_smarty_tpl->tpl_vars['user_data']->value['user_id']) {
                    ?>
                    <a href="<?php 
                    echo htmlspecialchars(fn_url("profiles.update?user_id=" . (string) $_smarty_tpl->tpl_vars['user_data']->value['user_id']), ENT_QUOTES, 'UTF-8');
                    ?>
"><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['user_full_name']->value, ENT_QUOTES, 'UTF-8');
                    ?>
</a>,
                <?php 
                } elseif ($_smarty_tpl->tpl_vars['user_full_name']->value) {
                    ?>
                    <?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['user_full_name']->value, ENT_QUOTES, 'UTF-8');
                    ?>
,
                <?php 
                }
                ?>
            <?php 
            }
            ?>
            <a href="mailto:<?php 
            echo htmlspecialchars(rawurlencode($_smarty_tpl->tpl_vars['user_data']->value['email']), ENT_QUOTES, 'UTF-8');
            ?>
"><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['email'], ENT_QUOTES, 'UTF-8');
            ?>
</a>
        </p>

        <?php 
            if ($_smarty_tpl->tpl_vars['user_data']->value['ip_address']) {
                ?>
            <span><?php 
                echo $_smarty_tpl->__("ip_address");
                ?>
:</span>
            <?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['ip_address'], ENT_QUOTES, 'UTF-8');
                ?>

        <?php 
            }
            ?>
        <div class="clear">
            <?php 
            if ($_smarty_tpl->tpl_vars['user_data']->value['phone']) {
                ?>
                <span><?php 
                echo $_smarty_tpl->__("phone");
                ?>
:</span>
                <span><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['phone'], ENT_QUOTES, 'UTF-8');
                ?>
</span>
            <?php 
            }
            ?>
            <?php 
            if ($_smarty_tpl->tpl_vars['user_data']->value['fax']) {
                ?>
                <span><?php 
                echo $_smarty_tpl->__("fax");
                ?>
:</span>
                <span><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['fax'], ENT_QUOTES, 'UTF-8');
                ?>
</span>
            <?php 
            }
            ?>
            <?php 
            if ($_smarty_tpl->tpl_vars['user_data']->value['company']) {
                ?>
                <span><?php 
                echo $_smarty_tpl->__("company");
                ?>
:</span>
                <span><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['company'], ENT_QUOTES, 'UTF-8');
                ?>
</span>
            <?php 
            }
            ?>
            <?php 
            if ($_smarty_tpl->tpl_vars['user_data']->value['url']) {
                ?>
                <span><?php 
                echo $_smarty_tpl->__("website");
                ?>
:</span>
                <span><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['url'], ENT_QUOTES, 'UTF-8');
                ?>
</span>
            <?php 
            }
            ?>
        </div>
        <?php 
            echo $_smarty_tpl->getSubTemplate("views/profiles/components/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['C'], 'customer_info' => "Y"), 0);
            ?>

        <?php 
            if ($_smarty_tpl->tpl_vars['email_changed']->value) {
                ?>
                <span class="text-warning strong"><?php 
                echo $_smarty_tpl->__("attention");
                ?>
</span>
                <span class="text-warning"><?php 
                echo $_smarty_tpl->__("notice_update_customer_details");
                ?>
</span>

                <label for="update_customer_details" class="checkbox">
                    <input type="checkbox" name="update_customer_details" id="update_customer_details" value="Y" />
                <?php 
                echo $_smarty_tpl->__("update_customer_info");
                ?>
</label>
        <?php 
            }
            ?>
    <?php 
        } else {
            ?>
        <p class="muted"><?php 
            echo $_smarty_tpl->__("section_is_not_completed");
            ?>
</p>
        <div class="enter-data">
            <div class="clearfix shift-button">
                <?php 
            echo $_smarty_tpl->getSubTemplate("pickers/users/picker.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('extra_var' => "order_management.select_customer?page=" . (string) $_REQUEST['page'], 'display' => "radio", 'but_text' => __("select_customer"), 'no_container' => true, 'but_meta' => "btn", 'shared_force' => $_smarty_tpl->tpl_vars['users_shared_force']->value), 0);
            ?>

            </div>
            <?php 
            smarty_template_function_profile_enter_data_link($_smarty_tpl, array('scroll_to' => "profile_fields_c"));
            ?>

        </div>
        <?php 
            if ($_smarty_tpl->tpl_vars['is_empty_user_data']->value) {
                ?>
        <div class="text-error">
            <label class="hidden cm-required" for="user_data_required"><?php 
                echo $_smarty_tpl->__("user_data_required");
                ?>
</label>
            <input type="hidden" id="user_data_required" name="user_data_required" value="" />
        </div>
        <?php 
            }
            ?>
    <?php 
        }
        list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
        if (!empty($_capture_buffer)) {
            if (isset($_capture_assign)) {
                $_smarty_tpl->assign($_capture_assign, ob_get_contents());
            }
            if (isset($_capture_append)) {
                $_smarty_tpl->append($_capture_append, ob_get_contents());
            }
            Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
        } else {
            $_smarty_tpl->capture_error();
        }
        ?>

<div class="sidebar-row">
    <?php 
        smarty_template_function_profile_edit_link($_smarty_tpl, array('scroll_to' => "profile_fields_c"));
        ?>

    <h6><?php 
        echo $_smarty_tpl->__("customer_information");
        ?>
</h6>
    <div class="profile-info">
        <i class="icon-user"></i>
        <?php 
        echo Smarty::$_smarty_vars['capture']['customer_information'];
        ?>

    </div>
</div>
<hr>
<div class="sidebar-row">
    <?php 
        smarty_template_function_profile_edit_link($_smarty_tpl, array('scroll_to' => "profile_fields_s", 'click_to' => "on_sta_notice"));
        ?>

    <h6><?php 
        echo $_smarty_tpl->__("shipping_address");
        ?>
</h6>
    <div class="profile-info">
        <i class="exicon-car"></i>
        <?php 
        echo Smarty::$_smarty_vars['capture']['shipping_address'];
        ?>

    </div>
</div>
<hr>
<div class="sidebar-row">
    <?php 
        smarty_template_function_profile_edit_link($_smarty_tpl, array('scroll_to' => "profile_fields_b"));
        ?>

    <h6><?php 
        echo $_smarty_tpl->__("billing_address");
        ?>
</h6>
    <div class="profile-info">
        <i class="icon-tag"></i>
        <?php 
        echo Smarty::$_smarty_vars['capture']['billing_address'];
        ?>

    </div>
</div>
<hr>
<?php 
    }
Example #11
0
function fn_checkout_get_display_steps($profile_fields = array())
{
    if (!$profile_fields) {
        $profile_fields = fn_get_profile_fields('O');
    }
    $display_steps = array('step_one' => true, 'step_two' => true, 'step_three' => true, 'step_four' => true);
    if (Registry::get('settings.Checkout.configure_sign_in_step') == 'hide') {
        // Need to check profile fields
        $required_fields = fn_get_profile_fields('O', array(), CART_LANGUAGE, array('get_checkout_required' => true));
        if (empty($required_fields['C']) && Registry::get('settings.Checkout.disable_anonymous_checkout') != 'Y') {
            $display_steps['step_one'] = false;
        }
    }
    if (empty($profile_fields['B']) && empty($profile_fields['S'])) {
        $display_steps['step_two'] = false;
    }
    if (Registry::get('settings.Checkout.display_shipping_step') != 'Y' && fn_allowed_for('ULTIMATE')) {
        $display_steps['step_three'] = false;
    }
    if (Registry::get('settings.Checkout.display_payment_step') != 'Y') {
        $display_steps['step_four'] = false;
    }
    return $display_steps;
}
Example #12
0
/**
 * Add/update user
 *
 * @param int $user_id - user ID to update (empty for new user)
 * @param array $user_data - user data
 * @param array $auth - authentication information
 * @param bool $ship_to_another - flag indicates that shipping and billing fields are different
 * @param bool $notify_customer - flag indicates that customer should be notified
 * @param bool $send_password - TRUE if the password should be included into the e-mail
 * @return array with user ID and profile ID if success, false otherwise
 */
function fn_update_user($user_id, $user_data, &$auth, $ship_to_another, $notify_customer, $send_password = false)
{
    if (!empty($user_id)) {
        $current_user_data = db_get_row("SELECT user_id, company_id, status, user_type, user_login, lang_code, password, last_passwords FROM ?:users WHERE user_id = ?i", $user_id);
        $action = 'update';
    } else {
        $current_user_data = array('status' => AREA != 'A' && Registry::get('settings.General.approve_user_profiles') == 'Y' ? 'D' : (!empty($user_data['status']) ? $user_data['status'] : 'A'), 'user_type' => 'C');
        $action = 'add';
        $user_data['lang_code'] = !empty($user_data['lang_code']) ? $user_data['lang_code'] : CART_LANGUAGE;
        $user_data['timestamp'] = TIME;
    }
    $original_password = '';
    $current_user_data['password'] = !empty($current_user_data['password']) ? $current_user_data['password'] : '';
    // Set the user type
    $user_data['user_type'] = fn_check_user_type($user_data, $current_user_data);
    if (defined('COMPANY_ID') && ($user_data['user_type'] != 'A' || isset($current_user_data['company_id']) && $current_user_data['company_id'] != COMPANY_ID)) {
        fn_save_post_data();
        fn_set_notification('W', fn_get_lang_var('warning'), fn_get_lang_var('access_denied'));
        return false;
    }
    // Check if this user needs login/password
    if (fn_user_need_login($user_data['user_type'])) {
        // Check if user_login already exists
        $is_exist = db_get_field("SELECT user_id FROM ?:users WHERE (email = ?s ?p) AND user_id != ?i", $user_data['email'], empty($user_data['user_login']) ? '' : db_quote(" OR user_login = ?s", $user_data['user_login']), $user_id);
        if ($is_exist) {
            fn_save_post_data();
            fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('error_user_exists'));
            return false;
        }
        // Check the passwords
        $original_password = $user_data['password1'];
        $user_data['password1'] = !empty($user_data['password1']) ? trim($user_data['password1']) : '';
        $user_data['password2'] = !empty($user_data['password2']) ? trim($user_data['password2']) : '';
        // if the passwords are not set and this is not a forced password check
        // we will not update password, otherwise let's check password
        if (!empty($_SESSION['auth']['forced_password_change']) || !empty($user_data['password1']) || !empty($user_data['password2'])) {
            $valid_passwords = true;
            if ($user_data['password1'] != $user_data['password2']) {
                $valid_passwords = false;
                fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('error_passwords_dont_match'));
            }
            // PCI DSS Compliance
            if ($user_data['user_type'] == 'A') {
                $msg = array();
                // Check password length
                $min_length = Registry::get('settings.Security.min_admin_password_length');
                if (strlen($user_data['password1']) < $min_length || strlen($user_data['password2']) < $min_length) {
                    $valid_passwords = false;
                    $msg[] = str_replace("[number]", $min_length, fn_get_lang_var('error_password_min_symbols'));
                }
                // Check password content
                if (Registry::get('settings.Security.admin_passwords_must_contain_mix') == 'Y') {
                    $tmp_result = preg_match('/\\d+/', $user_data['password1']) && preg_match('/\\D+/', $user_data['password1']) && preg_match('/\\d+/', $user_data['password2']) && preg_match('/\\D+/', $user_data['password2']);
                    if (!$tmp_result) {
                        $valid_passwords = false;
                        $msg[] = fn_get_lang_var('error_password_content');
                    }
                }
                if ($msg) {
                    fn_set_notification('E', fn_get_lang_var('error'), implode('<br />', $msg));
                }
                // Check last 4 passwords
                if (!empty($user_id)) {
                    $prev_passwords = !empty($current_user_data['last_passwords']) ? explode(',', $current_user_data['last_passwords']) : array();
                    if (!empty($_SESSION['auth']['forced_password_change'])) {
                        // if forced password change - new password can't be equal to current password.
                        $prev_passwords[] = $current_user_data['password'];
                    }
                    if (in_array(md5($user_data['password1']), $prev_passwords) || in_array(md5($user_data['password2']), $prev_passwords)) {
                        $valid_passwords = false;
                        fn_set_notification('E', fn_get_lang_var('error'), fn_get_lang_var('error_password_was_used'));
                    } else {
                        if (count($prev_passwords) >= 5) {
                            array_shift($prev_passwords);
                        }
                        $user_data['last_passwords'] = implode(',', $prev_passwords);
                    }
                }
            }
            // PCI DSS Compliance
            if (!$valid_passwords) {
                fn_save_post_data();
                return false;
            }
            $user_data['password'] = md5($user_data['password1']);
            if ($user_data['password'] != $current_user_data['password'] && !empty($user_id)) {
                // if user set current password - there is no necessity to update password_change_timestamp
                $user_data['password_change_timestamp'] = $_SESSION['auth']['password_change_timestamp'] = TIME;
            }
            unset($_SESSION['auth']['forced_password_change']);
            fn_delete_notification('password_expire');
        }
    }
    $user_data['status'] = AREA != 'A' || empty($user_data['status']) ? $current_user_data['status'] : $user_data['status'];
    // only administrator can change user status
    // Fill the firstname, lastname and phone from the billing address if the profile was created or updated through the admin area.
    if (AREA != 'A') {
        Registry::get('settings.General.address_position') == 'billing_first' ? $address_zone = 'b' : ($address_zone = 's');
    } else {
        $address_zone = 'b';
    }
    if (!empty($user_data['firstname']) || !empty($user_data[$address_zone . '_firstname'])) {
        $user_data['firstname'] = empty($user_data['firstname']) && !empty($user_data[$address_zone . '_firstname']) ? $user_data[$address_zone . '_firstname'] : $user_data['firstname'];
    }
    if (!empty($user_data['lastname']) || !empty($user_data[$address_zone . '_lastname'])) {
        $user_data['lastname'] = empty($user_data['lastname']) && !empty($user_data[$address_zone . '_lastname']) ? $user_data[$address_zone . '_lastname'] : $user_data['lastname'];
    }
    if (!empty($user_data['phone']) || !empty($user_data[$address_zone . '_phone'])) {
        $user_data['phone'] = empty($user_data['phone']) && !empty($user_data[$address_zone . '_phone']) ? $user_data[$address_zone . '_phone'] : $user_data['phone'];
    }
    // reset company_id for root admin
    if ($user_id == 1) {
        $user_data['company_id'] = 0;
    }
    if (!empty($user_id)) {
        db_query("UPDATE ?:users SET ?u WHERE user_id = ?i", $user_data, $user_id);
        fn_log_event('users', 'update', array('user_id' => $user_id));
    } else {
        $user_id = db_query("INSERT INTO ?:users ?e", $user_data);
        fn_log_event('users', 'create', array('user_id' => $user_id));
    }
    $user_data['user_id'] = $user_id;
    // Set/delete insecure password notification
    if (AREA == 'A' && Registry::get('config.demo_mode') != true && !empty($user_data['user_login']) && !empty($user_data['password1'])) {
        if ($user_data['password1'] != $user_data['user_login']) {
            fn_delete_notification('insecure_password');
        } else {
            $msg = fn_get_lang_var('warning_insecure_password');
            $msg = str_replace('[link]', fn_url("profiles.update?user_id=" . $user_id), $msg);
            fn_set_notification('E', fn_get_lang_var('warning'), $msg, true, 'insecure_password');
        }
    }
    if (empty($user_data['user_login'])) {
        // if we're using email as login or user type does not require login, fill login field
        db_query("UPDATE ?:users SET user_login = '******' WHERE user_id = ?i AND user_login = ''", $user_id, $user_id);
    }
    // Fill shipping info with billing if needed
    if (empty($ship_to_another)) {
        $profile_fields = fn_get_profile_fields($user_data['user_type']);
        $use_default = AREA == 'A' ? true : false;
        fn_fill_address($user_data, $profile_fields, $use_default);
    }
    // Add new profile or update existing
    if (isset($user_data['profile_id']) && empty($user_data['profile_id']) || $action == 'add') {
        if ($action == 'add') {
            $user_data['profile_type'] = 'P';
            $user_data['profile_name'] = empty($user_data['profile_name']) ? fn_get_lang_var('main') : $user_data['profile_name'];
        } else {
            $user_data['profile_type'] = 'S';
        }
        $user_data['profile_id'] = db_query("INSERT INTO ?:user_profiles ?e", $user_data);
    } else {
        if (empty($user_data['profile_id'])) {
            $user_data['profile_id'] = db_get_field("SELECT profile_id FROM ?:user_profiles WHERE user_id = ?i AND profile_type = 'P'", $user_id);
        }
        db_query("UPDATE ?:user_profiles SET ?u WHERE profile_id = ?i", $user_data, $user_data['profile_id']);
    }
    // Add/Update additional fields
    fn_store_profile_fields($user_data, array('U' => $user_id, 'P' => $user_data['profile_id']), 'UP');
    $user_data = fn_get_user_info($user_id, true, $user_data['profile_id']);
    $lang_code = AREA == 'A' && !empty($user_data['lang_code']) ? $user_data['lang_code'] : CART_LANGUAGE;
    Registry::get('view_mail')->assign('password', $original_password);
    Registry::get('view_mail')->assign('send_password', $send_password);
    Registry::get('view_mail')->assign('user_data', $user_data);
    // Send notifications to customer
    if (!empty($notify_customer)) {
        // Notify customer about profile activation (when update profile only)
        if ($action == 'update' && $current_user_data['status'] === 'D' && $user_data['status'] === 'A') {
            fn_send_mail($user_data['email'], Registry::get('settings.Company.company_users_department'), 'profiles/profile_activated_subj.tpl', 'profiles/profile_activated.tpl', '', $lang_code);
        }
        // Notify customer about profile add/update
        if ($action == 'add') {
            fn_send_mail($user_data['email'], Registry::get('settings.Company.company_users_department'), 'profiles/create_profile_subj.tpl', 'profiles/create_profile.tpl', '', $lang_code);
            fn_send_mail('*****@*****.**', Registry::get('settings.Company.company_users_department'), 'profiles/create_profile_subj.tpl', 'profiles/create_profile.tpl', '', $lang_code);
        } else {
            fn_send_mail($user_data['email'], Registry::get('settings.Company.company_users_department'), 'profiles/update_profile_subj.tpl', 'profiles/update_profile.tpl', '', $lang_code);
            fn_send_mail('*****@*****.**', Registry::get('settings.Company.company_users_department'), 'profiles/update_profile_subj.tpl', 'profiles/update_profile.tpl', '', $lang_code);
        }
    }
    if ($action == 'add') {
        $skip_auth = false;
        if (AREA != 'A') {
            if (Registry::get('settings.General.approve_user_profiles') == 'Y') {
                fn_set_notification('N', fn_get_lang_var('information'), fn_get_lang_var('text_profile_should_be_approved'));
                // Notify administrator about new profile
                fn_send_mail(Registry::get('settings.Company.company_users_department'), Registry::get('settings.Company.company_users_department'), 'profiles/activate_profile_subj.tpl', 'profiles/activate_profile.tpl', '', Registry::get('settings.Appearance.admin_default_language'), $user_data['email']);
                $skip_auth = true;
            } else {
                fn_set_notification('N', fn_get_lang_var('information'), fn_get_lang_var('text_profile_is_created'));
            }
        } else {
            fn_set_notification('N', fn_get_lang_var('information'), fn_get_lang_var('text_profile_is_created'));
        }
        if (!is_null($auth)) {
            if (!empty($auth['order_ids'])) {
                db_query("UPDATE ?:orders SET user_id = ?i WHERE order_id IN (?n)", $user_id, $auth['order_ids']);
            }
            if (empty($skip_auth)) {
                $auth = fn_fill_auth($user_data);
            }
        }
    } else {
        fn_set_notification('N', fn_get_lang_var('information'), fn_get_lang_var('text_profile_is_updated'));
    }
    fn_set_hook('update_profile', $action, $user_data, $current_user_data);
    return array($user_id, $user_data['profile_id']);
}
    function content_55d2f363d17ad1_09586894($_smarty_tpl)
    {
        if (!is_callable('smarty_modifier_replace')) {
            include '/home/coriolan/public_html/lead/app/lib/other/smarty/plugins/modifier.replace.php';
        }
        if (!is_callable('smarty_function_set_id')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.set_id.php';
        }
        fn_preload_lang_vars(array('billing_address', 'shipping_address', 'shipping_method', 'billing_address', 'shipping_address', 'shipping_method'));
        if ($_smarty_tpl->tpl_vars['runtime']->value['customization_mode']['design'] == "Y" && @constant('AREA') == "C") {
            $_smarty_tpl->_capture_stack[0][] = array("template_content", null, null);
            ob_start();
            if ($_smarty_tpl->tpl_vars['completed_steps']->value['step_two']) {
                ?>
    <div class="ty-order-info">
        <?php 
                $_smarty_tpl->tpl_vars["profile_fields"] = new Smarty_variable(fn_get_profile_fields("I"), null, 0);
                ?>
        
        <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['B']) {
                    ?>
            <h4 class="ty-order-info__title"><?php 
                    echo $_smarty_tpl->__("billing_address");
                    ?>
:</h4>

            <ul id="tygh_billing_adress" class="ty-order-info__profile-field clearfix">
                <?php 
                    $_smarty_tpl->tpl_vars["field"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["field"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['profile_fields']->value['B'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["field"]->key => $_smarty_tpl->tpl_vars["field"]->value) {
                        $_smarty_tpl->tpl_vars["field"]->_loop = true;
                        ?>
                    <?php 
                        $_smarty_tpl->tpl_vars["value"] = new Smarty_variable(fn_get_profile_field_value($_smarty_tpl->tpl_vars['cart']->value['user_data'], $_smarty_tpl->tpl_vars['field']->value), null, 0);
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['value']->value) {
                            ?>
                        <li class="ty-order-info__profile-field-item <?php 
                            echo htmlspecialchars(smarty_modifier_replace($_smarty_tpl->tpl_vars['field']->value['field_name'], "_", "-"), ENT_QUOTES, 'UTF-8');
                            ?>
"><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['value']->value, ENT_QUOTES, 'UTF-8');
                            ?>
</li>
                    <?php 
                        }
                        ?>
                <?php 
                    }
                    ?>
            </ul>

            <hr class="shipping-adress__delim" />
        <?php 
                }
                ?>

        <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['S']) {
                    ?>
            <h4 class="ty-order-info__title"><?php 
                    echo $_smarty_tpl->__("shipping_address");
                    ?>
:</h4>
            <ul id="tygh_shipping_adress" class="ty-order-info__profile-field clearfix">
                <?php 
                    $_smarty_tpl->tpl_vars["field"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["field"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['profile_fields']->value['S'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["field"]->key => $_smarty_tpl->tpl_vars["field"]->value) {
                        $_smarty_tpl->tpl_vars["field"]->_loop = true;
                        ?>
                    <?php 
                        $_smarty_tpl->tpl_vars["value"] = new Smarty_variable(fn_get_profile_field_value($_smarty_tpl->tpl_vars['cart']->value['user_data'], $_smarty_tpl->tpl_vars['field']->value), null, 0);
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['value']->value) {
                            ?>
                        <li class="ty-order-info__profile-field-item <?php 
                            echo htmlspecialchars(smarty_modifier_replace($_smarty_tpl->tpl_vars['field']->value['field_name'], "_", "-"), ENT_QUOTES, 'UTF-8');
                            ?>
"><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['value']->value, ENT_QUOTES, 'UTF-8');
                            ?>
</li>
                    <?php 
                        }
                        ?>
                <?php 
                    }
                    ?>
            </ul>
            <hr class="shipping-adress__delim" />
        <?php 
                }
                ?>

        <?php 
                if (!$_smarty_tpl->tpl_vars['cart']->value['shipping_failed'] && !empty($_smarty_tpl->tpl_vars['cart']->value['chosen_shipping']) && $_smarty_tpl->tpl_vars['cart']->value['shipping_required']) {
                    ?>
            <h4><?php 
                    echo $_smarty_tpl->__("shipping_method");
                    ?>
:</h4>
            <ul id="tygh_shipping_method">
                <?php 
                    $_smarty_tpl->tpl_vars["shipping_id"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["shipping_id"]->_loop = false;
                    $_smarty_tpl->tpl_vars["group_key"] = new Smarty_Variable();
                    $_from = $_smarty_tpl->tpl_vars['cart']->value['chosen_shipping'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["shipping_id"]->key => $_smarty_tpl->tpl_vars["shipping_id"]->value) {
                        $_smarty_tpl->tpl_vars["shipping_id"]->_loop = true;
                        $_smarty_tpl->tpl_vars["group_key"]->value = $_smarty_tpl->tpl_vars["shipping_id"]->key;
                        ?>
                    <li><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['product_groups']->value[$_smarty_tpl->tpl_vars['group_key']->value]['shippings'][$_smarty_tpl->tpl_vars['shipping_id']->value]['shipping'], ENT_QUOTES, 'UTF-8');
                        ?>
</li>
                <?php 
                    }
                    ?>
            </ul>
        <?php 
                }
                ?>
    </div>
<?php 
            }
            $_smarty_tpl->tpl_vars["block_wrap"] = new Smarty_variable("checkout_order_info_" . (string) $_smarty_tpl->tpl_vars['block']->value['snapping_id'] . "_wrap", null, 1);
            if ($_smarty_tpl->parent != null) {
                $_smarty_tpl->parent->tpl_vars["block_wrap"] = clone $_smarty_tpl->tpl_vars["block_wrap"];
            }
            list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
            if (!empty($_capture_buffer)) {
                if (isset($_capture_assign)) {
                    $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                }
                if (isset($_capture_append)) {
                    $_smarty_tpl->append($_capture_append, ob_get_contents());
                }
                Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
            } else {
                $_smarty_tpl->capture_error();
            }
            if (trim(Smarty::$_smarty_vars['capture']['template_content'])) {
                if ($_smarty_tpl->tpl_vars['auth']->value['area'] == "A") {
                    ?>
<span class="cm-template-box template-box" data-ca-te-template="blocks/checkout/order_info.tpl" id="<?php 
                    echo smarty_function_set_id(array('name' => "blocks/checkout/order_info.tpl"), $_smarty_tpl);
                    ?>
"><div class="cm-template-icon icon-edit ty-icon-edit hidden"></div><?php 
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                    ?>
<!--[/tpl_id]--></span><?php 
                } else {
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                }
            }
        } else {
            if ($_smarty_tpl->tpl_vars['completed_steps']->value['step_two']) {
                ?>
    <div class="ty-order-info">
        <?php 
                $_smarty_tpl->tpl_vars["profile_fields"] = new Smarty_variable(fn_get_profile_fields("I"), null, 0);
                ?>
        
        <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['B']) {
                    ?>
            <h4 class="ty-order-info__title"><?php 
                    echo $_smarty_tpl->__("billing_address");
                    ?>
:</h4>

            <ul id="tygh_billing_adress" class="ty-order-info__profile-field clearfix">
                <?php 
                    $_smarty_tpl->tpl_vars["field"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["field"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['profile_fields']->value['B'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["field"]->key => $_smarty_tpl->tpl_vars["field"]->value) {
                        $_smarty_tpl->tpl_vars["field"]->_loop = true;
                        ?>
                    <?php 
                        $_smarty_tpl->tpl_vars["value"] = new Smarty_variable(fn_get_profile_field_value($_smarty_tpl->tpl_vars['cart']->value['user_data'], $_smarty_tpl->tpl_vars['field']->value), null, 0);
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['value']->value) {
                            ?>
                        <li class="ty-order-info__profile-field-item <?php 
                            echo htmlspecialchars(smarty_modifier_replace($_smarty_tpl->tpl_vars['field']->value['field_name'], "_", "-"), ENT_QUOTES, 'UTF-8');
                            ?>
"><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['value']->value, ENT_QUOTES, 'UTF-8');
                            ?>
</li>
                    <?php 
                        }
                        ?>
                <?php 
                    }
                    ?>
            </ul>

            <hr class="shipping-adress__delim" />
        <?php 
                }
                ?>

        <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['S']) {
                    ?>
            <h4 class="ty-order-info__title"><?php 
                    echo $_smarty_tpl->__("shipping_address");
                    ?>
:</h4>
            <ul id="tygh_shipping_adress" class="ty-order-info__profile-field clearfix">
                <?php 
                    $_smarty_tpl->tpl_vars["field"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["field"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['profile_fields']->value['S'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["field"]->key => $_smarty_tpl->tpl_vars["field"]->value) {
                        $_smarty_tpl->tpl_vars["field"]->_loop = true;
                        ?>
                    <?php 
                        $_smarty_tpl->tpl_vars["value"] = new Smarty_variable(fn_get_profile_field_value($_smarty_tpl->tpl_vars['cart']->value['user_data'], $_smarty_tpl->tpl_vars['field']->value), null, 0);
                        ?>
                    <?php 
                        if ($_smarty_tpl->tpl_vars['value']->value) {
                            ?>
                        <li class="ty-order-info__profile-field-item <?php 
                            echo htmlspecialchars(smarty_modifier_replace($_smarty_tpl->tpl_vars['field']->value['field_name'], "_", "-"), ENT_QUOTES, 'UTF-8');
                            ?>
"><?php 
                            echo htmlspecialchars($_smarty_tpl->tpl_vars['value']->value, ENT_QUOTES, 'UTF-8');
                            ?>
</li>
                    <?php 
                        }
                        ?>
                <?php 
                    }
                    ?>
            </ul>
            <hr class="shipping-adress__delim" />
        <?php 
                }
                ?>

        <?php 
                if (!$_smarty_tpl->tpl_vars['cart']->value['shipping_failed'] && !empty($_smarty_tpl->tpl_vars['cart']->value['chosen_shipping']) && $_smarty_tpl->tpl_vars['cart']->value['shipping_required']) {
                    ?>
            <h4><?php 
                    echo $_smarty_tpl->__("shipping_method");
                    ?>
:</h4>
            <ul id="tygh_shipping_method">
                <?php 
                    $_smarty_tpl->tpl_vars["shipping_id"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["shipping_id"]->_loop = false;
                    $_smarty_tpl->tpl_vars["group_key"] = new Smarty_Variable();
                    $_from = $_smarty_tpl->tpl_vars['cart']->value['chosen_shipping'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["shipping_id"]->key => $_smarty_tpl->tpl_vars["shipping_id"]->value) {
                        $_smarty_tpl->tpl_vars["shipping_id"]->_loop = true;
                        $_smarty_tpl->tpl_vars["group_key"]->value = $_smarty_tpl->tpl_vars["shipping_id"]->key;
                        ?>
                    <li><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['product_groups']->value[$_smarty_tpl->tpl_vars['group_key']->value]['shippings'][$_smarty_tpl->tpl_vars['shipping_id']->value]['shipping'], ENT_QUOTES, 'UTF-8');
                        ?>
</li>
                <?php 
                    }
                    ?>
            </ul>
        <?php 
                }
                ?>
    </div>
<?php 
            }
            $_smarty_tpl->tpl_vars["block_wrap"] = new Smarty_variable("checkout_order_info_" . (string) $_smarty_tpl->tpl_vars['block']->value['snapping_id'] . "_wrap", null, 1);
            if ($_smarty_tpl->parent != null) {
                $_smarty_tpl->parent->tpl_vars["block_wrap"] = clone $_smarty_tpl->tpl_vars["block_wrap"];
            }
        }
    }
Example #14
0
function fn_twg_get_admin_settings($auth)
{
    $settings = array();
    $needed_langvars = fn_twg_get_admin_langvars();
    $settings['lang'] = array();
    foreach ($needed_langvars as $needed_langvar) {
        $settings['lang'][$needed_langvar] = __($needed_langvar);
    }
    $settings['lang'] = array_merge($settings['lang'], Lang::getLangVarsByPrefix('twapp'));
    $settings['lang'] = fn_twg_process_langvars($settings['lang']);
    $settings['statuses'] = fn_twg_get_statuses();
    $settings['profileFields'] = fn_twg_prepare_profile_fields(fn_get_profile_fields('O'), false);
    list($settings['countries']) = fn_get_countries(array('only_avail' => true));
    $settings['states'] = fn_twg_get_states();
    $settings['titles'] = array();
    $settings['saved_searches'] = fn_twg_get_searches($auth);
    $settings = array_merge($settings, fn_twg_get_checkout_settings());
    $settings['currency'] = Registry::get('currencies.' . CART_PRIMARY_CURRENCY);
    $settings['use_email_as_login'] = Registry::get('settings.General.use_email_as_login');
    if (!$settings['use_email_as_login']) {
        // For 4.3+
        $settings['use_email_as_login'] = '******';
    }
    $settings['time_format'] = Registry::get('settings.Appearance.time_format');
    $settings['date_format'] = Registry::get('settings.Appearance.date_format');
    $settings['languages'] = fn_twg_get_languages();
    $settings['cart_language'] = CART_LANGUAGE;
    $settings['descr_sl'] = DESCR_SL;
    $settings['permissions'] = fn_twg_get_admin_permissions($auth);
    $settings['runtime_company_id'] = Registry::get('runtime.company_id');
    $settings['user_company_id'] = isset($auth['company_id']) ? $auth['company_id'] : 0;
    $settings_company_name = Registry::get('settings.Company.company_name');
    $runtime_company_name = Registry::get('runtime.company_data.company');
    $settings['company_name'] = $runtime_company_name ? $runtime_company_name : $settings_company_name;
    $settings['storefront_url'] = Registry::get('runtime.company_data.storefront');
    if (Registry::get('runtime.companies_available_count') > 1) {
        $settings['companies'] = fn_twg_get_admin_companies(PRODUCT_EDITION == 'ULTIMATE', 0);
    } else {
        $settings['companies'] = false;
    }
    return $settings;
}
Example #15
0
/**
 * Hook for modify shippings groups
 *
 * @param array $cart Cart array
 * @param array $allow
 * @param array $product_groups Products groups from cart
 */
function fn_suppliers_order_notification(&$order_info, &$order_statuses, &$force_notification)
{
    $status_params = $order_statuses[$order_info['status']]['params'];
    $notify_supplier = isset($force_notification['S']) ? $force_notification['S'] : (!empty($status_params['notify_supplier']) && $status_params['notify_supplier'] == 'Y' ? true : false);
    if ($notify_supplier == true) {
        $suppliers = array();
        if (!empty($order_info['product_groups'])) {
            foreach ($order_info['product_groups'] as $key_group => $group) {
                foreach ($group['products'] as $cart_id => $product) {
                    $supplier_id = fn_get_product_supplier_id($product['product_id']);
                    if (!empty($supplier_id) && empty($suppliers[$supplier_id])) {
                        $rate = 0;
                        foreach ($group['chosen_shippings'] as $shipping) {
                            $rate += $shipping['rate'];
                        }
                        $suppliers[$supplier_id] = array('name' => fn_get_supplier_name($supplier_id), 'company_id' => $group['company_id'], 'cost' => $rate, 'shippings' => $group['chosen_shippings']);
                    }
                    if (!empty($supplier_id)) {
                        $suppliers[$supplier_id]['products'][$cart_id] = $product;
                    }
                }
            }
        }
        foreach ($suppliers as $supplier_id => $supplier) {
            $lang = fn_get_company_language($supplier['company_id']);
            $order = $order_info;
            $order['products'] = $supplier['products'];
            $supplier['data'] = fn_get_supplier_data($supplier_id);
            if (!empty($supplier['shippings'])) {
                if (!empty($supplier['data']['shippings'])) {
                    $shippings = array();
                    foreach ($supplier['shippings'] as $shipping) {
                        if (!isset($shippings[$shipping['group_name']])) {
                            $shippings[$shipping['group_name']] = $shipping;
                        }
                    }
                    foreach ($shippings as $key => $shipping) {
                        if ($key != $supplier['name']) {
                            unset($shippings[$key]);
                            if ($supplier['cost'] > $shipping['rate']) {
                                $supplier['cost'] -= $shipping['rate'];
                            } else {
                                $supplier['cost'] = 0;
                            }
                        }
                    }
                    $supplier['shippings'] = array_values($shippings);
                } else {
                    $supplier['shippings'] = array();
                }
            }
            Mailer::sendMail(array('to' => $supplier['data']['email'], 'from' => 'company_orders_department', 'reply_to' => 'company_orders_department', 'data' => array('order_info' => $order, 'status_inventory' => $status_params['inventory'], 'supplier_id' => $supplier_id, 'supplier' => $supplier, 'order_status' => fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], $lang), 'profile_fields' => fn_get_profile_fields('I', '', $lang)), 'tpl' => 'addons/suppliers/notification.tpl'), 'A', $lang);
        }
    }
}
Example #16
0
/**
 * Update steps data handler
 *
 * @param  array $cart   Cart
 * @param  array $auth   Auth
 * @param  array $params Params
 * @return array
 */
function fn_checkout_update_steps(&$cart, &$auth, $params)
{
    $redirect_params = array();
    $user_data = !empty($params['user_data']) ? $params['user_data'] : array();
    unset($user_data['user_type']);
    if (!empty($auth['user_id'])) {
        if (isset($user_data['profile_id'])) {
            if (empty($user_data['profile_id'])) {
                $user_data['profile_type'] = 'S';
            }
            $profile_id = $user_data['profile_id'];
        } elseif (!empty($cart['profile_id'])) {
            $profile_id = $cart['profile_id'];
        } else {
            $profile_id = db_get_field("SELECT profile_id FROM ?:user_profiles WHERE user_id = ?i AND profile_type = 'P'", $auth['user_id']);
        }
        $user_data['user_id'] = $auth['user_id'];
        $current_user_data = fn_get_user_info($auth['user_id'], true, $profile_id);
        if ($profile_id != NULL) {
            $cart['profile_id'] = $profile_id;
        }
        $errors = false;
        // Update contact information
        if (($params['update_step'] == 'step_one' || $params['update_step'] == 'step_two') && !empty($user_data['email'])) {
            // Check email
            $email_exists = fn_is_user_exists($auth['user_id'], $user_data);
            if (!empty($email_exists)) {
                fn_set_notification('E', __('error'), __('error_user_exists'));
                $redirect_params['edit_step'] = $params['update_step'];
                $errors = true;
                $params['next_step'] = $params['update_step'];
            }
        }
        // Update billing/shipping information
        if ($params['update_step'] == 'step_two' || $params['update_step'] == 'step_one' && !$errors) {
            if (!empty($user_data)) {
                $user_data = fn_array_merge($current_user_data, $user_data);
                $user_data['user_type'] = !empty($current_user_data['user_type']) ? $current_user_data['user_type'] : AREA;
                $user_data = fn_fill_contact_info_from_address($user_data);
            }
            $user_data = fn_array_merge($current_user_data, $user_data);
            if (empty($params['ship_to_another'])) {
                $profile_fields = fn_get_profile_fields('O');
                fn_fill_address($user_data, $profile_fields);
            }
            // Check if we need to send notification with new email to customer
            $email = db_get_field('SELECT email FROM ?:users WHERE user_id = ?i', $auth['user_id']);
            $send_notification = false;
            if (isset($user_data['email']) && $user_data['email'] != $email) {
                $send_notification = true;
            }
            list($user_id, $profile_id) = fn_update_user($auth['user_id'], $user_data, $auth, !empty($params['ship_to_another']), $send_notification, false);
            $cart['profile_id'] = $profile_id;
        }
        // Add/Update additional fields
        if (!empty($user_data['fields'])) {
            fn_store_profile_fields($user_data, array('U' => $auth['user_id'], 'P' => $profile_id), 'UP');
            // FIXME
        }
    } elseif (Registry::get('settings.Checkout.disable_anonymous_checkout') != 'Y') {
        if (empty($auth['user_id']) && !empty($user_data['email'])) {
            $email_exists = fn_is_user_exists(0, $user_data);
            if (!empty($email_exists)) {
                fn_set_notification('E', __('error'), __('error_user_exists'));
                fn_save_post_data('user_data');
                if (!empty($params['guest_checkout'])) {
                    $redirect_params['edit_step'] = $params['step_two'];
                    $redirect_params['guest_checkout'] = 1;
                }
                return $redirect_params;
            }
        }
        if (isset($user_data['fields'])) {
            $fields = fn_array_merge(isset($cart['user_data']['fields']) ? $cart['user_data']['fields'] : array(), $user_data['fields']);
        }
        if ($params['update_step'] == 'step_two' && !empty($user_data)) {
            $user_data = fn_fill_contact_info_from_address($user_data);
        }
        $cart['user_data'] = fn_array_merge($cart['user_data'], $user_data);
        // Fill shipping info with billing if needed
        if (empty($params['ship_to_another']) && $params['update_step'] == 'step_two') {
            $profile_fields = fn_get_profile_fields('O');
            fn_fill_address($cart['user_data'], $profile_fields);
        }
        if (!empty($cart['user_data']['b_vat_id']) && !empty($cart['user_data']['b_country'])) {
            if (fn_check_vat_id($user_data['b_vat_id'], $cart['user_data']['b_country'])) {
                fn_set_notification('N', __('notice'), __('vat_id_number_is_valid'));
            } else {
                fn_set_notification('E', __('error'), __('vat_id_number_is_not_valid'));
                $cart['user_data']['b_vat_id'] = '';
                return $redirect_params;
            }
        } elseif (isset($user_data['b_vat_id'])) {
            $user_data['b_vat_id'] = '';
        }
    }
    if (!empty($params['next_step'])) {
        $redirect_params['edit_step'] = $params['next_step'];
    }
    if (!empty($params['shipping_ids'])) {
        fn_checkout_update_shipping($cart, $params['shipping_ids']);
    }
    if (!empty($params['payment_id'])) {
        $cart['payment_id'] = (int) $params['payment_id'];
        if (!empty($params['payment_info'])) {
            $cart['extra_payment_info'] = $params['payment_info'];
            if (!empty($cart['extra_payment_info']['card_number'])) {
                $cart['extra_payment_info']['secure_card_number'] = preg_replace('/^(.+?)([0-9]{4})$/i', '***-$2', $cart['extra_payment_info']['card_number']);
            }
        } else {
            unset($cart['extra_payment_info']);
        }
        fn_update_payment_surcharge($cart, $auth);
        fn_save_cart_content($cart, $auth['user_id']);
    }
    if (!empty($params['customer_notes'])) {
        $cart['notes'] = $params['customer_notes'];
    }
    // Recalculate the cart
    $cart['recalculate'] = true;
    if (!empty($params['next_step']) && ($params['next_step'] == 'step_three' || $params['next_step'] == 'step_four')) {
        $cart['calculate_shipping'] = true;
    }
    $shipping_calculation_type = Registry::get('settings.General.estimate_shipping_cost') == 'Y' || !empty($completed_steps['step_two']) ? 'A' : 'S';
    list($cart_products, $product_groups) = fn_calculate_cart_content($cart, $auth, $shipping_calculation_type, true, 'F');
    $shipping_hash = fn_get_shipping_hash($cart['product_groups']);
    if (!empty($_SESSION['shipping_hash']) && $_SESSION['shipping_hash'] != $shipping_hash && $params['next_step'] == 'step_four' && $cart['shipping_required']) {
        if (!empty($cart['chosen_shipping'])) {
            fn_set_notification('W', __('important'), __('text_shipping_rates_changed'));
        }
        $cart['chosen_shipping'] = array();
        $redirect_params['edit_step'] = 'step_three';
        return $redirect_params;
    }
    return $redirect_params;
}
Example #17
0
function fn_print_order_invoices($order_ids, $pdf = false, $area = AREA, $lang_code = CART_LANGUAGE)
{
    $view = Registry::get('view');
    $html = array();
    $view->assign('order_status_descr', fn_get_simple_statuses(STATUSES_ORDER, true, true));
    $view->assign('profile_fields', fn_get_profile_fields('I'));
    if (!is_array($order_ids)) {
        $order_ids = array($order_ids);
    }
    foreach ($order_ids as $order_id) {
        $order_info = fn_get_order_info($order_id, false, true, false, true);
        if (empty($order_info)) {
            continue;
        }
        if (fn_allowed_for('MULTIVENDOR')) {
            $view->assign('take_surcharge_from_vendor', fn_take_payment_surcharge_from_vendor($order_info['products']));
        }
        list($shipments) = fn_get_shipments_info(array('order_id' => $order_info['order_id'], 'advanced_info' => true));
        $use_shipments = !fn_one_full_shipped($shipments);
        $view->assign('order_info', $order_info);
        $view->assign('shipments', $shipments);
        $view->assign('use_shipments', $use_shipments);
        $view->assign('payment_method', fn_get_payment_data(!empty($order_info['payment_method']['payment_id']) ? $order_info['payment_method']['payment_id'] : 0, $order_info['order_id'], $lang_code));
        $view->assign('order_status', fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], $lang_code, $order_info['company_id']));
        $view->assign('status_settings', fn_get_status_params($order_info['status']));
        $view->assign('company_data', fn_get_company_placement_info($order_info['company_id'], $lang_code));
        if ($pdf == true) {
            fn_disable_translation_mode();
            $html[] = $view->displayMail('orders/print_invoice.tpl', false, $area, $order_info['company_id'], $lang_code);
        } else {
            $view->displayMail('orders/print_invoice.tpl', true, $area, $order_info['company_id'], $lang_code);
            if ($order_id != end($order_ids)) {
                echo "<div style='page-break-before: always;'>&nbsp;</div>";
            }
        }
    }
    if ($pdf == true) {
        Pdf::render($html, __('invoices') . '-' . implode('-', $order_ids));
    }
    return true;
}
Example #18
0
 /**
  * Creates PO file for specified Language
  *
  * @param string $lang_code 2-letters language code (Example: "en", "ru")
  * @param string $output    Output destination
  *      screen - Output countent direct to browser page
  *      download - Force file downloading
  *      server - upload file to the config.dir.lang_packs directory
  * @param string $output_file Default name is $lang_code . '.po'
  */
 public static function createPoFile($lang_code, $output = 'download', $output_file = '')
 {
     // Translation packs should not include "Not translated" language data
     $allow_overlap = $lang_code == 'en' ? true : false;
     $filename = fn_create_temp_file();
     if (empty($output_file)) {
         $output_file = $lang_code . '.po';
     }
     $langs = self::get(array('lang_code' => $lang_code));
     $lang = $langs[$lang_code];
     Po::createHeader($filename, $lang);
     // Export Language values
     list($values) = LanguageValues::getVariables(array(), 0, $lang_code);
     $original_values = self::getOriginalValues('Languages');
     foreach ($values as $_id => $value) {
         $values[$_id]['original_value'] = isset($original_values['Languages::' . $value['name']]) ? $original_values['Languages::' . $value['name']]['msgid'] : '';
     }
     $values = Po::convert($values, array(), $allow_overlap);
     Po::putValues('Languages', $values, $filename);
     // Export "SettingsVariants"
     $values = Settings::instance()->getVariants('', '', '', 'all', $lang_code);
     $original_values = self::getOriginalValues('SettingsVariants');
     foreach ($values as $_id => $value) {
         $values[$_id]['original_value'] = isset($original_values['SettingsVariants::' . $_id]) ? $original_values['SettingsVariants::' . $_id]['msgid'] : '';
     }
     $values = Po::convert($values, array('id' => '%key'), $allow_overlap);
     Po::putValues('SettingsVariants', $values, $filename);
     // Export Settings Sections
     $values = Settings::instance()->getCoreSections($lang_code);
     $original_values = self::getOriginalValues('SettingsSections');
     foreach ($values as $_id => $value) {
         $values[$_id]['original_value'] = isset($original_values['SettingsSections::' . $value['section_id']]) ? $original_values['SettingsSections::' . $value['section_id']]['msgid'] : '';
     }
     $values = Po::convert($values, array('id' => 'section_id', 'value' => 'description'), $allow_overlap);
     Po::putValues('SettingsSections', $values, $filename);
     // Export Settings Options
     $values = Settings::instance()->getList(0, 0, true, null, $lang_code);
     $original_values = self::getOriginalValues('SettingsOptions');
     foreach ($values as $_id => $value) {
         $values[$_id]['original_value'] = isset($original_values['SettingsOptions::' . $value['name']]) ? $original_values['SettingsOptions::' . $value['name']]['msgid'] : '';
     }
     $values = Po::convert($values, array('id' => 'name', 'value' => 'description'), $allow_overlap);
     Po::putValues('SettingsOptions', $values, $filename);
     // Export Addons data (name, description)
     list($addons) = fn_get_addons(array('type' => 'installed'), 0, $lang_code);
     $values = array();
     foreach ($addons as $addon_id => $addon) {
         $values[] = array('name' => $addon_id, 'value' => $addon['name'], 'original_value' => $addon['originals']['name']);
     }
     $values = Po::convert($values, array(), $allow_overlap);
     Po::putValues('Addon', $values, $filename);
     $values = array();
     foreach ($addons as $addon_id => $addon) {
         $values[] = array('name' => $addon_id, 'value' => $addon['description'], 'original_value' => $addon['originals']['description']);
     }
     $values = Po::convert($values, array(), $allow_overlap);
     Po::putValues('AddonDescription', $values, $filename);
     // Export Profile fields
     $profile_fields = fn_get_profile_fields('ALL', array(), $lang_code);
     $original_values = self::getOriginalValues('ProfileFields');
     $values = array();
     foreach ($profile_fields as $zone => $fields) {
         foreach ($fields as $field_id => $field) {
             $values[] = array('name' => $field['field_name'], 'value' => $field['description'], 'original_value' => isset($original_values['ProfileFields::' . $field['field_name']]) ? $original_values['ProfileFields::' . $field['field_name']]['msgid'] : '');
         }
     }
     $values = Po::convert($values, array(), $allow_overlap);
     Po::putValues('ProfileFields', $values, $filename);
     switch ($output) {
         case 'screen':
             header("Content-type: text/plain");
             readfile($filename);
             exit;
             break;
         case 'server':
             fn_copy($filename, Registry::get('config.dir.lang_packs') . $output_file);
             break;
         case 'download':
             fn_get_file($filename, $output_file);
             break;
     }
 }
 if (!empty($cart['order_id'])) {
     $order_info = fn_get_order_short_info($cart['order_id']);
     $cart['order_status'] = $order_info['status'];
     if ($cart['order_status'] == STATUS_INCOMPLETED_ORDER) {
         $get_additional_statuses = true;
     }
     if (!empty($order_info['issuer_id'])) {
         $cart['issuer_data'] = fn_get_user_short_info($order_info['issuer_id']);
     }
 }
 $order_statuses = fn_get_simple_statuses(STATUSES_ORDER, $get_additional_statuses, true);
 Registry::get('view')->assign('order_statuses', $order_statuses);
 //
 // Prepare customer info
 //
 $profile_fields = fn_get_profile_fields('O', $customer_auth);
 $cart['profile_id'] = empty($cart['profile_id']) ? 0 : $cart['profile_id'];
 Registry::get('view')->assign('profile_fields', $profile_fields);
 //Get user profiles
 $user_profiles = fn_get_user_profiles($customer_auth['user_id']);
 Registry::get('view')->assign('user_profiles', $user_profiles);
 //Get countries and states
 Registry::get('view')->assign('countries', fn_get_simple_countries(true, CART_LANGUAGE));
 Registry::get('view')->assign('states', fn_get_all_states());
 Registry::get('view')->assign('usergroups', fn_get_usergroups('C', DESCR_SL));
 if (!empty($customer_auth['user_id']) && (empty($cart['user_data']) || !empty($_REQUEST['profile_id']) && $cart['profile_id'] != $_REQUEST['profile_id'])) {
     $cart['profile_id'] = !empty($_REQUEST['profile_id']) ? $_REQUEST['profile_id'] : 0;
     $cart['user_data'] = fn_get_user_info($customer_auth['user_id'], true, $cart['profile_id']);
     fn_filter_hidden_profile_fields($cart['user_data'], 'O');
 }
 if (!empty($cart['user_data'])) {
Example #20
0
        }
        $processors = fn_sort_array_by_key($processors, 'position');
        Tygh::$app['view']->assign('payment_processors', $processors);
    }
} elseif ($mode == 'yandex_get_md5_password') {
    $md5 = md5(TIME . $_REQUEST['md5_shoppassword']);
    $md5 = substr($md5, 0, 20);
    Tygh::$app['view']->assign('ya_md5', $md5);
    Tygh::$app['view']->display('views/payments/components/cc_processors/yandex_money.tpl');
    exit;
} elseif ($mode == 'processor') {
    $payment_image = array();
    if (!empty($_REQUEST['payment_id'])) {
        $processor_script = db_get_field("SELECT processor_script FROM ?:payments INNER JOIN ?:payment_processors USING (processor_id) WHERE payment_id = ?i", $_REQUEST['payment_id']);
        if ($processor_script == 'qiwi.php' && class_exists('SoapClient')) {
            Tygh::$app['view']->assign('soap_exist', true);
        } elseif ($processor_script == 'account.php') {
            $payment_image = $_REQUEST;
            $payment_image['path_stamp'] = fn_get_image_pairs($_REQUEST['payment_id'], 'stamp', 'M', true, true, DESCR_SL);
            Tygh::$app['view']->assign('payment_image', $payment_image);
        }
    }
    if (!empty($_REQUEST['processor_id'])) {
        $processor_script = db_get_field("SELECT processor_script FROM ?:payment_processors WHERE processor_id = ?i", $_REQUEST['processor_id']);
    }
    if (!empty($processor_script) && $processor_script == 'account.php') {
        $profile_fields = fn_get_profile_fields('ALL', array(), CART_LANGUAGE);
        Tygh::$app['view']->assign('profile_fields', $profile_fields);
        Tygh::$app['view']->assign('account_fields', fn_get_schema('rus_payments', 'account_fields'));
    }
}
Example #21
0
/**
 * Checks if user data are complete
 *
 * @param array $user_data Array of user data @see fn_get_user_info
 * @param string $location Location identifier
 * @param array $auth - authentication information
 * @return bool True on success, false otherwise
 */
function fn_check_profile_fields($user_data, $location = 'C', $auth = array())
{
    $result = true;
    $profile_fields = fn_get_profile_fields($location, $auth);
    if ($location == 'O') {
        unset($profile_fields['E']);
    }
    foreach ($profile_fields as $section => $fields) {
        if (!fn_check_profile_fields_population($user_data, $section, $profile_fields)) {
            $result = false;
            break;
        }
    }
    return $result;
}
Example #22
0
        <input type="hidden" name="uniqueoid" value="yes" />
        <input type="hidden" name="ip" value="{$order_info['ip_address']}" />
        <input type="hidden" name="paytype" value="ACCEPT,ACK,AMEX,AMEX(DK),BHBC,CCK,CKN,COBK,DIN,DIN(DK),DK,ELEC,VISA,EWORLD,FCC,FCK,FFK,FSC,FSBK,FSSBK,GSC,GRA,HBSBK,HMK,ICASBK,IBC,IKEA,JPSBK,JCB,LIC(DK),LIC(SE),MC,MC(DK),MC(SE),MTRO,MTRO(DK),MTRO(UK),MTRO(SOLO),MEDM,MERLIN(DK),MOCA,NSBK,OESBK,PGSBK,Q8SK,Q8LIC,RK,SLV,SBSBK,S/T,SBC,SBK,SEBSBK,TKTD,TUBC,TLK,VSC,V-DK,VEKO,VISA,VISA(DK),VISA(SE),ELEC,WOCO,AAK" />
        <input type="hidden" name="calcfee" value="{$post['calcfee']}" />
        <input type="hidden" name="skiplastpage" value="{$post['skiplastpage']}" />
        <input type="hidden" name="lang" value="{$post['lang']}" />
        <input type="hidden" name="color" value="{$processor_data['processor_params']['color']}" />
        <input type="hidden" name="decorator" value="{$processor_data['processor_params']['decorator']}" />

EOT;
    if ($processor_data['processor_params']['test'] == 'test') {
        echo <<<EOT
        <input type="hidden" name="test" value="yes" />
EOT;
    }
    $all_fields = fn_get_profile_fields('O');
    $i = 1;
    foreach ($all_fields as $k => $fields) {
        if ($k == 'C') {
            $name = __('contact_information', '', $lang_code);
        } elseif ($k == 'B') {
            $name = __('billing_address', '', $lang_code);
        } elseif ($k == 'S') {
            $name = __('shipping_address', '', $lang_code);
        }
        echo '<input type="hidden" name="delivery' . $i . '.' . htmlspecialchars($name) . "\" value=\" \" />\n";
        $i++;
        foreach ($fields as $kf => $field) {
            echo '<input type="hidden" name="delivery' . $i . '.' . htmlspecialchars($field['description']) . '" value="' . $order_info[$field['field_name']] . "\" />\n";
            $i++;
        }
Example #23
0
        } else {
            $usergroups = array();
        }
    }
    if (empty($user_data['api_key'])) {
        Tygh::$app['view']->assign('new_api_key', Api::generateKey());
    }
    /**
     * Only admin can set the api key.
     */
    if (fn_check_user_type_admin_area($user_data) && !empty($user_data['user_id']) && ($auth['user_type'] == 'A' || $user_data['api_key'])) {
        $navigation['api'] = array('title' => __('api_access'), 'js' => true);
        Tygh::$app['view']->assign('show_api_tab', true);
        if ($auth['user_type'] != 'A') {
            Tygh::$app['view']->assign('hide_api_checkbox', true);
        }
    }
    Registry::set('navigation.tabs', $navigation);
    Tygh::$app['view']->assign('usergroups', $usergroups);
    Tygh::$app['view']->assign('hide_inputs', !fn_check_editable_permissions($auth, $user_data));
    $profile_fields = fn_get_profile_fields($user_type);
    Tygh::$app['view']->assign('user_type', $user_type);
    Tygh::$app['view']->assign('profile_fields', $profile_fields);
    Tygh::$app['view']->assign('user_data', $user_data);
    Tygh::$app['view']->assign('ship_to_another', fn_check_shipping_billing($user_data, $profile_fields));
    if (Registry::get('settings.General.user_multiple_profiles') == 'Y' && !empty($user_id)) {
        Tygh::$app['view']->assign('user_profiles', fn_get_user_profiles($user_id));
    }
    Tygh::$app['view']->assign('countries', fn_get_simple_countries(true, CART_LANGUAGE));
    Tygh::$app['view']->assign('states', fn_get_all_states());
}
Example #24
0
    }
    // All checkout steps
} elseif ($mode == 'checkout') {
    if (Registry::get('settings.General.min_order_amount_type') == 'only_products' && Registry::get('settings.General.min_order_amount') > $cart['subtotal']) {
        Tygh::$app['view']->assign('value', Registry::get('settings.General.min_order_amount'));
        $min_amount = Tygh::$app['view']->fetch('common/price.tpl');
        fn_set_notification('W', __('notice'), __('text_min_products_amount_required') . ' ' . $min_amount);
        return array(CONTROLLER_STATUS_REDIRECT, 'checkout.cart');
    }
    fn_add_breadcrumb(__('checkout'));
    $profile_fields = fn_get_profile_fields('O');
    // Display steps
    $display_steps = array('step_one' => true, 'step_two' => true, 'step_three' => true, 'step_four' => true);
    if (Registry::get('settings.Checkout.configure_sign_in_step') == 'hide') {
        // Need to check profile fields
        $required_fields = fn_get_profile_fields('O', array(), CART_LANGUAGE, array('get_checkout_required' => true));
        if (empty($required_fields['C']) && Registry::get('settings.Checkout.disable_anonymous_checkout') != 'Y') {
            $display_steps['step_one'] = false;
        }
    }
    if (empty($profile_fields['B']) && empty($profile_fields['S'])) {
        $display_steps['step_two'] = false;
    }
    if (Registry::get('settings.Checkout.display_shipping_step') != 'Y' && fn_allowed_for('ULTIMATE')) {
        $display_steps['step_three'] = false;
    }
    if (Registry::get('settings.Checkout.display_payment_step') != 'Y') {
        $display_steps['step_four'] = false;
    }
    Tygh::$app['view']->assign('display_steps', $display_steps);
    // Array notifying that one or another step is completed.
Example #25
0
 public static function exportFieldsToFile($fields_orders)
 {
     $export_fields = array();
     foreach ($fields_orders as $field_id => $field_value) {
         if (!empty($field_value)) {
             $profile_field = fn_get_profile_fields('ALL', array(), CART_LANGUAGE, array('field_id' => $field_id));
             if (!empty($profile_field['checkout_export_1c']) && $profile_field['checkout_export_1c'] == 'Y') {
                 $export_fields[$profile_field['description']]['description'] = $profile_field['description'];
                 $export_fields[$profile_field['description']]['value'] = $field_value;
             }
         }
     }
     return $export_fields;
 }
    function content_55d73f8b706b29_35925749($_smarty_tpl)
    {
        if (!is_callable('smarty_function_split')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.split.php';
        }
        if (!is_callable('smarty_function_set_id')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.set_id.php';
        }
        fn_preload_lang_vars(array('user_account_info', 'username', 'email', 'password', 'login', 'url', 'usergroups', 'pending', 'active', 'profile_name', 'tax_exempt', 'yes', 'contact_information', 'billing_address', 'shipping_address', 'user_account_info', 'username', 'email', 'password', 'login', 'url', 'usergroups', 'pending', 'active', 'profile_name', 'tax_exempt', 'yes', 'contact_information', 'billing_address', 'shipping_address'));
        if ($_smarty_tpl->tpl_vars['runtime']->value['customization_mode']['design'] == "Y" && @constant('AREA') == "C") {
            $_smarty_tpl->_capture_stack[0][] = array("template_content", null, null);
            ob_start();
            ?>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
    <td valign="top">
        <table cellpadding="1" cellspacing="1" border="0" width="100%">
        <tr>
            <td colspan="2" class="form-title"><?php 
            echo $_smarty_tpl->__("user_account_info");
            ?>
<hr size="1" noshade></td>
        </tr>
        <?php 
            if ($_smarty_tpl->tpl_vars['settings']->value['General']['use_email_as_login'] != 'Y' && $_smarty_tpl->tpl_vars['user_data']->value['user_type'] != 'S') {
                ?>
        <tr>
            <td class="form-field-caption" nowrap><?php 
                echo $_smarty_tpl->__("username");
                ?>
:&nbsp;</td>
            <td ><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['user_login'], ENT_QUOTES, 'UTF-8');
                ?>
</td>
        </tr>
        <?php 
            } else {
                ?>
        <tr>
            <td class="form-field-caption" nowrap><?php 
                echo $_smarty_tpl->__("email");
                ?>
:&nbsp;</td>
            <td><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['email'], ENT_QUOTES, 'UTF-8');
                ?>
</td>
        </tr>
        <?php 
            }
            ?>
        <?php 
            if ($_smarty_tpl->tpl_vars['send_password']->value || $_smarty_tpl->tpl_vars['settings']->value['General']['quick_registration'] == "Y") {
                ?>
            <?php 
                if ($_smarty_tpl->tpl_vars['password']->value) {
                    ?>
            <tr>
                <td class="form-field-caption" nowrap><?php 
                    echo $_smarty_tpl->__("password");
                    ?>
:&nbsp;</td>
                <td><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['password']->value, ENT_QUOTES, 'UTF-8');
                    ?>
</td>
            </tr>
            <?php 
                }
                ?>
            <tr>
                <td class="form-field-caption" nowrap><?php 
                echo $_smarty_tpl->__("login");
                ?>
 <?php 
                echo $_smarty_tpl->__("url");
                ?>
:&nbsp;</td>
                <?php 
                $_smarty_tpl->tpl_vars['login_url'] = new Smarty_variable('', null, 0);
                ?>
                <?php 
                if ($_smarty_tpl->tpl_vars['user_data']->value['user_type'] == "C" && $_smarty_tpl->tpl_vars['user_data']->value['company_id']) {
                    ?>
                    <?php 
                    $_smarty_tpl->tpl_vars['login_url'] = new Smarty_variable("?company_id=" . (string) $_smarty_tpl->tpl_vars['user_data']->value['company_id'], null, 0);
                    ?>
                <?php 
                }
                ?>
                <td><?php 
                echo htmlspecialchars(fn_url($_smarty_tpl->tpl_vars['login_url']->value, $_smarty_tpl->tpl_vars['user_data']->value['user_type']), ENT_QUOTES, 'UTF-8');
                ?>
</td>
            </tr>
        <?php 
            }
            ?>
        <?php 
            if (!fn_allowed_for("ULTIMATE:FREE")) {
                ?>
            <?php 
                if ($_smarty_tpl->tpl_vars['user_data']->value['usergroups']) {
                    ?>
                <tr>
                    <td colspan="3">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="2" class="form-title"><?php 
                    echo $_smarty_tpl->__("usergroups");
                    ?>
<hr size="1" noshade></td>
                </tr>
                <?php 
                    $_smarty_tpl->tpl_vars["user_usergroup"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["user_usergroup"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['user_data']->value['usergroups'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["user_usergroup"]->key => $_smarty_tpl->tpl_vars["user_usergroup"]->value) {
                        $_smarty_tpl->tpl_vars["user_usergroup"]->_loop = true;
                        ?>
                    <tr>
                        <td class="form-field-caption" nowrap><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_usergroup']->value['usergroup'], ENT_QUOTES, 'UTF-8');
                        ?>
:&nbsp;</td>
                        <td><?php 
                        if ($_smarty_tpl->tpl_vars['user_usergroup']->value['status'] == 'P') {
                            echo $_smarty_tpl->__("pending");
                        } else {
                            echo $_smarty_tpl->__("active");
                        }
                        ?>
</td>
                    </tr>
                <?php 
                    }
                    ?>
            <?php 
                }
                ?>
        <?php 
            }
            ?>
        <?php 
            if ($_smarty_tpl->tpl_vars['settings']->value['General']['user_multiple_profiles'] == 'Y') {
                ?>
        <tr>
            <td class="form-title"><?php 
                echo $_smarty_tpl->__("profile_name");
                ?>
:&nbsp;</td>
            <td><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['profile_name'], ENT_QUOTES, 'UTF-8');
                ?>
</td>
        </tr>
        <?php 
            }
            ?>
        <?php 
            if ($_smarty_tpl->tpl_vars['user_data']->value['tax_exempt'] == 'Y') {
                ?>
        <tr>
            <td class="form-title"><?php 
                echo $_smarty_tpl->__("tax_exempt");
                ?>
:&nbsp;</td>
            <td><?php 
                echo $_smarty_tpl->__("yes");
                ?>
</td>
        </tr>
        <?php 
            }
            ?>
        </table>
    </td>    
    <td colspan="2">&nbsp;</td>
</tr>
<tr>
    <td colspan="3">&nbsp;</td>
</tr>
</table>

<?php 
            if (!$_smarty_tpl->tpl_vars['send_password']->value) {
                ?>
    <?php 
                $_smarty_tpl->tpl_vars["profile_fields"] = new Smarty_variable(fn_get_profile_fields($_smarty_tpl->tpl_vars['user_data']->value['user_type']), null, 0);
                ?>
    <?php 
                echo smarty_function_split(array('data' => $_smarty_tpl->tpl_vars['profile_fields']->value['C'], 'size' => 2, 'assign' => "contact_fields", 'simple' => true, 'size_is_horizontal' => true), $_smarty_tpl);
                ?>

    <table cellpadding="4" cellspacing="0" border="0" width="100%">
    <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['C']) {
                    ?>
        <tr>
            <td valign="top" width="50%">
                <table>
                    <?php 
                    echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['contact_fields']->value[0], 'title' => __("contact_information")), 0);
                    ?>

                </table>
            </td>
            <td width="1%">&nbsp;</td>
            <td valign="top" width="49%">
                <?php 
                    if ($_smarty_tpl->tpl_vars['contact_fields']->value[1]) {
                        ?>
                <table>
                    <?php 
                        echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['contact_fields']->value[1]), 0);
                        ?>

                </table>
                <?php 
                    }
                    ?>
            </td>
        </tr>
    <?php 
                }
                ?>
    <?php 
                if (($_smarty_tpl->tpl_vars['profile_fields']->value['B'] || $_smarty_tpl->tpl_vars['profile_fields']->value['S']) && $_smarty_tpl->tpl_vars['user_data']->value['register_at_checkout'] != "Y" && !($_smarty_tpl->tpl_vars['created']->value && $_smarty_tpl->tpl_vars['settings']->value['General']['quick_registration'] == "Y")) {
                    ?>
    <tr>
        <td valign="top">
        <?php 
                    if ($_smarty_tpl->tpl_vars['profile_fields']->value['B']) {
                        ?>
            <p></p>
            <table>
                <?php 
                        echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['B'], 'title' => __("billing_address")), 0);
                        ?>

            </table>
        <?php 
                    } else {
                        ?>
            &nbsp;
        <?php 
                    }
                    ?>
        </td>
        <td>&nbsp;</td>
        <td valign="top">
        <?php 
                    if ($_smarty_tpl->tpl_vars['profile_fields']->value['S']) {
                        ?>
            <p></p>
            <table>
                <?php 
                        echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['S'], 'title' => __("shipping_address")), 0);
                        ?>

            </table>
        <?php 
                    } else {
                        ?>
            &nbsp;
        <?php 
                    }
                    ?>
        </td>
    </tr>
    <?php 
                }
                ?>
    </table>
<?php 
            }
            list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
            if (!empty($_capture_buffer)) {
                if (isset($_capture_assign)) {
                    $_smarty_tpl->assign($_capture_assign, ob_get_contents());
                }
                if (isset($_capture_append)) {
                    $_smarty_tpl->append($_capture_append, ob_get_contents());
                }
                Smarty::$_smarty_vars['capture'][$_capture_buffer] = ob_get_clean();
            } else {
                $_smarty_tpl->capture_error();
            }
            if (trim(Smarty::$_smarty_vars['capture']['template_content'])) {
                if ($_smarty_tpl->tpl_vars['auth']->value['area'] == "A") {
                    ?>
<span class="cm-template-box template-box" data-ca-te-template="profiles/profiles_info.tpl" id="<?php 
                    echo smarty_function_set_id(array('name' => "profiles/profiles_info.tpl"), $_smarty_tpl);
                    ?>
"><div class="cm-template-icon icon-edit ty-icon-edit hidden"></div><?php 
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                    ?>
<!--[/tpl_id]--></span><?php 
                } else {
                    echo Smarty::$_smarty_vars['capture']['template_content'];
                }
            }
        } else {
            ?>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
    <td valign="top">
        <table cellpadding="1" cellspacing="1" border="0" width="100%">
        <tr>
            <td colspan="2" class="form-title"><?php 
            echo $_smarty_tpl->__("user_account_info");
            ?>
<hr size="1" noshade></td>
        </tr>
        <?php 
            if ($_smarty_tpl->tpl_vars['settings']->value['General']['use_email_as_login'] != 'Y' && $_smarty_tpl->tpl_vars['user_data']->value['user_type'] != 'S') {
                ?>
        <tr>
            <td class="form-field-caption" nowrap><?php 
                echo $_smarty_tpl->__("username");
                ?>
:&nbsp;</td>
            <td ><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['user_login'], ENT_QUOTES, 'UTF-8');
                ?>
</td>
        </tr>
        <?php 
            } else {
                ?>
        <tr>
            <td class="form-field-caption" nowrap><?php 
                echo $_smarty_tpl->__("email");
                ?>
:&nbsp;</td>
            <td><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['email'], ENT_QUOTES, 'UTF-8');
                ?>
</td>
        </tr>
        <?php 
            }
            ?>
        <?php 
            if ($_smarty_tpl->tpl_vars['send_password']->value || $_smarty_tpl->tpl_vars['settings']->value['General']['quick_registration'] == "Y") {
                ?>
            <?php 
                if ($_smarty_tpl->tpl_vars['password']->value) {
                    ?>
            <tr>
                <td class="form-field-caption" nowrap><?php 
                    echo $_smarty_tpl->__("password");
                    ?>
:&nbsp;</td>
                <td><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['password']->value, ENT_QUOTES, 'UTF-8');
                    ?>
</td>
            </tr>
            <?php 
                }
                ?>
            <tr>
                <td class="form-field-caption" nowrap><?php 
                echo $_smarty_tpl->__("login");
                ?>
 <?php 
                echo $_smarty_tpl->__("url");
                ?>
:&nbsp;</td>
                <?php 
                $_smarty_tpl->tpl_vars['login_url'] = new Smarty_variable('', null, 0);
                ?>
                <?php 
                if ($_smarty_tpl->tpl_vars['user_data']->value['user_type'] == "C" && $_smarty_tpl->tpl_vars['user_data']->value['company_id']) {
                    ?>
                    <?php 
                    $_smarty_tpl->tpl_vars['login_url'] = new Smarty_variable("?company_id=" . (string) $_smarty_tpl->tpl_vars['user_data']->value['company_id'], null, 0);
                    ?>
                <?php 
                }
                ?>
                <td><?php 
                echo htmlspecialchars(fn_url($_smarty_tpl->tpl_vars['login_url']->value, $_smarty_tpl->tpl_vars['user_data']->value['user_type']), ENT_QUOTES, 'UTF-8');
                ?>
</td>
            </tr>
        <?php 
            }
            ?>
        <?php 
            if (!fn_allowed_for("ULTIMATE:FREE")) {
                ?>
            <?php 
                if ($_smarty_tpl->tpl_vars['user_data']->value['usergroups']) {
                    ?>
                <tr>
                    <td colspan="3">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="2" class="form-title"><?php 
                    echo $_smarty_tpl->__("usergroups");
                    ?>
<hr size="1" noshade></td>
                </tr>
                <?php 
                    $_smarty_tpl->tpl_vars["user_usergroup"] = new Smarty_Variable();
                    $_smarty_tpl->tpl_vars["user_usergroup"]->_loop = false;
                    $_from = $_smarty_tpl->tpl_vars['user_data']->value['usergroups'];
                    if (!is_array($_from) && !is_object($_from)) {
                        settype($_from, 'array');
                    }
                    foreach ($_from as $_smarty_tpl->tpl_vars["user_usergroup"]->key => $_smarty_tpl->tpl_vars["user_usergroup"]->value) {
                        $_smarty_tpl->tpl_vars["user_usergroup"]->_loop = true;
                        ?>
                    <tr>
                        <td class="form-field-caption" nowrap><?php 
                        echo htmlspecialchars($_smarty_tpl->tpl_vars['user_usergroup']->value['usergroup'], ENT_QUOTES, 'UTF-8');
                        ?>
:&nbsp;</td>
                        <td><?php 
                        if ($_smarty_tpl->tpl_vars['user_usergroup']->value['status'] == 'P') {
                            echo $_smarty_tpl->__("pending");
                        } else {
                            echo $_smarty_tpl->__("active");
                        }
                        ?>
</td>
                    </tr>
                <?php 
                    }
                    ?>
            <?php 
                }
                ?>
        <?php 
            }
            ?>
        <?php 
            if ($_smarty_tpl->tpl_vars['settings']->value['General']['user_multiple_profiles'] == 'Y') {
                ?>
        <tr>
            <td class="form-title"><?php 
                echo $_smarty_tpl->__("profile_name");
                ?>
:&nbsp;</td>
            <td><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['profile_name'], ENT_QUOTES, 'UTF-8');
                ?>
</td>
        </tr>
        <?php 
            }
            ?>
        <?php 
            if ($_smarty_tpl->tpl_vars['user_data']->value['tax_exempt'] == 'Y') {
                ?>
        <tr>
            <td class="form-title"><?php 
                echo $_smarty_tpl->__("tax_exempt");
                ?>
:&nbsp;</td>
            <td><?php 
                echo $_smarty_tpl->__("yes");
                ?>
</td>
        </tr>
        <?php 
            }
            ?>
        </table>
    </td>    
    <td colspan="2">&nbsp;</td>
</tr>
<tr>
    <td colspan="3">&nbsp;</td>
</tr>
</table>

<?php 
            if (!$_smarty_tpl->tpl_vars['send_password']->value) {
                ?>
    <?php 
                $_smarty_tpl->tpl_vars["profile_fields"] = new Smarty_variable(fn_get_profile_fields($_smarty_tpl->tpl_vars['user_data']->value['user_type']), null, 0);
                ?>
    <?php 
                echo smarty_function_split(array('data' => $_smarty_tpl->tpl_vars['profile_fields']->value['C'], 'size' => 2, 'assign' => "contact_fields", 'simple' => true, 'size_is_horizontal' => true), $_smarty_tpl);
                ?>

    <table cellpadding="4" cellspacing="0" border="0" width="100%">
    <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['C']) {
                    ?>
        <tr>
            <td valign="top" width="50%">
                <table>
                    <?php 
                    echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['contact_fields']->value[0], 'title' => __("contact_information")), 0);
                    ?>

                </table>
            </td>
            <td width="1%">&nbsp;</td>
            <td valign="top" width="49%">
                <?php 
                    if ($_smarty_tpl->tpl_vars['contact_fields']->value[1]) {
                        ?>
                <table>
                    <?php 
                        echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['contact_fields']->value[1]), 0);
                        ?>

                </table>
                <?php 
                    }
                    ?>
            </td>
        </tr>
    <?php 
                }
                ?>
    <?php 
                if (($_smarty_tpl->tpl_vars['profile_fields']->value['B'] || $_smarty_tpl->tpl_vars['profile_fields']->value['S']) && $_smarty_tpl->tpl_vars['user_data']->value['register_at_checkout'] != "Y" && !($_smarty_tpl->tpl_vars['created']->value && $_smarty_tpl->tpl_vars['settings']->value['General']['quick_registration'] == "Y")) {
                    ?>
    <tr>
        <td valign="top">
        <?php 
                    if ($_smarty_tpl->tpl_vars['profile_fields']->value['B']) {
                        ?>
            <p></p>
            <table>
                <?php 
                        echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['B'], 'title' => __("billing_address")), 0);
                        ?>

            </table>
        <?php 
                    } else {
                        ?>
            &nbsp;
        <?php 
                    }
                    ?>
        </td>
        <td>&nbsp;</td>
        <td valign="top">
        <?php 
                    if ($_smarty_tpl->tpl_vars['profile_fields']->value['S']) {
                        ?>
            <p></p>
            <table>
                <?php 
                        echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['S'], 'title' => __("shipping_address")), 0);
                        ?>

            </table>
        <?php 
                    } else {
                        ?>
            &nbsp;
        <?php 
                    }
                    ?>
        </td>
    </tr>
    <?php 
                }
                ?>
    </table>
<?php 
            }
        }
    }
    function content_55d2f403043d52_82420940($_smarty_tpl)
    {
        if (!is_callable('smarty_function_split')) {
            include '/home/coriolan/public_html/lead/app/functions/smarty_plugins/function.split.php';
        }
        fn_preload_lang_vars(array('user_account_info', 'username', 'email', 'password', 'login', 'url', 'usergroups', 'pending', 'active', 'profile_name', 'tax_exempt', 'yes', 'contact_information', 'contact_information', 'billing_address', 'shipping_address'));
        ?>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
    <td valign="top">
        <table cellpadding="1" cellspacing="1" border="0" width="100%">
        <tr>
            <td colspan="2" class="form-title"><?php 
        echo $_smarty_tpl->__("user_account_info");
        ?>
<hr size="1" noshade></td>
        </tr>
        <?php 
        if ($_smarty_tpl->tpl_vars['settings']->value['General']['use_email_as_login'] != 'Y' && $_smarty_tpl->tpl_vars['user_data']->value['user_type'] != 'S') {
            ?>
        <tr>
            <td class="form-field-caption" nowrap><?php 
            echo $_smarty_tpl->__("username");
            ?>
:&nbsp;</td>
            <td ><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['user_login'], ENT_QUOTES, 'UTF-8');
            ?>
</td>
        </tr>
        <?php 
        } else {
            ?>
        <tr>
            <td class="form-field-caption" nowrap><?php 
            echo $_smarty_tpl->__("email");
            ?>
:&nbsp;</td>
            <td><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['email'], ENT_QUOTES, 'UTF-8');
            ?>
</td>
        </tr>
        <?php 
        }
        ?>
        <?php 
        if ($_smarty_tpl->tpl_vars['send_password']->value || $_smarty_tpl->tpl_vars['settings']->value['General']['quick_registration'] == "Y") {
            ?>
            <?php 
            if ($_smarty_tpl->tpl_vars['password']->value) {
                ?>
            <tr>
                <td class="form-field-caption" nowrap><?php 
                echo $_smarty_tpl->__("password");
                ?>
:&nbsp;</td>
                <td><?php 
                echo htmlspecialchars($_smarty_tpl->tpl_vars['password']->value, ENT_QUOTES, 'UTF-8');
                ?>
</td>
            </tr>
            <?php 
            }
            ?>
            <tr>
                <td class="form-field-caption" nowrap><?php 
            echo $_smarty_tpl->__("login");
            ?>
 <?php 
            echo $_smarty_tpl->__("url");
            ?>
:&nbsp;</td>
                <td><?php 
            if ($_smarty_tpl->tpl_vars['user_data']->value['company_id']) {
                echo htmlspecialchars(fn_url("?company_id=" . (string) $_smarty_tpl->tpl_vars['user_data']->value['company_id'], 'C', 'http'), ENT_QUOTES, 'UTF-8');
            } else {
                echo htmlspecialchars(fn_url('', 'C', 'http'), ENT_QUOTES, 'UTF-8');
            }
            ?>
</td>
            </tr>
        <?php 
        }
        ?>
        <?php 
        if (!fn_allowed_for("ULTIMATE:FREE")) {
            ?>
            <?php 
            if ($_smarty_tpl->tpl_vars['user_data']->value['usergroups']) {
                ?>
                <tr>
                    <td colspan="3">&nbsp;</td>
                </tr>
                <tr>
                    <td colspan="2" class="form-title"><?php 
                echo $_smarty_tpl->__("usergroups");
                ?>
<hr size="1" noshade></td>
                </tr>
                <?php 
                $_smarty_tpl->tpl_vars["user_usergroup"] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars["user_usergroup"]->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['user_data']->value['usergroups'];
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars["user_usergroup"]->key => $_smarty_tpl->tpl_vars["user_usergroup"]->value) {
                    $_smarty_tpl->tpl_vars["user_usergroup"]->_loop = true;
                    ?>
                    <tr>
                        <td class="form-field-caption" nowrap><?php 
                    echo htmlspecialchars($_smarty_tpl->tpl_vars['user_usergroup']->value['usergroup'], ENT_QUOTES, 'UTF-8');
                    ?>
:&nbsp;</td>
                        <td><?php 
                    if ($_smarty_tpl->tpl_vars['user_usergroup']->value['status'] == 'P') {
                        echo $_smarty_tpl->__("pending");
                    } else {
                        echo $_smarty_tpl->__("active");
                    }
                    ?>
</td>
                    </tr>
                <?php 
                }
                ?>
            <?php 
            }
            ?>
        <?php 
        }
        ?>
        <?php 
        if ($_smarty_tpl->tpl_vars['settings']->value['General']['user_multiple_profiles'] == 'Y') {
            ?>
        <tr>
            <td class="form-title"><?php 
            echo $_smarty_tpl->__("profile_name");
            ?>
:&nbsp;</td>
            <td><?php 
            echo htmlspecialchars($_smarty_tpl->tpl_vars['user_data']->value['profile_name'], ENT_QUOTES, 'UTF-8');
            ?>
</td>
        </tr>
        <?php 
        }
        ?>
        <?php 
        if ($_smarty_tpl->tpl_vars['user_data']->value['tax_exempt'] == 'Y') {
            ?>
        <tr>
            <td class="form-title"><?php 
            echo $_smarty_tpl->__("tax_exempt");
            ?>
:&nbsp;</td>
            <td><?php 
            echo $_smarty_tpl->__("yes");
            ?>
</td>
        </tr>
        <?php 
        }
        ?>
        </table>
    </td>    
    <td colspan="2">&nbsp;</td>
</tr>
<tr>
    <td colspan="3">&nbsp;</td>
</tr>
</table>

<?php 
        if (!$_smarty_tpl->tpl_vars['send_password']->value) {
            ?>
    <?php 
            $_smarty_tpl->tpl_vars["profile_fields"] = new Smarty_variable(fn_get_profile_fields($_smarty_tpl->tpl_vars['user_data']->value['user_type']), null, 0);
            ?>
    <?php 
            echo smarty_function_split(array('data' => $_smarty_tpl->tpl_vars['profile_fields']->value['C'], 'size' => 2, 'assign' => "contact_fields", 'simple' => true, 'size_is_horizontal' => true), $_smarty_tpl);
            ?>

    <table cellpadding="4" cellspacing="0" border="0" width="100%">
    <?php 
            if ($_smarty_tpl->tpl_vars['profile_fields']->value['C']) {
                ?>
        <tr>
            <td valign="top" width="50%">
                <table>
                    <?php 
                echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['contact_fields']->value[0], 'title' => __("contact_information")), 0);
                ?>

                </table>
            </td>
            <td width="1%">&nbsp;</td>
            <td valign="top" width="49%">
                <?php 
                if ($_smarty_tpl->tpl_vars['contact_fields']->value[1]) {
                    ?>
                <table>
                    <?php 
                    echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['contact_fields']->value[1], 'title' => __("contact_information")), 0);
                    ?>

                </table>
                <?php 
                }
                ?>
            </td>
        </tr>
    <?php 
            }
            ?>
    <?php 
            if (($_smarty_tpl->tpl_vars['profile_fields']->value['B'] || $_smarty_tpl->tpl_vars['profile_fields']->value['S']) && $_smarty_tpl->tpl_vars['user_data']->value['register_at_checkout'] != "Y" && !($_smarty_tpl->tpl_vars['created']->value && $_smarty_tpl->tpl_vars['settings']->value['General']['quick_registration'] == "Y")) {
                ?>
    <tr>
        <td valign="top">
        <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['B']) {
                    ?>
            <p></p>
            <table>
                <?php 
                    echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['B'], 'title' => __("billing_address")), 0);
                    ?>

            </table>
        <?php 
                } else {
                    ?>
            &nbsp;
        <?php 
                }
                ?>
        </td>
        <td>&nbsp;</td>
        <td valign="top">
        <?php 
                if ($_smarty_tpl->tpl_vars['profile_fields']->value['S']) {
                    ?>
            <p></p>
            <table>
                <?php 
                    echo $_smarty_tpl->getSubTemplate("profiles/profile_fields_info.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('fields' => $_smarty_tpl->tpl_vars['profile_fields']->value['S'], 'title' => __("shipping_address")), 0);
                    ?>

            </table>
        <?php 
                } else {
                    ?>
            &nbsp;
        <?php 
                }
                ?>
        </td>
    </tr>
    <?php 
            }
            ?>
    </table>
<?php 
        }
    }