tessguefen
7/20/2015 - 5:41 PM

Shop By (ALL) , alphabetical order. Craziness. MTP.

Shop By (ALL) , alphabetical order. Craziness. MTP.

<mvt:item name="toolkit" param="parentcat|pccount" />
<mvt:item name="toolkit" param="asortmulti|l.all_settings:parent_categories|:name|1" />

<mvt:assign name="l.settings:lettercount_array" value="''" />
<mvt:assign name="l.settings:lettercount" value="0" />
<mvt:assign name="l.settings:last_letter" value="'A'" />

<mvt:foreach iterator="parent_category" array="parent_categories">
<mvt:assign name="l.settings:letter" value="substring( l.settings:parent_category:name, 0, 1 )" />
<mvt:if expr="isdigit( l.settings:letter ) EQ 0">
	<mvt:if expr="l.settings:letter NE l.settings:last_letter">
		<mvt:assign name="l.settings:lettercount_arrayInsert" value="miva_array_insert( l.settings:lettercount_array, l.settings:lettercount, -1 )" />
		<mvt:assign name="l.settings:lettercount" value="0" />
	<mvt:else>
			<mvt:assign name="l.settings:lettercount" value="l.settings:lettercount + 1" />
	</mvt:if>
	<mvt:assign name="l.settings:last_letter" value="l.settings:letter" />
</mvt:if>
</mvt:foreach>

<mvt:assign name="l.helpfultotal" value="miva_array_elements( l.settings:readytheme:navigationitems )" />
<mvt:assign name="l.helpfulhalf" value="ceil(l.helpfultotal / 2)" />
<mvt:assign name="l.settings:letter_count" value="0" />
<mvt:assign name="l.settings:total_letter_count" value="0" />


<mvt:foreach iterator="parent_category" array="parent_categories">
<mvt:assign name="l.settings:letter" value="substring( l.settings:parent_category:name, 0, 1 )" />
<mvt:if expr="isdigit( l.settings:letter ) EQ 0">
	<mvt:if expr="l.settings:letter NE l.settings:last_letter">

		<mvt:assign name="l.settings:letter_count" value="0" />
		<mvt:assign name="l.settings:total_letter_count" value="0" />

		<mvt:assign name="l.settings:currentLetterNum" value="l.settings:currentLetterNum + 1" />
		<mvt:assign name="l.settings:letter_total_count" value="l.settings:lettercount_array[l.settings:currentLetterNum]" />
		<mvt:assign name="l.settings:letters_divided" value="l.settings:letter_total_count / 3" />
		<mvt:assign name="l.settings:letter_divisible" value="ceil( l.settings:letters_divided )" />
		
		<div class="breaker clear clearfix"></div>
		<div id="letter-&mvt:letter;" class="shop-all-letter" style="border-bottom: 1px solid #000; margin-top: 20px;">
			&mvt:letter;
		</div>
	</mvt:if>
	<mvt:if expr="l.settings:letter_count EQ 0 OR l.settings:letter_count EQ l.settings:letter_divisible">
		<div class="column np medium-one-third whole">
		<mvt:assign name="l.settings:letter_count" value="0" />
	</mvt:if>
	<a href="/category/&mvt:parent_category:code;.html">&mvt:parent_category:name;</a><br />
	<mvt:assign name="l.settings:letter_count" value="l.settings:letter_count + 1" />
	<mvt:assign name="l.settings:total_letter_count" value="l.settings:total_letter_count + 1" />

	<mvt:if expr="l.settings:letter_count EQ l.settings:letter_divisible OR l.settings:total_letter_count EQ (l.settings:letter_total_count + 1 )">
		</div>
	</mvt:if>

	<mvt:assign name="l.settings:last_letter" value="l.settings:letter" />

</mvt:if>
</mvt:foreach>