  |
127 | 127 | | } |
| |
128 | 128 | | |
| |
129 | 129 | | function getProducts() { |
  |
130 | | - | global $osC_Database, $osC_Services, $osC_Currencies, $osC_Specials; |
| |
131 | | - | |
|
132 | 130 | | $history = array(); |
| |
133 | 131 | | |
| |
134 | 132 | | if (isset($this->visits['products']) && (empty($this->visits['products']) === false)) { |
| |
|
|
 |
… |
|
137 | 135 | | foreach ($this->visits['products'] as $k => $v) { |
| |
138 | 136 | | $counter++; |
| |
139 | 137 | | |
  |
140 | | - | $cpath = tep_get_product_path($this->visits['products'][$k]['id']); |
| |
141 | | - | $parts = explode("_", $cpath); |
| |
142 | | - | $cat_id = $parts[sizeof($parts)-1]; |
| |
| 138 | + | $osC_Product = new osC_Product($v['id']); |
| |
| 139 | + | $osC_Category = new osC_Category($osC_Product->getCategoryID()); |
|
143 | 140 | | |
  |
144 | | - | $Qcategory = $osC_Database->query('select categories_name from :table_categories_description where categories_id = :categories_id and language_id = :language_id'); |
| |
145 | | - | $Qcategory->bindTable(':table_categories_description', TABLE_CATEGORIES_DESCRIPTION); |
| |
146 | | - | $Qcategory->bindInt(':categories_id', $cat_id); |
| |
147 | | - | $Qcategory->bindInt(':language_id', $_SESSION['languages_id']); |
| |
148 | | - | $Qcategory->execute(); |
| |
149 | | - | |
| |
150 | | - | $Qproduct = $osC_Database->query('select p.products_price, p.products_tax_class_id, p.products_image, pd.products_name, pd.products_keyword from :table_products p, :table_products_description pd where p.products_id = :products_id and p.products_status = 1 and pd.products_id = :products_id and pd.language_id = :language_id'); |
| |
151 | | - | $Qproduct->bindTable(':table_products', TABLE_PRODUCTS); |
| |
152 | | - | $Qproduct->bindTable(':table_products_description', TABLE_PRODUCTS_DESCRIPTION); |
| |
153 | | - | $Qproduct->bindInt(':products_id', $this->visits['products'][$k]['id']); |
| |
154 | | - | $Qproduct->bindInt(':products_id', $this->visits['products'][$k]['id']); |
| |
155 | | - | $Qproduct->bindInt(':language_id', $_SESSION['languages_id']); |
| |
156 | | - | $Qproduct->execute(); |
| |
157 | | - | |
| |
158 | | - | if (SERVICE_RECENTLY_VISITED_SHOW_PRICE == 'True') { |
| |
159 | | - | if ( ($osC_Services->isStarted('specials')) && ($new_price = $osC_Specials->getPrice($this->visits['products'][$k]['id'])) ) { |
| |
160 | | - | $products_price = '<s>' . $osC_Currencies->displayPrice($Qproduct->value('products_price'), $Qproduct->valueInt('products_tax_class_id')) . '</s> <span class="productSpecialPrice">' . $osC_Currencies->displayPrice($new_price, $Qproduct->valueInt('products_tax_class_id')) . '</span>'; |
| |
161 | | - | } else { |
| |
162 | | - | $products_price = $osC_Currencies->displayPrice($Qproduct->value('products_price'), $Qproduct->valueInt('products_tax_class_id')); |
| |
163 | | - | } |
| |
164 | | - | } |
| |
165 | | - | |
| |
166 | | - | $history[] = array('name' => $Qproduct->value('products_name'), |
| |
167 | | - | 'id' => $this->visits['products'][$k]['id'], |
| |
168 | | - | 'keyword' => $Qproduct->value('products_keyword'), |
| |
169 | | - | 'price' => (SERVICE_RECENTLY_VISITED_SHOW_PRICE == 'True') ? $products_price : '', |
| |
170 | | - | 'image' => $Qproduct->value('products_image'), |
| |
171 | | - | 'category_name' => $Qcategory->value('categories_name'), |
| |
172 | | - | 'category_path' => $cpath |
| |
| 141 | + | $history[] = array('name' => $osC_Product->getTitle(), |
| |
| 142 | + | 'id' => $osC_Product->getID(), |
| |
| 143 | + | 'keyword' => $osC_Product->getKeyword(), |
| |
| 144 | + | 'price' => (SERVICE_RECENTLY_VISITED_SHOW_PRICE == 'True') ? $osC_Product->getPriceFormated(true) : '', |
| |
| 145 | + | 'image' => $osC_Product->getImage(), |
| |
| 146 | + | 'category_name' => $osC_Category->getTitle(), |
| |
| 147 | + | 'category_path' => $osC_Category->getPath() |
|
173 | 148 | | ); |
| |
174 | 149 | | |
| |
175 | 150 | | if ($counter == MAX_RECENTLY_VISITED_PRODUCTS) { |
| |
|
|
 |
… |
|
190 | 165 | | } |
| |
191 | 166 | | |
| |
192 | 167 | | function getCategories() { |
  |
193 | | - | global $osC_CategoryTree; |
| |
194 | | - | |
|
195 | 168 | | $history = array(); |
| |
196 | 169 | | |
| |
197 | 170 | | if (isset($this->visits['categories']) && (empty($this->visits['categories']) === false)) { |
| |
|
|
 |
… |
|
206 | 179 | | $osC_CategoryParent = new osC_Category($osC_Category->getParent()); |
| |
207 | 180 | | } |
| |
208 | 181 | | |
  |
209 | | - | $history[] = array('parents_name' => ($osC_Category->hasParent()) ? $osC_CategoryParent->getTitle() : '', |
| |
210 | | - | 'parents_id' => ($osC_Category->hasParent()) ? $osC_CategoryParent->getID() : '', |
| |
211 | | - | 'category_name' => $osC_Category->getTitle(), |
| |
212 | | - | 'category_id' => $osC_Category->getPath() |
| |
| 182 | + | $history[] = array('id' => $osC_Category->getID(), |
| |
| 183 | + | 'name' => $osC_Category->getTitle(), |
| |
| 184 | + | 'path' => $osC_Category->getPath(), |
| |
| 185 | + | 'image' => $osC_Category->getImage(), |
| |
| 186 | + | 'parent_name' => ($osC_Category->hasParent()) ? $osC_CategoryParent->getTitle() : '', |
| |
| 187 | + | 'parent_id' => ($osC_Category->hasParent()) ? $osC_CategoryParent->getID() : '' |
  |
213 | 188 | | ); |
| |
214 | 189 | | |
| |
215 | 190 | | if ($counter == MAX_RECENTLY_VISITED_CATEGORIES) { |