Better tax system
This commit is contained in:
parent
291855f318
commit
6913726cd5
|
@ -521,7 +521,7 @@ function woocommerce_update_options($options) {
|
|||
$tax_rate = array();
|
||||
$tax_rates = array();
|
||||
$tax_shipping = array();
|
||||
|
||||
|
||||
if (isset($_POST['tax_class'])) $tax_classes = $_POST['tax_class'];
|
||||
if (isset($_POST['tax_country'])) $tax_countries = $_POST['tax_country'];
|
||||
if (isset($_POST['tax_rate'])) $tax_rate = $_POST['tax_rate'];
|
||||
|
@ -531,23 +531,31 @@ function woocommerce_update_options($options) {
|
|||
|
||||
if (isset($tax_classes[$i]) && isset($tax_countries[$i]) && isset($tax_rate[$i]) && $tax_rate[$i] && is_numeric($tax_rate[$i])) :
|
||||
|
||||
$country = woocommerce_clean($tax_countries[$i]);
|
||||
$state = '*';
|
||||
$rate = number_format(woocommerce_clean($tax_rate[$i]), 4);
|
||||
$class = woocommerce_clean($tax_classes[$i]);
|
||||
|
||||
if (isset($tax_shipping[$i]) && $tax_shipping[$i]) $shipping = 'yes'; else $shipping = 'no';
|
||||
|
||||
// Get state from country input if defined
|
||||
if (strstr($country, ':')) :
|
||||
$cr = explode(':', $country);
|
||||
$country = current($cr);
|
||||
$state = end($cr);
|
||||
endif;
|
||||
// Handle countries
|
||||
$counties_array = array();
|
||||
$countries = $tax_countries[$i];
|
||||
if ($countries) foreach ($countries as $country) :
|
||||
|
||||
$country = woocommerce_clean($country);
|
||||
$state = '*';
|
||||
|
||||
if (strstr($country, ':')) :
|
||||
$cr = explode(':', $country);
|
||||
$country = current($cr);
|
||||
$state = end($cr);
|
||||
endif;
|
||||
|
||||
$counties_array[$country][] = $state;
|
||||
|
||||
endforeach;
|
||||
|
||||
$tax_rates[] = array(
|
||||
'country' => $country,
|
||||
'state' => $state,
|
||||
'countries' => $counties_array,
|
||||
'rate' => $rate,
|
||||
'shipping' => $shipping,
|
||||
'class' => $class
|
||||
|
@ -759,34 +767,32 @@ function woocommerce_admin_fields($options) {
|
|||
$_tax = new woocommerce_tax();
|
||||
$tax_classes = $_tax->get_tax_classes();
|
||||
$tax_rates = get_option('woocommerce_tax_rates');
|
||||
|
||||
?><tr valign="top">
|
||||
<th scope="row" class="titledesc"><?php echo $value['name'] ?></th>
|
||||
<td class="forminp" id="tax_rates">
|
||||
<div class="taxrows">
|
||||
<?php
|
||||
$i = -1;
|
||||
if ($tax_rates && is_array($tax_rates) && sizeof($tax_rates)>0) foreach( $tax_rates as $rate ) : $i++;
|
||||
echo '<p class="taxrow"><select name="tax_class['.$i.']" title="Tax Class"><option value="">'.__('Standard Rate', 'woothemes').'</option>';
|
||||
|
||||
if ($tax_classes) foreach ($tax_classes as $class) :
|
||||
echo '<option value="'.sanitize_title($class).'"';
|
||||
|
||||
if ($rate['class']==sanitize_title($class)) echo 'selected="selected"';
|
||||
|
||||
echo '>'.$class.'</option>';
|
||||
endforeach;
|
||||
|
||||
echo '</select><select name="tax_country['.$i.']" title="Country">';
|
||||
|
||||
woocommerce_countries::country_dropdown_options($rate['country'], $rate['state']);
|
||||
|
||||
echo '</select><input type="text" class="text" value="'.$rate['rate'].'" name="tax_rate['.$i.']" title="'.__('Rate', 'woothemes').'" placeholder="'.__('Rate', 'woothemes').'" maxlength="8" />% <label><input type="checkbox" name="tax_shipping['.$i.']" ';
|
||||
|
||||
if (isset($rate['shipping']) && $rate['shipping']=='yes') echo 'checked="checked"';
|
||||
|
||||
echo ' /> '.__('Apply to shipping', 'woothemes').'</label><a href="#" class="remove button">×</a></p>';
|
||||
endforeach;
|
||||
?>
|
||||
|
||||
<?php $i = -1; if ($tax_rates && is_array($tax_rates) && sizeof($tax_rates)>0) foreach( $tax_rates as $rate ) : $i++; ?>
|
||||
<div class="taxrow">
|
||||
<select name="tax_country[<?php echo $i; ?>][]" title="Country" class="country_multiselect" size="10" multiple="multiple">
|
||||
<?php echo woocommerce_countries::country_multiselect_options( $rate['countries'] ); ?>
|
||||
</select>
|
||||
<select name="tax_class[<?php echo $i; ?>]" title="Tax Class">
|
||||
<option value=""><?php _e('Standard Rate', 'woothemes'); ?></option>
|
||||
<?php
|
||||
if ($tax_classes) foreach ($tax_classes as $class) :
|
||||
echo '<option value="'.sanitize_title($class).'"';
|
||||
selected($rate['class'], sanitize_title($class));
|
||||
echo '>'.$class.'</option>';
|
||||
endforeach;
|
||||
?>
|
||||
</select>
|
||||
<input type="text" class="text" value="<?php echo $rate['rate']; ?>" name="tax_rate[<?php echo $i; ?>]" title="<?php _e('Rate', 'woothemes'); ?>" placeholder="<?php _e('Rate', 'woothemes'); ?>" maxlength="8" />%
|
||||
<label class="checkbox"><input type="checkbox" name="tax_shipping[<?php echo $i; ?>]" <?php if (isset($rate['shipping'])) checked($rate['shipping'], 'yes'); ?> /> <?php _e('Apply to shipping', 'woothemes'); ?></label><a href="#" class="remove button">×</a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</div>
|
||||
<p><a href="#" class="add button"><?php _e('+ Add Tax Rule', 'woothemes'); ?></a></p>
|
||||
</td>
|
||||
|
@ -794,25 +800,37 @@ function woocommerce_admin_fields($options) {
|
|||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
jQuery(function() {
|
||||
|
||||
jQuery(".country_multiselect").multiselect({
|
||||
noneSelectedText: '<?php _e('Select countries/states', 'woothemes'); ?>',
|
||||
selectedList: 4
|
||||
});
|
||||
|
||||
|
||||
jQuery('#tax_rates a.add').live('click', function(){
|
||||
var size = jQuery('.taxrows .taxrow').size();
|
||||
|
||||
// Add the row
|
||||
jQuery('<p class="taxrow"> \
|
||||
<select name="tax_class[' + size + ']" title="Tax Class"> \
|
||||
<option value=""><?php _e('Standard Rate', 'woothemes'); ?></option><?php
|
||||
$tax_classes = $_tax->get_tax_classes();
|
||||
if ($tax_classes) foreach ($tax_classes as $class) :
|
||||
echo '<option value="'.sanitize_title($class).'">'.$class.'</option>';
|
||||
endforeach;
|
||||
?></select><select name="tax_country[' + size + ']" title="Country"><?php
|
||||
woocommerce_countries::country_dropdown_options('','',true);
|
||||
?></select><input type="text" class="text" name="tax_rate[' + size + ']" title="<?php _e('Rate', 'woothemes'); ?>" placeholder="<?php _e('Rate', 'woothemes'); ?>" maxlength="8" />%\
|
||||
<label><input type="checkbox" name="tax_shipping[' + size + ']" /> <?php _e('Apply to shipping', 'woothemes'); ?></label>\
|
||||
<a href="#" class="remove button">×</a>\
|
||||
</p>').appendTo('#tax_rates div.taxrows');
|
||||
jQuery('<div class="taxrow">\
|
||||
<select name="tax_country[' + size + '][]" title="Country" class="country_multiselect" size="10" multiple="multiple"><?php echo woocommerce_countries::country_multiselect_options('',true); ?></select>\
|
||||
<select name="tax_class[' + size + ']" title="Tax Class"><option value=""><?php _e('Standard Rate', 'woothemes'); ?></option><?php
|
||||
if ($tax_classes) foreach ($tax_classes as $class) :
|
||||
echo '<option value="'.sanitize_title($class).'">'.$class.'</option>';
|
||||
endforeach;
|
||||
?></select>\
|
||||
<input type="text" class="text" name="tax_rate[' + size + ']" title="<?php _e('Rate', 'woothemes'); ?>" placeholder="<?php _e('Rate', 'woothemes'); ?>" maxlength="8" />% \
|
||||
<label class="checkbox"><input type="checkbox" name="tax_shipping[' + size + ']" checked="checked" /> <?php _e('Apply to shipping', 'woothemes'); ?></label><a href="#" class="remove button">×</a>\
|
||||
</div>').appendTo('#tax_rates div.taxrows');
|
||||
|
||||
// Multiselect
|
||||
jQuery(".country_multiselect").multiselect({
|
||||
noneSelectedText: '<?php _e('Select countries/states', 'woothemes'); ?>',
|
||||
selectedList: 4
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery('#tax_rates a.remove').live('click', function(){
|
||||
var answer = confirm("<?php _e('Delete this rule?', 'woothemes'); ?>");
|
||||
if (answer) {
|
||||
|
|
|
@ -382,28 +382,6 @@ ul.recent-orders li .pending {
|
|||
ul.recent-orders li .refunded, ul.recent-orders li .cancelled {
|
||||
color: #999;
|
||||
}
|
||||
#woocommmerce_dashboard_useful_links ul.links {
|
||||
float: left;
|
||||
width: 49%;
|
||||
}
|
||||
#woocommmerce_dashboard_useful_links .social {
|
||||
float: right;
|
||||
width: 49%;
|
||||
}
|
||||
#woocommmerce_dashboard_useful_links .social h4 {
|
||||
color: #999;
|
||||
}
|
||||
#woocommmerce_dashboard_useful_links .social h4.first {
|
||||
margin-top: 0;
|
||||
}
|
||||
#woocommmerce_dashboard_useful_links .social img {
|
||||
width: 49%;
|
||||
}
|
||||
#woocommmerce_dashboard_useful_links .social p {
|
||||
color: #ccc;
|
||||
line-height: 1.5em;
|
||||
font-style: italic;
|
||||
}
|
||||
#woocommmerce_dashboard_recent_reviews li {
|
||||
line-height: 1.5em;
|
||||
margin-bottom: 12px;
|
||||
|
@ -448,17 +426,20 @@ ul.recent-orders li .refunded, ul.recent-orders li .cancelled {
|
|||
.woocommerce table.shippingrows td a.remove {
|
||||
margin: 0 !important;
|
||||
}
|
||||
p.taxrow select {
|
||||
div.taxrows .taxrow {
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
div.taxrows .taxrow select {
|
||||
width: 125px;
|
||||
}
|
||||
p.taxrow input.text {
|
||||
div.taxrows .taxrow input.text {
|
||||
width: 60px;
|
||||
}
|
||||
p.taxrow label {
|
||||
div.taxrows .taxrow label.checkbox {
|
||||
line-height: 1.5em;
|
||||
margin: 0 8px;
|
||||
}
|
||||
p.taxrow label input {
|
||||
div.taxrows .taxrow label.checkbox input {
|
||||
margin: 0 4px 0 0;
|
||||
}
|
||||
.woocommerce table.widefat table.coupon_rows {
|
||||
|
@ -819,35 +800,35 @@ table.jCalendar td {
|
|||
}
|
||||
table.jCalendar td.other-month {
|
||||
background: #ddd;
|
||||
color: #aaa;
|
||||
color: #aaaaaa;
|
||||
}
|
||||
table.jCalendar td.today {
|
||||
background: #666;
|
||||
color: #fff;
|
||||
color: #ffffff;
|
||||
}
|
||||
table.jCalendar td.selected {
|
||||
background: #f66;
|
||||
color: #fff;
|
||||
color: #ffffff;
|
||||
}
|
||||
table.jCalendar td.selected.dp-hover {
|
||||
background: #f33;
|
||||
color: #fff;
|
||||
color: #ffffff;
|
||||
}
|
||||
table.jCalendar td.dp-hover, table.jCalendar tr.activeWeekHover td {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
color: #000000;
|
||||
}
|
||||
table.jCalendar tr.selectedWeek td {
|
||||
background: #f66;
|
||||
color: #fff;
|
||||
color: #ffffff;
|
||||
}
|
||||
table.jCalendar td.disabled, table.jCalendar td.disabled.dp-hover {
|
||||
background: #bbb;
|
||||
color: #888;
|
||||
color: #888888;
|
||||
}
|
||||
table.jCalendar td.unselectable, table.jCalendar td.unselectable:hover, table.jCalendar td.unselectable.dp-hover {
|
||||
background: #bbb;
|
||||
color: #888;
|
||||
color: #888888;
|
||||
}
|
||||
div.dp-popup {
|
||||
position: relative;
|
||||
|
@ -891,7 +872,6 @@ div.dp-popup div.dp-nav-prev {
|
|||
div.dp-popup div.dp-nav-prev a {
|
||||
float: left;
|
||||
}
|
||||
/* Opera needs the rules to be this specific otherwise it doesn't change the cursor back to pointer after you have disabled and re-enabled a link */
|
||||
div.dp-popup div.dp-nav-prev a, div.dp-popup div.dp-nav-next a {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -909,7 +889,7 @@ div.dp-popup div.dp-nav-next a {
|
|||
}
|
||||
div.dp-popup a.disabled {
|
||||
cursor: default;
|
||||
color: #aaa;
|
||||
color: #aaaaaa;
|
||||
}
|
||||
div.dp-popup td {
|
||||
cursor: pointer;
|
||||
|
@ -917,3 +897,96 @@ div.dp-popup td {
|
|||
div.dp-popup td.disabled {
|
||||
cursor: default;
|
||||
}
|
||||
/* Multiselect
|
||||
----------------------------------*/
|
||||
.ui-multiselect {
|
||||
padding: 3px 0 3px 4px;
|
||||
text-align: left;
|
||||
margin: 1px;
|
||||
vertical-align: middle;
|
||||
height: 24px;
|
||||
}
|
||||
.ui-multiselect span.ui-icon {
|
||||
float: right;
|
||||
}
|
||||
.ui-multiselect-single .ui-multiselect-checkboxes input {
|
||||
position: absolute !important;
|
||||
top: auto !important;
|
||||
left: -9999px;
|
||||
}
|
||||
.ui-multiselect-single .ui-multiselect-checkboxes label {
|
||||
padding: 5px !important;
|
||||
}
|
||||
.ui-multiselect-header {
|
||||
margin-bottom: 3px;
|
||||
padding: 3px 0 3px 4px;
|
||||
}
|
||||
.ui-multiselect-header ul {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.ui-multiselect-header ul li {
|
||||
float: left;
|
||||
padding: 0 10px 0 0;
|
||||
margin: 0;
|
||||
}
|
||||
.ui-multiselect-header a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.ui-multiselect-header a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.ui-multiselect-header span.ui-icon {
|
||||
float: left;
|
||||
}
|
||||
.ui-multiselect-header li.ui-multiselect-close {
|
||||
float: right;
|
||||
text-align: right;
|
||||
padding-right: 0;
|
||||
}
|
||||
.ui-multiselect-menu {
|
||||
display: none;
|
||||
padding: 3px;
|
||||
position: absolute;
|
||||
z-index: 10000;
|
||||
}
|
||||
.ui-multiselect-checkboxes {
|
||||
position: relative /* fixes bug in IE6/7 */;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.ui-multiselect-checkboxes label {
|
||||
cursor: default;
|
||||
display: block;
|
||||
border: 1px solid transparent;
|
||||
padding: 3px 1px;
|
||||
}
|
||||
.ui-multiselect-checkboxes label input {
|
||||
position: relative;
|
||||
top: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.ui-multiselect-checkboxes label span {
|
||||
padding-left: 4px;
|
||||
}
|
||||
.ui-multiselect-checkboxes li {
|
||||
clear: both;
|
||||
font-size: 0.9em;
|
||||
padding-right: 3px;
|
||||
}
|
||||
.ui-multiselect-checkboxes li.ui-multiselect-optgroup-label {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px solid;
|
||||
}
|
||||
.ui-multiselect-checkboxes li.ui-multiselect-optgroup-label a {
|
||||
display: block;
|
||||
padding: 3px;
|
||||
margin: 1px 0;
|
||||
text-decoration: none;
|
||||
}
|
||||
.ui-multiselect-checkboxes li.ui-multiselect-optgroup-last {
|
||||
border-bottom: 1px solid;
|
||||
}
|
||||
/* remove label borders in IE6 because IE6 does not support transparency */
|
||||
* html .ui-multiselect-checkboxes label {
|
||||
border: none;
|
||||
}
|
||||
|
|
|
@ -416,32 +416,6 @@ ul.recent-orders {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#woocommmerce_dashboard_useful_links {
|
||||
ul.links {
|
||||
float: left;
|
||||
width: 49%;
|
||||
}
|
||||
.social {
|
||||
float: right;
|
||||
width: 49%;
|
||||
h4 {
|
||||
color: #999;
|
||||
&.first {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
img {
|
||||
width: 49%;
|
||||
}
|
||||
p {
|
||||
color: #ccc;
|
||||
line-height: 1.5em;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#woocommmerce_dashboard_recent_reviews {
|
||||
li {
|
||||
line-height: 1.5em;
|
||||
|
@ -490,17 +464,22 @@ ul.recent-orders {
|
|||
margin: 0 !important;
|
||||
}
|
||||
|
||||
p.taxrow select {
|
||||
width: 125px;
|
||||
}
|
||||
p.taxrow input.text {
|
||||
width: 60px;
|
||||
}
|
||||
p.taxrow label {
|
||||
line-height: 1.5em;
|
||||
margin: 0 8px;
|
||||
input {
|
||||
margin: 0 4px 0 0;
|
||||
div.taxrows {
|
||||
.taxrow {
|
||||
padding-bottom: 8px;
|
||||
select {
|
||||
width: 125px;
|
||||
}
|
||||
input.text {
|
||||
width: 60px;
|
||||
}
|
||||
label.checkbox {
|
||||
line-height: 1.5em;
|
||||
margin: 0 8px;
|
||||
input {
|
||||
margin: 0 4px 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -530,8 +509,6 @@ p.taxrow label {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.woocommerce #tabs-wrap table a.remove {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
@ -855,127 +832,64 @@ img.tips {
|
|||
}
|
||||
|
||||
/* Datepicker */
|
||||
table.jCalendar {
|
||||
border: 1px solid #000;
|
||||
background: #aaa;
|
||||
border-collapse: separate;
|
||||
border-spacing: 2px;
|
||||
width: 190px;
|
||||
}
|
||||
table.jCalendar th {
|
||||
background: #333;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
padding: 3px 5px;
|
||||
}
|
||||
table.jCalendar{border:1px solid #000; background:#aaa; border-collapse:separate; border-spacing:2px; width:190px}
|
||||
table.jCalendar th{background:#333; color:#fff; font-weight:bold; padding:3px 5px}
|
||||
|
||||
table.jCalendar td {
|
||||
background: #ccc;
|
||||
color: #000;
|
||||
padding: 3px 5px;
|
||||
text-align: center;
|
||||
font-size: 10px !important;
|
||||
}
|
||||
table.jCalendar td.other-month {
|
||||
background: #ddd;
|
||||
color: #aaa;
|
||||
}
|
||||
table.jCalendar td.today {
|
||||
background: #666;
|
||||
color: #fff;
|
||||
}
|
||||
table.jCalendar td.selected {
|
||||
background: #f66;
|
||||
color: #fff;
|
||||
}
|
||||
table.jCalendar td.selected.dp-hover {
|
||||
background: #f33;
|
||||
color: #fff;
|
||||
}
|
||||
table.jCalendar td.dp-hover,
|
||||
table.jCalendar tr.activeWeekHover td {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
}
|
||||
table.jCalendar tr.selectedWeek td {
|
||||
background: #f66;
|
||||
color: #fff;
|
||||
}
|
||||
table.jCalendar td.disabled, table.jCalendar td.disabled.dp-hover {
|
||||
background: #bbb;
|
||||
color: #888;
|
||||
}
|
||||
table.jCalendar td.unselectable,
|
||||
table.jCalendar td.unselectable:hover,
|
||||
table.jCalendar td.unselectable.dp-hover {
|
||||
background: #bbb;
|
||||
color: #888;
|
||||
}
|
||||
div.dp-popup {
|
||||
position: relative;
|
||||
background: #ccc;
|
||||
font-size: 10px !important;
|
||||
font-family: arial, sans-serif;
|
||||
padding: 2px;
|
||||
width: 190px;
|
||||
line-height: 1.2em;
|
||||
}
|
||||
div#dp-popup {
|
||||
position: absolute;
|
||||
z-index: 199;
|
||||
}
|
||||
div.dp-popup h2 {
|
||||
font-size: 12px !important;
|
||||
text-align: center;
|
||||
margin: 2px 0;
|
||||
padding: 0;
|
||||
}
|
||||
a#dp-close {
|
||||
font-size: 11px !important;
|
||||
padding: 4px 0;
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
a#dp-close:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
div.dp-popup a {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
padding: 3px 2px 0;
|
||||
}
|
||||
div.dp-popup div.dp-nav-prev {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 4px;
|
||||
width: 100px;
|
||||
}
|
||||
div.dp-popup div.dp-nav-prev a {
|
||||
float: left;
|
||||
}
|
||||
/* Opera needs the rules to be this specific otherwise it doesn't change the cursor back to pointer after you have disabled and re-enabled a link */
|
||||
div.dp-popup div.dp-nav-prev a, div.dp-popup div.dp-nav-next a {
|
||||
cursor: pointer;
|
||||
}
|
||||
div.dp-popup div.dp-nav-prev a.disabled, div.dp-popup div.dp-nav-next a.disabled {
|
||||
cursor: default;
|
||||
}
|
||||
div.dp-popup div.dp-nav-next {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
right: 4px;
|
||||
width: 100px;
|
||||
}
|
||||
div.dp-popup div.dp-nav-next a {
|
||||
float: right;
|
||||
}
|
||||
div.dp-popup a.disabled {
|
||||
cursor: default;
|
||||
color: #aaa;
|
||||
}
|
||||
div.dp-popup td {
|
||||
cursor: pointer;
|
||||
}
|
||||
div.dp-popup td.disabled {
|
||||
cursor: default;
|
||||
}
|
||||
table.jCalendar td{background:#ccc; color:#000; padding:3px 5px; text-align:center; font-size:10px !important}
|
||||
table.jCalendar td.other-month{background:#ddd; color:#aaa}
|
||||
table.jCalendar td.today{background:#666; color:#fff}
|
||||
table.jCalendar td.selected{background:#f66; color:#fff}
|
||||
table.jCalendar td.selected.dp-hover{background:#f33; color:#fff}
|
||||
table.jCalendar td.dp-hover,
|
||||
table.jCalendar tr.activeWeekHover td{background:#fff; color:#000}
|
||||
table.jCalendar tr.selectedWeek td{background:#f66; color:#fff}
|
||||
table.jCalendar td.disabled, table.jCalendar td.disabled.dp-hover{background:#bbb; color:#888}
|
||||
table.jCalendar td.unselectable,
|
||||
table.jCalendar td.unselectable:hover,
|
||||
table.jCalendar td.unselectable.dp-hover{background:#bbb; color:#888}
|
||||
div.dp-popup{position:relative; background:#ccc; font-size:10px !important; font-family:arial,sans-serif; padding:2px; width:190px; line-height:1.2em}
|
||||
div#dp-popup{position:absolute; z-index:199}
|
||||
div.dp-popup h2{font-size:12px !important; text-align:center; margin:2px 0; padding:0}
|
||||
a#dp-close{font-size:11px !important; padding:4px 0; text-align:center; display:block}
|
||||
a#dp-close:hover{text-decoration:underline}
|
||||
div.dp-popup a{color:#000; text-decoration:none; padding:3px 2px 0}
|
||||
div.dp-popup div.dp-nav-prev{position:absolute; top:2px; left:4px; width:100px}
|
||||
div.dp-popup div.dp-nav-prev a{float:left}
|
||||
|
||||
div.dp-popup div.dp-nav-prev a, div.dp-popup div.dp-nav-next a{cursor:pointer}
|
||||
div.dp-popup div.dp-nav-prev a.disabled, div.dp-popup div.dp-nav-next a.disabled{cursor:default}
|
||||
div.dp-popup div.dp-nav-next{position:absolute; top:2px; right:4px; width:100px}
|
||||
div.dp-popup div.dp-nav-next a{float:right}
|
||||
div.dp-popup a.disabled{cursor:default; color:#aaa}
|
||||
div.dp-popup td{cursor:pointer}
|
||||
div.dp-popup td.disabled{cursor:default}
|
||||
|
||||
/* Multiselect
|
||||
----------------------------------*/
|
||||
.ui-multiselect { padding:3px 0 3px 4px; text-align:left; margin: 1px; vertical-align: middle; height: 24px; }
|
||||
.ui-multiselect span.ui-icon { float:right }
|
||||
.ui-multiselect-single .ui-multiselect-checkboxes input { position:absolute !important; top: auto !important; left:-9999px; }
|
||||
.ui-multiselect-single .ui-multiselect-checkboxes label { padding:5px !important; }
|
||||
|
||||
|
||||
.ui-multiselect-header { margin-bottom:3px; padding:3px 0 3px 4px }
|
||||
.ui-multiselect-header ul { font-size:0.9em }
|
||||
.ui-multiselect-header ul li { float:left; padding:0 10px 0 0; margin: 0; }
|
||||
.ui-multiselect-header a { text-decoration:none }
|
||||
.ui-multiselect-header a:hover { text-decoration:underline }
|
||||
.ui-multiselect-header span.ui-icon { float:left }
|
||||
.ui-multiselect-header li.ui-multiselect-close { float:right; text-align:right; padding-right:0 }
|
||||
|
||||
.ui-multiselect-menu { display:none; padding:3px; position:absolute; z-index:10000 }
|
||||
.ui-multiselect-checkboxes { position:relative /* fixes bug in IE6/7 */; overflow-y:scroll }
|
||||
.ui-multiselect-checkboxes label { cursor:default; display:block; border:1px solid transparent; padding:3px 1px; }
|
||||
.ui-multiselect-checkboxes label input { position:relative; top:0; vertical-align: middle; }
|
||||
.ui-multiselect-checkboxes label span { padding-left: 4px; }
|
||||
.ui-multiselect-checkboxes li { clear:both; font-size:0.9em; padding-right:3px }
|
||||
.ui-multiselect-checkboxes li.ui-multiselect-optgroup-label { text-align:center; font-weight:bold; border-bottom:1px solid }
|
||||
.ui-multiselect-checkboxes li.ui-multiselect-optgroup-label a { display:block; padding:3px; margin:1px 0; text-decoration:none }
|
||||
|
||||
.ui-multiselect-checkboxes li.ui-multiselect-optgroup-last { border-bottom:1px solid }
|
||||
|
||||
/* remove label borders in IE6 because IE6 does not support transparency */
|
||||
* html .ui-multiselect-checkboxes label { border:none }
|
|
@ -1,3 +1,52 @@
|
|||
/*
|
||||
* jQuery MultiSelect UI Widget 1.11pre
|
||||
* Copyright (c) 2011 Eric Hynds
|
||||
*
|
||||
* http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
|
||||
*
|
||||
* Depends:
|
||||
* - jQuery 1.4.2+
|
||||
* - jQuery UI 1.8 widget factory
|
||||
*
|
||||
* Optional:
|
||||
* - jQuery UI effects
|
||||
* - jQuery UI position utility
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
(function($,undefined){var multiselectID=0;$.widget("ech.multiselect",{options:{header:true,height:175,minWidth:225,classes:'',checkAllText:'Check all',uncheckAllText:'Uncheck all',noneSelectedText:'Select options',selectedText:'# selected',selectedList:0,show:'',hide:'',autoOpen:false,multiple:true,position:{}},_create:function(){var el=this.element.hide(),o=this.options;this.speed=$.fx.speeds._default;this._isOpen=false;var
|
||||
button=(this.button=$('<button type="button"><span class="ui-icon ui-icon-triangle-2-n-s"></span></button>')).addClass('ui-multiselect ui-widget ui-state-default ui-corner-all').addClass(o.classes).attr({'title':el.attr('title'),'aria-haspopup':true,'tabIndex':el.attr('tabIndex')}).insertAfter(el),buttonlabel=(this.buttonlabel=$('<span />')).html(o.noneSelectedText).appendTo(button),menu=(this.menu=$('<div />')).addClass('ui-multiselect-menu ui-widget ui-widget-content ui-corner-all').addClass(o.classes).insertAfter(button),header=(this.header=$('<div />')).addClass('ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix').appendTo(menu),headerLinkContainer=(this.headerLinkContainer=$('<ul />')).addClass('ui-helper-reset').html(function(){if(o.header===true){return'<li><a class="ui-multiselect-all" href="#"><span class="ui-icon ui-icon-check"></span><span>'+o.checkAllText+'</span></a></li><li><a class="ui-multiselect-none" href="#"><span class="ui-icon ui-icon-closethick"></span><span>'+o.uncheckAllText+'</span></a></li>';}else if(typeof o.header==="string"){return'<li>'+o.header+'</li>';}else{return'';}}).append('<li class="ui-multiselect-close"><a href="#" class="ui-multiselect-close"><span class="ui-icon ui-icon-circle-close"></span></a></li>').appendTo(header),checkboxContainer=(this.checkboxContainer=$('<ul />')).addClass('ui-multiselect-checkboxes ui-helper-reset').appendTo(menu);this._bindEvents();this.refresh(true);if(!o.multiple){menu.addClass('ui-multiselect-single');}},_init:function(){if(this.options.header===false){this.header.hide();}
|
||||
if(!this.options.multiple){this.headerLinkContainer.find('.ui-multiselect-all, .ui-multiselect-none').hide();}
|
||||
if(this.options.autoOpen){this.open();}
|
||||
if(this.element.is(':disabled')){this.disable();}},refresh:function(init){var el=this.element,o=this.options,menu=this.menu,checkboxContainer=this.checkboxContainer,optgroups=[],html=[],id=el.attr('id')||multiselectID++;this.element.find('option').each(function(i){var $this=$(this),parent=this.parentNode,title=this.innerHTML,description=this.title,value=this.value,inputID=this.id||'ui-multiselect-'+id+'-option-'+i,isDisabled=this.disabled,isSelected=this.selected,labelClasses=['ui-corner-all'],optLabel;if(parent.tagName.toLowerCase()==='optgroup'){optLabel=parent.getAttribute('label');if($.inArray(optLabel,optgroups)===-1){html.push('<li class="ui-multiselect-optgroup-label"><a href="#">'+optLabel+'</a></li>');optgroups.push(optLabel);}}
|
||||
if(isDisabled){labelClasses.push('ui-state-disabled');}
|
||||
if(isSelected&&!o.multiple){labelClasses.push('ui-state-active');}
|
||||
html.push('<li class="'+(isDisabled?'ui-multiselect-disabled':'')+'">');html.push('<label for="'+inputID+'" title="'+description+'" class="'+labelClasses.join(' ')+'">');html.push('<input id="'+inputID+'" name="multiselect_'+id+'" type="'+(o.multiple?"checkbox":"radio")+'" value="'+value+'" title="'+title+'"');if(isSelected){html.push(' checked="checked"');html.push(' aria-selected="true"');}
|
||||
if(isDisabled){html.push(' disabled="disabled"');html.push(' aria-disabled="true"');}
|
||||
html.push(' /><span>'+title+'</span></label></li>');if(parent.tagName.toLowerCase()==='optgroup'){var $next_parent=$this.next('option').parent();if(!$next_parent.is('optgroup')){html.push('<li class="ui-multiselect-optgroup-last"></li>');}}});checkboxContainer.html(html.join(''));this.labels=menu.find('label');this._setButtonWidth();this._setMenuWidth();this.button[0].defaultValue=this.update();if(!init){this._trigger('refresh');}},update:function(){var o=this.options,$inputs=this.labels.find('input'),$checked=$inputs.filter(':checked'),numChecked=$checked.length,value;if(numChecked===0){value=o.noneSelectedText;}else{if($.isFunction(o.selectedText)){value=o.selectedText.call(this,numChecked,$inputs.length,$checked.get());}else if(/\d/.test(o.selectedList)&&o.selectedList>0&&numChecked<=o.selectedList){value=$checked.map(function(){return this.title;}).get().join(', ');}else{value=o.selectedText.replace('#',numChecked).replace('#',$inputs.length);}}
|
||||
this.buttonlabel.html(value);return value;},_bindEvents:function(){var self=this,button=this.button;function clickHandler(){self[self._isOpen?'close':'open']();return false;}
|
||||
button.find('span').bind('click.multiselect',clickHandler);button.bind({click:clickHandler,keypress:function(e){switch(e.which){case 27:case 38:case 37:self.close();break;case 39:case 40:self.open();break;}},mouseenter:function(){if(!button.hasClass('ui-state-disabled')){$(this).addClass('ui-state-hover');}},mouseleave:function(){$(this).removeClass('ui-state-hover');},focus:function(){if(!button.hasClass('ui-state-disabled')){$(this).addClass('ui-state-focus');}},blur:function(){$(this).removeClass('ui-state-focus');}});this.header.delegate('a','click.multiselect',function(e){if($(this).hasClass('ui-multiselect-close')){self.close();}else{self[$(this).hasClass('ui-multiselect-all')?'checkAll':'uncheckAll']();}
|
||||
e.preventDefault();});this.menu.delegate('li.ui-multiselect-optgroup-label a','click.multiselect',function(e){e.preventDefault();var $this=$(this),$inputs=$this.parent().nextUntil('li.ui-multiselect-optgroup-label, li.ui-multiselect-optgroup-last').find('input:visible:not(:disabled)'),nodes=$inputs.get(),label=$this.parent().text();if(self._trigger('beforeoptgrouptoggle',e,{inputs:nodes,label:label})===false){return;}
|
||||
self._toggleChecked($inputs.filter(':checked').length!==$inputs.length,$inputs);self._trigger('optgrouptoggle',e,{inputs:nodes,label:label,checked:nodes[0].checked});}).delegate('label','mouseenter.multiselect',function(){if(!$(this).hasClass('ui-state-disabled')){self.labels.removeClass('ui-state-hover');$(this).addClass('ui-state-hover').find('input').focus();}}).delegate('label','keydown.multiselect',function(e){e.preventDefault();switch(e.which){case 9:case 27:self.close();break;case 38:case 40:case 37:case 39:self._traverse(e.which,this);break;case 13:$(this).find('input')[0].click();break;}}).delegate('input[type="checkbox"], input[type="radio"]','click.multiselect',function(e){var $this=$(this),val=this.value,checked=this.checked,tags=self.element.find('option');if(this.disabled||self._trigger('click',e,{value:val,text:this.title,checked:checked})===false){e.preventDefault();return;}
|
||||
$this.attr('aria-selected',checked);tags.each(function(){if(this.value===val){this.selected=checked;if(checked){this.setAttribute('selected','selected');}else{this.removeAttribute('selected');}}else if(!self.options.multiple){this.selected=false;}});if(!self.options.multiple){self.labels.removeClass('ui-state-active');$this.closest('label').toggleClass('ui-state-active',checked);self.close();}
|
||||
self.element.trigger("change");setTimeout($.proxy(self.update,self),10);});$(document).bind('mousedown.multiselect',function(e){if(self._isOpen&&!$.contains(self.menu[0],e.target)&&!$.contains(self.button[0],e.target)&&e.target!==self.button[0]){self.close();}});$(this.element[0].form).bind('reset.multiselect',function(){setTimeout(function(){self.update();},10);});},_setButtonWidth:function(){var width=this.element.outerWidth(),o=this.options;if(/\d/.test(o.minWidth)&&width<o.minWidth){width=o.minWidth;}
|
||||
this.button.width(width);},_setMenuWidth:function(){var m=this.menu,width=this.button.outerWidth()-
|
||||
parseInt(m.css('padding-left'),10)-
|
||||
parseInt(m.css('padding-right'),10)-
|
||||
parseInt(m.css('border-right-width'),10)-
|
||||
parseInt(m.css('border-left-width'),10);m.width(width||this.button.outerWidth());},_traverse:function(which,start){var $start=$(start),moveToLast=which===38||which===37,$next=$start.parent()[moveToLast?'prevAll':'nextAll']('li:not(.ui-multiselect-disabled, .ui-multiselect-optgroup-label)')[moveToLast?'last':'first']();if(!$next.length){var $container=this.menu.find('ul:last');this.menu.find('label')[moveToLast?'last':'first']().trigger('mouseover');$container.scrollTop(moveToLast?$container.height():0);}else{$next.find('label').trigger('mouseover');}},_toggleCheckbox:function(prop,flag){return function(){!this.disabled&&(this[prop]=flag);if(flag){this.setAttribute('aria-selected',true);}else{this.removeAttribute('aria-selected');}}},_toggleChecked:function(flag,group){var $inputs=(group&&group.length)?group:this.labels.find('input'),self=this;$inputs.each(this._toggleCheckbox('checked',flag));this.update();var values=$inputs.map(function(){return this.value;}).get();this.element.find('option').each(function(){if(!this.disabled&&$.inArray(this.value,values)>-1){self._toggleCheckbox('selected',flag).call(this);}});if($inputs.length){this.element.trigger("change");}},_toggleDisabled:function(flag){this.button.attr({'disabled':flag,'aria-disabled':flag})[flag?'addClass':'removeClass']('ui-state-disabled');this.menu.find('input').attr({'disabled':flag,'aria-disabled':flag}).parent()[flag?'addClass':'removeClass']('ui-state-disabled');this.element.attr({'disabled':flag,'aria-disabled':flag});},open:function(e){var self=this,button=this.button,menu=this.menu,speed=this.speed,o=this.options;if(this._trigger('beforeopen')===false||button.hasClass('ui-state-disabled')||this._isOpen){return;}
|
||||
var $container=menu.find('ul:last'),effect=o.show,pos=button.position();if($.isArray(o.show)){effect=o.show[0];speed=o.show[1]||self.speed;}
|
||||
$container.scrollTop(0).height(o.height);if($.ui.position&&!$.isEmptyObject(o.position)){o.position.of=o.position.of||button;menu.show().position(o.position).hide().show(effect,speed);}else{menu.css({top:pos.top+button.outerHeight(),left:pos.left}).show(effect,speed);}
|
||||
this.labels.eq(0).trigger('mouseover').trigger('mouseenter').find('input').trigger('focus');button.addClass('ui-state-active');this._isOpen=true;this._trigger('open');},close:function(){if(this._trigger('beforeclose')===false){return;}
|
||||
var o=this.options,effect=o.hide,speed=this.speed;if($.isArray(o.hide)){effect=o.hide[0];speed=o.hide[1]||this.speed;}
|
||||
this.menu.hide(effect,speed);this.button.removeClass('ui-state-active').trigger('blur').trigger('mouseleave');this._isOpen=false;this._trigger('close');},enable:function(){this._toggleDisabled(false);},disable:function(){this._toggleDisabled(true);},checkAll:function(e){this._toggleChecked(true);this._trigger('checkAll');},uncheckAll:function(){this._toggleChecked(false);this._trigger('uncheckAll');},getChecked:function(){return this.menu.find('input').filter(':checked');},destroy:function(){$.Widget.prototype.destroy.call(this);this.button.remove();this.menu.remove();this.element.show();return this;},isOpen:function(){return this._isOpen;},widget:function(){return this.menu;},_setOption:function(key,value){var menu=this.menu;switch(key){case'header':menu.find('div.ui-multiselect-header')[value?'show':'hide']();break;case'checkAllText':menu.find('a.ui-multiselect-all span').eq(-1).text(value);break;case'uncheckAllText':menu.find('a.ui-multiselect-none span').eq(-1).text(value);break;case'height':menu.find('ul:last').height(parseInt(value,10));break;case'minWidth':this.options[key]=parseInt(value,10);this._setButtonWidth();this._setMenuWidth();break;case'selectedText':case'selectedList':case'noneSelectedText':this.options[key]=value;this.update();break;case'classes':menu.add(this.button).removeClass(this.options.classes).addClass(value);break;}
|
||||
$.Widget.prototype._setOption.apply(this,arguments);}});})(jQuery);
|
||||
|
||||
|
||||
/*!
|
||||
jQuery blockUI plugin
|
||||
Version 2.37 (29-JAN-2011)
|
||||
|
|
|
@ -552,9 +552,9 @@ class woocommerce_countries {
|
|||
if ( $countries ) foreach ( $countries as $key=>$value) :
|
||||
if ( $states = self::get_states($key) ) :
|
||||
echo '<optgroup label="'.$value.'">';
|
||||
echo '<option value="'.$key.'"';
|
||||
/*echo '<option value="'.$key.'"';
|
||||
if ($selected_country==$key && $selected_state=='*') echo ' selected="selected"';
|
||||
echo '>'.$value.' — '.__('All states', 'woothemes').'</option>';
|
||||
echo '>'.$value.' — '.__('All states', 'woothemes').'</option>';*/
|
||||
foreach ($states as $state_key=>$state_value) :
|
||||
echo '<option value="'.$key.':'.$state_key.'"';
|
||||
|
||||
|
@ -570,5 +570,32 @@ class woocommerce_countries {
|
|||
endif;
|
||||
endforeach;
|
||||
}
|
||||
|
||||
/** Outputs the list of countries and states for use in multiselect boxes */
|
||||
function country_multiselect_options( $selected_countries = '', $escape=false ) {
|
||||
|
||||
$countries = self::$countries;
|
||||
asort($countries);
|
||||
|
||||
if ( $countries ) foreach ( $countries as $key=>$value) :
|
||||
if ( $states = self::get_states($key) ) :
|
||||
echo '<optgroup label="'.$value.'">';
|
||||
foreach ($states as $state_key=>$state_value) :
|
||||
echo '<option value="'.$key.':'.$state_key.'"';
|
||||
|
||||
if (isset($selected_countries[$key]) && in_array($state_key, $selected_countries[$key])) echo ' selected="selected"';
|
||||
|
||||
echo '>' . ($escape ? esc_js($state_value) : $state_value) .'</option>';
|
||||
endforeach;
|
||||
echo '</optgroup>';
|
||||
else :
|
||||
echo '<option';
|
||||
|
||||
if (isset($selected_countries[$key]) && in_array('*', $selected_countries[$key])) echo ' selected="selected"';
|
||||
|
||||
echo ' value="'.$key.'">'. ($escape ? esc_js( __($value, 'woothemes') ) : __($value, 'woothemes') ) .'</option>';
|
||||
endif;
|
||||
endforeach;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,12 +47,23 @@ class woocommerce_tax {
|
|||
$tax_rates = get_option('woocommerce_tax_rates');
|
||||
$tax_rates_array = array();
|
||||
if ($tax_rates && is_array($tax_rates) && sizeof($tax_rates)>0) foreach( $tax_rates as $rate ) :
|
||||
if ($rate['class']) :
|
||||
$tax_rates_array[$rate['country']][$rate['state']][$rate['class']] = array( 'rate' => $rate['rate'], 'shipping' => $rate['shipping'] );
|
||||
else :
|
||||
// Standard Rate
|
||||
$tax_rates_array[$rate['country']][$rate['state']]['*'] = $rate['rate'] = array( 'rate' => $rate['rate'], 'shipping' => $rate['shipping'] );
|
||||
endif;
|
||||
|
||||
// Standard Rate?
|
||||
if (!$rate['class']) $rate['class'] = '*';
|
||||
|
||||
// Add entry for each country
|
||||
if ($rate['countries']) foreach ($rate['countries'] as $country => $states) :
|
||||
|
||||
if ($states) :
|
||||
foreach ($states as $state) :
|
||||
|
||||
$tax_rates_array[$country][$state][$rate['class']] = array( 'rate' => $rate['rate'], 'shipping' => $rate['shipping'] );
|
||||
|
||||
endforeach;
|
||||
endif;
|
||||
|
||||
endforeach;
|
||||
|
||||
endforeach;
|
||||
return $tax_rates_array;
|
||||
}
|
||||
|
@ -238,7 +249,6 @@ class woocommerce_tax {
|
|||
|
||||
// Round to the nearest pence
|
||||
$tax_amount = round($tax_amount);
|
||||
|
||||
$tax_amount = $tax_amount / 100; // Back to pounds
|
||||
|
||||
//return number_format($tax_amount, 4, '.', '');
|
||||
|
@ -255,7 +265,6 @@ class woocommerce_tax {
|
|||
function calc_shipping_tax( $price, $rate ) {
|
||||
|
||||
$rate = round($rate, 4);
|
||||
|
||||
$tax_amount = $price * ($rate/100);
|
||||
|
||||
return round($tax_amount, 2);
|
||||
|
|
|
@ -171,6 +171,7 @@ function woocommerce_init() {
|
|||
if (is_admin()) :
|
||||
wp_register_style('woocommerce_admin_styles', woocommerce::plugin_url() . '/assets/css/admin.css');
|
||||
wp_enqueue_style('woocommerce_admin_styles');
|
||||
wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
|
||||
else :
|
||||
wp_register_style( 'woocommerce_fancybox_styles', woocommerce::plugin_url() . '/assets/css/fancybox.css' );
|
||||
wp_register_style( 'jqueryui_styles', woocommerce::plugin_url() . '/assets/css/ui.css' );
|
||||
|
@ -183,7 +184,7 @@ function woocommerce_init() {
|
|||
|
||||
function woocommerce_admin_scripts() {
|
||||
|
||||
wp_register_script( 'woocommerce_admin', woocommerce::plugin_url() . '/assets/js/woocommerce_admin.js', 'jquery', '1.0' );
|
||||
wp_register_script( 'woocommerce_admin', woocommerce::plugin_url() . '/assets/js/woocommerce_admin.js', array('jquery', 'jquery-ui-widget'), '1.0' );
|
||||
wp_enqueue_script('woocommerce_admin');
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue