Dynamic depth with GWcode Categories - expressionengine

I'm having trouble wrapping my head around how to create a dynamic menu with GWcode categories in ExpressionEngine. I would like the menu to go a certain depth only for current {segment_2} (parent) category and the rest of the parent categories to just stay a depth of 1.
For instance, if the url was: domain.com/products/medical-tables-cabinets/eta-classic-series/ it would output this:
<ul class="nav-menu">
<li>Power Tables</li>
<li class="active submenu">Medical Tables & Cabinets
<ul class="nav-submenu">
<li>ETA Alpha Series</li>
<li class="active submenu">ETA Classic Series
<ul class="nav-submenu">
<li>Entry A</li>
<li>Entry B</li>
<li>Entry C</li>
</ul>
</li>
<li>Style Line Cabinet Models</li>
<li>Echo Image Series</li>
<li>Bariatric Series</li>
<li>Family Practice</li>
<li>Treatment & Bedside Cabinets</li>
<li>Managed Care Quick Cabinets</li>
<li>Recovery Couches</li>
</ul>
</li>
<li>Pediatric Equipment</li>
<li>Medical Seating</li>
<li>Blood Drawing Chairs</li>
<li>Tubular Steel & Accessories</li>
<li>Physical Therapy Equipment</li>
<li>Kangoo by Clinton</li>
<li>Training Room Furnishings</li>
<li>Index by Model #</li>
<li>Clinton-Eco Tables</li>
</ul>

I got it working, but I still need to go a little deeper. Here is the basic concept:
{exp:gwcode_categories
channel="products"
style="linear"
}
{if depth1_start AND segment_2 != cat_url_title}
<li>{cat_name}</li>
{/if}
{if depth1_start AND segment_2 == cat_url_title}
<li class="active submenu">{cat_name}
<ul class="nav-submenu">
{/if}
{if depth == 2 AND segment_2 == parent_url_title}
<li{if segment_3 == cat_url_title} class="active"{/if}>{cat_name}</li>
{/if}
{if depth1_end AND segment_2 == parent_url_title}
</ul>
</li>
{/if}
{/exp:gwcode_categories}

Related

Prestashop 1.7 attribute groups - check stock and apply css to unavailable combination

Prestashop option to hide unavailable attributes on product page doesn't work when attribute groups are used, for example color and size (for clothing shops).
I need to keep showing all possible combinations, but grey out (or strikethrough) the combinations with no stock.
Like this:
I tried several things.
In Prestashop 1.6 the following piece of code worked to apply css class (.out-of-stock-float-left) to unavailable combinations:
{elseif $group.group_type == 'radio'}
<ul id="group_{$id_attribute_group}">
{foreach from=$group.attributes key=id_attribute item=group_attribute}
{if {$group.attributes_quantity[{$id_attribute|intval}]} > 1} <!-- product in stock -->
<li class="input-container float-left">
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}"
name="group[{$id_attribute_group}]"
value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</li>
{else} <!-- product out of stock -->
<li class="input-container out-of-stock-float-left">
<input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}"
name="group[{$id_attribute_group}]"
value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
<span class="radio-label">{$group_attribute.name}</span>
</li>
{/if}
{/foreach}
</ul>
{/if}
When changing combinations there is an ajax request. I don't know how to grey out combinations with no stock and make them not clickable.
Thanks

How can I use Selenium to click multiple plus buttons and show their entire content

I want to click and open multiple plus buttons and print out their texts. Here is the code that I have:
from selenium import webdriver
chrome_path=r"G:\My Drive\chrome_driver\chromedriver_win32\chromedriver.exe"
driver=webdriver.Chrome(chrome_path)
driver.get('https://meshb.nlm.nih.gov/treeView')
for links in driver.find_elements_by_css_selector('a.ng-scope'):
links.find_element_by_xpath("following-sibling::span").click();
for sublinks in links.find_elements_by_xpath("//*[#class='ng-scope']/span"):
print(sublinks.text)
here is what I see! the nodes' text is duplicated! and the code cannot open all the plus buttons. Only the first level plus buttons are opened, how can I change my code to be able to open all plus buttons, and once every plus button is open, I see the node'stext along with the whole content that is associated with it?
A part of html looks like this:
<a class="ng-scope">
<span class="ng-binding ng-scope">Anatomy [A]</span>
</a>
<ul class="treeItem ng-scope">
<li class ="ng-scope" >
< a class ="ng-scope" href="/record/ui?ui=D001829" >
< span class ="ng-binding ng-scope" > Body Regions[A01] < / span >
</a>
</li>
< li class ="ng-scope" >
<a class ="ng-scope" href="/record/ui?ui=D001829" >
< span class ="ng-binding ng-scope" > Cardio Vascular< / span >
</a>
<ul class="treeItem ng-scope">
<li class="ng-scope">
<a class="ng-scope" href="/record/ui?ui=D015824">
<span class="ng-binding ng-scope">Blood-Air Barrier [A07.025]</span>
</a>
<ul class="treeItem ng-scope">
<li class="ng-scope">
<a class="ng-scope" href="/record/ui?ui=D018916">
<span class="ng-binding ng-scope">Blood-Aqueous Barrier [A07.030]</span>
</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>

