SliderFlash Posted July 3, 2020 Share Posted July 3, 2020 (edited) in the categories, Invalid characters: <>; = # {} I want to allow these characters <> to include an icon image, can you tell me where I can change that? Edited July 3, 2020 by SliderFlash (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted July 10, 2020 Share Posted July 10, 2020 Checks are done in classes/validate.php. The function for category names is isCatalogName Link to comment Share on other sites More sharing options...
mlclm Posted July 11, 2020 Share Posted July 11, 2020 (edited) Quote in classes/validate.php. @musicmaster Thanks for the info about validate.php, I did the following but it still does not work ( see screenshots ) , in my case on PS 1.7 latest version, I am trying to add a <br /> tag ( html line break ) in the category name. In my test I tried to put a hashtag # When I put "Category # Test " for example, I have tried to overwrite the file "Validate.php" , as explained on another topic by redefining the function "isCatalogName" : <?php class Validate extends ValidateCore { public static function isCatalogName($name) { // simple test return !preg_match('/[]/i', $name); } } now I should be able to put a hashtag like # but still get the error like on screenshot above. I am using latest version 1.7 I have tried different ways : - overwritting only the file "Validate.php" - overwritting Validate.php, but also Category.php and CMSCategory.php where the function "isCatalogName($name)" is called and removing the validation in these files. - removing the overitten files and editing directly the Core Files in the class directory , then cleared cache, etc. - I cleared cache in backend and also var/cache files to be sure each time, logged out / logged in administration every time. Refreshed browser cache / Changed browser too ! It does not work. Edited July 11, 2020 by mlclm (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted July 12, 2020 Share Posted July 12, 2020 (edited) in $definirion: self::TYPE_HTML, 'size' =>255, 'validate'=>'isCleanHtml' Edited July 12, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
SliderFlash Posted July 12, 2020 Author Share Posted July 12, 2020 (edited) I do not understand..! are there any instructions....? Edited July 12, 2020 by SliderFlash (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted July 12, 2020 Share Posted July 12, 2020 (edited) ./classes/Category.php find 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128) change to 'name' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 65000) Validate.php does not need to be modified Edited July 12, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted July 12, 2020 Share Posted July 12, 2020 (edited) But it will never work. It will still show the error because it always tries to create a URL from the name. The most sensible thing is to add your own HTML field and paste the code into it. A minimum knowledge of Prestashop 5/10 is required for editing. Edited July 12, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
SliderFlash Posted July 12, 2020 Author Share Posted July 12, 2020 ok Thank you Link to comment Share on other sites More sharing options...
SliderFlash Posted July 13, 2020 Author Share Posted July 13, 2020 (edited) vor 16 Stunden schrieb Guest: But it will never work. It will still show the error because it always tries to create a URL from the name. The most sensible thing is to add your own HTML field and paste the code into it. A minimum knowledge of Prestashop 5/10 is required for editing. I also think that not all characters should be allowed, only for pictures < = " " > otherwise there is a great risk of sql injection. do you have an idea for a snippet of code? or instructions? This is possible in PHPBB FORUM, it can be inserted in every category picture icon Thank you SF..... Edited July 13, 2020 by SliderFlash (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2020 Share Posted July 13, 2020 Am I correct that you're trying to put a picture or category icon in the Menu or category list? Write the reason for the adjustment to make it understand. Link to comment Share on other sites More sharing options...
SliderFlash Posted July 13, 2020 Author Share Posted July 13, 2020 yes exactly, a symbol for the categories, "Pictures are worth a thousand words" It is better for orientation in the menu and the eyes do not get tired quickly. Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2020 Share Posted July 13, 2020 Link to comment Share on other sites More sharing options...
SliderFlash Posted July 13, 2020 Author Share Posted July 13, 2020 no for Menu Navigation Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2020 Share Posted July 13, 2020 Go to ./themes/your-theme/modules/ps_mainmenu/ps_mainmenu.tpl Find: {foreach from=$nodes item=node} add after: {if $node.image_urls|count} {foreach from=$node.image_urls item=image_url} <img src="{$image_url}" style="height:32px;margin-right: -10px;"> {/foreach} {/if} full tpl: {assign var=_counter value=0} {function name="menu" nodes=[] depth=0 parent=null} {if $nodes|count} <ul class="top-menu" {if $depth == 0}id="top-menu"{/if} data-depth="{$depth}"> {foreach from=$nodes item=node} {if $node.image_urls|count} {foreach from=$node.image_urls item=image_url} <img src="{$image_url}" style="height:32px;margin-right: -10px;"> {/foreach} {/if} <li class="{$node.type}{if $node.current} current {/if}" id="{$node.page_identifier}"> {assign var=_counter value=$_counter+1} <a class="{if $depth >= 0}dropdown-item{/if}{if $depth === 1} dropdown-submenu{/if}" href="{$node.url}" data-depth="{$depth}" {if $node.open_in_new_window} target="_blank" {/if} > {if $node.children|count} {* Cannot use page identifier as we can have the same page several times *} {assign var=_expand_id value=10|mt_rand:100000} <span class="float-xs-right hidden-md-up"> <span data-target="#top_sub_menu_{$_expand_id}" data-toggle="collapse" class="navbar-toggler collapse-icons"> <i class="material-icons add"></i> <i class="material-icons remove"></i> </span> </span> {/if} {$node.label} </a> {if $node.children|count} <div {if $depth === 0} class="popover sub-menu js-sub-menu collapse"{else} class="collapse"{/if} id="top_sub_menu_{$_expand_id}"> {menu nodes=$node.children depth=$node.depth parent=$node} </div> {/if} </li> {/foreach} </ul> {/if} {/function} <div class="menu js-top-menu position-static hidden-sm-down" id="_desktop_top_menu"> {menu nodes=$menu.children} <div class="clearfix"></div> </div> Link to comment Share on other sites More sharing options...
SliderFlash Posted July 13, 2020 Author Share Posted July 13, 2020 Thanks Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2020 Share Posted July 13, 2020 Link to comment Share on other sites More sharing options...
SliderFlash Posted July 13, 2020 Author Share Posted July 13, 2020 Thanks very nice Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2020 Share Posted July 13, 2020 It is always better to write in detail what you need to do, make a screen, paint an arrow where you want to edit the code, etc., then the answer is simple and fast. Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2020 Share Posted July 13, 2020 You can give like a click and a gray heart below my posts. Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2020 Share Posted July 13, 2020 You can also put a large category icon in the drop-down menu. Just put the code before: {menu nodes=$node.children depth=$node.depth parent=$node} sample: {if $node.image_urls|count} {foreach from=$node.image_urls item=image_url} <img src="{$image_url}" style="height:85px;"> {/foreach} {/if} {menu nodes=$node.children depth=$node.depth parent=$node} result: Link to comment Share on other sites More sharing options...
SliderFlash Posted July 13, 2020 Author Share Posted July 13, 2020 how did you insert the picture? I get errors, I have inserted the code as described above Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2020 Share Posted July 13, 2020 ????????????????? Do not put anything in the category name !!!!!!!!!!!!!!!!!!!!!!!!!!!!! Link to comment Share on other sites More sharing options...
SliderFlash Posted July 13, 2020 Author Share Posted July 13, 2020 (edited) ok I did not show that first, then I tried another category menu, which was arranged at the top of the menu, it is then displayed. Edited July 13, 2020 by SliderFlash (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted July 13, 2020 Share Posted July 13, 2020 In the basic Menu module, only images in the main category can be displayed. It is not possible for subcategories. You have to buy a module for that. E.g. https://addons.prestashop.com/en/menu/29701-mega-menu-builder.html I consider this thread solved. Link to comment Share on other sites More sharing options...
SliderFlash Posted July 14, 2020 Author Share Posted July 14, 2020 With me, no image is displayed like yours no matter what I do Link to comment Share on other sites More sharing options...
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