iticleonel.len Posted June 18, 2013 Share Posted June 18, 2013 Hi, I need to add the content of a cmd page, in the content include a image, but i don't know how obtain it. That the image of the code and where i want to put the content.. I try to used {$cms_page.content} but it not work Link to comment Share on other sites More sharing options...
vekia Posted June 18, 2013 Share Posted June 18, 2013 it's because $cms_titles variable is defined with: $cms_titles = BlockCMSModel::getCMSTitles($column); sql query for function looks like: $sql = 'SELECT bcp.`id_cms`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'cms_block_page` bcp INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (bcp.`id_cms` = cl.`id_cms_category`) WHERE bcp.`id_cms_block` = '.(int)$id_cms_block.' AND cl.`id_lang` = '.(int)Context::getContext()->language->id.' AND bcp.`is_category` = 1'; there is no content, so you have to modify the query to achieve what you want Link to comment Share on other sites More sharing options...
iticleonel.len Posted June 18, 2013 Author Share Posted June 18, 2013 it's because $cms_titles variable is defined with: $cms_titles = BlockCMSModel::getCMSTitles($column); sql query for function looks like: $sql = 'SELECT bcp.`id_cms`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'cms_block_page` bcp INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl ON (bcp.`id_cms` = cl.`id_cms_category`) WHERE bcp.`id_cms_block` = '.(int)$id_cms_block.' AND cl.`id_lang` = '.(int)Context::getContext()->language->id.' AND bcp.`is_category` = 1'; there is no content, so you have to modify the query to achieve what you want Entonces en el archivo blockCMSModel.php tengo que modificar cual function? pues getCMSTitles es: public static function getCMSTitles($location, $id_shop = false) { $content = array(); $context = Context::getContext(); $cmsCategories = BlockCMSModel::getCMSCategoriesByLocation($location, $id_shop); if (is_array($cmsCategories) && count($cmsCategories)) { foreach ($cmsCategories as $cmsCategory) { $key = (int)$cmsCategory['id_cms_block']; $content[$key]['display_store'] = $cmsCategory['display_store']; $content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block']); $links = array(); if (count($content[$key]['cms'])) { foreach ($content[$key]['cms'] as $row) { $row['link'] = $context->link->getCMSLink((int)($row['id_cms']), $row['link_rewrite']); $links[] = $row; } } Tengo que modificar entonces getCMSBlockPages. Cierto? public static function getCMSBlockPages($id_block) { $sql = 'SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'cms_block_page` bcp INNER JOIN `'._DB_PREFIX_.'cms_lang` cl ON (bcp.`id_cms` = cl.`id_cms`) INNER JOIN `'._DB_PREFIX_.'cms` c ON (bcp.`id_cms` = c.`id_cms`) WHERE bcp.`id_cms_block` = '.(int)$id_block.' AND cl.`id_lang` = '.(int)Context::getContext()->language->id.' AND bcp.`is_category` = 0 AND c.`active` = 1 ORDER BY `position`'; return Db::getInstance()->executeS($sql); } $content[$key]['cms'] = $links; $content[$key]['categories'] = BlockCMSModel::getCMSBlockPagesCategories($cmsCategory['id_cms_block']); $links = array(); if (count($content[$key]['categories'])) { foreach ($content[$key]['categories'] as $row) { $row['link'] = $context->link->getCMSCategoryLink((int)$row['id_cms'], $row['link_rewrite']); $links[] = $row; } } $content[$key]['categories'] = $links; $content[$key]['name'] = $cmsCategory['block_name']; $content[$key]['category_link'] = $context->link->getCMSCategoryLink((int)$cmsCategory['id_cms_category'], $cmsCategory['link_rewrite']); $content[$key]['category_name'] = $cmsCategory['category_name']; } } return $content; } Link to comment Share on other sites More sharing options...
vekia Posted June 18, 2013 Share Posted June 18, 2013 hello, can you use engish language here? if so, please correct your post, im convinced that many developers here don't know spanish as well as you Link to comment Share on other sites More sharing options...
iticleonel.len Posted June 18, 2013 Author Share Posted June 18, 2013 hello, can you use engish language here? if so, please correct your post, im convinced that many developers here don't know spanish as well as you So, I need to modify the file blockCMSModel.php ? because the function getCMSTitles is: public static function getCMSTitles($location, $id_shop = false) { $content = array(); $context = Context::getContext(); $cmsCategories = BlockCMSModel::getCMSCategoriesByLocation($location, $id_shop); if (is_array($cmsCategories) && count($cmsCategories)) { foreach ($cmsCategories as $cmsCategory) { $key = (int)$cmsCategory['id_cms_block']; $content[$key]['display_store'] = $cmsCategory['display_store']; $content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block']); $links = array(); if (count($content[$key]['cms'])) { foreach ($content[$key]['cms'] as $row) { $row['link'] = $context->link->getCMSLink((int)($row['id_cms']), $row['link_rewrite']); $links[] = $row; } } So I need fodify the funtion getCMSBlockPages ? that is public static function getCMSBlockPages($id_block) { $sql = 'SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'cms_block_page` bcp INNER JOIN `'._DB_PREFIX_.'cms_lang` cl ON (bcp.`id_cms` = cl.`id_cms`) INNER JOIN `'._DB_PREFIX_.'cms` c ON (bcp.`id_cms` = c.`id_cms`) WHERE bcp.`id_cms_block` = '.(int)$id_block.' AND cl.`id_lang` = '.(int)Context::getContext()->language->id.' AND bcp.`is_category` = 0 AND c.`active` = 1 ORDER BY `position`'; return Db::getInstance()->executeS($sql); } $content[$key]['cms'] = $links; $content[$key]['categories'] = BlockCMSModel::getCMSBlockPagesCategories($cmsCategory['id_cms_block']); $links = array(); if (count($content[$key]['categories'])) { foreach ($content[$key]['categories'] as $row) { $row['link'] = $context->link->getCMSCategoryLink((int)$row['id_cms'], $row['link_rewrite']); $links[] = $row; } } $content[$key]['categories'] = $links; $content[$key]['name'] = $cmsCategory['block_name']; $content[$key]['category_link'] = $context->link->getCMSCategoryLink((int)$cmsCategory['id_cms_category'], $cmsCategory['link_rewrite']); $content[$key]['category_name'] = $cmsCategory['category_name']; } } return $content; } to public static function getCMSBlockPages($id_block) { $sql = 'SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite`, cl.`content` FROM `'._DB_PREFIX_.'cms_block_page` bcp INNER JOIN `'._DB_PREFIX_.'cms_lang` cl ON (bcp.`id_cms` = cl.`id_cms`) INNER JOIN `'._DB_PREFIX_.'cms` c ON (bcp.`id_cms` = c.`id_cms`) WHERE bcp.`id_cms_block` = '.(int)$id_block.' AND cl.`id_lang` = '.(int)Context::getContext()->language->id.' AND bcp.`is_category` = 0 AND c.`active` = 1 ORDER BY `position`'; return Db::getInstance()->executeS($sql); } $content[$key]['cms'] = $links; $content[$key]['categories'] = BlockCMSModel::getCMSBlockPagesCategories($cmsCategory['id_cms_block']); $links = array(); if (count($content[$key]['categories'])) { foreach ($content[$key]['categories'] as $row) { $row['link'] = $context->link->getCMSCategoryLink((int)$row['id_cms'], $row['link_rewrite']); $links[] = $row; } } $content[$key]['categories'] = $links; $content[$key]['name'] = $cmsCategory['block_name']; $content[$key]['category_link'] = $context->link->getCMSCategoryLink((int)$cmsCategory['id_cms_category'], $cmsCategory['link_rewrite']); $content[$key]['category_name'] = $cmsCategory['category_name']; } } return $content; } Link to comment Share on other sites More sharing options...
vekia Posted June 18, 2013 Share Posted June 18, 2013 you hae to add content to the function: $content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block']); $sql = 'SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite`, cl.content FROM `'._DB_PREFIX_.'cms_block_page` bcp INNER JOIN `'._DB_PREFIX_.'cms_lang` cl ON (bcp.`id_cms` = cl.`id_cms`) INNER JOIN `'._DB_PREFIX_.'cms` c ON (bcp.`id_cms` = c.`id_cms`) WHERE bcp.`id_cms_block` = '.(int)$id_block.' AND cl.`id_lang` = '.(int)Context::getContext()->language->id.' AND bcp.`is_category` = 0 AND c.`active` = 1 ORDER BY `position`'; Link to comment Share on other sites More sharing options...
iticleonel.len Posted June 18, 2013 Author Share Posted June 18, 2013 you hae to add content to the function: $content[$key]['cms'] = BlockCMSModel::getCMSBlockPages($cmsCategory['id_cms_block']); $sql = 'SELECT cl.`id_cms`, cl.`meta_title`, cl.`link_rewrite`, cl.content FROM `'._DB_PREFIX_.'cms_block_page` bcp INNER JOIN `'._DB_PREFIX_.'cms_lang` cl ON (bcp.`id_cms` = cl.`id_cms`) INNER JOIN `'._DB_PREFIX_.'cms` c ON (bcp.`id_cms` = c.`id_cms`) WHERE bcp.`id_cms_block` = '.(int)$id_block.' AND cl.`id_lang` = '.(int)Context::getContext()->language->id.' AND bcp.`is_category` = 0 AND c.`active` = 1 ORDER BY `position`'; Thanks!! Link to comment Share on other sites More sharing options...
vekia Posted June 18, 2013 Share Posted June 18, 2013 im going to mark this thread as solved (i tested it on my own store and works like a charm) so if you've got any questions related to this case - feel free to write btw. what editor you use? http://www.divento.com.gridhosted.co.uk/foro1.png regards Link to comment Share on other sites More sharing options...
Recommended Posts