Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

245
 
246
 
246
 
product.php
_> 1616     function osC_Product($id) {
  1717       global $osC_Database, $osC_Services;
  1818 
<> 19 -      $Qproduct = $osC_Database->query('select p.products_id as id, p.products_model as model, p.products_quantity as quantity, p.products_image as image, pd.products_url as url, p.products_price as price, p.products_tax_class_id as tax_class_id, p.products_date_added as date_added, p.products_date_available as date_available, p.manufacturers_id, pd.products_name as name, pd.products_description as description from :table_products p, :table_products_description pd where');
  20 -      $Qproduct->bindTable(':table_products', TABLE_PRODUCTS);
  21 -      $Qproduct->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
   19+      if (!empty($id)) {
   20+        $Qproduct = $osC_Database->query('select p.products_id as id, p.products_quantity as quantity, p.products_image as image, p.products_price as price, p.products_tax_class_id as tax_class_id, p.products_date_added as date_added, p.products_date_available as date_available, p.manufacturers_id, pd.products_name as name, pd.products_description as description, pd.products_model as model, pd.products_keyword as keyword, pd.products_tags as tags, pd.products_url as url from :table_products p, :table_products_description pd where');
   21+        $Qproduct->bindTable(':table_products', TABLE_PRODUCTS);
   22+        $Qproduct->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
2223 
<> 23 -      if (is_numeric($id) || ereg('[0-9]+[{[0-9]+}[0-9]+]*$', $id)) {
  24 -        $Qproduct->appendQuery('p.products_id = :products_id');
  25 -        $Qproduct->bindInt(':products_id', tep_get_prid($id));
  26 -      } else {
  27 -        $Qproduct->appendQuery('p.products_model = :products_model');
  28 -        $Qproduct->bindValue(':products_model', $id);
  29 -      }
   24+        if (is_numeric($id) || ereg('[0-9]+[{[0-9]+}[0-9]+]*$', $id)) {
   25+          $Qproduct->appendQuery('p.products_id = :products_id');
   26+          $Qproduct->bindInt(':products_id', tep_get_prid($id));
   27+        } else {
   28+          $Qproduct->appendQuery('pd.products_keyword = :products_keyword');
   29+          $Qproduct->bindValue(':products_keyword', $id);
   30+        }
3031 
<> 31 -      $Qproduct->appendQuery('and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id');
  32 -      $Qproduct->bindInt(':language_id', $_SESSION['languages_id']);
  33 -      $Qproduct->execute();
   32+        $Qproduct->appendQuery('and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id');
   33+        $Qproduct->bindInt(':language_id', $_SESSION['languages_id']);
   34+        $Qproduct->execute();
3435 
<> 35 -      $this->_data = $Qproduct->toArray();
   36+        $this->_data = $Qproduct->toArray();
3637 
<> 37 -      $Qcheck = $osC_Database->query('select products_attributes_id from :table_products_attributes patrib where products_id = :products_id limit 1');
  38 -      $Qcheck->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
  39 -      $Qcheck->bindInt(':products_id', tep_get_prid($id));
  40 -      $Qcheck->execute();
   38+        $Qcheck = $osC_Database->query('select products_attributes_id from :table_products_attributes patrib where products_id = :products_id limit 1');
   39+        $Qcheck->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
   40+        $Qcheck->bindInt(':products_id', $this->_data['id']);
   41+        $Qcheck->execute();
4142 
<> 42 -      if ($Qcheck->numberOfRows() === 1) {
  43 -        $this->_data['attributes'] = array();
   43+        if ($Qcheck->numberOfRows() === 1) {
   44+          $this->_data['attributes'] = array();
4445 
<> 45 -        $Qattributes = $osC_Database->query('select pa.*, po.*, pov.* from :table_products_attributes pa, :table_products_options po, :table_products_options_values pov where pa.products_id = :products_id and pa.options_id = po.products_options_id and po.language_id = :language_id and pa.options_values_id = pov.products_options_values_id and pov.language_id = :language_id order by po.products_options_name, pov.products_options_values_name');
  46 -        $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
  47 -        $Qattributes->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
  48 -        $Qattributes->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
  49 -        $Qattributes->bindInt(':products_id', tep_get_prid($id));
  50 -        $Qattributes->bindInt(':language_id', $_SESSION['languages_id']);
  51 -        $Qattributes->bindInt(':language_id', $_SESSION['languages_id']);
  52 -        $Qattributes->execute();
   46+          $Qattributes = $osC_Database->query('select pa.*, po.*, pov.* from :table_products_attributes pa, :table_products_options po, :table_products_options_values pov where pa.products_id = :products_id and pa.options_id = po.products_options_id and po.language_id = :language_id and pa.options_values_id = pov.products_options_values_id and pov.language_id = :language_id order by po.products_options_name, pov.products_options_values_name');
   47+          $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
   48+          $Qattributes->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
   49+          $Qattributes->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
   50+          $Qattributes->bindInt(':products_id', $this->_data['id']);
   51+          $Qattributes->bindInt(':language_id', $_SESSION['languages_id']);
   52+          $Qattributes->bindInt(':language_id', $_SESSION['languages_id']);
   53+          $Qattributes->execute();
5354 
<> 54 -        while ($Qattributes->next()) {
  55 -          $this->_data['attributes'][] = array('options_id' => $Qattributes->valueInt('options_id'),
  56 -                                               'options_name' => $Qattributes->value('products_options_name'),
  57 -                                               'options_values_id' => $Qattributes->valueInt('options_values_id'),
  58 -                                               'options_values_name' => $Qattributes->value('products_options_values_name'),
  59 -                                               'options_values_price' => $Qattributes->value('options_values_price'),
  60 -                                               'price_prefix' => $Qattributes->value('price_prefix'));
   55+          while ($Qattributes->next()) {
   56+            $this->_data['attributes'][] = array('options_id' => $Qattributes->valueInt('options_id'),
   57+                                                 'options_name' => $Qattributes->value('products_options_name'),
   58+                                                 'options_values_id' => $Qattributes->valueInt('options_values_id'),
   59+                                                 'options_values_name' => $Qattributes->value('products_options_values_name'),
   60+                                                 'options_values_price' => $Qattributes->value('options_values_price'),
   61+                                                 'price_prefix' => $Qattributes->value('price_prefix'));
   62+          }
6163         }
<> 62 -      }
6364 
<> 64 -      if ($osC_Services->isStarted('reviews')) {
  65 -        $Qavg = $osC_Database->query('select avg(reviews_rating) as rating from :table_reviews where products_id = :products_id and languages_id = :languages_id and reviews_status = 1');
  66 -        $Qavg->bindTable(':table_reviews', TABLE_REVIEWS);
  67 -        $Qavg->bindInt(':products_id', $id);
  68 -        $Qavg->bindInt(':languages_id', $_SESSION['languages_id']);
  69 -        $Qavg->execute();
   65+        if ($osC_Services->isStarted('reviews')) {
   66+          $Qavg = $osC_Database->query('select avg(reviews_rating) as rating from :table_reviews where products_id = :products_id and languages_id = :languages_id and reviews_status = 1');
   67+          $Qavg->bindTable(':table_reviews', TABLE_REVIEWS);
   68+          $Qavg->bindInt(':products_id', $this->_data['id']);
   69+          $Qavg->bindInt(':languages_id', $_SESSION['languages_id']);
   70+          $Qavg->execute();
7071 
<> 71 -        $this->_data['reviews_average_rating'] = round($Qavg->value('rating'));
   72+          $this->_data['reviews_average_rating'] = round($Qavg->value('rating'));
   73+        }
7274       }
  7375     }
  7476 
<>  77+    function isValid() {
   78+      if (empty($this->_data)) {
   79+        return false;
   80+      }
   81+
   82+      return true;
   83+    }
   84+
7585     function getData($key) {
  7686       if (isset($this->_data[$key])) {
  7787         return $this->_data[$key];
     
 !
100110       return $this->_data['model'];
  101111     }
  102112 
<>  113+    function getKeyword() {
   114+      return $this->_data['keyword'];
   115+    }
   116+
103117     function getPrice() {
  104118     }
  105119 
     
 !
170184     function checkEntry($id) {
  171185       global $osC_Database;
  172186 
<> 173 -      $Qcheck = $osC_Database->query('select products_id from :table_products where');
   187+      $Qcheck = $osC_Database->query('select p.products_id from :table_products p');
174188       $Qcheck->bindTable(':table_products', TABLE_PRODUCTS);
  175189 
  176190       if (is_numeric($id) || ereg('[0-9]+[{[0-9]+}[0-9]+]*$', $id)) {
<> 177 -        $Qcheck->appendQuery('products_id = :products_id');
   191+        $Qcheck->appendQuery('where p.products_id = :products_id');
178192         $Qcheck->bindInt(':products_id', tep_get_prid($id));
  179193       } else {
<> 180 -        $Qcheck->appendQuery('products_model = :products_model');
  181 -        $Qcheck->bindValue(':products_model', $id);
   194+        $Qcheck->appendQuery(', :table_products_description pd where pd.products_keyword = :products_keyword and pd.products_id = p.products_id');
   195+        $Qcheck->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION);
   196+        $Qcheck->bindValue(':products_keyword', $id);
182197       }
  183198 
<> 184 -      $Qcheck->appendQuery('and products_status = 1 limit 1');
   199+      $Qcheck->appendQuery('and p.products_status = 1 limit 1');
<_ 185200       $Qcheck->execute();
  186201 
  187202       if ($Qcheck->numberOfRows() === 1) {