break;
         case 'PRODUCT_LIST_MANUFACTURER':
             $table_inner_array[] = array('case' => 'manufacturer', 'manufacturers_name' => $listing['manufacturers_name'], 'manufacturers_link' => xos_href_link(FILENAME_DEFAULT, 'm=' . $listing['manufacturers_id']));
             break;
         case 'PRODUCT_LIST_PRICE':
             $popup_content_id = xos_get_delivery_times_values($listing['products_delivery_time_id'], 'popup_content_id');
             $table_inner_array[] = array('case' => 'price', 'price_breaks' => $price_breaks, 'products_id' => $listing['products_id'], 'products_delivery_time' => xos_get_delivery_times_values($listing['products_delivery_time_id']), 'link_filename_popup_content_products_delivery_time' => $popup_content_id > 0 ? xos_href_link(FILENAME_POPUP_CONTENT, 'co=' . $popup_content_id . '&p=' . $listing['products_id'], $request_type) : '', 'tax_description' => xos_get_products_tax_description($listing['products_tax_class_id'], $products_tax_rate), 'price' => $product_price, 'price_special' => $product_price_special, 'price_breaks' => $price_breaks_array);
             break;
         case 'PRODUCT_LIST_QUANTITY':
             $table_inner_array[] = array('case' => 'quantity', 'products_quantity' => $listing['products_quantity'] > 0 ? $listing['products_quantity'] : '<span class="red-mark">' . $listing['products_quantity'] . '</span>');
             break;
         case 'PRODUCT_LIST_WEIGHT':
             $table_inner_array[] = array('case' => 'weight', 'products_weight' => $listing['products_weight']);
             break;
         case 'PRODUCT_LIST_IMAGE':
             $products_image_name = xos_get_product_images($listing['products_image']);
             if (!empty($_GET['m'])) {
                 $table_inner_array[] = array('case' => 'image', 'products_image_small' => xos_lazy_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($products_image_name['name']), $listing['products_name'], '', '', 'class="img-responsive center-block lazy" style="display: none;"') . '<noscript>' . xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($products_image_name['name']), $listing['products_name'], '', '', 'class="img-responsive center-block"') . '</noscript>', 'products_image_medium' => xos_lazy_image(DIR_WS_IMAGES . 'products/medium/' . rawurlencode($products_image_name['name']), $listing['products_name'], '', '', 'class="img-responsive center-block lazy" style="display: none;"') . '<noscript>' . xos_image(DIR_WS_IMAGES . 'products/medium/' . rawurlencode($products_image_name['name']), $listing['products_name'], '', '', 'class="img-responsive center-block"') . '</noscript>', 'products_link_image' => xos_href_link(FILENAME_PRODUCT_INFO, 'm=' . $_GET['m'] . '&p=' . $listing['products_id']));
             } else {
                 $table_inner_array[] = array('case' => 'image', 'products_image_small' => xos_lazy_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($products_image_name['name']), $listing['products_name'], '', '', 'class="img-responsive center-block lazy" style="display: none;"') . '<noscript>' . xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($products_image_name['name']), $listing['products_name'], '', '', 'class="img-responsive center-block"') . '</noscript>', 'products_image_medium' => xos_lazy_image(DIR_WS_IMAGES . 'products/medium/' . rawurlencode($products_image_name['name']), $listing['products_name'], '', '', 'class="img-responsive center-block lazy" style="display: none;"') . '<noscript>' . xos_image(DIR_WS_IMAGES . 'products/medium/' . rawurlencode($products_image_name['name']), $listing['products_name'], '', '', 'class="img-responsive center-block"') . '</noscript>', 'products_link_image' => xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . $listing['products_id']));
             }
             $smarty->assign('product_image', true);
             break;
         case 'PRODUCT_LIST_BUY_NOW':
             $table_inner_array[] = array('case' => 'buy_now', 'products_buy_form_begin' => xos_draw_form('cart_quantity_' . $rows, xos_href_link(basename($_SERVER['PHP_SELF']), xos_get_all_get_params(array('action')) . 'action=add_product', $request_type)), 'form_name' => 'cart_quantity_' . $rows, 'form_end' => '</form>', 'label_for_products_input_quantity' => 'products_quantity_' . $listing['products_id'], 'products_input_quantity' => xos_draw_input_field('products_quantity', '1', 'id="products_quantity_' . $listing['products_id'] . '" class="form-control input-quantity" maxlength="5"'), 'products_hidden_field' => xos_draw_hidden_field('p', $listing['products_id']));
             break;
     }
 }
 $table_outer_array[] = array('table_inner' => $table_inner_array);
 unset($price_breaks_array);
 unset($table_inner_array);
                                                                    '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) : '');
                                }       
                              }
                    */
                } else {
                    $xsell_product_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
                    $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $xsell_product_price_special = $currencies->display_price($products_prices[0][0]['special'], $products_tax_rate) : ($xsell_product_price_special = '');
                    $sizeof = count($products_prices[0]);
                    /*          
                              if ($sizeof > 2) {      
                                $array_keys = array_keys($products_prices[0]);
                                for ($count=2, $n=$sizeof; $count<$n; $count++) {
                                  $qty = $array_keys[$count];
                                  $xsell_price_breaks_array[]=array('qty' => $qty,
                                                                    'price_break' => $currencies->display_price($products_prices[0][$qty]['regular'], $products_tax_rate),
                                                                    'price_break_special' => $products_prices[0]['special_status'] == 1 && $products_prices[0][$qty]['special'] > 0 ? $currencies->display_price($products_prices[0][$qty]['special'], $products_tax_rate) : '');                                      
                                }                                           
                              } 
                    */
                }
                $xsell_products_image = xos_get_product_images($xsell['products_image']);
                $xsell_products_array[] = array('link_filename_product_info' => xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . $xsell['products_id']), 'image' => xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($xsell_products_image['name']), $xsell['products_name']), 'info' => $xsell['products_info'], 'price' => $xsell_product_price, 'price_special' => $xsell_product_price_special, 'price_breaks' => $xsell_price_breaks_array, 'tax_description' => xos_get_products_tax_description($xsell['products_tax_class_id'], $products_tax_rate), 'name' => $xsell['products_name']);
            }
            $smarty->assign('xsell_products', $xsell_products_array);
            $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'xsell_products');
            $output_xsell_products = $smarty->fetch(SELECTED_TPL . '/includes/modules/xsell_products.tpl');
            $smarty->clearAssign('xsell_products');
            $smarty->assign('xsell_products', $output_xsell_products);
        }
    }
}
Example #3
0
                        $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) : '');
                    }
                }
            } else {
                $product_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
                $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $product_price_special = $currencies->display_price($products_prices[0][0]['special'], $products_tax_rate) : ($product_price_special = '');
                $sizeof = count($products_prices[0]);
                if ($sizeof > 2) {
                    $array_keys = array_keys($products_prices[0]);
                    for ($count = 2, $n = $sizeof; $count < $n; $count++) {
                        $qty = $array_keys[$count];
                        $price_breaks_array[] = array('qty' => $qty, 'price_break' => $currencies->display_price($products_prices[0][$qty]['regular'], $products_tax_rate), 'price_break_special' => $products_prices[0]['special_status'] == 1 && $products_prices[0][$qty]['special'] > 0 ? $currencies->display_price($products_prices[0][$qty]['special'], $products_tax_rate) : '');
                    }
                }
            }
            $product_image = xos_get_product_images($products_new['products_image']);
            $popup_content_id = xos_get_delivery_times_values($products_new['products_delivery_time_id'], 'popup_content_id');
            $products_new_array[] = array('link_filename_product_info' => xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . $products_new['products_id']), 'href_buy_now' => xos_href_link(FILENAME_PRODUCTS_NEW, xos_get_all_get_params(array('action')) . 'action=buy_now&p=' . $products_new['products_id']), 'date_added' => xos_date_long($products_new['products_date_added']), 'image' => xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($product_image['name']), $products_new['products_name'], '', '', 'class="img-responsive"'), 'td_width_img' => SMALL_PRODUCT_IMAGE_MAX_WIDTH + 10, 'manufacturer' => $products_new['manufacturers_name'], 'tax_description' => xos_get_products_tax_description($products_new['products_tax_class_id'], $products_tax_rate), 'products_delivery_time' => xos_get_delivery_times_values($products_new['products_delivery_time_id']), 'link_filename_popup_content_products_delivery_time' => $popup_content_id > 0 ? xos_href_link(FILENAME_POPUP_CONTENT, 'co=' . $popup_content_id . '&p=' . $products_new['products_id'], $request_type) : '', 'price' => $product_price, 'price_special' => $product_price_special, 'price_breaks' => $price_breaks_array, 'info' => $products_new['products_info'], 'products_p_unit' => $products_new['products_p_unit'], 'products_model' => $products_new['products_model'], 'products_quantity' => $products_new['products_quantity'], 'name' => $products_new['products_name']);
            unset($price_breaks_array);
        }
        if (PREV_NEXT_BAR_LOCATION == '1' || PREV_NEXT_BAR_LOCATION == '3') {
            $smarty->assign('nav_bar_top', true);
        }
        if (PREV_NEXT_BAR_LOCATION == '2' || PREV_NEXT_BAR_LOCATION == '3') {
            $smarty->assign('nav_bar_bottom', true);
        }
        $smarty->assign('new_products', true);
    }
    $smarty->assign(array('nav_bar_number' => $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW), 'nav_bar_result' => '<nav><ul class="pagination">' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, xos_get_all_get_params(array('page', 'info', 'lnc', 'cur', 'tpl', 'x', 'y'))) . '</ul></nav>', 'interval_days_back' => INTERVAL_DAYS_BACK, 'products_new' => $products_new_array));
    $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'products_new');
}
if (!$is_shop) {
    xos_redirect(xos_href_link(FILENAME_DEFAULT), false);
} elseif (!(@(include DIR_FS_SMARTY . 'catalog/templates/' . SELECTED_TPL . '/php/' . FILENAME_PRODUCT_REVIEWS_WRITE) == 'overwrite_all')) {
    if (PRODUCT_REVIEWS_ENABLED != 'true') {
        xos_redirect(xos_href_link(FILENAME_DEFAULT), false);
    } elseif (!isset($_SESSION['customer_id'])) {
        $_SESSION['navigation']->remove_current_page();
        $_SESSION['navigation']->set_snapshot();
        xos_redirect(xos_href_link(FILENAME_LOGIN, '', 'SSL'));
    }
    $product_info_query = xos_db_query("select p.products_id, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, pd.products_name, pd.products_p_unit from " . 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_id = '" . (int) $_GET['p'] . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'");
    if (!xos_db_num_rows($product_info_query)) {
        xos_redirect(xos_href_link(FILENAME_PRODUCT_REVIEWS, xos_get_all_get_params(array('action'))), false);
    } else {
        $product_info = xos_db_fetch_array($product_info_query);
        $products_image_name = xos_get_product_images($product_info['products_image'], 'all');
    }
    $customer_query = xos_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $_SESSION['customer_id'] . "'");
    $customer = xos_db_fetch_array($customer_query);
    if (isset($_GET['action']) && $_GET['action'] == 'process' && isset($_POST['formid']) && $_POST['formid'] == $_SESSION['sessiontoken']) {
        $rating = xos_db_prepare_input($_POST['rating']);
        $review = xos_db_prepare_input(substr(strip_tags($_POST['review']), 0, 1000));
        $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);
        }
