shacker 1,055 Posted December 7, 2009 Posted December 7, 2009 Show categories with thumbnails no need to regenerate! (now with subcategories image and size) added compatibility with url rewriting i update the version to 1.7 and works like the block categories, and now reduce the image in subcategories Updated with Link function for images and solves ssl errors v3.0-blockcategoriesi.zip Share this post Link to post Share on other sites
ysco 77 Posted December 7, 2009 Posted December 7, 2009 Thanks shacker for sharing this free module Probably it is as great as all your other stuff you made, hope that it also works on the module Rocky blockcategoriesnc v2.0.Will try it out and see what happens.Thanks.Best regards,ysco.. Share this post Link to post Share on other sites
shacker 1,055 Posted December 7, 2009 Posted December 7, 2009 Thanks shacker for sharing this free module Probably it is as great as all your other stuff you made, hope that it also works on the module Rocky blockcategoriesnc v2.0.Will try it out and see what happens.Thanks.Best regards,ysco.. Hi Ysco. Maybe this modification works with any categories module. We add more and more modules this week. And i answer you questions today.Best regards Share this post Link to post Share on other sites
ysco 77 Posted December 7, 2009 Posted December 7, 2009 Hello shacker I was just looking at this module but i think that it won`t work easily with the module from Rocky 2.0 cause the files has different names so then i probably must manually add the modifications from yours into the one from rocky and then i don`t know if it works anyway.How you guys do it bringing such many modules in short time ( and all are special ) not just simple ones it is just amazing how you do it Well i wait for your reply later this day buddy.Best regards,ysco.. Share this post Link to post Share on other sites
shacker 1,055 Posted December 7, 2009 Posted December 7, 2009 Hello shacker I was just looking at this module but i think that it won`t work easily with the module from Rocky 2.0 cause the files has different names so then i probably must manually add the modifications from yours into the one from rocky and then i don`t know if it works anyway.How you guys do it bringing such many modules in short time ( and all are special ) not just simple ones it is just amazing how you do it Well i wait for your reply later this day buddy.Best regards,ysco.. Thanks Ysco. We read all your suggestions to develop future modules, and change the actual modules. you are a important customer for us, and your opinion is very useful.best regards. Share this post Link to post Share on other sites
rocky 959 Posted December 7, 2009 Posted December 7, 2009 I was planning to add an option to add category images to the next version of my module. I'll have to have a look at how you did it. It would be better if you added the download as an attachment, so it can be downloaded without registering first, though I understand if you are using this as a method to track who is downloading your modules. Share this post Link to post Share on other sites
jolvil 79 Posted December 7, 2009 Posted December 7, 2009 I suggest to give another name than blockcategories on archive because there are now several blockcategories customed modules with same name.Why not blockcategoriesimage or blockcategoriesimg? it is very easy to do and more usefull ! ;-) Share this post Link to post Share on other sites
shacker 1,055 Posted December 7, 2009 Posted December 7, 2009 I suggest to give another name than blockcategories on archive because there are now several blockcategories customed modules with same name.Why not blockcategoriesimage or blockcategoriesimg? it is very easy to do and more usefull ! ;-) Hi jolvil.The problem is that this is the same block categories, only with image. The idea is replace the original module, no add another one. Share this post Link to post Share on other sites
jolvil 79 Posted December 7, 2009 Posted December 7, 2009 yes I know but the idea is not to confuse when you manage them. If you rename it, you can test it in BO easily, activating ans desactivatiing. I your case you have to overwrite the original module to test it.Having his own name could be better I think Share this post Link to post Share on other sites
shacker 1,055 Posted December 7, 2009 Posted December 7, 2009 I was planning to add an option to add category images to the next version of my module. I'll have to have a look at how you did it. It would be better if you added the download as an attachment, so it can be downloaded without registering first, though I understand if you are using this as a method to track who is downloading your modules. Hi. we add in our site to track the downloads and the the users can view the other modules and themes. Share this post Link to post Share on other sites
shacker 1,055 Posted December 7, 2009 Posted December 7, 2009 yes I know but the idea is not to confuse when you manage them. If you rename it, you can test it in BO easily, activating ans desactivatiing. I your case you have to overwrite the original module to test it.Having his own name could be better I think I understand your point and update very soon.thanks Share this post Link to post Share on other sites
Guillerm 0 Posted December 8, 2009 Posted December 8, 2009 yes I know but the idea is not to confuse when you manage them. If you rename it, you can test it in BO easily, activating ans desactivatiing. I your case you have to overwrite the original module to test it.Having his own name could be better I think I understand your point and update very soon.thanks Gracias! Share this post Link to post Share on other sites
shacker 1,055 Posted December 15, 2009 Posted December 15, 2009 yes I know but the idea is not to confuse when you manage them. If you rename it, you can test it in BO easily, activating ans desactivatiing. I your case you have to overwrite the original module to test it.Having his own name could be better I think I understand your point and update very soon.thanks Gracias! UPDATED. CHANGE THE NAME OF THE MODULE Share this post Link to post Share on other sites
shacker 1,055 Posted May 12, 2010 Posted May 12, 2010 Updated: added image size and subcategories image. Share this post Link to post Share on other sites
pawa 0 Posted November 23, 2010 Posted November 23, 2010 Thank you. I download your module Share this post Link to post Share on other sites
shacker 1,055 Posted November 23, 2010 Posted November 23, 2010 Thank you. I download your module thanks for your comments Share this post Link to post Share on other sites
aga63 1 Posted December 16, 2010 Posted December 16, 2010 The Module does not work sometimesit does not load up the category pictures for some product pages please see the link below, the categories on the left do not show the images.http://www.turkishfootballstore.com/besiktas-store-shop-bjk-kartal-yuvasi/261-besiktas-blanket-.html Share this post Link to post Share on other sites
shacker 1,055 Posted December 16, 2010 Posted December 16, 2010 The Module does not work sometimesit does not load up the category pictures for some product pages please see the link below, the categories on the left do not show the images.http://www.turkishfootballstore.com/besiktas-store-shop-bjk-kartal-yuvasi/261-besiktas-blanket-.html This is becouse the url rewriting.we need to use absolute path Share this post Link to post Share on other sites
aga63 1 Posted December 16, 2010 Posted December 16, 2010 ok thanks, so how can i solve this problem? Share this post Link to post Share on other sites
aga63 1 Posted December 16, 2010 Posted December 16, 2010 sorry i dont know how to programme. can you give me any directions on how to solve this issue please.I am grateful. Share this post Link to post Share on other sites
shacker 1,055 Posted December 17, 2010 Posted December 17, 2010 Redownload. Update with url rewrite compatibility Share this post Link to post Share on other sites
aga63 1 Posted December 17, 2010 Posted December 17, 2010 HiThanks for the update, the module does not work. at all now. please see my website. Share this post Link to post Share on other sites
shacker 1,055 Posted December 17, 2010 Posted December 17, 2010 You can see the module working here:http://www.prestashop-store.com.ar/lang/2-musica-ipodsso i think you have another problem Share this post Link to post Share on other sites
aga63 1 Posted December 17, 2010 Posted December 17, 2010 i dont understand, the previous version was working to an extent. how ever this version does not work at all. why could this be? Share this post Link to post Share on other sites
shacker 1,055 Posted December 17, 2010 Posted December 17, 2010 the only change is in the category-tree-branch.tpl i added this {$base_dir}that links to root.Check if all its uploaded correctly Share this post Link to post Share on other sites
aga63 1 Posted December 17, 2010 Posted December 17, 2010 if i pm you the login details of the ftp can you check. as i have uploaded everything correctly?Thanks Share this post Link to post Share on other sites
shacker 1,055 Posted December 17, 2010 Posted December 17, 2010 no problem, send me the access Share this post Link to post Share on other sites
aga63 1 Posted December 17, 2010 Posted December 17, 2010 hi, i sent the pm. but i cant see it in my sent emails folder. can you confirm that you have received it? Share this post Link to post Share on other sites
shacker 1,055 Posted December 17, 2010 Posted December 17, 2010 i get it. i test today- Share this post Link to post Share on other sites
aga63 1 Posted December 17, 2010 Posted December 17, 2010 thanks for your assistance Share this post Link to post Share on other sites
aga63 1 Posted December 18, 2010 Posted December 18, 2010 any opportunity to test? Share this post Link to post Share on other sites
shacker 1,055 Posted December 21, 2010 Posted December 21, 2010 chek now.you forgot configure image size Share this post Link to post Share on other sites
shacker 1,055 Posted December 21, 2010 Posted December 21, 2010 i added 40 to default image size Share this post Link to post Share on other sites
aga63 1 Posted December 21, 2010 Posted December 21, 2010 Hi Thanks, some improvement but now the module does not work at allplease see hereit only works in some categories and not in othershttp://www.turkishfootballstore.com/besiktas-store-shop-bjk-kartal-yuvasi/263-logo-fc-duvet-set-single-.htmlhttp://www.turkishfootballstore.com/besiktas-store-shop-bjk-kartal-yuvasi/259-1903-fc-duvet-single-duvet-set-.htmlhttp://www.turkishfootballstore.com/besiktas-store-shop-bjk-kartal-yuvasi/260-besiktas-1903-bed-set-single-.htmlhttp://www.turkishfootballstore.com/turkey-international-team-shop-store-shirt-world-cup/63-tr-carnival-hat-triangle.htmlwhen i view the product pages they module does not workplease try to fix it. I am grateful for your contribution Share this post Link to post Share on other sites
shacker 1,055 Posted February 17, 2011 Posted February 17, 2011 Try with the new versionNow is PS 1.4 compatible Share this post Link to post Share on other sites
leeloo 9 Posted March 13, 2011 Posted March 13, 2011 When a category is selected with the module blockcategories, the block remains open on the active category.But with the module blockcategoriesi, the active category is closed.How to have the same effect on active category with the module blockcategoriesi ? Share this post Link to post Share on other sites
shacker 1,055 Posted March 13, 2011 Posted March 13, 2011 what is your site url?and ps version Share this post Link to post Share on other sites
leeloo 9 Posted March 13, 2011 Posted March 13, 2011 Hi,Now i use the blockcategories module and not blockcategoriesi Share this post Link to post Share on other sites
shacker 1,055 Posted March 13, 2011 Posted March 13, 2011 i think is a problem with this version. maybe check the block categories and compare with the block categoriesi to check if some line is changed (not the current img added to the code) Share this post Link to post Share on other sites
ngalfas 5 Posted May 3, 2011 Posted May 3, 2011 i think the module is not compatible with v1.4.1it displays the images ok, but javascript does not work. it's always in non dynamic mode.i tried many things, i checked the code, but no luck... Share this post Link to post Share on other sites
shacker 1,055 Posted May 10, 2011 Posted May 10, 2011 I tested on a fresh install and works fine. Maybe is a conflict with other module Share this post Link to post Share on other sites
ngalfas 5 Posted May 27, 2011 Posted May 27, 2011 i just tested a fresh install. the module works ok when the original categories module is enabled.when i disable the original module, your module does not work in dynamic mode! the option in configuration does noy work.also, the bold letters for category/subcategory are in reverse when you look the original catogories module.i hope you see this and agree with me, because i really like this module and i would like to use it. Share this post Link to post Share on other sites
shacker 1,055 Posted May 27, 2011 Posted May 27, 2011 thanks for advice.i check and update the version Share this post Link to post Share on other sites
shacker 1,055 Posted May 28, 2011 Posted May 28, 2011 i update the version to 1.5 and works like the block categories, and now reduce the image in subcategories Share this post Link to post Share on other sites
ngalfas 5 Posted July 12, 2011 Posted July 12, 2011 i noticed that the module shows the images from http: when the page is shown in https:it's a small glitch that shows a warning window from the browser Share this post Link to post Share on other sites
gorrasriders 1 Posted July 12, 2011 Posted July 12, 2011 thanks for the module look fine Share this post Link to post Share on other sites
shacker 1,055 Posted July 14, 2011 Posted July 14, 2011 Module updated with ssl option and Link function for images Share this post Link to post Share on other sites
shopero 0 Posted July 31, 2011 Posted July 31, 2011 Thanks for share it, it's a big help Share this post Link to post Share on other sites
ill7 3 Posted December 22, 2011 Posted December 22, 2011 Hola shacker, gracias por el módulo blockcategoriesi Lo he probado y aparentemente funciona muy bien visualmente, añadiendo fotografías a la izquierda de cada categoría, pero al tenerlo activado resulta que hay un problema a la hora de usar atributos sobre un producto con variaciones en su precio. Me explico: Si usamos por ejemplo, el grupo de atributos de colores y para por ej, el color azul mantenemos el precio normal del producto, pero para el color rojo le asignamos un incremento de "X" euros, a la hora de probarlo no funciona la variación de precio del atributo, a menos qué, se esté logueado en la tienda. Si no estas logueado, no cambia el precio. En cambio con el módulo de Categorías sin imágenes por defecto de Prestashop, el precio si varía estés o no logueado en la tienda. ¿Sabrías algo acerca de este problema? Muchas gracias por adelantado Un saludo Share this post Link to post Share on other sites
shacker 1,055 Posted January 4, 2012 Posted January 4, 2012 updated to PS 1.5 Share this post Link to post Share on other sites
shacker 1,055 Posted January 9, 2012 Posted January 9, 2012 que version de presta tienes? Share this post Link to post Share on other sites
buggindave 5 Posted October 2, 2012 Posted October 2, 2012 Hello, I installed your module on my Prestashop 1.5 and got the following debug error after the site wouldn't load. I disabled the default category module as well... Fatal error: Call to undefined method Shop::getID() in /home6/smallpet/public_html/ps150/modules/blockcategoriesi/blockcategoriesi.php on line 282 How do I solve this? Thanks! -Dave 1 Share this post Link to post Share on other sites
buggindave 5 Posted October 2, 2012 Posted October 2, 2012 <?php class BlockCategoriesi extends Module { function __construct() { $this->name = 'blockcategoriesi'; if(_PS_VERSION_ > "1.4.0.0"){ $this->tab = 'front_office_features'; $this->author = 'RSI'; $this->need_instance = 0; }else{ $this->tab = 'Blocks'; } $this->version = 1.7; parent::__construct(); $this->displayName = $this->l('Categories block image'); $this->description = $this->l('Adds a block featuring product categories - www.catalogo-onlienrsi.com.ar'); } function install() { if(_PS_VERSION_ < "1.4.0.0"){ if (parent::install() == false OR $this->registerHook('leftColumn') == false OR Configuration::updateValue('BLOCK_CATEGI_MAX_DEPTH', 3) == false OR Configuration::updateValue('BLOCK_CATEGI_DHTML', 1) == false OR Configuration::updateValue('BLOCK_CATEGI_IMAGE', 40) == false) return false; return true; } else{ if (!parent::install() OR !$this->registerHook('leftColumn') OR !$this->registerHook('header') OR // Temporary hooks. Do NOT hook any module on it. Some CRUD hook will replace them as soon as possible. !$this->registerHook('categoryAddition') OR !$this->registerHook('categoryUpdate') OR !$this->registerHook('categoryDeletion') OR !Configuration::updateValue('BLOCK_CATEGI_MAX_DEPTH', 3) OR !Configuration::updateValue('BLOCK_CATEGI_DHTML', 1)OR !Configuration::updateValue('BLOCK_CATEGI_IMAGE', 40)) return false; return true; } } public function getContent() { $output = '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitBlockCategoriesi')) { $maxDepth = intval(Tools::getValue('maxDepth')); $dhtml = Tools::getValue('dhtml'); $image = Tools::getValue('image'); if ($maxDepth < 0) $output .= '<div class="alert error">'.$this->l('Maximum depth: Invalid number.').'</div>'; elseif ($dhtml != 0 AND $dhtml != 1) $output .= '<div class="alert error">'.$this->l('Dynamic HTML: Invalid choice.').'</div>'; else { Configuration::updateValue('BLOCK_CATEGI_MAX_DEPTH', intval($maxDepth)); Configuration::updateValue('BLOCK_CATEGI_DHTML', intval($dhtml)); Configuration::updateValue('BLOCK_CATEGI_IMAGE', $image); $output .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Settings updated').'</div>'; } } return $output.$this->displayForm(); } public function displayForm() { return ' <form action="'.$_SERVER['REQUEST_URI'].'" method="post"> <fieldset> <legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend> <label>'.$this->l('Maximum depth').'</label> <div class="margin-form"> <input type="text" name="maxDepth" value="'.Configuration::get('BLOCK_CATEGI_MAX_DEPTH').'" /> <p class="clear">'.$this->l('Set the maximum depth of sublevels displayed in this block (0 = infinite)').'</p> </div> <label>'.$this->l('Image size').'</label> <div class="margin-form"> <input type="text" name="image" value="'.Configuration::get('BLOCK_CATEGI_IMAGE').'" /> </div> <label>'.$this->l('Dynamic').'</label> <div class="margin-form"> <input type="radio" name="dhtml" id="dhtml_on" value="1" '.(Tools::getValue('dhtml', Configuration::get('BLOCK_CATEGI_DHTML')) ? 'checked="checked" ' : '').'/> <label class="t" for="dhtml_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label> <input type="radio" name="dhtml" id="dhtml_off" value="0" '.(!Tools::getValue('dhtml', Configuration::get('BLOCK_CATEGI_DHTML')) ? 'checked="checked" ' : '').'/> <label class="t" for="dhtml_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label> <p class="clear">'.$this->l('Activate dynamic (animated) mode for sublevels').'</p> </div> <center><input type="submit" name="submitBlockCategoriesi" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Contribute').'</legend> <p class="clear">'.$this->l('You can contribute with a donation if our free modules and themes are usefull for you. Clic on the link and support us!').'</p> <p class="clear">'.$this->l('For more modules & themes visit: www.catalogo-onlinersi.com.ar').'</p> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="HMBZNQAHN9UMJ"> <input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" width="1" height="1"> </fieldset> </form>'; } public function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0) { global $link; $children = array(); if (isset($resultParents[$id_category]) AND sizeof($resultParents[$id_category]) AND ($maxDepth == 0 OR $currentDepth < $maxDepth)) foreach ($resultParents[$id_category] as $subcat) $children[] = $this->getTree($resultParents, $resultIds, $maxDepth, $subcat['id_category'], $currentDepth + 1); if (!isset($resultIds[$id_category])) return false; if ( _PS_VERSION_ < "1.4.0.0"){ return array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']), 'name' => Category::hideCategoryPosition($resultIds[$id_category]['name']), 'desc'=> $resultIds[$id_category]['description'], 'children' => $children); } else{ return array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']), 'name' => $resultIds[$id_category]['name'], 'desc'=> $resultIds[$id_category]['description'], 'children' => $children); } } function hookLeftColumn($params) { global $smarty, $cookie, $category; $psversion = _PS_VERSION_; if (_PS_VERSION_ < "1.4.0.0"){ /* ONLY FOR THEME OLDER THAN v1.0 */ global $link; $image = Configuration::get('BLOCK_CATEGI_IMAGE'); $smarty->assign(array( 'categories' => Category::getHomeCategories(intval($params['cookie']->id_lang), true), 'image' => $image, 'link' => $link )); /* ELSE */ $id_customer = intval($params['cookie']->id_customer); $maxdepth = Configuration::get('BLOCK_CATEGI_MAX_DEPTH'); if (!$result = Db::getInstance()->ExecuteS(' SELECT DISTINCT c.*, cl.* FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.intval($params['cookie']->id_lang).') LEFT JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = c.`id_category`) '.($id_customer ? 'INNER JOIN `'._DB_PREFIX_.'customer_group` cg ON (cg.`id_group` = ctg.`id_group` AND cg.`id_customer` = '.intval($id_customer).')' : '' ).' WHERE 1' .(intval($maxdepth) != 0 ? ' AND `level_depth` <= '.intval($maxdepth) : '').' AND (c.`active` = 1 OR c.`id_category`= 1) '.(!$id_customer ? 'AND ctg.`id_group` = 1' : '' ).' ORDER BY `level_depth` ASC, cl.`name` ASC')) return; $resultParents = array(); $resultIds = array(); foreach ($result as $row) { $$row['name'] = Category::hideCategoryPosition($row['name']); $resultParents[$row['id_parent']][] = $row; $resultIds[$row['id_category']] = $row; } $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEGI_MAX_DEPTH')); $isDhtml = (Configuration::get('BLOCK_CATEGI_DHTML') == 1 ? true : false); if (isset($_GET['id_category'])) { $cookie->last_visited_category = intval($_GET['id_category']); $smarty->assign('currentCategoryId', intval($_GET['id_category'])); } if (isset($_GET['id_product'])) { if (!isset($cookie->last_visited_category) OR !Product::idIsOnCategoryId(intval($_GET['id_product']), array('0' => array('id_category' => $cookie->last_visited_category)))) { $product = new Product(intval($_GET['id_product'])); if (isset($product) AND Validate::isLoadedObject($product)) $cookie->last_visited_category = intval($product->id_category_default); } $smarty->assign('currentCategoryId', intval($cookie->last_visited_category)); } $smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategoriesi/blockcategoriesi.tpl')) $smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategoriesi/category-tree-branch.tpl'); else $smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategoriesi/category-tree-branch.tpl'); $smarty->assign('isDhtml', $isDhtml); /* /ONLY FOR THEME OLDER THAN v1.0 */ $smarty->assign('psversion', $psversion); return $this->display(__FILE__, 'blockcategoriesi.tpl'); } if(_PS_VERSION_ < "1.5.0.0" && _PS_VERSION_ > "1.4.0.0") { $image = Configuration::get('BLOCK_CATEGI_IMAGE'); $images = $image - 10; $id_customer = (int)($params['cookie']->id_customer); $id_group = $id_customer ? Customer::getDefaultGroupId($id_customer) : _PS_DEFAULT_CUSTOMER_GROUP_; $id_product = (int)(Tools::getValue('id_product', 0)); $id_category = (int)(Tools::getValue('id_category', 0)); $id_lang = (int)($params['cookie']->id_lang); $smartyCacheId = 'blockcategoriesi|'.$id_group.'_'.$id_lang.'_'.$id_product.'_'.$id_category; Tools::enableCache(); if (!$this->isCached('blockcategoriesi.tpl', $smartyCacheId)) { $maxdepth = Configuration::get('BLOCK_CATEGI_MAX_DEPTH'); if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT DISTINCT c.*, cl.* FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.$id_lang.') LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`) WHERE 1' .((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').' AND (c.`active` = 1 OR c.`id_category` = 1) AND cg.`id_group` = '.$id_group.' ORDER BY `level_depth` ASC, c.`position` ASC') ) return; $resultParents = array(); $resultIds = array(); foreach ($result as &$row) { $resultParents[$row['id_parent']][] = &$row; $resultIds[$row['id_category']] = &$row; } $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEGI_MAX_DEPTH')); unset($resultParents); unset($resultIds); $isDhtml = (Configuration::get('BLOCK_CATEGI_DHTML') == 1 ? true : false); if (Tools::isSubmit('id_category')) { $cookie->last_visited_category = $id_category; $smarty->assign('currentCategoryId', $cookie->last_visited_category); } if (Tools::isSubmit('id_product')) { if (!isset($cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $cookie->last_visited_category)))) { $product = new Product($id_product); if (isset($product) AND Validate::isLoadedObject($product)) $cookie->last_visited_category = (int)($product->id_category_default); } $smarty->assign('currentCategoryId', (int)($cookie->last_visited_category)); } $smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategoriesi/blockcategoriesi.tpl')) $smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategoriesi/category-tree-branch.tpl'); else $smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategoriesi/category-tree-branch.tpl'); $smarty->assign('isDhtml', $isDhtml); } $smarty->assign('image', $image); $smarty->assign('images', $images); $smarty->assign('psversion', $psversion); $smarty->cache_lifetime = 31536000; // 1 Year $display = $this->display(__FILE__, 'blockcategoriesi.tpl', $smartyCacheId); Tools::restoreCacheSettings(); return $display; } else{ $image = Configuration::get('BLOCK_CATEGI_IMAGE'); $images = $image - 10; $id_current_shop = $this->context->shop->getID(); $id_customer = (int)($params['cookie']->id_customer); // Get all groups for this customer and concatenate them as a string: "1,2,3..." // It is necessary to keep the group query separate from the main select query because it is used for the cache $groups = $id_customer ? implode(', ', Customer::getGroupsStatic($id_customer)) : _PS_DEFAULT_CUSTOMER_GROUP_; $id_product = (int)(Tools::getValue('id_product', 0)); $id_category = (int)(Tools::getValue('id_category', 0)); $id_lang = (int)($params['cookie']->id_lang); $smartyCacheId = 'blockcategories|'.$id_current_shop.'_'.$groups.'_'.$id_lang.'_'.$id_product.'_'.$id_category; /*Tools::enableCache(); if (!$this->isCached('blockcategories.tpl', $smartyCacheId)) {*/ $maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH'); /*p(' SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.$this->context->shop->addSqlRestrictionOnLang('cl').') LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`) WHERE (c.`active` = 1 OR c.`id_category` = 1) '.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').' AND cg.`id_group` IN ('.pSQL($groups).') GROUP BY id_category ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'c.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC'));*/ if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.$this->context->shop->addSqlRestrictionOnLang('cl').') LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`) WHERE (c.`active` = 1 OR c.`id_category` = 1) '.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').' AND cg.`id_group` IN ('.pSQL($groups).') GROUP BY id_category ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'c.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC')) ) return Tools::restoreCacheSettings(); $resultParents = array(); $resultIds = array(); foreach ($result as &$row) { $resultParents[$row['id_parent']][] = &$row; $resultIds[$row['id_category']] = &$row; } //p($resultParents); $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH')); unset($resultParents, $resultIds); //d($blockCategTree); $isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false); if (Tools::isSubmit('id_category')) { $this->context->cookie->last_visited_category = $id_category; $this->context->smarty->assign('currentCategoryId', $this->context->cookie->last_visited_category); } if (Tools::isSubmit('id_product')) { if (!isset($this->context->cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $this->context->cookie->last_visited_category)))) { $product = new Product($id_product); if (isset($product) AND Validate::isLoadedObject($product)) $this->context->cookie->last_visited_category = (int)($product->id_category_default); } $this->context->smarty->assign('currentCategoryId', (int)($this->context->cookie->last_visited_category)); } $this->context->smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategoriesi/blockcategoriesi.tpl')) $this->context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategorieis/category-tree-branch.tpl'); else $this->context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategoriesi/category-tree-branch.tpl'); $this->context->smarty->assign('isDhtml', $isDhtml); //} $smarty->assign('image', $image); $smarty->assign('images', $images); $smarty->assign('psversion', $psversion); $this->context->smarty->cache_lifetime = 31536000; // 1 Year $display = $this->display(__FILE__, 'blockcategoriesi.tpl', $smartyCacheId); Tools::restoreCacheSettings(); return $display; } } public function hookRightColumn($params) { return $this->hookLeftColumn($params); } public function hookHeader() { if(_PS_VERSION_ > "1.4.0.0"){ Tools::addJS(_THEME_JS_DIR_.'tools/treeManagement.js'); Tools::addCSS(($this->_path).'blockcategories.css', 'all'); } } private function _clearBlockcategoriesCache() { $this->_clearCache(NULL, 'blockcategories'); Tools::restoreCacheSettings(); } public function hookCategoryAddition($params) { $this->_clearBlockcategoriesCache(); } public function hookCategoryUpdate($params) { $this->_clearBlockcategoriesCache(); } public function hookCategoryDeletion($params) { $this->_clearBlockcategoriesCache(); } } ?> ^Copy and Paste of the blockcategoriesi.php Share this post Link to post Share on other sites
eligomez86 4 Posted October 5, 2012 Posted October 5, 2012 <?php class BlockCategoriesi extends Module { function __construct() { $this->name = 'blockcategoriesi'; if(_PS_VERSION_ > "1.4.0.0"){ $this->tab = 'front_office_features'; $this->author = 'RSI'; $this->need_instance = 0; }else{ $this->tab = 'Blocks'; } $this->version = 1.7; parent::__construct(); $this->displayName = $this->l('Categories block image'); $this->description = $this->l('Adds a block featuring product categories - www.catalogo-onlienrsi.com.ar'); } function install() { if(_PS_VERSION_ < "1.4.0.0"){ if (parent::install() == false OR $this->registerHook('leftColumn') == false OR Configuration::updateValue('BLOCK_CATEGI_MAX_DEPTH', 3) == false OR Configuration::updateValue('BLOCK_CATEGI_DHTML', 1) == false OR Configuration::updateValue('BLOCK_CATEGI_IMAGE', 40) == false) return false; return true; } else{ if (!parent::install() OR !$this->registerHook('leftColumn') OR !$this->registerHook('header') OR // Temporary hooks. Do NOT hook any module on it. Some CRUD hook will replace them as soon as possible. !$this->registerHook('categoryAddition') OR !$this->registerHook('categoryUpdate') OR !$this->registerHook('categoryDeletion') OR !Configuration::updateValue('BLOCK_CATEGI_MAX_DEPTH', 3) OR !Configuration::updateValue('BLOCK_CATEGI_DHTML', 1)OR !Configuration::updateValue('BLOCK_CATEGI_IMAGE', 40)) return false; return true; } } public function getContent() { $output = '<h2>'.$this->displayName.'</h2>'; if (Tools::isSubmit('submitBlockCategoriesi')) { $maxDepth = intval(Tools::getValue('maxDepth')); $dhtml = Tools::getValue('dhtml'); $image = Tools::getValue('image'); if ($maxDepth < 0) $output .= '<div class="alert error">'.$this->l('Maximum depth: Invalid number.').'</div>'; elseif ($dhtml != 0 AND $dhtml != 1) $output .= '<div class="alert error">'.$this->l('Dynamic HTML: Invalid choice.').'</div>'; else { Configuration::updateValue('BLOCK_CATEGI_MAX_DEPTH', intval($maxDepth)); Configuration::updateValue('BLOCK_CATEGI_DHTML', intval($dhtml)); Configuration::updateValue('BLOCK_CATEGI_IMAGE', $image); $output .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('Confirmation').'" />'.$this->l('Settings updated').'</div>'; } } return $output.$this->displayForm(); } public function displayForm() { return ' <form action="'.$_SERVER['REQUEST_URI'].'" method="post"> <fieldset> <legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend> <label>'.$this->l('Maximum depth').'</label> <div class="margin-form"> <input type="text" name="maxDepth" value="'.Configuration::get('BLOCK_CATEGI_MAX_DEPTH').'" /> <p class="clear">'.$this->l('Set the maximum depth of sublevels displayed in this block (0 = infinite)').'</p> </div> <label>'.$this->l('Image size').'</label> <div class="margin-form"> <input type="text" name="image" value="'.Configuration::get('BLOCK_CATEGI_IMAGE').'" /> </div> <label>'.$this->l('Dynamic').'</label> <div class="margin-form"> <input type="radio" name="dhtml" id="dhtml_on" value="1" '.(Tools::getValue('dhtml', Configuration::get('BLOCK_CATEGI_DHTML')) ? 'checked="checked" ' : '').'/> <label class="t" for="dhtml_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label> <input type="radio" name="dhtml" id="dhtml_off" value="0" '.(!Tools::getValue('dhtml', Configuration::get('BLOCK_CATEGI_DHTML')) ? 'checked="checked" ' : '').'/> <label class="t" for="dhtml_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label> <p class="clear">'.$this->l('Activate dynamic (animated) mode for sublevels').'</p> </div> <center><input type="submit" name="submitBlockCategoriesi" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form> <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Contribute').'</legend> <p class="clear">'.$this->l('You can contribute with a donation if our free modules and themes are usefull for you. Clic on the link and support us!').'</p> <p class="clear">'.$this->l('For more modules & themes visit: www.catalogo-onlinersi.com.ar').'</p> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="HMBZNQAHN9UMJ"> <input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" width="1" height="1"> </fieldset> </form>'; } public function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0) { global $link; $children = array(); if (isset($resultParents[$id_category]) AND sizeof($resultParents[$id_category]) AND ($maxDepth == 0 OR $currentDepth < $maxDepth)) foreach ($resultParents[$id_category] as $subcat) $children[] = $this->getTree($resultParents, $resultIds, $maxDepth, $subcat['id_category'], $currentDepth + 1); if (!isset($resultIds[$id_category])) return false; if ( _PS_VERSION_ < "1.4.0.0"){ return array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']), 'name' => Category::hideCategoryPosition($resultIds[$id_category]['name']), 'desc'=> $resultIds[$id_category]['description'], 'children' => $children); } else{ return array('id' => $id_category, 'link' => $link->getCategoryLink($id_category, $resultIds[$id_category]['link_rewrite']), 'name' => $resultIds[$id_category]['name'], 'desc'=> $resultIds[$id_category]['description'], 'children' => $children); } } function hookLeftColumn($params) { global $smarty, $cookie, $category; $psversion = _PS_VERSION_; if (_PS_VERSION_ < "1.4.0.0"){ /* ONLY FOR THEME OLDER THAN v1.0 */ global $link; $image = Configuration::get('BLOCK_CATEGI_IMAGE'); $smarty->assign(array( 'categories' => Category::getHomeCategories(intval($params['cookie']->id_lang), true), 'image' => $image, 'link' => $link )); /* ELSE */ $id_customer = intval($params['cookie']->id_customer); $maxdepth = Configuration::get('BLOCK_CATEGI_MAX_DEPTH'); if (!$result = Db::getInstance()->ExecuteS(' SELECT DISTINCT c.*, cl.* FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.intval($params['cookie']->id_lang).') LEFT JOIN `'._DB_PREFIX_.'category_group` ctg ON (ctg.`id_category` = c.`id_category`) '.($id_customer ? 'INNER JOIN `'._DB_PREFIX_.'customer_group` cg ON (cg.`id_group` = ctg.`id_group` AND cg.`id_customer` = '.intval($id_customer).')' : '' ).' WHERE 1' .(intval($maxdepth) != 0 ? ' AND `level_depth` <= '.intval($maxdepth) : '').' AND (c.`active` = 1 OR c.`id_category`= 1) '.(!$id_customer ? 'AND ctg.`id_group` = 1' : '' ).' ORDER BY `level_depth` ASC, cl.`name` ASC')) return; $resultParents = array(); $resultIds = array(); foreach ($result as $row) { $$row['name'] = Category::hideCategoryPosition($row['name']); $resultParents[$row['id_parent']][] = $row; $resultIds[$row['id_category']] = $row; } $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEGI_MAX_DEPTH')); $isDhtml = (Configuration::get('BLOCK_CATEGI_DHTML') == 1 ? true : false); if (isset($_GET['id_category'])) { $cookie->last_visited_category = intval($_GET['id_category']); $smarty->assign('currentCategoryId', intval($_GET['id_category'])); } if (isset($_GET['id_product'])) { if (!isset($cookie->last_visited_category) OR !Product::idIsOnCategoryId(intval($_GET['id_product']), array('0' => array('id_category' => $cookie->last_visited_category)))) { $product = new Product(intval($_GET['id_product'])); if (isset($product) AND Validate::isLoadedObject($product)) $cookie->last_visited_category = intval($product->id_category_default); } $smarty->assign('currentCategoryId', intval($cookie->last_visited_category)); } $smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategoriesi/blockcategoriesi.tpl')) $smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategoriesi/category-tree-branch.tpl'); else $smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategoriesi/category-tree-branch.tpl'); $smarty->assign('isDhtml', $isDhtml); /* /ONLY FOR THEME OLDER THAN v1.0 */ $smarty->assign('psversion', $psversion); return $this->display(__FILE__, 'blockcategoriesi.tpl'); } if(_PS_VERSION_ < "1.5.0.0" && _PS_VERSION_ > "1.4.0.0") { $image = Configuration::get('BLOCK_CATEGI_IMAGE'); $images = $image - 10; $id_customer = (int)($params['cookie']->id_customer); $id_group = $id_customer ? Customer::getDefaultGroupId($id_customer) : _PS_DEFAULT_CUSTOMER_GROUP_; $id_product = (int)(Tools::getValue('id_product', 0)); $id_category = (int)(Tools::getValue('id_category', 0)); $id_lang = (int)($params['cookie']->id_lang); $smartyCacheId = 'blockcategoriesi|'.$id_group.'_'.$id_lang.'_'.$id_product.'_'.$id_category; Tools::enableCache(); if (!$this->isCached('blockcategoriesi.tpl', $smartyCacheId)) { $maxdepth = Configuration::get('BLOCK_CATEGI_MAX_DEPTH'); if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT DISTINCT c.*, cl.* FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.$id_lang.') LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`) WHERE 1' .((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').' AND (c.`active` = 1 OR c.`id_category` = 1) AND cg.`id_group` = '.$id_group.' ORDER BY `level_depth` ASC, c.`position` ASC') ) return; $resultParents = array(); $resultIds = array(); foreach ($result as &$row) { $resultParents[$row['id_parent']][] = &$row; $resultIds[$row['id_category']] = &$row; } $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEGI_MAX_DEPTH')); unset($resultParents); unset($resultIds); $isDhtml = (Configuration::get('BLOCK_CATEGI_DHTML') == 1 ? true : false); if (Tools::isSubmit('id_category')) { $cookie->last_visited_category = $id_category; $smarty->assign('currentCategoryId', $cookie->last_visited_category); } if (Tools::isSubmit('id_product')) { if (!isset($cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $cookie->last_visited_category)))) { $product = new Product($id_product); if (isset($product) AND Validate::isLoadedObject($product)) $cookie->last_visited_category = (int)($product->id_category_default); } $smarty->assign('currentCategoryId', (int)($cookie->last_visited_category)); } $smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategoriesi/blockcategoriesi.tpl')) $smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategoriesi/category-tree-branch.tpl'); else $smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategoriesi/category-tree-branch.tpl'); $smarty->assign('isDhtml', $isDhtml); } $smarty->assign('image', $image); $smarty->assign('images', $images); $smarty->assign('psversion', $psversion); $smarty->cache_lifetime = 31536000; // 1 Year $display = $this->display(__FILE__, 'blockcategoriesi.tpl', $smartyCacheId); Tools::restoreCacheSettings(); return $display; } else{ $image = Configuration::get('BLOCK_CATEGI_IMAGE'); $images = $image - 10; $id_current_shop = $this->context->shop->getID(); $id_customer = (int)($params['cookie']->id_customer); // Get all groups for this customer and concatenate them as a string: "1,2,3..." // It is necessary to keep the group query separate from the main select query because it is used for the cache $groups = $id_customer ? implode(', ', Customer::getGroupsStatic($id_customer)) : _PS_DEFAULT_CUSTOMER_GROUP_; $id_product = (int)(Tools::getValue('id_product', 0)); $id_category = (int)(Tools::getValue('id_category', 0)); $id_lang = (int)($params['cookie']->id_lang); $smartyCacheId = 'blockcategories|'.$id_current_shop.'_'.$groups.'_'.$id_lang.'_'.$id_product.'_'.$id_category; /*Tools::enableCache(); if (!$this->isCached('blockcategories.tpl', $smartyCacheId)) {*/ $maxdepth = Configuration::get('BLOCK_CATEG_MAX_DEPTH'); /*p(' SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.$this->context->shop->addSqlRestrictionOnLang('cl').') LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`) WHERE (c.`active` = 1 OR c.`id_category` = 1) '.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').' AND cg.`id_group` IN ('.pSQL($groups).') GROUP BY id_category ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'c.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC'));*/ if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite FROM `'._DB_PREFIX_.'category` c LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.$this->context->shop->addSqlRestrictionOnLang('cl').') LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`) WHERE (c.`active` = 1 OR c.`id_category` = 1) '.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').' AND cg.`id_group` IN ('.pSQL($groups).') GROUP BY id_category ORDER BY `level_depth` ASC, '.(Configuration::get('BLOCK_CATEG_SORT') ? 'cl.`name`' : 'c.`position`').' '.(Configuration::get('BLOCK_CATEG_SORT_WAY') ? 'DESC' : 'ASC')) ) return Tools::restoreCacheSettings(); $resultParents = array(); $resultIds = array(); foreach ($result as &$row) { $resultParents[$row['id_parent']][] = &$row; $resultIds[$row['id_category']] = &$row; } //p($resultParents); $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH')); unset($resultParents, $resultIds); //d($blockCategTree); $isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false); if (Tools::isSubmit('id_category')) { $this->context->cookie->last_visited_category = $id_category; $this->context->smarty->assign('currentCategoryId', $this->context->cookie->last_visited_category); } if (Tools::isSubmit('id_product')) { if (!isset($this->context->cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $this->context->cookie->last_visited_category)))) { $product = new Product($id_product); if (isset($product) AND Validate::isLoadedObject($product)) $this->context->cookie->last_visited_category = (int)($product->id_category_default); } $this->context->smarty->assign('currentCategoryId', (int)($this->context->cookie->last_visited_category)); } $this->context->smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategoriesi/blockcategoriesi.tpl')) $this->context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategorieis/category-tree-branch.tpl'); else $this->context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategoriesi/category-tree-branch.tpl'); $this->context->smarty->assign('isDhtml', $isDhtml); //} $smarty->assign('image', $image); $smarty->assign('images', $images); $smarty->assign('psversion', $psversion); $this->context->smarty->cache_lifetime = 31536000; // 1 Year $display = $this->display(__FILE__, 'blockcategoriesi.tpl', $smartyCacheId); Tools::restoreCacheSettings(); return $display; } } public function hookRightColumn($params) { return $this->hookLeftColumn($params); } public function hookHeader() { if(_PS_VERSION_ > "1.4.0.0"){ Tools::addJS(_THEME_JS_DIR_.'tools/treeManagement.js'); Tools::addCSS(($this->_path).'blockcategories.css', 'all'); } } private function _clearBlockcategoriesCache() { $this->_clearCache(NULL, 'blockcategories'); Tools::restoreCacheSettings(); } public function hookCategoryAddition($params) { $this->_clearBlockcategoriesCache(); } public function hookCategoryUpdate($params) { $this->_clearBlockcategoriesCache(); } public function hookCategoryDeletion($params) { $this->_clearBlockcategoriesCache(); } } ?> ^Copy and Paste of the blockcategoriesi.php Have you find any solution? Share this post Link to post Share on other sites
buggindave 5 Posted October 5, 2012 Posted October 5, 2012 Not yet. Share this post Link to post Share on other sites
88colores 0 Posted October 19, 2012 Posted October 19, 2012 Hola!! Cuando lo instalo me da error 500 ¿Sabes por que puede ser? Te lo dejo instalado en mi segunda tienda www.kebonitas.es/licencias Saludos Share this post Link to post Share on other sites
shacker 1,055 Posted March 3, 2013 Posted March 3, 2013 v2.0 - Compatible PS 1.5.3.1 - bug fix v2.0 - Compatible PS 1.5.3.1 - bug fix Share this post Link to post Share on other sites
shacker 1,055 Posted March 3, 2013 Posted March 3, 2013 Hola!! Cuando lo instalo me da error 500 ¿Sabes por que puede ser? Te lo dejo instalado en mi segunda tienda www.kebonitas.es/licencias Saludos descargalo de nuevo de nuestro sitio. lo hemos actualizado Share this post Link to post Share on other sites
fruns 0 Posted May 8, 2013 Posted May 8, 2013 I just installed the module but that site is added / inserted the image? Share this post Link to post Share on other sites
shacker 1,055 Posted May 8, 2013 Posted May 8, 2013 the images are from your categories Share this post Link to post Share on other sites
fruns 0 Posted May 8, 2013 Posted May 8, 2013 (edited) hen it does not work in 1.5.4.1 Edited May 8, 2013 by fruns (see edit history) Share this post Link to post Share on other sites
shacker 1,055 Posted May 8, 2013 Posted May 8, 2013 i tested in this version and works. what is your site url? Share this post Link to post Share on other sites
fruns 0 Posted May 8, 2013 Posted May 8, 2013 (edited) http://www.hobbykits.es/index.php I removed the maintenance Edited May 8, 2013 by fruns (see edit history) Share this post Link to post Share on other sites
shacker 1,055 Posted May 8, 2013 Posted May 8, 2013 i see the images on the categories block module Share this post Link to post Share on other sites
fruns 0 Posted May 8, 2013 Posted May 8, 2013 (edited) I thought I had to go where indicated in the picture i'm sorry, I did not realize that was down the module, is very well, thank you very much and sorry for the inconvenience Edited May 8, 2013 by fruns (see edit history) Share this post Link to post Share on other sites
shacker 1,055 Posted May 8, 2013 Posted May 8, 2013 the module is at the bottom of the page, this is the normal module, the new module is at the bottom in the left column Share this post Link to post Share on other sites
fruns 0 Posted May 8, 2013 Posted May 8, 2013 good again. I have questions or problems, 1st - I do not like has been displaced the name of the category for the image (photo 1), I would like to remain as the photo 2, ie, after the image name. 2 - I've noticed that when I click a category automatically becomes empty the category, this is normal? (photo 3) Share this post Link to post Share on other sites
fruns 0 Posted May 9, 2013 Posted May 9, 2013 nobody knows how to fix this problem? Share this post Link to post Share on other sites
shacker 1,055 Posted May 10, 2013 Posted May 10, 2013 site url? Share this post Link to post Share on other sites
fruns 0 Posted May 11, 2013 Posted May 11, 2013 site url? http://www.hobbykits.es/ Share this post Link to post Share on other sites
shacker 1,055 Posted May 13, 2013 Posted May 13, 2013 download again. i fix the image position Share this post Link to post Share on other sites
shacker 1,055 Posted May 13, 2013 Posted May 13, 2013 v2.1 - Fixed issue with 1.5 ps style 1 Share this post Link to post Share on other sites
fruns 0 Posted May 13, 2013 Posted May 13, 2013 v2.1 - Fixed issue with 1.5 ps style problem solved. +10. I will make a donation. regards Share this post Link to post Share on other sites
shacker 1,055 Posted May 13, 2013 Posted May 13, 2013 nice Share this post Link to post Share on other sites
lightsb 11 Posted May 24, 2013 Posted May 24, 2013 Hi, Versions presta: 1.4.9.0 Version Categories image: 2.1 Image not appear after activating Friendly URLs but when is disable image appear. Is possible to work when activating Friendly URLs ? Thx. Share this post Link to post Share on other sites
shacker 1,055 Posted June 14, 2013 Posted June 14, 2013 v2.2-bugfix friendly url ps 1.4 Hi, Versions presta: 1.4.9.0 Version Categories image: 2.1 Image not appear after activating Friendly URLs but when is disable image appear. Is possible to work when activating Friendly URLs ? Thx. redownload latest version Share this post Link to post Share on other sites
shacker 1,055 Posted September 22, 2013 Posted September 22, 2013 **** solved download issue Share this post Link to post Share on other sites
shacker 1,055 Posted September 23, 2013 Posted September 23, 2013 i dont understand Share this post Link to post Share on other sites
shacker 1,055 Posted October 7, 2019 Posted October 7, 2019 v3.0-Compatible PS 1.7 Share this post Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now