[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> product_reviews_write.php (source)

   1  <?php
   2  /*

   3  $Id: product_reviews_write.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13  // Most of this file is changed or moved to BTS - Basic Template System - format.

  14  // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  15  //       catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  16  // (Sub 'fallback' with your current template to see if there is a template specific file.)

  17  
  18    require ('includes/application_top.php');
  19  
  20    if (!tep_session_is_registered('customer_id')) {
  21      $navigation->set_snapshot();
  22      tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  23    }
  24  
  25    $product_info_query = tep_db_query("select p.products_id, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
  26    if (!tep_db_num_rows($product_info_query)) {
  27      tep_redirect(tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params(array('action'))));
  28    } else {
  29      $product_info = tep_db_fetch_array($product_info_query);
  30    }
  31  
  32    $customer_query = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
  33    $customer = tep_db_fetch_array($customer_query);
  34  
  35    if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
  36      $rating = tep_db_prepare_input($HTTP_POST_VARS['rating']);
  37      $review = tep_db_prepare_input($HTTP_POST_VARS['review']);
  38  
  39      $error = false;
  40      if (strlen($review) < REVIEW_TEXT_MIN_LENGTH) {
  41        $error = true;
  42  
  43        $messageStack->add('review', JS_REVIEW_TEXT);
  44      }
  45  
  46      if (($rating < 1) || ($rating > 5)) {
  47        $error = true;
  48  
  49        $messageStack->add('review', JS_REVIEW_RATING);
  50      }
  51  
  52      if ($error == false) {
  53        tep_db_query("insert into " . TABLE_REVIEWS . " (products_id, customers_id, customers_name, reviews_rating, date_added) values ('" . (int)$HTTP_GET_VARS['products_id'] . "', '" . (int)$customer_id . "', '" . tep_db_input($customer['customers_firstname']) . ' ' . tep_db_input($customer['customers_lastname']) . "', '" . tep_db_input($rating) . "', now())");
  54        $insert_id = tep_db_insert_id();
  55  
  56        tep_db_query("insert into " . TABLE_REVIEWS_DESCRIPTION . " (reviews_id, languages_id, reviews_text) values ('" . (int)$insert_id . "', '" . (int)$languages_id . "', '" . tep_db_input($review) . "')");
  57  
  58        tep_redirect(tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params(array('action'))));
  59      }
  60    }
  61  
  62  // BOF: MOD - Separate Pricing Per Customer

  63    if(!tep_session_is_registered('sppc_customer_group_id')) { 
  64    $customer_group_id = '0';
  65    } else {
  66     $customer_group_id = $sppc_customer_group_id;
  67    }
  68    
  69       if ($customer_group_id !='0') {
  70      $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and customers_group_id =  '" . $customer_group_id . "'");
  71        if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
  72          $product_info['products_price'] = $customer_group_price['customers_group_price'];
  73        }
  74       }
  75  // EOF: MOD - Separate Pricing Per Customer

  76    if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  77      $products_price = '<<span style="text-decoration:line-through">>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
  78    } else {
  79      $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
  80    }
  81  
  82    if (tep_not_null($product_info['products_model'])) {
  83      $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
  84    } else {
  85      $products_name = $product_info['products_name'];
  86    }
  87  
  88    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_REVIEWS_WRITE);
  89  
  90    $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()));
  91  
  92    $content = CONTENT_PRODUCT_REVIEWS_WRITE;
  93    $javascript = $content . '.js';
  94  
  95    include (bts_select('main', $content_template)); // BTSv1.5

  96  
  97    require (DIR_WS_INCLUDES . 'application_bottom.php');
  98  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7