External link

Magnus J

No avatar

2006-03-21 09:14

Treewood, since U rule and you´re such a helpful guy, I will ask you:

Is there a simple way to add an option; when creating a category you can choose "type - external link". So that the menu item opens an external page, if you know what I mean?

Regards
Magnus J :-)

Magnus J

No avatar

2006-03-21 15:07

Please, would this be hard to do?

treewood (OpenSolution)

Avatar: treewood

2006-03-21 17:08

You want option when it will be ON You will open no subpage (category) but other page for example google.com ?

Magnus J

No avatar

2006-03-23 17:04

Yes, exactly :-) Can it be done?


treewood (OpenSolution)

Avatar: treewood

2006-03-24 07:53

MagnusJ - then edit index.php and search below code. For example id of Your category with external link will be 22. Put if in else block. Example below:

<?php
if( is_file$sActionFile ) )
  require_once 
$sActionFile;
else{
  
// ... code in index.php
  
if( $iCategory == 22 ){ // id of category with link
   
header'http://google.com/' ); // external link
   
exit;
  }
  
$content .= $tpl->tbHtml'contents_more.tpl'$sBlock );
}
?>

grecords

Avatar: grecords

2006-03-24 10:33

It doesn´t work!

treewood (OpenSolution)

Avatar: treewood

2006-03-24 10:35

grecords - you should put this 3 lines before adding to $content variable where $iCategory will be set

grecords

Avatar: grecords

2006-03-24 11:41

This is part of my index.php, so tell me where must I put your script.


Add-ons actions
*/
if( 
filesizeDIR_PLUGINS.'actions_client.php' ) > 30 )
  require 
DIR_PLUGINS.'actions_client.php';

getAction$p'actions_client/' );

if( 
is_file$sActionFile ) )
  require_once 
$sActionFile;
else{
  require_once 
DIR_CORE.'files-'.$config['db_type'].'.php';
  require_once 
DIR_CORE.'files.php';

  if( !isset( 
$bDisplayedPage ) ){
    if( 
strlen$p ) > )
      
$iCategory substr$p);

    if( !
is_numeric$iCategory ) )
      
$iCategory $config['contact_page'];

    
$aData throwCategory$iCategorytruetrue );

    if( !isset( 
$aData['sDescriptionFull'] ) ){
      
$iCategory  $config['contact_page'];
      
$aData      throwCategory$iCategorytruetrue );
    }

    
$sBlock         'COLUMNS_ONE';
    
$sTitleBefore   $aData['sName'].' - ';
    
$sSubcategories listCategoriesChildren$iCategory'contents_more.tpl'true );
    
$aFiles         listFiles$iCategory'contents_more.tpl');

    if( 
$iCategory == $config['contact_page'] ){
      if( isset( 
$_POST['sSend'] ) )
        
$sContentPanel =  sendEmail$_POST'contact.tpl' );
      else
        
$sContentPanel =  $tpl->tbHtml'contact.tpl''FORM' );
      
$sBlock 'COLUMNS_TWO_CONTACT';
    }
    else{
      if( isset( 
$aFiles['sPhotosDefault'] ) )
        
$sContentPanel $aFiles['sPhotosDefault'];
      if( isset( 
$aFiles['sPhotos'] ) )
        
$sContentPanel .= $aFiles['sPhotos'];
      
      if( isset( 
$sContentPanel ) && !empty( $sContentPanel ) )
        
$sBlock 'COLUMNS_TWO';


    }
    
$content .= $tpl->tbHtml'contents_more.tpl'$sBlock );
  }
}

if( !isset( 
$sBlockPage ) ){
  if( !isset( 
$sCategoriesMenu ) )
    
$sCategoriesMenu listCategories'categories_menu.tpl'1true, Array( $iCategory ) );
  if( !isset( 
$sContentsMenu ) )
    
$sContentsMenu listCategories'contents_menu.tpl'2true, Array( $iCategory ) );
  
$sBlockPage null;
}
echo 
$tpl->tbHtml'page.tpl''HEAD'.$sBlockPage ).$content.$tpl->tbHtml'page.tpl''FOOTER'.$sBlockPage );




treewood (OpenSolution)

Avatar: treewood

2006-03-24 11:48

grecords - before (watch better my first example)

<?php
$content 
.= $tpl->tbHtml'contents_more.tpl'$sBlock );
?>


You should put below

<?php
  
if( $iCategory == 22 ){ // id of category with link
   
header'http://google.com/' ); // external link
   
exit;
  }
?>

znacznik

No avatar

2006-03-24 12:16

It works, but only with Location:
<?php
if( $iCategory == 22 ){ // id of category with link
header( 'Location: http://google.com/' ); // external link
exit;
}
?>

znacznik

Magnus J

No avatar

2006-03-24 15:13

Hi treewood,
Maybe we misunderstood each other. This way I would have to hard code every external link, right?

I want to be able to automatically create an external link when creating a category. (Just like choosing if a category should be visible in the menu or not). Also it would be nice to be able to choose if that link should open i a separate window or not.

treewood (OpenSolution)

Avatar: treewood

2006-03-24 15:39

Magnus J - then You must add new field in category and if it will be not empty then it will redirect on other page. but i cant explain how to do it

Magnus J

No avatar

2006-03-24 16:26

Hmm... too bad. I don´t know how to do that :-( Anyone lese that can explain?

saveuse

Avatar: saveuse

2009-08-03 11:28

i was using quick cart v2.3. under add category menu for add-in hyperlink on full descriprion. i want to add-in pop-up window for the hyperlink. anyone know this?

saveuse

saveuse

Avatar: saveuse

2009-08-03 11:31

i was add on a category called "opportunity". when i was click into this opportunity menu, it was a word "click here for register". now i was to add-on a pop-up window for this word "click here for register". that mean when i was click this, another html windows will pop-up. anyone can help?

saveuse

Back to top
about us | contact