  |
14 | 14 | | var $_data = array(); |
| |
15 | 15 | | |
| |
16 | 16 | | function osC_Product($id) { |
  |
17 | | - | global $osC_Database, $osC_Services; |
| |
| 17 | + | global $osC_Database, $osC_Services, $osC_Language; |
|
18 | 18 | | |
| |
19 | 19 | | if (!empty($id)) { |
| |
20 | 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'); |
| |
|
|
 |
… |
|
30 | 30 | | } |
| |
31 | 31 | | |
| |
32 | 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']); |
| |
| 33 | + | $Qproduct->bindInt(':language_id', $osC_Language->getID()); |
|
34 | 34 | | $Qproduct->execute(); |
| |
35 | 35 | | |
| |
36 | 36 | | if ($Qproduct->numberOfRows() === 1) { |
| |
|
|
 |
… |
|
56 | 56 | | $Qattributes->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS); |
| |
57 | 57 | | $Qattributes->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES); |
| |
58 | 58 | | $Qattributes->bindInt(':products_id', $this->_data['id']); |
  |
59 | | - | $Qattributes->bindInt(':language_id', $_SESSION['languages_id']); |
| |
60 | | - | $Qattributes->bindInt(':language_id', $_SESSION['languages_id']); |
| |
| 59 | + | $Qattributes->bindInt(':language_id', $osC_Language->getID()); |
| |
| 60 | + | $Qattributes->bindInt(':language_id', $osC_Language->getID()); |
|
61 | 61 | | $Qattributes->execute(); |
| |
62 | 62 | | |
| |
63 | 63 | | while ($Qattributes->next()) { |
| |
|
|
 |
… |
|
74 | 74 | | $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'); |
| |
75 | 75 | | $Qavg->bindTable(':table_reviews', TABLE_REVIEWS); |
| |
76 | 76 | | $Qavg->bindInt(':products_id', $this->_data['id']); |
  |
77 | | - | $Qavg->bindInt(':languages_id', $_SESSION['languages_id']); |
| |
| 77 | + | $Qavg->bindInt(':languages_id', $osC_Language->getID()); |
|
78 | 78 | | $Qavg->execute(); |
| |
79 | 79 | | |
| |
80 | 80 | | $this->_data['reviews_average_rating'] = round($Qavg->value('rating')); |
| |
|
|
 |
… |
|
232 | 232 | | } |
| |
233 | 233 | | |
| |
234 | 234 | | function incrementCounter() { |
  |
235 | | - | global $osC_Database; |
| |
| 235 | + | global $osC_Database, $osC_Language; |
|
236 | 236 | | |
| |
237 | 237 | | $Qupdate = $osC_Database->query('update :table_products_description set products_viewed = products_viewed+1 where products_id = :products_id and language_id = :language_id'); |
| |
238 | 238 | | $Qupdate->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION); |
| |
239 | 239 | | $Qupdate->bindInt(':products_id', tep_get_prid($this->_data['id'])); |
  |
240 | | - | $Qupdate->bindInt(':language_id', $_SESSION['languages_id']); |
| |
| 240 | + | $Qupdate->bindInt(':language_id', $osC_Language->getID()); |
|
241 | 241 | | $Qupdate->execute(); |
| |
242 | 242 | | } |
| |
243 | 243 | | |
| |
244 | 244 | | function &getListingNew() { |
  |
245 | | - | global $osC_Database; |
| |
| 245 | + | global $osC_Database, $osC_Language; |
|
246 | 246 | | |
| |
247 | 247 | | $Qproducts = $osC_Database->query('select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from :table_products p left join :table_manufacturers m on (p.manufacturers_id = m.manufacturers_id), :table_products_description pd where p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_added desc, pd.products_name'); |
| |
248 | 248 | | $Qproducts->bindTable(':table_products', TABLE_PRODUCTS); |
| |
249 | 249 | | $Qproducts->bindTable(':table_manufacturers', TABLE_MANUFACTURERS); |
| |
250 | 250 | | $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION); |
  |
251 | | - | $Qproducts->bindInt(':language_id', $_SESSION['languages_id']); |
| |
| 251 | + | $Qproducts->bindInt(':language_id', $osC_Language->getID()); |
  |
252 | 252 | | $Qproducts->setBatchLimit($_GET['page'], MAX_DISPLAY_PRODUCTS_NEW); |
| |
253 | 253 | | $Qproducts->execute(); |
| |
254 | 254 | | |