  |
20 | 20 | | |
| |
21 | 21 | | if ( !empty($id) ) { |
| |
22 | 22 | | if ( is_numeric($id) ) { |
  |
23 | | - | $Qproduct = $osC_Database->query('select products_id as id, parent_id, products_quantity as quantity, products_price as price, products_model as model, products_tax_class_id as tax_class_id, products_date_added as date_added, products_date_available as date_available, manufacturers_id, has_children from :table_products where products_id = :products_id and products_status = :products_status'); |
| |
| 23 | + | $Qproduct = $osC_Database->query('select products_id as id, parent_id, products_quantity as quantity, products_price as price, products_model as model, products_tax_class_id as tax_class_id, products_date_added as date_added, manufacturers_id, has_children from :table_products where products_id = :products_id and products_status = :products_status'); |
|
24 | 24 | | $Qproduct->bindTable(':table_products', TABLE_PRODUCTS); |
| |
25 | 25 | | $Qproduct->bindInt(':products_id', $id); |
| |
26 | 26 | | $Qproduct->bindInt(':products_status', 1); |
| |
27 | 27 | | $Qproduct->execute(); |
| |
28 | 28 | | |
| |
29 | 29 | | if ( $Qproduct->numberOfRows() === 1 ) { |
| |
30 | 30 | | $this->_data = $Qproduct->toArray(); |
  |
| 31 | + | |
|
31 | 32 | | $this->_data['master_id'] = $Qproduct->valueInt('id'); |
| |
32 | 33 | | $this->_data['has_children'] = $Qproduct->valueInt('has_children'); |
| |
33 | 34 | | |
| |
|
|
 |
… |
|
57 | 58 | | } |
| |
58 | 59 | | } |
| |
59 | 60 | | } else { |
  |
60 | | - | $Qproduct = $osC_Database->query('select p.products_id as id, p.parent_id, p.products_quantity as quantity, p.products_price as price, p.products_model as model, 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, p.has_children, pd.products_name as name, pd.products_description as description, pd.products_keyword as keyword, pd.products_tags as tags, pd.products_url as url from :table_products p, :table_products_description pd where pd.products_keyword = :products_keyword and pd.language_id = :language_id and pd.products_id = p.products_id and p.products_status = :products_status'); |
| |
| 61 | + | $Qproduct = $osC_Database->query('select p.products_id as id, p.parent_id, p.products_quantity as quantity, p.products_price as price, p.products_model as model, p.products_tax_class_id as tax_class_id, p.products_date_added as date_added, p.manufacturers_id, p.has_children, pd.products_name as name, pd.products_description as description, pd.products_keyword as keyword, pd.products_tags as tags, pd.products_url as url from :table_products p, :table_products_description pd where pd.products_keyword = :products_keyword and pd.language_id = :language_id and pd.products_id = p.products_id and p.products_status = :products_status'); |
|
61 | 62 | | $Qproduct->bindTable(':table_products', TABLE_PRODUCTS); |
| |
62 | 63 | | $Qproduct->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION); |
| |
63 | 64 | | $Qproduct->bindValue(':products_keyword', $id); |
| |
|
|
 |
… |
|
107 | 108 | | 'model' => $Qsubproducts->value('products_model'), |
| |
108 | 109 | | 'quantity' => $Qsubproducts->value('products_quantity'), |
| |
109 | 110 | | 'weight' => $Qsubproducts->value('products_weight'), |
  |
110 | | - | 'weight_class_id' => $Qsubproducts->valueInt('products_weight_class')); |
| |
| 111 | + | 'weight_class_id' => $Qsubproducts->valueInt('products_weight_class'), |
| |
| 112 | + | 'availability_shipping' => 1); |
|
111 | 113 | | |
| |
112 | 114 | | $Qvariants = $osC_Database->query('select pv.default_combo, pvg.id as group_id, pvg.title as group_title, pvg.module, pvv.id as value_id, pvv.title as value_title, pvv.sort_order as value_sort_order from :table_products_variants pv, :table_products_variants_groups pvg, :table_products_variants_values pvv where pv.products_id = :products_id and pv.products_variants_values_id = pvv.id and pvv.languages_id = :languages_id and pvv.products_variants_groups_id = pvg.id and pvg.languages_id = :languages_id order by pvg.sort_order, pvg.title'); |
| |
113 | 115 | | $Qvariants->bindTable(':table_products_variants', TABLE_PRODUCTS_VARIANTS); |
| |
|
|
 |
… |
|
129 | 131 | | } |
| |
130 | 132 | | } |
| |
131 | 133 | | |
  |
| 134 | + | $this->_data['attributes'] = array(); |
| |
| 135 | + | |
| |
| 136 | + | $Qattributes = $osC_Database->query('select tb.code, pa.value from :table_product_attributes pa, :table_templates_boxes tb where pa.products_id = :products_id and pa.languages_id in (0, :languages_id) and pa.id = tb.id'); |
| |
| 137 | + | $Qattributes->bindTable(':table_product_attributes'); |
| |
| 138 | + | $Qattributes->bindTable(':table_templates_boxes'); |
| |
| 139 | + | $Qattributes->bindInt(':products_id', $this->_data['master_id']); |
| |
| 140 | + | $Qattributes->bindInt(':languages_id', $osC_Language->getID()); |
| |
| 141 | + | $Qattributes->execute(); |
| |
| 142 | + | |
| |
| 143 | + | while ( $Qattributes->next() ) { |
| |
| 144 | + | $this->_data['attributes'][$Qattributes->value('code')] = $Qattributes->value('value'); |
| |
| 145 | + | } |
| |
| 146 | + | |
|
132 | 147 | | if ( $osC_Services->isStarted('reviews') ) { |
| |
133 | 148 | | $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'); |
| |
134 | 149 | | $Qavg->bindTable(':table_reviews', TABLE_REVIEWS); |
| |
|
|
 |
… |
|
270 | 285 | | } |
| |
271 | 286 | | |
| |
272 | 287 | | function getDateAvailable() { |
  |
273 | | - | return $this->_data['date_available']; |
| |
| 288 | + | // HPDL |
| |
| 289 | + | return false; //$this->_data['date_available']; |
|
274 | 290 | | } |
| |
275 | 291 | | |
| |
276 | 292 | | function getDateAdded() { |
| |
|
|
 |
… |
|
401 | 417 | | |
| |
402 | 418 | | } |
| |
403 | 419 | | |
  |
| 420 | + | function hasAttribute($code) { |
| |
| 421 | + | return isset($this->_data['attributes'][$code]); |
| |
| 422 | + | } |
| |
| 423 | + | |
| |
| 424 | + | function getAttribute($code) { |
| |
| 425 | + | if ( !class_exists('osC_ProductAttributes_' . $code) ) { |
| |
| 426 | + | if ( file_exists(DIR_FS_CATALOG . 'includes/modules/product_attributes/' . basename($code) . '.php') ) { |
| |
| 427 | + | include(DIR_FS_CATALOG . 'includes/modules/product_attributes/' . basename($code) . '.php'); |
| |
| 428 | + | } |
| |
| 429 | + | } |
| |
| 430 | + | |
| |
| 431 | + | if ( class_exists('osC_ProductAttributes_' . $code) ) { |
| |
| 432 | + | return call_user_func(array('osC_ProductAttributes_' . $code, 'getValue'), $this->_data['attributes'][$code]); |
| |
| 433 | + | } |
| |
| 434 | + | } |
| |
| 435 | + | |
  |
404 | 436 | | function checkEntry($id) { |
| |
405 | 437 | | global $osC_Database; |
| |
406 | 438 | | |