  |
5 | 5 | | osCommerce, Open Source E-Commerce Solutions |
| |
6 | 6 | | http://www.oscommerce.com |
| |
7 | 7 | | |
  |
8 | | - | Copyright (c) 2005 osCommerce |
| |
| 8 | + | Copyright (c) 2006 osCommerce |
|
9 | 9 | | |
| |
10 | 10 | | Released under the GNU General Public License |
| |
11 | 11 | | */ |
| |
|
|
 |
… |
|
132 | 132 | | } |
| |
133 | 133 | | |
| |
134 | 134 | | function &execute() { |
  |
135 | | - | global $osC_Database, $osC_Customer, $osC_Currencies, $osC_Language; |
| |
| 135 | + | global $osC_Database, $osC_Customer, $osC_Currencies, $osC_Language, $osC_Image; |
|
136 | 136 | | |
  |
137 | | - | $Qlisting = $osC_Database->query('select SQL_CALC_FOUND_ROWS distinct p.*, pd.*, m.*, if(s.status, s.specials_new_products_price, null) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price'); |
| |
| 137 | + | $Qlisting = $osC_Database->query('select SQL_CALC_FOUND_ROWS distinct p.*, pd.*, m.*, i.image, if(s.status, s.specials_new_products_price, null) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price'); |
|
138 | 138 | | |
| |
139 | 139 | | if (($this->hasPriceSet('from') || $this->hasPriceSet('to')) && (DISPLAY_PRICE_WITH_TAX == '1')) { |
| |
140 | 140 | | $Qlisting->appendQuery(', sum(tr.tax_rate) as tax_rate'); |
| |
141 | 141 | | } |
| |
142 | 142 | | |
  |
143 | | - | $Qlisting->appendQuery('from :table_products p left join :table_manufacturers m using(manufacturers_id) left join :table_specials s on (p.products_id = s.products_id)'); |
| |
| 143 | + | $Qlisting->appendQuery('from :table_products p left join :table_manufacturers m using(manufacturers_id) left join :table_specials s on (p.products_id = s.products_id) left join :table_images i on (p.products_id = i.for_id and i.images_groups_id = :images_groups_id)'); |
|
144 | 144 | | $Qlisting->bindTable(':table_products', TABLE_PRODUCTS); |
| |
145 | 145 | | $Qlisting->bindTable(':table_manufacturers', TABLE_MANUFACTURERS); |
| |
146 | 146 | | $Qlisting->bindTable(':table_specials', TABLE_SPECIALS); |
  |
| 147 | + | $Qlisting->bindTable(':table_images', TABLE_IMAGES); |
| |
| 148 | + | $Qlisting->bindInt(':images_groups_id', $osC_Image->getID('default')); |
  |
147 | 149 | | |
| |
148 | 150 | | if (($this->hasPriceSet('from') || $this->hasPriceSet('to')) && (DISPLAY_PRICE_WITH_TAX == '1')) { |
| |
149 | 151 | | if ($osC_Customer->isLoggedOn()) { |