function _assets_base($file, $attr, $type)
 {
     if (is_array($file)) {
         return _process_array($file, $type);
     } else {
         if (!empty($attr) && is_array($attr)) {
             $attribute = ' ';
             foreach ($attr as $key => $value) {
                 $attribute .= ' ' . $key . '="' . $value . '"';
             }
         }
         $config = _getConfig();
         $path = base_url($config['path_base'] . DS . $config['path_' . $type] . DS . $file);
         if ($type == 'js') {
             return '<script type="text/javascript" src="' . $path . '"' . $attribute . '></script>' . PHP_EOL;
         } else {
             if ($type == 'jsku') {
                 return '<script type="text/javascript" src="' . $path . '"' . $attribute . '></script>' . PHP_EOL;
             } else {
                 if ($type == 'css') {
                     return '<link rel="stylesheet" type="text/css" href="' . $path . '"' . $attribute . '>' . PHP_EOL;
                 } else {
                     if ($type == 'img') {
                         return '<img src="' . $path . '"' . $attribute . '/>' . PHP_EOL;
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 function _upload_file($type, $file, $file_name, $folder = '')
 {
     $resultArr = array();
     $config = _getConfig();
     if ($type == 'article' && $folder != '') {
         $folder = $config['path_article'] . DS . $folder;
     } else {
         if ($type == 'carousel') {
             $folder = $config['path_carousel'];
         } else {
             if ($type == 'teacher') {
                 $folder = $config['path_teacher'];
             } else {
                 if ($type == 'student') {
                     $folder = $config['path_student'];
                 } else {
                     return array('success' => false, 'error' => 'No folder specified');
                 }
             }
         }
     }
     $config['upload_path'] = '.' . DS . $config['path_base'] . DS . $folder;
     $config['file_name'] = $file_name;
     $CI =& get_instance();
     $CI->load->library('upload', $config);
     if (!$CI->upload->do_upload()) {
         $resultArr['success'] = FALSE;
         $resultArr['error'] = $CI->upload->display_errors();
     } else {
         $data = $CI->upload->data();
         $resultArr['success'] = TRUE;
         $resultArr['data'] = $data;
     }
     // if (fopen($config['path_base'].DS.$folder.DS.$file_name, "wb"))
     // {
     // 	$ifp = fopen($config['path_base'].DS.$folder.DS.$file_name, "wb");
     // fwrite($ifp, $file);
     // fclose($ifp);
     // 	$resultArr['success'] = TRUE;
     // 	$resultArr['url'] = base_url($config['path_base'].DS.$folder.DS.$file_name);
     // }
     // else
     // {
     // 	$resultArr['success'] = FALSE;
     // }
     return $resultArr;
 }
Esempio n. 3
0
                                            $_SESSION[CART_KEY]['distance_details']['foreign'] = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } elseif (isset($_SESSION[CART_KEY]['distance']) && is_intval($_SESSION[CART_KEY]['distance'])) {
        $subtotal['shipping_distance'] = $_SESSION[CART_KEY]['distance'];
        $subtotal['shipping_distance_details'] = array_merge($subtotal['shipping_distance_details'], $_SESSION[CART_KEY]['distance_details']);
    }
}
foreach (_getConfig('shop_pref_shipping', '_shopPref') as $item_key => $row) {
    // calculate shipping costs based on weight
    if ($subtotal['shipping_calc_type'] === 0) {
        // do nothing as long shipping fee = 0
        if ($row['net'] == 0) {
            continue;
        }
        // lower weight and current shipping fee lower then this
        if ($subtotal['weight'] <= $row['weight']) {
            $subtotal['shipping_calc'] = true;
        }
        if ($subtotal['shipping_calc']) {
            $subtotal['shipping_net'] = $row['net'];
            $subtotal['shipping_gross'] = $subtotal['shipping_net'] * (1 + $row['vat'] / 100);
            $subtotal['shipping_vat'] = $subtotal['shipping_gross'] - $subtotal['shipping_net'];
            break;
Esempio n. 4
0
 function assets_path($file)
 {
     $config = _getConfig();
     return base_url($config['path_base'] . DS . $file);
 }
Esempio n. 5
0
 }
 $mail_customer = str_replace(array('{CURRENCY_SYMBOL}', '{$}'), $_shopPref['shop_pref_currency'], $mail_customer);
 $mail_neworder = str_replace(array('{CURRENCY_SYMBOL}', '{$}'), $_shopPref['shop_pref_currency'], $mail_neworder);
 // store order in database
 $order_data = array('order_number' => $order_num, 'order_date' => gmdate('Y-m-d H:i'), 'order_name' => $_SESSION[CART_KEY]['step1']['INV_NAME'], 'order_firstname' => $_SESSION[CART_KEY]['step1']['INV_FIRSTNAME'], 'order_email' => $_SESSION[CART_KEY]['step1']['EMAIL'], 'order_net' => $subtotal['float_total_net'], 'order_gross' => $subtotal['float_total_gross'], 'order_payment' => $payment, 'order_data' => @serialize(array('cart' => $cart_data, 'address' => $_SESSION[CART_KEY]['step1'], 'mail_customer' => $mail_customer, 'mail_self' => $mail_neworder, 'subtotal' => array('subtotal_net' => $subtotal['float_net'], 'subtotal_gross' => $subtotal['float_gross']), 'shipping' => array('shipping_net' => $subtotal['float_shipping_net'], 'shipping_gross' => $subtotal['float_shipping_gross'], 'shipping_distance' => $subtotal['shipping_distance'] === false ? 0 : $subtotal['shipping_distance']), 'discount' => array('discount_net' => $subtotal['float_discount_net'], 'discount_gross' => $subtotal['float_discount_gross']), 'loworder' => array('loworder_net' => $subtotal['float_loworder_net'], 'loworder_gross' => $subtotal['float_loworder_gross']), 'weight' => $subtotal['float_weight'], 'lang' => $phpwcms['default_lang'], 'distance' => $subtotal['shipping_distance'] === false ? null : $subtotal['shipping_distance_details'])), 'order_status' => 'NEW-ORDER');
 // receive order db ID
 $order_data = _dbInsert('phpwcms_shop_orders', $order_data);
 // send mail to customer
 $email_from = _getConfig('shop_pref_email_from', '_shopPref');
 if (!is_valid_email($email_from)) {
     $email_from = $phpwcms['SMTP_FROM_EMAIL'];
 }
 $order_mail_customer = array('recipient' => $_SESSION[CART_KEY]['step1']['EMAIL'], 'toName' => $_SESSION[CART_KEY]['step1']['INV_FIRSTNAME'] . ' ' . $_SESSION[CART_KEY]['step1']['INV_NAME'], 'subject' => str_replace('{ORDER}', $order_num, $_tmpl['config']['mail_customer_subject']), 'text' => $mail_customer, 'from' => $email_from, 'sender' => $email_from);
 $order_data_mail_customer = sendEmail($order_mail_customer);
 // send mail to shop
 $send_order_to = convertStringToArray(_getConfig('shop_pref_email_to', '_shopPref'), ';');
 if (empty($send_order_to[0]) || !is_valid_email($send_order_to[0])) {
     $email_to = $phpwcms['SMTP_FROM_EMAIL'];
 } else {
     $email_to = $send_order_to[0];
     unset($send_order_to[0]);
 }
 $order_mail_self = array('from' => $_SESSION[CART_KEY]['step1']['EMAIL'], 'fromName' => $_SESSION[CART_KEY]['step1']['INV_FIRSTNAME'] . ' ' . $_SESSION[CART_KEY]['step1']['INV_NAME'], 'subject' => str_replace('{ORDER}', $order_num, $_tmpl['config']['mail_neworder_subject']), 'text' => $mail_neworder, 'recipient' => $email_to, 'sender' => $_SESSION[CART_KEY]['step1']['EMAIL']);
 $order_data_mail_self = sendEmail($order_mail_self);
 // are there additional recipients for orders?
 if (count($send_order_to)) {
     foreach ($send_order_to as $value) {
         $order_mail_self['recipient'] = $value;
         @sendEmail($order_mail_self);
     }
 }
Esempio n. 6
0
function get_struct_data($root_name = '', $root_info = '')
{
    //returns the complete active and public struct data as array
    //so it is reusable by many menu functions -> lower db access
    // first check pre-rendered structure for current user mode
    $sysvalue_key = 'structure_array_vmode_' . get_user_vmode();
    $data = _getConfig($sysvalue_key);
    if (is_array($data)) {
        return $data;
    }
    global $db;
    global $indexpage;
    $data = array();
    $data[0] = array("acat_id" => 0, "acat_name" => $indexpage['acat_name'], "acat_info" => $indexpage['acat_info'], "acat_struct" => 0, "acat_sort" => 0, "acat_hidden" => intval($indexpage['acat_hidden']), "acat_regonly" => intval($indexpage['acat_regonly']), "acat_ssl" => intval($indexpage['acat_ssl']), "acat_template" => intval($indexpage['acat_template']), "acat_alias" => $indexpage['acat_alias'], "acat_topcount" => intval($indexpage['acat_topcount']), "acat_maxlist" => intval($indexpage['acat_maxlist']), "acat_redirect" => $indexpage['acat_redirect'], "acat_order" => intval($indexpage['acat_order']), "acat_timeout" => $indexpage['acat_timeout'], "acat_nosearch" => $indexpage['acat_nosearch'], "acat_nositemap" => $indexpage['acat_nositemap'], "acat_permit" => !empty($indexpage['acat_permit']) && is_array($indexpage['acat_permit']) ? $indexpage['acat_permit'] : array(), "acat_pagetitle" => empty($indexpage['acat_pagetitle']) ? '' : $indexpage['acat_pagetitle'], "acat_paginate" => empty($indexpage['acat_paginate']) ? 0 : 1, "acat_overwrite" => empty($indexpage['acat_overwrite']) ? '' : $indexpage['acat_overwrite'], "acat_archive" => empty($indexpage['acat_archive']) ? 0 : 1, "acat_class" => empty($indexpage['acat_class']) ? '' : $indexpage['acat_class'], "acat_keywords" => empty($indexpage['acat_keywords']) ? '' : $indexpage['acat_keywords'], "acat_disable301" => empty($indexpage['acat_disable301']) ? 0 : 1, "acat_opengraph" => isset($indexpage['acat_opengraph']) ? $indexpage['acat_opengraph'] : 1, "acat_canonical" => empty($indexpage['acat_canonical']) ? '' : $indexpage['acat_canonical']);
    $sql = "SELECT * FROM " . DB_PREPEND . "phpwcms_articlecat WHERE ";
    // VISIBLE_MODE: 0 = frontend (all) mode, 1 = article user mode, 2 = admin user mode
    if (VISIBLE_MODE != 2) {
        // for 0 AND 1
        $sql .= "acat_aktiv=1 AND ";
    }
    $sql .= "acat_trash=0 ORDER BY acat_struct, acat_sort";
    if ($result = mysql_query($sql, $db)) {
        while ($row = mysql_fetch_assoc($result)) {
            $data[$row["acat_id"]] = array("acat_id" => $row["acat_id"], "acat_name" => $row["acat_name"], "acat_info" => $row["acat_info"], "acat_struct" => $row["acat_struct"], "acat_sort" => $row["acat_sort"], "acat_hidden" => $row["acat_hidden"], "acat_regonly" => $row["acat_regonly"], "acat_ssl" => $row["acat_ssl"], "acat_template" => $row["acat_template"], "acat_alias" => $row["acat_alias"], "acat_topcount" => $row["acat_topcount"], "acat_maxlist" => $row["acat_maxlist"], "acat_redirect" => $row["acat_redirect"], "acat_order" => $row["acat_order"], "acat_timeout" => $row["acat_cache"], "acat_nosearch" => $row["acat_nosearch"], "acat_nositemap" => $row["acat_nositemap"], "acat_permit" => empty($row["acat_permit"]) ? array() : explode(',', $row["acat_permit"]), "acat_pagetitle" => $row["acat_pagetitle"], "acat_paginate" => $row["acat_paginate"], "acat_overwrite" => $row["acat_overwrite"], "acat_archive" => $row["acat_archive"], "acat_class" => $row["acat_class"], "acat_keywords" => $row["acat_keywords"], "acat_disable301" => $row["acat_disable301"], "acat_opengraph" => $row["acat_opengraph"], "acat_canonical" => $row["acat_canonical"]);
        }
        mysql_free_result($result);
    }
    // set max_allowed_package to bigger value
    _dbSetVar('max_allowed_packet', 16 * 1024 * 1024, '<');
    // store pre-rendered serialized array in database
    _setConfig($sysvalue_key, $data, 'frontend_render', 1);
    return $data;
}
Esempio n. 7
0
         if (!isset($result[0])) {
             $result = _dbQuery("ALTER TABLE " . DB_PREPEND . "phpwcms_shop_products ADD shopprod_overwrite_meta INT(1) NOT NULL DEFAULT '1'", 'ALTER');
         }
         $result = _dbQuery("SHOW COLUMNS FROM `" . DB_PREPEND . "phpwcms_shop_products` WHERE Field='shopprod_opengraph'");
         if (!isset($result[0])) {
             $insert = _dbQuery("ALTER TABLE `" . DB_PREPEND . "phpwcms_shop_products` ADD `shopprod_opengraph` INT(1) UNSIGNED NOT NULL DEFAULT '1', ADD INDEX (`shopprod_opengraph`)", 'ALTER');
         }
     }
     $_SESSION['shop_db_proof'] = true;
 }
 // module default stuff
 $plugin = array();
 define('MODULE_HREF', 'phpwcms.php?do=modules&amp;module=' . $module);
 include_once $phpwcms['modules'][$module]['path'] . 'inc/functions.backend.inc.php';
 include_once $phpwcms['modules'][$module]['path'] . 'inc/functions.global.inc.php';
 define('SHOP_FELANG_SUPPORT', _getConfig('shop_pref_felang') ? true : false);
 // put translation back to have easier access to it - use it as relation
 $BLM =& $BL['modules'][$module];
 // load special backend CSS
 $BE['HEADER']['module.shop.css'] = '	<link href="' . $phpwcms['modules'][$module]['dir'] . 'template/module.shop.css" rel="stylesheet" type="text/css" />';
 $controller = empty($_GET['controller']) ? 'order' : strtolower($_GET['controller']);
 if (isset($_GET['edit'])) {
     $action = 'edit';
 } elseif (isset($_GET['status'])) {
     $action = 'status';
 } elseif (isset($_GET['delete'])) {
     $action = 'delete';
 } elseif (isset($_GET['show'])) {
     $action = 'show';
 } else {
     $action = '';
			<td width="75"><label for="shopprod_netgross" title="<?php 
echo $BLM['shopprod_netgross_info'];
?>
"><?php 
echo $BLM['shopprod_netgross'];
?>
</label>&nbsp;&nbsp;&nbsp;</td>

			<td class="chatlist"><?php 
echo $BLM['shopprod_vat'];
?>
:&nbsp;</td>
			<td><select name="shopprod_vat" id="shopprod_id" class="v12">

	<?php 
if (!($plugin['data']['shop_pref_vat'] = _getConfig('shop_pref_vat'))) {
    $plugin['data']['shop_pref_vat'] = array('0.00');
    _setConfig('shop_pref_vat', $plugin['data']['shop_pref_vat'], 'module_shop');
}
$add_option = '';
$add_vat = array();
foreach ($plugin['data']['shop_pref_vat'] as $value) {
    echo '<option value="' . $value . '"';
    if ($plugin['data']['shopprod_vat'] == $value) {
        echo ' selected="selected"';
    } elseif (!empty($plugin['data']['shopprod_vat']) && !in_array($plugin['data']['shopprod_vat'], $plugin['data']['shop_pref_vat'])) {
        $plugin['data']['shop_pref_vat'][] = $plugin['data']['shopprod_vat'];
        natsort($plugin['data']['shop_pref_vat']);
        _setConfig('shop_pref_vat', $plugin['data']['shop_pref_vat'], 'module_shop');
        $add_option .= LF . '<option value="' . $plugin['data']['shopprod_vat'] . '" selected="selected">';
        $add_option .= number_format($plugin['data']['shopprod_vat'], 2, $BLM['dec_point'], $BLM['thousands_sep']);
Esempio n. 9
0
}
// define a charset helper here
if (PHPWCMS_CHARSET !== 'utf-8') {
    function _convert_charset($string)
    {
        return mb_convert_encoding($string, 'utf-8', PHPWCMS_CHARSET);
    }
} else {
    function _convert_charset($string)
    {
        return $string;
    }
}
// Get API Key and check if API access is enabled
$shop_api_access = _getConfig('shop_pref_api_access');
$shop_api_key = _getConfig('shop_pref_api_key');
$shop_api_action = null;
$shop_api_data = array('status' => 'ok', 'code' => '', 'message' => '', 'request_mode' => 'get', 'result' => array());
if (!empty($_GET['api']) && $_GET['api'] === clean_slweg($shop_api_key)) {
    if (isset($_GET['action'])) {
        $shop_api_action = strtolower(clean_slweg($_GET['action']));
    }
} elseif (!empty($_POST['api']) && $_POST['api'] === clean_slweg($shop_api_key)) {
    $shop_api_data['request_mode'] = 'post';
    if (isset($_POST['action'])) {
        $shop_api_action = strtolower(clean_slweg($_POST['action']));
    }
} else {
    $shop_api_data['status'] = 'error';
    $shop_api_data['code'] = 'api-key-missing';
    $shop_api_data['message'] = 'Set or see the API key setting in the shop preferences.';
Esempio n. 10
0
function get_payment_options()
{
    $payment_prefs = _getConfig('shop_pref_payment', '_shopPref');
    $supported = array('prepay' => 0, 'pod' => 0, 'onbill' => 0);
    $available = array();
    foreach ($supported as $key => $value) {
        if (!empty($payment_prefs[$key])) {
            $available[$key] = $payment_prefs[$key];
        }
    }
    return $available;
}
            _setConfig('shop_pref_vat', $plugin['data']['shop_pref_vat'], 'module_shop');
            _setConfig('shop_pref_email_to', $plugin['data']['shop_pref_email_to'], 'module_shop');
            _setConfig('shop_pref_email_from', $plugin['data']['shop_pref_email_from'], 'module_shop');
            _setConfig('shop_pref_email_paypal', $plugin['data']['shop_pref_email_paypal'], 'module_shop');
            _setConfig('shop_pref_shipping_calc', $plugin['data']['shop_pref_shipping_calc'], 'module_shop');
            _setConfig('shop_pref_shipping', $plugin['data']['shop_pref_shipping'], 'module_shop');
            _setConfig('shop_pref_payment', $plugin['data']['shop_pref_payment'], 'module_shop');
            _setConfig('shop_pref_terms', $plugin['data']['shop_pref_terms'], 'module_shop');
            _setConfig('shop_pref_terms_format', $plugin['data']['shop_pref_terms_format'], 'module_shop');
            _setConfig('shop_pref_id_shop', $plugin['data']['shop_pref_id_shop'], 'module_shop');
            _setConfig('shop_pref_id_cart', $plugin['data']['shop_pref_id_cart'], 'module_shop');
            _setConfig('shop_pref_discount', $plugin['data']['shop_pref_discount'], 'module_shop');
            _setConfig('shop_pref_loworder', $plugin['data']['shop_pref_loworder'], 'module_shop');
            _setConfig('shop_pref_felang', $plugin['data']['shop_pref_felang'], 'module_shop');
            _setConfig('shop_pref_zone_base', $plugin['data']['shop_pref_zone_base'], 'module_shop');
            _setConfig('shop_pref_api_access', $plugin['data']['shop_pref_api_access'], 'module_shop');
            _setConfig('shop_pref_api_key', $plugin['data']['shop_pref_api_key'], 'module_shop');
            // save and back to listing mode
            headerRedirect(shop_url('controller=pref', ''));
        }
    }
    $_checkPref_shipping_default = array('weight' => '', 'net' => 0, 'vat' => 0, 'price' => '', 'price_net' => 0, 'price_vat' => 0, 'zone' => '', 'zone_net' => 0, 'zone_vat' => 0, 'zone_label' => '');
    $_checkPref = array('shop_pref_currency' => '', 'shop_pref_unit_weight' => 'kg', 'shop_pref_vat' => array('0.00', '7.00', '19.00'), 'shop_pref_email_to' => '', 'shop_pref_email_from' => '', 'shop_pref_email_paypal' => '', 'shop_pref_id_shop' => 0, 'shop_pref_id_cart' => 0, 'shop_pref_felang' => 0, 'shop_pref_shipping_calc' => 0, 'shop_pref_shipping' => array(0 => $_checkPref_shipping_default, 1 => $_checkPref_shipping_default, 2 => $_checkPref_shipping_default, 3 => $_checkPref_shipping_default, 4 => $_checkPref_shipping_default), 'shop_pref_zone_base' => '', 'shop_pref_payment' => array('paypal' => 1, 'prepay' => 1, 'pod' => 1, 'onbill' => 1, 'ccard' => 1, 'accepted_ccard' => array('americanexpress', 'mastercard', 'visa')), 'shop_pref_terms' => '', 'shop_pref_terms_format' => 0, 'shop_pref_discount' => array('discount' => 0, 'percent' => 0, 'amount' => 0, 'freeshipping' => 0, 'discount_1' => 0, 'percent_1' => 0, 'amount_1' => 0, 'freeshipping_1' => 0, 'discount_2' => 0, 'percent_2' => 0, 'amount_2' => 0, 'freeshipping_2' => 0), 'shop_pref_loworder' => array('loworder' => 0, 'under' => 0, 'charge' => 0, 'vat' => 0), 'shop_pref_api_access' => 0, 'shop_pref_api_key' => '');
    // retrieve all settings
    foreach ($_checkPref as $key => $value) {
        if (false === ($plugin['data'][$key] = _getConfig($key))) {
            $plugin['data'][$key] = $value;
            _setConfig($key, $plugin['data'][$key], 'module_shop');
        }
    }
}
Esempio n. 12
0
    ?>
</td>
			<td class="number"><?php 
    echo number_format($plugin['data']['order_data']['shipping']['vat'], 2, $BLM['dec_point'], $BLM['thousands_sep']);
    ?>
</td>
			<td class="number"><?php 
    echo number_format($plugin['data']['order_data']['shipping']['shipping_gross'], 2, $BLM['dec_point'], $BLM['thousands_sep']);
    ?>
</td>
		</tr>

<?php 
    if (isset($plugin['data']['order_data']['discount'])) {
        $plugin['data']['order_data']['discount']['vat'] = $plugin['data']['order_data']['discount']['discount_gross'] - $plugin['data']['order_data']['discount']['discount_net'];
        $plugin['data']['shop_pref_discount'] = _getConfig('shop_pref_discount');
        ?>
		<tr class="product linebottom">
			<td colspan="3" class="chatlist"><?php 
        echo $BLM['shopprod_discount'] . ' ' . number_format($plugin['data']['shop_pref_discount']['percent'], 2, $BLM['dec_point'], $BLM['thousands_sep']);
        ?>
%:</td>
			<td class="number">-<?php 
        echo number_format($plugin['data']['order_data']['discount']['discount_net'], 2, $BLM['dec_point'], $BLM['thousands_sep']);
        ?>
</td>
			<td class="number">-<?php 
        echo number_format($plugin['data']['order_data']['discount']['vat'], 2, $BLM['dec_point'], $BLM['thousands_sep']);
        ?>
</td>
			<td class="number">-<?php 
Esempio n. 13
0
 function assets_path()
 {
     $config = _getConfig();
     return base_url($config['path_base']);
 }
 function search()
 {
     if (!$this->search_word_count) {
         return NULL;
     }
     $shop_url = _getConfig('shop_pref_id_shop', '_shopPref');
     $shop_lang_support = _getConfig('shop_pref_felang') ? true : false;
     if (!is_intval($shop_url) && is_string($shop_url)) {
         $shop_url = trim($shop_url);
     } elseif (is_intval($shop_url) && intval($shop_url)) {
         $shop_url = 'aid=' . intval($shop_url);
     } else {
         $shop_url = $GLOBALS['aktion'][1] ? 'aid=' . $GLOBALS['aktion'][1] : 'id=' . $GLOBALS['aktion'][0];
     }
     if ($this->search_highlight_words && is_array($this->search_highlight_words)) {
         $s_highlight_words = implode(' ', $this->search_highlight_words);
     } else {
         $s_highlight_words = '';
         $this->search_highlight = false;
     }
     $sql = 'SELECT shopprod_id, shopprod_category, shopprod_ordernumber, ';
     $sql .= 'shopprod_name1, shopprod_var, ';
     $sql .= 'UNIX_TIMESTAMP(shopprod_changedate) AS shopprod_date, ';
     $sql .= 'CONCAT(';
     $sql .= "\tshopprod_description0,' ',";
     $sql .= "\tshopprod_description1,' ',";
     $sql .= "\tshopprod_description2,' ',";
     $sql .= "\tshopprod_description3,' ',";
     $sql .= "\tshopprod_color,' ',";
     $sql .= "\tshopprod_size,' ',";
     $sql .= "\tshopprod_ordernumber,' ',";
     $sql .= "\tshopprod_model,' ',";
     $sql .= "\tshopprod_name1,' ',";
     $sql .= "\tshopprod_name2,' '";
     $sql .= ') AS shopprod_search ';
     $sql .= 'FROM ' . DB_PREPEND . 'phpwcms_shop_products WHERE shopprod_status=1';
     if ($shop_lang_support && !empty($GLOBALS['phpwcms']['default_lang'])) {
         $sql .= " AND (shopprod_lang='' OR shopprod_lang=" . _dbEscape($GLOBALS['phpwcms']['default_lang']) . ')';
     }
     $data = _dbQuery($sql);
     foreach ($data as $value) {
         $s_result = array();
         $s_text = $value['shopprod_search'];
         $s_text = str_replace(array('~', '|', ':', 'http', '//', '_blank', '&nbsp;'), ' ', $s_text);
         $s_text = clean_search_text($s_text);
         preg_match_all('/' . $this->search_words . '/is', $s_text, $s_result);
         $s_count = count($s_result[0]);
         if ($s_count && SEARCH_TYPE_AND) {
             $s_and_or = array();
             foreach ($s_result[0] as $svalue) {
                 $s_and_or[strtolower($svalue)] = 1;
             }
             $s_and_or = count($s_and_or);
             if ($s_and_or != $this->search_word_count) {
                 $s_count = 0;
             }
         }
         if ($s_count) {
             $id = $this->search_result_entry;
             $s_title = $value['shopprod_ordernumber'] ? trim($value['shopprod_ordernumber']) . ': ' : '';
             $s_title .= $value['shopprod_name1'];
             $s_title = html($s_title);
             $s_text = trim($s_text);
             if ($this->search_wordlimit) {
                 $s_text = getCleanSubString($s_text, $this->search_wordlimit, $this->ellipse_sign, 'word');
             }
             $s_text = html($s_text);
             $this->search_results[$id]["id"] = $value['shopprod_id'];
             $this->search_results[$id]["cid"] = 0;
             $this->search_results[$id]["rank"] = $s_count;
             $this->search_results[$id]["date"] = $value['shopprod_date'];
             $this->search_results[$id]["user"] = '';
             $this->search_results[$id]["subtitle"] = '';
             $this->search_results[$id]['query'] = $shop_url;
             //.'&amp;shop_cat='.$value['shopprod_category'].'&amp;shop_detail='.$value['shopprod_id'];
             $this->search_results[$id]['image'] = false;
             if ($this->image_render) {
                 $value['shopprod_var'] = unserialize($value['shopprod_var']);
                 if (isset($value['shopprod_var']['images'][0]['f_hash'])) {
                     $this->search_results[$id]['image'] = array('id' => $value['shopprod_var']['images'][0]['f_id'], 'hash' => $value['shopprod_var']['images'][0]['f_hash'], 'ext' => $value['shopprod_var']['images'][0]['f_ext'], 'name' => $value['shopprod_var']['images'][0]['f_name']);
                 }
             }
             if ($this->search_highlight) {
                 $this->search_results[$id]["title"] = highlightSearchResult($s_title, $this->search_highlight_words);
                 $this->search_results[$id]["text"] = highlightSearchResult($s_text, $this->search_highlight_words);
                 $this->search_results[$id]['link'] = rel_url(array('shop_cat' => $value['shopprod_category'], 'shop_detail' => $value['shopprod_id'], 'highlight' => $s_highlight_words), array('searchstart', 'searchwords'), $shop_url);
             } else {
                 $this->search_results[$id]["title"] = $s_title;
                 $this->search_results[$id]["text"] = $s_text;
                 $this->search_results[$id]['link'] = rel_url(array('shop_cat' => $value['shopprod_category'], 'shop_detail' => $value['shopprod_id']), array('highlight', 'searchstart', 'searchwords'), $shop_url);
             }
             $this->search_result_entry++;
         }
     }
 }