Example #1
0
//              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//              GNU General Public License for more details.
//
//              You should have received a copy of the GNU General Public License
//              along with XOS-Shop.  If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
// this file is based on:
//              osCommerce, Open Source E-Commerce Solutions
//              http://www.oscommerce.com
//              Copyright (c) 2003 osCommerce
//              filename: specials.php
//
//              Released under the GNU General Public License
////////////////////////////////////////////////////////////////////////////////
if (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/includes/boxes/specials.php') == 'overwrite_all')) {
    if ($random_product = xos_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s, " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where c.categories_or_pages_status = '1' and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and s.status = '1' and s.customers_group_id = '" . $customer_group_id . "' order by p.products_date_added DESC limit " . MAX_RANDOM_SELECT_SPECIALS)) {
        $products_prices = xos_get_product_prices($random_product['products_price']);
        $products_tax_rate = xos_get_tax_rate($random_product['products_tax_class_id']);
        $specials_price_breaks_array = array();
        if (isset($products_prices[$customer_group_id][0])) {
            $specials_product_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate);
            $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $specials_product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($specials_product_price_special = '');
            $sizeof = count($products_prices[$customer_group_id]);
            /*      
                  if ($sizeof > 2) {
                    $array_keys = array_keys($products_prices[$customer_group_id]);
                    for ($count=2, $n=$sizeof; $count<$n; $count++) {
                      $qty = $array_keys[$count];
                      $specials_price_breaks_array[]=array('qty' => $qty,
                                                           'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate),
                                                           'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : '');
Example #2
0
function xos_banner_exists($action, $identifier)
{
    if ($action == 'dynamic') {
        return xos_random_select("select b.banners_id, bc.banners_title, bc.banners_url, bc.banners_image, bc.banners_html_text, bc.banners_php_source from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_CONTENT . " bc where b.banners_id = bc.banners_id and bc.language_id = '" . (int) $_SESSION['languages_id'] . "' and status = '1' and b.banners_group = '" . $identifier . "'");
    } elseif ($action == 'static') {
        $banner_query = xos_db_query("select b.banners_id, bc.banners_title, bc.banners_url, bc.banners_image, bc.banners_html_text, bc.banners_php_source from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_CONTENT . " bc where b.banners_id = bc.banners_id and bc.language_id = '" . (int) $_SESSION['languages_id'] . "' and status = '1' and b.banners_id = '" . (int) $identifier . "'");
        return xos_db_fetch_array($banner_query);
    } else {
        return false;
    }
}
Example #3
0
//              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//              GNU General Public License for more details.
//
//              You should have received a copy of the GNU General Public License
//              along with XOS-Shop.  If not, see <http://www.gnu.org/licenses/>.
//------------------------------------------------------------------------------
// this file is based on:
//              osCommerce, Open Source E-Commerce Solutions
//              http://www.oscommerce.com
//              Copyright (c) 2003 osCommerce
//              filename: whats_new.php
//
//              Released under the GNU General Public License
////////////////////////////////////////////////////////////////////////////////
if (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/includes/boxes/whats_new.php') == 'overwrite_all')) {
    if ($random_product = xos_random_select("select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES_OR_PAGES . " c where p.products_status=1 and p.products_id = p2c.products_id and c.categories_or_pages_id = p2c.categories_or_pages_id and c.categories_or_pages_status = '1' and p.products_date_added > '" . date("Y-m-d", mktime(1, 1, 1, date("m"), date("d") - INTERVAL_DAYS_BACK, date("Y"))) . "' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
        $products_prices = xos_get_product_prices($random_product['products_price']);
        $products_tax_rate = xos_get_tax_rate($random_product['products_tax_class_id']);
        $whats_new_price_breaks_array = array();
        if (isset($products_prices[$customer_group_id][0])) {
            $whats_new_price = $currencies->display_price($products_prices[$customer_group_id][0]['regular'], $products_tax_rate);
            $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][0]['special'] > 0 ? $whats_new_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($whats_new_price_special = '');
            $sizeof = count($products_prices[$customer_group_id]);
            /*      
                  if ($sizeof > 2) {
                    $array_keys = array_keys($products_prices[$customer_group_id]);
                    for ($count=2, $n=$sizeof; $count<$n; $count++) {
                      $qty = $array_keys[$count];
                      $whats_new_price_breaks_array[]=array('qty' => $qty,
                                                            'price_break' => $currencies->display_price($products_prices[$customer_group_id][$qty]['regular'], $products_tax_rate),
                                                            'price_break_special' => $products_prices[$customer_group_id]['special_status'] == 1 && $products_prices[$customer_group_id][$qty]['special'] > 0 ? $currencies->display_price($products_prices[$customer_group_id][$qty]['special'], $products_tax_rate) : '');
Example #4
0
////////////////////////////////////////////////////////////////////////////////
if (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/includes/boxes/reviews.php') == 'overwrite_all')) {
    $allowed = true;
    if (isset($_GET['p'])) {
        $allowed_product_query = xos_db_query("select p.products_id total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES_OR_PAGES . " c where p.products_id = '" . (int) $_GET['p'] . "' and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and c.categories_or_pages_status = '1' and p.products_status = '1'");
        if (!xos_db_num_rows($allowed_product_query)) {
            $allowed = false;
        }
    }
    if ($allowed == true) {
        $random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES_OR_PAGES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where c.categories_or_pages_status='1' and p.products_id = p2c.products_id and p2c.categories_or_pages_id = c.categories_or_pages_id and p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int) $_SESSION['languages_id'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'";
        if (isset($_GET['p'])) {
            $random_select .= " and p.products_id = '" . (int) $_GET['p'] . "'";
        }
        $random_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS;
        $random_product = xos_random_select($random_select);
        if ($random_product) {
            // display random review box
            $rand_review_query = xos_db_query("select substring(reviews_text, 1, 70) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int) $random_product['reviews_id'] . "' and languages_id = '" . (int) $_SESSION['languages_id'] . "'");
            $rand_review = xos_db_fetch_array($rand_review_query);
            $rand_review_text = xos_break_string(xos_output_string_protected($rand_review['reviews_text']), 20, '-<br />');
            $random_review_product_image = xos_get_product_images($random_product['products_image']);
            $smarty->assign(array('box_reviews_link_filename_product_reviews_info' => xos_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'p=' . $random_product['products_id'] . '&r=' . $random_product['reviews_id']), 'box_reviews_product_image' => xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($random_review_product_image['name']), $random_product['products_name']), 'box_reviews_review_text' => strip_tags($rand_review_text), 'box_reviews_stars_image' => xos_image(DIR_WS_IMAGES . 'catalog/templates/' . SELECTED_TPL . '/stars_' . $random_product['reviews_rating'] . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating']))));
        } elseif (isset($_GET['p'])) {
            // display 'write a review' box
            $smarty->assign(array('box_reviews_link_filename_product_reviews_write' => xos_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'p=' . $_GET['p'], 'SSL'), 'box_reviews_write_review_image' => xos_image(DIR_WS_IMAGES . 'catalog/templates/' . SELECTED_TPL . '/box_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW)));
        }
        $smarty->assign('box_reviews_link_filename_reviews', xos_href_link(FILENAME_REVIEWS));
        $output_reviews = $smarty->fetch(SELECTED_TPL . '/includes/boxes/reviews.tpl');
        $smarty->assign('box_reviews', $output_reviews);
    }