Ejemplo n.º 1
0
if ($_GET['products_id']) {
    $xsell_query = smn_db_query("select distinct p.store_id, p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.store_id = '" . $store_id . "' and  xp.products_id = '" . $_GET['products_id'] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and p.products_status = '1' order by xp.products_id asc limit " . MAX_DISPLAY_ALSO_PURCHASED);
    $num_products_xsell = smn_db_num_rows($xsell_query);
    if ($num_products_xsell >= MIN_DISPLAY_XSELL) {
        ?>
 
<!-- xsell_products //-->
<?php 
        $info_box_contents = array();
        $info_box_contents[] = array('align' => 'left', 'text' => TEXT_XSELL_PRODUCTS);
        new contentBoxHeading($info_box_contents);
        $row = 0;
        $col = 0;
        $info_box_contents = array();
        while ($xsell = smn_db_fetch_array($xsell_query)) {
            $xsell['specials_new_products_price'] = smn_get_products_special_price($xsell['products_id']);
            $store_images = 'images/' . $xsell['store_id'] . '_images/';
            if ($xsell['specials_new_products_price']) {
                $xsell_price = '<s>' . $currencies->display_price($xsell['products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id'])) . '</s><br>';
                $xsell_price .= '<span class="productSpecialPrice">' . $currencies->display_price($xsell['specials_new_products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id'])) . '</span>';
            } else {
                $xsell_price = $currencies->display_price($xsell['products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id']));
            }
            $info_box_contents[$row][$col] = array('text' => '<TABLE><TR><TD align="center" class="infoBoxContents" width="100"><div align="left">
 					    <a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $xsell['store_id'] . '&products_id=' . $xsell['products_id']) . '">' . smn_image($store_images . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></TD><TD class="infoBoxContents">
					    <a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $xsell['store_id'] . '&products_id=' . $xsell['products_id']) . '</a><br>' . TEXT_PRICE_SOLO . '<br>' . $currencies->display_price($xsell['products_price'], smn_get_tax_rate($xsell['products_tax_class_id'], '', '', $xsell['store_id'])) . '</div></td></tr></table>');
            $col++;
            if ($col > 0) {
                $col = 0;
                $row++;
            }
