Skip to content

Instantly share code, notes, and snippets.

@mohsin
Created December 30, 2016 09:08
Show Gist options
  • Save mohsin/1b8d32e04873005f4f2aa3fda3bf7cd3 to your computer and use it in GitHub Desktop.
Save mohsin/1b8d32e04873005f4f2aa3fda3bf7cd3 to your computer and use it in GitHub Desktop.
The Dropdown partial file
<div class="dropdown dropdown-fixed">
<button
id="parentDropdown"
type="button"
class="btn btn-default oc-icon-mobile"
data-toggle="dropdown">
<?php echo $variants[$this -> variant_id] ?> <?php if (count($variants) > 1): ?><span class="caret"><?php endif ?>
</button>
<?php if (count($variants) > 1): ?>
<ul class="dropdown-menu" role="menu" data-dropdown-title="Select variant">
<?php foreach ($variants as $k => $variant): ?>
<?php if ($k != $this -> variant_id): ?>
<li role="presentation">
<a
data-request="onVariantChange"
data-request-data="index: <?= $k ?>"
data-request-before-update="$('#parentDropdown').text();"
data-request-update="dropdown: '#dropdown-variant'"
data-stripe-load-indicator
role="menuitem"
tabindex="-1"
href="#"
class="oc-icon-android">
<?= $variant ?>
</a>
</li>
<?php endif ?>
<?php endforeach ?>
</ul>
<?php endif ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment