config->get('feed_google_base_status')) { $output = ''; $output .= ''; $output .= ' '; $output .= ' ' . $this->config->get('config_name') . ''; $output .= ' ' . $this->config->get('config_meta_description') . ''; $output .= ' ' . $this->config->get('config_url') . ''; $this->load->model('extension/feed/google_base'); $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $product_data = array(); $google_base_categories = $this->model_extension_feed_google_base->getCategories(); foreach ($google_base_categories as $google_base_category) { $filter_data = array( 'filter_category_id' => $google_base_category['category_id'], 'filter_filter' => false ); $products = $this->model_catalog_product->getProducts($filter_data); foreach ($products as $product) { if (!in_array($product['product_id'], $product_data) && $product['description']) { $product_data[] = $product['product_id']; $output .= ''; $output .= '<![CDATA[' . $product['name'] . ']]>'; $output .= '' . $this->url->link('product/product', 'product_id=' . $product['product_id']) . ''; $output .= ''; $output .= ''; $output .= 'new'; $output .= '' . $product['product_id'] . ''; if ($product['image']) { $output .= ' ' . $this->model_tool_image->resize($product['image'], 500, 500) . ''; } else { $output .= ' '; } $output .= ' ' . $product['model'] . ''; if ($product['mpn']) { $output .= ' ' ; } else { $output .= ' false'; } if ($product['upc']) { $output .= ' ' . $product['upc'] . ''; } if ($product['ean']) { $output .= ' ' . $product['ean'] . ''; } $currencies = array( 'USD', 'EUR', 'GBP' ); if (in_array($this->session->data['currency'], $currencies)) { $currency_code = $this->session->data['currency']; $currency_value = $this->currency->getValue($this->session->data['currency']); } else { $currency_code = 'USD'; $currency_value = $this->currency->getValue('USD'); } if ((float)$product['special']) { $output .= ' ' . $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id']), $currency_code, $currency_value, false) . ''; } else { $output .= ' ' . $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id']), $currency_code, $currency_value, false) . ''; } $output .= ' ' . $google_base_category['google_base_category_id'] . ''; $categories = $this->model_catalog_product->getCategories($product['product_id']); foreach ($categories as $category) { $path = $this->getPath($category['category_id']); if ($path) { $string = ''; foreach (explode('_', $path) as $path_id) { $category_info = $this->model_catalog_category->getCategory($path_id); if ($category_info) { if (!$string) { $string = $category_info['name']; } else { $string .= ' > ' . $category_info['name']; } } } $output .= ''; } } $output .= ' ' . $product['quantity'] . ''; $output .= ' ' . $this->weight->format($product['weight'], $product['weight_class_id']) . ''; $output .= ' '; $output .= ''; } } } $output .= ' '; $output .= ''; $this->response->addHeader('Content-Type: application/rss+xml'); $this->response->setOutput($output); } } protected function getPath($parent_id, $current_path = '') { $category_info = $this->model_catalog_category->getCategory($parent_id); if ($category_info) { if (!$current_path) { $new_path = $category_info['category_id']; } else { $new_path = $category_info['category_id'] . '_' . $current_path; } $path = $this->getPath($category_info['parent_id'], $new_path); if ($path) { return $path; } else { return $new_path; } } } }