예제 #1
0
if (isset($q) && vam_not_null($q)) {
    $searchwords = explode(" ", $q);
    $nosearchwords = sizeof($searchwords);
    foreach ($searchwords as $key => $value) {
        if ($value == '') {
            unset($searchwords[$key]);
        }
    }
    $searchwords = array_values($searchwords);
    $nosearchwords = sizeof($searchwords);
    foreach ($searchwords as $key => $value) {
        $booltje = '+' . $searchwords[$key] . '*';
        $searchwords[$key] = $booltje;
    }
    $q = implode(" ", $searchwords);
    $products_query = vam_db_query("select pd.products_id, pd.products_name, pd.products_keywords, p.products_model, p.products_image\n\t\t\t\t\t\t\tfrom " . TABLE_PRODUCTS_DESCRIPTION . " pd\n\t\t\t\t\t\t\tinner join " . TABLE_PRODUCTS . " p\n\t\t\t\t\t\t\ton (p.products_id = pd.products_id)\n\t\t\t\t\t\t\twhere (match (pd.products_name) against ('" . $q . "' in boolean mode)\n\t\t\t\t\t\t\tor match (p.products_model) against ('" . $q . "' in boolean mode) or match (pd.products_keywords) against ('" . $q . "' in boolean mode)" . ($_REQUEST['search_in_description'] == '1' ? "or match (pd.products_description) against ('" . $q . "' in boolean mode)" : "") . ")\n\t\t\t\t\t\t\tand p.products_status = '1'\n\t\t\t\t\t\t\tand pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n\t\t\t\t\t\t\torder by pd.products_name asc\n\t\t\t\t\t\t\tlimit " . AJAX_QUICKSEARCH_LIMIT);
    if (vam_db_num_rows($products_query)) {
        //$out .= sprintf(TEXT_AJAX_QUICKSEARCH_TOP, AJAX_QUICKSEARCH_LIMIT) . '<br />';
        $dropdown = array();
        $out .= '<ul class="ajaxQuickFind">';
        while ($products = vam_db_fetch_array($products_query)) {
            $out .= '<li class="ajaxQuickFind"><div class="search_img"><img src="images/product_images/thumbnail_images/' . $products['products_image'] . '" height="60"/></div><div class="search_href"><a href="' . vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($products['products_id'], $products['products_name']), 'NONSSL', false) . '">' . $products['products_name'] . '</a></div></li>' . "\n";
            $dropdown[] = array('id' => $products['products_id'], 'text' => $products['products_name']);
        }
        $out .= '</ul>' . "\n";
        if (AJAX_QUICKSEARCH_RESULT == 'dropdown') {
            $out .= vam_draw_pull_down_menu('AJAX_QUICKSEARCH_pid', $dropdown, '', 'onChange="this.form.submit();" size="' . AJAX_QUICKSEARCH_DROPDOWN_SIZE . '" class="ajaxQuickFind"') . vam_hide_session_id();
        }
    }
}
echo $out;
예제 #2
0
                $function_close($fp);
                $c = 0;
                $i++;
                $fp = $function_open('sitemap' . $i . $file_extension, 'w');
                output(SITEMAP_HEADER);
                $strlen = strlen(SITEMAP_HEADER);
            }
        }
    }
}
$product_result = vam_db_query("\n    SELECT\n      p.products_id,\n      pd.products_name,\n      pd.language_id,\n      UNIX_TIMESTAMP(p.products_date_added) as products_date_added,\n      UNIX_TIMESTAMP(p.products_last_modified) as products_last_modified,\n      l.code\n    FROM\n      " . TABLE_PRODUCTS . " p, \n      " . TABLE_PRODUCTS_DESCRIPTION . " pd,\n      " . TABLE_LANGUAGES . " l\n    WHERE pd.language_id = '" . $_SESSION['languages_id'] . "' and \n      p.products_status='1' AND\n      p.products_id = pd.products_id AND\n      pd.language_id = l.languages_id\n    ORDER BY\n      p.products_id\n  ");
if (vam_db_num_rows($product_result) > 0) {
    while ($product_data = vam_db_fetch_array($product_result)) {
        $lang_param = $product_data['code'] != DEFAULT_LANGUAGE ? '&language=' . $product_data['code'] : '';
        $date = $product_data['products_last_modified'] != NULL ? $product_data['products_last_modified'] : $product_data['products_date_added'];
        $string = sprintf(SITEMAP_ENTRY, htmlspecialchars(utf8_encode(vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($product_data['products_id'], $product_data['products_name']), 'NONSSL', false, SEARCH_ENGINE_FRIENDLY_URLS))), PRIORITY_PRODUCTS, iso8601_date($date), CHANGEFREQ_PRODUCTS);
        output($string);
        $strlen += strlen($string);
        $c++;
        if ($autogenerate) {
            // 500000 entrys or filesize > 10,485,760 - some space for the last entry
            if ($c == MAX_ENTRYS || $strlen >= MAX_SIZE) {
                output(SITEMAP_FOOTER);
                $function_close($fp);
                $c = 0;
                $i++;
                $fp = $function_open('sitemap' . $i . $file_extension, 'w');
                output(SITEMAP_HEADER);
                $strlen = strlen(SITEMAP_HEADER);
            }
        }
예제 #3
0
   Copyright (c) 2007 VaM Shop
   -----------------------------------------------------------------------------------------
   based on: 
   (c) 2006	 Andrew Berezin (ajaxAddQuickie.php,v 1.9 2003/08/17); zen-cart.com

   Released under the GNU General Public License 
   ---------------------------------------------------------------------------------------*/
//var_dump($_POST);echo '<br>';
define("AJAX_ADDQUICK_RESULT", 'text');
// dropdown or text
define("AJAX_ADDQUICK_DROPDOWN_SIZE", 5);
define("AJAX_ADDQUICK_LIMIT", 15);
$q = addslashes(preg_replace("%[^0-9a-zA-Zа-яА-Я\\s]%iu", "", $_REQUEST['quickie']));
$out = "";
if (isset($q) && vam_not_null($q)) {
    $model_query = vam_db_query("select pd.products_id, pd.products_name, p.products_model\n\t\t\t\t\t\t\tfrom " . TABLE_PRODUCTS_DESCRIPTION . " pd\n\t\t\t\t\t\t\tinner join " . TABLE_PRODUCTS . " p\n\t\t\t\t\t\t\ton (p.products_id = pd.products_id)\n\t\t\t\t\t\t\twhere p.products_model like '%" . $q . "%' \n\t\t\t\t\t\t\tand p.products_status = '1'\n\t\t\t\t\t\t\tand pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n\t\t\t\t\t\t\torder by pd.products_name asc\n\t\t\t\t\t\t\tlimit " . AJAX_ADDQUICK_LIMIT);
    if (vam_db_num_rows($model_query)) {
        $out .= sprintf(TEXT_AJAX_ADDQUICKIE_SEARCH_TOP, AJAX_ADDQUICK_LIMIT) . '<br />';
        $dropdown = array();
        $out .= '<ul class="ajaxAddQuickie">';
        while ($model = vam_db_fetch_array($model_query)) {
            $out .= '<li class="ajaxAddQuickie"><a href="' . vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($model['products_id'], $model['products_name']), 'NONSSL', false) . '">' . $model['products_name'] . '</a></li>' . "\n";
            $dropdown[] = array('id' => $model['products_id'], 'text' => $model['products_name']);
        }
        $out .= '</ul>' . "\n";
        if (AJAX_ADDQUICK_RESULT == 'dropdown') {
            $out .= vam_draw_pull_down_menu('AJAX_ADDQUICK_pid', $dropdown, '', 'onChange="this.form.submit();" size="' . AJAX_ADDQUICK_DROPDOWN_SIZE . '" class="ajaxAddQuickie"') . vam_hide_session_id();
        }
    }
}
echo $out;
$reviews_query = "select rd.reviews_text, r.reviews_rating, r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r left join " . TABLE_PRODUCTS . " p on (r.products_id = p.products_id) left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on (p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'), " . TABLE_REVIEWS_DESCRIPTION . " rd where r.reviews_id = '" . (int) $_GET['reviews_id'] . "' and r.reviews_id = rd.reviews_id and p.products_status = '1'";
$reviews_query = vam_db_query($reviews_query);
if (!vam_db_num_rows($reviews_query)) {
    vam_redirect(vam_href_link(FILENAME_REVIEWS));
}
$reviews = vam_db_fetch_array($reviews_query);
$breadcrumb->add(NAVBAR_TITLE_PRODUCT_REVIEWS, vam_href_link(FILENAME_PRODUCT_REVIEWS, $get_params));
vam_db_query("update " . TABLE_REVIEWS . " set reviews_read = reviews_read+1 where reviews_id = '" . $reviews['reviews_id'] . "'");
$reviews_text = vam_break_string(htmlspecialchars($reviews['reviews_text']), 60, '-<br />');
require DIR_WS_INCLUDES . 'header.php';
$vamTemplate->assign('PRODUCTS_NAME', $reviews['products_name']);
$vamTemplate->assign('AUTHOR', $reviews['customers_name']);
$vamTemplate->assign('DATE', vam_date_long($reviews['date_added']));
$vamTemplate->assign('REVIEWS_TEXT', nl2br($reviews_text));
$vamTemplate->assign('RATING', vam_image('templates/' . CURRENT_TEMPLATE . '/img/stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])));
$vamTemplate->assign('PRODUCTS_LINK', vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($reviews['products_id'], $reviews['products_name'])));
$vamTemplate->assign('BUTTON_BACK', '<a class="button" href="' . vam_href_link(FILENAME_PRODUCT_REVIEWS, $get_params) . '">' . vam_image_button('back.png', IMAGE_BUTTON_BACK) . '</a>');
$vamTemplate->assign('BUTTON_BUY_NOW', '<a class="button" href="' . vam_href_link(FILENAME_DEFAULT, 'action=buy_now&BUYproducts_id=' . $reviews['products_id']) . '">' . vam_image_button('buy.png', IMAGE_BUTTON_IN_CART) . '</a>');
$products_image = DIR_WS_THUMBNAIL_IMAGES . $reviews['products_image'];
if (!is_file($products_image)) {
    $products_image = DIR_WS_THUMBNAIL_IMAGES . '../noimage.gif';
}
$image = vam_image($products_image, $reviews['products_name'], '', '', 'hspace="5" vspace="5"');
$vamTemplate->assign('IMAGE', $image);
$vamTemplate->assign('language', $_SESSION['language']);
// set cache ID
if (!CacheCheck()) {
    $vamTemplate->caching = 0;
    $main_content = $vamTemplate->fetch(CURRENT_TEMPLATE . '/module/product_reviews_info.html');
} else {
    $vamTemplate->caching = 1;
예제 #5
0
 function buildDataArray(&$array, $image = 'thumbnail')
 {
     global $vamPrice, $main;
     $tax_rate = $vamPrice->TAX[$array['products_tax_class_id']];
     $products_price = $vamPrice->GetPrice($array['products_id'], $format = true, 1, $array['products_tax_class_id'], $array['products_price'], 1);
     if ($_SESSION['customers_status']['customers_status_show_price'] != '0') {
         if ($_SESSION['customers_status']['customers_fsk18'] == '1') {
             if ($array['products_fsk18'] == '0') {
                 $buy_now = $this->getBuyNowButton($array['products_id'], $array['products_name']);
                 $buy_now_new = $this->getBuyNowButtonNew($array['products_id'], $array['products_name']);
             }
         } else {
             $buy_now = $this->getBuyNowButton($array['products_id'], $array['products_name']);
             $buy_now_new = $this->getBuyNowButtonNew($array['products_id'], $array['products_name']);
         }
         $buy_now = $this->getBuyNowButton($array['products_id'], $array['products_name']);
     }
     $shipping_status_name = $main->getShippingStatusName($array['products_shippingtime']);
     $shipping_status_image = $main->getShippingStatusImage($array['products_shippingtime']);
     $extra_fields_query = vamDBquery("\n                      SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value\n                      FROM " . TABLE_PRODUCTS_EXTRA_FIELDS . " pef\n             LEFT JOIN  " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " ptf\n            ON ptf.products_extra_fields_id=pef.products_extra_fields_id\n            WHERE ptf.products_id=" . (int) $array['products_id'] . " and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='" . $_SESSION['languages_id'] . "')\n            ORDER BY products_extra_fields_order");
     while ($extra_fields = vam_db_fetch_array($extra_fields_query, true)) {
         if (!$extra_fields['status']) {
             // show only enabled extra field
             continue;
         }
         $extra_fields_data[] = array('NAME' => $extra_fields['name'], 'VALUE' => $extra_fields['value']);
     }
     return array('PRODUCTS_NAME' => vam_parse_input_field_data($array['products_name'], array('"' => '&quot;')), 'PRODUCTS_MODEL' => $array['products_model'], 'PRODUCTS_EAN' => $array['products_ean'], 'PRODUCTS_QUANTITY' => $array['products_quantity'], 'COUNT' => $array['ID'], 'REVIEWS_COUNT' => $this->getReviewsCount1($array['products_id']), 'EXTRA_FIELDS' => $extra_fields_data, 'PRODUCTS_ID' => $array['products_id'], 'PRODUCTS_VPE' => $this->getVPEtext($array, $products_price['plain']), 'PRODUCTS_IMAGE' => $this->productImage($array['products_image'], $image), 'PRODUCTS_LINK' => vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($array['products_id'], $array['products_name'])), 'PRODUCTS_PRICE' => $products_price['formated'], 'PRODUCTS_PRICE_PLAIN' => $products_price['plain'], 'PRODUCTS_TAX_INFO' => $main->getTaxInfo($tax_rate), 'PRODUCTS_SHIPPING_LINK' => $main->getShippingLink(), 'PRODUCTS_BUTTON_BUY_NOW' => $buy_now, 'PRODUCTS_BUTTON_BUY_NOW_NEW' => $buy_now_new, 'PRODUCTS_SHIPPING_NAME' => $shipping_status_name, 'PRODUCTS_SHIPPING_IMAGE' => $shipping_status_image, 'PRODUCTS_DESCRIPTION' => $array['products_description'], 'PRODUCTS_EXPIRES' => $array['expires_date'], 'PRODUCTS_CATEGORY_URL' => $array['cat_url'], 'PRODUCTS_SHORT_DESCRIPTION' => $array['products_short_description'], 'PRODUCTS_FSK18' => $array['products_fsk18'], 'CATEGORIES_NAME' => isset($array['categories_name']) ? $array['categories_name'] : "");
 }
   (c) 2004	 xt:Commerce (upcoming_products.php,v 1.7 2003/08/22); xt-commerce.com

   Released under the GNU General Public License 
   ---------------------------------------------------------------------------------------*/
$module = new vamTemplate();
$module->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
// include needed functions
require_once DIR_FS_INC . 'vam_date_short.inc.php';
$module_content = array();
//fsk18 lock
$fsk_lock = '';
if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') {
    $fsk_lock = ' and p.products_fsk18!=1';
}
if (GROUP_CHECK == 'true') {
    $group_check = "and p.group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
}
$expected_query = vamDBquery("select p.products_id,\n                                  pd.products_name,\n                                  products_date_available as date_expected from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                                  where to_days(products_date_available) >= to_days(now())\n                                  and p.products_id = pd.products_id\n                                  " . $group_check . "\n                                  " . $fsk_lock . "\n                                  and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n                                  order by " . EXPECTED_PRODUCTS_FIELD . " " . EXPECTED_PRODUCTS_SORT . "\n                                  limit " . MAX_DISPLAY_UPCOMING_PRODUCTS);
if (vam_db_num_rows($expected_query, true) > 0) {
    $row = 0;
    while ($expected = vam_db_fetch_array($expected_query, true)) {
        $row++;
        $module_content[] = array('PRODUCTS_LINK' => vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($expected['products_id'], $expected['products_name'])), 'PRODUCTS_NAME' => $expected['products_name'], 'PRODUCTS_DATE' => vam_date_short($expected['date_expected']));
    }
    $module->assign('language', $_SESSION['language']);
    $module->assign('module_content', $module_content);
    // set cache ID
    $module->caching = 0;
    $module = $module->fetch(CURRENT_TEMPLATE . '/module/upcoming_products.html');
    $default->assign('MODULE_upcoming_products', $module);
}
$customer_info_query = vam_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $_SESSION['customer_id'] . "'");
$customer_info = vam_db_fetch_array($customer_info_query);
require DIR_WS_INCLUDES . 'header.php';
if (!$product->isProduct()) {
    $vamTemplate->assign('error', ERROR_INVALID_PRODUCT);
} else {
    $name = $customer_info['customers_firstname'] . ' ' . $customer_info['customers_lastname'];
    if ($name == ' ') {
        $customer_info['customers_lastname'] = TEXT_GUEST;
    }
    $vamTemplate->assign('PRODUCTS_NAME', $product->data['products_name']);
    $vamTemplate->assign('AUTHOR', $customer_info['customers_firstname'] . ' ' . $customer_info['customers_lastname']);
    $vamTemplate->assign('INPUT_TEXT', vam_draw_textarea_field('review', 'soft', 60, 15, $_POST['review'], '', false));
    $input_rationg = '<td>' . vam_draw_radio_field('rating', '1') . '<br/><b>1</b></td><td>' . vam_draw_radio_field('rating', '2') . '<br/><b>2</b></td><td>' . vam_draw_radio_field('rating', '3') . '<br/><b>3</b></td><td>' . vam_draw_radio_field('rating', '4') . '<br/><b>4</b></td><td>' . vam_draw_radio_field('rating', '5') . '<br/><b>5</b></td>';
    $vamTemplate->assign('INPUT_RATING', $input_rationg);
    $vamTemplate->assign('FORM_ACTION', vam_draw_form('product_reviews_write', vam_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'action=process&' . vam_product_link($product->data['products_id'], $product->data['products_name'])), 'post', 'onsubmit="return checkForm();"'));
    $vamTemplate->assign('BUTTON_BACK', '<a class="button" href="javascript:history.back(1)">' . vam_image_button('back.png', IMAGE_BUTTON_BACK) . '</a>');
    $vamTemplate->assign('BUTTON_SUBMIT', vam_image_submit('submit.png', IMAGE_BUTTON_CONTINUE) . vam_draw_hidden_field('get_params', $get_params));
    $vamTemplate->assign('CAPTCHA_IMG', '<img src="' . vam_href_link(FILENAME_DISPLAY_CAPTCHA) . '" alt="captcha" name="captcha" />');
    $vamTemplate->assign('CAPTCHA_INPUT', vam_draw_input_field('captcha', '', 'size="6"', 'text', false));
    $vamTemplate->assign('FORM_END', '</form>');
}
$vamTemplate->assign('language', $_SESSION['language']);
$vamTemplate->caching = 0;
$main_content = $vamTemplate->fetch(CURRENT_TEMPLATE . '/module/product_reviews_write.html');
$vamTemplate->assign('language', $_SESSION['language']);
$vamTemplate->assign('main_content', $main_content);
$vamTemplate->caching = 0;
if (!defined(RM)) {
    $vamTemplate->load_filter('output', 'note');
}
$mark_stock = '';
for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
    if (STOCK_CHECK == 'true') {
        $mark_stock = vam_check_stock($products[$i]['id'], $products[$i]['quantity']);
        if ($mark_stock) {
            $_SESSION['any_out_of_stock'] = 1;
        }
    }
    $image = '';
    if ($products[$i]['image'] != '') {
        $image = DIR_WS_THUMBNAIL_IMAGES . $products[$i]['image'];
    }
    if (!is_file($image)) {
        $image = DIR_WS_THUMBNAIL_IMAGES . '../noimage.gif';
    }
    $module_content[$i] = array('PRODUCTS_NAME' => $products[$i]['name'] . $mark_stock, 'PRODUCTS_QTY' => vam_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="2" data-id="' . $products[$i]['id'] . '" class="quantity"') . vam_draw_hidden_field('products_id[]', $products[$i]['id']) . vam_draw_hidden_field('old_qty[]', $products[$i]['quantity']), 'PRODUCTS_MODEL' => $products[$i]['model'], 'PRODUCTS_SHIPPING_TIME' => $products[$i]['shipping_time'], 'PRODUCTS_TAX' => number_format($products[$i]['tax'], TAX_DECIMAL_PLACES), 'PRODUCTS_IMAGE' => $image, 'IMAGE_ALT' => $products[$i]['name'], 'BOX_DELETE' => $products[$i]['id'], 'PRODUCTS_LINK' => vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($products[$i]['id'], $products[$i]['name'])), 'PRODUCTS_PRICE' => $vamPrice->Format($products[$i]['price'] * $products[$i]['quantity'], true), 'PRODUCTS_SINGLE_PRICE' => $vamPrice->Format($products[$i]['price'], true), 'PRODUCTS_SHORT_DESCRIPTION' => vam_get_short_description($products[$i]['id']), 'ATTRIBUTES' => '');
    // Product options names
    $attributes_exist = isset($products[$i]['attributes']) ? 1 : 0;
    if ($attributes_exist == 1) {
        reset($products[$i]['attributes']);
        while (list($option, $value) = each($products[$i]['attributes'])) {
            if (ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true') {
                $attribute_stock_check = vam_check_stock_attributes($products[$i][$option]['products_attributes_id'], $products[$i]['quantity']);
                if ($attribute_stock_check) {
                    $_SESSION['any_out_of_stock'] = 1;
                }
            }
            $module_content[$i]['ATTRIBUTES'][] = array('ID' => $products[$i][$option]['products_attributes_id'], 'MODEL' => vam_get_attributes_model(vam_get_prid($products[$i]['id']), $products[$i][$option]['products_options_values_name'], $products[$i][$option]['products_options_name']), 'NAME' => $products[$i][$option]['products_options_name'], 'VALUE_NAME' => $products[$i][$option]['products_options_values_name'] . $attribute_stock_check);
        }
    }
}
// check if array key = first
if ($actual_key == 0) {
    // aktuel key = first product
} else {
    $prev_id = $actual_key - 1;
    $prev_link = vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($p_data[$prev_id]['pID'], $p_data[$prev_id]['pName']));
    // check if prev id = first
    if ($prev_id != 0) {
        $first_link = vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($p_data[0]['pID'], $p_data[0]['pName']));
    }
}
// check if key = last
if ($actual_key == sizeof($p_data) - 1) {
    // actual key is last
} else {
    $next_id = $actual_key + 1;
    $next_link = vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($p_data[$next_id]['pID'], $p_data[$next_id]['pName']));
    // check if next id = last
    if ($next_id != sizeof($p_data) - 1) {
        $last_link = vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($p_data[sizeof($p_data) - 1]['pID'], $p_data[sizeof($p_data) - 1]['pName']));
    }
}
$module->assign('FIRST', $first_link);
$module->assign('PREVIOUS', $prev_link);
$module->assign('NEXT', $next_link);
$module->assign('LAST', $last_link);
$module->assign('PRODUCTS_COUNT', count($p_data));
$module->assign('language', $_SESSION['language']);
$module->caching = 0;
$product_navigator = $module->fetch(CURRENT_TEMPLATE . '/module/product_navigator.html');
$info->assign('PRODUCT_NAVIGATOR', $product_navigator);
예제 #10
0
function vam_rss_products($sql_products)
{
    global $db, $rss, $random;
    $sql_maxdate = "select max(products_date_added) as max_date_added, max(products_last_modified) as max_date_modified\n\t\t\t\t\t\t\t\t\t\tfrom " . TABLE_PRODUCTS . "\n\t\t\t\t\t\t\t\t\t\twhere products_status = 1";
    $maxdate = vam_db_query($sql_maxdate);
    if (!$maxdate) {
        $rss->rss_feed_set('lastBuildDate', date('r', strtotime(max($maxdate['max_date_added'], $maxdate['max_date_modified']))));
    }
    if (isset($_GET['limit']) && (int) $_GET['limit'] > 0 && !$random) {
        $sql_products .= ' limit ' . (int) $_GET['limit'];
    }
    if ($random) {
        $products = vam_random_select($sql_products);
    } else {
        $products_query = vam_db_query($sql_products);
    }
    if ($random) {
        $products = vam_random_select($sql_products);
        $link = vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($products['products_id'], $products['products_name']) . (isset($_GET['ref']) ? '&ref=' . $_GET['ref'] : null), 'NONSSL', false);
        $rss->rss_feed_item($products['products_name'], $link, $link, date('r', strtotime(max($products['products_date_added'], $products['products_last_modified']))), $products['products_description'], $products['products_image'], vam_href_link(FILENAME_PRODUCT_REVIEWS_INFO, vam_product_link($products['products_id'], $products['products_name']) . (isset($_GET['ref']) ? '&ref=' . $_GET['ref'] : null), 'NONSSL', false));
    } else {
        $products_query = vam_db_query($sql_products);
        while ($products = vam_db_fetch_array($products_query)) {
            $link = vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($products['products_id'], $products['products_name']) . (isset($_GET['ref']) ? '&ref=' . $_GET['ref'] : null), 'NONSSL', false);
            $rss->rss_feed_item($products['products_name'], $link, $link, date('r', strtotime(max($products['products_date_added'], $products['products_last_modified']))), $products['products_description'], $products['products_image'], vam_href_link(FILENAME_PRODUCT_REVIEWS_INFO, vam_product_link($products['products_id'], $products['products_name']) . (isset($_GET['ref']) ? '&ref=' . $_GET['ref'] : null), 'NONSSL', false));
            if ($random) {
                break;
            }
        }
    }
    $rss->rss_feed_out();
}
예제 #11
0
$module = new vamTemplate();
$module->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
// include boxes
// include needed functions
require_once DIR_FS_INC . 'vam_row_number_format.inc.php';
require_once DIR_FS_INC . 'vam_date_short.inc.php';
$info->assign('options', $products_options_data);
if ($product->getReviewsCount() > 0) {
    if ($_SESSION['customers_status']['customers_status_write_reviews'] != 0) {
        $module->assign('BUTTON_WRITE', '<a class="button" href="' . vam_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, vam_product_link($product->data['products_id'], $product->data['products_name'])) . '">' . vam_image_button('add.png', IMAGE_BUTTON_WRITE_REVIEW) . '</a>');
    }
    $module->assign('language', $_SESSION['language']);
    $module->assign('module_content', $product->getReviews());
    $module->caching = 0;
    $module = $module->fetch(CURRENT_TEMPLATE . '/module/products_reviews.html');
    if ($_SESSION['customers_status']['customers_status_read_reviews'] != 0) {
        $info->assign('MODULE_products_reviews', $module);
    }
} else {
    if ($_SESSION['customers_status']['customers_status_write_reviews'] != 0) {
        $module->assign('BUTTON_WRITE', '<a class="button" href="' . vam_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, vam_product_link($product->data['products_id'], $product->data['products_name'])) . '">' . vam_image_button('add.png', IMAGE_BUTTON_WRITE_REVIEW) . '</a>');
    }
    $module->assign('TEXT_FIRST_REVIEW', TEXT_FIRST_REVIEW);
    $module->assign('language', $_SESSION['language']);
    $module->assign('module_content', $product->getReviews());
    $module->caching = 0;
    $module = $module->fetch(CURRENT_TEMPLATE . '/module/products_reviews.html');
    if ($_SESSION['customers_status']['customers_status_read_reviews'] != 0) {
        $info->assign('MODULE_products_reviews', $module);
    }
}
예제 #12
0
$random_product = vam_random_select($random_select);
if ($random_product) {
    // display random review box
    $review_query = "select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . $random_product['reviews_id'] . "' and languages_id = '" . $_SESSION['languages_id'] . "'";
    $review_query = vamDBquery($review_query);
    $review = vam_db_fetch_array($review_query, true);
    $review = htmlspecialchars($review['reviews_text']);
    $review = vam_break_string($review, 15, '-<br />');
    $products_image = DIR_WS_THUMBNAIL_IMAGES . $random_product['products_image'];
    if (!file_exists($products_image)) {
        $products_image = DIR_WS_THUMBNAIL_IMAGES . '../noimage.gif';
    }
    $box_content = '<p><a href="' . vam_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . vam_image($products_image, $random_product['products_name']) . '</a></p><a href="' . vam_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . $review . ' ..</a><p>' . vam_image('templates/' . CURRENT_TEMPLATE . '/img/stars_' . $random_product['reviews_rating'] . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating'])) . '</p>';
} elseif ($product->isProduct()) {
    // display 'write a review' box
    $box_content = '<p><a href="' . vam_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, vam_product_link($product->data['products_id'], $product->data['products_name'])) . '">' . vam_image('templates/' . CURRENT_TEMPLATE . '/img/box_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a></p><p><a href="' . vam_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, vam_product_link($product->data['products_id'], $product->data['products_name'])) . '">' . BOX_REVIEWS_WRITE_REVIEW . '</a></p>';
}
if ($box_content != '') {
    $box->assign('REVIEWS_LINK', vam_href_link(FILENAME_REVIEWS));
    $box->assign('BOX_CONTENT', $box_content);
    $box->assign('language', $_SESSION['language']);
    // set cache ID
    if (!CacheCheck()) {
        $box->caching = 0;
        $box_reviews = $box->fetch(CURRENT_TEMPLATE . '/boxes/box_reviews.html');
    } else {
        $box->caching = 1;
        $box->cache_lifetime = CACHE_LIFETIME;
        $box->cache_modified_check = CACHE_CHECK;
        $cache_id = $_SESSION['language'] . $random_product['reviews_id'] . $product->data['products_id'] . $_SESSION['language'];
        $box_reviews = $box->fetch(CURRENT_TEMPLATE . '/boxes/box_reviews.html', $cache_id);
예제 #13
0
     case "true":
         $available = YML_AVAILABLE;
         break;
 }
 $cbid = $bid = '';
 $products["yml_bid"] = max(!isset($products["yml_bid"]) ? 0 : $products["yml_bid"], $categories_bid[$products["categories_id"]]);
 if ($products["yml_bid"] > 0) {
     $bid = ' bid="' . $products["yml_bid"] . '"';
 }
 $products["yml_cbid"] = max(!isset($products["yml_cbid"]) ? 0 : $products["yml_cbid"], $categories_cbid[$products["categories_id"]]);
 if ($products["yml_cbid"] > 0) {
     $cbid = ' cbid="' . $products["yml_cbid"] . '"';
 }
 $price = $products['products_price'];
 $price = $vamPrice->GetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], $price);
 $url = vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($products['products_id'], $products['products_name']) . (isset($_GET['ref']) ? '&amp;ref=' . $_GET['ref'] : null) . $yml_referer, 'NONSSL', false);
 $available = ' available="' . $available . '"';
 vam_yml_out('<offer id="' . $products['products_id'] . '"' . $available . $bid . $cbid . '>');
 vam_yml_out('  <url>' . $url . '</url>');
 vam_yml_out('  <price>' . $price . '</price>');
 vam_yml_out('  <currencyId>' . $current_currency . '</currencyId>');
 vam_yml_out('  <categoryId>' . $products['categories_id'] . '</categoryId>');
 if ($display_all_categories) {
     $p2c_query = vam_db_query("SELECT categories_id\n                         FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                         WHERE products_id=" . (int) $products['products_id'] . "\n                           AND categories_id<>" . (int) $products['categories_id'] . "");
     while ($p2c = vam_db_fetch_array($p2c_query)) {
         vam_yml_out('  <categoryId>' . $p2c['categories_id'] . '</categoryId>');
     }
 }
 if (vam_not_null($products['products_image'])) {
     vam_yml_out('  <picture>' . HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_THUMBNAIL_IMAGES . urldecode($products['products_image']) . '</picture>');
 }
