XML messed up - Opencart

Vikacalci

New Member
im trying to build an mirror site to my Opencart system, its like an XML page that shows all the products and categories..the problem is that everything in there is messed and not working in explorer and fire fox, i dont know why :\this is the URL:http://www.hd1.co.il/index.php?route=zapindexthis is the page that messed up:\[code\]<?php \[/code\]class Controllerzapprod extends Controller {\[code\]public function plainText($description){ $description = strip_tags(html_entity_decode($description)); $description = str_replace('&nbsp;', ' ', $description); $description = str_replace('"', '"', $description ); $description = str_replace("'", ''', $description ); $description = str_replace('<', '<', $description ); $description = str_replace('>', '>', $description ); $description = str_replace("\n", ' ', $description ); $description = str_replace("\r", ' ', $description ); $description = preg_replace('/&#?[a-z0-9]+;/i',' ',$description); // remove any html entities.. $description = preg_replace('/\s{2,}/i', ' ', $description ); return substr($description, 0, 5000 ); }public function index() { if(isset($this->request->get['cat'])){ $output = '<? xml version="1.0" encoding="UTF-8" ?>'; $output .= '<STORE URL="' . HTTP_SERVER . '" DATE="'. date('d.m.Y') .'" TIME="'. date('H:i:s') .'" NAME="'. $this->config->get('config_name') .'" STATUS="ONLINE" ID="0">'; $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->load->model('tool/image'); $data = http://stackoverflow.com/questions/11212134/array('filter_category_id' => $this->request->get['cat'], 'sort' => '', 'order' => '', 'start' => '', 'limit' => '' ); $products = $this->model_catalog_product->getProducts($data); $output .= '<PRODUCTS>'; foreach ($products as $product) { $output .= '<PRODUCT>'; $output .= '<PRODUCT_NAME>' . $product['name'] . '</PRODUCT_NAME>'; $output .= '<PRODUCT_URL>' . HTTP_SERVER . 'index.php?route=product/product&product_id=' . $product['product_id'] . '</PRODUCT_URL>'; $output .= '<DETAILS>HEY</DETAILS>'; $output .= '<MANUFACTURER>' . $this->plainText($product['manufacturer']) . '</MANUFACTURER>'; $output .= '<CATALOG_NUMBER>' . $product['product_id'] . '</CATALOG_NUMBER>'; if ($product['image']) { $output .= '<IMAGE>' . $this->model_tool_image->resize($product['image'], 500, 500) . '</IMAGE>'; } else { $output .= '<IMAGE>' . $this->model_tool_image->resize('no_image.jpg', 500, 500) . '</IMAGE>'; } $output .= '<MODEL>' . $product['model'] . '</MODEL>'; $output .= '<CURRENCY>ILS</CURRENCY>'; if ((float)$product['special']) { $output .= '<PRICE>' . $new_string = substr($product['price'], 0, strpos($product['special'], '.')) . '</PRICE>'; } else { $output .= '<PRICE>' . $new_string = substr($product['price'], 0, strpos($product['price'], '.')) . '</PRICE>'; } $output .= '<SHIPMENT_COST>0</SHIPMENT_COST>'; $output .= '<DELIVERY_TIME>7</DELIVERY_TIME>'; $output .= '<WARRANTY />'; $output .= '<TAX />'; $output .= '</PRODUCT>'; } $output .= '</PRODUCTS>'; $output .= '</STORE>'; $this->response->addHeader('Content-Type: text/xml;'); $this->response->setOutput($output); }else { header('Location: http://www.hd1.co.il/index.php?route=zapindex'); } }\[/code\]}?>
 
Back
Top