Exemplo n.º 1
0
 public function hookDisplayAdminProductsExtra()
 {
     if (!Module::isInstalled('ph_simpleblog') || !Module::isEnabled('ph_simpleblog')) {
         return;
     }
     $product = new Product(Tools::getValue('id_product'), false, $this->context->cookie->id_lang);
     $posts = SimpleBlogPost::getSimplePosts($this->context->language->id);
     $selected_posts = array();
     $related_posts = array();
     foreach (SimpleBlogRelatedPost::getByProductId($product->id) as $key => $post) {
         $related_posts[] = $post['id_simpleblog_post'];
     }
     if (sizeof($related_posts) > 0) {
         $posts = SimpleBlogPost::getSimplePosts($this->context->language->id, null, null, 'NOT IN', $related_posts);
         $selected_posts = SimpleBlogPost::getSimplePosts($this->context->language->id, null, null, 'IN', $related_posts);
     }
     $this->context->smarty->assign(array('product' => $product, 'posts' => $posts, 'selected_posts' => $selected_posts, 'module_path' => $this->_path, 'secure_key' => $this->secure_key, 'is_16' => (bool) (version_compare(_PS_VERSION_, '1.6.0', '>=') === true)));
     return $this->display(__FILE__, 'admin-tab.tpl');
 }