Diff
383
608
608
product.php
  |
14 | 14 | | var $_data = array(); |
| |
15 | 15 | | |
| |
16 | 16 | | function osC_Product($id) { |
  |
17 | | - | global $osC_Database, $osC_Services, $osC_Language; |
| |
| 17 | + | global $osC_Database, $osC_Services, $osC_Language, $osC_Image; |
|
18 | 18 | | |
| |
19 | 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'); |
| |
| 20 | + | $Qproduct = $osC_Database->query('select p.products_id as id, p.products_quantity as quantity, 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, i.image from :table_products p left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :table_products_description pd where'); |
|
21 | 21 | | $Qproduct->bindTable(':table_products', TABLE_PRODUCTS); |
  |
| 22 | + | $Qproduct->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES); |
|
22 | 23 | | $Qproduct->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION); |
| |
23 | 24 | | |
| |
24 | 25 | | if (is_numeric($id) || ereg('[0-9]+[{[0-9]+}[0-9]+]*$', $id)) { |
| |
|
|
 |
… |
|
30 | 31 | | } |
| |
31 | 32 | | |
| |
32 | 33 | | $Qproduct->appendQuery('and p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id'); |
  |
| 34 | + | $Qproduct->bindInt(':default_flag', 1); |
|
33 | 35 | | $Qproduct->bindInt(':language_id', $osC_Language->getID()); |
| |
34 | 36 | | $Qproduct->execute(); |
| |
35 | 37 | | |
| |
|
|
 |
… |
|
242 | 244 | | } |
| |
243 | 245 | | |
| |
244 | 246 | | function &getListingNew() { |
  |
245 | | - | global $osC_Database, $osC_Language; |
| |
| 247 | + | global $osC_Database, $osC_Language, $osC_Image; |
|
246 | 248 | | |
  |
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'); |
| |
| 249 | + | $Qproducts = $osC_Database->query('select p.products_id, p.products_price, p.products_tax_class_id, p.products_date_added, pd.products_name, pd.products_keyword, m.manufacturers_name, i.image from :table_products p left join :table_manufacturers m on (p.manufacturers_id = m.manufacturers_id) left join :table_products_images i on (p.products_id = i.products_id and i.default_flag = :default_flag), :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 | 250 | | $Qproducts->bindTable(':table_products', TABLE_PRODUCTS); |
| |
249 | 251 | | $Qproducts->bindTable(':table_manufacturers', TABLE_MANUFACTURERS); |
  |
| 252 | + | $Qproducts->bindTable(':table_products_images', TABLE_PRODUCTS_IMAGES); |
|
250 | 253 | | $Qproducts->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION); |
  |
| 254 | + | $Qproducts->bindInt(':default_flag', 1); |
  |
251 | 255 | | $Qproducts->bindInt(':language_id', $osC_Language->getID()); |
| |
252 | 256 | | $Qproducts->setBatchLimit($_GET['page'], MAX_DISPLAY_PRODUCTS_NEW); |
| |
253 | 257 | | $Qproducts->execute(); |
|