Exemplo n.º 1
0
 public function ajaxPreviewTemplate($content, $id_lang)
 {
     // work around for the tinyMCE bug deleting the css line
     $css_line = '<link rel="stylesheet" type="text/css" href="' . $this->_getModuleUrl() . 'views/css/ebay.css" />';
     $content = $css_line . $content;
     // random product
     $category = Category::getRootCategory($id_lang);
     $product = $category->getProducts($id_lang, 0, 1, null, null, false, true, true, 1, false);
     $product = $product[0];
     // data
     $data = array('price' => $product['price'], 'price_without_reduction' => '', 'reduction' => $product['reduction'], 'name' => $product['name'], 'description' => $product['description'], 'description_short' => $product['description_short']);
     if ($data['reduction'] > 0) {
         $data['price_without_reduction'] = $product['price_without_reduction'];
     }
     // pictures product
     $product = new Product($product['id_product'], false, $id_lang);
     $pictures = EbaySynchronizer::_getPictures($product, $this->ebay_profile, $id_lang, $this->context, array());
     $data['large_pictures'] = $pictures['large'];
     $data['medium_pictures'] = $pictures['medium'];
     // features product
     $features_html = '';
     foreach ($product->getFrontFeatures($id_lang) as $feature) {
         $features_html .= '<b>' . $feature['name'] . '</b> : ' . $feature['value'] . '<br/>';
     }
     $data['features'] = $features_html;
     $content = EbaySynchronizer::fillAllTemplate($data, $content);
     echo $content;
 }