ExpressionEngine swtich tag working inconsistently

In ExpressioneEngine, I'm creating a list with conditionals that is returning some strange behavior. The code below is part of a bigger set:
<li><h4>DERMATOLOGY</h4>
<ul>
{exp:channel:entries channel="specialist" dynamic="no" orderby="sp_order" sort="asc"}
{if sp_specialty == "sp_dermatology"}
<li>
<img src="{sp_headshot}" />
<p>{title}</p>
</li>
{/if}
{/exp:channel:entries}
</ul>
</li>
<li><h4>EMERGENCY AND CRITICAL CARE</h4>
<ul>
{exp:channel:entries channel="specialist" dynamic="no" orderby="sp_order" sort="asc"}
{if sp_specialty == "sp_emergency"}
<li class="{switch='one|two'}">
<img src="{sp_headshot}" />
<p>{title}</p>
</li>
{/if}
{/exp:channel:entries}
</ul>
</li>
What happens, in the case of EMERGENCY AND CRITICAL CARE, is that with the 5 entries I have under that, the classes are returned like this: two, one, one, one, two. Any suggestions on getting the behavior I need?
I see what you mean. The switch variable applies its logic to all entries returned by the entries loop - which is why you're seeing odd numbering in your rendered page - because it's applying them to entries returned by the loop that you are then applying conditionals to in order to do your grouping. You could use the search param to do some of that for you, returning only the entries you're looking for within each loop. Like this:
<li><h4>DERMATOLOGY</h4>
<ul>
{exp:channel:entries channel="specialist" search:sp_specialty="=sp_dermatology" dynamic="no" orderby="sp_order" sort="asc"}
<li>
<img src="{sp_headshot}" />
<p>{title}</p>
</li>
{/exp:channel:entries}
</ul>
</li>
<li><h4>EMERGENCY AND CRITICAL CARE</h4>
<ul>
{exp:channel:entries channel="specialist" search:sp_specialty="=sp_emergency" dynamic="no" orderby="sp_order" sort="asc"}
<li class="{switch='one|two'}">
<img src="{sp_headshot}" />
<p>{title}</p>
</li>
{/exp:channel:entries}
</ul>
</li>
This way each loop returns ONLY the matching items you're looking for, eliminating the need for the conditional and allowing the switch param to operate as it wants to - applying itself in alternating fashion to every returned entry from the loop.

TYPO3: Navigation with different colors

Hy everyone. I am an neebie in Typo3 and i want to ask how is this possible to make a navigation with different colors. It must look like that
<ul>
<li>NavItem 1
<ul>
<li>SubItem1
<ul>
<li>SubsubItem1</li> <--- when active to red
</ul>
</li>
<li>SubItem2
<ul>
<li>SubsubItem2.1</li><--- when active to red
<li>SubsubItem2.2</li><--- when active to red
<li>SubsubItem2.3</li><--- when active to red
</ul>
</li>
</ul>
</li>
<li>NavItem 2</li><--- third level item to blue on active
<li>NavItem 3</li><--- third level Item to green on active
<li>NavItem 4</li>
<li>NavItem 5</li>
<li>NavItem 6</li>
</ul>
All other third level Items must be in the specified color when they active.
Is this possible in Typo3?
Thanks for your answers :)
what you are looking for is optionSplit.
f.e.
1.NO.ATagParams = class="red" || class="blue" || class="green" ...
The || indicates optionSplit - it will split each menu item.
I am not sure, if optionSplit works on ATagParams, at least you can use it on wrapItemAndSub or allWrap.
1.NO.allWrap = <li class="red">|</li> || <li class="blue">|</li> || ...

Joomla Menu Customize

How do I customize a Joomla Menu? I have a MainMenu with 1 row 1 item menu. I want to customize the menu with example style: 1 item 2 row. (each row each text field).
Now:
<ul class="menu">
<li class="item-464">
Home
</li>
<li class="item-444 active deeper parent">
About
</li>
</ul>
To:
<ul class="menu">
<li class="item-464">
<a href="#">
<span style="display:block">Home</span>
<span style="display:block,font-size:10px">Home</span>
</a>
</li>
<li class="item-444 active deeper parent">
<a href="#">
<span style="display:block">About</span>
<span style="display:block,font-size:10px">About</span>
</a>
</li>
</ul>
You just need to assign the items with a Parent Item of the first level in Menu Manager > Main Menu > Edit Menu Item which will create a menu tree as you add sub items.

Resources