Jump to content

processfire

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by processfire

  1. Probably a little too late to the party, but if anyone else os looking for an easy fix, i've got one, and it works like a charm:

    My issue was with getting a single product (each on its own page) to show up dynamically under different solutions i.e:

                  In-Store (solution 1) would need product 1, product 2, product 3

                  e-Commerce ( solution 2) would need  product 1, product 3

    short of dupicating the pages and having them as direct children to the 2 ( or more) different solutions wasnt viable,

    so, my work around was this, edit the template you're using for the pages that need to show up under more than one parent (product pages) and call it tag( or what ever you want to, doenst really matter as long as your php reflects this fields name)

    the relational layout of the pages is important also:

    |-solutions ( top parent)

    |--solution 1 ( child 1)

    |--solution 2 ( child 2)

    |--solution 3 ( child 3)

    |--All Products ( child 4, a container for all products)

    |---product 1 (child 1 of child 4)

    |---product 2 (child 1 of child 4)

    |---product 3 (child 1 of child 4)

    when assigning this child to the various parent you want, enter the page name as a tag seperated by commas, the php will allocate it to all the page tabs it finds.

    i've just spent a good couple days trying to work out the logic behind this so forgive me if ive just sperted this information out, i hope it makes sence! feel free to ask if not

                            
    
    
    foreach($pages->get("/solutions/all-products/")->children as $prod){
    	$check = $prod->tag;
    	if (strpos($check, ',') !== false) { #check if tag field has multiple tags by lookin gfor the seperationg value ','
    	$newstr = explode(",",$check); #split into array
    	foreach($newstr as $tag){ #Iterate through the tags
        	if($tag == $page->title){ # check if tag relates to a page
            	echo "<a href='{$prod->url}'><li><font color='white'>{$prod->title}<font></li></a>";
        	} else {
                #Do Nothing      
            }
        }
        } else {
        if($check == $page->title){ # Fthis if no multiple tags detected 
        	echo "<a href='{$prod->url}'><li><font color='white'>{$prod->title}<font></li></a>";
        } else {
            #Do Nothing
    	}
     }

    I know its a super specific example, but you may be able to modify this for a differnet use!

     

×
×
  • Create New...