Version Description
- , . ., , - , - .
Download this release
Release Info
Developer | Saphali |
Plugin | Saphali Woocommerce Russian |
Version | 1.7.0 |
Comparing to | |
See all releases |
Code changes from version 1.6.6 to 1.7.0
- readme.txt +4 -1
- saphali-woocommerce-lite.php +285 -36
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Donate link: https://money.yandex.ru/to/410011651211340
|
|
6 |
Tags: woocommerce, woo commerce russian, russian ruble, ukrainian hryvnia, mod, manadger filds checkout
|
7 |
Requires at least: WP 3.3 or higher & WooCommerce 1.6.6 or higher
|
8 |
Tested up to: 4.7
|
9 |
-
Stable tag: 1.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -72,6 +72,9 @@ define('SAPHALI_LITE_SYMBOL', 0 );
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
75 |
= 1.6.6 =
|
76 |
* Исправлен учет публикации в настройках плагина в версии WC 3.x.x.
|
77 |
|
6 |
Tags: woocommerce, woo commerce russian, russian ruble, ukrainian hryvnia, mod, manadger filds checkout
|
7 |
Requires at least: WP 3.3 or higher & WooCommerce 1.6.6 or higher
|
8 |
Tested up to: 4.7
|
9 |
+
Stable tag: 1.7.0
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
72 |
|
73 |
== Changelog ==
|
74 |
|
75 |
+
= 1.7.0 =
|
76 |
+
* Добавлен функционал, который позволяет соотнести поле к методам оплаты. Напр., будет полезно, если некоторые поля не требуется выводить при оплате каким-то методом оплаты, но нужны при оплате через какой-то другой.
|
77 |
+
|
78 |
= 1.6.6 =
|
79 |
* Исправлен учет публикации в настройках плагина в версии WC 3.x.x.
|
80 |
|
saphali-woocommerce-lite.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Saphali Woocommerce Russian
|
4 |
Plugin URI: http://saphali.com/saphali-woocommerce-plugin-wordpress
|
5 |
Description: Saphali Woocommerce Russian - это бесплатный вордпресс плагин, который добавляет набор дополнений к интернет-магазину на Woocommerce.
|
6 |
-
Version: 1.
|
7 |
Author: Saphali
|
8 |
Author URI: http://saphali.com/
|
9 |
Text Domain: saphali-woocommerce-lite
|
@@ -34,10 +34,11 @@ Domain Path: /languages
|
|
34 |
|
35 |
// Подключение валюты и локализации
|
36 |
define('SAPHALI_PLUGIN_DIR_URL',plugin_dir_url(__FILE__));
|
37 |
-
define('SAPHALI_LITE_VERSION', '1.
|
38 |
define('SAPHALI_PLUGIN_DIR_PATH',plugin_dir_path(__FILE__));
|
39 |
class saphali_lite {
|
40 |
var $email_order_id;
|
|
|
41 |
var $column_count_saphali;
|
42 |
function __construct() {
|
43 |
if ( version_compare( WOOCOMMERCE_VERSION, '2.2.0', '<' ) || version_compare( WOOCOMMERCE_VERSION, '2.5.0', '>' ) )
|
@@ -96,6 +97,173 @@ Domain Path: /languages
|
|
96 |
add_filter( 'woocommerce_admin_billing_fields', array($this,'woocommerce_admin_billing_fields'), 10, 1 );
|
97 |
add_filter( 'woocommerce_admin_shipping_fields', array($this,'woocommerce_admin_shipping_fields'), 10, 1 );
|
98 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
function formatted_billing_address($address, $order) {
|
101 |
$billing_data = $this->woocommerce_get_customer_meta_fields_saphali();
|
@@ -588,8 +756,8 @@ Domain Path: /languages
|
|
588 |
unset($filds_finish_filter["order"][$v_filt]);
|
589 |
}
|
590 |
}
|
591 |
-
|
592 |
-
|
593 |
foreach($filds_finish_filter['billing'] as $k_f => $v_f) {
|
594 |
$new_key = str_replace('billing_', '' , $k_f);
|
595 |
if(in_array($new_key, array('country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' ) ))
|
@@ -622,9 +790,9 @@ Domain Path: /languages
|
|
622 |
<th width="130px">Класс поля<img class="help_tip" data-tip="<h3 style='margin:0;padding:0'>Задает стиль текущего поля</h3><ul style='text-align: left;'><li><span style='color: #000'>form-row-first</span> – первый в строке;</li><li><span style='color: #000'>form-row-last</span> – последний в строке.</li></ul><hr /><span style='color: #000'>ЕСЛИ ОСТАВИТЬ ПУСТЫМ</span>, то поле будет отображаться на всю ширину. Соответственно, в предыдущем поле (которое выше) нужно отметить «Clear»." src="<?php bloginfo('wpurl');?>/wp-content/plugins/woocommerce/assets/images/help.png" /></th>
|
623 |
<th width="40px">Тип поля</th>
|
624 |
<th width="40px">Обя­за­те­ль­ное</th>
|
625 |
-
|
626 |
<th width="40px">Опу­бли­ко­вать</th>
|
627 |
-
|
628 |
<th width="65px">Удалить/До­ба­вить</th>
|
629 |
</tr>
|
630 |
</thead>
|
@@ -636,11 +804,11 @@ Domain Path: /languages
|
|
636 |
<th width="35px">Clear<img class="help_tip" data-tip="Указывает на то, что следующее поле за текущим, будет начинаться с новой строки." src="<?php bloginfo('wpurl');?>/wp-content/plugins/woocommerce/assets/images/help.png" /> </th>
|
637 |
<th>Класс поля</th>
|
638 |
<th width="40px">Тип поля</th>
|
639 |
-
|
640 |
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
</tr>
|
645 |
</tfoot>
|
646 |
<tbody id="the-list" class="myTable">
|
@@ -653,10 +821,24 @@ Domain Path: /languages
|
|
653 |
if( isset($checkout_fields["billing"]) && is_array($checkout_fields["billing"])) $f->checkout_fields["billing"] = $checkout_fields["billing"];
|
654 |
if( isset($f) )
|
655 |
foreach($f->checkout_fields["billing"] as $key => $value) {
|
|
|
656 |
$public = 'public';
|
657 |
if( !version_compare( WOOCOMMERCE_VERSION, '3.0', '<' ) ) {
|
658 |
if( isset( $checkout_fields["billing"][$key] ) ) $value[$public] = $checkout_fields["billing"][$key][$public];
|
659 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
660 |
|
661 |
if(empty($value[$public]) && !is_array($checkout_fields["billing"])) $value[$public] = true;
|
662 |
?>
|
@@ -687,6 +869,17 @@ Domain Path: /languages
|
|
687 |
</td>
|
688 |
<td><input <?php if( isset($value['required'] ) && $value['required']) echo 'checked'?> type="checkbox" name="billing[<?php echo $key?>][required]" /></td>
|
689 |
<td><input <?php if(isset($value[$public]) && $value[$public]) echo 'checked';?> type="checkbox" name="billing[<?php echo $key?>][<?php echo $public; ?>]" /></td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
690 |
|
691 |
<td><input rel="sort_order" id="order_count" type="hidden" name="billing[<?php echo $key?>][order]" value="<?php echo $count?>" />
|
692 |
<input type="button" class="button" id="billing_delete" value="Удалить -"/></td>
|
@@ -702,9 +895,10 @@ Domain Path: /languages
|
|
702 |
<td></td>
|
703 |
<td></td>
|
704 |
|
|
|
705 |
<td></td>
|
706 |
|
707 |
-
<td><input type="button" class="button" id="billing" value="Добавить +"/></td>
|
708 |
</tr>
|
709 |
</tbody>
|
710 |
</table>
|
@@ -721,7 +915,7 @@ Domain Path: /languages
|
|
721 |
<th width="40px">Обя­за­те­ль­ное</th>
|
722 |
|
723 |
<th width="40px">Опу­бли­ко­вать</th>
|
724 |
-
|
725 |
<th width="65px">Удалить/До­ба­вить</th>
|
726 |
</tr>
|
727 |
</thead>
|
@@ -735,7 +929,7 @@ Domain Path: /languages
|
|
735 |
<th width="40px">Обя­за­те­ль­ное</th>
|
736 |
|
737 |
<th width="40px">Опу­бли­ко­вать</th>
|
738 |
-
|
739 |
<th>Удалить/До­ба­вить</th>
|
740 |
</tr>
|
741 |
</tfoot>
|
@@ -748,6 +942,19 @@ Domain Path: /languages
|
|
748 |
if( ! version_compare( WOOCOMMERCE_VERSION, '3.0', '<' ) ) {
|
749 |
if( isset( $checkout_fields["shipping"][$key] ) ) $value[$public] = $checkout_fields["shipping"][$key][$public];
|
750 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
751 |
if( empty($value['public']) && !is_array($checkout_fields["shipping"]) ) $value['public'] = true;
|
752 |
?>
|
753 |
<tr>
|
@@ -762,6 +969,17 @@ Domain Path: /languages
|
|
762 |
} ?></td>
|
763 |
<td><input <?php if(isset($value['required']) && $value['required']) echo 'checked'?> type="checkbox" name="shipping[<?php echo $key?>][required]" /></td>
|
764 |
<td><input <?php if(isset($value['public']) && $value['public']) echo 'checked';?> type="checkbox" name="shipping[<?php echo $key?>][public]" /></td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
765 |
|
766 |
<td><input rel="sort_order" id="order_count" type="hidden" name="shipping[<?php echo $key?>][order]" value="<?php echo $count?>" /><input type="button" class="button" id="billing_delete" value="Удалить -"/>
|
767 |
<?php
|
@@ -779,13 +997,12 @@ Domain Path: /languages
|
|
779 |
<td></td>
|
780 |
<td></td>
|
781 |
<td></td>
|
782 |
-
|
783 |
<td></td>
|
|
|
784 |
<td></td>
|
785 |
<td></td>
|
786 |
<td></td>
|
787 |
-
|
788 |
-
<td><input type="button" class="button" id="shipping" value="Добавить +"/></td>
|
789 |
</tr>
|
790 |
|
791 |
</tbody>
|
@@ -801,7 +1018,6 @@ Domain Path: /languages
|
|
801 |
<th width="130px">Класс поля</th>
|
802 |
<th width="130px">Тип поля</th>
|
803 |
<th width="40px">Опу­бли­ко­вать</th>
|
804 |
-
|
805 |
<th width="65px">Удалить/До­ба­вить</th>
|
806 |
</tr>
|
807 |
</thead>
|
@@ -813,7 +1029,6 @@ Domain Path: /languages
|
|
813 |
<th>Класс поля</th>
|
814 |
<th>Тип поля</th>
|
815 |
<th width="40px">Опу­бли­ко­вать</th>
|
816 |
-
|
817 |
<th>Удалить/До­ба­вить</th>
|
818 |
</tr>
|
819 |
</tfoot>
|
@@ -878,7 +1093,7 @@ Domain Path: /languages
|
|
878 |
background:none repeat scroll 0 0 #EAEAEA !important;
|
879 |
color:#636060 !important;
|
880 |
}
|
881 |
-
|
882 |
</style>
|
883 |
<script type="text/javascript">
|
884 |
(function($){$.fn.tipTip=function(options){var defaults={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')))}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow")}return this.each(function(){var org_elem=$(this);if(opts.content){var org_title=opts.content}else{var org_title=org_elem.attr(opts.attribute)}if(org_title!=""){if(!opts.content){org_elem.removeAttr(opts.attribute)}var timeout=false;if(opts.activation=="hover"){org_elem.hover(function(){active_tiptip()},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}else if(opts.activation=="focus"){org_elem.focus(function(){active_tiptip()}).blur(function(){deactive_tiptip()})}else if(opts.activation=="click"){org_elem.click(function(){active_tiptip();return false}).hover(function(){},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}function active_tiptip(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(opts.defaultPosition=="bottom"){t_class="_bottom"}else if(opts.defaultPosition=="top"){t_class="_top"}else if(opts.defaultPosition=="left"){t_class="_left"}else if(opts.defaultPosition=="right"){t_class="_right"}var right_compare=(w_compare+left)<parseInt($(window).scrollLeft());var left_compare=(tip_w+left)>parseInt($(window).width());if((right_compare&&w_compare<0)||(t_class=="_right"&&!left_compare)||(t_class=="_left"&&left<(tip_w+opts.edgeOffset+5))){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare)}else if((left_compare&&w_compare<0)||(t_class=="_left"&&!right_compare)){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare)}var top_compare=(top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop());var bottom_compare=((top+org_height)-(opts.edgeOffset+tip_h+8))<0;if(top_compare||(t_class=="_bottom"&&top_compare)||(t_class=="_top"&&!bottom_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_top"}else{t_class=t_class+"_top"}arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset))}else if(bottom_compare|(t_class=="_top"&&bottom_compare)||(t_class=="_bottom"&&!top_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_bottom"}else{t_class=t_class+"_bottom"}arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset)}if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5}if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5}tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout)}timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn)},opts.delay)}function deactive_tiptip(){opts.exit.call(this);if(timeout){clearTimeout(timeout)}tiptip_holder.fadeOut(opts.fadeOut)}}})}})(jQuery);
|
@@ -889,13 +1104,13 @@ Domain Path: /languages
|
|
889 |
'delay' : 200
|
890 |
});
|
891 |
jQuery('input[value="billing_booking_delivery_t"]').parent().parent().hide();
|
892 |
-
jQuery('.delete-option'
|
893 |
jQuery(this).parent().remove();
|
894 |
});
|
895 |
-
jQuery('.button.add_option'
|
896 |
jQuery(this).before(' <span><br /><input type="text" id="options" value="" name="billing['+jQuery(this).attr('rel')+'][options][option-'+ (jQuery(this).parent().find('input').length + 1) +']"/><span class="delete-option" style="cursor:pointer;border:1px solid">Удалить</span></span>');
|
897 |
});
|
898 |
-
jQuery('input[type="radio"]'
|
899 |
if( jQuery(this).val() == 'select' || jQuery(this).val() == 'radio') {
|
900 |
jQuery(this).parent().parent().find('td').css('border-bottom', 'none');
|
901 |
jQuery(this).parent().parent().addClass('parrent_td_option'+jQuery('.button.add_option').length);
|
@@ -913,31 +1128,54 @@ Domain Path: /languages
|
|
913 |
}
|
914 |
});
|
915 |
|
916 |
-
jQuery('input#options'
|
917 |
var text = jQuery(this).attr('name');
|
918 |
text = text.replace(/\[options\]\[(.*)\]/g,'[options]['+ jQuery(this).val() +']');
|
919 |
jQuery(this).attr('name', text);
|
920 |
});
|
921 |
-
|
|
|
922 |
var obj = jQuery(this).parent().parent();
|
923 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
924 |
obj.removeClass('nodrop nodrag');
|
925 |
obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="billing" value="Добавить +"/></td></tr>');
|
926 |
});
|
927 |
-
jQuery('.button#shipping'
|
928 |
var obj = jQuery(this).parent().parent();
|
929 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
930 |
obj.removeClass('nodrop nodrag');
|
931 |
obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="shipping" value="Добавить +"/></td></tr>');
|
932 |
});
|
933 |
-
jQuery('.button#order'
|
934 |
var obj = jQuery(this).parent().parent();
|
935 |
obj.html('<td><input value="order_new_fild'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" type="text" name="order[new_fild][name][]" /></td><td><input value="" type="text" name="order[new_fild][label][]" /></td><td><input value="" type="text" name="order[new_fild][placeholder][]" /></td><td><input value="" type="text" name="order[new_fild][class][]" /></td><td><input checked type="text" name="order[new_fild][type][]" /></td><td><input checked type="checkbox" name="order[new_fild][public][]" /></td><td><input id="order_count" rel="sort_order" type="hidden" name="order[new_fild][order][]" value="'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" /><input type="button" class="button" id="billing_delete" value="Удалить -"/></td>');
|
936 |
obj.removeClass('nodrop nodrag');
|
937 |
obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="order" value="Добавить +"/></td></tr>');
|
938 |
});
|
939 |
|
940 |
-
jQuery('.button#billing_delete'
|
941 |
var obj = jQuery(this).parent().parent();
|
942 |
var obj_r = obj.parent();
|
943 |
obj.remove();
|
@@ -1064,8 +1302,9 @@ Domain Path: /languages
|
|
1064 |
return $show_fields;
|
1065 |
}
|
1066 |
function woocommerce_get_customer_meta_fields_saphali() {
|
1067 |
-
$fieldss
|
1068 |
-
|
|
|
1069 |
$show_fields = $this->woocommerce_get_customer_meta_fields_saph_ed();
|
1070 |
|
1071 |
|
@@ -1216,7 +1455,10 @@ Domain Path: /languages
|
|
1216 |
}
|
1217 |
function saphali_custom_override_checkout_fields( $fields ) {
|
1218 |
|
1219 |
-
$fieldss
|
|
|
|
|
|
|
1220 |
if(is_array($fieldss)) {
|
1221 |
$fields["billing"] = $fieldss["billing"];
|
1222 |
$fields["shipping"] = $fieldss["shipping"];
|
@@ -1233,7 +1475,10 @@ Domain Path: /languages
|
|
1233 |
}
|
1234 |
function saphali_custom_edit_address_fields( $fields ) {
|
1235 |
global $wp;
|
1236 |
-
$fieldss
|
|
|
|
|
|
|
1237 |
if(is_array($fieldss))
|
1238 |
$_fields = $fieldss["billing"];
|
1239 |
if( isset($_fields) && is_array($_fields) )
|
@@ -1253,8 +1498,10 @@ Domain Path: /languages
|
|
1253 |
return $fields;
|
1254 |
}
|
1255 |
function saphali_custom_billing_fields( $fields ) {
|
1256 |
-
|
1257 |
-
|
|
|
|
|
1258 |
if(is_array($fieldss))
|
1259 |
$fields = $fieldss["billing"];
|
1260 |
foreach($fields as $key => $value) {
|
@@ -1267,7 +1514,9 @@ Domain Path: /languages
|
|
1267 |
return $fields;
|
1268 |
}
|
1269 |
function saphali_custom_shipping_fields( $fields ) {
|
1270 |
-
$fieldss
|
|
|
|
|
1271 |
if(is_array($fieldss))
|
1272 |
$fields = $fieldss["shipping"];
|
1273 |
foreach($fields as $key => $value) {
|
3 |
Plugin Name: Saphali Woocommerce Russian
|
4 |
Plugin URI: http://saphali.com/saphali-woocommerce-plugin-wordpress
|
5 |
Description: Saphali Woocommerce Russian - это бесплатный вордпресс плагин, который добавляет набор дополнений к интернет-магазину на Woocommerce.
|
6 |
+
Version: 1.7.0
|
7 |
Author: Saphali
|
8 |
Author URI: http://saphali.com/
|
9 |
Text Domain: saphali-woocommerce-lite
|
34 |
|
35 |
// Подключение валюты и локализации
|
36 |
define('SAPHALI_PLUGIN_DIR_URL',plugin_dir_url(__FILE__));
|
37 |
+
define('SAPHALI_LITE_VERSION', '1.7.0' );
|
38 |
define('SAPHALI_PLUGIN_DIR_PATH',plugin_dir_path(__FILE__));
|
39 |
class saphali_lite {
|
40 |
var $email_order_id;
|
41 |
+
var $fieldss;
|
42 |
var $column_count_saphali;
|
43 |
function __construct() {
|
44 |
if ( version_compare( WOOCOMMERCE_VERSION, '2.2.0', '<' ) || version_compare( WOOCOMMERCE_VERSION, '2.5.0', '>' ) )
|
97 |
add_filter( 'woocommerce_admin_billing_fields', array($this,'woocommerce_admin_billing_fields'), 10, 1 );
|
98 |
add_filter( 'woocommerce_admin_shipping_fields', array($this,'woocommerce_admin_shipping_fields'), 10, 1 );
|
99 |
}
|
100 |
+
add_action("wp_footer", array($this,'print_script_payment_method') );
|
101 |
+
if( version_compare( WOOCOMMERCE_VERSION, '3.0.0', '<' ) )
|
102 |
+
add_action( 'woocommerce_after_checkout_validation', array( $this, 'after_checkout_validation' ), 10 );
|
103 |
+
else
|
104 |
+
add_action( 'woocommerce_after_checkout_validation', array( $this, 'after_checkout_validation' ), 10, 2 );
|
105 |
+
}
|
106 |
+
|
107 |
+
public function remove_no_valid_filds($key, $value, $errors) {
|
108 |
+
if ( version_compare( WOOCOMMERCE_VERSION, '3.0.0', '<' ) ) {
|
109 |
+
$is_e = true;
|
110 |
+
if( version_compare( WOOCOMMERCE_VERSION, '2.1', '<' ) ) {
|
111 |
+
global $woocommerce;
|
112 |
+
if(!empty($woocommerce->errors)) {
|
113 |
+
foreach($woocommerce->errors as $i => $_e) {
|
114 |
+
if( strpos($_e, strtolower($value["rf"]) ) !== false || strpos($_e, $value["rf"]) !== false ) {
|
115 |
+
unset($woocommerce->errors[$i]);
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
} else {
|
120 |
+
$s = WC()->session;
|
121 |
+
$notices = $s->get( 'wc_notices', array() );
|
122 |
+
if( isset( $notices['error'] ) ) {
|
123 |
+
foreach($notices['error'] as $i => $_e) {
|
124 |
+
if( strpos($_e, strtolower($value["rf"]) ) !== false || strpos($_e, $value["rf"]) !== false ) {
|
125 |
+
unset($notices['error'][$i]);
|
126 |
+
}
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
if(empty($notices['error'])) {
|
131 |
+
unset($notices['error']);
|
132 |
+
}
|
133 |
+
$s->set( 'wc_notices', $notices );
|
134 |
+
}
|
135 |
+
|
136 |
+
} else {
|
137 |
+
if( is_wp_error($errors) ) {
|
138 |
+
$is_e = true;
|
139 |
+
if( isset( $errors->errors["required-field"] ) ) {
|
140 |
+
foreach($errors->errors["required-field"] as $i => $_e) {
|
141 |
+
if( strpos($_e, strtolower($value["rf"]) ) !== false || strpos($_e, $value["rf"]) !== false ) {
|
142 |
+
unset($errors->errors["required-field"][$i]);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
+
return $is_e;
|
150 |
+
}
|
151 |
+
public function after_checkout_validation( $data, $errors = array() ) {
|
152 |
+
if(! isset($this->fieldss) )
|
153 |
+
$this->fieldss = get_option('woocommerce_saphali_filds_filters');
|
154 |
+
$fieldss = $this->fieldss;
|
155 |
+
|
156 |
+
foreach(array('billing', 'shipping') as $type) {
|
157 |
+
foreach($fieldss[$type] as $key => $value) {
|
158 |
+
if(isset($value['payment_method'])) {
|
159 |
+
$pm_k_remove = array();
|
160 |
+
foreach($value['payment_method'] as $k => $v) {
|
161 |
+
if($v === '0') {
|
162 |
+
$pm_k_remove[] = $k;
|
163 |
+
}
|
164 |
+
}
|
165 |
+
foreach($pm_k_remove as $k_remove) {
|
166 |
+
unset($value['payment_method'][$k_remove]);
|
167 |
+
}
|
168 |
+
}
|
169 |
+
if(isset($value['payment_method']) && !empty($value['payment_method'])) {
|
170 |
+
$r = ( isset($value["required"]) && $value["required"] );
|
171 |
+
$keys[ $key ] = array( 'pm' => $value['payment_method'], 'r' => $r, 'rf' => $value["label"], 'type' => $type );
|
172 |
+
}
|
173 |
+
}
|
174 |
+
}
|
175 |
+
$is_e = false;
|
176 |
+
foreach($keys as $key => $value) {
|
177 |
+
if( $value["r"] ) {
|
178 |
+
if(in_array($_POST['payment_method'], $value["pm"]) ) {
|
179 |
+
if( empty($_POST[$key])) {
|
180 |
+
$is_e = $this->remove_no_valid_filds($key, $value, $errors);
|
181 |
+
if( version_compare( WOOCOMMERCE_VERSION, '3.0.0', '<' ) ) {
|
182 |
+
if( !version_compare( WOOCOMMERCE_VERSION, '2.6.0', '<' ) )
|
183 |
+
$this->comp_woocomerce_mess_error( sprintf( _x( '%s is a required field.', 'FIELDNAME is a required field.', 'woocommerce' ), '<strong>' . $value["rf"] . '</strong>' ) );
|
184 |
+
else
|
185 |
+
$this->comp_woocomerce_mess_error( '<strong>' . $value["rf"] . '</strong> ' . __( 'is a required field.', 'woocommerce' ) );
|
186 |
+
} else {
|
187 |
+
switch ($value["type"]) {
|
188 |
+
case 'shipping' :
|
189 |
+
/* translators: %s: field name */
|
190 |
+
$field_label = __( 'Shipping %s', 'woocommerce' );
|
191 |
+
break;
|
192 |
+
case 'billing' :
|
193 |
+
/* translators: %s: field name */
|
194 |
+
$field_label = __( 'Billing %s', 'woocommerce' );
|
195 |
+
break;
|
196 |
+
}
|
197 |
+
$fl = function_exists('mb_strtolower') ? mb_strtolower( sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . $value["rf"] . '</strong>' ) ) : sprintf( __( '%s is a required field.', 'woocommerce' ), '<strong>' . $value["rf"] . '</strong>' );
|
198 |
+
$this->comp_woocomerce_mess_error( sprintf( $field_label, $fl ) );
|
199 |
+
}
|
200 |
+
}
|
201 |
+
} else {
|
202 |
+
if( empty($_POST[$key])) {
|
203 |
+
$is_e = $this->remove_no_valid_filds($key, $value, $errors);
|
204 |
+
}
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
if($is_e && !version_compare( WOOCOMMERCE_VERSION, '3.0.0', '<' ) ) {
|
209 |
+
if(empty( $errors->errors["required-field"] ) )
|
210 |
+
$errors->remove( 'required-field' );
|
211 |
+
}
|
212 |
+
}
|
213 |
+
function comp_woocomerce_mess_error ($m) {
|
214 |
+
if( version_compare( WOOCOMMERCE_VERSION, '2.1', '<' ) ) {
|
215 |
+
global $woocommerce;
|
216 |
+
$woocommerce->add_error( $m );
|
217 |
+
} else {
|
218 |
+
wc_add_notice( $m, 'error' );
|
219 |
+
}
|
220 |
+
}
|
221 |
+
function print_script_payment_method() {
|
222 |
+
if(! isset($this->fieldss) )
|
223 |
+
$this->fieldss = get_option('woocommerce_saphali_filds_filters');
|
224 |
+
$fieldss = $this->fieldss;
|
225 |
+
|
226 |
+
foreach(array('billing', 'shipping') as $type) {
|
227 |
+
if(isset($fieldss[$type]) && is_array($fieldss[$type])) {
|
228 |
+
foreach($fieldss[$type] as $key => $value) {
|
229 |
+
if(isset($value['payment_method'])) {
|
230 |
+
$pm_k_remove = array();
|
231 |
+
foreach($value['payment_method'] as $k => $v) {
|
232 |
+
if($v === '0') {
|
233 |
+
$pm_k_remove[] = $k;
|
234 |
+
}
|
235 |
+
}
|
236 |
+
foreach($pm_k_remove as $k_remove) {
|
237 |
+
unset($value['payment_method'][$k_remove]);
|
238 |
+
}
|
239 |
+
}
|
240 |
+
if(isset($value['payment_method']) && !empty($value['payment_method'])) {
|
241 |
+
$keys[ $key ] = $value['payment_method'];
|
242 |
+
}
|
243 |
+
}
|
244 |
+
}
|
245 |
+
}
|
246 |
+
?>
|
247 |
+
<script>
|
248 |
+
var $keys = <?php if( isset($keys) ) echo json_encode($keys); else echo '[]'; ?>;
|
249 |
+
function corect_payment_method_filds () {
|
250 |
+
var selected_p_method = jQuery("input[name=\"payment_method\"]:checked").val();
|
251 |
+
jQuery.each($keys, function(i,e){
|
252 |
+
if( jQuery.inArray( selected_p_method, e ) >= 0 ) {
|
253 |
+
jQuery("#" + i + "_field").show('slow');
|
254 |
+
} else {
|
255 |
+
jQuery("#" + i + "_field").hide('slow');
|
256 |
+
}
|
257 |
+
});
|
258 |
+
}
|
259 |
+
jQuery("body").delegate("input[name=\"payment_method\"]", 'click', function(){
|
260 |
+
corect_payment_method_filds ();
|
261 |
+
});
|
262 |
+
jQuery('body').bind('updated_checkout', function() {
|
263 |
+
corect_payment_method_filds ();
|
264 |
+
});
|
265 |
+
</script>
|
266 |
+
<?php
|
267 |
}
|
268 |
function formatted_billing_address($address, $order) {
|
269 |
$billing_data = $this->woocommerce_get_customer_meta_fields_saphali();
|
756 |
unset($filds_finish_filter["order"][$v_filt]);
|
757 |
}
|
758 |
}
|
759 |
+
update_option('woocommerce_saphali_filds',$filds_finish);
|
760 |
+
update_option('woocommerce_saphali_filds_filters',$filds_finish_filter);
|
761 |
foreach($filds_finish_filter['billing'] as $k_f => $v_f) {
|
762 |
$new_key = str_replace('billing_', '' , $k_f);
|
763 |
if(in_array($new_key, array('country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' ) ))
|
790 |
<th width="130px">Класс поля<img class="help_tip" data-tip="<h3 style='margin:0;padding:0'>Задает стиль текущего поля</h3><ul style='text-align: left;'><li><span style='color: #000'>form-row-first</span> – первый в строке;</li><li><span style='color: #000'>form-row-last</span> – последний в строке.</li></ul><hr /><span style='color: #000'>ЕСЛИ ОСТАВИТЬ ПУСТЫМ</span>, то поле будет отображаться на всю ширину. Соответственно, в предыдущем поле (которое выше) нужно отметить «Clear»." src="<?php bloginfo('wpurl');?>/wp-content/plugins/woocommerce/assets/images/help.png" /></th>
|
791 |
<th width="40px">Тип поля</th>
|
792 |
<th width="40px">Обя­за­те­ль­ное</th>
|
793 |
+
|
794 |
<th width="40px">Опу­бли­ко­вать</th>
|
795 |
+
<th width="120px">Метод оплаты</th>
|
796 |
<th width="65px">Удалить/До­ба­вить</th>
|
797 |
</tr>
|
798 |
</thead>
|
804 |
<th width="35px">Clear<img class="help_tip" data-tip="Указывает на то, что следующее поле за текущим, будет начинаться с новой строки." src="<?php bloginfo('wpurl');?>/wp-content/plugins/woocommerce/assets/images/help.png" /> </th>
|
805 |
<th>Класс поля</th>
|
806 |
<th width="40px">Тип поля</th>
|
807 |
+
<th width="40px">Обя­за­те­ль­ное</th>
|
808 |
|
809 |
+
<th width="40px">Опу­бли­ко­вать</th>
|
810 |
+
<th width="120px">Метод оплаты</th>
|
811 |
+
<th>Удалить/До­ба­вить</th>
|
812 |
</tr>
|
813 |
</tfoot>
|
814 |
<tbody id="the-list" class="myTable">
|
821 |
if( isset($checkout_fields["billing"]) && is_array($checkout_fields["billing"])) $f->checkout_fields["billing"] = $checkout_fields["billing"];
|
822 |
if( isset($f) )
|
823 |
foreach($f->checkout_fields["billing"] as $key => $value) {
|
824 |
+
|
825 |
$public = 'public';
|
826 |
if( !version_compare( WOOCOMMERCE_VERSION, '3.0', '<' ) ) {
|
827 |
if( isset( $checkout_fields["billing"][$key] ) ) $value[$public] = $checkout_fields["billing"][$key][$public];
|
828 |
}
|
829 |
+
if(isset($checkout_fields["billing"][$key]['payment_method'])) {
|
830 |
+
$pm_k_remove = array();
|
831 |
+
foreach($checkout_fields["billing"][$key]['payment_method'] as $k => $v) {
|
832 |
+
if($v === '0') {
|
833 |
+
$pm_k_remove[] = $k;
|
834 |
+
}
|
835 |
+
}
|
836 |
+
|
837 |
+
foreach($pm_k_remove as $k_remove) {
|
838 |
+
unset($checkout_fields["billing"][$key]['payment_method'][$k_remove]);
|
839 |
+
}
|
840 |
+
if( isset( $checkout_fields["billing"][$key] ) ) $value['payment_method'] = $checkout_fields["billing"][$key]['payment_method'];
|
841 |
+
}
|
842 |
|
843 |
if(empty($value[$public]) && !is_array($checkout_fields["billing"])) $value[$public] = true;
|
844 |
?>
|
869 |
</td>
|
870 |
<td><input <?php if( isset($value['required'] ) && $value['required']) echo 'checked'?> type="checkbox" name="billing[<?php echo $key?>][required]" /></td>
|
871 |
<td><input <?php if(isset($value[$public]) && $value[$public]) echo 'checked';?> type="checkbox" name="billing[<?php echo $key?>][<?php echo $public; ?>]" /></td>
|
872 |
+
<td>
|
873 |
+
<select multiple="multiple" width="120px" name="billing[<?php echo $key?>][payment_method][]">
|
874 |
+
<option value="0"<?php if( isset($value['payment_method']) && ( in_array('0', $value['payment_method']) || empty($value['payment_method']) ) || !isset($value['payment_method']) ) echo 'selected';?>>Все</option>
|
875 |
+
<?php
|
876 |
+
foreach ( $woocommerce->payment_gateways->payment_gateways() as $gateway ) {
|
877 |
+
if ( $gateway->enabled != 'yes' ) continue;
|
878 |
+
?><option value="<?php echo $gateway->id; ?>" <?php if(isset($value['payment_method']) && in_array($gateway->id, $value['payment_method']) ) echo 'selected';?>><?php echo $gateway->title; ?></option><?php
|
879 |
+
}
|
880 |
+
?>
|
881 |
+
</select>
|
882 |
+
</td>
|
883 |
|
884 |
<td><input rel="sort_order" id="order_count" type="hidden" name="billing[<?php echo $key?>][order]" value="<?php echo $count?>" />
|
885 |
<input type="button" class="button" id="billing_delete" value="Удалить -"/></td>
|
895 |
<td></td>
|
896 |
<td></td>
|
897 |
|
898 |
+
<td></td>
|
899 |
<td></td>
|
900 |
|
901 |
+
<td colspan="2"><input type="button" class="button" id="billing" value="Добавить +"/></td>
|
902 |
</tr>
|
903 |
</tbody>
|
904 |
</table>
|
915 |
<th width="40px">Обя­за­те­ль­ное</th>
|
916 |
|
917 |
<th width="40px">Опу­бли­ко­вать</th>
|
918 |
+
<th width="120px">Метод оплаты</th>
|
919 |
<th width="65px">Удалить/До­ба­вить</th>
|
920 |
</tr>
|
921 |
</thead>
|
929 |
<th width="40px">Обя­за­те­ль­ное</th>
|
930 |
|
931 |
<th width="40px">Опу­бли­ко­вать</th>
|
932 |
+
<th width="120px">Метод оплаты</th>
|
933 |
<th>Удалить/До­ба­вить</th>
|
934 |
</tr>
|
935 |
</tfoot>
|
942 |
if( ! version_compare( WOOCOMMERCE_VERSION, '3.0', '<' ) ) {
|
943 |
if( isset( $checkout_fields["shipping"][$key] ) ) $value[$public] = $checkout_fields["shipping"][$key][$public];
|
944 |
}
|
945 |
+
if(isset($checkout_fields["shipping"][$key]['payment_method'])) {
|
946 |
+
$pm_k_remove = array();
|
947 |
+
foreach($checkout_fields["shipping"][$key]['payment_method'] as $k => $v) {
|
948 |
+
if($v === '0') {
|
949 |
+
$pm_k_remove[] = $k;
|
950 |
+
}
|
951 |
+
}
|
952 |
+
|
953 |
+
foreach($pm_k_remove as $k_remove) {
|
954 |
+
unset($checkout_fields["shipping"][$key]['payment_method'][$k_remove]);
|
955 |
+
}
|
956 |
+
if( isset( $checkout_fields["shipping"][$key] ) ) $value['payment_method'] = $checkout_fields["shipping"][$key]['payment_method'];
|
957 |
+
}
|
958 |
if( empty($value['public']) && !is_array($checkout_fields["shipping"]) ) $value['public'] = true;
|
959 |
?>
|
960 |
<tr>
|
969 |
} ?></td>
|
970 |
<td><input <?php if(isset($value['required']) && $value['required']) echo 'checked'?> type="checkbox" name="shipping[<?php echo $key?>][required]" /></td>
|
971 |
<td><input <?php if(isset($value['public']) && $value['public']) echo 'checked';?> type="checkbox" name="shipping[<?php echo $key?>][public]" /></td>
|
972 |
+
<td>
|
973 |
+
<select multiple="multiple" width="120px" name="shipping[<?php echo $key?>][payment_method][]">
|
974 |
+
<option value="0" <?php if( isset($value['payment_method']) && ( in_array('0', $value['payment_method']) || empty($value['payment_method']) ) || !isset($value['payment_method']) ) echo 'selected';?>>Все</option>
|
975 |
+
<?php
|
976 |
+
foreach ( $woocommerce->payment_gateways->payment_gateways() as $gateway ) {
|
977 |
+
if ( $gateway->enabled != 'yes' ) continue;
|
978 |
+
?><option value="<?php echo $gateway->id; ?>" <?php if(isset($value['payment_method']) && in_array($gateway->id, $value['payment_method']) ) echo 'selected';?>><?php echo $gateway->title; ?></option><?php
|
979 |
+
}
|
980 |
+
?>
|
981 |
+
</select>
|
982 |
+
</td>
|
983 |
|
984 |
<td><input rel="sort_order" id="order_count" type="hidden" name="shipping[<?php echo $key?>][order]" value="<?php echo $count?>" /><input type="button" class="button" id="billing_delete" value="Удалить -"/>
|
985 |
<?php
|
997 |
<td></td>
|
998 |
<td></td>
|
999 |
<td></td>
|
|
|
1000 |
<td></td>
|
1001 |
+
|
1002 |
<td></td>
|
1003 |
<td></td>
|
1004 |
<td></td>
|
1005 |
+
<td colspan="2"><input type="button" class="button" id="shipping" value="Добавить +"/></td>
|
|
|
1006 |
</tr>
|
1007 |
|
1008 |
</tbody>
|
1018 |
<th width="130px">Класс поля</th>
|
1019 |
<th width="130px">Тип поля</th>
|
1020 |
<th width="40px">Опу­бли­ко­вать</th>
|
|
|
1021 |
<th width="65px">Удалить/До­ба­вить</th>
|
1022 |
</tr>
|
1023 |
</thead>
|
1029 |
<th>Класс поля</th>
|
1030 |
<th>Тип поля</th>
|
1031 |
<th width="40px">Опу­бли­ко­вать</th>
|
|
|
1032 |
<th>Удалить/До­ба­вить</th>
|
1033 |
</tr>
|
1034 |
</tfoot>
|
1093 |
background:none repeat scroll 0 0 #EAEAEA !important;
|
1094 |
color:#636060 !important;
|
1095 |
}
|
1096 |
+
#the-list select { width: 120px; }
|
1097 |
</style>
|
1098 |
<script type="text/javascript">
|
1099 |
(function($){$.fn.tipTip=function(options){var defaults={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},exit:function(){}};var opts=$.extend(defaults,options);if($("#tiptip_holder").length<=0){var tiptip_holder=$('<div id="tiptip_holder" style="max-width:'+opts.maxWidth+';"></div>');var tiptip_content=$('<div id="tiptip_content"></div>');var tiptip_arrow=$('<div id="tiptip_arrow"></div>');$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')))}else{var tiptip_holder=$("#tiptip_holder");var tiptip_content=$("#tiptip_content");var tiptip_arrow=$("#tiptip_arrow")}return this.each(function(){var org_elem=$(this);if(opts.content){var org_title=opts.content}else{var org_title=org_elem.attr(opts.attribute)}if(org_title!=""){if(!opts.content){org_elem.removeAttr(opts.attribute)}var timeout=false;if(opts.activation=="hover"){org_elem.hover(function(){active_tiptip()},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}else if(opts.activation=="focus"){org_elem.focus(function(){active_tiptip()}).blur(function(){deactive_tiptip()})}else if(opts.activation=="click"){org_elem.click(function(){active_tiptip();return false}).hover(function(){},function(){if(!opts.keepAlive){deactive_tiptip()}});if(opts.keepAlive){tiptip_holder.hover(function(){},function(){deactive_tiptip()})}}function active_tiptip(){opts.enter.call(this);tiptip_content.html(org_title);tiptip_holder.hide().removeAttr("class").css("margin","0");tiptip_arrow.removeAttr("style");var top=parseInt(org_elem.offset()['top']);var left=parseInt(org_elem.offset()['left']);var org_width=parseInt(org_elem.outerWidth());var org_height=parseInt(org_elem.outerHeight());var tip_w=tiptip_holder.outerWidth();var tip_h=tiptip_holder.outerHeight();var w_compare=Math.round((org_width-tip_w)/2);var h_compare=Math.round((org_height-tip_h)/2);var marg_left=Math.round(left+w_compare);var marg_top=Math.round(top+org_height+opts.edgeOffset);var t_class="";var arrow_top="";var arrow_left=Math.round(tip_w-12)/2;if(opts.defaultPosition=="bottom"){t_class="_bottom"}else if(opts.defaultPosition=="top"){t_class="_top"}else if(opts.defaultPosition=="left"){t_class="_left"}else if(opts.defaultPosition=="right"){t_class="_right"}var right_compare=(w_compare+left)<parseInt($(window).scrollLeft());var left_compare=(tip_w+left)>parseInt($(window).width());if((right_compare&&w_compare<0)||(t_class=="_right"&&!left_compare)||(t_class=="_left"&&left<(tip_w+opts.edgeOffset+5))){t_class="_right";arrow_top=Math.round(tip_h-13)/2;arrow_left=-12;marg_left=Math.round(left+org_width+opts.edgeOffset);marg_top=Math.round(top+h_compare)}else if((left_compare&&w_compare<0)||(t_class=="_left"&&!right_compare)){t_class="_left";arrow_top=Math.round(tip_h-13)/2;arrow_left=Math.round(tip_w);marg_left=Math.round(left-(tip_w+opts.edgeOffset+5));marg_top=Math.round(top+h_compare)}var top_compare=(top+org_height+opts.edgeOffset+tip_h+8)>parseInt($(window).height()+$(window).scrollTop());var bottom_compare=((top+org_height)-(opts.edgeOffset+tip_h+8))<0;if(top_compare||(t_class=="_bottom"&&top_compare)||(t_class=="_top"&&!bottom_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_top"}else{t_class=t_class+"_top"}arrow_top=tip_h;marg_top=Math.round(top-(tip_h+5+opts.edgeOffset))}else if(bottom_compare|(t_class=="_top"&&bottom_compare)||(t_class=="_bottom"&&!top_compare)){if(t_class=="_top"||t_class=="_bottom"){t_class="_bottom"}else{t_class=t_class+"_bottom"}arrow_top=-12;marg_top=Math.round(top+org_height+opts.edgeOffset)}if(t_class=="_right_top"||t_class=="_left_top"){marg_top=marg_top+5}else if(t_class=="_right_bottom"||t_class=="_left_bottom"){marg_top=marg_top-5}if(t_class=="_left_top"||t_class=="_left_bottom"){marg_left=marg_left+5}tiptip_arrow.css({"margin-left":arrow_left+"px","margin-top":arrow_top+"px"});tiptip_holder.css({"margin-left":marg_left+"px","margin-top":marg_top+"px"}).attr("class","tip"+t_class);if(timeout){clearTimeout(timeout)}timeout=setTimeout(function(){tiptip_holder.stop(true,true).fadeIn(opts.fadeIn)},opts.delay)}function deactive_tiptip(){opts.exit.call(this);if(timeout){clearTimeout(timeout)}tiptip_holder.fadeOut(opts.fadeOut)}}})}})(jQuery);
|
1104 |
'delay' : 200
|
1105 |
});
|
1106 |
jQuery('input[value="billing_booking_delivery_t"]').parent().parent().hide();
|
1107 |
+
jQuery("body").delegate('.delete-option', 'click',function() {
|
1108 |
jQuery(this).parent().remove();
|
1109 |
});
|
1110 |
+
jQuery("body").delegate('.button.add_option', 'click',function() {
|
1111 |
jQuery(this).before(' <span><br /><input type="text" id="options" value="" name="billing['+jQuery(this).attr('rel')+'][options][option-'+ (jQuery(this).parent().find('input').length + 1) +']"/><span class="delete-option" style="cursor:pointer;border:1px solid">Удалить</span></span>');
|
1112 |
});
|
1113 |
+
jQuery("body").delegate('input[type="radio"]', 'click',function() {
|
1114 |
if( jQuery(this).val() == 'select' || jQuery(this).val() == 'radio') {
|
1115 |
jQuery(this).parent().parent().find('td').css('border-bottom', 'none');
|
1116 |
jQuery(this).parent().parent().addClass('parrent_td_option'+jQuery('.button.add_option').length);
|
1128 |
}
|
1129 |
});
|
1130 |
|
1131 |
+
jQuery("body").delegate('input#options', 'blur', function() {
|
1132 |
var text = jQuery(this).attr('name');
|
1133 |
text = text.replace(/\[options\]\[(.*)\]/g,'[options]['+ jQuery(this).val() +']');
|
1134 |
jQuery(this).attr('name', text);
|
1135 |
});
|
1136 |
+
var fild_pm;
|
1137 |
+
jQuery("body").delegate('.button#billing','click',function() {
|
1138 |
var obj = jQuery(this).parent().parent();
|
1139 |
+
fild_pm = '<td>\
|
1140 |
+
<select multiple="multiple" width="120px" name="billing[new_fild][payment_method][]">\
|
1141 |
+
<option selected value="0">Все</option>\
|
1142 |
+
<?php
|
1143 |
+
foreach ( $woocommerce->payment_gateways->payment_gateways() as $gateway ) {
|
1144 |
+
if ( $gateway->enabled != 'yes' ) continue;
|
1145 |
+
?><option value="<?php echo $gateway->id; ?>" <?php if(isset($value['payment_method']) && in_array($gateway->id, $value['payment_method']) ) echo 'selected';?>><?php echo str_replace("'", "\\'", $gateway->title); ?></option><?php
|
1146 |
+
}
|
1147 |
+
?>\
|
1148 |
+
</select>\
|
1149 |
+
</td>';
|
1150 |
+
obj.html('<td><input value="billing_new_fild'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" type="text" name="billing[new_fild][name][]" /></td><td><input value="" type="text" name="billing[new_fild][label][]" /></td><td><input value="" type="text" name="billing[new_fild][placeholder][]" /></td><td><input type="checkbox" name="billing[new_fild][clear][]" /></td><td><input value="" type="text" name="billing[new_fild][class][]" /></td><td> Select <input type="radio" value="select" name="billing[new_fild][type]"><br>Radio <input type="radio" value="radio" name="billing[new_fild][type]"><br>Checkbox <input type="radio" value="checkbox" name="billing[new_fild][type]"><br> Textarea <input type="radio" value="textarea" name="billing[new_fild][type]"><br> Text <input type="radio" value="" name="billing[new_fild][type]" checked="checked"></td><td><input checked type="checkbox" name="billing[new_fild][required][]" /></td><td><input checked type="checkbox" name="billing[new_fild][public][]" /></td>' + fild_pm + '<td><input id="order_count" rel="sort_order" type="hidden" name="billing[new_fild][order][]" value="'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" /><input type="button" class="button" id="billing_delete" value="Удалить -"/></td>');
|
1151 |
obj.removeClass('nodrop nodrag');
|
1152 |
obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="billing" value="Добавить +"/></td></tr>');
|
1153 |
});
|
1154 |
+
jQuery("body").delegate('.button#shipping', 'click',function() {
|
1155 |
var obj = jQuery(this).parent().parent();
|
1156 |
+
fild_pm = '<td>\
|
1157 |
+
<select multiple="multiple" width="120px" name="shipping[new_fild][payment_method][]">\
|
1158 |
+
<option selected value="0">Все</option>\
|
1159 |
+
<?php
|
1160 |
+
foreach ( $woocommerce->payment_gateways->payment_gateways() as $gateway ) {
|
1161 |
+
if ( $gateway->enabled != 'yes' ) continue;
|
1162 |
+
?><option value="<?php echo $gateway->id; ?>" <?php if(isset($value['payment_method']) && in_array($gateway->id, $value['payment_method']) ) echo 'selected';?>><?php echo str_replace("'", "\\'", $gateway->title); ?></option><?php
|
1163 |
+
}
|
1164 |
+
?>\
|
1165 |
+
</select>\
|
1166 |
+
</td>';
|
1167 |
+
obj.html('<td><input value="shipping_new_fild'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" type="text" name="shipping[new_fild][name][]" /></td><td><input value="" type="text" name="shipping[new_fild][label][]" /></td><td><input value="" type="text" name="shipping[new_fild][placeholder][]" /></td><td><input type="checkbox" name="shipping[new_fild][clear][]" /></td><td><input value="" type="text" name="shipping[new_fild][class][]" /></td><td><input checked type="checkbox" name="shipping[new_fild][required][]" /></td><td><input checked type="checkbox" name="shipping[new_fild][public][]" /></td>' + fild_pm + '<td><input id="order_count" rel="sort_order" type="hidden" name="shipping[new_fild][order][]" value="'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" /><input type="button" class="button" id="billing_delete" value="Удалить -"/></td>');
|
1168 |
obj.removeClass('nodrop nodrag');
|
1169 |
obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="shipping" value="Добавить +"/></td></tr>');
|
1170 |
});
|
1171 |
+
jQuery("body").delegate('.button#order', 'click',function() {
|
1172 |
var obj = jQuery(this).parent().parent();
|
1173 |
obj.html('<td><input value="order_new_fild'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" type="text" name="order[new_fild][name][]" /></td><td><input value="" type="text" name="order[new_fild][label][]" /></td><td><input value="" type="text" name="order[new_fild][placeholder][]" /></td><td><input value="" type="text" name="order[new_fild][class][]" /></td><td><input checked type="text" name="order[new_fild][type][]" /></td><td><input checked type="checkbox" name="order[new_fild][public][]" /></td><td><input id="order_count" rel="sort_order" type="hidden" name="order[new_fild][order][]" value="'+(parseInt(obj.parent().find('tr td input#order_count:last').val(),10)+1)+'" /><input type="button" class="button" id="billing_delete" value="Удалить -"/></td>');
|
1174 |
obj.removeClass('nodrop nodrag');
|
1175 |
obj.after('<tr class="nodrop nodrag"><td></td><td></td><td></td><td></td><td></td><td></td><td><input type="button" class="button" id="order" value="Добавить +"/></td></tr>');
|
1176 |
});
|
1177 |
|
1178 |
+
jQuery("body").delegate('.button#billing_delete', 'click',function() {
|
1179 |
var obj = jQuery(this).parent().parent();
|
1180 |
var obj_r = obj.parent();
|
1181 |
obj.remove();
|
1302 |
return $show_fields;
|
1303 |
}
|
1304 |
function woocommerce_get_customer_meta_fields_saphali() {
|
1305 |
+
if(! isset($this->fieldss) )
|
1306 |
+
$this->fieldss = get_option('woocommerce_saphali_filds_filters');
|
1307 |
+
$fieldss = $this->fieldss;
|
1308 |
$show_fields = $this->woocommerce_get_customer_meta_fields_saph_ed();
|
1309 |
|
1310 |
|
1455 |
}
|
1456 |
function saphali_custom_override_checkout_fields( $fields ) {
|
1457 |
|
1458 |
+
if(! isset($this->fieldss) )
|
1459 |
+
$this->fieldss = get_option('woocommerce_saphali_filds_filters');
|
1460 |
+
$fieldss = $this->fieldss;
|
1461 |
+
|
1462 |
if(is_array($fieldss)) {
|
1463 |
$fields["billing"] = $fieldss["billing"];
|
1464 |
$fields["shipping"] = $fieldss["shipping"];
|
1475 |
}
|
1476 |
function saphali_custom_edit_address_fields( $fields ) {
|
1477 |
global $wp;
|
1478 |
+
if(! isset($this->fieldss) )
|
1479 |
+
$this->fieldss = get_option('woocommerce_saphali_filds_filters');
|
1480 |
+
$fieldss = $this->fieldss;
|
1481 |
+
|
1482 |
if(is_array($fieldss))
|
1483 |
$_fields = $fieldss["billing"];
|
1484 |
if( isset($_fields) && is_array($_fields) )
|
1498 |
return $fields;
|
1499 |
}
|
1500 |
function saphali_custom_billing_fields( $fields ) {
|
1501 |
+
if(! isset($this->fieldss) )
|
1502 |
+
$this->fieldss = get_option('woocommerce_saphali_filds_filters');
|
1503 |
+
$fieldss = $this->fieldss;
|
1504 |
+
|
1505 |
if(is_array($fieldss))
|
1506 |
$fields = $fieldss["billing"];
|
1507 |
foreach($fields as $key => $value) {
|
1514 |
return $fields;
|
1515 |
}
|
1516 |
function saphali_custom_shipping_fields( $fields ) {
|
1517 |
+
if(! isset($this->fieldss) )
|
1518 |
+
$this->fieldss = get_option('woocommerce_saphali_filds_filters');
|
1519 |
+
$fieldss = $this->fieldss;
|
1520 |
if(is_array($fieldss))
|
1521 |
$fields = $fieldss["shipping"];
|
1522 |
foreach($fields as $key => $value) {
|