예제 #14
0
   (c) 2004	 xt:Commerce (order_history.php,v 1.9 2003/08/13); xt-commerce.com 

   Released under the GNU General Public License 
   ---------------------------------------------------------------------------------------*/
$box = new vamTemplate();
$box->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
$box_content = '';
// include needed functions
require_once DIR_FS_INC . 'vam_get_all_get_params.inc.php';
if (isset($_SESSION['customer_id'])) {
    // retreive the last x products purchased
    $orders_query = vam_db_query("select distinct op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p where o.customers_id = '" . (int) $_SESSION['customer_id'] . "' and o.orders_id = op.orders_id and op.products_id = p.products_id and p.products_status = '1' group by products_id order by o.date_purchased desc limit " . MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX);
    if (vam_db_num_rows($orders_query)) {
        $product_ids = '';
        while ($orders = vam_db_fetch_array($orders_query)) {
            $product_ids .= $orders['products_id'] . ',';
        }
        $product_ids = substr($product_ids, 0, -1);
        $customer_orders_string = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
        $products_query = vam_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $product_ids . ") and language_id = '" . (int) $_SESSION['languages_id'] . "' order by products_name");
        while ($products = vam_db_fetch_array($products_query)) {
            $customer_orders_string .= '  <tr>' . '    <td class="infoBoxContents"><a href="' . vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($products['products_id'], $products['products_name'])) . '">' . $products['products_name'] . '</a></td>' . '    <td class="infoBoxContents" align="right" valign="top"><a href="' . vam_href_link(basename($PHP_SELF), vam_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $products['products_id']) . '">' . vam_image(DIR_WS_ICONS . 'cart.gif', ICON_CART) . '</a></td>' . '  </tr>';
        }
        $customer_orders_string .= '</table>';
    }
}
$box->assign('BOX_CONTENT', $customer_orders_string);
$box->caching = 0;
$box->assign('language', $_SESSION['language']);
$box_order_history = $box->fetch(CURRENT_TEMPLATE . '/boxes/box_order_history.html');
$vamTemplate->assign('box_HISTORY', $box_order_history);
예제 #15
0
                $attributes = vam_db_query("select popt.products_options_name, popt.products_options_type, poval.products_options_values_name, pa.options_values_price, pa.price_prefix,pa.attributes_stock,pa.products_attributes_id,pa.attributes_model , pa.options_values_id\n\t\t\t\t                                      from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n\t\t\t\t                                      where pa.products_id = '" . $products[$i]['id'] . "'\n\t\t\t\t                                       and pa.options_id = '" . $option . "'\n\t\t\t\t                                       and pa.options_id = popt.products_options_id\n\t\t\t\t                                       and pa.options_values_id = '" . $value . "'\n\t\t\t\t                                       and pa.options_values_id = poval.products_options_values_id\n\t\t\t\t                                       and popt.language_id = '" . (int) $_SESSION['languages_id'] . "'\n\t\t\t\t                                       and poval.language_id = '" . (int) $_SESSION['languages_id'] . "'");
                $attributes_values = vam_db_fetch_array($attributes);
                if ($attributes_values['products_options_type'] == '2' || $attributes_values['products_options_type'] == '3') {
                    $hidden_options .= vam_draw_hidden_field('id[' . $products[$i]['id'] . '][txt_' . $option . '_' . $value . ']', $products[$i]['attributes_values'][$option]);
                    $attr_value = $products[$i]['attributes_values'][$option];
                } else {
                    $hidden_options .= vam_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
                    $attr_value = $attributes_values['products_options_values_name'];
                }
                $product_attributes[$option]['NAME'] = $attributes_values['products_options_name'];
                $product_attributes[$option]['VALUE'] = $attributes_values['products_options_values_name'];
                $product_attributes_in_cart .= vam_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $attributes_values['options_values_id']);
            }
        }
        // Push all attributes information in an array
        $products_in_cart[] = array('QTY' => $products[$i]['quantity'], 'PRICE' => $products[$i]['price'] * $products[$i]['quantity'], 'LINK' => vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($products[$i]['id'], $products[$i]['name'])), 'PRODUCTS_QTY' => $product_attributes_in_cart . vam_draw_hidden_field('cart_quantity[]', $products[$i]['quantity'] - 1) . vam_draw_hidden_field('products_id[]', $products[$i]['id']) . vam_draw_hidden_field('old_qty[]', $products[$i]['quantity']) . ($products[$i]['quantity'] < 2 ? vam_draw_hidden_field('cart_delete[]', $products[$i]['id']) : ''), 'ATTRIBUTES' => $product_attributes, 'NAME' => $products[$i]['name']);
    }
    $box->assign('PRODUCTS', $qty);
    $box->assign('empty', 'false');
} else {
    // cart empty
    $box->assign('empty', 'true');
}
if ($_SESSION['cart']->count_contents() > 0) {
    $total = $_SESSION['cart']->show_total();
    if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount'] != '0.00') {
        if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
            $price = $total - $_SESSION['cart']->show_tax(false);
        } else {
            $price = $total;
        }