Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How to add _blank links in top menu? Rate Topic   - - - - -

 
  • minute
  • Junior Member
  • Members
  • Join Date: 21-Feb 11
  • 142 posts

Posted 09 October 2012 - 06:30 AM #1

Hello, I search the forum, someone suggested that creating links in Website/Content and checking the option "Open in new window" will do the trick. But either I don't know how to add this link to menu or it does not work. If I put the link in a block, it works, but creating a custom menu does not give the option to add the specified link. If I write the url, also the link will be _self and not _blank.

Any suggestions?

 
  • dwyndoan
  • Junior Member
  • Members
  • Join Date: 11-Feb 11
  • 1 posts

Posted 19 November 2013 - 03:36 PM #2

Hello.
the easiest way to do this ( for me ) :)

1. open and edit ( schemas\static_data\schema.php )

change this code :

'A' => array( // menu items
  'param' => 'url',
  'tooltip' => 'tts_link_text',
  'descr' => 'link_text',
  'add_title' => 'new_items',
  'add_button' => 'add_item',
  'edit_title' => 'editing_item',
  'mainbox_title' => 'menu_items',
  'additional_params' => array(
   array(
	'title' => 'activate_menu_tab_for',
	'tooltip' => 'tts_activate_menu_tab_for',
	'type' => 'input',
	'name' => 'param_2'
   ),
   array(
	'title' => 'generate_submenu',
	'tooltip' => 'tts_generate_submenu',
	'type' => 'megabox', // <img src='http://forum.cs-cart.com/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' />
	'name' => 'param_3'
   ),
  ),

to this code :

'A' => array( // menu items
  'param' => 'url',
  'tooltip' => 'tts_link_text',
  'descr' => 'link_text',
  'add_title' => 'new_items',
  'add_button' => 'add_item',
  'edit_title' => 'editing_item',
  'mainbox_title' => 'menu_items',
  'additional_params' => array(
   array(
	'title' => 'new_window',
	'tooltip' => 'tts_open_new_window',
	'type' => 'checkbox', // <img src='http://forum.cs-cart.com/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' />
	'default_value' => 'N',
	'name' => 'param_4'
   ),
   array(
	'title' => 'activate_menu_tab_for',
	'tooltip' => 'tts_activate_menu_tab_for',
	'type' => 'input',
	'name' => 'param_2'
   ),
   array(
	'title' => 'generate_submenu',
	'tooltip' => 'tts_generate_submenu',
	'type' => 'megabox', // <img src='http://forum.cs-cart.com/public/style_emoticons/<#EMO_DIR#>/smile.png' class='bbc_emoticon' alt=':)' />
	'name' => 'param_3'
   ),
  ),

check the different so you will find the idea.
code above will give you a New Window check box everytime you create a menu item.

2. open and edit skins\TEMPLATE_NAME\customers\blocks\topmenu_dropdown.tpl
and add this code in every <a> tag

{if $item1.param_4== "Y"} target ="_blank" {/if}

example :

<a{if $item1_url} href="{$item1_url}"{/if}{if $item1.param_4== "Y"} target ="_blank" {/if}{if $item1.$childs} class="drop"{/if}>{$item1.$name}</a>

Dont forget to save and clear cache to see the result.
Hope this solve your problem.

Cheers
Dwyn

 
  • jacson
  • Advanced Member
  • Members
  • Join Date: 03-Aug 12
  • 74 posts

Posted 12 February 2014 - 01:38 AM #3

Anyone know how to fix this issue in 4.0.3? Seems very odd that this is not a simple thing built into the back end...

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1249 posts

Posted 02 April 2014 - 05:31 AM #4

Hi @jacson
I have the add-on for v4.x ready done, please send a quote on hungryweb.net and you will receive it

Regards,

---
Valentin
part of hungryweb.net

 
  • yoyoman
  • Junior Member
  • Members
  • Join Date: 09-Nov 10
  • 16 posts

Posted 13 August 2016 - 05:57 PM #5

I am rather surprised that CS Cart has not implemented this yet! However, for anyone else reading this thread, dwyn's method works perfectly, even in 4.3. (Thanks!)

in version 4+ the file locations are just slightly different than the original instructions:

 

app/schemas/static/data/schema.php

design/themes/responsive/templates/blocks/topmenu_dropdown.tpl

 

I hope this helps someone! Cast your votes at CS Cart uservoice and maybe they will finally implement this simple change! Dwyn already did the work and it is only a few lines of code, so they could implement this immediately if they really wanted to.



 
  • websmart
  • Junior Member
  • Members
  • Join Date: 11-Feb 10
  • 78 posts

Posted 04 November 2019 - 07:19 PM #6

how can we do this using "my changes" addon with hooks?

 

Thank you