Author Topic: [Mod] Additional Category fields  (Read 31336 times)

0 Members and 1 Guest are viewing this topic.

Rembrandt

  • Guest
[Mod] Additional Category fields
« on: May 20, 2013, 04:45:45 PM »
Hi!

The additional category fields function as the additional image fields.
They work in the thumbnails in the categories and on the detail side.

Example Mod with "radio" Button

Example Mod with "textarea"


1.) search in admin/categories.php section: ($action == "savecat"):

$auth_viewcat 
intval($HTTP_POST_VARS['auth_viewcat']);

insert above:

// ######## Start Mod Additional Category #################  
  
if (!empty($additional_category_fields)) {
    
$additional_field_sql "";
    
$additional_value_sql "";
    
$table_fields $site_db->get_table_fields(CATEGORIES_TABLE);
    foreach (
$additional_category_fields as $key => $val) {
      if (isset(
$HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
        
$additional_field_sql .= ", $key";
        
$additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
      }
    }
  }
// ######## End Mod Additional Category ###################

1.2) search in section: ($action == "savecat"):

    $sql 
"INSERT INTO ".CATEGORIES_TABLE."
            (cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment)
            VALUES
            ('
$cat_name', '$cat_description', $cat_parent_id$cat_order$auth_viewcat$auth_viewimage$auth_download$auth_upload$auth_directupload$auth_vote$auth_sendpostcard$auth_readcomment$auth_postcomment)";


and replace:

// ############## Show below in the SQL Query Mod Additional Category #################
    
$sql "INSERT INTO ".CATEGORIES_TABLE."
            (cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment"
.$additional_field_sql.")
            VALUES
            ('
$cat_name', '$cat_description', $cat_parent_id$cat_order$auth_viewcat$auth_viewimage$auth_download$auth_upload$auth_directupload$auth_vote$auth_sendpostcard$auth_readcomment$auth_postcomment".$additional_value_sql.")";


1.3) search in section: ($action == "addcat"):

$permission_headline 
$lang['permissions'];

insert above:

// ######## Start Mod Additional Category ###################
  
show_additional_fields("category", array(), CATEGORIES_TABLE);
// ######## End Mod Additional Category #####################

1.4) search in section ($action == "updatecat"):

$auth_viewcat 
intval($HTTP_POST_VARS['auth_viewcat']);

insert above:

// ######## Start Mod Additional Category ##################  
  
if (!empty($additional_category_fields)) {
    
$additional_sql="";
    
$table_fields $site_db->get_table_fields(CATEGORIES_TABLE);
    foreach (
$additional_category_fields as $key => $val) {
      if (isset(
$HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
        
$additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
      }
    }
  }
// ######## End Mod Additional Category ####################

1.5) search in section ($action == "updatecat"):

SET cat_name 
'$cat_name'cat_description '$cat_description'cat_parent_id $cat_parent_idcat_order $cat_ordercat_hits $cat_hitsauth_viewcat $auth_viewcatauth_viewimage $auth_viewimageauth_download $auth_downloadauth_upload $auth_uploadauth_directupload $auth_directuploadauth_vote $auth_voteauth_sendpostcard $auth_sendpostcardauth_readcomment $auth_readcommentauth_postcomment $auth_postcomment

and replace:

SET cat_name 
'$cat_name'cat_description '$cat_description'cat_parent_id $cat_parent_idcat_order $cat_ordercat_hits $cat_hitsauth_viewcat $auth_viewcatauth_viewimage $auth_viewimageauth_download $auth_downloadauth_upload $auth_uploadauth_directupload $auth_directuploadauth_vote $auth_voteauth_sendpostcard $auth_sendpostcardauth_readcomment $auth_readcommentauth_postcomment $auth_postcomment".$additional_sql."

1.6) search in section ($action == "editcat"):

 $sql 
"SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment

and replace:

$sql 
"SELECT *

1.7) search in section ($action == "editcat"):

show_table_separator
($lang['permissions'], 2);

insert above:

// ######## Start Mod Additional Category ####################  
  
show_additional_fields("category"$cat_rowCATEGORIES_TABLE);
// ######## End Mod Additional Category ######################


2.) search in includes/functions.php in (function show_image):

global $self_url$site_template$site_sess$user_info$config$cat_cache$lang$additional_image_fields$user_table_fields$url_show_profile;

and replace:

global $self_url$site_template$site_sess$user_info$config$cat_cache$lang$additional_image_fields$user_table_fields$url_show_profile$additional_category_fields;

2.1) search in (function show_image):

  $rate_form 
"";
  if (
check_permission("auth_vote"$image_row['cat_id'])) {

insert above:

// ######## Start Mod Additional Category #################    
  
if (!empty($additional_category_fields)) {
    
$additional_field_array = array();
    foreach (
$additional_category_fields as $key => $val) {
    
//$additional_sql .= ", c.".$key;
      
$additional_field_array[$key] = (!empty($cat_cache[$image_row['cat_id']][$key])) ? format_text($cat_cache[$image_row['cat_id']][$key], 1) : REPLACE_EMPTY;
      
$additional_field_array['lang_'.$key] = $val[0];
    }
    if (!empty(
$additional_field_array)) {
      
$site_template->register_vars($additional_field_array); 
    }
  }
// ######## End Mod Additional Category ####################

2.2) search in (function get_categories):

global $cat_cache$cat_parent_cache$new_image_cache$subcat_ids;

and replace:

  
global $cat_cache$cat_parent_cache$new_image_cache$subcat_ids$additional_category_fields;

