Skip to content

Instantly share code, notes, and snippets.

@jschloss
Created February 23, 2012 16:11
Show Gist options
  • Save jschloss/1893472 to your computer and use it in GitHub Desktop.
Save jschloss/1893472 to your computer and use it in GitHub Desktop.
<?php if (!($_shippingRateGroups = $this->getShippingRatesByDate())): ?>
<div id="no-shipping-methods">
<p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
</div>
<?php else: ?>
<ul class="sp_methods">
<?php foreach($_shippingRateGroups as $_key => $_shippingRates): ?>
<?php if(empty($_shippingRates)) { continue; } ?>
<li class="method_parent">
<div class="sp_options">
<?php
$header = Mage::helper('addresstype')->getDeliveryHeader($_key);
$free=true;
foreach($_shippingRates as $key => $_rate)
if($_rate->getPrice() != 0.0)
$free=false;
if($free)
$header.=' - Free!';
$exploded=explode(" ", $header);
$cssClass = strtolower(array_pop($exploded));
?>
<h1><!--<?//php echo $header; ?>-->Get it in 2-3 business days</h1><div class="help-icon"></div><br/><br/><h4>We're moving to a new warehouse so we can ship orders even faster. We'll ship your order on Monday, or sooner if our new warehouse is up and running. </h4>
<div style="clear:both"></div>
<ul class="<?php echo $cssClass; ?>">
<?php foreach($_shippingRates as $key => $_rate): ?>
<li<?php if($_rate->getPrice() == 0.0): ?> class="free"<?php endif; ?>>
<div class="item">
<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> />
<label for="s_method_<?php echo $_rate->getCode() ?>">
<span class="sp_method"><?php echo $_rate->getMethodTitle() ?></span> -
<?php if($_rate->getPrice() == 0.0): ?>
<span class="sp_price free"><?php echo $this->__('Free'); ?></span>
<?php else: ?>
<span class="sp_price">
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
<?php echo $_excl; ?>
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
(<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
<?php endif; ?>
</span>
<?php endif; ?>
</label>
</div>
</li>
<?php endforeach; ?>
</ul>
<div style="clear:both"></div>
<span class="sp_options_more"></span>
</div>
<div style="clear:both;"></div>
</li>
<?php endforeach; ?>
</ul>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($) {
$('.help-icon').qtip({
content : {
title: 'We\’ll do our very best<br/> to get your order delivered on time.',
text: 'Occasional mishaps, crazy weather, giant<br/> dolphin attacks and other acts of god<br/> may delay delivery.'
},
position: {
at: 'top center',
my: 'bottom left'
},
style: {
classes: 'ui-tooltip-dark'
}
});
<?php
// hide duplicate monday methods
?>
if($('.sp_methods .monday').length > 1) {
$('.monday:not(:first) li').each(function() {
$('.monday:first').append($(this));
});
$('.monday:not(:first)').parents('.method_parent').hide();
}
if($('.sp_methods input:checked').length == 0) {
$('.sp_methods .sp_options .free input').first().attr('checked', 'checked');
}
// activate block that have selected method
$('.sp_methods input:checked').parents('.method_parent').addClass('active');
$('.sp_methods .active .help-icon').show();
//add background color to active day
$('.sp_methods input').click(function() {
var parent = $(this).parents('.method_parent');
if (!parent.hasClass('active')) {
$('.method_parent').removeClass('active', 'fast');
$('.sp_methods .help-icon').fadeOut('fast');
parent.addClass('active', 'fast');
parent.find('.help-icon').fadeIn('slow');
}
});
});
//]]>
</script>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment