• Select / Unselect All
    Killzone: Shadow Fall
    Sonic Lost World - Deadly Six Edition
    Sonic Lost World 3DS
    Sonic Space Migets
    Sonic the lost world
    Super Mario 3D World
    gdggsgdfhdghnvbnvbnhffgvbnvbnvnfgghbfdhf
    Killzone
    Sonic the Hedgehog
    Super Mario
    Nintendo 3DS
    Sony ? Playstation 4
    Sony
    Wii U
    First Person Shooter
    Platformer

    Thats how they are mashed at the moment. When something like:

    Game Titles:
    Killzone: Shadow Fall
    Sonic Lost World - Deadly Six Edition
    Sonic Lost World 3DS
    Sonic Space Migets
    Sonic the lost world
    Super Mario 3D World
    
    Game Series:
    gdggsgdfhdghnvbnvbnhffgvbnvbnvnfgghbfdhf
    Killzone
    Sonic the Hedgehog
    Super Mario
    
    System Format:
    Nintendo 3DS
    Sony ? Playstation 4
    Sony
    Wii U
    
    Genre:
    First Person Shooter
    Platformer

    That is more what I am after. Otherwise in a extremely short time it is going to turn into a gigantic wall of mess.

    function my_taxonomy_types($taxonomies) {
        $taxonomies[] = 'games_titles';
    	$taxonomies[] = 'gaming_series';
    	$taxonomies[] = 'system_formats';
    	$taxonomies[] = 'gaming_genres';
        return $taxonomies;
    }
    add_filter('s2_taxonomies', 'my_taxonomy_types');

    That is how they are being added so surely there must be a way to inform Subscribe2 to treat them as separate boxes/groups under a header? Also 'hierarchical' => true, is part of the taxonomy setups I use and have no problems using them before.

    Furthermore advice given by mattyrob pointed me to

    all_cats() function in the class-s2-core.php

    and

    display_category_form() function in the class-s2-admin.php

    .
    From what I can see there are two points of interest:
    1)$all_cats = array_merge on line 1106. This would cause (from my experience which isn’t great) the different terms to be mashed together and loose there uniqueness by creating a new array/grouping.
    2)display_category_form() simply calls the $all_cats which by this time has been mashed into a single array.

    As mentioned I really do not have much experience with such systems and is why I am still hopeful of using this plugin. If anyone has any advise to help assist with this that would be great.

    https://www.ads-software.com/plugins/subscribe2/

Viewing 7 replies - 1 through 7 (of 7 total)
  • @matthew,

    The only person you are likely to get advice from on this forum is me and as you say above I’ve already provided most of the information.

    If I get time I’l see if I can improve the code here.

    Thread Starter Matthew O'Donnell

    (@serpream)

    Np, Kinda using this as a note base while I update methods I have tried. Currently my theory is matching the parent of the term by a if statement. Then if same parent create a new header once, then if no match create a new header based on new parent. Will Update on results.

    @matthew,

    Okay, I understand.

    In fact I think the hierarchal part is working to a degrees as exampled by this “Sony ? Playstation 4”. “Playstation 4” is a child of “Sony” so is list as such.

    What you actually want is to list each taxonomy individually and with a heading rather than merging the taxonomies into a single sorted array.

    Thread Starter Matthew O'Donnell

    (@serpream)

    To update it seems the array_merge doesn’t actually break the link

    Killzone: Shadow Fall
    stdClass Object ( [term_id] => 18 [name] => Killzone: Shadow Fall [slug] => killzone-shadow-fall [term_group] => 0 [term_taxonomy_id] => 18 [taxonomy] => games_titles [description] => [parent] => 0 [count] => 1 [cat_ID] => 18 [category_count] => 1 [category_description] => [cat_name] => Killzone: Shadow Fall [category_nicename] => killzone-shadow-fall [category_parent] => 0 )

    as seen above the taxonomy name still exists. Currently experimenting within class-s2-admin lines 409 to 435. Introducing a If statement to foreach gets the taxonomy the term belongs to. Then if the taxonomy matches previous one carry on creating check boxes, then when taxonomy changes introduce a new break/header and carry on as normal again.

    Thread Starter Matthew O'Donnell

    (@serpream)

    by using

    $termstaxonomy = $cat->taxonomy;
    if ($temptermstaxonomy == $termstaxonomy) {
    	echo "Condition Met!";
    	$temptermstaxonomy = $termstaxonomy;
    } else {
    echo "Condition Not Met!";
    	$temptermstaxonomy = $termstaxonomy;
    }

    I can now detect if they belong to same taxonomy without altering any of the core code. I am at the stages of getting the code in the correct places and creating the header/title then will upload finish code and where it is put ??

    Thread Starter Matthew O'Donnell

    (@serpream)

    BOOM! and success. For someone who had no clue I am very chuffed with myself.
    class-s2-admin.php line 408 on wards.

    $catName .= $cat->name;
    
    	        $termstaxonomy = $cat->taxonomy;
    
    if ($temptermstaxonomy == $termstaxonomy) {
    					$temptermstaxonomy = $termstaxonomy;
    if ( 0 == $j ) {
    				echo "<label><input class=\"checkall_" . $name . "\" type=\"checkbox\" name=\"" . $name . "[]\" value=\"" . $cat->term_id . "\"";
    				if ( in_array($cat->term_id, $selected) || in_array($cat->term_id, $compulsory) ) {
    					echo " checked=\"checked\"";
    				}
    				if ( in_array($cat->term_id, $compulsory) && $name === 'category' ) {
    					echo " DISABLED";
    				}
    				echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
    			} else {
    				echo "<label><input class=\"checkall_" . $name . "\" type=\"checkbox\" name=\"" . $name . "[]\" value=\"" . $cat->term_id . "\"";
    				if ( in_array($cat->term_id, $selected) || in_array($cat->term_id, $compulsory) ) {
    					echo " checked=\"checked\"";
    				}
    				if ( in_array($cat->term_id, $compulsory) && $name === 'category' ) {
    					echo " DISABLED";
    				}
    				echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
    			}
    			$i++;
    	} 
    
    	else {
        echo "<h2>" . __($cat->taxonomy, 'subscribe2') . "</h2>\r\n";
    	$temptermstaxonomy = $termstaxonomy;
    	if ( 0 == $j ) {
    				echo "<label><input class=\"checkall_" . $name . "\" type=\"checkbox\" name=\"" . $name . "[]\" value=\"" . $cat->term_id . "\"";
    				if ( in_array($cat->term_id, $selected) || in_array($cat->term_id, $compulsory) ) {
    					echo " checked=\"checked\"";
    				}
    				if ( in_array($cat->term_id, $compulsory) && $name === 'category' ) {
    					echo " DISABLED";
    				}
    				echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
    			} else {
    				echo "<label><input class=\"checkall_" . $name . "\" type=\"checkbox\" name=\"" . $name . "[]\" value=\"" . $cat->term_id . "\"";
    				if ( in_array($cat->term_id, $selected) || in_array($cat->term_id, $compulsory) ) {
    					echo " checked=\"checked\"";
    				}
    				if ( in_array($cat->term_id, $compulsory) && $name === 'category' ) {
    					echo " DISABLED";
    				}
    				echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
    			}
    			$i++;
    	}
    }

    Not altered any of the already present code and hook from functions file is also untouched. Works perfectly ??
    Hope this helps you as well.

    *Just working on getting Taxonomy->name instead of slug then it will be perfect.

    Thread Starter Matthew O'Donnell

    (@serpream)

    And the final code using labels of the taxonomy as header. 408 on wards again.

    $catName .= $cat->name;
    
    			$termstaxonomy = $cat->taxonomy;
                $taxonomydetails = get_taxonomy($termstaxonomy);
    			$taxonomyname = $taxonomydetails->label;
    
    if ($temptermstaxonomy == $termstaxonomy) {
    					$temptermstaxonomy = $termstaxonomy;
    if ( 0 == $j ) {
    				echo "<label><input class=\"checkall_" . $name . "\" type=\"checkbox\" name=\"" . $name . "[]\" value=\"" . $cat->term_id . "\"";
    				if ( in_array($cat->term_id, $selected) || in_array($cat->term_id, $compulsory) ) {
    					echo " checked=\"checked\"";
    				}
    				if ( in_array($cat->term_id, $compulsory) && $name === 'category' ) {
    					echo " DISABLED";
    				}
    				echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
    			} else {
    				echo "<label><input class=\"checkall_" . $name . "\" type=\"checkbox\" name=\"" . $name . "[]\" value=\"" . $cat->term_id . "\"";
    				if ( in_array($cat->term_id, $selected) || in_array($cat->term_id, $compulsory) ) {
    					echo " checked=\"checked\"";
    				}
    				if ( in_array($cat->term_id, $compulsory) && $name === 'category' ) {
    					echo " DISABLED";
    				}
    				echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
    			}
    			$i++;
    	} 
    
    	else {
        echo "<h2>" . __($taxonomyname, 'subscribe2') . "</h2>\r\n";
    	$temptermstaxonomy = $termstaxonomy;
    	if ( 0 == $j ) {
    				echo "<label><input class=\"checkall_" . $name . "\" type=\"checkbox\" name=\"" . $name . "[]\" value=\"" . $cat->term_id . "\"";
    				if ( in_array($cat->term_id, $selected) || in_array($cat->term_id, $compulsory) ) {
    					echo " checked=\"checked\"";
    				}
    				if ( in_array($cat->term_id, $compulsory) && $name === 'category' ) {
    					echo " DISABLED";
    				}
    				echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
    			} else {
    				echo "<label><input class=\"checkall_" . $name . "\" type=\"checkbox\" name=\"" . $name . "[]\" value=\"" . $cat->term_id . "\"";
    				if ( in_array($cat->term_id, $selected) || in_array($cat->term_id, $compulsory) ) {
    					echo " checked=\"checked\"";
    				}
    				if ( in_array($cat->term_id, $compulsory) && $name === 'category' ) {
    					echo " DISABLED";
    				}
    				echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
    			}
    			$i++;
    	}
    }

    Hope this helps you as well.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Group options by taxonomy term belongs too? OR even manually sort?’ is closed to new replies.