2.3) search in (function get_categories):

      $random_cat_image_file 
get_random_image($category_id01);
    }

insert below:

// ######## Start Mod Additional Category #################    
    
if (!empty($additional_category_fields)) {
    
$additional_field_array = array();
    foreach (
$additional_category_fields as $key => $val) {
      
$additional_field_array[$key] = (!empty($cat_cache[$category_id][$key])) ? format_text($cat_cache[$category_id][$key], 1) : REPLACE_EMPTY;
      
$additional_field_array['lang_'.$key] = $val[0];
    }
    if (!empty(
$additional_field_array)) {
      
$site_template->register_vars($additional_field_array); 
    }
  }
// ######## End Mod Additional Category ###################


3.) search in global.php:

if (defined("GET_CACHES")) {

insert above:

// ######## Start Mod Additional Category #################
if (!empty($additional_category_fields)) {
  foreach (
$additional_category_fields as $key => $val) {
    
$additional_sql .= ",".$key;
  }
}
// ######## End Mod Additional Category ###################

3.1) search:

$sql 
"SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment

and replace:

$sql 
"SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment".$additional_sql."


mfg Andi
« Last Edit: April 23, 2014, 06:49:28 PM by Rembrandt »

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Mod] Additional Category fields
« Reply #1 on: October 08, 2013, 04:16:35 PM »
Hallo Andy,
So, installiert und keine Fehlermeldung (ist doch was  :wink:)
Aber sag mal, wo finde ich denn das Eingabefeld ?
Muss ich noch etwas anderes Installieren, oder fehlt evtl. ein Eintrag in der Sprachdatei ?

das einzigste was ich gefunden habe, unter Kategorie Einstellungen ist dieses (siehe Bild)

LG Harald
Danke Harald




Rembrandt

  • Guest
Re: [Mod] Additional Category fields
« Reply #2 on: October 08, 2013, 07:01:33 PM »
Hi!
...
das einzigste was ich gefunden habe, unter Kategorie Einstellungen ist dieses (siehe Bild)
..
Der Mod hier ist nur die Basis, wenn du jetzt Textfelder oder Radio Buttons haben möchtest mußt du die natürlich erst installieren, genau so wie bei den Additionalen Image fields.
Im ersten Post hier hast du die Links.

mfg Andi

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Mod] Additional Category fields
« Reply #3 on: October 09, 2013, 04:46:18 PM »
OK, das ist nicht das Problem, nur wie binde ich es so wie bei dir ein ?

Wenn ich das Kategorie Feld normal einbinde {category_info}
wird es ja nur als Textfeld dort angezeigt wo ich es einbinde.

Aber soll ja wie bei dir nach dem Klick (Kreuz) verschwinden

LG Harald
Danke Harald




Rembrandt

  • Guest
Re: [Mod] Additional Category fields
« Reply #4 on: October 09, 2013, 05:30:18 PM »
Achso... dann nehme ich mal an das du diesen Mod nicht gesehen hast?
http://www.4homepages.de/forum/index.php?topic=31353.0

mfg Andi

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: [Mod] Additional Category fields
« Reply #5 on: October 09, 2013, 07:45:33 PM »
Nö  :oops:

Danke für den Schupser

LG
Danke Harald




Offline .Infecto

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: [Mod] Additional Category fields
« Reply #6 on: April 23, 2014, 02:02:24 PM »
Wie kann man das Feld auf der Startseite anzeigen lassen?
In der Details.html wird es angezeigt bzw. ausgegeben, aber auf der Startseite leider nicht und in der category_bit auch nicht.

Habe das schon so versucht, aber ich denke es gibt einen einfacheren Weg?
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
$categories get_categories(0);
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url,i.image_download_url2,i.image_download_url3,i.image_download_url4,i.image_download_url5,i.image_download_url6,i.image_download_url7,i.image_download_url8, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_downloads2, i.image_downloads3, i.image_downloads4, i.image_downloads5, i.image_downloads6, i.image_downloads7,i.image_downloads8, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name, c.cat_icon".get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email")."
        FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_id = 
$image_id AND i.image_active = 1 AND c.cat_id = i.cat_id";
$image_row $site_db->query_firstrow($sql);
if (!
$categories)  {
  
$categories $lang['no_categories'];
}
$site_template->register_vars("categories"$categories);
$site_template->register_vars(array(
"cat_icon" => format_text($image_row['cat_icon'], 2)
));
unset(
$categories);

Rembrandt

  • Guest
Re: [Mod] Additional Category fields
« Reply #7 on: April 23, 2014, 06:51:41 PM »
Hi!
Wie kann man das Feld auf der Startseite anzeigen lassen?
In der Details.html wird es angezeigt bzw. ausgegeben, aber auf der Startseite leider nicht und in der category_bit auch nicht.

Habe das schon so versucht, aber ich denke es gibt einen einfacheren Weg?....
Sry mein Fehler, der Punkt 2.2) wurde geändert, und neu hinzugefügt, Schritt 2.3)

mfg Andi

Offline .Infecto

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: [Mod] Additional Category fields
« Reply #8 on: April 29, 2014, 01:51:49 PM »
Ich habe zu danken.

Offline Tomila

  • Pre-Newbie
  • Posts: 2
    • View Profile
    • Mediakol
Re: [Mod] Additional Category fields
« Reply #9 on: July 29, 2014, 05:22:49 PM »
Danke. Ich versuchte es alleine hinzubekommen, aber da bin ich ein wenig am Können gescheitert. Jetzt passt es wundervoll.