} } global $smarty; $id_shop = $context->shop->id; $id_lang = $context->language->id; $id_tdpost = Tools::getValue('tdpost'); if (Tools::getValue('replytocom')) { $replytocom = Tools::getValue('replytocom'); } else { $replytocom = 0; } $numofrepost = Configuration::get('td_numofrepost') ? Configuration::get('td_numofrepost') : 5; $numofcomments = Configuration::get('td_numofcomments') ? Configuration::get('td_numofcomments') : 5; $postcomments = tdpsblogModel::getComments($id_tdpost); $posttotalcomments = count(tdpsblogModel::getTotalCommentsByPost($id_tdpost)); $postcateogyr = tdpsblogModel::getPostCategory(); //print_r($postcateogyr); // print_r($postcomments); $tdblogpspost = $psblogobject->gettdBlogPostByID($id_tdpost, $id_lang, $id_shop); $data = array(); foreach ($tdblogpspost as $tdblogps) { $data[] = $tdblogps; } if (file_exists(_PS_THEME_DIR_ . 'modules/tdpsblog/form.tpl')) { $smarty->assign('comments_form', _PS_THEME_DIR_ . 'modules/tdpsblog/form.tpl'); } else { $smarty->assign('comments_form', _PS_MODULE_DIR_ . 'tdpsblog/views/templates/front/form.tpl'); } if (file_exists(_PS_THEME_DIR_ . 'modules/tdpsblog/comments.tpl')) { $smarty->assign('comments_tmp', _PS_THEME_DIR_ . 'modules/tdpsblog/comments.tpl'); } else {
public static function getPostCategory($parent = 0) { $context = Context::getContext(); $id_shop = $context->shop->id; $id_lang = $context->language->id; $results = Db::getInstance()->ExecuteS(' SELECT ctd.`id_tdpsblog_category`, ctd.`category_parent`, ctd.`active`, ctd.`id_shop`, ctd1.`category_name`, ctd1.`id_lang`, ctd1.`cat_rewrite` FROM `' . _DB_PREFIX_ . 'tdpsblog_category` ctd INNER JOIN `' . _DB_PREFIX_ . 'tdpsblog_category_lang` ctd1 ON (ctd.`id_tdpsblog_category` = ctd1.`id_tdpsblog_category`) WHERE ctd1.`id_lang` = ' . (int) $context->language->id . ' AND ctd.active = 1 ' . 'AND ctd.category_parent =' . (int) $parent . ' ORDER BY ctd.id_tdpsblog_category ASC'); foreach ($results as $result) { $sub_cat = tdpsblogModel::getPostCategory($result['id_tdpsblog_category']); if ($sub_cat && count($sub_cat) > 0) { $result['sub_category'] = $sub_cat; } $tdpspostcategory[] = $result; } return isset($tdpspostcategory) ? $tdpspostcategory : false; }