Ejemplo n.º 2
0
  This source file is subject to version 2.0 of the GPL license,   
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
if ($random_product = smn_random_select("select store_id, products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where store_id = '" . $store_id . "' and products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
    $boxHeading = BOX_HEADING_WHATS_NEW;
    $corner_left = 'square';
    $corner_right = 'square';
    $boxContent_attributes = ' align="center"';
    $boxLink = '<a href="' . smn_href_link(FILENAME_PRODUCTS_NEW) . '"><img src="images/infobox/arrow_right.gif" border="0" alt="more" title=" more " width="12" height="10"></a>';
    $box_base_name = 'whats_new';
    $box_id = $box_base_name . 'Box';
    $random_product['products_name'] = smn_get_products_name($random_product['products_id']);
    $random_product['specials_new_products_price'] = smn_get_products_special_price($random_product['products_id']);
    $store_images = 'images/' . $random_product['store_id'] . '_images/';
    if (smn_not_null($random_product['specials_new_products_price'])) {
        $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], smn_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
        $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], smn_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
    } else {
        $whats_new_price = $currencies->display_price($random_product['products_price'], smn_get_tax_rate($random_product['products_tax_class_id']));
    }
    $boxContent = '<a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $random_product['store_id'] . '&products_id=' . $random_product['products_id']) . '">' . smn_image($store_images . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . smn_href_link(FILENAME_PRODUCT_INFO, 'ID=' . $random_product['store_id'] . '&products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price;
    if (file_exists(DIR_WS_BOX_TEMPLATES . $box_base_name . '.php')) {
        require DIR_WS_BOX_TEMPLATES . $box_base_name . '.php';
    } else {
        require DEFAULT_TEMPLATENAME_BOX;
    }
    $boxContent_attributes = '';
    $boxLink = '';
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
global $page_name;
if (isset($_GET['reviews_id']) && smn_not_null($_GET['reviews_id']) && isset($_GET['products_id']) && smn_not_null($_GET['products_id'])) {
    $review_check_query = smn_db_query("select count(*) as total from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.reviews_id = '" . (int) $_GET['reviews_id'] . "' and r.products_id = '" . (int) $_GET['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "'");
    $review_check = smn_db_fetch_array($review_check_query);
    if ($review_check['total'] < 1) {
        smn_redirect(smn_href_link(FILENAME_PRODUCT_REVIEWS, smn_get_all_get_params(array('reviews_id'))));
    }
} else {
    smn_redirect(smn_href_link(FILENAME_PRODUCT_REVIEWS, smn_get_all_get_params(array('reviews_id'))));
}
smn_db_query("update " . TABLE_REVIEWS . " set reviews_read = reviews_read+1 where reviews_id = '" . (int) $_GET['reviews_id'] . "'");
/* Changed the query to get store id from the DB by Cimi on June 08,2007*/
/*$review_query = smn_db_query("select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where r.reviews_id = '" . (int)$_GET['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '". (int)$languages_id . "'");*/
$review_query = smn_db_query("select rd.reviews_text, r.reviews_rating, r.reviews_id, r.customers_name, r.date_added, r.reviews_read,p.store_id, p.products_id, p.products_price, p.products_tax_class_id, p.products_image, p.products_model, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where r.reviews_id = '" . (int) $_GET['reviews_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $languages_id . "' and r.products_id = p.products_id and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "'");
$review = smn_db_fetch_array($review_query);
if ($new_price = smn_get_products_special_price($review['products_id'])) {
    $products_price = '<s>' . $currencies->display_price($review['products_price'], smn_get_tax_rate($review['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, smn_get_tax_rate($review['products_tax_class_id'])) . '</span>';
} else {
    $products_price = $currencies->display_price($review['products_price'], smn_get_tax_rate($review['products_tax_class_id']));
}
if (smn_not_null($review['products_model'])) {
    $products_name = $review['products_name'] . '<br><span class="smallText">[' . $review['products_model'] . ']</span>';
} else {
    $products_name = $review['products_name'];
}
$breadcrumb->add(NAVBAR_TITLE, smn_href_link(FILENAME_PRODUCT_REVIEWS, smn_get_all_get_params()));
$customer = smn_db_fetch_array($customer_query);
if (isset($_GET['action']) && $_GET['action'] == 'process') {
    $rating = smn_db_prepare_input($_POST['rating']);
    $review = smn_db_prepare_input($_POST['review']);
    $error = false;
    if (strlen($review) < REVIEW_TEXT_MIN_LENGTH) {
        $error = true;
        $messageStack->add('review', JS_REVIEW_TEXT);
    }
    if ($rating < 1 || $rating > 5) {
        $error = true;
        $messageStack->add('review', JS_REVIEW_RATING);
    }
    if ($error == false) {
        smn_db_query("insert into " . TABLE_REVIEWS . " (products_id, customers_id, customers_name, reviews_rating, date_added) values ('" . (int) $_GET['products_id'] . "', '" . (int) $customer_id . "', '" . smn_db_input($customer['customers_firstname']) . ' ' . smn_db_input($customer['customers_lastname']) . "', '" . smn_db_input($rating) . "', now())");
        $insert_id = smn_db_insert_id();
        smn_db_query("insert into " . TABLE_REVIEWS_DESCRIPTION . " (reviews_id, languages_id, reviews_text) values ('" . (int) $insert_id . "', '" . (int) $languages_id . "', '" . smn_db_input($review) . "')");
        smn_redirect(smn_href_link(FILENAME_PRODUCT_REVIEWS, smn_get_all_get_params(array('action'))));
    }
}
if ($new_price = smn_get_products_special_price($product_info['products_id'])) {
    $products_price = '<s>' . $currencies->display_price($product_info['products_price'], smn_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, smn_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {
    $products_price = $currencies->display_price($product_info['products_price'], smn_get_tax_rate($product_info['products_tax_class_id']));
}
if (smn_not_null($product_info['products_model'])) {
    $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
} else {
    $products_name = $product_info['products_name'];
}
$breadcrumb->add(NAVBAR_TITLE, smn_href_link(FILENAME_PRODUCT_REVIEWS, smn_get_all_get_params()));