Example #5
0
 require DIR_WS_INCLUDES . 'html_header.php';
 require DIR_WS_INCLUDES . 'boxes.php';
 require DIR_WS_INCLUDES . 'header.php';
 require DIR_WS_INCLUDES . 'footer.php';
 if (CACHE_LEVEL > 2 && (isset($_COOKIE[session_name()]) && !isset($_GET[session_name()]) || SESSION_FORCE_COOKIE_USE == 'true')) {
     $smarty->caching = 1;
     $cache_id = 'L3|cc_reviews|' . $_SESSION['language'] . '-' . $_GET['lnc'] . '-' . $_GET[session_name()] . '-' . $session_started . '-' . SELECTED_TPL . '-' . $_SESSION['currency'];
 }
 if (!$smarty->isCached(SELECTED_TPL . '/reviews.tpl', $cache_id)) {
     $reviews_query_raw = "select r.reviews_id, left(rd.reviews_text, 100) as reviews_text, r.reviews_rating, r.date_added, p.products_id, pd.products_name, p.products_image, r.customers_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 p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "' and rd.languages_id = '" . (int) $_SESSION['languages_id'] . "' order by r.reviews_id DESC";
     $reviews_split = new splitPageResults($reviews_query_raw, MAX_DISPLAY_NEW_REVIEWS);
     if ($reviews_split->number_of_rows > 0) {
         $reviews_query = xos_db_query($reviews_split->sql_query);
         $reviews_array = array();
         while ($reviews = xos_db_fetch_array($reviews_query)) {
             $product_image = xos_get_product_images($reviews['products_image']);
             $reviews_array[] = array('link_filename_product_reviews_info' => xos_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'p=' . $reviews['products_id'] . '&r=' . $reviews['reviews_id']), 'date_added' => xos_date_long($reviews['date_added']), 'products_image' => xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($product_image['name']), $reviews['products_name']), 'td_width_img' => SMALL_PRODUCT_IMAGE_MAX_WIDTH + 10, 'reviews_rating' => $reviews['reviews_rating'], 'review_text' => xos_break_string(xos_output_string_protected($reviews['reviews_text']), 60, '-<br />'), 'stars_image' => xos_image(DIR_WS_IMAGES . 'catalog/templates/' . SELECTED_TPL . '/stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])), 'customers_name' => xos_output_string_protected($reviews['customers_name']), 'products_name' => $reviews['products_name']);
         }
         if (PREV_NEXT_BAR_LOCATION == '1' || PREV_NEXT_BAR_LOCATION == '3') {
             $smarty->assign('nav_bar_top', true);
         }
         if (PREV_NEXT_BAR_LOCATION == '2' || PREV_NEXT_BAR_LOCATION == '3') {
             $smarty->assign('nav_bar_bottom', true);
         }
         $smarty->assign('reviews', true);
     }
     $smarty->assign(array('nav_bar_number' => $reviews_split->display_count(TEXT_DISPLAY_NUMBER_OF_REVIEWS), 'nav_bar_result' => TEXT_RESULT_PAGE . ' ' . $reviews_split->display_links(MAX_DISPLAY_PAGE_LINKS, xos_get_all_get_params(array('page', 'info', 'lnc', 'cur', 'tpl', 'x', 'y'))), 'nav_bar_result_in_pull_down_menu' => $reviews_split->display_links_in_pull_down_menu(MAX_DISPLAY_PAGE_LINKS, xos_get_all_get_params(array('page', 'info', 'lnc', 'cur', 'tpl', 'x', 'y'))), 'reviews_array' => $reviews_array));
     $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'reviews');
 }
 $output_reviews = $smarty->fetch(SELECTED_TPL . '/reviews.tpl', $cache_id);
 $smarty->assign('central_contents', $output_reviews);
Example #6
0
     $smarty->assign(array('edit' => true, 'form_begin_review' => xos_draw_form('review', FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $_GET['rID'] . '&action=preview'), 'products_name' => $rInfo->products_name, 'customers_name' => $rInfo->customers_name, 'date_added' => xos_date_short($rInfo->date_added), 'textarea_reviews_text' => xos_draw_textarea_field('reviews_text', '60', '15', $rInfo->reviews_text), 'hidden_reviews_id' => xos_draw_hidden_field('reviews_id', $rInfo->reviews_id), 'hidden_products_id' => xos_draw_hidden_field('products_id', $rInfo->products_id), 'hidden_customers_name' => xos_draw_hidden_field('customers_name', $rInfo->customers_name), 'hidden_products_name' => xos_draw_hidden_field('products_name', $rInfo->products_name), 'hidden_products_image' => xos_draw_hidden_field('products_image', $rInfo->products_image), 'hidden_date_added' => xos_draw_hidden_field('date_added', $rInfo->date_added), 'link_filename_reviews_cancel' => xos_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $_GET['rID']), 'reviews_rating' => $reviews_rating, 'form_end' => '</form>'));
 } elseif ($action == 'preview') {
     if (xos_not_null($_POST)) {
         $rInfo = new objectInfo($_POST);
     } else {
         $rID = xos_db_prepare_input($_GET['rID']);
         $reviews_query = xos_db_query("select r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, rd.reviews_text, r.reviews_rating from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.reviews_id = '" . (int) $rID . "' and r.reviews_id = rd.reviews_id");
         $reviews = xos_db_fetch_array($reviews_query);
         $products_query = xos_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int) $reviews['products_id'] . "'");
         $products = xos_db_fetch_array($products_query);
         $products_name_query = xos_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int) $reviews['products_id'] . "' and language_id = '" . (int) $_SESSION['used_lng_id'] . "'");
         $products_name = xos_db_fetch_array($products_name_query);
         $rInfo_array = array_merge((array) $reviews, (array) $products, (array) $products_name);
         $rInfo = new objectInfo($rInfo_array);
     }
     $product_image = xos_get_product_images($rInfo->products_image);
     if (xos_not_null($_POST)) {
         /* Re-Post all POST'ed variables */
         reset($_POST);
         $hidden_post_values = '';
         while (list($key, $value) = each($_POST)) {
             $hidden_post_values .= xos_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
         }
         $smarty->assign(array('hidden_post_values' => $hidden_post_values, 'link_filename_reviews_back_edit' => xos_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id . '&action=edit'), 'link_filename_reviews_cancel' => xos_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id)));
     } else {
         if (isset($_GET['origin'])) {
             $back_url = $_GET['origin'];
             $back_url_params = '';
         } else {
             $back_url = FILENAME_REVIEWS;
             $back_url_params = 'page=' . $_GET['page'] . '&rID=' . $rInfo->reviews_id;
Example #7
0
                    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) : '');
                    }       
                  }
            */
        } else {
            $whats_new_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
            $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $whats_new_price_special = $currencies->display_price($products_prices[0][0]['special'], $products_tax_rate) : ($whats_new_price_special = '');
            $sizeof = count($products_prices[0]);
            /*      
                  if ($sizeof > 2) {      
                    $array_keys = array_keys($products_prices[0]);
                    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[0][$qty]['regular'], $products_tax_rate),
                                                            'price_break_special' => $products_prices[0]['special_status'] == 1 && $products_prices[0][$qty]['special'] > 0 ? $currencies->display_price($products_prices[0][$qty]['special'], $products_tax_rate) : '');                                      
                    }                                           
                  } 
            */
        }
        $random_product['products_name'] = xos_get_products_name($random_product['products_id']);
        $random_new_product_image = xos_get_product_images($random_product['products_image']);
        $smarty->assign(array('box_whats_new_link_filename_products_new' => xos_href_link(FILENAME_PRODUCTS_NEW), 'box_whats_new_link_filename_product_info' => xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . $random_product['products_id']), 'box_whats_new_product_image' => xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($random_new_product_image['name']), $random_product['products_name']), 'box_whats_new_product_name' => $random_product['products_name'], 'box_whats_new_product_price' => $whats_new_price, 'box_whats_new_product_price_special' => $whats_new_price_special, 'box_whats_new_products_tax_description' => xos_get_products_tax_description($random_product['products_tax_class_id'], $products_tax_rate), 'box_whats_new_product_price_breaks' => $whats_new_price_breaks_array));
        $output_whats_new = $smarty->fetch(SELECTED_TPL . '/includes/boxes/whats_new.tpl');
        $smarty->assign('box_whats_new', $output_whats_new);
    }
}
Example #8
0
                    $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) : '');
                    }       
                  }
            */
        } else {
            $specials_product_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
            $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $specials_product_price_special = $currencies->display_price($products_prices[0][0]['special'], $products_tax_rate) : ($specials_product_price_special = '');
            $sizeof = count($products_prices[0]);
            /*      
                  if ($sizeof > 2) {      
                    $array_keys = array_keys($products_prices[0]);
                    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[0][$qty]['regular'], $products_tax_rate),
                                                           'price_break_special' => $products_prices[0]['special_status'] == 1 && $products_prices[0][$qty]['special'] > 0 ? $currencies->display_price($products_prices[0][$qty]['special'], $products_tax_rate) : '');                                      
                    }                                           
                  } 
            */
        }
        $random_special_product_image = xos_get_product_images($random_product['products_image']);
        $smarty->assign(array('box_specials_link_filename_specials' => xos_href_link(FILENAME_SPECIALS), 'box_specials_link_filename_product_info' => xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . $random_product["products_id"]), 'box_specials_product_image' => xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($random_special_product_image['name']), $random_product['products_name']), 'box_specials_product_name' => $random_product['products_name'], 'box_specials_product_price' => $specials_product_price, 'box_specials_product_price_special' => $specials_product_price_special, 'box_specials_products_tax_description' => xos_get_products_tax_description($random_product['products_tax_class_id'], $products_tax_rate), 'box_specials_product_price_breaks' => $specials_price_breaks_array));
        $output_specials = $smarty->fetch(SELECTED_TPL . '/includes/boxes/specials.tpl');
        $smarty->assign('box_specials', $output_specials);
    }
}
Example #9
0
//              Copyright (c) 2003 osCommerce
//              filename: categories.php
//
//              Released under the GNU General Public License
////////////////////////////////////////////////////////////////////////////////
if (!(@(include DIR_FS_SMARTY . 'admin/templates/' . ADMIN_TPL . '/php/includes/modules/new_product.php') == 'overwrite_all')) {
    $form_action = isset($_GET['pID']) ? 'update_product' : 'insert_product';
    $parameters = array('products_name' => '', 'products_p_unit' => '', 'products_info' => '', 'products_description' => '', 'products_url' => '', 'products_id' => '', 'products_quantity' => '', 'products_delivery_time_id' => '', 'products_sort_order' => '', 'products_model' => '', 'products_image' => '', 'products_price' => '', 'products_weight' => '', 'products_date_added' => '', 'products_last_modified' => '', 'products_date_available' => '', 'products_status' => '', 'products_tax_class_id' => '', 'manufacturers_id' => '', 'attributes_quantity' => '');
    if (isset($_GET['pID'])) {
        $product_query = xos_db_query("select products_id, products_quantity, products_delivery_time_id, products_model, products_image, products_price, products_sort_order, products_weight, products_date_added, products_last_modified, date_format(products_date_available, '" . DATE_FORMAT_SHORT . "') as products_date_available, products_status, products_tax_class_id, manufacturers_id, attributes_quantity, attributes_not_updated from " . TABLE_PRODUCTS . " where products_id = '" . (int) $_GET['pID'] . "'");
        $product = xos_db_fetch_array($product_query);
        $pInfo = new objectInfo($product);
    } else {
        $pInfo = new objectInfo($parameters);
    }
    $products_image = xos_get_product_images($pInfo->products_image, 'all');
    $has_product_attributes = xos_has_product_attributes($pInfo->products_id);
    $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));
    $manufacturers_query = xos_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS_INFO . " where languages_id = '" . (int) $_SESSION['used_lng_id'] . "' order by manufacturers_name");
    while ($manufacturers = xos_db_fetch_array($manufacturers_query)) {
        $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $manufacturers['manufacturers_name']);
    }
    $delivery_times_array = array(array('id' => '', 'text' => TEXT_NONE));
    $delivery_times_query = xos_db_query("select delivery_times_id, delivery_times_text from " . TABLE_DELIVERY_TIMES . " where language_id = '" . (int) $_SESSION['used_lng_id'] . "' order by delivery_times_id");
    while ($delivery_times = xos_db_fetch_array($delivery_times_query)) {
        $delivery_times_array[] = array('id' => $delivery_times['delivery_times_id'], 'text' => $delivery_times['delivery_times_text']);
    }
    $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
    $tax_class_query = xos_db_query("select distinct tc.tax_class_id, tc.tax_class_title from " . TABLE_TAX_CLASS . " tc, " . TABLE_TAX_RATES . " tr where tc.tax_class_id = tr.tax_class_id order by tc.tax_class_title");
    while ($tax_class = xos_db_fetch_array($tax_class_query)) {
        $tax_class_array[] = array('id' => $tax_class['tax_class_id'], 'text' => $tax_class['tax_class_title']);
                                                                    '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) : '');
                                }       
                              }
                    */
                } else {
                    $orders_product_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
                    $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $orders_product_price_special = $currencies->display_price($products_prices[0][0]['special'], $products_tax_rate) : ($orders_product_price_special = '');
                    $sizeof = count($products_prices[0]);
                    /*          
                              if ($sizeof > 2) {      
                                $array_keys = array_keys($products_prices[0]);
                                for ($count=2, $n=$sizeof; $count<$n; $count++) {
                                  $qty = $array_keys[$count];
                                  $orders_price_breaks_array[]=array('qty' => $qty,
                                                                    'price_break' => $currencies->display_price($products_prices[0][$qty]['regular'], $products_tax_rate),
                                                                    'price_break_special' => $products_prices[0]['special_status'] == 1 && $products_prices[0][$qty]['special'] > 0 ? $currencies->display_price($products_prices[0][$qty]['special'], $products_tax_rate) : '');                                      
                                }                                           
                              }
                    */
                }
                $orders_products_image = xos_get_product_images($orders['products_image']);
                $also_purchased_products_array[] = array('link_filename_product_info' => xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . $orders['products_id']), 'image' => xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($orders_products_image['name']), $orders['products_name']), 'info' => $orders['products_info'], 'price' => $orders_product_price, 'price_special' => $orders_product_price_special, 'price_breaks' => $orders_price_breaks_array, 'tax_description' => xos_get_products_tax_description($orders['products_tax_class_id'], $products_tax_rate), 'name' => $orders['products_name']);
            }
            $smarty->assign('also_purchased_products', $also_purchased_products_array);
            $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'also_purchased_products');
            $output_also_purchased_products = $smarty->fetch(SELECTED_TPL . '/includes/modules/also_purchased_products.tpl');
            $smarty->clearAssign('also_purchased_products');
            $smarty->assign('also_purchased_products', $output_also_purchased_products);
        }
    }
}
Example #11
0
             if ($attributes_values['options_values_price'] != 0) {
                 $attributes_options_values_price = true;
                 $options_values_price = $currencies->format(xos_add_tax($currencies->currencies[$_SESSION['currency']]['value'] * $attributes_values['options_values_price'], $products_tax_rate));
             }
             $attributes_array[] = array('products_options_name' => $attributes_values['products_options_name'], 'options_values_id' => $value, 'products_options_values_name' => $attributes_values['products_options_values_name'], 'options_values_price' => $options_values_price, 'hidden_field' => $hidden_field, 'price_prefix' => $attributes_values['price_prefix']);
         }
     }
     if (STOCK_CHECK == 'true') {
         $stock_check = xos_check_stock($products[$i]['id'], $products[$i]['quantity']);
         if (xos_not_null($stock_check)) {
             $any_out_of_stock = 1;
             $products_name .= $stock_check;
         }
     }
     $tax_rate = xos_display_tax_value($products_tax_rate);
     $product_image = xos_get_product_images($products[$i]['image']);
     $popup_content_id = xos_get_delivery_times_values($products[$i]['delivery_time_id'], 'popup_content_id');
     $products_array[] = array('checkbox_cart_delete' => xos_draw_checkbox_field('cart_delete[]', $products[$i]['id'], false, 'id="cart_delete_' . ($i + 1) . '"'), 'link_filename_product_info' => xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . urlencode($products[$i]['id'])), 'link_remove_product' => xos_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&rmp=0&p=' . urlencode($products[$i]['id'])), 'products_image' => xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($product_image['name']), $products[$i]['name']), 'products_name' => $products[$i]['name'], 'products_packaging_unit' => $products[$i]['packaging_unit'], 'products_delivery_time' => xos_get_delivery_times_values($products[$i]['delivery_time_id']), 'link_filename_popup_content_products_delivery_time' => $popup_content_id > 0 ? xos_href_link(FILENAME_POPUP_CONTENT, 'co=' . $popup_content_id . '&p=' . $products[$i]['id'], $request_type) : '', 'products_model' => $products[$i]['model'], 'stock_check' => $stock_check, 'input_and_hidden_fields_quantity' => xos_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'id="cart_quantity_' . ($i + 1) . '" class="form-control cart-input-quantity" size="2" maxlength="5"') . xos_draw_hidden_field('p[]', $products[$i]['id']), 'products_tax' => xos_display_tax_value($products_tax_rate), 'products_price' => $currencies->format($products[$i]['price']), 'products_final_single_price' => $currencies->format($products[$i]['final_price']), 'products_final_price' => $currencies->format($products[$i]['quantity'] * $products[$i]['final_price']), 'products_attributes_option_price' => $attributes_options_values_price, 'products_attributes' => $attributes_array);
     if (isset($tax_rate)) {
         $tax_rates[$tax_rate] = '1';
     }
     unset($attributes_array);
 }
 include DIR_WS_CLASSES . 'payment.php';
 $payment_modules = new payment();
 $initialize_checkout_methods = $payment_modules->checkout_initialization_method();
 $alternative_checkout_methods_array = array();
 if (!empty($initialize_checkout_methods)) {
     reset($initialize_checkout_methods);
     while (list(, $value) = each($initialize_checkout_methods)) {
         $alternative_checkout_methods_array[] = array('value' => $value);
     xos_redirect(xos_href_link(FILENAME_PRODUCT_REVIEWS, xos_get_all_get_params(array('r'))));
 }
 require DIR_FS_SMARTY . 'catalog/languages/' . $_SESSION['language'] . '/' . FILENAME_PRODUCT_REVIEWS_INFO;
 $site_trail->add(NAVBAR_TITLE, xos_href_link(FILENAME_PRODUCT_REVIEWS_INFO, xos_get_all_get_params(array('lnc', 'cur', 'tpl', 'x', 'y'))));
 require DIR_WS_INCLUDES . 'html_header.php';
 require DIR_WS_INCLUDES . 'boxes.php';
 require DIR_WS_INCLUDES . 'header.php';
 require DIR_WS_INCLUDES . 'footer.php';
 xos_db_query("update " . TABLE_REVIEWS . " set reviews_read = reviews_read+1 where reviews_id = '" . (int) $_GET['r'] . "'");
 if (CACHE_LEVEL > 2 && (isset($_COOKIE[session_name()]) && !isset($_GET[session_name()]) || SESSION_FORCE_COOKIE_USE == 'true')) {
     $smarty->caching = 1;
     $cache_id = 'L3|cc_product_reviews_info|' . $_SESSION['language'] . '-' . $_GET['lnc'] . '-' . $_GET[session_name()] . '-' . $session_started . '-' . SELECTED_TPL . '-' . $_SESSION['currency'] . '-' . $_SESSION['sppc_customer_group_id'] . '-' . $_SESSION['sppc_customer_group_show_tax'] . '-' . $_SESSION['sppc_customer_group_tax_exempt'] . '-' . $_GET['c'] . '-' . $_GET['m'] . '-' . $_GET['p'] . '-' . $_GET['r'];
 }
 if (!$smarty->isCached(SELECTED_TPL . '/product_reviews_info.tpl', $cache_id)) {
     $review = xos_db_fetch_array($review_query);
     $products_image_name = xos_get_product_images($review['products_image'], 'all');
     $products_prices = xos_get_product_prices($review['products_price']);
     $products_tax_rate = xos_get_tax_rate($review['products_tax_class_id']);
     $price_breaks_array = array();
     if (isset($products_prices[$customer_group_id][0])) {
         $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 ? $product_price_special = $currencies->display_price($products_prices[$customer_group_id][0]['special'], $products_tax_rate) : ($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];
                 $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) : '');
             }
         }
     } else {
Example #13
0
function xos_remove_product($product_id)
{
    $product_image_query = xos_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int) $product_id . "'");
    $product_image = xos_db_fetch_array($product_image_query);
    $products_image_name = xos_get_product_images($product_image['products_image'], 'all');
    reset($products_image_name);
    while ($image = each($products_image_name)) {
        @unlink(DIR_FS_CATALOG_IMAGES . 'products/uploads/' . $image[1]['name']);
        @unlink(DIR_FS_CATALOG_IMAGES . 'products/extra_small/' . $image[1]['name']);
        @unlink(DIR_FS_CATALOG_IMAGES . 'products/small/' . $image[1]['name']);
        @unlink(DIR_FS_CATALOG_IMAGES . 'products/medium/' . $image[1]['name']);
        @unlink(DIR_FS_CATALOG_IMAGES . 'products/large/' . $image[1]['name']);
    }
    xos_db_query("delete from " . TABLE_SPECIALS . " where products_id = '" . (int) $product_id . "'");
    xos_db_query("delete from " . TABLE_PRODUCTS . " where products_id = '" . (int) $product_id . "'");
    xos_db_query("delete from " . TABLE_PRODUCTS_PRICES . " where products_id = '" . (int) $product_id . "'");
    xos_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int) $product_id . "'");
    xos_db_query("delete from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int) $product_id . "'");
    xos_db_query("delete from " . TABLE_PRODUCTS_XSELL . " where products_id = '" . (int) $product_id . "' or xsell_id = '" . (int) $product_id . "'");
    xos_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where products_id = '" . (int) $product_id . "' or products_id like '" . (int) $product_id . "-%'");
    $products_attributes_id_query = xos_db_query("select products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $product_id . "'");
    while ($products_attributes_id = xos_db_fetch_array($products_attributes_id_query)) {
        xos_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " where products_attributes_id = '" . (int) $products_attributes_id['products_attributes_id'] . "'");
    }
    xos_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int) $product_id . "'");
    $product_reviews_query = xos_db_query("select reviews_id from " . TABLE_REVIEWS . " where products_id = '" . (int) $product_id . "'");
    while ($product_reviews = xos_db_fetch_array($product_reviews_query)) {
        xos_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int) $product_reviews['reviews_id'] . "'");
    }
    xos_db_query("delete from " . TABLE_REVIEWS . " where products_id = '" . (int) $product_id . "'");
}
require 'includes/application_top.php';
if (!(@(include DIR_FS_SMARTY . 'admin/templates/' . ADMIN_TPL . '/php/' . FILENAME_IMAGE_PROCESSING) == 'overwrite_all')) {
    $action = isset($_GET['action']) ? $_GET['action'] : '';
    if ($action == 'recreate_product_images_now') {
        $smarty_cache_control->clearAllCache();
        require_once 'includes/classes/image_creator.php';
        xos_set_time_limit(0);
        $files = array();
        $handle = opendir(DIR_FS_CATALOG_IMAGES . 'products/uploads/');
        while ($files[] = readdir($handle)) {
        }
        closedir($handle);
        $products_query = xos_db_query("select products_image from " . TABLE_PRODUCTS);
        if (xos_db_num_rows($products_query)) {
            while ($products = xos_db_fetch_array($products_query)) {
                $products_image = xos_get_product_images($products['products_image'], 'all');
                foreach ($products_image as $key => $val) {
                    if (in_array($val['name'], $files)) {
                        new image_create(DIR_FS_CATALOG_IMAGES . 'products/uploads/' . $val['name'], DIR_FS_CATALOG_IMAGES . 'products/extra_small/' . $val['name'], EXTRA_SMALL_PRODUCT_IMAGE_MAX_WIDTH, EXTRA_SMALL_PRODUCT_IMAGE_MAX_HEIGHT, IMAGE_QUALITY, EXTRA_SMALL_PRODUCT_IMAGE_MERGE);
                        new image_create(DIR_FS_CATALOG_IMAGES . 'products/uploads/' . $val['name'], DIR_FS_CATALOG_IMAGES . 'products/small/' . $val['name'], SMALL_PRODUCT_IMAGE_MAX_WIDTH, SMALL_PRODUCT_IMAGE_MAX_HEIGHT, IMAGE_QUALITY, SMALL_PRODUCT_IMAGE_MERGE);
                        new image_create(DIR_FS_CATALOG_IMAGES . 'products/uploads/' . $val['name'], DIR_FS_CATALOG_IMAGES . 'products/medium/' . $val['name'], MEDIUM_PRODUCT_IMAGE_MAX_WIDTH, MEDIUM_PRODUCT_IMAGE_MAX_HEIGHT, IMAGE_QUALITY, MEDIUM_PRODUCT_IMAGE_MERGE);
                        new image_create(DIR_FS_CATALOG_IMAGES . 'products/uploads/' . $val['name'], DIR_FS_CATALOG_IMAGES . 'products/large/' . $val['name'], $val['large_image_max_width'] == 'default' ? LARGE_PRODUCT_IMAGE_MAX_WIDTH : $val['large_image_max_width'], $val['large_image_max_height'] == 'default' ? LARGE_PRODUCT_IMAGE_MAX_HEIGHT : $val['large_image_max_height'], IMAGE_QUALITY, LARGE_PRODUCT_IMAGE_MERGE);
                    }
                }
            }
        }
        $smarty->assign(array('recreate_product_images_now' => true, 'link_filename_image_processing_back' => xos_href_link(FILENAME_IMAGE_PROCESSING)));
        $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'image_processing');
        $output_image_processing_recreate = $smarty->fetch(ADMIN_TPL . '/image_processing.tpl');
        echo $output_image_processing_recreate;
        die;
Example #15
0
                                                            '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) : '');
                          }       
                        }
                */
            } else {
                $new_product_price = $currencies->display_price($products_prices[0][0]['regular'], $products_tax_rate);
                $products_prices[0]['special_status'] == 1 && $products_prices[0][0]['special'] > 0 ? $new_product_price_special = $currencies->display_price($products_prices[0][0]['special'], $products_tax_rate) : ($new_product_price_special = '');
                $sizeof = count($products_prices[0]);
                /*        
                        if ($sizeof > 2) {      
                          $array_keys = array_keys($products_prices[0]);
                          for ($count=2, $n=$sizeof; $count<$n; $count++) {
                            $qty = $array_keys[$count];
                            $new_price_breaks_array[]=array('qty' => $qty,
                                                            'price_break' => $currencies->display_price($products_prices[0][$qty]['regular'], $products_tax_rate),
                                                            'price_break_special' => $products_prices[0]['special_status'] == 1 && $products_prices[0][$qty]['special'] > 0 ? $currencies->display_price($products_prices[0][$qty]['special'], $products_tax_rate) : '');                                      
                          }                                           
                        }
                */
            }
            $new_products_image = xos_get_product_images($new_products['products_image']);
            $new_products_array[] = array('link_filename_product_info' => xos_href_link(FILENAME_PRODUCT_INFO, 'p=' . $new_products['products_id']), 'image' => xos_image(DIR_WS_IMAGES . 'products/small/' . rawurlencode($new_products_image['name']), $new_products['products_name']), 'info' => $new_products['products_info'], 'price' => $new_product_price, 'price_special' => $new_product_price_special, 'price_breaks' => $new_price_breaks_array, 'tax_description' => xos_get_products_tax_description($new_products['products_tax_class_id'], $products_tax_rate), 'name' => $new_products['products_name']);
            unset($price_breaks_array);
        }
        $smarty->assign('new_products', $new_products_array);
        $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'new_products');
        $output_new_products = $smarty->fetch(SELECTED_TPL . '/includes/modules/new_products.tpl');
        $smarty->clearAssign('new_products');
        $smarty->assign('new_products', $output_new_products);
    }
}