Version Description
- Fixed: WooCommerce 3.0 compatibility using $order->id
- Changed: Cleaned up the code across the Plugin
Download this release
Release Info
Developer | visser |
Plugin | WooCommerce Checkout Manager |
Version | 4.1.3 |
Comparing to | |
See all releases |
Code changes from version 4.0 to 4.1.3
- LICENSE.txt +339 -0
- includes/admin.php +2145 -0
- includes/checkout-additional.php +229 -0
- includes/checkout-billing.php +85 -0
- includes/checkout-shipping.php +85 -0
- includes/checkout.php +505 -0
- includes/classes/export.php +0 -652
- includes/classes/field_filters.php +667 -695
- includes/classes/file_upload/button_style.css +0 -61
- includes/classes/file_upload/file_editing_table.css +0 -137
- includes/classes/file_upload/main_upload.php +0 -624
- includes/classes/file_upload/upload_settings.php +0 -191
- includes/classes/import.php +139 -110
- includes/classes/main.php +754 -2251
- includes/email.php +367 -0
- includes/export.php +983 -0
- includes/formatting.php +94 -0
- includes/functions.php +31 -0
- includes/install.php +250 -0
- includes/pickers/caman/dist/caman.css +7 -7
- includes/pickers/caman/proxies/caman_proxy.php +29 -13
- includes/pickers/css/backend_css.css +228 -210
- includes/pickers/include/ui-1.10.0/ui-lightness/dislawooccm.php +0 -287
- includes/pickers/jcrop/css/jquery.Jcrop.css +5 -5
- includes/pickers/jquery.ui.css +1 -1
- includes/pickers/magnificpopup/dist/magnific-popup.css +6 -6
- includes/pickers/magnificpopup/libs/jquery/jquery.js +1 -1
- includes/pickers/wooccm_upload_script.js +1 -5
- includes/template.php +544 -0
- includes/templates/admin/edit-order-uploads-button_style.css +66 -0
- includes/templates/admin/edit-order-uploads-file_editing_table.css +139 -0
- includes/templates/admin/woocheckout-additional-clone.php +165 -0
- includes/templates/admin/woocheckout-additional-tbody.php +285 -0
- includes/templates/admin/woocheckout-additional-thead.php +154 -0
- includes/templates/admin/woocheckout-additional.php +67 -0
- includes/templates/admin/woocheckout-billing-clone.php +158 -0
- includes/templates/admin/woocheckout-billing-tbody.php +272 -0
- includes/templates/admin/woocheckout-billing-thead.php +130 -0
- includes/templates/admin/woocheckout-billing.php +86 -0
- includes/{classes/sc/export.css → templates/admin/woocheckout-export.css} +17 -25
- includes/templates/admin/woocheckout-general-address-fields.php +16 -0
- includes/templates/admin/woocheckout-general-advanced.php +29 -0
- includes/templates/admin/woocheckout-general-checkout-notices.php +82 -0
- includes/templates/admin/woocheckout-general-custom-css.php +28 -0
- includes/templates/admin/woocheckout-general-order-notes.php +150 -0
- includes/templates/admin/woocheckout-general-switches.php +189 -0
- includes/templates/admin/woocheckout-general-uploads.php +151 -0
- includes/templates/admin/woocheckout-general.php +57 -0
- includes/templates/admin/woocheckout-shipping-clone.php +159 -0
- includes/templates/admin/woocheckout-shipping-tbody.php +272 -0
- includes/templates/admin/woocheckout-shipping-thead.php +128 -0
- includes/templates/admin/woocheckout-shipping.php +84 -0
- includes/templates/functions/add_functions.php +728 -654
- includes/templates/functions/add_wooccmupload.php +354 -354
- includes/templates/functions/billing_functions.php +754 -663
- includes/templates/functions/billing_wooccmupload.php +313 -322
- includes/templates/functions/required/add_required.php +93 -93
- includes/templates/functions/required/billing_required.php +138 -119
- includes/templates/functions/required/shipping_required.php +137 -116
- includes/templates/functions/shipping_functions.php +757 -664
- includes/templates/functions/shipping_wooccmupload.php +312 -322
- includes/templates/functions/woocm_editing_wrapper.php +218 -195
- includes/templates/htmlbodyadd.php +0 -37
LICENSE.txt
ADDED
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 2, June 1991
|
3 |
+
|
4 |
+
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
5 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
6 |
+
Everyone is permitted to copy and distribute verbatim copies
|
7 |
+
of this license document, but changing it is not allowed.
|
8 |
+
|
9 |
+
Preamble
|
10 |
+
|
11 |
+
The licenses for most software are designed to take away your
|
12 |
+
freedom to share and change it. By contrast, the GNU General Public
|
13 |
+
License is intended to guarantee your freedom to share and change free
|
14 |
+
software--to make sure the software is free for all its users. This
|
15 |
+
General Public License applies to most of the Free Software
|
16 |
+
Foundation's software and to any other program whose authors commit to
|
17 |
+
using it. (Some other Free Software Foundation software is covered by
|
18 |
+
the GNU Lesser General Public License instead.) You can apply it to
|
19 |
+
your programs, too.
|
20 |
+
|
21 |
+
When we speak of free software, we are referring to freedom, not
|
22 |
+
price. Our General Public Licenses are designed to make sure that you
|
23 |
+
have the freedom to distribute copies of free software (and charge for
|
24 |
+
this service if you wish), that you receive source code or can get it
|
25 |
+
if you want it, that you can change the software or use pieces of it
|
26 |
+
in new free programs; and that you know you can do these things.
|
27 |
+
|
28 |
+
To protect your rights, we need to make restrictions that forbid
|
29 |
+
anyone to deny you these rights or to ask you to surrender the rights.
|
30 |
+
These restrictions translate to certain responsibilities for you if you
|
31 |
+
distribute copies of the software, or if you modify it.
|
32 |
+
|
33 |
+
For example, if you distribute copies of such a program, whether
|
34 |
+
gratis or for a fee, you must give the recipients all the rights that
|
35 |
+
you have. You must make sure that they, too, receive or can get the
|
36 |
+
source code. And you must show them these terms so they know their
|
37 |
+
rights.
|
38 |
+
|
39 |
+
We protect your rights with two steps: (1) copyright the software, and
|
40 |
+
(2) offer you this license which gives you legal permission to copy,
|
41 |
+
distribute and/or modify the software.
|
42 |
+
|
43 |
+
Also, for each author's protection and ours, we want to make certain
|
44 |
+
that everyone understands that there is no warranty for this free
|
45 |
+
software. If the software is modified by someone else and passed on, we
|
46 |
+
want its recipients to know that what they have is not the original, so
|
47 |
+
that any problems introduced by others will not reflect on the original
|
48 |
+
authors' reputations.
|
49 |
+
|
50 |
+
Finally, any free program is threatened constantly by software
|
51 |
+
patents. We wish to avoid the danger that redistributors of a free
|
52 |
+
program will individually obtain patent licenses, in effect making the
|
53 |
+
program proprietary. To prevent this, we have made it clear that any
|
54 |
+
patent must be licensed for everyone's free use or not licensed at all.
|
55 |
+
|
56 |
+
The precise terms and conditions for copying, distribution and
|
57 |
+
modification follow.
|
58 |
+
|
59 |
+
GNU GENERAL PUBLIC LICENSE
|
60 |
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
61 |
+
|
62 |
+
0. This License applies to any program or other work which contains
|
63 |
+
a notice placed by the copyright holder saying it may be distributed
|
64 |
+
under the terms of this General Public License. The "Program", below,
|
65 |
+
refers to any such program or work, and a "work based on the Program"
|
66 |
+
means either the Program or any derivative work under copyright law:
|
67 |
+
that is to say, a work containing the Program or a portion of it,
|
68 |
+
either verbatim or with modifications and/or translated into another
|
69 |
+
language. (Hereinafter, translation is included without limitation in
|
70 |
+
the term "modification".) Each licensee is addressed as "you".
|
71 |
+
|
72 |
+
Activities other than copying, distribution and modification are not
|
73 |
+
covered by this License; they are outside its scope. The act of
|
74 |
+
running the Program is not restricted, and the output from the Program
|
75 |
+
is covered only if its contents constitute a work based on the
|
76 |
+
Program (independent of having been made by running the Program).
|
77 |
+
Whether that is true depends on what the Program does.
|
78 |
+
|
79 |
+
1. You may copy and distribute verbatim copies of the Program's
|
80 |
+
source code as you receive it, in any medium, provided that you
|
81 |
+
conspicuously and appropriately publish on each copy an appropriate
|
82 |
+
copyright notice and disclaimer of warranty; keep intact all the
|
83 |
+
notices that refer to this License and to the absence of any warranty;
|
84 |
+
and give any other recipients of the Program a copy of this License
|
85 |
+
along with the Program.
|
86 |
+
|
87 |
+
You may charge a fee for the physical act of transferring a copy, and
|
88 |
+
you may at your option offer warranty protection in exchange for a fee.
|
89 |
+
|
90 |
+
2. You may modify your copy or copies of the Program or any portion
|
91 |
+
of it, thus forming a work based on the Program, and copy and
|
92 |
+
distribute such modifications or work under the terms of Section 1
|
93 |
+
above, provided that you also meet all of these conditions:
|
94 |
+
|
95 |
+
a) You must cause the modified files to carry prominent notices
|
96 |
+
stating that you changed the files and the date of any change.
|
97 |
+
|
98 |
+
b) You must cause any work that you distribute or publish, that in
|
99 |
+
whole or in part contains or is derived from the Program or any
|
100 |
+
part thereof, to be licensed as a whole at no charge to all third
|
101 |
+
parties under the terms of this License.
|
102 |
+
|
103 |
+
c) If the modified program normally reads commands interactively
|
104 |
+
when run, you must cause it, when started running for such
|
105 |
+
interactive use in the most ordinary way, to print or display an
|
106 |
+
announcement including an appropriate copyright notice and a
|
107 |
+
notice that there is no warranty (or else, saying that you provide
|
108 |
+
a warranty) and that users may redistribute the program under
|
109 |
+
these conditions, and telling the user how to view a copy of this
|
110 |
+
License. (Exception: if the Program itself is interactive but
|
111 |
+
does not normally print such an announcement, your work based on
|
112 |
+
the Program is not required to print an announcement.)
|
113 |
+
|
114 |
+
These requirements apply to the modified work as a whole. If
|
115 |
+
identifiable sections of that work are not derived from the Program,
|
116 |
+
and can be reasonably considered independent and separate works in
|
117 |
+
themselves, then this License, and its terms, do not apply to those
|
118 |
+
sections when you distribute them as separate works. But when you
|
119 |
+
distribute the same sections as part of a whole which is a work based
|
120 |
+
on the Program, the distribution of the whole must be on the terms of
|
121 |
+
this License, whose permissions for other licensees extend to the
|
122 |
+
entire whole, and thus to each and every part regardless of who wrote it.
|
123 |
+
|
124 |
+
Thus, it is not the intent of this section to claim rights or contest
|
125 |
+
your rights to work written entirely by you; rather, the intent is to
|
126 |
+
exercise the right to control the distribution of derivative or
|
127 |
+
collective works based on the Program.
|
128 |
+
|
129 |
+
In addition, mere aggregation of another work not based on the Program
|
130 |
+
with the Program (or with a work based on the Program) on a volume of
|
131 |
+
a storage or distribution medium does not bring the other work under
|
132 |
+
the scope of this License.
|
133 |
+
|
134 |
+
3. You may copy and distribute the Program (or a work based on it,
|
135 |
+
under Section 2) in object code or executable form under the terms of
|
136 |
+
Sections 1 and 2 above provided that you also do one of the following:
|
137 |
+
|
138 |
+
a) Accompany it with the complete corresponding machine-readable
|
139 |
+
source code, which must be distributed under the terms of Sections
|
140 |
+
1 and 2 above on a medium customarily used for software interchange; or,
|
141 |
+
|
142 |
+
b) Accompany it with a written offer, valid for at least three
|
143 |
+
years, to give any third party, for a charge no more than your
|
144 |
+
cost of physically performing source distribution, a complete
|
145 |
+
machine-readable copy of the corresponding source code, to be
|
146 |
+
distributed under the terms of Sections 1 and 2 above on a medium
|
147 |
+
customarily used for software interchange; or,
|
148 |
+
|
149 |
+
c) Accompany it with the information you received as to the offer
|
150 |
+
to distribute corresponding source code. (This alternative is
|
151 |
+
allowed only for noncommercial distribution and only if you
|
152 |
+
received the program in object code or executable form with such
|
153 |
+
an offer, in accord with Subsection b above.)
|
154 |
+
|
155 |
+
The source code for a work means the preferred form of the work for
|
156 |
+
making modifications to it. For an executable work, complete source
|
157 |
+
code means all the source code for all modules it contains, plus any
|
158 |
+
associated interface definition files, plus the scripts used to
|
159 |
+
control compilation and installation of the executable. However, as a
|
160 |
+
special exception, the source code distributed need not include
|
161 |
+
anything that is normally distributed (in either source or binary
|
162 |
+
form) with the major components (compiler, kernel, and so on) of the
|
163 |
+
operating system on which the executable runs, unless that component
|
164 |
+
itself accompanies the executable.
|
165 |
+
|
166 |
+
If distribution of executable or object code is made by offering
|
167 |
+
access to copy from a designated place, then offering equivalent
|
168 |
+
access to copy the source code from the same place counts as
|
169 |
+
distribution of the source code, even though third parties are not
|
170 |
+
compelled to copy the source along with the object code.
|
171 |
+
|
172 |
+
4. You may not copy, modify, sublicense, or distribute the Program
|
173 |
+
except as expressly provided under this License. Any attempt
|
174 |
+
otherwise to copy, modify, sublicense or distribute the Program is
|
175 |
+
void, and will automatically terminate your rights under this License.
|
176 |
+
However, parties who have received copies, or rights, from you under
|
177 |
+
this License will not have their licenses terminated so long as such
|
178 |
+
parties remain in full compliance.
|
179 |
+
|
180 |
+
5. You are not required to accept this License, since you have not
|
181 |
+
signed it. However, nothing else grants you permission to modify or
|
182 |
+
distribute the Program or its derivative works. These actions are
|
183 |
+
prohibited by law if you do not accept this License. Therefore, by
|
184 |
+
modifying or distributing the Program (or any work based on the
|
185 |
+
Program), you indicate your acceptance of this License to do so, and
|
186 |
+
all its terms and conditions for copying, distributing or modifying
|
187 |
+
the Program or works based on it.
|
188 |
+
|
189 |
+
6. Each time you redistribute the Program (or any work based on the
|
190 |
+
Program), the recipient automatically receives a license from the
|
191 |
+
original licensor to copy, distribute or modify the Program subject to
|
192 |
+
these terms and conditions. You may not impose any further
|
193 |
+
restrictions on the recipients' exercise of the rights granted herein.
|
194 |
+
You are not responsible for enforcing compliance by third parties to
|
195 |
+
this License.
|
196 |
+
|
197 |
+
7. If, as a consequence of a court judgment or allegation of patent
|
198 |
+
infringement or for any other reason (not limited to patent issues),
|
199 |
+
conditions are imposed on you (whether by court order, agreement or
|
200 |
+
otherwise) that contradict the conditions of this License, they do not
|
201 |
+
excuse you from the conditions of this License. If you cannot
|
202 |
+
distribute so as to satisfy simultaneously your obligations under this
|
203 |
+
License and any other pertinent obligations, then as a consequence you
|
204 |
+
may not distribute the Program at all. For example, if a patent
|
205 |
+
license would not permit royalty-free redistribution of the Program by
|
206 |
+
all those who receive copies directly or indirectly through you, then
|
207 |
+
the only way you could satisfy both it and this License would be to
|
208 |
+
refrain entirely from distribution of the Program.
|
209 |
+
|
210 |
+
If any portion of this section is held invalid or unenforceable under
|
211 |
+
any particular circumstance, the balance of the section is intended to
|
212 |
+
apply and the section as a whole is intended to apply in other
|
213 |
+
circumstances.
|
214 |
+
|
215 |
+
It is not the purpose of this section to induce you to infringe any
|
216 |
+
patents or other property right claims or to contest validity of any
|
217 |
+
such claims; this section has the sole purpose of protecting the
|
218 |
+
integrity of the free software distribution system, which is
|
219 |
+
implemented by public license practices. Many people have made
|
220 |
+
generous contributions to the wide range of software distributed
|
221 |
+
through that system in reliance on consistent application of that
|
222 |
+
system; it is up to the author/donor to decide if he or she is willing
|
223 |
+
to distribute software through any other system and a licensee cannot
|
224 |
+
impose that choice.
|
225 |
+
|
226 |
+
This section is intended to make thoroughly clear what is believed to
|
227 |
+
be a consequence of the rest of this License.
|
228 |
+
|
229 |
+
8. If the distribution and/or use of the Program is restricted in
|
230 |
+
certain countries either by patents or by copyrighted interfaces, the
|
231 |
+
original copyright holder who places the Program under this License
|
232 |
+
may add an explicit geographical distribution limitation excluding
|
233 |
+
those countries, so that distribution is permitted only in or among
|
234 |
+
countries not thus excluded. In such case, this License incorporates
|
235 |
+
the limitation as if written in the body of this License.
|
236 |
+
|
237 |
+
9. The Free Software Foundation may publish revised and/or new versions
|
238 |
+
of the General Public License from time to time. Such new versions will
|
239 |
+
be similar in spirit to the present version, but may differ in detail to
|
240 |
+
address new problems or concerns.
|
241 |
+
|
242 |
+
Each version is given a distinguishing version number. If the Program
|
243 |
+
specifies a version number of this License which applies to it and "any
|
244 |
+
later version", you have the option of following the terms and conditions
|
245 |
+
either of that version or of any later version published by the Free
|
246 |
+
Software Foundation. If the Program does not specify a version number of
|
247 |
+
this License, you may choose any version ever published by the Free Software
|
248 |
+
Foundation.
|
249 |
+
|
250 |
+
10. If you wish to incorporate parts of the Program into other free
|
251 |
+
programs whose distribution conditions are different, write to the author
|
252 |
+
to ask for permission. For software which is copyrighted by the Free
|
253 |
+
Software Foundation, write to the Free Software Foundation; we sometimes
|
254 |
+
make exceptions for this. Our decision will be guided by the two goals
|
255 |
+
of preserving the free status of all derivatives of our free software and
|
256 |
+
of promoting the sharing and reuse of software generally.
|
257 |
+
|
258 |
+
NO WARRANTY
|
259 |
+
|
260 |
+
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
261 |
+
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
262 |
+
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
263 |
+
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
264 |
+
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
265 |
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
266 |
+
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
267 |
+
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
268 |
+
REPAIR OR CORRECTION.
|
269 |
+
|
270 |
+
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
271 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
272 |
+
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
273 |
+
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
274 |
+
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
275 |
+
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
276 |
+
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
277 |
+
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
278 |
+
POSSIBILITY OF SUCH DAMAGES.
|
279 |
+
|
280 |
+
END OF TERMS AND CONDITIONS
|
281 |
+
|
282 |
+
How to Apply These Terms to Your New Programs
|
283 |
+
|
284 |
+
If you develop a new program, and you want it to be of the greatest
|
285 |
+
possible use to the public, the best way to achieve this is to make it
|
286 |
+
free software which everyone can redistribute and change under these terms.
|
287 |
+
|
288 |
+
To do so, attach the following notices to the program. It is safest
|
289 |
+
to attach them to the start of each source file to most effectively
|
290 |
+
convey the exclusion of warranty; and each file should have at least
|
291 |
+
the "copyright" line and a pointer to where the full notice is found.
|
292 |
+
|
293 |
+
<one line to give the program's name and a brief idea of what it does.>
|
294 |
+
Copyright (C) <year> <name of author>
|
295 |
+
|
296 |
+
This program is free software; you can redistribute it and/or modify
|
297 |
+
it under the terms of the GNU General Public License as published by
|
298 |
+
the Free Software Foundation; either version 2 of the License, or
|
299 |
+
(at your option) any later version.
|
300 |
+
|
301 |
+
This program is distributed in the hope that it will be useful,
|
302 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
303 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
304 |
+
GNU General Public License for more details.
|
305 |
+
|
306 |
+
You should have received a copy of the GNU General Public License along
|
307 |
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
308 |
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
309 |
+
|
310 |
+
Also add information on how to contact you by electronic and paper mail.
|
311 |
+
|
312 |
+
If the program is interactive, make it output a short notice like this
|
313 |
+
when it starts in an interactive mode:
|
314 |
+
|
315 |
+
Gnomovision version 69, Copyright (C) year name of author
|
316 |
+
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
317 |
+
This is free software, and you are welcome to redistribute it
|
318 |
+
under certain conditions; type `show c' for details.
|
319 |
+
|
320 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
321 |
+
parts of the General Public License. Of course, the commands you use may
|
322 |
+
be called something other than `show w' and `show c'; they could even be
|
323 |
+
mouse-clicks or menu items--whatever suits your program.
|
324 |
+
|
325 |
+
You should also get your employer (if you work as a programmer) or your
|
326 |
+
school, if any, to sign a "copyright disclaimer" for the program, if
|
327 |
+
necessary. Here is a sample; alter the names:
|
328 |
+
|
329 |
+
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
330 |
+
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
331 |
+
|
332 |
+
<signature of Ty Coon>, 1 April 1989
|
333 |
+
Ty Coon, President of Vice
|
334 |
+
|
335 |
+
This General Public License does not permit incorporating your program into
|
336 |
+
proprietary programs. If your program is a subroutine library, you may
|
337 |
+
consider it more useful to permit linking proprietary applications with the
|
338 |
+
library. If this is what you want to do, use the GNU Lesser General
|
339 |
+
Public License instead of this License.
|
includes/admin.php
ADDED
@@ -0,0 +1,2145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if( is_admin() ) {
|
3 |
+
|
4 |
+
// backend scripts
|
5 |
+
add_action( 'admin_enqueue_scripts', 'wooccm_admin_enqueue_scripts' );
|
6 |
+
// List of action links on the Plugins screen
|
7 |
+
add_filter( sprintf( 'plugin_action_links_%s', WOOCCM_RELPATH ), 'wooccm_admin_plugin_actions' );
|
8 |
+
// WordPress Settings screen for WooCheckout
|
9 |
+
add_action( 'admin_init', 'wooccm_register_settings' );
|
10 |
+
// WP Admin Actions
|
11 |
+
add_action( 'admin_init', 'wooccm_admin_actions' );
|
12 |
+
add_action( 'admin_init', 'wooccm_admin_woocheckout_actions' );
|
13 |
+
// Updater notice
|
14 |
+
add_action( 'admin_notices', 'wooccm_admin_notices' );
|
15 |
+
// Add fields to the Edit Order screen
|
16 |
+
add_action( 'woocommerce_admin_order_data_after_order_details', 'wooccm_admin_edit_order_additional_details' );
|
17 |
+
add_action( 'woocommerce_admin_order_data_after_billing_address', 'wooccm_admin_edit_order_billing_details' );
|
18 |
+
add_action( 'woocommerce_admin_order_data_after_shipping_address', 'wooccm_admin_edit_order_shipping_details' );
|
19 |
+
|
20 |
+
}
|
21 |
+
|
22 |
+
// Display admin notice on screen load
|
23 |
+
function wooccm_admin_notice( $message = '', $priority = 'updated', $screen = '' ) {
|
24 |
+
|
25 |
+
if( $priority == false || $priority == '' )
|
26 |
+
$priority = 'updated';
|
27 |
+
if( $message <> '' ) {
|
28 |
+
ob_start();
|
29 |
+
wooccm_admin_notice_html( $message, $priority, $screen );
|
30 |
+
$output = ob_get_contents();
|
31 |
+
ob_end_clean();
|
32 |
+
// Check if an existing notice is already in queue
|
33 |
+
$existing_notice = get_transient( WOOCCM_PREFIX . '_notice' );
|
34 |
+
if( $existing_notice !== false ) {
|
35 |
+
$existing_notice = base64_decode( $existing_notice );
|
36 |
+
$output = $existing_notice . $output;
|
37 |
+
}
|
38 |
+
set_transient( WOOCCM_PREFIX . '_notice', base64_encode( $output ), MINUTE_IN_SECONDS );
|
39 |
+
add_action( 'admin_notices', WOOCCM_PREFIX . '_admin_notice_print' );
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
// HTML template for admin notice
|
45 |
+
function wooccm_admin_notice_html( $message = '', $priority = 'updated', $screen = '' ) {
|
46 |
+
|
47 |
+
// Display admin notice on specific screen
|
48 |
+
if( !empty( $screen ) ) {
|
49 |
+
|
50 |
+
global $pagenow;
|
51 |
+
|
52 |
+
if( is_array( $screen ) ) {
|
53 |
+
if( in_array( $pagenow, $screen ) == false )
|
54 |
+
return;
|
55 |
+
} else {
|
56 |
+
if( $pagenow <> $screen )
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
+
} ?>
|
61 |
+
<div id="message" class="<?php echo $priority; ?>">
|
62 |
+
<p><?php echo $message; ?></p>
|
63 |
+
</div>
|
64 |
+
<?php
|
65 |
+
|
66 |
+
}
|
67 |
+
|
68 |
+
// Grabs the WordPress transient that holds the admin notice and prints it
|
69 |
+
function wooccm_admin_notice_print() {
|
70 |
+
|
71 |
+
$output = get_transient( WOOCCM_PREFIX . '_notice' );
|
72 |
+
if( $output !== false ) {
|
73 |
+
delete_transient( WOOCCM_PREFIX . '_notice' );
|
74 |
+
$output = base64_decode( $output );
|
75 |
+
echo $output;
|
76 |
+
}
|
77 |
+
|
78 |
+
}
|
79 |
+
|
80 |
+
// WordPress Administration menu
|
81 |
+
function wooccm_admin_menu() {
|
82 |
+
|
83 |
+
add_menu_page( 'WooCheckout', 'WooCheckout', 'manage_options', 'woocommerce-checkout-manager' , 'wooccm_options_page', 'dashicons-businessman', 57);
|
84 |
+
add_submenu_page( 'woocommerce-checkout-manager', 'Export', 'Export', 'manage_options', 'wooccm-advance-export', 'wooccm_advance_export' );
|
85 |
+
|
86 |
+
}
|
87 |
+
add_action( 'admin_menu', 'wooccm_admin_menu' );
|
88 |
+
|
89 |
+
function wooccm_admin_enqueue_scripts( $hook_suffix ) {
|
90 |
+
|
91 |
+
if( $hook_suffix == 'toplevel_page_woocommerce-checkout-manager' ) {
|
92 |
+
wp_enqueue_style( 'farbtastic' );
|
93 |
+
// @mod - We need to check that farbtastic exists
|
94 |
+
wp_enqueue_script( 'farbtastic', site_url( '/wp-admin/js/farbtastic.js' ) );
|
95 |
+
wp_enqueue_style( 'wooccm-backend-css', plugins_url( 'includes/pickers/css/backend_css.css', WOOCCM_RELPATH ) );
|
96 |
+
wp_enqueue_script( 'script_wccs', plugins_url( 'includes/templates/js/script_wccs.js', WOOCCM_RELPATH ), array( 'jquery' ), '1.2' );
|
97 |
+
wp_enqueue_script( 'billing_script_wccs', plugins_url( 'includes/templates/js/billing_script_wccs.js', WOOCCM_RELPATH ), array( 'jquery' ), '1.2' );
|
98 |
+
wp_enqueue_script( 'shipping_script_wccs', plugins_url( 'includes/templates/js/shipping_script_wccs.js', WOOCCM_RELPATH ), array( 'jquery' ), '1.2' );
|
99 |
+
if( wp_script_is( 'jquery-ui-sortable', 'queue' ) == false )
|
100 |
+
wp_enqueue_script('jquery-ui-sortable');
|
101 |
+
}
|
102 |
+
if( $hook_suffix === 'woocheckout_page_wooccm-advance-export' ) {
|
103 |
+
wp_enqueue_style( 'export', plugins_url( 'includes/templates/admin/woocheckout-export.css', WOOCCM_RELPATH ) );
|
104 |
+
}
|
105 |
+
|
106 |
+
}
|
107 |
+
|
108 |
+
// List of action links on the Plugins screen
|
109 |
+
function wooccm_admin_plugin_actions( $links ) {
|
110 |
+
|
111 |
+
$page_url = add_query_arg( 'page', 'woocommerce-checkout-manager', 'admin.php' );
|
112 |
+
$support_url = 'https://wordpress.org/support/plugin/woocommerce-checkout-manager/';
|
113 |
+
|
114 |
+
$plugin_links = array(
|
115 |
+
'<a href="' . $page_url . '">'.__('Settings', 'woocommerce-checkout-manager' ).'</a>',
|
116 |
+
'<a href="' . $support_url . '">'.__('Support', 'woocommerce-checkout-manager' ).'</a>',
|
117 |
+
);
|
118 |
+
return array_merge( $plugin_links, $links );
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
function wooccm_deactivate_plugin_conditional() {
|
123 |
+
|
124 |
+
$name = 'woocommerce-checkout-manager/woocommerce-checkout-manager.php';
|
125 |
+
if( !is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
126 |
+
add_action('admin_notices', 'wooccm_admin_notice_woo');
|
127 |
+
deactivate_plugins( $name );
|
128 |
+
}
|
129 |
+
|
130 |
+
}
|
131 |
+
add_action( 'admin_init', 'wooccm_deactivate_plugin_conditional' );
|
132 |
+
|
133 |
+
function wooccm_admin_notice_woo() {
|
134 |
+
|
135 |
+
$message = __( 'WooCommerce is not active. WooCommerce Checkout Manager requires WooCommerce to be active.', 'woocommerce-checkout-manager' );
|
136 |
+
echo '<div class="error"><p><strong>' . $message . '</strong></p></div>';
|
137 |
+
|
138 |
+
}
|
139 |
+
|
140 |
+
// Global actions
|
141 |
+
function wooccm_admin_actions() {
|
142 |
+
|
143 |
+
// Check the User has the manage_options capability
|
144 |
+
if( current_user_can( 'manage_options' ) == false )
|
145 |
+
return;
|
146 |
+
|
147 |
+
// Process any actions
|
148 |
+
$action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
|
149 |
+
switch( $action ) {
|
150 |
+
|
151 |
+
case 'wooccm_dismiss_beta_notice':
|
152 |
+
// We need to verify the nonce.
|
153 |
+
if( !empty( $_GET ) && check_admin_referer( 'wooccm_dismiss_beta_notice' ) ) {
|
154 |
+
add_option( WOOCCM_PREFIX . '_beta_notice', 1 );
|
155 |
+
$url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
|
156 |
+
wp_redirect( $url );
|
157 |
+
exit();
|
158 |
+
}
|
159 |
+
break;
|
160 |
+
|
161 |
+
case 'wooccm_dismiss_update_notice':
|
162 |
+
// We need to verify the nonce.
|
163 |
+
if( !empty( $_GET ) && check_admin_referer( 'wooccm_dismiss_update_notice' ) ) {
|
164 |
+
update_option( WOOCCM_PREFIX . '_update_notice', 1 );
|
165 |
+
$url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
|
166 |
+
wp_redirect( $url );
|
167 |
+
exit();
|
168 |
+
}
|
169 |
+
break;
|
170 |
+
|
171 |
+
}
|
172 |
+
|
173 |
+
}
|
174 |
+
|
175 |
+
// Actions limited to the WooCheckout screen
|
176 |
+
function wooccm_admin_woocheckout_actions() {
|
177 |
+
|
178 |
+
// Check the User has the manage_options capability
|
179 |
+
if( current_user_can( 'manage_options' ) == false )
|
180 |
+
return;
|
181 |
+
|
182 |
+
// Check that we are on the WooCheckout screen
|
183 |
+
$page = ( isset($_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : false );
|
184 |
+
if( $page != 'woocommerce-checkout-manager' )
|
185 |
+
return;
|
186 |
+
|
187 |
+
// Process any actions
|
188 |
+
$action = ( function_exists( 'woo_get_action' ) ? woo_get_action() : false );
|
189 |
+
switch( $action ) {
|
190 |
+
|
191 |
+
// Reset the Run the updater notice
|
192 |
+
case 'wooccm_reset_update_notice':
|
193 |
+
// We need to verify the nonce.
|
194 |
+
if( !empty( $_GET ) && check_admin_referer( 'wooccm_reset_update_notice' ) ) {
|
195 |
+
delete_option( WOOCCM_PREFIX . '_update_notice' );
|
196 |
+
$url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
|
197 |
+
wp_redirect( $url );
|
198 |
+
exit();
|
199 |
+
}
|
200 |
+
break;
|
201 |
+
|
202 |
+
case 'wooccm_nuke_options':
|
203 |
+
// We need to verify the nonce.
|
204 |
+
if( !empty( $_GET ) && check_admin_referer( 'wooccm_nuke_options' ) ) {
|
205 |
+
// Delete the default options
|
206 |
+
$options = array( 'settings', 'settings2', 'settings3' );
|
207 |
+
foreach( $options as $option )
|
208 |
+
delete_option( 'wccs_' . $option );
|
209 |
+
// Delete any notices
|
210 |
+
$notices = array( 'update_notice', 'beta_notice' );
|
211 |
+
foreach( $notices as $notice )
|
212 |
+
delete_option( WOOCCM_PREFIX . '_' . $notice );
|
213 |
+
$url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
|
214 |
+
wp_redirect( $url );
|
215 |
+
exit();
|
216 |
+
}
|
217 |
+
break;
|
218 |
+
|
219 |
+
case 'wooccm_nuke_order_meta':
|
220 |
+
// We need to verify the nonce.
|
221 |
+
if( !empty( $_GET ) && check_admin_referer( 'wooccm_nuke_order_meta' ) ) {
|
222 |
+
$post_type = 'shop_order';
|
223 |
+
$args = array(
|
224 |
+
'post_type' => $post_type,
|
225 |
+
'post_status' => ( function_exists( 'wc_get_order_statuses()' ) ? wc_get_order_statuses() : false ),
|
226 |
+
'fields' => 'ids',
|
227 |
+
'numberposts' => -1
|
228 |
+
);
|
229 |
+
$orders = get_posts( $args );
|
230 |
+
if( !empty( $orders ) ) {
|
231 |
+
// Prepare the Post meta name lists for only custom fields
|
232 |
+
$meta_keys = array();
|
233 |
+
|
234 |
+
// Additional section
|
235 |
+
$options = get_option( 'wccs_settings' );
|
236 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
237 |
+
if( !empty( $buttons ) ) {
|
238 |
+
foreach( $buttons as $btn ) {
|
239 |
+
if( strstr( $btn['cow'], 'myfield' ) )
|
240 |
+
$meta_keys[] = $btn['cow'];
|
241 |
+
}
|
242 |
+
}
|
243 |
+
// Billing section
|
244 |
+
$options = get_option( 'wccs_settings3' );
|
245 |
+
$buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
|
246 |
+
if( !empty( $buttons ) ) {
|
247 |
+
foreach( $buttons as $btn ) {
|
248 |
+
if( strstr( $btn['cow'], 'myfield' ) )
|
249 |
+
$meta_keys[] = sprintf( '_billing_%s', $btn['cow'] );
|
250 |
+
}
|
251 |
+
}
|
252 |
+
// Shipping section
|
253 |
+
$options = get_option( 'wccs_settings2' );
|
254 |
+
$buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
|
255 |
+
if( !empty( $buttons ) ) {
|
256 |
+
foreach( $buttons as $btn ) {
|
257 |
+
if( strstr( $btn['cow'], 'myfield' ) )
|
258 |
+
$meta_keys[] = sprintf( '_shipping_%s', $btn['cow'] );
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
// Do the deed
|
263 |
+
if( !empty( $meta_keys ) ) {
|
264 |
+
foreach( $orders as $order_id ) {
|
265 |
+
if( !empty( $order_id ) ) {
|
266 |
+
foreach( $meta_keys as $meta_key )
|
267 |
+
delete_post_meta( $order_id, $meta_key );
|
268 |
+
}
|
269 |
+
}
|
270 |
+
}
|
271 |
+
}
|
272 |
+
$url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
|
273 |
+
wp_redirect( $url );
|
274 |
+
exit();
|
275 |
+
}
|
276 |
+
break;
|
277 |
+
|
278 |
+
case 'wooccm_nuke_user_meta':
|
279 |
+
// We need to verify the nonce.
|
280 |
+
if( !empty( $_GET ) && check_admin_referer( 'wooccm_nuke_user_meta' ) ) {
|
281 |
+
$args = array(
|
282 |
+
'fields' => array( 'ID' )
|
283 |
+
);
|
284 |
+
$users = get_users( $args );
|
285 |
+
if( !empty( $users ) ) {
|
286 |
+
// Prepare the Post meta name lists for only custom fields
|
287 |
+
$meta_keys = array();
|
288 |
+
|
289 |
+
// Additional section
|
290 |
+
$options = get_option( 'wccs_settings' );
|
291 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
292 |
+
if( !empty( $buttons ) ) {
|
293 |
+
foreach( $buttons as $btn ) {
|
294 |
+
if( strstr( $btn['cow'], 'myfield' ) )
|
295 |
+
$meta_keys[] = $btn['cow'];
|
296 |
+
}
|
297 |
+
}
|
298 |
+
// Billing section
|
299 |
+
$options = get_option( 'wccs_settings3' );
|
300 |
+
$buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
|
301 |
+
if( !empty( $buttons ) ) {
|
302 |
+
foreach( $buttons as $btn ) {
|
303 |
+
if( strstr( $btn['cow'], 'myfield' ) )
|
304 |
+
$meta_keys[] = sprintf( 'billing_%s', $btn['cow'] );
|
305 |
+
}
|
306 |
+
}
|
307 |
+
// Shipping section
|
308 |
+
$options = get_option( 'wccs_settings2' );
|
309 |
+
$buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
|
310 |
+
if( !empty( $buttons ) ) {
|
311 |
+
foreach( $buttons as $btn ) {
|
312 |
+
if( strstr( $btn['cow'], 'myfield' ) )
|
313 |
+
$meta_keys[] = sprintf( 'shipping_%s', $btn['cow'] );
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
+
// Do the deed
|
318 |
+
if( !empty( $meta_keys ) ) {
|
319 |
+
foreach( $users as $user_id ) {
|
320 |
+
foreach( $meta_keys as $meta_key )
|
321 |
+
delete_user_meta( $user_id->ID, $meta_key );
|
322 |
+
}
|
323 |
+
}
|
324 |
+
}
|
325 |
+
$url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
|
326 |
+
wp_redirect( $url );
|
327 |
+
exit();
|
328 |
+
}
|
329 |
+
break;
|
330 |
+
|
331 |
+
case 'wooccm_dismiss_beta_notice':
|
332 |
+
// We need to verify the nonce.
|
333 |
+
if( !empty( $_GET ) && check_admin_referer( 'wooccm_dismiss_beta_notice' ) ) {
|
334 |
+
add_option( WOOCCM_PREFIX . '_beta_notice', 1 );
|
335 |
+
$url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
|
336 |
+
wp_redirect( $url );
|
337 |
+
exit();
|
338 |
+
}
|
339 |
+
break;
|
340 |
+
|
341 |
+
case 'wooccm_dismiss_update_notice':
|
342 |
+
// We need to verify the nonce.
|
343 |
+
if( !empty( $_GET ) && check_admin_referer( 'wooccm_dismiss_update_notice' ) ) {
|
344 |
+
add_option( WOOCCM_PREFIX . '_update_notice', 1 );
|
345 |
+
$url = add_query_arg( array( 'action' => null, '_wpnonce' => null ) );
|
346 |
+
wp_redirect( $url );
|
347 |
+
exit();
|
348 |
+
}
|
349 |
+
break;
|
350 |
+
|
351 |
+
}
|
352 |
+
|
353 |
+
}
|
354 |
+
|
355 |
+
if( !function_exists( 'woo_get_action' ) ) {
|
356 |
+
function woo_get_action( $prefer_get = false ) {
|
357 |
+
|
358 |
+
if ( isset( $_GET['action'] ) && $prefer_get )
|
359 |
+
return sanitize_text_field( $_GET['action'] );
|
360 |
+
|
361 |
+
if ( isset( $_POST['action'] ) )
|
362 |
+
return sanitize_text_field( $_POST['action'] );
|
363 |
+
|
364 |
+
if ( isset( $_GET['action'] ) )
|
365 |
+
return sanitize_text_field( $_GET['action'] );
|
366 |
+
|
367 |
+
return;
|
368 |
+
|
369 |
+
}
|
370 |
+
}
|
371 |
+
|
372 |
+
// WordPress Settings screen for WooCheckout
|
373 |
+
function wooccm_register_settings() {
|
374 |
+
|
375 |
+
register_setting( 'wccs_options', 'wccs_settings', 'wooccm_options_validate' );
|
376 |
+
register_setting( 'wccs_options2', 'wccs_settings2', 'wooccm_options_validate_shipping' );
|
377 |
+
register_setting( 'wccs_options3', 'wccs_settings3', 'wooccm_options_validate_billing' );
|
378 |
+
|
379 |
+
}
|
380 |
+
|
381 |
+
function wooccm_options_page() {
|
382 |
+
|
383 |
+
if ( !current_user_can('manage_options') )
|
384 |
+
wp_die( __('You do not have sufficient permissions to access this page.', 'woocommerce-checkout-manager') );
|
385 |
+
|
386 |
+
$htmlshippingabbr = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' );
|
387 |
+
$htmlbillingabbr = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'email', 'phone' );
|
388 |
+
$upload_dir = wp_upload_dir();
|
389 |
+
$hidden_field_name = 'mccs_submit_hidden';
|
390 |
+
$hidden_wccs_reset = "my_new_field_reset";
|
391 |
+
$options = get_option( 'wccs_settings' );
|
392 |
+
$options2 = get_option( 'wccs_settings2' );
|
393 |
+
$options3 = get_option( 'wccs_settings3' );
|
394 |
+
|
395 |
+
// Check if the reset button has been clicked
|
396 |
+
if( isset($_POST[ $hidden_wccs_reset ]) && sanitize_text_field( $_POST[ $hidden_wccs_reset ] ) == 'Y' ) {
|
397 |
+
delete_option('wccs_settings');
|
398 |
+
delete_option('wccs_settings2');
|
399 |
+
delete_option('wccs_settings3');
|
400 |
+
$defaults = array(
|
401 |
+
'checkness' => array(
|
402 |
+
'position' => 'after_billing_form',
|
403 |
+
'wooccm_notification_email' => get_option( 'admin_email' ),
|
404 |
+
'payment_method_t' => true,
|
405 |
+
'shipping_method_t' => true,
|
406 |
+
'payment_method_d' => __( 'Payment Method','woocommerce-checkout-manager' ),
|
407 |
+
'shipping_method_d' => __( 'Shipping Method','woocommerce-checkout-manager' ),
|
408 |
+
'time_stamp_title' => __( 'Order Time','woocommerce-checkout-manager' ),
|
409 |
+
),
|
410 |
+
);
|
411 |
+
|
412 |
+
$shipping = array(
|
413 |
+
'country' => __( 'Country', 'woocommerce-checkout-manager' ),
|
414 |
+
'first_name' => __( 'First Name', 'woocommerce-checkout-manager' ),
|
415 |
+
'last_name' => __( 'Last Name', 'woocommerce-checkout-manager' ),
|
416 |
+
'company' => __( 'Company Name', 'woocommerce-checkout-manager' ),
|
417 |
+
'address_1' => __( 'Address', 'woocommerce-checkout-manager' ),
|
418 |
+
'address_2' => '',
|
419 |
+
'city' => __( 'Town/ City', 'woocommerce-checkout-manager' ),
|
420 |
+
'state' => __( 'State', 'woocommerce-checkout-manager' ),
|
421 |
+
'postcode' => __( 'Zip', 'woocommerce-checkout-manager' )
|
422 |
+
);
|
423 |
+
$ship = 0;
|
424 |
+
foreach( $shipping as $name => $value ) {
|
425 |
+
|
426 |
+
$defaults2['shipping_buttons'][$ship]['label'] = __( $value, 'woocommerce-checkout-manager' );
|
427 |
+
$defaults2['shipping_buttons'][$ship]['cow'] = $name;
|
428 |
+
$defaults2['shipping_buttons'][$ship]['checkbox'] = 'true';
|
429 |
+
$defaults2['shipping_buttons'][$ship]['order'] = $ship + 1;
|
430 |
+
$defaults2['shipping_buttons'][$ship]['type'] = 'wooccmtext';
|
431 |
+
|
432 |
+
switch( $name ) {
|
433 |
+
|
434 |
+
case 'country':
|
435 |
+
$defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
|
436 |
+
break;
|
437 |
+
|
438 |
+
case 'first_name':
|
439 |
+
$defaults2['shipping_buttons'][$ship]['position'] = 'form-row-first';
|
440 |
+
break;
|
441 |
+
|
442 |
+
case 'last_name':
|
443 |
+
$defaults2['shipping_buttons'][$ship]['position'] = 'form-row-last';
|
444 |
+
$defaults2['shipping_buttons'][$ship]['clear_row'] = true;
|
445 |
+
break;
|
446 |
+
|
447 |
+
case 'company':
|
448 |
+
$defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
|
449 |
+
break;
|
450 |
+
|
451 |
+
case 'address_1':
|
452 |
+
$defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
|
453 |
+
$defaults2['shipping_buttons'][$ship]['placeholder'] = __('Street address', 'woocommerce-checkout-manager');
|
454 |
+
break;
|
455 |
+
|
456 |
+
case 'address_2':
|
457 |
+
$defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
|
458 |
+
$defaults2['shipping_buttons'][$ship]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce-checkout-manager');
|
459 |
+
break;
|
460 |
+
|
461 |
+
case 'city':
|
462 |
+
$defaults2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
|
463 |
+
$defaults2['shipping_buttons'][$ship]['placeholder'] = __('Town / City', 'woocommerce-checkout-manager');
|
464 |
+
break;
|
465 |
+
|
466 |
+
case 'state':
|
467 |
+
$defaults2['shipping_buttons'][$ship]['position'] = 'form-row-first';
|
468 |
+
break;
|
469 |
+
|
470 |
+
}
|
471 |
+
|
472 |
+
$ship++;
|
473 |
+
|
474 |
+
}
|
475 |
+
|
476 |
+
$billing = array(
|
477 |
+
'country' => __( 'Country', 'woocommerce-checkout-manager' ),
|
478 |
+
'first_name' => __( 'First Name', 'woocommerce-checkout-manager' ),
|
479 |
+
'last_name' => __( 'Last Name', 'woocommerce-checkout-manager' ),
|
480 |
+
'company' => __( 'Company Name', 'woocommerce-checkout-manager' ),
|
481 |
+
'address_1' => __( 'Address', 'woocommerce-checkout-manager' ),
|
482 |
+
'address_2' => '',
|
483 |
+
'city' => __( 'Town/ City', 'woocommerce-checkout-manager' ),
|
484 |
+
'state' => __( 'State', 'woocommerce-checkout-manager' ),
|
485 |
+
'postcode' => __( 'Zip', 'woocommerce-checkout-manager' ),
|
486 |
+
'email' => __( 'Email Address', 'woocommerce-checkout-manager' ),
|
487 |
+
'phone' => __( 'Phone', 'woocommerce-checkout-manager' )
|
488 |
+
);
|
489 |
+
|
490 |
+
$bill = 0;
|
491 |
+
|
492 |
+
foreach( $billing as $name => $value ) {
|
493 |
+
|
494 |
+
$defaults3['billing_buttons'][$bill]['label'] = __( $value, 'woocommerce-checkout-manager' );
|
495 |
+
$defaults3['billing_buttons'][$bill]['cow'] = $name;
|
496 |
+
$defaults3['billing_buttons'][$bill]['checkbox'] = 'true';
|
497 |
+
$defaults3['billing_buttons'][$bill]['order'] = $bill + 1;
|
498 |
+
$defaults3['billing_buttons'][$bill]['type'] = 'wooccmtext';
|
499 |
+
|
500 |
+
switch( $name ) {
|
501 |
+
|
502 |
+
case 'country':
|
503 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
|
504 |
+
break;
|
505 |
+
|
506 |
+
case 'first_name':
|
507 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-first';
|
508 |
+
break;
|
509 |
+
|
510 |
+
case 'last_name':
|
511 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-last';
|
512 |
+
$defaults3['billing_buttons'][$bill]['clear_row'] = true;
|
513 |
+
break;
|
514 |
+
|
515 |
+
case 'company':
|
516 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
|
517 |
+
break;
|
518 |
+
|
519 |
+
case 'address_1':
|
520 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
|
521 |
+
$defaults3['billing_buttons'][$bill]['placeholder'] = __('Street address', 'woocommerce-checkout-manager');
|
522 |
+
break;
|
523 |
+
|
524 |
+
case 'address_2':
|
525 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
|
526 |
+
$defaults3['billing_buttons'][$bill]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce-checkout-manager');
|
527 |
+
break;
|
528 |
+
|
529 |
+
case 'city':
|
530 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-wide';
|
531 |
+
$defaults3['billing_buttons'][$bill]['placeholder'] = __('Town / City', 'woocommerce-checkout-manager');
|
532 |
+
break;
|
533 |
+
|
534 |
+
case 'state':
|
535 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-first';
|
536 |
+
break;
|
537 |
+
|
538 |
+
case 'postcode':
|
539 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-last';
|
540 |
+
$defaults3['billing_buttons'][$bill]['placeholder'] = __('Postcode / Zip', 'woocommerce-checkout-manager');
|
541 |
+
$defaults3['billing_buttons'][$bill]['clear_row'] = true;
|
542 |
+
break;
|
543 |
+
|
544 |
+
case 'email':
|
545 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-first';
|
546 |
+
break;
|
547 |
+
|
548 |
+
case 'phone':
|
549 |
+
$defaults3['billing_buttons'][$bill]['position'] = 'form-row-last';
|
550 |
+
$defaults3['billing_buttons'][$bill]['clear_row'] = true;
|
551 |
+
break;
|
552 |
+
|
553 |
+
}
|
554 |
+
|
555 |
+
$bill++;
|
556 |
+
|
557 |
+
}
|
558 |
+
add_option( 'wccs_settings' , $defaults );
|
559 |
+
add_option( 'wccs_settings2' , $defaults2 );
|
560 |
+
add_option( 'wccs_settings3' , $defaults3 );
|
561 |
+
|
562 |
+
// @mod - Change this to add_query_arg()
|
563 |
+
echo '
|
564 |
+
<script type="text/javascript">window.location.href="'.$_SERVER['PHP_SELF'].'?page=woocommerce-checkout-manager";</script>';
|
565 |
+
echo '
|
566 |
+
<noscript><meta http-equiv="refresh" content="0;url='.$_SERVER['PHP_SELF'].'?page=woocommerce-checkout-manager" /></noscript>';
|
567 |
+
exit;
|
568 |
+
|
569 |
+
}
|
570 |
+
echo '
|
571 |
+
<script type="text/javascript" src="'.plugins_url( '/woocommerce/assets/js/jquery-blockui/jquery.blockUI.js' ).'"></script>';
|
572 |
+
echo '
|
573 |
+
<div class="refreshwooccm">
|
574 |
+
';
|
575 |
+
|
576 |
+
// display error
|
577 |
+
settings_errors();
|
578 |
+
|
579 |
+
// Now display the settings editing screen
|
580 |
+
|
581 |
+
// header
|
582 |
+
?>
|
583 |
+
<h2><?php _e( 'WooCommerce Checkout Manager', 'woocommerce-checkout-manager' ); ?></h2>
|
584 |
+
<div id="content">
|
585 |
+
|
586 |
+
<h2 class="nav-tab-wrapper add_tip_wrap">
|
587 |
+
<a class="nav-tab general-tab nav-tab-active"><?php _e( 'General', 'woocommerce-checkout-manager' ); ?></a>
|
588 |
+
<a class="nav-tab billing-tab"><?php _e( 'Billing', 'woocommerce-checkout-manager' ); ?></a>
|
589 |
+
<a class="nav-tab shipping-tab"><?php _e( 'Shipping', 'woocommerce-checkout-manager' ); ?></a>
|
590 |
+
<a class="nav-tab additional-tab"><?php _e( 'Additional', 'woocommerce-checkout-manager' ); ?></a>
|
591 |
+
<a class="nav-tab star" href="https://wordpress.org/support/view/plugin-reviews/woocommerce-checkout-manager?filter=5" target="_blank">
|
592 |
+
<div id="star-five" title="<?php _e('Like the plugin? Rate it! On WordPress.org', 'woocommerce-checkout-manager' ); ?>">
|
593 |
+
<div class="star-rating">
|
594 |
+
<div class="star star-full"></div>
|
595 |
+
<div class="star star-full"></div>
|
596 |
+
<div class="star star-full"></div>
|
597 |
+
<div class="star star-full"></div>
|
598 |
+
<div class="star star-full"></div>
|
599 |
+
</div>
|
600 |
+
<!-- .star-rating -->
|
601 |
+
</div>
|
602 |
+
<!-- #star-five -->
|
603 |
+
</a>
|
604 |
+
</h2>
|
605 |
+
<!-- .nav-tab-wrapper -->
|
606 |
+
|
607 |
+
<?php do_action('wooccm_run_color_innerpicker'); ?>
|
608 |
+
|
609 |
+
<form name="reset_form" class="reset_form" method="post" action="">
|
610 |
+
<input type="hidden" name="<?php echo esc_attr( $hidden_wccs_reset ); ?>" value="Y">
|
611 |
+
<input type="submit" name="submit" id="wccs_reset_submit" class="button button-hero" value="Reset">
|
612 |
+
</form>
|
613 |
+
<script type="text/javascript">
|
614 |
+
jQuery( '#wccs_reset_submit' ).click( 'click', function() {
|
615 |
+
return window.confirm( '<?php echo esc_js( __( 'Are you sure you wish to reset the settings on this tab for WooCommerce Checkout Manager?', 'woocommerce-checkout-manager' ) ); ?>' );
|
616 |
+
});
|
617 |
+
</script>
|
618 |
+
|
619 |
+
<?php require( WOOCCM_PATH.'includes/classes/import.php'); ?>
|
620 |
+
|
621 |
+
<div class="wrap">
|
622 |
+
|
623 |
+
<!-- Shipping section -->
|
624 |
+
<form name="wooccmform2" method="post" action="options.php" id="frm2">
|
625 |
+
|
626 |
+
<?php settings_fields( 'wccs_options2' ); ?>
|
627 |
+
|
628 |
+
<input type="submit" id="wccs_submit_button" style="display:none;" name="Submit" class="save-shipping wccs_submit_button button button-primary button-hero" value="<?php _e( 'Save Changes', 'woocommerce-checkout-manager' ); ?>" />
|
629 |
+
|
630 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-shipping.php' ); ?>
|
631 |
+
|
632 |
+
</form>
|
633 |
+
<!-- #frm2 -->
|
634 |
+
|
635 |
+
<!-- Billing section -->
|
636 |
+
<form name="wooccmform3" method="post" action="options.php" id="frm3">
|
637 |
+
|
638 |
+
<?php settings_fields( 'wccs_options3' ); ?>
|
639 |
+
|
640 |
+
<input type="submit" id="wccs_submit_button" name="Submit" style="display:none;" class="save-billing wccs_submit_button button button-primary button-hero" value="<?php _e( 'Save Changes', 'woocommerce-checkout-manager' ); ?>" />
|
641 |
+
|
642 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-billing.php' ); ?>
|
643 |
+
|
644 |
+
</form>
|
645 |
+
<!-- #frm3 -->
|
646 |
+
|
647 |
+
<!-- Additional section -->
|
648 |
+
<form name="wooccmform" method="post" action="options.php" id="frm1">
|
649 |
+
|
650 |
+
<?php settings_fields( 'wccs_options' ); ?>
|
651 |
+
|
652 |
+
<input type="submit" id="wccs_submit_button" name="Submit" class="save-additional wccs_submit_button button button-primary button-hero" value="<?php _e( 'Save Changes', 'woocommerce-checkout-manager' ); ?>" />
|
653 |
+
|
654 |
+
<!-- Additional section -->
|
655 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-additional.php' ); ?>
|
656 |
+
|
657 |
+
<!-- General section -->
|
658 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-general.php' ); ?>
|
659 |
+
|
660 |
+
</form>
|
661 |
+
<!-- #frm1 -->
|
662 |
+
|
663 |
+
</div>
|
664 |
+
<!-- .wrap -->
|
665 |
+
|
666 |
+
</div>
|
667 |
+
<!-- #content -->
|
668 |
+
|
669 |
+
</div>
|
670 |
+
<!-- #refreshwooccm -->
|
671 |
+
|
672 |
+
<?php
|
673 |
+
|
674 |
+
}
|
675 |
+
|
676 |
+
function wooccm_options_validate( $input ) {
|
677 |
+
|
678 |
+
$detect_error = 0;
|
679 |
+
// translate additional fields
|
680 |
+
if( !empty($input['buttons']) ) {
|
681 |
+
foreach( $input['buttons'] as $i => $btn ) {
|
682 |
+
|
683 |
+
if( function_exists( 'icl_register_string' ) ) {
|
684 |
+
if( !empty($btn['label']) ) {
|
685 |
+
icl_register_string( 'WooCommerce Checkout Manager', $btn['label'], $btn['label'] );
|
686 |
+
}
|
687 |
+
if( !empty($btn['placeholder']) ) {
|
688 |
+
icl_register_string( 'WooCommerce Checkout Manager', $btn['placeholder'], $btn['placeholder'] );
|
689 |
+
}
|
690 |
+
|
691 |
+
if( !empty($btn['option_array']) ) {
|
692 |
+
$mysecureop = explode( '||', $btn['option_array']);
|
693 |
+
foreach ( $mysecureop as $one ) {
|
694 |
+
icl_register_string( 'WooCommerce Checkout Manager', $one, $one );
|
695 |
+
}
|
696 |
+
}
|
697 |
+
}
|
698 |
+
|
699 |
+
if( !empty($btn['role_options']) && !empty($btn['role_options2']) ) {
|
700 |
+
$input['buttons'][$i]['role_options2'] = '';
|
701 |
+
add_settings_error(
|
702 |
+
'wooccm_settings_errors',
|
703 |
+
esc_attr( 'settings_updated' ),
|
704 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both role options. OK.', 'woocommerce-checkout-manager' ),
|
705 |
+
'error'
|
706 |
+
);
|
707 |
+
}
|
708 |
+
|
709 |
+
if( !empty($btn['single_p']) && !empty($btn['single_px']) ) {
|
710 |
+
$input['buttons'][$i]['single_px'] = '';
|
711 |
+
add_settings_error(
|
712 |
+
'wooccm_settings_errors',
|
713 |
+
esc_attr( 'settings_updated' ),
|
714 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden product options. OK.', 'woocommerce-checkout-manager' ),
|
715 |
+
'error'
|
716 |
+
);
|
717 |
+
}
|
718 |
+
|
719 |
+
if( !empty($btn['single_p_cat']) && !empty($btn['single_px_cat']) ) {
|
720 |
+
$input['buttons'][$i]['single_px_cat'] = '';
|
721 |
+
add_settings_error(
|
722 |
+
'wooccm_settings_errors',
|
723 |
+
esc_attr( 'settings_updated' ),
|
724 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden category options. OK.', 'woocommerce-checkout-manager' ),
|
725 |
+
'error'
|
726 |
+
);
|
727 |
+
}
|
728 |
+
|
729 |
+
if( empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
730 |
+
unset( $input['buttons'][$i] );
|
731 |
+
|
732 |
+
if( $i != 999 ) {
|
733 |
+
$detect_error++;
|
734 |
+
$fieldnum = $i + 1;
|
735 |
+
add_settings_error(
|
736 |
+
'wooccm_settings_errors',
|
737 |
+
esc_attr( 'settings_updated' ),
|
738 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Additional field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
|
739 |
+
'error'
|
740 |
+
);
|
741 |
+
}
|
742 |
+
}
|
743 |
+
|
744 |
+
if ( empty( $btn['cow'] ) && (!empty( $btn['label'] ) || !empty( $btn['placeholder'] )) ) {
|
745 |
+
$newNum = $i + 1;
|
746 |
+
if( wooccm_mul_array( 'myfield'.$newNum , $input['buttons'] ) ) {
|
747 |
+
$input['buttons'][$i]['cow'] = 'myfield'.$newNum.'c';
|
748 |
+
} else {
|
749 |
+
$input['buttons'][$i]['cow'] = 'myfield'.$newNum;
|
750 |
+
}
|
751 |
+
}
|
752 |
+
|
753 |
+
if( !empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
754 |
+
unset( $input['buttons'][$i] );
|
755 |
+
|
756 |
+
if( $i != 999 ) {
|
757 |
+
$detect_error++;
|
758 |
+
$fieldnum = $i + 1;
|
759 |
+
add_settings_error(
|
760 |
+
'wooccm_settings_errors',
|
761 |
+
esc_attr( 'settings_updated' ),
|
762 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Additional field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
|
763 |
+
'error'
|
764 |
+
);
|
765 |
+
}
|
766 |
+
}
|
767 |
+
|
768 |
+
}
|
769 |
+
}
|
770 |
+
if( $detect_error == 0 ) {
|
771 |
+
add_settings_error(
|
772 |
+
'wooccm_settings_errors',
|
773 |
+
esc_attr( 'settings_updated' ),
|
774 |
+
__( 'Your changes have been saved.', 'woocommerce-checkout-manager' ),
|
775 |
+
'updated'
|
776 |
+
);
|
777 |
+
}
|
778 |
+
return $input;
|
779 |
+
|
780 |
+
}
|
781 |
+
|
782 |
+
function wooccm_options_validate_shipping( $input ) {
|
783 |
+
|
784 |
+
$detect_error = 0;
|
785 |
+
// translate shipping fields
|
786 |
+
if( !empty( $input['shipping_buttons'] ) ) {
|
787 |
+
foreach( $input['shipping_buttons'] as $i => $btn ) {
|
788 |
+
|
789 |
+
if( function_exists( 'icl_register_string' ) ) {
|
790 |
+
if( !empty($btn['label']) ) {
|
791 |
+
icl_register_string( 'WooCommerce Checkout Manager', $btn['label'], $btn['label'] );
|
792 |
+
}
|
793 |
+
if( !empty($btn['placeholder']) ) {
|
794 |
+
icl_register_string( 'WooCommerce Checkout Manager', $btn['placeholder'], $btn['placeholder'] );
|
795 |
+
}
|
796 |
+
|
797 |
+
if( !empty($btn['option_array']) ) {
|
798 |
+
$mysecureop = explode( '||', $btn['option_array']);
|
799 |
+
foreach( $mysecureop as $one ) {
|
800 |
+
icl_register_string( 'WooCommerce Checkout Manager', $one, $one );
|
801 |
+
}
|
802 |
+
}
|
803 |
+
}
|
804 |
+
|
805 |
+
if( !empty($btn['role_options']) && !empty($btn['role_options2']) ) {
|
806 |
+
$input['buttons'][$i]['role_options2'] = '';
|
807 |
+
add_settings_error(
|
808 |
+
'wooccm_settings_errors',
|
809 |
+
esc_attr( 'settings_updated' ),
|
810 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both role options.', 'woocommerce-checkout-manager' ),
|
811 |
+
'error'
|
812 |
+
);
|
813 |
+
}
|
814 |
+
|
815 |
+
if( !empty($btn['single_p']) && !empty($btn['single_px']) ) {
|
816 |
+
$input['buttons'][$i]['single_px'] = '';
|
817 |
+
add_settings_error(
|
818 |
+
'wooccm_settings_errors',
|
819 |
+
esc_attr( 'settings_updated' ),
|
820 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden product options.', 'woocommerce-checkout-manager' ),
|
821 |
+
'error'
|
822 |
+
);
|
823 |
+
}
|
824 |
+
|
825 |
+
if( !empty($btn['single_p_cat']) && !empty($btn['single_px_cat']) ) {
|
826 |
+
$input['buttons'][$i]['single_px_cat'] = '';
|
827 |
+
add_settings_error(
|
828 |
+
'wooccm_settings_errors',
|
829 |
+
esc_attr( 'settings_updated' ),
|
830 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden category options.', 'woocommerce-checkout-manager' ),
|
831 |
+
'error'
|
832 |
+
);
|
833 |
+
}
|
834 |
+
|
835 |
+
if( empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
836 |
+
unset( $input['shipping_buttons'][$i] );
|
837 |
+
|
838 |
+
if( $i != 999 ) {
|
839 |
+
$detect_error++;
|
840 |
+
$fieldnum = $i + 1;
|
841 |
+
add_settings_error(
|
842 |
+
'wooccm_settings_errors',
|
843 |
+
esc_attr( 'settings_updated' ),
|
844 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Shipping field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
|
845 |
+
'error'
|
846 |
+
);
|
847 |
+
}
|
848 |
+
}
|
849 |
+
|
850 |
+
if( empty( $btn['cow'] ) && (!empty( $btn['label'] ) || !empty( $btn['placeholder'] )) ) {
|
851 |
+
$newNum = $i + 1;
|
852 |
+
if( wooccm_mul_array( 'myfield'.$newNum , $input['shipping_buttons'] ) ) {
|
853 |
+
$input['shipping_buttons'][$i]['cow'] = 'myfield'.$newNum.'c';
|
854 |
+
} else {
|
855 |
+
$input['shipping_buttons'][$i]['cow'] = 'myfield'.$newNum;
|
856 |
+
}
|
857 |
+
}
|
858 |
+
|
859 |
+
if( !empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
860 |
+
unset( $input['shipping_buttons'][$i] );
|
861 |
+
|
862 |
+
if( $i != 999 ) {
|
863 |
+
$detect_error++;
|
864 |
+
$fieldnum = $i + 1;
|
865 |
+
add_settings_error(
|
866 |
+
'wooccm_settings_errors',
|
867 |
+
esc_attr( 'settings_updated' ),
|
868 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Shipping field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
|
869 |
+
'error'
|
870 |
+
);
|
871 |
+
}
|
872 |
+
}
|
873 |
+
|
874 |
+
}
|
875 |
+
}
|
876 |
+
|
877 |
+
if( $detect_error == 0 ) {
|
878 |
+
add_settings_error(
|
879 |
+
'wooccm_settings_errors',
|
880 |
+
esc_attr( 'settings_updated' ),
|
881 |
+
__( 'Your changes have been saved.', 'woocommerce-checkout-manager' ),
|
882 |
+
'updated'
|
883 |
+
);
|
884 |
+
}
|
885 |
+
|
886 |
+
return $input;
|
887 |
+
|
888 |
+
}
|
889 |
+
|
890 |
+
function wooccm_options_validate_billing( $input ) {
|
891 |
+
|
892 |
+
$detect_error = 0;
|
893 |
+
|
894 |
+
// translate billing fields
|
895 |
+
if( !empty($input['billing_buttons']) ) {
|
896 |
+
foreach( $input['billing_buttons'] as $i => $btn ) {
|
897 |
+
|
898 |
+
if( function_exists( 'icl_register_string' ) ) {
|
899 |
+
if( !empty($btn['label']) ) {
|
900 |
+
icl_register_string( 'WooCommerce Checkout Manager', $btn['label'], $btn['label']);
|
901 |
+
}
|
902 |
+
if( !empty($btn['placeholder']) ) {
|
903 |
+
icl_register_string( 'WooCommerce Checkout Manager', $btn['placeholder'], $btn['placeholder']);
|
904 |
+
}
|
905 |
+
|
906 |
+
if ( !empty($btn['option_array']) ) {
|
907 |
+
$mysecureop = explode( '||', $btn['option_array']);
|
908 |
+
foreach( $mysecureop as $one ) {
|
909 |
+
icl_register_string( 'WooCommerce Checkout Manager', $one, $one );
|
910 |
+
}
|
911 |
+
}
|
912 |
+
}
|
913 |
+
|
914 |
+
if( !empty($btn['role_options']) && !empty($btn['role_options2']) ) {
|
915 |
+
$input['buttons'][$i]['role_options2'] = '';
|
916 |
+
add_settings_error(
|
917 |
+
'wooccm_settings_errors',
|
918 |
+
esc_attr( 'settings_updated' ),
|
919 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both role options.', 'woocommerce-checkout-manager' ),
|
920 |
+
'error'
|
921 |
+
);
|
922 |
+
}
|
923 |
+
|
924 |
+
if( !empty($btn['single_p']) && !empty($btn['single_px']) ) {
|
925 |
+
$input['buttons'][$i]['single_px'] = '';
|
926 |
+
add_settings_error(
|
927 |
+
'wooccm_settings_errors',
|
928 |
+
esc_attr( 'settings_updated' ),
|
929 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden product options.', 'woocommerce-checkout-manager' ),
|
930 |
+
'error'
|
931 |
+
);
|
932 |
+
}
|
933 |
+
|
934 |
+
if( !empty($btn['single_p_cat']) && !empty($btn['single_px_cat']) ) {
|
935 |
+
$input['buttons'][$i]['single_px_cat'] = '';
|
936 |
+
add_settings_error(
|
937 |
+
'wooccm_settings_errors',
|
938 |
+
esc_attr( 'settings_updated' ),
|
939 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager requires you to not have values in both hidden category options.', 'woocommerce-checkout-manager' ),
|
940 |
+
'error'
|
941 |
+
);
|
942 |
+
}
|
943 |
+
|
944 |
+
if( empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
945 |
+
unset( $input['billing_buttons'][$i] );
|
946 |
+
|
947 |
+
if( $i != 999 ) {
|
948 |
+
$detect_error++;
|
949 |
+
$fieldnum = $i + 1;
|
950 |
+
add_settings_error(
|
951 |
+
'wooccm_settings_errors',
|
952 |
+
esc_attr( 'settings_updated' ),
|
953 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Billing field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
|
954 |
+
'error'
|
955 |
+
);
|
956 |
+
}
|
957 |
+
}
|
958 |
+
|
959 |
+
if( empty( $btn['cow'] ) && (!empty( $btn['label'] ) || !empty( $btn['placeholder'] )) ) {
|
960 |
+
$newNum = $i + 1;
|
961 |
+
if( wooccm_mul_array( 'myfield'.$newNum, $input['billing_buttons'] ) ) {
|
962 |
+
$input['billing_buttons'][$i]['cow'] = 'myfield'.$newNum.'c';
|
963 |
+
} else {
|
964 |
+
$input['billing_buttons'][$i]['cow'] = 'myfield'.$newNum;
|
965 |
+
}
|
966 |
+
}
|
967 |
+
|
968 |
+
if( !empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
969 |
+
$detect_error++;
|
970 |
+
unset( $input['billing_buttons'][$i] );
|
971 |
+
|
972 |
+
if( $i != 999 ) {
|
973 |
+
$detect_error++;
|
974 |
+
$fieldnum = $i + 1;
|
975 |
+
add_settings_error(
|
976 |
+
'wooccm_settings_errors',
|
977 |
+
esc_attr( 'settings_updated' ),
|
978 |
+
__( 'Sorry! An error occurred. WooCommerce Checkout Manager removed Billing field #'.$fieldnum.' because no Label or Placeholder name was provided.', 'woocommerce-checkout-manager' ),
|
979 |
+
'error'
|
980 |
+
);
|
981 |
+
}
|
982 |
+
}
|
983 |
+
|
984 |
+
}
|
985 |
+
}
|
986 |
+
|
987 |
+
if( $detect_error == 0 ) {
|
988 |
+
add_settings_error(
|
989 |
+
'wooccm_settings_errors',
|
990 |
+
esc_attr( 'settings_updated' ),
|
991 |
+
__( 'Your changes have been saved.', 'woocommerce-checkout-manager' ),
|
992 |
+
'updated'
|
993 |
+
);
|
994 |
+
}
|
995 |
+
|
996 |
+
return $input;
|
997 |
+
|
998 |
+
}
|
999 |
+
|
1000 |
+
function wooccm_admin_notices() {
|
1001 |
+
|
1002 |
+
// Check the User has the manage_options capability
|
1003 |
+
if( current_user_can( 'manage_options' ) == false )
|
1004 |
+
return;
|
1005 |
+
|
1006 |
+
// Data update from legacy (<3.0)
|
1007 |
+
wooccm_admin_updater_notice();
|
1008 |
+
|
1009 |
+
// Check whether we are on the WooCommerce Checkout Manager screen
|
1010 |
+
$screen = get_current_screen();
|
1011 |
+
|
1012 |
+
if( get_option( 'wooccm_beta_notice' ) == false ) {
|
1013 |
+
$beta_url = 'https://www.visser.com.au/plugins/woocommerce-checkout-manager/#beta';
|
1014 |
+
$support_url = 'https://wordpress.org/support/plugin/woocommerce-checkout-manager#postform';
|
1015 |
+
$dismiss_url = add_query_arg( array( 'action' => 'wooccm_dismiss_beta_notice', '_wpnonce' => wp_create_nonce( 'wooccm_dismiss_beta_notice' ) ) );
|
1016 |
+
|
1017 |
+
$message = '<span style="float:right;"><a href="' . $dismiss_url . '">' . __( 'Dismiss', 'woocommerce-checkout-manager' ) . '</a></span>';
|
1018 |
+
$message .= __( '<strong>WooCommerce Checkout Manager Notice:</strong> We urgently need developers, integrators and interested store owners to test early Plugin releases and provide feedback to help stabilise the 4.0+ series. Can you help?', 'woocommerce-checkout-manager' );
|
1019 |
+
$message .= '
|
1020 |
+
<p class="submit">
|
1021 |
+
<a href="' . $beta_url . '" target="_blank" class="button-primary button-hero">' . __( 'Join the Developers list', 'woocommerce-checkout-manager' ) . '</a>
|
1022 |
+
<a href="' . $support_url . '" target="_blank" class="button-secondary button-hero">' . __( 'Send feedback', 'woocommerce-checkout-manager' ) . '</a>
|
1023 |
+
</p>';
|
1024 |
+
echo wooccm_admin_notice_html( $message );
|
1025 |
+
}
|
1026 |
+
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
function wooccm_admin_updater_notice() {
|
1030 |
+
|
1031 |
+
if( in_array( get_option( WOOCCM_PREFIX . '_update_notice' ), array( 1, 'yep' ) ) == true )
|
1032 |
+
return;
|
1033 |
+
|
1034 |
+
$dismiss_url = add_query_arg( array( 'action' => 'wooccm_dismiss_update_notice', '_wpnonce' => wp_create_nonce( 'wooccm_dismiss_update_notice' ) ) );
|
1035 |
+
|
1036 |
+
?>
|
1037 |
+
<form method="post" name="clickhere" action="">
|
1038 |
+
<div id="message" class="updated settings-error click-here-wooccm">
|
1039 |
+
<p>
|
1040 |
+
<span style="float:right;"><a href="<?php echo $dismiss_url; ?>"><?php _e( 'Dismiss', 'woocommerce-checkout-manager' ); ?></a></span>
|
1041 |
+
<?php _e( '<strong>WooCommerce Checkout Manager Data Update Required</strong> – We just need to update the settings for WooCommerce Checkout Manager to the latest version.', 'woocommerce-checkout-manager' ); ?>
|
1042 |
+
</p>
|
1043 |
+
<?php
|
1044 |
+
// Check whether we are on the WooCommerce Checkout Manager screen
|
1045 |
+
$screen = get_current_screen();
|
1046 |
+
if( strstr( $screen->base, 'woocommerce-checkout-manager' ) ) {
|
1047 |
+
?>
|
1048 |
+
<p class="submit">
|
1049 |
+
<input type="submit" class="wooccm-update-now button-primary button-hero" value="<?php _e( 'Run the updater', 'woocommerce-checkout-manager' ); ?>" />
|
1050 |
+
</p>
|
1051 |
+
<?php
|
1052 |
+
} else {
|
1053 |
+
?>
|
1054 |
+
<p class="submit">
|
1055 |
+
<a href="<?php echo add_query_arg( 'page', 'woocommerce-checkout-manager' ); ?>" class="button-primary button-hero "><?php _e( 'Open WooCheckout', 'woocommerce-checkout-manager' ); ?></a>
|
1056 |
+
</p>
|
1057 |
+
<?php
|
1058 |
+
}
|
1059 |
+
?>
|
1060 |
+
</div>
|
1061 |
+
<!-- #message -->
|
1062 |
+
<input type="hidden" name="click-here-wooccm" value="y" />
|
1063 |
+
</form>
|
1064 |
+
<?php
|
1065 |
+
if( strstr( $screen->base, 'woocommerce-checkout-manager' ) ) {
|
1066 |
+
?>
|
1067 |
+
<script type="text/javascript">
|
1068 |
+
jQuery( '.wooccm-update-now' ).click( 'click', function() {
|
1069 |
+
return window.confirm( '<?php echo esc_js( __( 'It is strongly recommended that you backup your database before proceeding. Are you sure you wish to run the updater now?', 'woocommerce-checkout-manager' ) ); ?>' );
|
1070 |
+
});
|
1071 |
+
</script>
|
1072 |
+
<?php
|
1073 |
+
|
1074 |
+
if( isset($_POST['click-here-wooccm']) && sanitize_text_field( $_POST['click-here-wooccm'] ) == 'y') {
|
1075 |
+
// @mod - We need to check this file exists
|
1076 |
+
?>
|
1077 |
+
|
1078 |
+
<!-- First Use -->
|
1079 |
+
<script type="text/javascript">
|
1080 |
+
jQuery(document).ready(function($) {
|
1081 |
+
|
1082 |
+
$( '#wpbody-content' ).block({message:null,overlayCSS:{background:"#fff url(<?php echo plugins_url( 'woocommerce/assets/images/ajax-loader.gif' ); ?> ) no-repeat center",opacity:.6}});
|
1083 |
+
|
1084 |
+
var form = $('#frm1');
|
1085 |
+
data = $('#frm1');
|
1086 |
+
forma = $('#frm2');
|
1087 |
+
dataa = $('#frm2');
|
1088 |
+
formb = $('#frm3');
|
1089 |
+
datab = $('#frm3');
|
1090 |
+
|
1091 |
+
$.ajax( {
|
1092 |
+
type: "POST",
|
1093 |
+
url: form.attr( 'action' ),
|
1094 |
+
data: data.serialize(),
|
1095 |
+
success: function( response ) {
|
1096 |
+
|
1097 |
+
$.ajax( {
|
1098 |
+
type: "POST",
|
1099 |
+
url: forma.attr( 'action' ),
|
1100 |
+
data: dataa.serialize(),
|
1101 |
+
success: function( response ) {}
|
1102 |
+
});
|
1103 |
+
|
1104 |
+
$.ajax( {
|
1105 |
+
type: "POST",
|
1106 |
+
url: formb.attr( 'action' ),
|
1107 |
+
data: datab.serialize(),
|
1108 |
+
success: function( response ) {}
|
1109 |
+
});
|
1110 |
+
$('.settings-error.click-here-wooccm').hide();
|
1111 |
+
$('#wpbody-content').unblock();
|
1112 |
+
|
1113 |
+
}
|
1114 |
+
});
|
1115 |
+
|
1116 |
+
});
|
1117 |
+
</script>
|
1118 |
+
|
1119 |
+
<?php
|
1120 |
+
update_option( WOOCCM_PREFIX . '_update_notice', 1 );
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
}
|
1124 |
+
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
// Additional details
|
1128 |
+
function wooccm_admin_edit_order_additional_details( $order ) {
|
1129 |
+
|
1130 |
+
global $post;
|
1131 |
+
|
1132 |
+
if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) ) {
|
1133 |
+
$order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
|
1134 |
+
} else {
|
1135 |
+
$order_id = ( isset( $order->id ) ? $order->id : 0 );
|
1136 |
+
}
|
1137 |
+
|
1138 |
+
$options = get_option( 'wccs_settings' );
|
1139 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
1140 |
+
if( !empty( $buttons ) ) {
|
1141 |
+
echo '
|
1142 |
+
<p> </p>
|
1143 |
+
<h4>' . __( 'Additional Details', 'woocommerce-checkout-manager' ) . '</h4>';
|
1144 |
+
foreach( $buttons as $btn ) {
|
1145 |
+
if(
|
1146 |
+
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
1147 |
+
!empty( $btn['label'] ) &&
|
1148 |
+
$btn['type'] !== 'heading' &&
|
1149 |
+
$btn['type'] !== 'multiselect' &&
|
1150 |
+
$btn['type'] !== 'wooccmupload' &&
|
1151 |
+
$btn['type'] !== 'multicheckbox'
|
1152 |
+
) {
|
1153 |
+
echo '
|
1154 |
+
<p id="additional_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
|
1155 |
+
<strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), $btn['cow'], __( 'Generic', 'woocommerce-checkout-manager' ) ) . '">
|
1156 |
+
'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong><br />' . nl2br( get_post_meta( $order_id , $btn['cow'], true ) ) . '
|
1157 |
+
</p>
|
1158 |
+
<!-- .form-field-type-... -->';
|
1159 |
+
} elseif(
|
1160 |
+
!empty( $btn['label'] ) &&
|
1161 |
+
$btn['type'] !== 'wooccmupload' &&
|
1162 |
+
$btn['type'] !== 'multiselect' &&
|
1163 |
+
$btn['type'] !== 'multicheckbox' &&
|
1164 |
+
$btn['type'] == 'heading'
|
1165 |
+
) {
|
1166 |
+
echo '
|
1167 |
+
<h4>' .wooccm_wpml_string( trim( $btn['label'] ) ). '</h4>';
|
1168 |
+
} elseif(
|
1169 |
+
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
1170 |
+
!empty( $btn['label'] ) &&
|
1171 |
+
$btn['type'] !== 'heading' &&
|
1172 |
+
$btn['type'] !== 'wooccmupload' &&
|
1173 |
+
(
|
1174 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
1175 |
+
)
|
1176 |
+
) {
|
1177 |
+
$value = get_post_meta( $order_id, $btn['cow'], true );
|
1178 |
+
$strings = maybe_unserialize( $value );
|
1179 |
+
echo '
|
1180 |
+
<p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
|
1181 |
+
<strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), $btn['cow'], __( 'Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager' ) ) . '">'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> ';
|
1182 |
+
if( !empty( $strings ) ) {
|
1183 |
+
if( is_array( $strings ) ) {
|
1184 |
+
$iww = 0;
|
1185 |
+
$len = count($strings);
|
1186 |
+
foreach( $strings as $key ) {
|
1187 |
+
if( $iww == $len - 1 ) {
|
1188 |
+
echo '' . wooccm_wpml_string( $key );
|
1189 |
+
} else {
|
1190 |
+
echo '' . wooccm_wpml_string( $key ) . ', ';
|
1191 |
+
}
|
1192 |
+
$iww++;
|
1193 |
+
}
|
1194 |
+
}
|
1195 |
+
} else {
|
1196 |
+
echo '-';
|
1197 |
+
}
|
1198 |
+
echo '
|
1199 |
+
</p>
|
1200 |
+
<!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
|
1201 |
+
} elseif(
|
1202 |
+
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
1203 |
+
$btn['type'] == 'wooccmupload'
|
1204 |
+
) {
|
1205 |
+
$attachments = get_post_meta( $order_id, $btn['cow'], true );
|
1206 |
+
$attachments = ( $attachments !== '' ? explode( ",", $attachments ) : false );
|
1207 |
+
echo '
|
1208 |
+
<p class="form-field form-field-wide form-field-type-wooccmupload">
|
1209 |
+
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong><br />';
|
1210 |
+
if( !empty( $attachments ) ) {
|
1211 |
+
foreach( $attachments as $attachment ) {
|
1212 |
+
$attachment_url = wp_get_attachment_url( $attachment );
|
1213 |
+
echo '<a href="' . $attachment_url . '" target="_blank">' . basename( $attachment_url ) . '</a><br />';
|
1214 |
+
}
|
1215 |
+
} else {
|
1216 |
+
echo '-';
|
1217 |
+
}
|
1218 |
+
echo '
|
1219 |
+
</p>
|
1220 |
+
<!-- .form-field-type-wooccmupload -->';
|
1221 |
+
}
|
1222 |
+
}
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
// Billing details
|
1228 |
+
function wooccm_admin_edit_order_billing_details( $order ) {
|
1229 |
+
|
1230 |
+
global $post;
|
1231 |
+
|
1232 |
+
$options = get_option( 'wccs_settings3' );
|
1233 |
+
$buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
|
1234 |
+
if( !empty( $buttons ) ) {
|
1235 |
+
$fields = array(
|
1236 |
+
'country',
|
1237 |
+
'first_name',
|
1238 |
+
'last_name',
|
1239 |
+
'company',
|
1240 |
+
'address_1',
|
1241 |
+
'address_2',
|
1242 |
+
'city',
|
1243 |
+
'state',
|
1244 |
+
'postcode',
|
1245 |
+
'email',
|
1246 |
+
'phone'
|
1247 |
+
);
|
1248 |
+
foreach( $buttons as $btn ) {
|
1249 |
+
if( !in_array( $btn['cow'], $fields ) ) {
|
1250 |
+
if(
|
1251 |
+
( get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true ) !== '' ) &&
|
1252 |
+
!empty( $btn['label'] ) &&
|
1253 |
+
$btn['type'] !== 'heading' &&
|
1254 |
+
$btn['type'] !== 'multiselect' &&
|
1255 |
+
$btn['type'] !== 'wooccmupload' &&
|
1256 |
+
$btn['type'] !== 'multicheckbox'
|
1257 |
+
) {
|
1258 |
+
echo '
|
1259 |
+
<p id="billing_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
|
1260 |
+
<strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), sprintf( '_billing_%s', $btn['cow'] ), __( 'Generic', 'woocommerce-checkout-manager' ) ) . '">
|
1261 |
+
'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong><br />'.nl2br( get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true ) ).'
|
1262 |
+
</p>
|
1263 |
+
<!-- .form-field-type-... -->';
|
1264 |
+
} elseif(
|
1265 |
+
!empty( $btn['label'] ) &&
|
1266 |
+
$btn['type'] !== 'wooccmupload' &&
|
1267 |
+
$btn['type'] !== 'multiselect' &&
|
1268 |
+
$btn['type'] !== 'multicheckbox' &&
|
1269 |
+
$btn['type'] == 'heading'
|
1270 |
+
) {
|
1271 |
+
echo '
|
1272 |
+
<h4>' .wooccm_wpml_string( trim( $btn['label'] ) ). '</h4>';
|
1273 |
+
} elseif(
|
1274 |
+
( get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true ) !== '' ) &&
|
1275 |
+
!empty( $btn['label'] ) &&
|
1276 |
+
$btn['type'] !== 'heading' &&
|
1277 |
+
$btn['type'] !== 'wooccmupload' &&
|
1278 |
+
(
|
1279 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
1280 |
+
)
|
1281 |
+
) {
|
1282 |
+
$value = get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true );
|
1283 |
+
$strings = maybe_unserialize( $value );
|
1284 |
+
|
1285 |
+
echo '
|
1286 |
+
<p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
|
1287 |
+
<strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), sprintf( '_billing_%s', $btn['cow'] ), __( 'Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager' ) ) . '">'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> ';
|
1288 |
+
if( !empty( $strings ) ) {
|
1289 |
+
if( is_array( $strings ) ) {
|
1290 |
+
$iww = 0;
|
1291 |
+
$len = count( $strings );
|
1292 |
+
foreach( $strings as $key ) {
|
1293 |
+
if( $iww == $len - 1 ) {
|
1294 |
+
echo wooccm_wpml_string( $key );
|
1295 |
+
} else {
|
1296 |
+
echo wooccm_wpml_string( $key ) . ', ';
|
1297 |
+
}
|
1298 |
+
$iww++;
|
1299 |
+
}
|
1300 |
+
} else {
|
1301 |
+
echo $strings;
|
1302 |
+
}
|
1303 |
+
} else {
|
1304 |
+
echo '-';
|
1305 |
+
}
|
1306 |
+
echo '
|
1307 |
+
</p>
|
1308 |
+
<!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
|
1309 |
+
} elseif(
|
1310 |
+
( get_post_meta( $order_id , sprintf( '_billing_%s', $btn['cow'] ), true ) !== '' ) &&
|
1311 |
+
$btn['type'] == 'wooccmupload'
|
1312 |
+
) {
|
1313 |
+
$attachments = get_post_meta( $order_id, sprintf( '_billing_%s', $btn['cow'] ), true );
|
1314 |
+
$attachments = ( $attachments !== '' ? explode( ",", $attachments ) : false );
|
1315 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
1316 |
+
echo '
|
1317 |
+
<p class="form-field form-field-wide form-field-type-wooccmupload">
|
1318 |
+
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong><br />';
|
1319 |
+
if( !empty( $attachments ) ) {
|
1320 |
+
foreach( $attachments as $attachment ) {
|
1321 |
+
$attachment_url = wp_get_attachment_url( $attachment );
|
1322 |
+
echo '<a href="' . $attachment_url . '" target="_blank">' . basename( $attachment_url ) . '</a><br />';
|
1323 |
+
}
|
1324 |
+
} else {
|
1325 |
+
echo '-';
|
1326 |
+
}
|
1327 |
+
echo '
|
1328 |
+
</p>
|
1329 |
+
<!-- .form-field-type-wooccmupload -->';
|
1330 |
+
}
|
1331 |
+
}
|
1332 |
+
}
|
1333 |
+
}
|
1334 |
+
|
1335 |
+
}
|
1336 |
+
|
1337 |
+
// Shipping details
|
1338 |
+
function wooccm_admin_edit_order_shipping_details( $order ) {
|
1339 |
+
|
1340 |
+
global $post;
|
1341 |
+
|
1342 |
+
$options = get_option( 'wccs_settings2' );
|
1343 |
+
$buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
|
1344 |
+
if( !empty( $buttons ) ) {
|
1345 |
+
$fields = array(
|
1346 |
+
'country',
|
1347 |
+
'first_name',
|
1348 |
+
'last_name',
|
1349 |
+
'company',
|
1350 |
+
'address_1',
|
1351 |
+
'address_2',
|
1352 |
+
'city',
|
1353 |
+
'state',
|
1354 |
+
'postcode'
|
1355 |
+
);
|
1356 |
+
foreach( $buttons as $btn ) {
|
1357 |
+
|
1358 |
+
if( !in_array( $btn['cow'], $fields ) ) {
|
1359 |
+
if(
|
1360 |
+
( get_post_meta( $order_id , sprintf( '_shipping_%s', $btn['cow'] ), true ) !== '' ) &&
|
1361 |
+
!empty( $btn['label'] ) &&
|
1362 |
+
$btn['type'] !== 'wooccmupload' &&
|
1363 |
+
$btn['type'] !== 'heading' &&
|
1364 |
+
$btn['type'] !== 'multiselect' &&
|
1365 |
+
$btn['type'] !== 'multicheckbox'
|
1366 |
+
) {
|
1367 |
+
echo '
|
1368 |
+
<p id="shipping_' . $btn['cow'] . '" class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
|
1369 |
+
<strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), sprintf( '_shipping_%s', $btn['cow'] ), __( 'Generic', 'woocommerce-checkout-manager' ) ) . '">
|
1370 |
+
'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong><br />'.nl2br( get_post_meta( $order_id , sprintf( '_shipping_%s', $btn['cow'] ), true ) ).'
|
1371 |
+
</p>
|
1372 |
+
<!-- .form-field-type-... -->';
|
1373 |
+
} elseif(
|
1374 |
+
!empty( $btn['label'] ) &&
|
1375 |
+
$btn['type'] !== 'multiselect' &&
|
1376 |
+
$btn['type'] !== 'multicheckbox' &&
|
1377 |
+
$btn['type'] == 'heading'
|
1378 |
+
) {
|
1379 |
+
echo '
|
1380 |
+
<h4>' .wooccm_wpml_string( trim( $btn['label'] ) ). '</h4>';
|
1381 |
+
} elseif(
|
1382 |
+
( get_post_meta( $order_id, sprintf( '_shipping_%s', $btn['cow'] ), true ) !== '' ) &&
|
1383 |
+
!empty( $btn['label'] ) &&
|
1384 |
+
$btn['type'] !== 'heading' &&
|
1385 |
+
$btn['type'] !== 'wooccmupload' &&
|
1386 |
+
(
|
1387 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
1388 |
+
)
|
1389 |
+
) {
|
1390 |
+
$value = get_post_meta( $order_id, sprintf( '_shipping_%s', $btn['cow'] ), true );
|
1391 |
+
$strings = maybe_unserialize( $value );
|
1392 |
+
echo '
|
1393 |
+
<p class="form-field form-field-wide form-field-type-' . $btn['type'] . '">
|
1394 |
+
<strong title="' . sprintf( __( 'ID: %s | Field Type: %s', 'woocommerce-checkout-manager' ), sprintf( '_shipping_%s', $btn['cow'] ), __( 'Multi-Select or Multi-Checkbox', 'woocommerce-checkout-manager' ) ) . '">'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> ';
|
1395 |
+
if( !empty( $strings ) ) {
|
1396 |
+
if( is_array( $strings ) ) {
|
1397 |
+
$iww = 0;
|
1398 |
+
$len = count( $strings );
|
1399 |
+
foreach( $strings as $key ) {
|
1400 |
+
if( $iww == $len - 1 ) {
|
1401 |
+
echo wooccm_wpml_string($key);
|
1402 |
+
} else {
|
1403 |
+
echo wooccm_wpml_string($key).', ';
|
1404 |
+
}
|
1405 |
+
$iww++;
|
1406 |
+
}
|
1407 |
+
} else {
|
1408 |
+
echo $strings;
|
1409 |
+
}
|
1410 |
+
} else {
|
1411 |
+
echo '-';
|
1412 |
+
}
|
1413 |
+
echo '
|
1414 |
+
</p>
|
1415 |
+
<!-- .form-field-type-multiselect .form-field-type-multicheckbox -->';
|
1416 |
+
} elseif(
|
1417 |
+
( get_post_meta( $order_id , sprintf( '_shipping_%s', $btn['cow'] ), true ) !== '' ) &&
|
1418 |
+
$btn['type'] == 'wooccmupload'
|
1419 |
+
) {
|
1420 |
+
$attachments = get_post_meta( $order_id, sprintf( '_shipping_%s', $btn['cow'] ), true );
|
1421 |
+
$attachments = ( $attachments !== '' ? explode( ",", $attachments ) : false );
|
1422 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
1423 |
+
echo '
|
1424 |
+
<p class="form-field form-field-wide form-field-type-wooccmupload">
|
1425 |
+
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong><br />';
|
1426 |
+
if( !empty( $attachments ) ) {
|
1427 |
+
foreach( $attachments as $attachment ) {
|
1428 |
+
$attachment_url = wp_get_attachment_url( $attachment );
|
1429 |
+
echo '<a href="' . $attachment_url . '" target="_blank">' . basename( $attachment_url ) . '</a><br />';
|
1430 |
+
}
|
1431 |
+
} else {
|
1432 |
+
echo '-';
|
1433 |
+
}
|
1434 |
+
echo '
|
1435 |
+
</p>
|
1436 |
+
<!-- .form-field-type-wooccmupload -->';
|
1437 |
+
}
|
1438 |
+
}
|
1439 |
+
|
1440 |
+
}
|
1441 |
+
}
|
1442 |
+
|
1443 |
+
}
|
1444 |
+
|
1445 |
+
function wooccm_validate_upload_process_customer() {
|
1446 |
+
|
1447 |
+
$options = get_option( 'wccs_settings' );
|
1448 |
+
|
1449 |
+
if( !empty($options['checkness']['enable_file_upload'])) {
|
1450 |
+
return true;
|
1451 |
+
} else {
|
1452 |
+
return false;
|
1453 |
+
}
|
1454 |
+
|
1455 |
+
}
|
1456 |
+
|
1457 |
+
// Check if the customer can upload images
|
1458 |
+
// @mod - This disables the Order Uploaded Files meta box even for Administrators...?
|
1459 |
+
if( wooccm_validate_upload_process_customer() ) {
|
1460 |
+
add_action( 'woocommerce_view_order', 'wooccm_file_uploader_front_end' );
|
1461 |
+
add_action( 'add_meta_boxes', 'wooccm_admin_edit_order_metaboxes' );
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
function wooccm_admin_edit_order_metaboxes() {
|
1465 |
+
|
1466 |
+
global $post;
|
1467 |
+
|
1468 |
+
$post_type = 'shop_order';
|
1469 |
+
add_meta_box( 'woocommerce-order-files', __( 'Order Uploaded Files', 'woocommerce-checkout-manager' ), 'wooccm_admin_edit_order_uploaded_files_meta_box', $post_type, 'normal', 'default' );
|
1470 |
+
|
1471 |
+
}
|
1472 |
+
|
1473 |
+
function wooccm_admin_edit_order_uploaded_files_meta_box( $post ) {
|
1474 |
+
|
1475 |
+
global $wpdb, $thepostid, $theorder, $woocommerce, $post;
|
1476 |
+
|
1477 |
+
$options = get_option( 'wccs_settings' );
|
1478 |
+
|
1479 |
+
$upload_dir = wp_upload_dir();
|
1480 |
+
|
1481 |
+
$array = array();
|
1482 |
+
$default_wccm_values = '';
|
1483 |
+
$product_image_gallery = '';
|
1484 |
+
|
1485 |
+
$post_type = 'attachment';
|
1486 |
+
$order_id = $post->ID;
|
1487 |
+
$args = array(
|
1488 |
+
'post_type' => $post_type,
|
1489 |
+
'numberposts' => -1,
|
1490 |
+
'post_status' => null,
|
1491 |
+
'post_parent' => $order_id
|
1492 |
+
);
|
1493 |
+
$posts = get_posts( $args );
|
1494 |
+
// wooccm_error_log( 'posts: ' . print_r( $posts, true ) );
|
1495 |
+
// @mod - Legacy versions were not correctly saving Post Parent so let's do a search if no results were returned
|
1496 |
+
if( empty( $posts ) ) {
|
1497 |
+
|
1498 |
+
$meta_keys = array();
|
1499 |
+
|
1500 |
+
// Additional section
|
1501 |
+
$options = get_option( 'wccs_settings' );
|
1502 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
1503 |
+
if( !empty( $buttons ) ) {
|
1504 |
+
foreach( $buttons as $btn ) {
|
1505 |
+
if( $btn['type'] == 'wooccmupload' )
|
1506 |
+
$meta_keys[] = $btn['cow'];
|
1507 |
+
}
|
1508 |
+
}
|
1509 |
+
// Billing section
|
1510 |
+
$options = get_option( 'wccs_settings3' );
|
1511 |
+
$buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
|
1512 |
+
if( !empty( $buttons ) ) {
|
1513 |
+
foreach( $buttons as $btn ) {
|
1514 |
+
if( $btn['type'] == 'wooccmupload' )
|
1515 |
+
$meta_keys[] = sprintf( '_billing_%s', $btn['cow'] );
|
1516 |
+
}
|
1517 |
+
}
|
1518 |
+
// Shipping section
|
1519 |
+
$options = get_option( 'wccs_settings2' );
|
1520 |
+
$buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
|
1521 |
+
if( !empty( $buttons ) ) {
|
1522 |
+
foreach( $buttons as $btn ) {
|
1523 |
+
if( $btn['type'] == 'wooccmupload' )
|
1524 |
+
$meta_keys[] = sprintf( '_shipping_%s', $btn['cow'] );
|
1525 |
+
}
|
1526 |
+
}
|
1527 |
+
|
1528 |
+
if( !empty( $meta_keys ) ) {
|
1529 |
+
$values = array();
|
1530 |
+
// Check the Order for these meta keys
|
1531 |
+
foreach( $meta_keys as $meta_key ) {
|
1532 |
+
$value = get_post_meta( $order_id, $meta_key, true );
|
1533 |
+
if( !empty( $value ) )
|
1534 |
+
$array[] = implode( ',', $value );
|
1535 |
+
}
|
1536 |
+
}
|
1537 |
+
|
1538 |
+
}
|
1539 |
+
// Check if there are any attachments
|
1540 |
+
if( !empty( $posts ) || !empty( $array ) ) {
|
1541 |
+
if( !empty( $posts ) ) {
|
1542 |
+
foreach( $posts as $attachment ) {
|
1543 |
+
$array[] = $attachment->ID;
|
1544 |
+
}
|
1545 |
+
}
|
1546 |
+
$default_wccm_values = implode( ',', $array );
|
1547 |
+
$product_image_gallery = implode( ',', $array );
|
1548 |
+
// wooccm_error_log( 'default_wccm_values: ' . print_r( $default_wccm_values, true ) );
|
1549 |
+
// wooccm_error_log( 'product_image_gallery: ' . print_r( $product_image_gallery, true ) );
|
1550 |
+
}
|
1551 |
+
|
1552 |
+
$attachments = array_filter( explode( ',', $product_image_gallery ) );
|
1553 |
+
// wooccm_error_log( 'attachments: ' . print_r( $attachments, true ) );
|
1554 |
+
?>
|
1555 |
+
|
1556 |
+
<script type="text/javascript">
|
1557 |
+
jQuery(document).ready(function($) {
|
1558 |
+
|
1559 |
+
$('#wccm_save_order_submit').click(function() {
|
1560 |
+
$(".wccm_results").html( "<?php _e( 'Saving, please wait...', 'woocommerce-checkout-manager' ); ?>" );
|
1561 |
+
var data = {
|
1562 |
+
action: 'update_attachment_wccm',
|
1563 |
+
post_id : '<?php echo $post->ID; ?>',
|
1564 |
+
product_image_gallery : $('#product_image_gallery').val(),
|
1565 |
+
wccm_default_keys_load : $('#wccm_default_keys_load').val()
|
1566 |
+
};
|
1567 |
+
|
1568 |
+
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
1569 |
+
$.post(ajaxurl, data, function(response) {
|
1570 |
+
$(".wccm_results").html(response);
|
1571 |
+
});
|
1572 |
+
});
|
1573 |
+
|
1574 |
+
});
|
1575 |
+
</script>
|
1576 |
+
|
1577 |
+
<?php wp_enqueue_style( 'wccm_upload_file_style', plugins_url( 'includes/templates/admin/edit-order-uploads-file_editing_table.css', WOOCCM_RELPATH ) ); ?>
|
1578 |
+
|
1579 |
+
<div class="woocommerce_order_items_wrapper">
|
1580 |
+
<table class="woocommerce_order_items back_end">
|
1581 |
+
|
1582 |
+
<thead>
|
1583 |
+
<tr>
|
1584 |
+
<th nowrap>
|
1585 |
+
<attr title="<?php _e( 'Attachment ID', 'woocommerce-checkout-manager' ); ?>"><?php _e('ID','woocommerce-checkout-manager'); ?></attr>
|
1586 |
+
</th>
|
1587 |
+
<th><?php _e( 'Image', 'woocommerce-checkout-manager' ); ?></th>
|
1588 |
+
<th><?php _e( 'Action', 'woocommerce-checkout-manager' ); ?></th>
|
1589 |
+
<th><?php _e( 'Dimensions', 'woocommerce-checkout-manager' ); ?></th>
|
1590 |
+
<th><?php _e( 'Extension',' woocommerce-checkout-manager' ); ?></th>
|
1591 |
+
<th><?php _e( 'Name', 'woocommerce-checkout-manager' ); ?></th>
|
1592 |
+
</tr>
|
1593 |
+
</thead>
|
1594 |
+
|
1595 |
+
<tbody class="product_images">
|
1596 |
+
<?php
|
1597 |
+
if( !empty( $attachments ) ) {
|
1598 |
+
foreach ( $attachments as $attachment_id ) {
|
1599 |
+
|
1600 |
+
$image_attributes = wp_get_attachment_url( $attachment_id );
|
1601 |
+
$image_attributes2 = wp_get_attachment_image_src( $attachment_id );
|
1602 |
+
$filename = basename( $image_attributes );
|
1603 |
+
$wp_filetype = wp_check_filetype( $filename );
|
1604 |
+
|
1605 |
+
$value_declear = array_diff( explode( ',',$default_wccm_values ), explode( ',', $attachment_id ) );
|
1606 |
+
|
1607 |
+
echo '
|
1608 |
+
<tr class="image wccm_filesli wccmv_' . esc_attr( $attachment_id ) . '">
|
1609 |
+
<script type="text/javascript">
|
1610 |
+
jQuery(document).ready(function(){
|
1611 |
+
jQuery(".wccmx_' . esc_attr( $attachment_id ) . '").click(function(){
|
1612 |
+
|
1613 |
+
jQuery(".wccmv_' . esc_attr( $attachment_id ) . '").hide();
|
1614 |
+
jQuery("#product_image_gallery").val(jQuery("#product_image_gallery").val().replace("'.esc_attr( $attachment_id ).'", ""));
|
1615 |
+
|
1616 |
+
});
|
1617 |
+
});
|
1618 |
+
</script>
|
1619 |
+
<td>' . $attachment_id . '</td>
|
1620 |
+
<td>' . wp_get_attachment_image( $attachment_id, array( 75, 75 ), true ) . '</td>
|
1621 |
+
<td style="text-align:left;">
|
1622 |
+
<a href="' . $image_attributes2[0] . '" target="_blank">' . __( 'Download', 'woocommerce-checkout-manager' ) . '</a><br />
|
1623 |
+
<a class="delete tips wccm_delete wccmx_' . esc_attr( $attachment_id ) . '" data-tip="' . __( 'Delete image', 'woocommerce-checkout-manager' ) . '">' . __( 'Delete', 'woocommerce-checkout-manager' ) . '</a>
|
1624 |
+
</td>
|
1625 |
+
<td>';
|
1626 |
+
if( $image_attributes2[1] == '' ) {
|
1627 |
+
echo '-';
|
1628 |
+
} else {
|
1629 |
+
echo $image_attributes2[1] . ' x ' . $image_attributes2[2];
|
1630 |
+
}
|
1631 |
+
echo '</td>
|
1632 |
+
<td>' . strtoupper( $wp_filetype['ext'] ) . '</td>
|
1633 |
+
<td style="text-align:left;">' . preg_replace( '/\.[^.]+$/', '', $filename ) . '</td>
|
1634 |
+
</tr>
|
1635 |
+
';
|
1636 |
+
|
1637 |
+
}
|
1638 |
+
} else {
|
1639 |
+
echo '
|
1640 |
+
<tr>
|
1641 |
+
<td colspan="6" style="text-align:left;">' . __( 'No files have been uploaded to this Order.', 'woocommerce-checkout-manager' ) . '</td>
|
1642 |
+
</tr>';
|
1643 |
+
}
|
1644 |
+
?>
|
1645 |
+
</tbody>
|
1646 |
+
</table>
|
1647 |
+
<input type="hidden" class="wccm_add_to_list" id="product_image_gallery" name="product_image_gallery" value="<?php echo esc_attr( $product_image_gallery ); ?>" />
|
1648 |
+
<input type="hidden" id="wccm_default_keys_load" name="wccm_default_keys_load" value="<?php echo esc_attr( $default_wccm_values ); ?>" />
|
1649 |
+
<!-- .woocommerce_order_items -->
|
1650 |
+
|
1651 |
+
<p class="add_product_images hide-if-no-js">
|
1652 |
+
<form method="POST" action="">
|
1653 |
+
<span class="btn button-primary wccm_add_order_link fileinput-button">
|
1654 |
+
<span><?php _e( 'Add Order Files', 'woocommerce-checkout-manager' ); ?></span>
|
1655 |
+
<input type="file" name="files_wccm" id="files_wccm" multiple />
|
1656 |
+
<button type="button" id="files_button_wccm"><?php _e( 'Upload Files!', 'woocommerce-checkout-manager' ); ?></button>
|
1657 |
+
</span>
|
1658 |
+
</form>
|
1659 |
+
</p>
|
1660 |
+
|
1661 |
+
<!-- Edit Order: File upload -->
|
1662 |
+
<script type="text/javascript">
|
1663 |
+
jQuery(document).ready(function($){(
|
1664 |
+
|
1665 |
+
function post_image_content() {
|
1666 |
+
|
1667 |
+
var input = document.getElementById("files_wccm"), formdata = false;
|
1668 |
+
|
1669 |
+
if(window.FormData) {
|
1670 |
+
formdata = new FormData();
|
1671 |
+
document.getElementById("files_button_wccm").style.display = "none";
|
1672 |
+
}
|
1673 |
+
|
1674 |
+
input.addEventListener("change", function (evt) {
|
1675 |
+
|
1676 |
+
$(".wccm_results").html("Uploading, please wait....");
|
1677 |
+
|
1678 |
+
var i = 0, len = this.files.length, img, reader, file;
|
1679 |
+
|
1680 |
+
for ( ; i < len; i++ ) {
|
1681 |
+
file = this.files[i];
|
1682 |
+
if (formdata) {
|
1683 |
+
formdata.append("files_wccm[]",file);
|
1684 |
+
}
|
1685 |
+
}
|
1686 |
+
|
1687 |
+
if(formdata) {
|
1688 |
+
$.ajax({
|
1689 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wccs_upload_file_func&order_id='.$post->ID.'&name=files_wccm'); ?>",
|
1690 |
+
type: "POST",
|
1691 |
+
data: formdata,
|
1692 |
+
processData: false,
|
1693 |
+
contentType: false,
|
1694 |
+
success: function (res) {
|
1695 |
+
$('#files_wccm').show();
|
1696 |
+
$(".wccm_results").html("Files Uploaded Successfully.");
|
1697 |
+
/* $(".wccm_results").html(res); */
|
1698 |
+
|
1699 |
+
$.ajax({
|
1700 |
+
url: '<?php echo admin_url('/post.php?post='.$post->ID.'&action=edit'); ?>',
|
1701 |
+
data: {},
|
1702 |
+
success: function (data) {
|
1703 |
+
$("div#product_images_container").html($(data).find("div#product_images_container"));
|
1704 |
+
$(".wccm_results").html("Files Uploaded Successfully.");
|
1705 |
+
/* $(".wccm_results").html(data); */
|
1706 |
+
},
|
1707 |
+
dataType: 'html'
|
1708 |
+
});
|
1709 |
+
}
|
1710 |
+
});
|
1711 |
+
}
|
1712 |
+
}, false);
|
1713 |
+
}
|
1714 |
+
|
1715 |
+
());
|
1716 |
+
|
1717 |
+
});
|
1718 |
+
</script>
|
1719 |
+
|
1720 |
+
<input type="button" id="wccm_save_order_submit" class="button button-primary" value="<?php _e( 'Save Changes', 'woocommerce-checkout-manager' ); ?>">
|
1721 |
+
<div class="wccm_results"></div>
|
1722 |
+
<div class="clear"></div>
|
1723 |
+
|
1724 |
+
</div>
|
1725 |
+
<!-- .woocommerce_order_items_wrapper -->
|
1726 |
+
<?php
|
1727 |
+
|
1728 |
+
}
|
1729 |
+
|
1730 |
+
// front end for user
|
1731 |
+
function wooccm_file_uploader_front_end( $order_id ) {
|
1732 |
+
|
1733 |
+
global $wpdb, $thepostid, $theorder, $woocommerce, $post;
|
1734 |
+
|
1735 |
+
$order = new WC_Order( $order_id );
|
1736 |
+
|
1737 |
+
$options = get_option( 'wccs_settings' );
|
1738 |
+
$length = ( empty( $options['checkness']['file_upload_number'] ) ) ? 'this.files.length' : $options['checkness']['file_upload_number'];
|
1739 |
+
|
1740 |
+
$file_types = ( !empty( $options['checkness']['file_types'] ) ? explode( ",", $options['checkness']['file_types'] ) : array() );
|
1741 |
+
$number_of_types = count( $file_types );
|
1742 |
+
|
1743 |
+
$prefix = 'wc-';
|
1744 |
+
|
1745 |
+
if( empty( $options['checkness']['upload_os'] ) || ( $order->post_status == $prefix.$options['checkness']['upload_os'] ) ) {
|
1746 |
+
|
1747 |
+
$post_type = 'attachment';
|
1748 |
+
$upload_dir = wp_upload_dir();
|
1749 |
+
$args = array(
|
1750 |
+
'post_type' => $post_type,
|
1751 |
+
'numberposts' => -1,
|
1752 |
+
'post_status' => null,
|
1753 |
+
'post_parent' => $order_id
|
1754 |
+
);
|
1755 |
+
$default_wccm_values = false;
|
1756 |
+
$product_image_gallery = false;
|
1757 |
+
$posts = get_posts( $args );
|
1758 |
+
// wooccm_error_log( 'posts: ' . print_r( $posts, true ) );
|
1759 |
+
if( !empty( $posts ) ) {
|
1760 |
+
foreach( $posts as $attachment )
|
1761 |
+
$array[] = $attachment->ID;
|
1762 |
+
$default_wccm_values = implode( ',', $array );
|
1763 |
+
$product_image_gallery = implode( ',', $array );
|
1764 |
+
}
|
1765 |
+
// wooccm_error_log( 'default_wccm_values: ' . print_r( $default_wccm_values, true ) );
|
1766 |
+
// wooccm_error_log( 'product_image_gallery: ' . print_r( $product_image_gallery, true ) );
|
1767 |
+
if( !empty( $product_image_gallery ) )
|
1768 |
+
$attachments = array_filter( explode( ',', $product_image_gallery ) );
|
1769 |
+
// wooccm_error_log( 'attachments: ' . print_r( $attachments, true ) );
|
1770 |
+
|
1771 |
+
?>
|
1772 |
+
|
1773 |
+
<script type="text/javascript">
|
1774 |
+
jQuery(document).ready(function($) {
|
1775 |
+
|
1776 |
+
$('#wccm_save_order_submit').click(function() {
|
1777 |
+
$(".wccm_results").html("Deleting files, please wait....");
|
1778 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
1779 |
+
data = {
|
1780 |
+
action: 'update_attachment_wccm',
|
1781 |
+
product_image_gallery : $('#product_image_gallery').val(),
|
1782 |
+
wccm_default_keys_load : $('#wccm_default_keys_load').val()
|
1783 |
+
};
|
1784 |
+
|
1785 |
+
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
1786 |
+
$.post(ajaxurl, data, function(response) {
|
1787 |
+
$(".wccm_results").html(response);
|
1788 |
+
});
|
1789 |
+
});
|
1790 |
+
|
1791 |
+
});
|
1792 |
+
</script>
|
1793 |
+
|
1794 |
+
<?php wp_enqueue_style( 'wccm_upload_file_style', plugins_url( 'includes/templates/admin/edit-order-uploads-file_editing_table.css', WOOCCM_RELPATH ) ); ?>
|
1795 |
+
|
1796 |
+
<h2><?php echo ( empty( $options['checkness']['upload_title'] ) ) ? 'Order Uploaded Files' : esc_attr( $options['checkness']['upload_title'] ); ?></h2>
|
1797 |
+
<div class="woocommerce_order_items_wrapper front_end">
|
1798 |
+
<table class="woocommerce_order_items front_end">
|
1799 |
+
|
1800 |
+
<thead>
|
1801 |
+
<tr>
|
1802 |
+
<th style="width:15%;text-align: center;"><?php _e( 'Attachment ID', 'woocommerce-checkout-manager' ); ?></th>
|
1803 |
+
<th style="width:12%"><?php _e( 'Image', 'woocommerce-checkout-manager' ); ?></th>
|
1804 |
+
<th style="width:10%"><?php _e( 'Action', 'woocommerce-checkout-manager' ); ?></th>
|
1805 |
+
<th style="width:12%"><?php _e( 'Dimensions', 'woocommerce-checkout-manager' ); ?></th>
|
1806 |
+
<th style="width:8%"><?php _e( 'Extension' ,'woocommerce-checkout-manager' ); ?></th>
|
1807 |
+
<th style="width:4%"><?php _e( 'Link', 'woocommerce-checkout-manager' ); ?></th>
|
1808 |
+
<th style="width:30%;text-align: center;"><?php _e( 'Name', 'woocommerce-checkout-manager' ); ?></th>
|
1809 |
+
</tr>
|
1810 |
+
</thead>
|
1811 |
+
|
1812 |
+
<tbody class="product_images front_end">
|
1813 |
+
<?php
|
1814 |
+
if( !empty( $attachments ) ) {
|
1815 |
+
foreach( $attachments as $attachment_id ) {
|
1816 |
+
|
1817 |
+
$image_attributes = wp_get_attachment_url( $attachment_id );
|
1818 |
+
$image_attributes2 = wp_get_attachment_image_src( $attachment_id );
|
1819 |
+
$filename = basename( $image_attributes );
|
1820 |
+
$wp_filetype = wp_check_filetype( $filename );
|
1821 |
+
|
1822 |
+
$value_declear = array_diff( explode( ',', $default_wccm_values ), explode( ',', $attachment_id ) );
|
1823 |
+
|
1824 |
+
echo '
|
1825 |
+
<tr class="image wccm_filesli wccmv_' . esc_attr( $attachment_id ) . '">
|
1826 |
+
|
1827 |
+
<td style="display:none;">
|
1828 |
+
<script type="text/javascript">
|
1829 |
+
|
1830 |
+
jQuery(document).ready(function(){
|
1831 |
+
|
1832 |
+
jQuery(".wccmx_' . esc_attr( $attachment_id ) . '").click(function(){
|
1833 |
+
jQuery(".wccmv_' . esc_attr( $attachment_id ) . '").hide();
|
1834 |
+
jQuery("#product_image_gallery").val(jQuery("#product_image_gallery").val().replace("'.esc_attr( $attachment_id ).'", ""));
|
1835 |
+
|
1836 |
+
});
|
1837 |
+
});
|
1838 |
+
|
1839 |
+
</script>
|
1840 |
+
</td>
|
1841 |
+
<td>'.$attachment_id.'</td>
|
1842 |
+
<td>'.wp_get_attachment_link( $attachment_id, '' , false, false, wp_get_attachment_image( $attachment_id, array(75,75), true ) ).'</td>
|
1843 |
+
<td>
|
1844 |
+
<a class="delete tips wccm_delete wccmx_' . esc_attr( $attachment_id ) . '" data-tip="' . __( 'Delete image', 'woocommerce-checkout-manager' ) . '">' . __( 'Delete', 'woocommerce-checkout-manager' ) . '</a>
|
1845 |
+
</td>
|
1846 |
+
<td>';
|
1847 |
+
if( $image_attributes2[1] == '' ) {
|
1848 |
+
echo '-';
|
1849 |
+
} else {
|
1850 |
+
echo $image_attributes2[1].' x '.$image_attributes2[2];
|
1851 |
+
}
|
1852 |
+
echo '
|
1853 |
+
</td>
|
1854 |
+
<td>'.$wp_filetype['ext'].'</td>
|
1855 |
+
<td>'.wp_get_attachment_link( $attachment_id, '' , false, false, 'Link' ).'</td>
|
1856 |
+
<td>'.preg_replace( '/\.[^.]+$/', '', $filename).'</td>
|
1857 |
+
</tr>';
|
1858 |
+
}
|
1859 |
+
} else {
|
1860 |
+
echo '
|
1861 |
+
<tr>
|
1862 |
+
<td colspan="7">' . __( 'No uploaded files have been assigned to this Order.', 'woocommerce-checkout-manager' ) . '</td>
|
1863 |
+
</tr>
|
1864 |
+
';
|
1865 |
+
}
|
1866 |
+
?>
|
1867 |
+
</tbody>
|
1868 |
+
</table>
|
1869 |
+
<input type="hidden" class="wccm_add_to_list" id="product_image_gallery" name="product_image_gallery" value="<?php echo ( !empty( $product_image_gallery ) ? esc_attr( $product_image_gallery ) : '' ); ?>" />
|
1870 |
+
<input type="hidden" id="wccm_default_keys_load" name="wccm_default_keys_load" value="<?php echo ( !empty( $default_wccm_values ) ? esc_attr( $default_wccm_values ) : '' ); ?>" />
|
1871 |
+
<!-- .woocommerce_order_items -->
|
1872 |
+
</div>
|
1873 |
+
<!-- .woocommerce_order_items_wrapper -->
|
1874 |
+
|
1875 |
+
<button type="button" id="wccm_save_order_submit" class="file_upload_delete wooccm-btn wooccm-btn-danger delete"><php _e( 'Confirm Delete', 'woocommerce-checkout-manager' ); ?></button>
|
1876 |
+
|
1877 |
+
<span id="wccm_uploader_select">
|
1878 |
+
<input type="file" style="display:none;" name="files_wccm" id="files_wccm" multiple />
|
1879 |
+
<button type="button" class="file_upload_account wooccm-btn wooccm-btn-primary start" id="files_button_wccm"><?php _e( 'Upload Files', 'woocommerce-checkout-manager' ); ?></button>
|
1880 |
+
</span>
|
1881 |
+
<!-- #wccm_uploader_select -->
|
1882 |
+
|
1883 |
+
<div class="wccm_results front_end"></div>
|
1884 |
+
|
1885 |
+
<div class="clear"></div>
|
1886 |
+
<?php
|
1887 |
+
// script for uploading the files
|
1888 |
+
echo '
|
1889 |
+
<!-- Edit Order: File upload -->
|
1890 |
+
<script type="text/javascript">
|
1891 |
+
jQuery(document).ready(function($){
|
1892 |
+
|
1893 |
+
(function post_image_content() {
|
1894 |
+
|
1895 |
+
var input = document.getElementById("files_wccm"), formdata = false;
|
1896 |
+
|
1897 |
+
$("#files_button_wccm").click( function(){
|
1898 |
+
$("#wccm_uploader_select input[type=file]").click();
|
1899 |
+
return false;
|
1900 |
+
});
|
1901 |
+
|
1902 |
+
if (window.FormData) {
|
1903 |
+
formdata = new FormData();
|
1904 |
+
}
|
1905 |
+
|
1906 |
+
input.addEventListener("change", function (evt) {
|
1907 |
+
$("#wccm_uploader_select").block({message: null, overlayCSS: {background: "#fff url(" + woocommerce_params.plugin_url + "/assets/images/ajax-loader.gif) no-repeat center", opacity: 0.6}});
|
1908 |
+
|
1909 |
+
$("#wccm_uploader_select").block({message: null, overlayCSS: {background: "#fff url(" + woocommerce_params.ajax_loader_url + ") no-repeat center", opacity: 0.6}});
|
1910 |
+
|
1911 |
+
var length = '.$length.';
|
1912 |
+
var file_array = ' . wooccm_js_array( $file_types ) . ';
|
1913 |
+
var wooempt = ' . implode( ',', $file_types ) . ';
|
1914 |
+
|
1915 |
+
for ( i = 0; i < length; i++ ) {
|
1916 |
+
file = this.files[i];
|
1917 |
+
for(x=0; x < '.$number_of_types.'; x++){
|
1918 |
+
if( !wooempt || file.type.match(file_array[x]) ) {
|
1919 |
+
if (formdata) {
|
1920 |
+
formdata.append("files_wccm[]",file);
|
1921 |
+
}
|
1922 |
+
}
|
1923 |
+
}
|
1924 |
+
}
|
1925 |
+
|
1926 |
+
if (formdata) {
|
1927 |
+
$.ajax({
|
1928 |
+
url: "'.admin_url('/admin-ajax.php?action=wccs_upload_file_func&order_id='.$post->ID.'&name=files_wccm').'",
|
1929 |
+
type: "POST",
|
1930 |
+
data: formdata,
|
1931 |
+
processData: false,
|
1932 |
+
contentType: false,
|
1933 |
+
success: function (res) {
|
1934 |
+
$("#files_wccm").show();
|
1935 |
+
|
1936 |
+
$.ajax({
|
1937 |
+
url: "'.$order->get_view_order_url().'",
|
1938 |
+
data: {},
|
1939 |
+
success: function (data) {
|
1940 |
+
$("div.woocommerce_order_items_wrapper.front_end").html($(data).find("div.woocommerce_order_items_wrapper.front_end"));
|
1941 |
+
jQuery("#wccm_uploader_select").unblock();
|
1942 |
+
},
|
1943 |
+
dataType: "html"
|
1944 |
+
});
|
1945 |
+
|
1946 |
+
}
|
1947 |
+
});
|
1948 |
+
}
|
1949 |
+
}, false);
|
1950 |
+
}
|
1951 |
+
());
|
1952 |
+
});
|
1953 |
+
</script>';
|
1954 |
+
// end script
|
1955 |
+
// ------------
|
1956 |
+
|
1957 |
+
}
|
1958 |
+
|
1959 |
+
}
|
1960 |
+
|
1961 |
+
function wccs_upload_file_func_callback( $order_id ) {
|
1962 |
+
|
1963 |
+
global $wpdb, $woocommerce, $post; // this is how you get access to the database
|
1964 |
+
|
1965 |
+
$options = get_option( 'wccs_settings' );
|
1966 |
+
|
1967 |
+
$order_id = ( isset( $_REQUEST['order_id'] ) ? absint( $_REQUEST['order_id'] ) : false );
|
1968 |
+
|
1969 |
+
$order = new WC_Order( $order_id );
|
1970 |
+
|
1971 |
+
// load files
|
1972 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
1973 |
+
require_once( ABSPATH . 'wp-admin/includes/media.php' );
|
1974 |
+
|
1975 |
+
$upload_dir = wp_upload_dir();
|
1976 |
+
|
1977 |
+
$name = ( isset( $_REQUEST['name'] ) ? $_REQUEST['name'] : false );
|
1978 |
+
|
1979 |
+
if( empty( $name ) ) {
|
1980 |
+
echo ' '.__('Upload failed. Files were not uploaded.','woocommerce-checkout-manager').'';
|
1981 |
+
die();
|
1982 |
+
}
|
1983 |
+
|
1984 |
+
if( empty( $order_id ) ) {
|
1985 |
+
echo ' '.__('Invalid Order. Files were not uploaded.','woocommerce-checkout-manager').'';
|
1986 |
+
die();
|
1987 |
+
}
|
1988 |
+
|
1989 |
+
$files = $_FILES[''. $name .''];
|
1990 |
+
// $upload_overrides = array( 'test_form' => false );
|
1991 |
+
|
1992 |
+
if( !empty( $files['name'] ) ) {
|
1993 |
+
foreach( $files['name'] as $key => $value ) {
|
1994 |
+
if( $files['name'][$key] ) {
|
1995 |
+
|
1996 |
+
// using the wp_handle_upload
|
1997 |
+
if ( empty($options['checkness']['cat_file_upload']) ) {
|
1998 |
+
$file = array(
|
1999 |
+
'name' => $files['name'][$key],
|
2000 |
+
'type' => $files['type'][$key],
|
2001 |
+
'tmp_name' => $files['tmp_name'][$key],
|
2002 |
+
'error' => $files['error'][$key],
|
2003 |
+
'size' => $files['size'][$key]
|
2004 |
+
);
|
2005 |
+
|
2006 |
+
// $movefile = wp_handle_upload($file, $upload_overrides);
|
2007 |
+
$movefile = wp_handle_upload($file);
|
2008 |
+
|
2009 |
+
// Check if the save process failed
|
2010 |
+
if( isset( $movefile['error'] ) ) {
|
2011 |
+
echo 'Could not save uploaded file. Files were not uploaded.';
|
2012 |
+
die();
|
2013 |
+
}
|
2014 |
+
|
2015 |
+
$attachment = array(
|
2016 |
+
'guid' => $movefile['url'],
|
2017 |
+
'post_mime_type' => $movefile['type'],
|
2018 |
+
'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $movefile['file'] ) ),
|
2019 |
+
'post_content' => '',
|
2020 |
+
'post_status' => 'inherit',
|
2021 |
+
'post_parent' => $order_id
|
2022 |
+
);
|
2023 |
+
|
2024 |
+
$attach_id = wp_insert_attachment( $attachment, $movefile['url'], $order_id );
|
2025 |
+
|
2026 |
+
// you must first include the image.php file
|
2027 |
+
// for the function wp_generate_attachment_metadata() to work
|
2028 |
+
|
2029 |
+
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
2030 |
+
$attach_data = wp_generate_attachment_metadata( $attach_id, $movefile['url'] );
|
2031 |
+
wp_update_attachment_metadata( $attach_id, $attach_data );
|
2032 |
+
|
2033 |
+
// send email
|
2034 |
+
$email_recipients = $options['checkness']['wooccm_notification_email'];
|
2035 |
+
$message_content = '
|
2036 |
+
This is an automatic message from WooCommerce Checkout Manager, reporting that files has been uploaded by '.$order->billing_first_name.' '.$order->billing_last_name.'.<br />
|
2037 |
+
<h3>Customer Details</h3>
|
2038 |
+
Name: '.$order->billing_first_name.' '.$order->billing_last_name.'<br />
|
2039 |
+
E-mail: '.$order->billing_email.'<br />
|
2040 |
+
Order Number: '.$order_id.' <br />
|
2041 |
+
You can view the files and order details via back-end by following this <a href="'.admin_url('/post.php?post='.$order_id.'&action=edit').'">link</a>.
|
2042 |
+
';
|
2043 |
+
|
2044 |
+
add_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
2045 |
+
wp_mail( $email_recipients, sprintf( __( 'WooCommerce Checkout Manager - Files Uploaded by Customer [%s]', 'woocommerce-checkout-manager' ), $order->billing_first_name . ' ' . $order->billing_last_name ), $message_content );
|
2046 |
+
remove_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
2047 |
+
|
2048 |
+
} else {
|
2049 |
+
|
2050 |
+
// using move_uploaded_file to categorized uploaded images
|
2051 |
+
if( !file_exists( $upload_dir['basedir'] . '/wooccm_uploads/' . $order_id . '/' ) ) {
|
2052 |
+
wp_mkdir_p( $upload_dir['basedir'] . '/wooccm_uploads/' . $order_id . '/' );
|
2053 |
+
}
|
2054 |
+
|
2055 |
+
$filename = $files['name'][$key];
|
2056 |
+
$wp_filetype = wp_check_filetype( $filename );
|
2057 |
+
$URLpath = $upload_dir['baseurl'] . '/wooccm_uploads/' . $order_id . '/' . $filename;
|
2058 |
+
|
2059 |
+
move_uploaded_file( $files["tmp_name"][$key], $upload_dir['basedir'] . '/wooccm_uploads/' . $order_id . '/' . $filename);
|
2060 |
+
|
2061 |
+
$attachment = array(
|
2062 |
+
'guid' => $URLpath,
|
2063 |
+
'post_mime_type' => $wp_filetype['type'],
|
2064 |
+
'post_title' => preg_replace( '/\.[^.]+$/', '', $filename),
|
2065 |
+
'post_content' => '',
|
2066 |
+
'post_status' => 'inherit'
|
2067 |
+
);
|
2068 |
+
|
2069 |
+
$attach_id = wp_insert_attachment( $attachment, $URLpath, $order_id);
|
2070 |
+
|
2071 |
+
// you must first include the image.php file
|
2072 |
+
// for the function wp_generate_attachment_metadata() to work
|
2073 |
+
|
2074 |
+
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
2075 |
+
$attach_data = wp_generate_attachment_metadata( $attach_id, $URLpath );
|
2076 |
+
wp_update_attachment_metadata( $attach_id, $attach_data );
|
2077 |
+
// send email
|
2078 |
+
$email_recipients = get_option('admin_email');
|
2079 |
+
$message_content = '
|
2080 |
+
This is an automatic message from WooCommerce Checkout Manager, reporting that files has been uploaded by '.$order->billing_first_name.' '.$order->billing_last_name.'.<br />
|
2081 |
+
<h3>Customer Details</h3>
|
2082 |
+
Name: '.$order->billing_first_name.' '.$order->billing_last_name.'<br />
|
2083 |
+
E-mail: '.$order->billing_email.'<br />
|
2084 |
+
Order Number: '.$order_id.' <br />
|
2085 |
+
You can view the files and order details via back-end by following this <a href="'.admin_url( '/post.php?post='.$order_id.'&action=edit' ).'">link</a>.
|
2086 |
+
';
|
2087 |
+
|
2088 |
+
add_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
2089 |
+
wp_mail( $email_recipients, __( 'WooCommerce Checkout Manager - Files Uploaded by Customer', 'woocommerce-checkout-manager' ), $message_content );
|
2090 |
+
remove_filter( 'wp_mail_content_type', 'wooccm_set_html_content_type' );
|
2091 |
+
|
2092 |
+
}
|
2093 |
+
}
|
2094 |
+
}
|
2095 |
+
echo ' '.__('Files were uploaded successfully.','woocommerce-checkout-manager').'';
|
2096 |
+
} else {
|
2097 |
+
echo ' '.__('No uploads were recognised. Files were not uploaded.','woocommerce-checkout-manager').'';
|
2098 |
+
}
|
2099 |
+
die();
|
2100 |
+
|
2101 |
+
}
|
2102 |
+
add_action("wp_ajax_wccs_upload_file_func", "wccs_upload_file_func_callback");
|
2103 |
+
add_action("wp_ajax_nopriv_wccs_upload_file_func", "wccs_upload_file_func_callback");
|
2104 |
+
|
2105 |
+
function wooccm_set_html_content_type() {
|
2106 |
+
|
2107 |
+
return 'text/html';
|
2108 |
+
|
2109 |
+
}
|
2110 |
+
|
2111 |
+
function wooccm_js_str( $s ) {
|
2112 |
+
|
2113 |
+
return '"' . addcslashes($s, "\0..\37\"\\") . '"';
|
2114 |
+
|
2115 |
+
}
|
2116 |
+
|
2117 |
+
function wooccm_js_array( $array ) {
|
2118 |
+
|
2119 |
+
$temp = array_map( 'wooccm_js_str', $array );
|
2120 |
+
return '[' . implode(',', $temp) . ']';
|
2121 |
+
|
2122 |
+
}
|
2123 |
+
|
2124 |
+
function update_attachment_wccm_callback() {
|
2125 |
+
|
2126 |
+
global $post, $wpdb, $woocommerce;
|
2127 |
+
|
2128 |
+
$array1 = explode( ',', sanitize_text_field( isset( $_POST['wccm_default_keys_load'] ) ? $_POST['wccm_default_keys_load'] : '' ) );
|
2129 |
+
$array2 = explode( ',', sanitize_text_field( isset( $_POST['product_image_gallery'] ) ? $_POST['product_image_gallery'] : '' ) );
|
2130 |
+
$attachment_ids = array_diff( $array1, $array2 );
|
2131 |
+
|
2132 |
+
if( isset( $_POST['wccm_default_keys_load'] ) ) {
|
2133 |
+
if( !empty( $attachment_ids ) ) {
|
2134 |
+
foreach( $attachment_ids as $key => $values ) {
|
2135 |
+
wp_delete_attachment( $attachment_ids[$key] );
|
2136 |
+
}
|
2137 |
+
}
|
2138 |
+
echo __('Deleted Successfully.','woocommerce-checkout-manager');
|
2139 |
+
}
|
2140 |
+
die();
|
2141 |
+
|
2142 |
+
}
|
2143 |
+
add_action( 'wp_ajax_update_attachment_wccm', 'update_attachment_wccm_callback' );
|
2144 |
+
add_action( 'wp_ajax_nopriv_update_attachment_wccm', 'update_attachment_wccm_callback' );
|
2145 |
+
?>
|
includes/checkout-additional.php
ADDED
@@ -0,0 +1,229 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wooccm_checkout_additional_fields( $checkout ) {
|
3 |
+
|
4 |
+
$options = get_option( 'wccs_settings' );
|
5 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
6 |
+
|
7 |
+
// Check if we have any fields to process
|
8 |
+
if( empty( $buttons ) )
|
9 |
+
return;
|
10 |
+
|
11 |
+
foreach( $buttons as $btn ) {
|
12 |
+
|
13 |
+
if( $btn['type'] == 'heading' && empty( $btn['deny_checkout'] ) ) {
|
14 |
+
echo '
|
15 |
+
<h3 class="form-row '.$btn['position'].'" id="'.$btn['cow'].'_field">' . wooccm_wpml_string( $btn['label'] ) . '</h3>';
|
16 |
+
}
|
17 |
+
|
18 |
+
switch( $btn['type'] ) {
|
19 |
+
|
20 |
+
// Text field
|
21 |
+
case 'wooccmtext':
|
22 |
+
woocommerce_form_field( $btn['cow'], array(
|
23 |
+
'type' => 'wooccmtext',
|
24 |
+
'class' => array( $btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'] ),
|
25 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
26 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
27 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
28 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
29 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
30 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
31 |
+
'placeholder' => wooccm_wpml_string( $btn['placeholder'] ),
|
32 |
+
), $checkout->get_value( $btn['cow'] )
|
33 |
+
);
|
34 |
+
break;
|
35 |
+
|
36 |
+
// Textarea field
|
37 |
+
case 'wooccmtextarea':
|
38 |
+
woocommerce_form_field( $btn['cow'], array(
|
39 |
+
'type' => 'wooccmtextarea',
|
40 |
+
'class' => array( $btn['position'].' wccs-form-row-wide '.$btn['conditional_tie'].' '.$btn['extra_class'] ),
|
41 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
42 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
43 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
44 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
45 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
46 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
47 |
+
'placeholder' => wooccm_wpml_string( $btn['placeholder'] ),
|
48 |
+
), $checkout->get_value( $btn['cow'] )
|
49 |
+
);
|
50 |
+
break;
|
51 |
+
|
52 |
+
// Password field
|
53 |
+
case 'wooccmpassword':
|
54 |
+
woocommerce_form_field( $btn['cow'], array(
|
55 |
+
'type' => 'wooccmpassword',
|
56 |
+
'class' => array( $btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].' '.$btn['extra_class'] ),
|
57 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
58 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
59 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
60 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
61 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
62 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
63 |
+
'placeholder' => $btn['placeholder'],
|
64 |
+
), $checkout->get_value( $btn['cow'] )
|
65 |
+
);
|
66 |
+
break;
|
67 |
+
|
68 |
+
// Checkbox field (single)
|
69 |
+
case 'checkbox_wccm':
|
70 |
+
woocommerce_form_field( $btn['cow'], array(
|
71 |
+
'type' => 'checkbox_wccm',
|
72 |
+
'class' => array( $btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'] ),
|
73 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
74 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
75 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
76 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
77 |
+
'required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : false ),
|
78 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : false ),
|
79 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
80 |
+
'options' => $btn['option_array'],
|
81 |
+
), $checkout->get_value( $btn['cow'] )
|
82 |
+
);
|
83 |
+
break;
|
84 |
+
|
85 |
+
// Select field (single)
|
86 |
+
case 'wooccmselect':
|
87 |
+
woocommerce_form_field( $btn['cow'] , array(
|
88 |
+
'type' => 'wooccmselect',
|
89 |
+
'class' => array( $btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'] ),
|
90 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
91 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
92 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
93 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
94 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
95 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
96 |
+
'fancy' => ( isset( $btn['fancy'] ) ? $btn['fancy'] : '' ),
|
97 |
+
'default' => $btn['force_title2'],
|
98 |
+
'options' => $btn['option_array'],
|
99 |
+
), $checkout->get_value( $btn['cow'] )
|
100 |
+
);
|
101 |
+
break;
|
102 |
+
|
103 |
+
// Radio field (multiple)
|
104 |
+
case 'wooccmradio':
|
105 |
+
woocommerce_form_field( $btn['cow'], array(
|
106 |
+
'type' => 'wooccmradio',
|
107 |
+
'class' => array( $btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'] ),
|
108 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
109 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
110 |
+
'default' => $btn['force_title2'],
|
111 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
112 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
113 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
114 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
115 |
+
'options' => $btn['option_array'],
|
116 |
+
), $checkout->get_value( $btn['cow'] )
|
117 |
+
);
|
118 |
+
break;
|
119 |
+
|
120 |
+
// Multiple select field
|
121 |
+
case 'multiselect':
|
122 |
+
woocommerce_form_field( $btn['cow'], array(
|
123 |
+
'type' => 'multiselect',
|
124 |
+
'class' => array( $btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'] ),
|
125 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
126 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
127 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
128 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
129 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
130 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
131 |
+
'options' =>$btn['option_array'],
|
132 |
+
), $checkout->get_value( $btn['cow'] )
|
133 |
+
);
|
134 |
+
break;
|
135 |
+
|
136 |
+
// Mulitple checkbox field
|
137 |
+
case 'multicheckbox':
|
138 |
+
// Check if Multi-checkbox has options assigned to it
|
139 |
+
if( empty( $btn['option_array'] ) )
|
140 |
+
continue;
|
141 |
+
woocommerce_form_field( $btn['cow'], array(
|
142 |
+
'type' => 'multicheckbox',
|
143 |
+
'class' => array( $btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'] ),
|
144 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
145 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
146 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
147 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
148 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
149 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
150 |
+
'options' => $btn['option_array'],
|
151 |
+
), $checkout->get_value( $btn['cow'] )
|
152 |
+
);
|
153 |
+
break;
|
154 |
+
|
155 |
+
// Colour picker
|
156 |
+
case 'colorpicker':
|
157 |
+
woocommerce_form_field( $btn['cow'], array(
|
158 |
+
'type' => 'colorpicker',
|
159 |
+
'class' => array( $btn['position'].' '.$btn['conditional_tie'].' wccs_colorpicker '.$btn['extra_class'] ),
|
160 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
161 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
162 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
163 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
164 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
165 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
166 |
+
'placeholder' => wooccm_wpml_string( $btn['placeholder'] ),
|
167 |
+
'color' => ( isset( $btn['colorpickerd'] ) ? $btn['colorpickerd'] : '' ),
|
168 |
+
'colorpickertype' => ( isset( $btn['colorpickertype'] ) ? $btn['colorpickertype'] : '' )
|
169 |
+
), $checkout->get_value( $btn['cow'] )
|
170 |
+
);
|
171 |
+
break;
|
172 |
+
|
173 |
+
// Date picker
|
174 |
+
case 'datepicker':
|
175 |
+
woocommerce_form_field( $btn['cow'], array(
|
176 |
+
'type' => 'wooccmtext',
|
177 |
+
'class' => array( $btn['position'].' MyDate'.$btn['cow'].' wccs-form-row-wide '.$btn['conditional_tie'].' '.$btn['extra_class'] ),
|
178 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
179 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
180 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
181 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
182 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
183 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
184 |
+
'placeholder' => wooccm_wpml_string( $btn['placeholder'] ),
|
185 |
+
), $checkout->get_value( $btn['cow'] )
|
186 |
+
);
|
187 |
+
break;
|
188 |
+
|
189 |
+
// Time picker
|
190 |
+
case 'time':
|
191 |
+
woocommerce_form_field( $btn['cow'], array(
|
192 |
+
'type' => 'wooccmtext',
|
193 |
+
'class' => array( $btn['position'].' MyTime'.$btn['cow'].' wccs-form-row-wide '.$btn['conditional_tie'].' '.$btn['extra_class']),
|
194 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
195 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
196 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
197 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
198 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
199 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
200 |
+
'placeholder' => wooccm_wpml_string( $btn['placeholder'] ),
|
201 |
+
), $checkout->get_value( $btn['cow'] )
|
202 |
+
);
|
203 |
+
break;
|
204 |
+
|
205 |
+
// File uploader
|
206 |
+
case 'wooccmupload':
|
207 |
+
woocommerce_form_field( $btn['cow'] , array(
|
208 |
+
'type' => 'wooccmupload',
|
209 |
+
'placeholder' => $btn['placeholder'],
|
210 |
+
'class' => array( $btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'] ),
|
211 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
212 |
+
'wooccm_required' => ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' ),
|
213 |
+
'clear' => ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' ),
|
214 |
+
'user_role' => ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' ),
|
215 |
+
'role_options' => ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' ),
|
216 |
+
'role_options2' => ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' ),
|
217 |
+
'fancy' => ( isset( $btn['fancy'] ) ? $btn['fancy'] : '' ),
|
218 |
+
'default' => $btn['force_title2'],
|
219 |
+
'options' => $btn['option_array'],
|
220 |
+
), $checkout->get_value( $btn['cow'] )
|
221 |
+
);
|
222 |
+
break;
|
223 |
+
|
224 |
+
}
|
225 |
+
|
226 |
+
}
|
227 |
+
|
228 |
+
}
|
229 |
+
?>
|
includes/checkout-billing.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wooccm_checkout_billing_fields( $fields ) {
|
3 |
+
|
4 |
+
$options = get_option( 'wccs_settings3' );
|
5 |
+
$buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
|
6 |
+
|
7 |
+
// Check if we have any fields to process
|
8 |
+
if( empty( $buttons ) )
|
9 |
+
return $fields;
|
10 |
+
|
11 |
+
$billing = array(
|
12 |
+
'address_1',
|
13 |
+
'address_2',
|
14 |
+
'city',
|
15 |
+
'postcode',
|
16 |
+
'state',
|
17 |
+
'country'
|
18 |
+
);
|
19 |
+
|
20 |
+
foreach( $buttons as $btn ) {
|
21 |
+
|
22 |
+
if( !empty( $btn['cow'] ) && empty( $btn['deny_checkout'] ) ) {
|
23 |
+
$key = sprintf( 'billing_%s', $btn['cow'] );
|
24 |
+
if( $btn['cow'] == 'country' ) {
|
25 |
+
// Country override
|
26 |
+
$fields[$key]['type'] = 'wooccmcountry';
|
27 |
+
} elseif( $btn['cow'] == 'state' ) {
|
28 |
+
// State override
|
29 |
+
$fields[$key]['type'] = 'wooccmstate';
|
30 |
+
} else {
|
31 |
+
$fields[$key]['type'] = $btn['type'];
|
32 |
+
}
|
33 |
+
|
34 |
+
if( $btn['cow'] !== 'country' || $btn['cow'] !== 'state' ) {
|
35 |
+
$fields[$key]['placeholder'] = ( isset( $btn['placeholder'] ) ? $btn['placeholder'] : '' );
|
36 |
+
}
|
37 |
+
|
38 |
+
// @mod - Why are we not setting the position here like we do for shipping?
|
39 |
+
|
40 |
+
$fields[$key]['class'] = array( $btn['position'].' '. ( isset( $btn['conditional_tie'] ) ? $btn['conditional_tie'] : '' ) .' '. ( isset( $btn['extra_class'] ) ? $btn['extra_class'] : '' ) );
|
41 |
+
$fields[$key]['label'] = wooccm_wpml_string( $btn['label'] );
|
42 |
+
$fields[$key]['clear'] = ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' );
|
43 |
+
$fields[$key]['default'] = ( isset( $btn['force_title2'] ) ? $btn['force_title2'] : '' );
|
44 |
+
$fields[$key]['options'] = ( isset( $btn['option_array'] ) ? $btn['option_array'] : '' );
|
45 |
+
$fields[$key]['user_role'] = ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' );
|
46 |
+
$fields[$key]['role_options'] = ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' );
|
47 |
+
$fields[$key]['role_options2'] = ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' );
|
48 |
+
$fields[$key]['required'] = ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' );
|
49 |
+
$fields[$key]['wooccm_required'] = ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' );
|
50 |
+
$fields[$key]['cow'] = ( isset( $btn['cow'] ) ? $btn['cow'] : '' );
|
51 |
+
$fields[$key]['color'] = ( isset( $btn['colorpickerd'] ) ? $btn['colorpickerd'] : '' );
|
52 |
+
$fields[$key]['colorpickertype'] = ( isset( $btn['colorpickertype'] ) ? $btn['colorpickertype'] : '' );
|
53 |
+
$fields[$key]['order'] = ( isset( $btn['order'] ) ? $btn['order'] : '' );
|
54 |
+
$fields[$key]['fancy'] = ( isset( $btn['fancy'] ) ? $btn['fancy'] : '' );
|
55 |
+
|
56 |
+
// Check if Multi-checkbox has options assigned to it
|
57 |
+
if( $btn['type'] == 'multicheckbox' && empty( $btn['option_array'] ) ) {
|
58 |
+
$btn['disabled'] = true;
|
59 |
+
}
|
60 |
+
|
61 |
+
// Bolt on address-field for address-based fields
|
62 |
+
if( in_array( $btn['cow'], $billing ) ) {
|
63 |
+
$fields[$key]['class'][] = 'address-field';
|
64 |
+
}
|
65 |
+
|
66 |
+
// Remove disabled fields
|
67 |
+
if( !empty( $btn['disabled'] ) ) {
|
68 |
+
unset( $fields[$key] );
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
// Resort the fields by order
|
76 |
+
$fields[] = uasort( $fields, 'wooccm_sort_fields' );
|
77 |
+
|
78 |
+
if( $fields[0] ) {
|
79 |
+
unset( $fields[0] );
|
80 |
+
}
|
81 |
+
|
82 |
+
return $fields;
|
83 |
+
|
84 |
+
}
|
85 |
+
?>
|
includes/checkout-shipping.php
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wooccm_checkout_shipping_fields( $fields = array() ) {
|
3 |
+
|
4 |
+
$options = get_option( 'wccs_settings2' );
|
5 |
+
$buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
|
6 |
+
|
7 |
+
// Check if we have any fields to process
|
8 |
+
if( empty( $buttons ) )
|
9 |
+
return $fields;
|
10 |
+
|
11 |
+
$shipping = array(
|
12 |
+
'address_1',
|
13 |
+
'address_2',
|
14 |
+
'city',
|
15 |
+
'postcode',
|
16 |
+
'state',
|
17 |
+
'country'
|
18 |
+
);
|
19 |
+
|
20 |
+
foreach( $buttons as $btn ) {
|
21 |
+
|
22 |
+
if( !empty( $btn['cow'] ) && empty( $btn['deny_checkout'] ) ) {
|
23 |
+
$key = sprintf( 'shipping_%s', $btn['cow'] );
|
24 |
+
if( $btn['cow'] == 'country' ) {
|
25 |
+
// Country override
|
26 |
+
$fields[$key]['type'] = 'wooccmcountry';
|
27 |
+
} elseif( $btn['cow'] == 'state' ) {
|
28 |
+
// State override
|
29 |
+
$fields[$key]['type'] = 'wooccmstate';
|
30 |
+
} else {
|
31 |
+
$fields[$key]['type'] = $btn['type'];
|
32 |
+
}
|
33 |
+
|
34 |
+
if( $btn['cow'] !== 'country' || $btn['cow'] !== 'state' ) {
|
35 |
+
$fields[$key]['placeholder'] = ( isset( $btn['placeholder'] ) ? $btn['placeholder'] : '' );
|
36 |
+
}
|
37 |
+
|
38 |
+
// Default to Position wide
|
39 |
+
$btn['position'] = ( isset( $btn['position'] ) ? $btn['position'] : 'form-row-wide' );
|
40 |
+
$fields[$key]['class'] = array( $btn['position'].' '. ( isset( $btn['conditional_tie'] ) ? $btn['conditional_tie'] : '' ) .' '. ( isset( $btn['extra_class'] ) ? $btn['extra_class'] : '' ) );
|
41 |
+
$fields[$key]['label'] = wooccm_wpml_string( $btn['label'] );
|
42 |
+
$fields[$key]['clear'] = ( isset( $btn['clear_row'] ) ? $btn['clear_row'] : '' );
|
43 |
+
$fields[$key]['default'] = ( isset( $btn['force_title2'] ) ? $btn['force_title2'] : '' );
|
44 |
+
$fields[$key]['options'] = ( isset( $btn['option_array'] ) ? $btn['option_array'] : '' );
|
45 |
+
$fields[$key]['user_role'] = ( isset( $btn['user_role'] ) ? $btn['user_role'] : '' );
|
46 |
+
$fields[$key]['role_options'] = ( isset( $btn['role_options'] ) ? $btn['role_options'] : '' );
|
47 |
+
$fields[$key]['role_options2'] = ( isset( $btn['role_options2'] ) ? $btn['role_options2'] : '' );
|
48 |
+
$fields[$key]['required'] = ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' );
|
49 |
+
$fields[$key]['wooccm_required'] = ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : '' );
|
50 |
+
$fields[$key]['cow'] = ( isset( $btn['cow'] ) ? $btn['cow'] : '' );
|
51 |
+
$fields[$key]['color'] = ( isset( $btn['colorpickerd'] ) ? $btn['colorpickerd'] : '' );
|
52 |
+
$fields[$key]['colorpickertype'] = ( isset( $btn['colorpickertype'] ) ? $btn['colorpickertype'] : '' );
|
53 |
+
$fields[$key]['order'] = ( isset( $btn['order'] ) ? $btn['order'] : '' );
|
54 |
+
$fields[$key]['fancy'] = ( isset( $btn['fancy'] ) ? $btn['fancy'] : '' );
|
55 |
+
|
56 |
+
// Check if Multi-checkbox has options assigned to it
|
57 |
+
if( $btn['type'] == 'multicheckbox' && empty( $btn['option_array'] ) ) {
|
58 |
+
$btn['disabled'] = true;
|
59 |
+
}
|
60 |
+
|
61 |
+
// Bolt on address-field for address-based fields
|
62 |
+
if( in_array( $btn['cow'], $shipping ) ) {
|
63 |
+
$fields[$key]['class'][] = 'address-field';
|
64 |
+
}
|
65 |
+
|
66 |
+
// Remove disabled fields
|
67 |
+
if( !empty( $btn['disabled'] ) ) {
|
68 |
+
unset( $fields[$key] );
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
}
|
74 |
+
|
75 |
+
// Resort the fields by order
|
76 |
+
$fields[] = uasort( $fields, 'wooccm_sort_fields' );
|
77 |
+
|
78 |
+
if( $fields[0] ) {
|
79 |
+
unset( $fields[0] );
|
80 |
+
}
|
81 |
+
|
82 |
+
return $fields;
|
83 |
+
|
84 |
+
}
|
85 |
+
?>
|
includes/checkout.php
ADDED
@@ -0,0 +1,505 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Decides where the Additional Checkout fields appear on the Checkout page
|
3 |
+
function wooccm_checkout_additional_positioning() {
|
4 |
+
|
5 |
+
$options = get_option( 'wccs_settings' );
|
6 |
+
// Defaults to after_order_notes
|
7 |
+
$position = ( !empty( $options['checkness']['position'] ) ? sanitize_text_field( $options['checkness']['position'] ) : 'after_order_notes' );
|
8 |
+
switch( $position ) {
|
9 |
+
|
10 |
+
case 'before_shipping_form':
|
11 |
+
case 'after_shipping_form':
|
12 |
+
case 'before_billing_form':
|
13 |
+
case 'after_billing_form':
|
14 |
+
case 'after_order_notes':
|
15 |
+
return $position;
|
16 |
+
break;
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
21 |
+
|
22 |
+
function wooccm_autocreate_account( $fields ) {
|
23 |
+
|
24 |
+
$options = get_option( 'wccs_settings' );
|
25 |
+
|
26 |
+
if( !empty( $options['checkness']['auto_create_wccm_account'] ) ) {
|
27 |
+
?>
|
28 |
+
<script type="text/javascript">
|
29 |
+
|
30 |
+
jQuery(document).ready(function() {
|
31 |
+
jQuery( "input#createaccount" ).prop("checked","checked");
|
32 |
+
});
|
33 |
+
|
34 |
+
</script>
|
35 |
+
|
36 |
+
<style type="text/css">
|
37 |
+
.create-account {
|
38 |
+
display:none;
|
39 |
+
}
|
40 |
+
</style>
|
41 |
+
|
42 |
+
<?php
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
function wooccm_display_front() {
|
48 |
+
|
49 |
+
global $woocommerce;
|
50 |
+
|
51 |
+
if( !is_checkout() )
|
52 |
+
return;
|
53 |
+
|
54 |
+
$options = get_option( 'wccs_settings' );
|
55 |
+
|
56 |
+
// Hide Ship to a different address? heading
|
57 |
+
if( !empty( $options['checkness']['additional_info'] ) ) {
|
58 |
+
echo '
|
59 |
+
<style type="text/css">
|
60 |
+
.woocommerce-shipping-fields h3:first-child {
|
61 |
+
display: none;
|
62 |
+
}
|
63 |
+
</style>
|
64 |
+
';
|
65 |
+
}
|
66 |
+
|
67 |
+
// Force show Billing fields
|
68 |
+
if( !empty( $options['checkness']['show_shipping_fields'] ) ) {
|
69 |
+
echo '
|
70 |
+
<style type="text/css">
|
71 |
+
.woocommerce-shipping-fields .shipping_address {
|
72 |
+
display: block !important;
|
73 |
+
}
|
74 |
+
</style>
|
75 |
+
';
|
76 |
+
}
|
77 |
+
|
78 |
+
// Custom CSS
|
79 |
+
echo '
|
80 |
+
<style type="text/css">';
|
81 |
+
if( !empty( $options['checkness']['custom_css_w'] ) ) {
|
82 |
+
echo esc_textarea( $options['checkness']['custom_css_w'] );
|
83 |
+
}
|
84 |
+
echo '
|
85 |
+
|
86 |
+
@media screen and (max-width: 685px) {
|
87 |
+
.woocommerce .checkout .container .wooccm-btn {
|
88 |
+
padding: 1% 6%;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
@media screen and (max-width: 685px) {
|
93 |
+
.woocommerce .checkout .container .wooccm-btn {
|
94 |
+
padding: 1% 8%;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
@media screen and (max-width: 770px) {
|
99 |
+
.checkout .wooccm_each_file .wooccm-image-holder {
|
100 |
+
width: 20%;
|
101 |
+
}
|
102 |
+
.checkout name.wooccm_name, .wooccm_each_file span.container{
|
103 |
+
width: 80%;
|
104 |
+
}
|
105 |
+
.checkout .container .wooccm-btn {
|
106 |
+
padding: 1% 10%;
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
@media screen and (max-width: 992px) {
|
111 |
+
.wooccm_each_file .wooccm-image-holder {
|
112 |
+
width: 26%;
|
113 |
+
}
|
114 |
+
name.wooccm_name, .wooccm_each_file span.container{
|
115 |
+
width: 74%;
|
116 |
+
}
|
117 |
+
.container .wooccm-btn {
|
118 |
+
padding: 5px 8px;
|
119 |
+
font-size: 12px;
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
.container .wooccm-btn {
|
124 |
+
padding: 1.7% 6.7%;
|
125 |
+
}
|
126 |
+
|
127 |
+
#caman_content .blockUI.blockOverlay:before, #caman_content .loader:before {
|
128 |
+
height: 1em;
|
129 |
+
width: 1em;
|
130 |
+
position: absolute;
|
131 |
+
top: 50%;
|
132 |
+
left: 50%;
|
133 |
+
margin-left: -.5em;
|
134 |
+
margin-top: -.5em;
|
135 |
+
display: block;
|
136 |
+
-webkit-animation: spin 1s ease-in-out infinite;
|
137 |
+
-moz-animation: spin 1s ease-in-out infinite;
|
138 |
+
animation: spin 1s ease-in-out infinite;
|
139 |
+
content: "";
|
140 |
+
/* @mod - We need to check this file exists */
|
141 |
+
background: url('.plugins_url( 'woocommerce/assets/images/icons/loader.svg' ).') center center/cover;
|
142 |
+
line-height: 1;
|
143 |
+
text-align: center;
|
144 |
+
font-size: 2em;
|
145 |
+
color: rgba(0,0,0,.75);
|
146 |
+
}
|
147 |
+
body.admin-bar #caman_content {
|
148 |
+
margin-top: 32px;
|
149 |
+
}
|
150 |
+
|
151 |
+
.file_upload_button_hide {
|
152 |
+
display: none;
|
153 |
+
}
|
154 |
+
|
155 |
+
.wooccm_each_file {
|
156 |
+
display: block;
|
157 |
+
padding-top: 20px;
|
158 |
+
clear: both;
|
159 |
+
text-align: center;
|
160 |
+
}
|
161 |
+
.wooccm_each_file .wooccm-image-holder {
|
162 |
+
width: 20%;
|
163 |
+
display: block;
|
164 |
+
float: left;
|
165 |
+
}
|
166 |
+
.wooccm-btn.disable {
|
167 |
+
margin-right: 10px;
|
168 |
+
cursor: auto;
|
169 |
+
}
|
170 |
+
zoom.wooccm_zoom, edit.wooccm_edit, dele.wooccm_dele {
|
171 |
+
padding: 5px;
|
172 |
+
}
|
173 |
+
.wooccm_each_file name {
|
174 |
+
font-size: 18px;
|
175 |
+
}
|
176 |
+
name.wooccm_name, .wooccm_each_file span.container {
|
177 |
+
display: block;
|
178 |
+
padding: 0 0 10px 20px;
|
179 |
+
float: left;
|
180 |
+
width: 80%;
|
181 |
+
}
|
182 |
+
|
183 |
+
.wooccm_each_file img{
|
184 |
+
display: inline-block;
|
185 |
+
height: 90px;
|
186 |
+
border: 2px solid #767676;
|
187 |
+
border-radius: 4px;
|
188 |
+
}
|
189 |
+
.file_upload_account:before{ content: "\f317";font-family: dashicons; margin-right: 10px; }
|
190 |
+
.wooccm_each_file .wooccm_zoom:before{ content: "\f179";font-family: dashicons; margin-right: 5px; }
|
191 |
+
.wooccm_each_file .wooccm_edit:before{ content: "\f464";font-family: dashicons; margin-right: 5px; }
|
192 |
+
.wooccm_each_file .wooccm_dele:before{ content: "\f158";font-family: dashicons; margin-right: 5px; }
|
193 |
+
.wooccm-btn{
|
194 |
+
display: inline-block;
|
195 |
+
padding: 6px 12px;
|
196 |
+
margin-bottom: 0;
|
197 |
+
font-size: 14px;
|
198 |
+
font-weight: 400;
|
199 |
+
line-height: 1.42857143;
|
200 |
+
text-align: center;
|
201 |
+
white-space: nowrap;
|
202 |
+
vertical-align: middle;
|
203 |
+
cursor: pointer;
|
204 |
+
-webkit-user-select: none;
|
205 |
+
-moz-user-select: none;
|
206 |
+
-ms-user-select: none;
|
207 |
+
user-select: none;
|
208 |
+
background-image: none;
|
209 |
+
border: 1px solid transparent;
|
210 |
+
border-radius: 4px;
|
211 |
+
font-family: "Raleway", Arial, Helvetica, sans-serif;
|
212 |
+
color: #767676;
|
213 |
+
background-color: buttonface;
|
214 |
+
align-items: flex-start;
|
215 |
+
text-indent: 0px;
|
216 |
+
text-shadow: none;
|
217 |
+
letter-spacing: normal;
|
218 |
+
word-spacing: normal;
|
219 |
+
text-rendering: auto;
|
220 |
+
}
|
221 |
+
.wooccm-btn-primary {
|
222 |
+
width: 100%;
|
223 |
+
color: #fff;
|
224 |
+
background-color: #428bca;
|
225 |
+
border-color: #357ebd;
|
226 |
+
}
|
227 |
+
|
228 |
+
.wooccm-btn-danger {
|
229 |
+
color: #fff;
|
230 |
+
background-color: #d9534f;
|
231 |
+
border-color: #d43f3a;
|
232 |
+
margin-right: 10px;
|
233 |
+
}
|
234 |
+
.wooccm_each_file .container a:hover, .wooccm_each_file .container a:focus, .wooccm_each_file .container a:active, .wooccm_each_file .container a:visited, .wooccm_each_file .container a:link {
|
235 |
+
color: #fff;
|
236 |
+
}
|
237 |
+
#caman_content #wooccmtoolbar #close:hover, #caman_content #wooccmtoolbar #save:hover {
|
238 |
+
background: #1b1917;
|
239 |
+
}
|
240 |
+
.wooccm-btn-zoom {
|
241 |
+
color: #fff;
|
242 |
+
background-color: #5cb85c;
|
243 |
+
border-color: #4cae4c;
|
244 |
+
margin-right: 10px;
|
245 |
+
}
|
246 |
+
|
247 |
+
.wooccm-btn-edit {
|
248 |
+
color: #fff;
|
249 |
+
background-color: #f0ad4e;
|
250 |
+
border-color: #eea236;
|
251 |
+
margin-right: 10px;
|
252 |
+
}
|
253 |
+
|
254 |
+
</style>
|
255 |
+
';
|
256 |
+
|
257 |
+
}
|
258 |
+
|
259 |
+
function wooccm_checkout_text_after() {
|
260 |
+
|
261 |
+
$options = get_option( 'wccs_settings' );
|
262 |
+
|
263 |
+
if( !empty($options['checkness']['text2']) ) {
|
264 |
+
if( ( isset( $options['checkness']['checkbox3'] ) && $options['checkness']['checkbox3'] == true ) || ( isset( $options['checkness']['checkbox4'] ) && $options['checkness']['checkbox4'] == true ) ) {
|
265 |
+
if( isset( $options['checkness']['checkbox4'] ) && $options['checkness']['checkbox4'] == true ) {
|
266 |
+
echo $options['checkness']['text2'];
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
if( !empty($options['checkness']['text1']) ) {
|
272 |
+
if( $options['checkness']['checkbox1'] == true || $options['checkness']['checkbox2'] == true ) {
|
273 |
+
if( isset( $options['checkness']['checkbox2'] ) && $options['checkness']['checkbox2'] == true ) {
|
274 |
+
echo $options['checkness']['text1'];
|
275 |
+
}
|
276 |
+
}
|
277 |
+
}
|
278 |
+
|
279 |
+
}
|
280 |
+
|
281 |
+
function wooccm_checkout_text_before(){
|
282 |
+
|
283 |
+
$options = get_option( 'wccs_settings' );
|
284 |
+
|
285 |
+
if( !empty( $options['checkness']['text2'] ) ) {
|
286 |
+
if( ( isset( $options['checkness']['checkbox3'] ) && $options['checkness']['checkbox3'] == true ) || ( isset( $options['checkness']['checkbox4'] ) && $options['checkness']['checkbox4'] == true ) ) {
|
287 |
+
if( isset( $options['checkness']['checkbox3'] ) && $options['checkness']['checkbox3'] == true ) {
|
288 |
+
echo $options['checkness']['text2'];
|
289 |
+
}
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
if( !empty( $options['checkness']['text1'] ) ) {
|
294 |
+
if( $options['checkness']['checkbox1'] == true || $options['checkness']['checkbox2'] == true ) {
|
295 |
+
if( isset( $options['checkness']['checkbox1'] ) && $options['checkness']['checkbox1'] == true ) {
|
296 |
+
echo $options['checkness']['text1'];
|
297 |
+
}
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
}
|
302 |
+
|
303 |
+
// We are overriding the default Order Post meta values with our own secret sauce
|
304 |
+
function wooccm_custom_checkout_field_update_order_meta( $order ) {
|
305 |
+
|
306 |
+
// Additional section
|
307 |
+
$options = get_option( 'wccs_settings' );
|
308 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
309 |
+
if( !empty( $buttons ) ) {
|
310 |
+
foreach( $buttons as $btn ) {
|
311 |
+
if( $btn['type'] == 'wooccmtextarea' ) {
|
312 |
+
if( !empty( $_POST[$btn['cow']] ) ) {
|
313 |
+
update_post_meta( $order, $btn['cow'] , wp_kses( $_POST[ $btn['cow']], false ) );
|
314 |
+
}
|
315 |
+
} else if( $btn['type'] !== 'multiselect' && $btn['type'] !== 'multicheckbox' ) {
|
316 |
+
if( !empty( $_POST[$btn['cow']] ) ) {
|
317 |
+
update_post_meta( $order, $btn['cow'] , sanitize_text_field( $_POST[ $btn['cow'] ] ) );
|
318 |
+
}
|
319 |
+
} elseif( $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox' ) {
|
320 |
+
if( !empty( $_POST[$btn['cow']] ) ) {
|
321 |
+
update_post_meta( $order, $btn['cow'] , maybe_serialize( array_map( 'sanitize_text_field', $_POST[$btn['cow']] ) ) );
|
322 |
+
}
|
323 |
+
}
|
324 |
+
}
|
325 |
+
}
|
326 |
+
|
327 |
+
// Shipping section
|
328 |
+
$options = get_option( 'wccs_settings2' );
|
329 |
+
$buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
|
330 |
+
if( !empty( $buttons ) ) {
|
331 |
+
foreach( $buttons as $btn ) {
|
332 |
+
if( $btn['type'] == 'wooccmtextarea' ) {
|
333 |
+
if( !empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
|
334 |
+
update_post_meta( $order, sprintf( '_shipping_%s', $btn['cow'] ), wp_kses( $_POST[sprintf( 'shipping_%s', $btn['cow'] )], false ) );
|
335 |
+
}
|
336 |
+
}
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
+
// Billing section
|
341 |
+
$options = get_option( 'wccs_settings3' );
|
342 |
+
$buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
|
343 |
+
if( !empty( $buttons ) ) {
|
344 |
+
foreach( $buttons as $btn ) {
|
345 |
+
if( $btn['type'] == 'wooccmtextarea' ) {
|
346 |
+
if( !empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
347 |
+
update_post_meta( $order, sprintf( '_billing_%s', $btn['cow'] ), wp_kses( $_POST[sprintf( 'billing_%s', $btn['cow'] )], false ) );
|
348 |
+
}
|
349 |
+
}
|
350 |
+
}
|
351 |
+
}
|
352 |
+
|
353 |
+
}
|
354 |
+
|
355 |
+
function wooccm_custom_checkout_field_update_user_meta( $user_id = 0, $posted ) {
|
356 |
+
|
357 |
+
if( empty( $user_id ) )
|
358 |
+
return;
|
359 |
+
|
360 |
+
// Additional section
|
361 |
+
$options = get_option( 'wccs_settings' );
|
362 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
363 |
+
if( !empty( $buttons ) ) {
|
364 |
+
foreach( $buttons as $btn ) {
|
365 |
+
if( $btn['type'] == 'wooccmtextarea' ) {
|
366 |
+
if( !empty( $_POST[$btn['cow']] ) ) {
|
367 |
+
update_user_meta( $user_id, $btn['cow'], wp_kses( $_POST[$btn['cow']], false ) );
|
368 |
+
}
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
|
373 |
+
// Shipping section
|
374 |
+
$options = get_option( 'wccs_settings2' );
|
375 |
+
$buttons = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : false );
|
376 |
+
if( !empty( $buttons ) ) {
|
377 |
+
foreach( $buttons as $btn ) {
|
378 |
+
if( $btn['type'] == 'wooccmtextarea' ) {
|
379 |
+
if( !empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
|
380 |
+
update_user_meta( $user_id, sprintf( 'shipping_%s', $btn['cow'] ), wp_kses( $_POST[sprintf( 'shipping_%s', $btn['cow'] )], false ) );
|
381 |
+
}
|
382 |
+
}
|
383 |
+
}
|
384 |
+
}
|
385 |
+
|
386 |
+
// Billing section
|
387 |
+
$options = get_option( 'wccs_settings3' );
|
388 |
+
$buttons = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : false );
|
389 |
+
if( !empty( $buttons ) ) {
|
390 |
+
foreach( $buttons as $btn ) {
|
391 |
+
if( $btn['type'] == 'wooccmtextarea' ) {
|
392 |
+
if( !empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
393 |
+
update_user_meta( $user_id, sprintf( 'billing_%s', $btn['cow'] ), wp_kses( $_POST[sprintf( 'billing_%s', $btn['cow'] )], false ) );
|
394 |
+
}
|
395 |
+
}
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
}
|
400 |
+
|
401 |
+
function wooccm_custom_checkout_field_process() {
|
402 |
+
|
403 |
+
global $woocommerce;
|
404 |
+
|
405 |
+
$options = get_option( 'wccs_settings' );
|
406 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
407 |
+
if( !empty( $buttons ) ) {
|
408 |
+
foreach( $buttons as $btn ) {
|
409 |
+
if( isset( $btn['checkbox'] ) && $btn['checkbox'] === 'true' ) {
|
410 |
+
// without checkbox
|
411 |
+
if(
|
412 |
+
empty( $btn['single_px_cat'] ) &&
|
413 |
+
empty( $btn['single_p_cat'] ) &&
|
414 |
+
empty( $btn['single_px'] ) &&
|
415 |
+
empty( $btn['single_p'] ) &&
|
416 |
+
!empty( $btn['label'] ) &&
|
417 |
+
$btn['type'] !== 'wooccmupload' &&
|
418 |
+
$btn['type'] !== 'changename' &&
|
419 |
+
$btn['type'] !== 'heading'
|
420 |
+
) {
|
421 |
+
if( empty( $_POST[$btn['cow']] ) ) {
|
422 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
423 |
+
wc_add_notice( $message, 'error' );
|
424 |
+
}
|
425 |
+
}
|
426 |
+
// checkbox
|
427 |
+
if(
|
428 |
+
empty( $btn['single_px_cat'] ) &&
|
429 |
+
empty( $btn['single_p_cat'] ) &&
|
430 |
+
empty( $btn['single_px'] ) &&
|
431 |
+
empty( $btn['single_p'] ) &&
|
432 |
+
!empty( $btn['label'] ) &&
|
433 |
+
$btn['type'] == 'checkbox' &&
|
434 |
+
$btn['type'] !== 'changename' &&
|
435 |
+
$btn['type'] !== 'wooccmupload' &&
|
436 |
+
$btn['type'] !== 'heading'
|
437 |
+
) {
|
438 |
+
if( ( sanitize_text_field( $_POST[$btn['cow']] ) == $btn['check_2'] ) && ( !empty ($btn['checkbox'] ) ) ) {
|
439 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
440 |
+
wc_add_notice( $message, 'error' );
|
441 |
+
}
|
442 |
+
}
|
443 |
+
}
|
444 |
+
}
|
445 |
+
}
|
446 |
+
|
447 |
+
}
|
448 |
+
|
449 |
+
function wooccm_remove_fields_filter_billing( $fields ) {
|
450 |
+
|
451 |
+
global $woocommerce;
|
452 |
+
|
453 |
+
// Check if the cart is not empty
|
454 |
+
if( empty( $woocommerce->cart->cart_contents ) )
|
455 |
+
return $fields;
|
456 |
+
|
457 |
+
$options = get_option( 'wccs_settings' );
|
458 |
+
|
459 |
+
foreach( $woocommerce->cart->cart_contents as $key => $values ) {
|
460 |
+
|
461 |
+
$multiCategoriesx = ( isset( $options['checkness']['productssave'] ) ? $options['checkness']['productssave'] : '' );
|
462 |
+
$multiCategoriesArrayx = explode(',',$multiCategoriesx);
|
463 |
+
|
464 |
+
if( in_array( $values['product_id'], $multiCategoriesArrayx ) && ( $woocommerce->cart->cart_contents_count < 2 ) ) {
|
465 |
+
unset( $fields['billing']['billing_address_1'] );
|
466 |
+
unset( $fields['billing']['billing_address_2'] );
|
467 |
+
unset( $fields['billing']['billing_phone'] );
|
468 |
+
unset( $fields['billing']['billing_country'] );
|
469 |
+
unset( $fields['billing']['billing_city'] );
|
470 |
+
unset( $fields['billing']['billing_postcode'] );
|
471 |
+
unset( $fields['billing']['billing_state'] );
|
472 |
+
break;
|
473 |
+
}
|
474 |
+
|
475 |
+
}
|
476 |
+
return $fields;
|
477 |
+
|
478 |
+
}
|
479 |
+
|
480 |
+
function wooccm_remove_fields_filter_shipping( $fields ) {
|
481 |
+
|
482 |
+
global $woocommerce;
|
483 |
+
|
484 |
+
// Check if the cart is not empty
|
485 |
+
if( empty( $woocommerce->cart->cart_contents ) )
|
486 |
+
return $fields;
|
487 |
+
|
488 |
+
$options = get_option( 'wccs_settings' );
|
489 |
+
|
490 |
+
foreach( $woocommerce->cart->cart_contents as $key => $values ) {
|
491 |
+
|
492 |
+
$multiCategoriesx = ( isset( $options['checkness']['productssave'] ) ? $options['checkness']['productssave'] : '' );
|
493 |
+
$multiCategoriesArrayx = explode(',',$multiCategoriesx);
|
494 |
+
$_product = $values['data'];
|
495 |
+
|
496 |
+
if( ($woocommerce->cart->cart_contents_count > 1) && ($_product->needs_shipping()) ){
|
497 |
+
remove_filter('woocommerce_checkout_fields','wooccm_remove_fields_filter',15);
|
498 |
+
break;
|
499 |
+
}
|
500 |
+
|
501 |
+
}
|
502 |
+
return $fields;
|
503 |
+
|
504 |
+
}
|
505 |
+
?>
|
includes/classes/export.php
DELETED
@@ -1,652 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WooCommerce Checkout Manager
|
4 |
-
*/
|
5 |
-
|
6 |
-
// Exit if accessed directly
|
7 |
-
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
-
|
9 |
-
function wooccm_additional_gen( $tab, $abbr, $section, $wooname ) {
|
10 |
-
global $woocommerce, $wpdb;
|
11 |
-
$options = get_option( 'wccs_settings' );
|
12 |
-
$options2 = get_option( 'wccs_settings2' ); // shipping
|
13 |
-
$options3 = get_option( 'wccs_settings3' ); // billing
|
14 |
-
|
15 |
-
$args = array(
|
16 |
-
'post_type' => 'shop_order',
|
17 |
-
'posts_per_page' => -1,
|
18 |
-
'post_status' => array( 'wc-processing', 'wc-completed' )
|
19 |
-
);
|
20 |
-
|
21 |
-
$loop = new WP_Query( $args );
|
22 |
-
$csv_output = '';
|
23 |
-
|
24 |
-
if ( $wooname == 'additional' ){
|
25 |
-
$optionname = $options['buttons'];
|
26 |
-
}
|
27 |
-
elseif ( $wooname == 'shipping' ){
|
28 |
-
$optionname = $options2['shipping_buttons'];
|
29 |
-
}
|
30 |
-
elseif ( $wooname == 'billing' ){
|
31 |
-
$optionname = $options3['billing_buttons'];
|
32 |
-
}
|
33 |
-
|
34 |
-
if( !empty($abbr) && $section == 1 ) {
|
35 |
-
if ( $tab == $wooname ) {
|
36 |
-
while ( $loop->have_posts() ) {
|
37 |
-
$loop->the_post();
|
38 |
-
$order_id = $loop->post->ID;
|
39 |
-
$order = new WC_Order($order_id);
|
40 |
-
|
41 |
-
if ( get_post_meta($order_id, $abbr, true) ) {
|
42 |
-
$csv_output .= '["'.$order->billing_first_name.' '.$order->billing_last_name.'", "'.get_post_meta($order_id, $abbr, true).'" ], ';
|
43 |
-
}
|
44 |
-
}
|
45 |
-
}elseif ($tab == 'heading' ) {
|
46 |
-
$csv_output .= '["Name","'.$abbr.'"]';
|
47 |
-
}
|
48 |
-
} elseif( empty($abbr) && $section == 2 ) {
|
49 |
-
if ( $tab == $wooname ) {
|
50 |
-
|
51 |
-
while ( $loop->have_posts() ) {
|
52 |
-
$loop->the_post();
|
53 |
-
$order_id = $loop->post->ID;
|
54 |
-
$order = new WC_Order($order_id);
|
55 |
-
foreach( $optionname as $name ) {
|
56 |
-
if ( get_post_meta($order_id, $name['cow'], true) ) {
|
57 |
-
$listida[] = $order_id;
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
$csv_output = array_unique($listida);
|
62 |
-
}elseif ($tab == 'heading' ) {
|
63 |
-
while ( $loop->have_posts() ) {
|
64 |
-
$loop->the_post();
|
65 |
-
$order_id = $loop->post->ID;
|
66 |
-
$order = new WC_Order($order_id);
|
67 |
-
foreach( $optionname as $n) {
|
68 |
-
if ( get_post_meta($order_id, $n['cow'], true) ) {
|
69 |
-
$lista[] = $n['label'];
|
70 |
-
}
|
71 |
-
}
|
72 |
-
}
|
73 |
-
$csv_output = array_unique($lista);
|
74 |
-
}
|
75 |
-
}
|
76 |
-
return $csv_output;
|
77 |
-
}
|
78 |
-
|
79 |
-
|
80 |
-
/**
|
81 |
-
* Converting data to CSV [ SETTINGS DATA ]
|
82 |
-
*/
|
83 |
-
function wooccm_generate_csv($tab) {
|
84 |
-
|
85 |
-
$options = get_option( 'wccs_settings' );
|
86 |
-
$options2 = get_option( 'wccs_settings2' );
|
87 |
-
$options3 = get_option( 'wccs_settings3' );
|
88 |
-
|
89 |
-
$csv_output = '';
|
90 |
-
|
91 |
-
if ( $tab == 'additional' ) {
|
92 |
-
|
93 |
-
if ( !empty($options['buttons']) ) {
|
94 |
-
|
95 |
-
$total = count($options['buttons']) - 1;
|
96 |
-
|
97 |
-
foreach( $options['buttons'] as $i => $btn) {
|
98 |
-
if( $i != 999 && !empty($btn['cow']) ) {
|
99 |
-
$csv_output .= '[';
|
100 |
-
|
101 |
-
foreach($btn as $n => $dataw) {
|
102 |
-
$csv_output .= '"'.$dataw.'",';
|
103 |
-
}
|
104 |
-
|
105 |
-
if ( $i != $total ) {
|
106 |
-
$csv_output .= '], ';
|
107 |
-
} else {
|
108 |
-
$csv_output .= ']';
|
109 |
-
}
|
110 |
-
}
|
111 |
-
}
|
112 |
-
}
|
113 |
-
}elseif ($tab == 'billing' ) {
|
114 |
-
|
115 |
-
$total = count($options3['billing_buttons']) - 1;
|
116 |
-
|
117 |
-
if (!empty($options3['billing_buttons']) ) {
|
118 |
-
foreach( $options3['billing_buttons'] as $i => $btn) {
|
119 |
-
if( $i != 999 && !empty($btn['cow']) ) {
|
120 |
-
$csv_output .= '[';
|
121 |
-
|
122 |
-
foreach($btn as $n => $dataw) {
|
123 |
-
$csv_output .= '"'.$dataw.'",';
|
124 |
-
}
|
125 |
-
|
126 |
-
if ( $i != $total) {
|
127 |
-
$csv_output .= '], ';
|
128 |
-
} else {
|
129 |
-
$csv_output .= ']';
|
130 |
-
}
|
131 |
-
}
|
132 |
-
}
|
133 |
-
}
|
134 |
-
}elseif ( $tab == 'shipping') {
|
135 |
-
$total = count($options2['shipping_buttons']) -1;
|
136 |
-
|
137 |
-
if( !empty($options2['shipping_buttons']) ) {
|
138 |
-
foreach( $options2['shipping_buttons'] as $i => $btn) {
|
139 |
-
if( $i != 999 && !empty($btn['cow']) ) {
|
140 |
-
$csv_output .= '[';
|
141 |
-
|
142 |
-
foreach($btn as $n => $dataw) {
|
143 |
-
$csv_output .= '"'.$dataw.'",';
|
144 |
-
}
|
145 |
-
|
146 |
-
if ( $i != $total) {
|
147 |
-
$csv_output .= '], ';
|
148 |
-
} else {
|
149 |
-
$csv_output .= ']';
|
150 |
-
}
|
151 |
-
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
}
|
155 |
-
elseif ( $tab == 'general') {
|
156 |
-
|
157 |
-
if( !empty($options['checkness']) ) {
|
158 |
-
$csv_output .= '[';
|
159 |
-
foreach( $options['checkness'] as $i => $btn) {
|
160 |
-
$csv_output .= '"'.$btn.'",';
|
161 |
-
}
|
162 |
-
$csv_output .= ']';
|
163 |
-
}
|
164 |
-
}elseif ($tab == 'heading' ) {
|
165 |
-
|
166 |
-
if (!empty($options3['billing_buttons']) ) {
|
167 |
-
$csv_output .= '[';
|
168 |
-
|
169 |
-
foreach( $options3['billing_buttons'][0] as $n => $dataw) {
|
170 |
-
$csv_output .= '"'.$n.'",';
|
171 |
-
}
|
172 |
-
|
173 |
-
$csv_output .= ']';
|
174 |
-
}
|
175 |
-
}elseif ($tab == 'heading3' ) {
|
176 |
-
|
177 |
-
if (!empty($options['buttons']) ) {
|
178 |
-
$csv_output .= '[';
|
179 |
-
|
180 |
-
foreach( $options['buttons'][0] as $n => $dataw) {
|
181 |
-
$csv_output .= '"'.$n.'",';
|
182 |
-
}
|
183 |
-
|
184 |
-
$csv_output .= ']';
|
185 |
-
}
|
186 |
-
}elseif ($tab == 'heading2' ) {
|
187 |
-
|
188 |
-
if (!empty($options['checkness']) ) {
|
189 |
-
$csv_output .= '[';
|
190 |
-
foreach( $options['checkness'] as $n => $btn) {
|
191 |
-
$csv_output .= '"'.$n.'",';
|
192 |
-
}
|
193 |
-
$csv_output .= ']';
|
194 |
-
}
|
195 |
-
}
|
196 |
-
|
197 |
-
|
198 |
-
return $csv_output;
|
199 |
-
}
|
200 |
-
// --------------- END SETTINGS DATA ----------------
|
201 |
-
|
202 |
-
function wooccm_csvall_heading($heading) {
|
203 |
-
$csv_output .= '["Name", ';
|
204 |
-
foreach($heading as $data ){
|
205 |
-
$csv_output .= '"'.$data.'", ';
|
206 |
-
}
|
207 |
-
$csv_output .= ']';
|
208 |
-
|
209 |
-
return $csv_output;
|
210 |
-
}
|
211 |
-
|
212 |
-
function wooccm_csvall_info($orderids, $wooname){
|
213 |
-
$options = get_option( 'wccs_settings' );
|
214 |
-
$options2 = get_option( 'wccs_settings2' );
|
215 |
-
$options3 = get_option( 'wccs_settings3' );
|
216 |
-
|
217 |
-
foreach( $orderids as $order_id ) {
|
218 |
-
$csv_output .= '["'.get_post_meta($order_id, '_billing_first_name', true).' '.get_post_meta($order_id, '_billing_last_name', true).'", ';
|
219 |
-
|
220 |
-
|
221 |
-
if( $wooname == 'additional'){
|
222 |
-
foreach( $options['buttons'] as $name2 ) {
|
223 |
-
$csv_output .= '"'.get_post_meta($order_id, $name2['cow'], true).'", ';
|
224 |
-
}
|
225 |
-
}
|
226 |
-
if( $wooname == 'billing'){
|
227 |
-
foreach( $options3['billing_buttons'] as $name2 ) {
|
228 |
-
$csv_output .= '"'.get_post_meta($order_id, $name2['cow'], true).'", ';
|
229 |
-
}
|
230 |
-
}
|
231 |
-
if( $wooname == 'shipping'){
|
232 |
-
foreach( $options2['shipping_buttons'] as $name2 ) {
|
233 |
-
$csv_output .= '"'.get_post_meta($order_id, $name2['cow'], true).'", ';
|
234 |
-
}
|
235 |
-
}
|
236 |
-
|
237 |
-
$csv_output .= '], ';
|
238 |
-
}
|
239 |
-
return $csv_output;
|
240 |
-
}
|
241 |
-
|
242 |
-
|
243 |
-
function wooccm_advance_export(){
|
244 |
-
$options = get_option( 'wccs_settings' );
|
245 |
-
$options2 = get_option( 'wccs_settings2' );
|
246 |
-
$options3 = get_option( 'wccs_settings3' );
|
247 |
-
|
248 |
-
if ( isset($_POST['single-download']) && !empty($_POST['single-download']) ) {
|
249 |
-
|
250 |
-
if( $_POST['single-download'] == 'additional' ){
|
251 |
-
$csv = wooccm_additional_gen('additional', $_POST['selectedval'], 1);
|
252 |
-
$heading = wooccm_additional_gen('heading', $_POST['selectedval'], 1);
|
253 |
-
}
|
254 |
-
elseif( $_POST['single-download'] == 'shipping' ){
|
255 |
-
$csv = wooccm_additional_gen('shipping', $_POST['shippingselectedval'], 1, 'shipping');
|
256 |
-
$heading = wooccm_additional_gen('heading', $_POST['shippingselectedval'], 1, 'shipping' );
|
257 |
-
}
|
258 |
-
elseif( $_POST['single-download'] == 'billing' ){
|
259 |
-
$csv = wooccm_additional_gen('billing', $_POST['billingselectedval'], 1, 'billing' );
|
260 |
-
$heading = wooccm_additional_gen('heading', $_POST['billingselectedval'], 1, 'billing' );
|
261 |
-
}
|
262 |
-
?>
|
263 |
-
|
264 |
-
<script type="text/javascript">
|
265 |
-
jQuery(document).ready(function($) {
|
266 |
-
|
267 |
-
var A = [<?php echo $heading.','.$csv; ?>]; // initialize array of rows with header row as 1st item
|
268 |
-
|
269 |
-
var csvRows = [];
|
270 |
-
for(var i=0, l=A.length; i<l; ++i){ // for each array( [..] ), join with commas for csv
|
271 |
-
for (index = 0; index < A[i].length; ++index) {
|
272 |
-
A[i][index] = '"'+A[i][index]+'"'; // add back quotes for each string, to store special characters and commas
|
273 |
-
}
|
274 |
-
csvRows.push( A[i] ); // put data in a java useable array
|
275 |
-
}
|
276 |
-
|
277 |
-
var csvString = csvRows.join("\n"); // make rows for each array
|
278 |
-
|
279 |
-
var a = document.createElement('a');
|
280 |
-
|
281 |
-
a.href = 'data:attachment/csv,' + encodeURIComponent(csvString);
|
282 |
-
a.target = '_blank';
|
283 |
-
a.download = 'only_additional_fieldname.csv';
|
284 |
-
document.body.appendChild(a);
|
285 |
-
a.click();
|
286 |
-
|
287 |
-
});
|
288 |
-
</script>
|
289 |
-
|
290 |
-
<?php }
|
291 |
-
|
292 |
-
// ----------- ALL DOWNLOAD ---------
|
293 |
-
if ( isset($_POST['all-download']) && !empty($_POST['all-download']) ) {
|
294 |
-
|
295 |
-
$abbr = '';
|
296 |
-
if( $_POST['all-download'] == 'additional' ){
|
297 |
-
$csv = wooccm_additional_gen('additional', $abbr, 2);
|
298 |
-
$csv = wooccm_csvall_info($csv, 'additional' );
|
299 |
-
$heading = wooccm_additional_gen('heading', $abbr, 2);
|
300 |
-
$heading = wooccm_csvall_heading($heading);
|
301 |
-
}
|
302 |
-
elseif( $_POST['all-download'] == 'shipping' ){
|
303 |
-
$csv = wooccm_additional_gen('additional', $abbr, 2, 'shipping' );
|
304 |
-
$csv = wooccm_csvall_info($csv, 'shipping' );
|
305 |
-
$heading = wooccm_additional_gen('heading', $abbr, 2, 'shipping');
|
306 |
-
$heading = wooccm_csvall_heading($heading);
|
307 |
-
}
|
308 |
-
elseif( $_POST['all-download'] == 'billing' ){
|
309 |
-
$csv = wooccm_additional_gen('billing', $abbr, 2, 'billing' );
|
310 |
-
$csv = wooccm_csvall_info($csv, 'billing' );
|
311 |
-
$heading = wooccm_additional_gen('heading', $abbr, 2, 'billing' );
|
312 |
-
$heading = wooccm_csvall_heading($heading);
|
313 |
-
}
|
314 |
-
?>
|
315 |
-
|
316 |
-
<script type="text/javascript">
|
317 |
-
jQuery(document).ready(function($) {
|
318 |
-
|
319 |
-
var A = [<?php echo $heading.','.$csv; ?>]; // initialize array of rows with header row as 1st item
|
320 |
-
|
321 |
-
var csvRows = [];
|
322 |
-
for(var i=0, l=A.length; i<l; ++i){ // for each array( [..] ), join with commas for csv
|
323 |
-
for (index = 0; index < A[i].length; ++index) {
|
324 |
-
A[i][index] = '"'+A[i][index]+'"'; // add back quotes for each string, to store special characters and commas
|
325 |
-
}
|
326 |
-
csvRows.push( A[i] ); // put data in a java useable array
|
327 |
-
}
|
328 |
-
|
329 |
-
var csvString = csvRows.join("\n"); // make rows for each array
|
330 |
-
|
331 |
-
var a = document.createElement('a');
|
332 |
-
|
333 |
-
a.href = 'data:attachment/csv,' + encodeURIComponent(csvString);
|
334 |
-
a.target = '_blank';
|
335 |
-
a.download = 'only_additional_fieldname.csv';
|
336 |
-
document.body.appendChild(a);
|
337 |
-
a.click();
|
338 |
-
|
339 |
-
});
|
340 |
-
</script>
|
341 |
-
|
342 |
-
<?php }
|
343 |
-
// ---------- END ALL DOWNLOAD --------------
|
344 |
-
|
345 |
-
// ---------- SETTING DOWNLOAD --------------
|
346 |
-
if ( isset($_POST['setting-download']) && !empty($_POST['setting-download']) ) {
|
347 |
-
|
348 |
-
if( $_POST['setting-download'] == 'additional' ){
|
349 |
-
$csv = wooccm_generate_csv('additional');
|
350 |
-
$heading = wooccm_generate_csv('heading3');
|
351 |
-
}
|
352 |
-
|
353 |
-
print_r( $heading );
|
354 |
-
|
355 |
-
if( $_POST['setting-download'] == 'billing' ){
|
356 |
-
$csv = wooccm_generate_csv('billing');
|
357 |
-
$heading = wooccm_generate_csv('heading');
|
358 |
-
}
|
359 |
-
if( $_POST['setting-download'] == 'shipping' ){
|
360 |
-
$csv = wooccm_generate_csv('shipping');
|
361 |
-
$heading = wooccm_generate_csv('heading');
|
362 |
-
}
|
363 |
-
if( $_POST['setting-download'] == 'general' ){
|
364 |
-
$csv = wooccm_generate_csv('general');
|
365 |
-
$heading = wooccm_generate_csv('heading2');
|
366 |
-
}
|
367 |
-
|
368 |
-
?>
|
369 |
-
|
370 |
-
<script type="text/javascript">
|
371 |
-
jQuery(document).ready(function($) {
|
372 |
-
|
373 |
-
var A = [<?php echo $heading.','.$csv; ?>]; // initialize array of rows with header row as 1st item
|
374 |
-
|
375 |
-
var csvRows = [];
|
376 |
-
for(var i=0, l=A.length; i<l; ++i){ // for each array( [..] ), join with commas for csv
|
377 |
-
for (index = 0; index < A[i].length; ++index) {
|
378 |
-
A[i][index] = '"'+A[i][index]+'"'; // add back quotes for each string, to store special characters and commas
|
379 |
-
}
|
380 |
-
csvRows.push( A[i] ); // put data in a java useable array
|
381 |
-
}
|
382 |
-
|
383 |
-
var csvString = csvRows.join("\n"); // make rows for each array
|
384 |
-
|
385 |
-
var a = document.createElement('a');
|
386 |
-
|
387 |
-
a.href = 'data:attachment/csv,' + encodeURIComponent(csvString);
|
388 |
-
a.target = '_blank';
|
389 |
-
a.download = 'only_additional_fieldname.csv';
|
390 |
-
document.body.appendChild(a);
|
391 |
-
a.click();
|
392 |
-
|
393 |
-
});
|
394 |
-
</script>
|
395 |
-
|
396 |
-
<?php }
|
397 |
-
// ---------------- END SETTING DOWNLOAD --------------
|
398 |
-
?>
|
399 |
-
|
400 |
-
|
401 |
-
<script type="text/javascript">
|
402 |
-
jQuery(document).ready(function() {
|
403 |
-
jQuery(function () {
|
404 |
-
jQuery(".button.single-download.additional").click(function() {
|
405 |
-
jQuery("input[name=single-download]").val("additional");
|
406 |
-
jQuery("#additional_export").submit();
|
407 |
-
});
|
408 |
-
|
409 |
-
jQuery(".button.all-download.additional").click(function() {
|
410 |
-
jQuery("input[name=all-download]").val("additional");
|
411 |
-
jQuery("#additional_export").submit();
|
412 |
-
});
|
413 |
-
|
414 |
-
jQuery(".button.setting-download.additional").click(function() {
|
415 |
-
jQuery("input[name=setting-download]").val("additional");
|
416 |
-
jQuery("#additional_export").submit();
|
417 |
-
});
|
418 |
-
|
419 |
-
<!-- shipping -->
|
420 |
-
jQuery(".button.single-download.shipping").click(function() {
|
421 |
-
jQuery("input[name=single-download]").val("shipping");
|
422 |
-
jQuery("#additional_export").submit();
|
423 |
-
});
|
424 |
-
|
425 |
-
jQuery(".button.all-download.shipping").click(function() {
|
426 |
-
jQuery("input[name=all-download]").val("shipping");
|
427 |
-
jQuery("#additional_export").submit();
|
428 |
-
});
|
429 |
-
jQuery(".button.setting-download.additional").click(function() {
|
430 |
-
jQuery("input[name=setting-download]").val("shipping");
|
431 |
-
jQuery("#additional_export").submit();
|
432 |
-
});
|
433 |
-
<!-- end shipping -->
|
434 |
-
|
435 |
-
|
436 |
-
<!-- billing -->
|
437 |
-
jQuery(".button.single-download.billing").click(function() {
|
438 |
-
jQuery("input[name=single-download]").val("billing");
|
439 |
-
jQuery("#additional_export").submit();
|
440 |
-
});
|
441 |
-
|
442 |
-
jQuery(".button.all-download.billing").click(function() {
|
443 |
-
jQuery("input[name=all-download]").val("billing");
|
444 |
-
jQuery("#additional_export").submit();
|
445 |
-
});
|
446 |
-
|
447 |
-
jQuery(".button.setting-download.additional").click(function() {
|
448 |
-
jQuery("input[name=setting-download]").val("billing");
|
449 |
-
jQuery("#additional_export").submit();
|
450 |
-
});
|
451 |
-
<!-- end billing -->
|
452 |
-
|
453 |
-
});
|
454 |
-
|
455 |
-
});
|
456 |
-
</script>
|
457 |
-
|
458 |
-
|
459 |
-
<div class="wrap">
|
460 |
-
|
461 |
-
<div id="welcome-panel" class="welcome-panel heading">
|
462 |
-
<h1 class="heading-blue"><?php _e( 'Field Data Export', 'woocommerce-checkout-manager'); ?></h1>
|
463 |
-
</div>
|
464 |
-
|
465 |
-
|
466 |
-
<div id="welcome-panel" class="welcome-panel heading">
|
467 |
-
<form name="additionalexport" method="post" action="" id="additional_export">
|
468 |
-
<input type="hidden" name="single-download" val="" />
|
469 |
-
<input type="hidden" name="all-download" val="" />
|
470 |
-
<input type="hidden" name="setting-download" val="" />
|
471 |
-
|
472 |
-
|
473 |
-
<div id="welcome-panel" class="welcome-panel left">
|
474 |
-
|
475 |
-
<!-- ADDITIONAL SECTION -->
|
476 |
-
<p class="about-description heading"><?php _e( 'Additional Fields Section', 'woocommerce-checkout-manager'); ?>
|
477 |
-
</p>
|
478 |
-
<hr />
|
479 |
-
<div class="welcome-panel-content">
|
480 |
-
<p class="about-description inner"><?php _e( 'Export All Orders with abbreviation name : ', 'woocommerce-checkout-manager'); ?>
|
481 |
-
<select name="selectedval">
|
482 |
-
<?php foreach( $options['buttons'] as $name ) { ?>
|
483 |
-
<option value="<?php echo $name['cow']; ?>"><?php echo $name['cow']; ?></option>
|
484 |
-
<?php } ?>
|
485 |
-
</select>
|
486 |
-
</p>
|
487 |
-
|
488 |
-
|
489 |
-
<div class="welcome-panel-column-container">
|
490 |
-
<div class="welcome-panel-column">
|
491 |
-
<ul>
|
492 |
-
<a class="button button-primary button-hero single-download additional" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
493 |
-
</ul>
|
494 |
-
</div>
|
495 |
-
</div>
|
496 |
-
|
497 |
-
<div class="sheet ">
|
498 |
-
</div>
|
499 |
-
<p style="clear:both;" class="about-description inner"><?php _e( 'Export All Orders', 'woocommerce-checkout-manager'); ?>
|
500 |
-
</p>
|
501 |
-
|
502 |
-
<div class="welcome-panel-column-container">
|
503 |
-
<div class="welcome-panel-column">
|
504 |
-
<ul>
|
505 |
-
<a class="button button-primary button-hero all-download additional" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
506 |
-
</ul>
|
507 |
-
</div>
|
508 |
-
</div>
|
509 |
-
|
510 |
-
<div class="sheet ">
|
511 |
-
</div>
|
512 |
-
|
513 |
-
|
514 |
-
<p style="clear:both;" class="about-description inner"><?php _e( 'Export Settings', 'woocommerce-checkout-manager'); ?>
|
515 |
-
</p>
|
516 |
-
|
517 |
-
<div class="welcome-panel-column-container">
|
518 |
-
<div class="welcome-panel-column">
|
519 |
-
<ul>
|
520 |
-
<a class="button button-primary button-hero setting-download additional" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
521 |
-
</ul>
|
522 |
-
</div>
|
523 |
-
</div>
|
524 |
-
|
525 |
-
|
526 |
-
</div>
|
527 |
-
<!-- // END ADDITIONAL SECTION -->
|
528 |
-
</div>
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
<div id="welcome-panel" class="welcome-panel left billing">
|
533 |
-
<!-- BILLING SECTION -->
|
534 |
-
<p class="about-description heading"><?php _e( 'Billing Fields Section', 'woocommerce-checkout-manager'); ?>
|
535 |
-
</p>
|
536 |
-
<hr />
|
537 |
-
<div class="welcome-panel-content">
|
538 |
-
<p class="about-description inner"><?php _e( 'Export All Orders with abbreviation name : ', 'woocommerce-checkout-manager'); ?>
|
539 |
-
<select name="billingselectedval">
|
540 |
-
<?php foreach( $options3['billing_buttons'] as $name ) { ?>
|
541 |
-
<option value="<?php echo $name['cow']; ?>"><?php echo $name['cow']; ?></option>
|
542 |
-
<?php } ?>
|
543 |
-
</select>
|
544 |
-
</p>
|
545 |
-
|
546 |
-
|
547 |
-
<div class="welcome-panel-column-container">
|
548 |
-
<div class="welcome-panel-column">
|
549 |
-
<ul>
|
550 |
-
<a class="button button-primary button-hero single-download billing" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
551 |
-
</ul>
|
552 |
-
</div>
|
553 |
-
</div>
|
554 |
-
|
555 |
-
<div class="sheet ">
|
556 |
-
</div>
|
557 |
-
<p style="clear:both;" class="about-description inner"><?php _e( 'Export All Orders', 'woocommerce-checkout-manager'); ?>
|
558 |
-
</p>
|
559 |
-
|
560 |
-
<div class="welcome-panel-column-container">
|
561 |
-
<div class="welcome-panel-column">
|
562 |
-
<ul>
|
563 |
-
<a class="button button-primary button-hero all-download billing" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
564 |
-
</ul>
|
565 |
-
</div>
|
566 |
-
</div>
|
567 |
-
|
568 |
-
<div class="sheet ">
|
569 |
-
</div>
|
570 |
-
|
571 |
-
|
572 |
-
<p style="clear:both;" class="about-description inner"><?php _e( 'Export Settings', 'woocommerce-checkout-manager'); ?>
|
573 |
-
</p>
|
574 |
-
|
575 |
-
<div class="welcome-panel-column-container">
|
576 |
-
<div class="welcome-panel-column">
|
577 |
-
<ul>
|
578 |
-
<a class="button button-primary button-hero setting-download billing" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
579 |
-
</ul>
|
580 |
-
</div>
|
581 |
-
</div>
|
582 |
-
|
583 |
-
|
584 |
-
</div>
|
585 |
-
</div>
|
586 |
-
<!-- END BILLING SECTION -->
|
587 |
-
|
588 |
-
|
589 |
-
<div id="welcome-panel" class="welcome-panel left shipping">
|
590 |
-
<!-- SHIPPING SECTION -->
|
591 |
-
<p class="about-description heading"><?php _e( 'Shipping Fields Section', 'woocommerce-checkout-manager'); ?>
|
592 |
-
</p>
|
593 |
-
<hr />
|
594 |
-
<div class="welcome-panel-content">
|
595 |
-
<p class="about-description inner"><?php _e( 'Export All Orders with abbreviation name : ', 'woocommerce-checkout-manager'); ?>
|
596 |
-
<select name="shippingselectedval">
|
597 |
-
<?php foreach( $options2['shipping_buttons'] as $name ) { ?>
|
598 |
-
<option value="<?php echo $name['cow']; ?>"><?php echo $name['cow']; ?></option>
|
599 |
-
<?php } ?>
|
600 |
-
</select>
|
601 |
-
</p>
|
602 |
-
|
603 |
-
|
604 |
-
<div class="welcome-panel-column-container">
|
605 |
-
<div class="welcome-panel-column">
|
606 |
-
<ul>
|
607 |
-
<a class="button button-primary button-hero single-download shipping" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
608 |
-
</ul>
|
609 |
-
</div>
|
610 |
-
</div>
|
611 |
-
|
612 |
-
<div class="sheet ">
|
613 |
-
</div>
|
614 |
-
<p style="clear:both;" class="about-description inner"><?php _e( 'Export All Orders', 'woocommerce-checkout-manager'); ?>
|
615 |
-
</p>
|
616 |
-
|
617 |
-
<div class="welcome-panel-column-container">
|
618 |
-
<div class="welcome-panel-column">
|
619 |
-
<ul>
|
620 |
-
<a class="button button-primary button-hero all-download shipping" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
621 |
-
</ul>
|
622 |
-
</div>
|
623 |
-
</div>
|
624 |
-
|
625 |
-
<div class="sheet ">
|
626 |
-
</div>
|
627 |
-
|
628 |
-
|
629 |
-
<p style="clear:both;" class="about-description inner"><?php _e( 'Export Settings', 'woocommerce-checkout-manager'); ?>
|
630 |
-
</p>
|
631 |
-
|
632 |
-
<div class="welcome-panel-column-container">
|
633 |
-
<div class="welcome-panel-column">
|
634 |
-
<ul>
|
635 |
-
<a class="button button-primary button-hero setting-download shipping" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
636 |
-
</ul>
|
637 |
-
</div>
|
638 |
-
</div>
|
639 |
-
|
640 |
-
|
641 |
-
</div>
|
642 |
-
</div>
|
643 |
-
<!-- END SHIPPING SECTION -->
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
</form>
|
649 |
-
</div>
|
650 |
-
</div>
|
651 |
-
|
652 |
-
<?php }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/classes/field_filters.php
CHANGED
@@ -6,988 +6,960 @@
|
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
add_filter('woocommerce_form_field_wooccmpassword', 'wooccmpassword_handler', 10, 4);
|
11 |
-
function wooccmpassword_handler( $field = '', $key, $args, $value ) {
|
12 |
-
global $current_user;
|
13 |
$user_roles = $current_user->roles;
|
14 |
$user_role = array_shift($user_roles);
|
15 |
-
|
16 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
17 |
$rolekeys = explode('||',$args['role_options']);
|
18 |
$rolekeys2 = explode('||',$args['role_options2']);
|
19 |
-
if
|
20 |
return;
|
21 |
}
|
22 |
-
if
|
23 |
return;
|
24 |
}
|
25 |
-
}
|
26 |
-
|
27 |
-
if ( ( ! empty( $args['clear'] ) ) ) {
|
28 |
-
$after = '<div class="clear"></div>';
|
29 |
-
} else {
|
30 |
-
$after = '';
|
31 |
-
}
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
$required = '';
|
38 |
-
}
|
39 |
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
|
43 |
-
$args['label_class'] = array( $args['label_class'] );
|
44 |
-
}
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
|
50 |
-
|
51 |
-
$
|
|
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
57 |
}
|
|
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
}
|
63 |
}
|
|
|
64 |
|
65 |
-
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
-
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
|
77 |
-
|
78 |
|
79 |
return $field;
|
|
|
80 |
}
|
|
|
|
|
|
|
|
|
81 |
|
|
|
82 |
|
83 |
-
add_filter('woocommerce_form_field_wooccmtextarea', 'wooccmtextarea_handler', 10, 4);
|
84 |
-
function wooccmtextarea_handler( $field = '', $key, $args, $value ) {
|
85 |
-
global $current_user;
|
86 |
$user_roles = $current_user->roles;
|
87 |
$user_role = array_shift($user_roles);
|
88 |
|
89 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
90 |
$rolekeys = explode('||',$args['role_options']);
|
91 |
$rolekeys2 = explode('||',$args['role_options2']);
|
92 |
-
|
93 |
-
|
94 |
-
}
|
95 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
96 |
-
return;
|
97 |
-
}
|
98 |
-
}
|
99 |
-
|
100 |
-
if ( ( ! empty( $args['clear'] ) ) ) {
|
101 |
-
$after = '<div class="clear"></div>';
|
102 |
-
} else {
|
103 |
-
$after = '';
|
104 |
}
|
105 |
-
|
106 |
-
|
107 |
-
$args['class'][] = 'validate-required';
|
108 |
-
$required = ' <abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>';
|
109 |
-
} else {
|
110 |
-
$required = '';
|
111 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
-
|
116 |
-
$args['label_class'] = array( $args['label_class'] );
|
117 |
-
}
|
118 |
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
122 |
|
123 |
-
|
124 |
-
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
}
|
130 |
}
|
|
|
131 |
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
}
|
136 |
}
|
|
|
137 |
|
138 |
-
|
139 |
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
|
144 |
-
|
|
|
|
|
145 |
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
|
|
149 |
|
150 |
-
|
151 |
|
152 |
return $field;
|
|
|
153 |
}
|
|
|
154 |
|
|
|
|
|
155 |
|
156 |
-
|
157 |
-
function wooccmupload_handler( $field = '', $key, $args, $value ) {
|
158 |
-
global $wpdb, $woocommerce, $post, $current_user;
|
159 |
|
160 |
$user_roles = $current_user->roles;
|
161 |
$user_role = array_shift($user_roles);
|
162 |
-
|
163 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
164 |
$rolekeys = explode('||',$args['role_options']);
|
165 |
$rolekeys2 = explode('||',$args['role_options2']);
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
}
|
173 |
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
} else {
|
179 |
-
$after = '';
|
180 |
-
}
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
|
189 |
-
|
190 |
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
|
199 |
-
|
200 |
-
|
201 |
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
}
|
206 |
}
|
|
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
}
|
212 |
}
|
|
|
|
|
|
|
213 |
|
214 |
-
|
|
|
|
|
|
|
|
|
215 |
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
<button type="button" class="file_upload_account wooccm-btn wooccm-btn-primary start" id="' . esc_attr( $key ) . '_files_button_wccm">'.$upload_name.'</button>';
|
223 |
|
224 |
-
$field .= '</p>' . $after;
|
225 |
-
|
226 |
return $field;
|
|
|
227 |
}
|
|
|
|
|
|
|
|
|
228 |
|
|
|
229 |
|
230 |
-
add_filter('woocommerce_form_field_wooccmtext', 'wooccmtext_handler', 10, 4);
|
231 |
-
function wooccmtext_handler( $field = '', $key, $args, $value ) {
|
232 |
-
global $current_user;
|
233 |
$user_roles = $current_user->roles;
|
234 |
$user_role = array_shift($user_roles);
|
235 |
-
|
236 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
237 |
$rolekeys = explode('||',$args['role_options']);
|
238 |
$rolekeys2 = explode('||',$args['role_options2']);
|
239 |
-
|
240 |
-
|
241 |
-
}
|
242 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
243 |
-
return;
|
244 |
-
}
|
245 |
-
}
|
246 |
-
|
247 |
-
if ( ( ! empty( $args['clear'] ) ) ) {
|
248 |
-
$after = '<div class="clear"></div>';
|
249 |
-
} else {
|
250 |
-
$after = '';
|
251 |
}
|
252 |
-
|
253 |
-
|
254 |
-
$args['class'][] = 'validate-required';
|
255 |
-
$required = ' <abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>';
|
256 |
-
} else {
|
257 |
-
$required = '';
|
258 |
}
|
|
|
259 |
|
260 |
-
|
|
|
|
|
|
|
261 |
|
262 |
-
|
263 |
-
|
264 |
-
|
|
|
|
|
|
|
265 |
|
266 |
-
|
267 |
-
$value = $args['default'];
|
268 |
-
}
|
269 |
|
270 |
-
|
271 |
-
$custom_attributes = array();
|
272 |
|
273 |
-
|
274 |
-
foreach ( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
275 |
-
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
276 |
-
}
|
277 |
-
}
|
278 |
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
}
|
283 |
}
|
|
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
if ( $args['label'] ) {
|
288 |
-
$field .= '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label'] . $required . '</label>';
|
289 |
-
}
|
290 |
-
|
291 |
-
$field .= '<input type="text" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" '.$args['maxlength'].' value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
|
292 |
-
|
293 |
-
if ( $args['description'] ) {
|
294 |
-
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
295 |
-
}
|
296 |
-
|
297 |
-
$field .= '</p>' . $after;
|
298 |
|
299 |
return $field;
|
|
|
300 |
}
|
|
|
|
|
|
|
|
|
301 |
|
|
|
302 |
|
303 |
-
add_filter('woocommerce_form_field_wooccmstate', 'wooccmstate_handler', 10, 4);
|
304 |
-
function wooccmstate_handler( $field = '', $key, $args, $value ) {
|
305 |
-
global $current_user;
|
306 |
$user_roles = $current_user->roles;
|
307 |
$user_role = array_shift($user_roles);
|
308 |
-
|
309 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
310 |
$rolekeys = explode('||',$args['role_options']);
|
311 |
$rolekeys2 = explode('||',$args['role_options2']);
|
312 |
-
|
313 |
-
|
314 |
-
}
|
315 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
316 |
-
return;
|
317 |
-
}
|
318 |
-
}
|
319 |
-
|
320 |
-
if ( ( ! empty( $args['clear'] ) ) ) {
|
321 |
-
$after = '<div class="clear"></div>';
|
322 |
-
} else {
|
323 |
-
$after = '';
|
324 |
}
|
325 |
-
|
326 |
-
|
327 |
-
$args['class'][] = 'validate-required';
|
328 |
-
$required = ' <abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>';
|
329 |
-
} else {
|
330 |
-
$required = '';
|
331 |
}
|
|
|
332 |
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
}
|
338 |
-
|
339 |
-
if ( is_null( $value ) ) {
|
340 |
-
$value = $args['default'];
|
341 |
-
}
|
342 |
-
|
343 |
-
// Custom attribute handling
|
344 |
-
$custom_attributes = array();
|
345 |
-
|
346 |
-
if ( ! empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) ) {
|
347 |
-
foreach ( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
348 |
-
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
349 |
-
}
|
350 |
-
}
|
351 |
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
/* Get Country */
|
359 |
-
$country_key = $key == 'billing_state'? 'billing_country' : 'shipping_country';
|
360 |
-
$current_cc = WC()->checkout->get_value( $country_key );
|
361 |
-
$states = WC()->countries->get_states( $current_cc );
|
362 |
|
363 |
-
|
364 |
|
365 |
-
|
366 |
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
|
372 |
-
|
373 |
-
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
374 |
-
}
|
375 |
|
376 |
-
|
|
|
377 |
|
378 |
-
|
|
|
|
|
|
|
|
|
379 |
|
380 |
-
|
381 |
|
382 |
-
|
383 |
-
|
384 |
-
$field .= '<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" class="state_select ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" ' . implode( ' ', $custom_attributes ) . ' placeholder="' . esc_attr( $args['placeholder'] ) . '">
|
385 |
-
<option value="">'.__( 'Select a state…', 'woocommerce' ) .'</option>';
|
386 |
|
387 |
-
|
388 |
-
|
389 |
-
}
|
390 |
|
391 |
-
|
392 |
|
393 |
-
|
394 |
-
|
395 |
-
}
|
396 |
|
397 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
398 |
|
399 |
-
|
400 |
|
401 |
-
|
|
|
|
|
|
|
402 |
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
|
|
|
|
407 |
|
408 |
-
|
409 |
-
|
410 |
-
|
|
|
|
|
|
|
411 |
|
412 |
-
|
413 |
-
}
|
414 |
|
415 |
-
return $field;
|
416 |
}
|
|
|
417 |
|
|
|
|
|
|
|
|
|
418 |
|
419 |
-
add_filter('woocommerce_form_field_wooccmcountry', 'wooccmcountry_handler', 10, 4);
|
420 |
-
function wooccmcountry_handler( $field = '', $key, $args, $value ) {
|
421 |
-
global $current_user;
|
422 |
$user_roles = $current_user->roles;
|
423 |
$user_role = array_shift($user_roles);
|
424 |
-
|
425 |
-
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
426 |
-
$rolekeys = explode('||',$args['role_options']);
|
427 |
-
$rolekeys2 = explode('||',$args['role_options2']);
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
}
|
434 |
-
}
|
435 |
-
|
436 |
-
if ( ( ! empty( $args['clear'] ) ) ) {
|
437 |
-
$after = '<div class="clear"></div>';
|
438 |
-
} else {
|
439 |
-
$after = '';
|
440 |
}
|
|
|
441 |
|
442 |
-
|
443 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
$args['class'][] = 'validate-required';
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
|
450 |
-
|
451 |
|
452 |
-
|
453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
}
|
|
|
455 |
|
456 |
-
|
457 |
-
|
|
|
458 |
}
|
|
|
459 |
|
460 |
-
|
461 |
-
$custom_attributes = array();
|
462 |
|
463 |
-
|
464 |
-
foreach ( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
465 |
-
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
466 |
-
}
|
467 |
-
}
|
468 |
|
469 |
-
if
|
470 |
-
|
471 |
-
$args['class'][] = 'validate-' . $validate;
|
472 |
-
}
|
473 |
}
|
|
|
474 |
|
475 |
-
|
|
|
|
|
476 |
|
477 |
-
|
478 |
|
479 |
-
|
480 |
|
481 |
-
|
482 |
-
$field .= '<label class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label'] . '</label>';
|
483 |
-
}
|
484 |
|
485 |
-
|
|
|
|
|
|
|
486 |
|
487 |
-
|
|
|
|
|
488 |
|
489 |
-
|
490 |
-
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
491 |
-
}
|
492 |
|
493 |
-
|
|
|
|
|
494 |
|
495 |
-
|
496 |
|
497 |
-
|
498 |
-
. '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label'] . $required . '</label>'
|
499 |
-
. '<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" class="country_to_state country_select ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" ' . implode( ' ', $custom_attributes ) . '>'
|
500 |
-
. '<option value="">'.__( 'Select a country…', 'woocommerce' ) .'</option>';
|
501 |
|
502 |
-
|
503 |
-
$field .= '<option value="' . esc_attr( $ckey ) . '" '.selected( $value, $ckey, false ) .'>'.__( $cvalue, 'woocommerce' ) .'</option>';
|
504 |
-
}
|
505 |
|
506 |
-
|
|
|
|
|
|
|
507 |
|
508 |
-
|
|
|
|
|
509 |
|
510 |
-
|
511 |
-
|
512 |
-
}
|
513 |
|
514 |
-
|
515 |
-
}
|
516 |
|
517 |
-
return $field;
|
518 |
}
|
|
|
519 |
|
|
|
|
|
|
|
|
|
520 |
|
521 |
-
add_filter('woocommerce_form_field_multiselect', 'wooccm_multiselect_handler', 10, 4);
|
522 |
-
function wooccm_multiselect_handler( $field = '', $key, $args, $value ) {
|
523 |
-
global $current_user;
|
524 |
$user_roles = $current_user->roles;
|
525 |
$user_role = array_shift($user_roles);
|
526 |
-
|
527 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
528 |
$rolekeys = explode('||',$args['role_options']);
|
529 |
$rolekeys2 = explode('||',$args['role_options2']);
|
530 |
-
|
531 |
-
|
532 |
-
}
|
533 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
534 |
-
return;
|
535 |
-
}
|
536 |
-
}
|
537 |
-
|
538 |
-
|
539 |
-
if ( ( ! empty( $args['clear'] ) ) ) $after = '<div class="clear"></div>'; else $after = '';
|
540 |
-
|
541 |
-
if ( $args['wooccm_required'] ) {
|
542 |
-
$args['class'][] = 'validate-required';
|
543 |
-
$required = ' <abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>';
|
544 |
-
} else {
|
545 |
-
$required = '';
|
546 |
}
|
|
|
|
|
|
|
|
|
547 |
|
548 |
-
|
549 |
-
|
550 |
-
|
|
|
|
|
551 |
|
552 |
-
|
553 |
-
foreach (explode('||',$args['options']) as $option_key => $option_text )
|
554 |
-
$options .= '<option value="'.wpml_string_wccm_pro( esc_attr( $option_text ) ).'" '. selected( $value, $option_key, false ) . '>' . wpml_string_wccm_pro( esc_attr( $option_text ) ) .'</option>';
|
555 |
|
556 |
-
|
|
|
|
|
|
|
|
|
|
|
557 |
|
558 |
-
|
559 |
-
$field .= '<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>';
|
560 |
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
</p>' . $after;
|
565 |
|
566 |
-
|
567 |
-
|
|
|
568 |
|
|
|
|
|
569 |
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
577 |
-
$rolekeys = explode('||',$args['role_options']);
|
578 |
-
$rolekeys2 = explode('||',$args['role_options2']);
|
579 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
580 |
-
return;
|
581 |
-
}
|
582 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
583 |
-
return;
|
584 |
-
}
|
585 |
-
}
|
586 |
-
|
587 |
-
|
588 |
-
if ( ( ! empty( $args['clear'] ) ) ) $after = '<div class="clear"></div>'; else $after = '';
|
589 |
|
590 |
-
|
591 |
-
|
592 |
-
$
|
593 |
-
} else {
|
594 |
-
$required = '';
|
595 |
}
|
|
|
596 |
|
597 |
-
|
598 |
|
599 |
-
|
600 |
|
601 |
-
|
602 |
-
foreach (explode('||',$args['options']) as $option_key => $option_text )
|
603 |
-
$options .= '' . wpml_string_wccm_pro( esc_attr( $option_text ) ) .' <input type="checkbox" name="' . esc_attr( $key ) . '[]" value="'.wpml_string_wccm_pro( esc_attr( $option_text ) ).'" '. selected( $value, $option_key, false ) . ' /><br />';
|
604 |
|
605 |
-
|
|
|
|
|
606 |
|
607 |
-
|
608 |
-
$field .= '<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>';
|
609 |
|
610 |
-
|
611 |
-
</p>' . $after;
|
612 |
|
613 |
-
|
614 |
-
|
|
|
615 |
|
|
|
616 |
|
617 |
-
|
618 |
-
function wooccm_radio_handler( $field = '', $key, $args, $value ) {
|
619 |
-
global $current_user;
|
620 |
-
$user_roles = $current_user->roles;
|
621 |
-
$user_role = array_shift($user_roles);
|
622 |
-
|
623 |
-
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
624 |
-
$rolekeys = explode('||',$args['role_options']);
|
625 |
-
$rolekeys2 = explode('||',$args['role_options2']);
|
626 |
-
if (!empty($args['role_options']) && !in_array($user_role, $rolekeys)) {
|
627 |
-
return;
|
628 |
-
}
|
629 |
-
if (!empty($args['role_options2']) && in_array($user_role, $rolekeys2)) {
|
630 |
-
return;
|
631 |
-
}
|
632 |
-
}
|
633 |
-
|
634 |
-
if ( ( ! empty( $args['clear'] ) ) ) $after = '<div class="clear"></div>'; else $after = '';
|
635 |
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
$required = '';
|
641 |
-
}
|
642 |
|
643 |
-
|
|
|
|
|
644 |
|
645 |
-
$field
|
646 |
|
647 |
-
$field .= '<
|
648 |
|
649 |
-
if
|
|
|
|
|
650 |
|
651 |
-
|
652 |
-
$field .= '<label><input type="radio" ' . checked( $value, wpml_string_wccm_pro( esc_attr( $option_text ) ), false ) . ' name="' . esc_attr( $key ) . '" value="' . wpml_string_wccm_pro( esc_attr( $option_text ) ). '" /> ' . wpml_string_wccm_pro( esc_html( $option_text ) ). '</label>';
|
653 |
|
654 |
-
|
655 |
|
656 |
-
|
657 |
|
658 |
}
|
|
|
|
|
|
|
|
|
659 |
|
|
|
660 |
|
661 |
-
add_filter('woocommerce_form_field_wooccmselect', 'wooccm_select_handler', 10, 4);
|
662 |
-
function wooccm_select_handler( $field = '', $key, $args, $value ) {
|
663 |
-
global $current_user;
|
664 |
$user_roles = $current_user->roles;
|
665 |
$user_role = array_shift($user_roles);
|
666 |
-
|
667 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
668 |
$rolekeys = explode('||',$args['role_options']);
|
669 |
$rolekeys2 = explode('||',$args['role_options2']);
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
}
|
676 |
-
}
|
677 |
-
|
678 |
-
if ( ( ! empty( $args['clear'] ) ) ) $after = '<div class="clear"></div>'; else $after = '';
|
679 |
-
|
680 |
-
if ( $args['wooccm_required'] ) {
|
681 |
-
$args['class'][] = 'validate-required';
|
682 |
-
$required = ' <abbr class="required" title="' . esc_attr__( 'required', 'woocommerce' ) . '">*</abbr>';
|
683 |
-
} else {
|
684 |
-
$required = '';
|
685 |
}
|
|
|
686 |
|
687 |
-
|
|
|
|
|
|
|
688 |
|
689 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
690 |
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
$options .= '<option '. selected( $value, $option_key, false ) . '>' . wpml_string_wccm_pro( esc_attr( $option_text ) ) .'</option>';
|
695 |
|
696 |
-
|
697 |
|
698 |
-
|
699 |
-
|
700 |
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
|
706 |
-
|
707 |
|
708 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
709 |
|
710 |
-
add_filter('woocommerce_form_field_checkbox_wccm', 'wooccm_checkbox_handler', 10, 4);
|
711 |
-
function wooccm_checkbox_handler( $field = '', $key, $args, $value ) {
|
712 |
-
global $current_user;
|
713 |
$user_roles = $current_user->roles;
|
714 |
-
$user_role = array_shift($user_roles);
|
715 |
-
|
716 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
717 |
$rolekeys = explode('||',$args['role_options']);
|
718 |
$rolekeys2 = explode('||',$args['role_options2']);
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
}
|
726 |
-
|
727 |
-
$args['options'] = explode('||',$args['options']);
|
728 |
-
|
729 |
-
if ( ( ! empty( $args['clear'] ) ) ) $after = '<div class="clear"></div>'; else $after = '';
|
730 |
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
736 |
}
|
|
|
737 |
|
738 |
-
$field = '<p class="form-row ' . implode( ' ', $args['class'] ) .'" id="' . $key . '_field">
|
739 |
-
<input type="checkbox" class="input-checkbox" name="' . $key . '" id="' . $key . '_checkbox" value="'.$args['options'][0].'" />
|
740 |
|
741 |
-
|
|
|
742 |
|
743 |
-
|
744 |
-
|
745 |
|
746 |
-
|
747 |
|
748 |
}
|
|
|
|
|
|
|
|
|
749 |
|
|
|
750 |
|
751 |
-
add_filter('woocommerce_form_field_colorpicker', 'wooccm_colorpicker_handler', 10, 4);
|
752 |
-
function wooccm_colorpicker_handler( $field = '', $key, $args, $value ) {
|
753 |
-
global $current_user;
|
754 |
$user_roles = $current_user->roles;
|
755 |
$user_role = array_shift($user_roles);
|
756 |
|
757 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
758 |
$rolekeys = explode('||',$args['role_options']);
|
759 |
$rolekeys2 = explode('||',$args['role_options2']);
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
}
|
767 |
|
768 |
-
|
|
|
|
|
|
|
769 |
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
|
776 |
|
777 |
-
//if ( isset($value) ) {
|
778 |
-
$value = $args['color'];
|
779 |
-
//}
|
780 |
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
-
|
785 |
-
|
|
|
|
|
|
|
786 |
|
787 |
-
return $field;
|
788 |
}
|
|
|
789 |
|
|
|
|
|
|
|
|
|
790 |
|
791 |
-
add_filter('woocommerce_form_field_datepicker', 'wooccm_datepicker_handler', 10, 4);
|
792 |
-
function wooccm_datepicker_handler( $field = '', $key, $args, $value ) {
|
793 |
-
global $current_user;
|
794 |
$user_roles = $current_user->roles;
|
795 |
$user_role = array_shift($user_roles);
|
796 |
-
|
797 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
798 |
$rolekeys = explode('||',$args['role_options']);
|
799 |
$rolekeys2 = explode('||',$args['role_options2']);
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
}
|
807 |
|
808 |
|
809 |
-
|
|
|
|
|
|
|
810 |
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
|
818 |
-
|
819 |
<label for="' . $key . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label'] . $required . '</label>
|
820 |
<input type="text" class="input-text" name="' . $key . '" id="' . $key . '" placeholder="' . $args['placeholder'] . '" value="'. $value.'" />
|
821 |
</p>' . $after;
|
822 |
|
823 |
-
|
|
|
824 |
}
|
|
|
|
|
|
|
|
|
825 |
|
|
|
826 |
|
827 |
-
add_filter('woocommerce_form_field_time', 'wooccm_timepicker_handler', 10, 4);
|
828 |
-
function wooccm_timepicker_handler( $field = '', $key, $args, $value ) {
|
829 |
-
global $current_user;
|
830 |
$user_roles = $current_user->roles;
|
831 |
$user_role = array_shift($user_roles);
|
832 |
-
|
833 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
834 |
$rolekeys = explode('||',$args['role_options']);
|
835 |
$rolekeys2 = explode('||',$args['role_options2']);
|
836 |
-
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
}
|
843 |
-
|
844 |
|
845 |
-
|
|
|
|
|
|
|
846 |
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
|
854 |
-
|
855 |
<label for="' . $key . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label'] . $required . '</label>
|
856 |
<input type="text" class="input-text" name="' . $key . '" id="' . $key . '" placeholder="' . $args['placeholder'] . '" value="'. $value.'" />
|
857 |
</p>' . $after;
|
858 |
|
859 |
-
|
|
|
860 |
}
|
|
|
|
|
|
|
|
|
861 |
|
|
|
862 |
|
863 |
-
add_filter('woocommerce_form_field_heading', 'wooccm_heading_handler', 10, 4);
|
864 |
-
function wooccm_heading_handler( $field = '', $key, $args, $value ) {
|
865 |
-
global $current_user;
|
866 |
$user_roles = $current_user->roles;
|
867 |
$user_role = array_shift($user_roles);
|
868 |
|
869 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
870 |
$rolekeys = explode('||',$args['role_options']);
|
871 |
$rolekeys2 = explode('||',$args['role_options2']);
|
872 |
-
|
873 |
-
|
874 |
-
|
875 |
-
|
876 |
-
|
877 |
-
|
878 |
-
}
|
879 |
-
|
880 |
-
$field = '<h3 class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">' . $args['label'] . '</h3>';
|
881 |
|
882 |
-
|
883 |
-
}
|
884 |
|
|
|
|
|
|
|
|
|
|
|
885 |
|
886 |
-
|
887 |
-
$
|
888 |
-
|
889 |
-
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
if ( $btn['cow'] == 'country' ) {
|
894 |
-
$fields['billing_'.$btn['cow'].'']['type'] = 'wooccmcountry';
|
895 |
-
} elseif ( $btn['cow'] == 'state' ) {
|
896 |
-
$fields['billing_'.$btn['cow'].'']['type'] = 'wooccmstate';
|
897 |
-
} else {
|
898 |
-
$fields['billing_'.$btn['cow'].'']['type'] = ''.$btn['type'].'';
|
899 |
-
}
|
900 |
-
|
901 |
-
|
902 |
-
if ( $btn['cow'] !== 'country' || $btn['cow'] !== 'state' ) {
|
903 |
-
$fields['billing_'.$btn['cow'].'']['placeholder'] = ''.$btn['placeholder'].'';
|
904 |
-
}
|
905 |
-
|
906 |
-
$fields['billing_'.$btn['cow'].'']['class'] = array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].'');
|
907 |
-
$fields['billing_'.$btn['cow'].'']['label'] = wpml_string_wccm_pro(''.$btn['label'].'');
|
908 |
-
$fields['billing_'.$btn['cow'].'']['clear'] = ''.$btn['clear_row'].'';
|
909 |
-
$fields['billing_'.$btn['cow'].'']['default'] = ''.$btn['force_title2'].'';
|
910 |
-
$fields['billing_'.$btn['cow'].'']['options'] = ''.$btn['option_array'].'';
|
911 |
-
$fields['billing_'.$btn['cow'].'']['user_role'] = ''.$btn['user_role'].'';
|
912 |
-
$fields['billing_'.$btn['cow'].'']['role_options'] = ''.$btn['role_options'].'';
|
913 |
-
$fields['billing_'.$btn['cow'].'']['role_options2'] = ''.$btn['role_options2'].'';
|
914 |
-
$fields['billing_'.$btn['cow'].'']['required'] = false;
|
915 |
-
$fields['billing_'.$btn['cow'].'']['wooccm_required'] = ''.$btn['checkbox'].'';
|
916 |
-
$fields['billing_'.$btn['cow'].'']['cow'] = ''.$btn['cow'].'';
|
917 |
-
$fields['billing_'.$btn['cow'].'']['color'] = ''.$btn['colorpickerd'].'';
|
918 |
-
$fields['billing_'.$btn['cow'].'']['colorpickertype'] = ''.$btn['colorpickertype'].'';
|
919 |
-
$fields['billing_'.$btn['cow'].'']['order'] = ''.$btn['order'].'';
|
920 |
-
$fields['billing_'.$btn['cow'].'']['fancy'] = ''.$btn['fancy'].'';
|
921 |
-
|
922 |
-
if ( !empty($btn['disabled']) ) {
|
923 |
-
unset($fields['billing_'.$btn['cow'].'']);
|
924 |
-
}
|
925 |
-
}
|
926 |
-
endforeach;
|
927 |
-
|
928 |
-
$fields[] = uasort($fields, 'sort_fields');
|
929 |
-
|
930 |
-
if ($fields[0]) {
|
931 |
-
unset($fields[0]);
|
932 |
-
}
|
933 |
-
return $fields;
|
934 |
-
}
|
935 |
|
|
|
936 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
937 |
|
938 |
-
function wooccm_shipping_fields( $fields ) {
|
939 |
-
$options2 = get_option( 'wccs_settings2' );
|
940 |
-
|
941 |
-
foreach ( $options2['shipping_buttons'] as $btn ) :
|
942 |
-
|
943 |
-
if ( !empty( $btn['cow']) && empty($btn['deny_checkout']) ) {
|
944 |
-
|
945 |
-
if ( $btn['cow'] == 'country' ) {
|
946 |
-
$fields['shipping_'.$btn['cow'].'']['type'] = 'wooccmcountry';
|
947 |
-
} elseif ( $btn['cow'] == 'state' ) {
|
948 |
-
$fields['shipping_'.$btn['cow'].'']['type'] = 'wooccmstate';
|
949 |
-
} else {
|
950 |
-
$fields['shipping_'.$btn['cow'].'']['type'] = ''.$btn['type'].'';
|
951 |
-
}
|
952 |
-
|
953 |
-
if ( $btn['cow'] !== 'country' || $btn['cow'] !== 'state' ) {
|
954 |
-
$fields['shipping_'.$btn['cow'].'']['placeholder'] = ''.$btn['placeholder'].'';
|
955 |
-
}
|
956 |
-
|
957 |
-
$fields['shipping_'.$btn['cow'].'']['class'] = array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].'');
|
958 |
-
$fields['shipping_'.$btn['cow'].'']['label'] = wpml_string_wccm_pro(''.$btn['label'].'');
|
959 |
-
$fields['shipping_'.$btn['cow'].'']['clear'] = ''.$btn['clear_row'].'';
|
960 |
-
$fields['shipping_'.$btn['cow'].'']['default'] = ''.$btn['force_title2'].'';
|
961 |
-
$fields['shipping_'.$btn['cow'].'']['options'] = ''.$btn['option_array'].'';
|
962 |
-
$fields['shipping_'.$btn['cow'].'']['user_role'] = ''.$btn['user_role'].'';
|
963 |
-
$fields['shipping_'.$btn['cow'].'']['role_options'] = ''.$btn['role_options'].'';
|
964 |
-
$fields['shipping_'.$btn['cow'].'']['role_options2'] = ''.$btn['role_options2'].'';
|
965 |
-
$fields['shipping_'.$btn['cow'].'']['required'] = false;
|
966 |
-
$fields['shipping_'.$btn['cow'].'']['wooccm_required'] = ''.$btn['checkbox'].'';
|
967 |
-
$fields['shipping_'.$btn['cow'].'']['cow'] = ''.$btn['cow'].'';
|
968 |
-
$fields['shipping_'.$btn['cow'].'']['color'] = ''.$btn['colorpickerd'].'';
|
969 |
-
$fields['shipping_'.$btn['cow'].'']['colorpickertype'] = ''.$btn['colorpickertype'].'';
|
970 |
-
$fields['shipping_'.$btn['cow'].'']['order'] = ''.$btn['order'].'';
|
971 |
-
$fields['shipping_'.$btn['cow'].'']['fancy'] = ''.$btn['fancy'].'';
|
972 |
-
|
973 |
-
if ( !empty($btn['disabled']) ) {
|
974 |
-
unset($fields['shipping_'.$btn['cow'].'']);
|
975 |
-
}
|
976 |
-
}
|
977 |
-
endforeach;
|
978 |
-
|
979 |
-
$fields[] = uasort($fields, 'sort_fields');
|
980 |
-
|
981 |
-
if ($fields[0]) {
|
982 |
-
unset($fields[0]);
|
983 |
-
}
|
984 |
-
return $fields;
|
985 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
986 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
987 |
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
}
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
+
// WooCommerce Checkout field - Text Input
|
10 |
+
function wooccm_checkout_field_text_handler( $field = '', $key, $args, $value ) {
|
11 |
+
|
12 |
+
global $current_user;
|
13 |
|
|
|
|
|
|
|
14 |
$user_roles = $current_user->roles;
|
15 |
$user_role = array_shift($user_roles);
|
16 |
+
|
17 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
18 |
$rolekeys = explode('||',$args['role_options']);
|
19 |
$rolekeys2 = explode('||',$args['role_options2']);
|
20 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
21 |
return;
|
22 |
}
|
23 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
24 |
return;
|
25 |
}
|
26 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
if( !empty( $args['clear'] ) )
|
29 |
+
$after = '<div class="clear"></div>';
|
30 |
+
else
|
31 |
+
$after = '';
|
|
|
|
|
32 |
|
33 |
+
if( $args['wooccm_required'] ) {
|
34 |
+
$args['class'][] = 'validate-required';
|
35 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
36 |
+
} else {
|
37 |
+
$required = '';
|
38 |
+
}
|
39 |
|
40 |
+
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
|
|
|
|
41 |
|
42 |
+
if( is_string( $args['label_class'] ) ) {
|
43 |
+
$args['label_class'] = array( $args['label_class'] );
|
44 |
+
}
|
45 |
|
46 |
+
if( is_null( $value ) ) {
|
47 |
+
$value = $args['default'];
|
48 |
+
}
|
49 |
|
50 |
+
// Custom attribute handling
|
51 |
+
$custom_attributes = array();
|
52 |
+
|
53 |
+
if( !empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) ) {
|
54 |
+
foreach( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
55 |
+
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
56 |
}
|
57 |
+
}
|
58 |
|
59 |
+
if( !empty( $args['validate'] ) ) {
|
60 |
+
foreach( $args['validate'] as $validate ) {
|
61 |
+
$args['class'][] = 'validate-' . $validate;
|
|
|
62 |
}
|
63 |
+
}
|
64 |
|
65 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">';
|
66 |
|
67 |
+
if( $args['label'] || $required ) {
|
68 |
+
$field .= '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label'] . $required . '</label>';
|
69 |
+
}
|
70 |
|
71 |
+
$field .= '<input type="text" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" '.$args['maxlength'].' value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
|
72 |
|
73 |
+
if( $args['description'] ) {
|
74 |
+
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
75 |
+
}
|
76 |
|
77 |
+
$field .= '</p>' . $after;
|
78 |
|
79 |
return $field;
|
80 |
+
|
81 |
}
|
82 |
+
add_filter( 'woocommerce_form_field_wooccmtext', 'wooccm_checkout_field_text_handler', 10, 4 );
|
83 |
+
|
84 |
+
// WooCommerce Checkout field - Textarea
|
85 |
+
function wooccm_checkout_field_textarea_handler( $field = '', $key, $args, $value ) {
|
86 |
|
87 |
+
global $current_user;
|
88 |
|
|
|
|
|
|
|
89 |
$user_roles = $current_user->roles;
|
90 |
$user_role = array_shift($user_roles);
|
91 |
|
92 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
93 |
$rolekeys = explode('||',$args['role_options']);
|
94 |
$rolekeys2 = explode('||',$args['role_options2']);
|
95 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
96 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
99 |
+
return;
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
+
}
|
102 |
+
|
103 |
+
if( !empty( $args['clear'] ) )
|
104 |
+
$after = '<div class="clear"></div>';
|
105 |
+
else
|
106 |
+
$after = '';
|
107 |
|
108 |
+
if( $args['wooccm_required'] ) {
|
109 |
+
$args['class'][] = 'validate-required';
|
110 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
111 |
+
} else {
|
112 |
+
$required = '';
|
113 |
+
}
|
114 |
|
115 |
+
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
|
|
|
|
116 |
|
117 |
+
if( is_string( $args['label_class'] ) ) {
|
118 |
+
$args['label_class'] = array( $args['label_class'] );
|
119 |
+
}
|
120 |
+
|
121 |
+
if( is_null( $value ) ) {
|
122 |
+
$value = $args['default'];
|
123 |
+
}
|
124 |
|
125 |
+
// Custom attribute handling
|
126 |
+
$custom_attributes = array();
|
127 |
|
128 |
+
if( ! empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) ) {
|
129 |
+
foreach( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
130 |
+
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
|
|
131 |
}
|
132 |
+
}
|
133 |
|
134 |
+
if( !empty( $args['validate'] ) ) {
|
135 |
+
foreach( $args['validate'] as $validate ) {
|
136 |
+
$args['class'][] = 'validate-' . $validate;
|
|
|
137 |
}
|
138 |
+
}
|
139 |
|
140 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">';
|
141 |
|
142 |
+
if( $args['label'] ) {
|
143 |
+
$field .= '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label']. $required . '</label>';
|
144 |
+
}
|
145 |
|
146 |
+
// WordPress Filters to override default row and column counts
|
147 |
+
$rows = apply_filters( 'wooccm_checkout_field_texarea_rows', 2, $key, $args );
|
148 |
+
$columns = apply_filters( 'wooccm_checkout_field_texarea_columns', 5, $key, $args );
|
149 |
|
150 |
+
$field .= '<textarea name="' . esc_attr( $key ) . '" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" ' . $args['maxlength'] . ' ' . ( empty( $args['custom_attributes']['rows'] ) ? ' rows="' . $rows . '"' : '' ) . ( empty( $args['custom_attributes']['cols'] ) ? ' cols="' . $columns . '"' : '' ) . implode( ' ', $custom_attributes ) . '>'. esc_textarea( $value ) .'</textarea>';
|
151 |
+
|
152 |
+
if( $args['description'] ) {
|
153 |
+
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
154 |
+
}
|
155 |
|
156 |
+
$field .= '</p>' . $after;
|
157 |
|
158 |
return $field;
|
159 |
+
|
160 |
}
|
161 |
+
add_filter( 'woocommerce_form_field_wooccmtextarea', 'wooccm_checkout_field_textarea_handler', 10, 4 );
|
162 |
|
163 |
+
// WooCommerce Checkout field - Password
|
164 |
+
function wooccm_checkout_field_password_handler( $field = '', $key, $args, $value ) {
|
165 |
|
166 |
+
global $current_user;
|
|
|
|
|
167 |
|
168 |
$user_roles = $current_user->roles;
|
169 |
$user_role = array_shift($user_roles);
|
170 |
+
|
171 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
172 |
$rolekeys = explode('||',$args['role_options']);
|
173 |
$rolekeys2 = explode('||',$args['role_options2']);
|
174 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
175 |
+
return;
|
176 |
+
}
|
177 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
178 |
+
return;
|
179 |
+
}
|
180 |
}
|
181 |
|
182 |
+
if( !empty( $args['clear'] ) )
|
183 |
+
$after = '<div class="clear"></div>';
|
184 |
+
else
|
185 |
+
$after = '';
|
|
|
|
|
|
|
186 |
|
187 |
+
if( $args['wooccm_required'] ) {
|
188 |
+
$args['class'][] = 'validate-required';
|
189 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
190 |
+
} else {
|
191 |
+
$required = '';
|
192 |
+
}
|
193 |
|
194 |
+
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
195 |
|
196 |
+
if( is_string( $args['label_class'] ) ) {
|
197 |
+
$args['label_class'] = array( $args['label_class'] );
|
198 |
+
}
|
199 |
|
200 |
+
if( is_null( $value ) ) {
|
201 |
+
$value = $args['default'];
|
202 |
+
}
|
203 |
|
204 |
+
// Custom attribute handling
|
205 |
+
$custom_attributes = array();
|
206 |
|
207 |
+
if( ! empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) ) {
|
208 |
+
foreach( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
209 |
+
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
|
|
210 |
}
|
211 |
+
}
|
212 |
|
213 |
+
if( !empty( $args['validate'] ) ) {
|
214 |
+
foreach( $args['validate'] as $validate ) {
|
215 |
+
$args['class'][] = 'validate-' . $validate;
|
|
|
216 |
}
|
217 |
+
}
|
218 |
+
|
219 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">';
|
220 |
|
221 |
+
if( $args['label'] ) {
|
222 |
+
$field .= '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label']. $required . '</label>';
|
223 |
+
}
|
224 |
+
|
225 |
+
$field .= '<input type="password" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" value="' . esc_attr( $value ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
|
226 |
|
227 |
+
if( $args['description'] ) {
|
228 |
+
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
229 |
+
}
|
230 |
|
231 |
+
$field .= '</p>' . $after;
|
|
|
|
|
232 |
|
|
|
|
|
233 |
return $field;
|
234 |
+
|
235 |
}
|
236 |
+
add_filter( 'woocommerce_form_field_wooccmpassword', 'wooccm_checkout_field_password_handler', 10, 4 );
|
237 |
+
|
238 |
+
// WooCommerce Checkout field - Radio Buttons
|
239 |
+
function wooccm_checkout_field_radio_handler( $field = '', $key, $args, $value ) {
|
240 |
|
241 |
+
global $current_user;
|
242 |
|
|
|
|
|
|
|
243 |
$user_roles = $current_user->roles;
|
244 |
$user_role = array_shift($user_roles);
|
245 |
+
|
246 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
247 |
$rolekeys = explode('||',$args['role_options']);
|
248 |
$rolekeys2 = explode('||',$args['role_options2']);
|
249 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
250 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
}
|
252 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
253 |
+
return;
|
|
|
|
|
|
|
|
|
254 |
}
|
255 |
+
}
|
256 |
|
257 |
+
if( !empty( $args['clear'] ) )
|
258 |
+
$after = '<div class="clear"></div>';
|
259 |
+
else
|
260 |
+
$after = '';
|
261 |
|
262 |
+
if( $args['wooccm_required'] ) {
|
263 |
+
$args['class'][] = 'validate-required';
|
264 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
265 |
+
} else {
|
266 |
+
$required = '';
|
267 |
+
}
|
268 |
|
269 |
+
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
|
|
|
|
270 |
|
271 |
+
$field = '<div class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">';
|
|
|
272 |
|
273 |
+
$field .= '<fieldset><legend>' . $args['label'] . $required . '</legend>';
|
|
|
|
|
|
|
|
|
274 |
|
275 |
+
if( !empty( $args['options'] ) ) {
|
276 |
+
foreach( explode('||',$args['options']) as $option_key => $option_text ) {
|
277 |
+
$field .= '<label><input type="radio" ' . checked( $value, wooccm_wpml_string( esc_attr( $option_text ) ), false ) . ' name="' . esc_attr( $key ) . '" value="' . wooccm_wpml_string( esc_attr( $option_text ) ). '" /> ' . wooccm_wpml_string( esc_html( $option_text ) ). '</label>';
|
|
|
278 |
}
|
279 |
+
}
|
280 |
|
281 |
+
$field .= '</fieldset></div>' . $after;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
|
283 |
return $field;
|
284 |
+
|
285 |
}
|
286 |
+
add_filter( 'woocommerce_form_field_wooccmradio', 'wooccm_checkout_field_radio_handler', 10, 4 );
|
287 |
+
|
288 |
+
// WooCommerce Checkout field - Select Options
|
289 |
+
function wooccm_checkout_field_select_handler( $field = '', $key, $args, $value ) {
|
290 |
|
291 |
+
global $current_user;
|
292 |
|
|
|
|
|
|
|
293 |
$user_roles = $current_user->roles;
|
294 |
$user_role = array_shift($user_roles);
|
295 |
+
|
296 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
297 |
$rolekeys = explode('||',$args['role_options']);
|
298 |
$rolekeys2 = explode('||',$args['role_options2']);
|
299 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
300 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
301 |
}
|
302 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
303 |
+
return;
|
|
|
|
|
|
|
|
|
304 |
}
|
305 |
+
}
|
306 |
|
307 |
+
if( !empty( $args['clear'] ) )
|
308 |
+
$after = '<div class="clear"></div>';
|
309 |
+
else
|
310 |
+
$after = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
|
312 |
+
if( $args['wooccm_required'] ) {
|
313 |
+
$args['class'][] = 'validate-required';
|
314 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
315 |
+
} else {
|
316 |
+
$required = '';
|
317 |
+
}
|
|
|
|
|
|
|
|
|
318 |
|
319 |
+
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
320 |
|
321 |
+
$options = '';
|
322 |
|
323 |
+
if( !empty( $args['options'] ) )
|
324 |
+
$options .= ($args['default']) ?'<option value="">' . $args['default'] .'</option>': '';
|
325 |
+
foreach (explode('||',$args['options']) as $option_key => $option_text )
|
326 |
+
$options .= '<option '. selected( $value, $option_key, false ) . '>' . wooccm_wpml_string( esc_attr( $option_text ) ) .'</option>';
|
327 |
|
328 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">';
|
|
|
|
|
329 |
|
330 |
+
if( $args['label'] )
|
331 |
+
$field .= '<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>';
|
332 |
|
333 |
+
$field .= '
|
334 |
+
<select class="' . esc_attr( $args['fancy'] ) .'" data-placeholder="' . __( $args['default'], 'wc_checkout_fields' ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" >
|
335 |
+
' . $options . '
|
336 |
+
</select>
|
337 |
+
</p>' . $after;
|
338 |
|
339 |
+
return $field;
|
340 |
|
341 |
+
}
|
342 |
+
add_filter( 'woocommerce_form_field_wooccmselect', 'wooccm_checkout_field_select_handler', 10, 4 );
|
|
|
|
|
343 |
|
344 |
+
// WooCommerce Checkout field - Check Box
|
345 |
+
function wooccm_checkout_field_checkbox_handler( $field = '', $key, $args, $value ) {
|
|
|
346 |
|
347 |
+
global $current_user;
|
348 |
|
349 |
+
$user_roles = $current_user->roles;
|
350 |
+
$user_role = array_shift($user_roles);
|
|
|
351 |
|
352 |
+
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
353 |
+
$rolekeys = explode('||',$args['role_options']);
|
354 |
+
$rolekeys2 = explode('||',$args['role_options2']);
|
355 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
356 |
+
return;
|
357 |
+
}
|
358 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
359 |
+
return;
|
360 |
+
}
|
361 |
+
}
|
362 |
|
363 |
+
$args['options'] = explode('||',$args['options']);
|
364 |
|
365 |
+
if( !empty( $args['clear'] ) )
|
366 |
+
$after = '<div class="clear"></div>';
|
367 |
+
else
|
368 |
+
$after = '';
|
369 |
|
370 |
+
if( $args['wooccm_required'] ) {
|
371 |
+
$args['class'][] = 'validate-required';
|
372 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
373 |
+
} else {
|
374 |
+
$required = '';
|
375 |
+
}
|
376 |
|
377 |
+
$field = '
|
378 |
+
<p class="form-row ' . implode( ' ', $args['class'] ) .'" id="' . $key . '_field">
|
379 |
+
<label for="' . $key . '_checkbox" class="checkbox ' . implode( ' ', $args['label_class'] ) .'">
|
380 |
+
<input type="checkbox" id="' . $key . '_checkbox" name="' . $key . '" class="input-checkbox" value="1" />' . $args['label'] . $required . '
|
381 |
+
</label>
|
382 |
+
</p>' . $after;
|
383 |
|
384 |
+
return $field;
|
|
|
385 |
|
|
|
386 |
}
|
387 |
+
add_filter( 'woocommerce_form_field_checkbox_wccm', 'wooccm_checkout_field_checkbox_handler', 10, 4 );
|
388 |
|
389 |
+
// WooCommerce Checkout field - State
|
390 |
+
function wooccm_checkout_field_state_handler( $field = '', $key, $args, $value ) {
|
391 |
+
|
392 |
+
global $current_user;
|
393 |
|
|
|
|
|
|
|
394 |
$user_roles = $current_user->roles;
|
395 |
$user_role = array_shift($user_roles);
|
396 |
+
|
397 |
+
if( !empty( $args['user_role'] ) && (!empty( $args['role_options'] ) || !empty ($args['role_options2'] )) ) {
|
398 |
+
$rolekeys = explode( '||',$args['role_options'] );
|
399 |
+
$rolekeys2 = explode( '||',$args['role_options2'] );
|
400 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
401 |
+
return;
|
402 |
+
}
|
403 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
404 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
}
|
406 |
+
}
|
407 |
|
408 |
+
if( !empty( $args['clear'] ) )
|
409 |
+
$after = '<div class="clear"></div>';
|
410 |
+
else
|
411 |
+
$after = '';
|
412 |
+
|
413 |
+
$args['class'][] = 'address-field';
|
414 |
+
|
415 |
+
// Get Country
|
416 |
+
// @mod - This is where the Billing/Shipping State bug lies...
|
417 |
+
$country_key = $key == 'billing_state' ? 'billing_country' : 'shipping_country';
|
418 |
+
$current_cc = WC()->checkout->get_value( $country_key );
|
419 |
+
$states = WC()->countries->get_states( $current_cc );
|
420 |
+
|
421 |
+
if( $args['wooccm_required'] ) {
|
422 |
+
if( !empty( $states ) )
|
423 |
$args['class'][] = 'validate-required';
|
424 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
425 |
+
} else {
|
426 |
+
$required = '';
|
427 |
+
}
|
428 |
|
429 |
+
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
430 |
|
431 |
+
if( is_string( $args['label_class'] ) ) {
|
432 |
+
$args['label_class'] = array( $args['label_class'] );
|
433 |
+
}
|
434 |
+
|
435 |
+
if( is_null( $value ) ) {
|
436 |
+
$value = $args['default'];
|
437 |
+
}
|
438 |
+
|
439 |
+
// Custom attribute handling
|
440 |
+
$custom_attributes = array();
|
441 |
+
|
442 |
+
if( !empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) ) {
|
443 |
+
foreach ( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
444 |
+
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
445 |
}
|
446 |
+
}
|
447 |
|
448 |
+
if( !empty( $states ) && !empty( $args['validate'] ) ) {
|
449 |
+
foreach( $args['validate'] as $validate ) {
|
450 |
+
$args['class'][] = 'validate-' . $validate;
|
451 |
}
|
452 |
+
}
|
453 |
|
454 |
+
if( is_array( $states ) && empty( $states ) ) {
|
|
|
455 |
|
456 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field" style="display: none">';
|
|
|
|
|
|
|
|
|
457 |
|
458 |
+
if( $args['label'] ) {
|
459 |
+
$field .= '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label'] . $required . '</label>';
|
|
|
|
|
460 |
}
|
461 |
+
$field .= '<input type="hidden" class="hidden" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" value="" ' . implode( ' ', $custom_attributes ) . ' placeholder="' . esc_attr( $args['placeholder'] ) . '" />';
|
462 |
|
463 |
+
if( $args['description'] ) {
|
464 |
+
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
465 |
+
}
|
466 |
|
467 |
+
$field .= '</p>' . $after;
|
468 |
|
469 |
+
} elseif ( is_array( $states ) ) {
|
470 |
|
471 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">';
|
|
|
|
|
472 |
|
473 |
+
if( $args['label'] )
|
474 |
+
$field .= '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label']. $required . '</label>';
|
475 |
+
$field .= '<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" class="state_select ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" ' . implode( ' ', $custom_attributes ) . ' placeholder="' . esc_attr( $args['placeholder'] ) . '">
|
476 |
+
<option value="">' . __( 'Select a state…', 'woocommerce-checkout-manager' ) . '</option>';
|
477 |
|
478 |
+
foreach( $states as $ckey => $cvalue ) {
|
479 |
+
$field .= '<option value="' . esc_attr( $ckey ) . '" '.selected( $value, $ckey, false ) .'>'.__( $cvalue, 'woocommerce-checkout-manager' ) .'</option>';
|
480 |
+
}
|
481 |
|
482 |
+
$field .= '</select>';
|
|
|
|
|
483 |
|
484 |
+
if( $args['description'] ) {
|
485 |
+
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
486 |
+
}
|
487 |
|
488 |
+
$field .= '</p>' . $after;
|
489 |
|
490 |
+
} else {
|
|
|
|
|
|
|
491 |
|
492 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">';
|
|
|
|
|
493 |
|
494 |
+
if( $args['label'] ) {
|
495 |
+
$field .= '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label']. $required . '</label>';
|
496 |
+
}
|
497 |
+
$field .= '<input type="text" class="input-text ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" value="' . esc_attr( $value ) . '" placeholder="' . esc_attr( $args['placeholder'] ) . '" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" ' . implode( ' ', $custom_attributes ) . ' />';
|
498 |
|
499 |
+
if( $args['description'] ) {
|
500 |
+
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
501 |
+
}
|
502 |
|
503 |
+
$field .= '</p>' . $after;
|
504 |
+
}
|
|
|
505 |
|
506 |
+
return $field;
|
|
|
507 |
|
|
|
508 |
}
|
509 |
+
add_filter( 'woocommerce_form_field_wooccmstate', 'wooccm_checkout_field_state_handler', 10, 4 );
|
510 |
|
511 |
+
// WooCommerce Checkout field - Country
|
512 |
+
function wooccm_checkout_field_country_handler( $field = '', $key, $args, $value ) {
|
513 |
+
|
514 |
+
global $current_user;
|
515 |
|
|
|
|
|
|
|
516 |
$user_roles = $current_user->roles;
|
517 |
$user_role = array_shift($user_roles);
|
518 |
+
|
519 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
520 |
$rolekeys = explode('||',$args['role_options']);
|
521 |
$rolekeys2 = explode('||',$args['role_options2']);
|
522 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
523 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
524 |
}
|
525 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
526 |
+
return;
|
527 |
+
}
|
528 |
+
}
|
529 |
|
530 |
+
if( ( !empty( $args['clear'] ) ) ) {
|
531 |
+
$after = '<div class="clear"></div>';
|
532 |
+
} else {
|
533 |
+
$after = '';
|
534 |
+
}
|
535 |
|
536 |
+
$args['class'][] = 'address-field';
|
|
|
|
|
537 |
|
538 |
+
if( $args['wooccm_required'] ) {
|
539 |
+
$args['class'][] = 'validate-required';
|
540 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
541 |
+
} else {
|
542 |
+
$required = '';
|
543 |
+
}
|
544 |
|
545 |
+
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
|
|
546 |
|
547 |
+
if( is_string( $args['label_class'] ) ) {
|
548 |
+
$args['label_class'] = array( $args['label_class'] );
|
549 |
+
}
|
|
|
550 |
|
551 |
+
if( is_null( $value ) ) {
|
552 |
+
$value = $args['default'];
|
553 |
+
}
|
554 |
|
555 |
+
// Custom attribute handling
|
556 |
+
$custom_attributes = array();
|
557 |
|
558 |
+
if( !empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) ) {
|
559 |
+
foreach( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
560 |
+
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
561 |
+
}
|
562 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
563 |
|
564 |
+
if( !empty( $args['validate'] ) ) {
|
565 |
+
foreach( $args['validate'] as $validate ) {
|
566 |
+
$args['class'][] = 'validate-' . $validate;
|
|
|
|
|
567 |
}
|
568 |
+
}
|
569 |
|
570 |
+
$countries = $key == 'shipping_country' ? WC()->countries->get_shipping_countries() : WC()->countries->get_allowed_countries();
|
571 |
|
572 |
+
if( sizeof( $countries ) == 1 ) {
|
573 |
|
574 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">';
|
|
|
|
|
575 |
|
576 |
+
if( $args['label'] ) {
|
577 |
+
$field .= '<label class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label'] . '</label>';
|
578 |
+
}
|
579 |
|
580 |
+
$field .= '<strong>' . current( array_values( $countries ) ) . '</strong>';
|
|
|
581 |
|
582 |
+
$field .= '<input type="hidden" name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" value="' . current( array_keys($countries ) ) . '" ' . implode( ' ', $custom_attributes ) . ' class="country_to_state" />';
|
|
|
583 |
|
584 |
+
if( $args['description'] ) {
|
585 |
+
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
586 |
+
}
|
587 |
|
588 |
+
$field .= '</p>' . $after;
|
589 |
|
590 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
|
592 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">'
|
593 |
+
. '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label'] . $required . '</label>'
|
594 |
+
. '<select name="' . esc_attr( $key ) . '" id="' . esc_attr( $args['id'] ) . '" class="country_to_state country_select ' . esc_attr( implode( ' ', $args['input_class'] ) ) .'" ' . implode( ' ', $custom_attributes ) . '>'
|
595 |
+
. '<option value="">'.__( 'Select a country…', 'woocommerce-checkout-manager' ) .'</option>';
|
|
|
|
|
596 |
|
597 |
+
foreach( $countries as $ckey => $cvalue ) {
|
598 |
+
$field .= '<option value="' . esc_attr( $ckey ) . '" '.selected( $value, $ckey, false ) .'>'.__( $cvalue, 'woocommerce-checkout-manager' ) .'</option>';
|
599 |
+
}
|
600 |
|
601 |
+
$field .= '</select>';
|
602 |
|
603 |
+
$field .= '<noscript><input type="submit" name="woocommerce_checkout_update_totals" value="' . __( 'Update country', 'woocommerce-checkout-manager' ) . '" /></noscript>';
|
604 |
|
605 |
+
if( $args['description'] ) {
|
606 |
+
$field .= '<span class="description">' . esc_attr( $args['description'] ) . '</span>';
|
607 |
+
}
|
608 |
|
609 |
+
$field .= '</p>' . $after;
|
|
|
610 |
|
611 |
+
}
|
612 |
|
613 |
+
return $field;
|
614 |
|
615 |
}
|
616 |
+
add_filter( 'woocommerce_form_field_wooccmcountry', 'wooccm_checkout_field_country_handler', 10, 4 );
|
617 |
+
|
618 |
+
// WooCommerce Checkout field - Multi-Select
|
619 |
+
function wooccm_checkout_field_multiselect_handler( $field = '', $key, $args, $value ) {
|
620 |
|
621 |
+
global $current_user;
|
622 |
|
|
|
|
|
|
|
623 |
$user_roles = $current_user->roles;
|
624 |
$user_role = array_shift($user_roles);
|
625 |
+
|
626 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
627 |
$rolekeys = explode('||',$args['role_options']);
|
628 |
$rolekeys2 = explode('||',$args['role_options2']);
|
629 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
630 |
+
return;
|
631 |
+
}
|
632 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
633 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
634 |
}
|
635 |
+
}
|
636 |
|
637 |
+
if ( ( ! empty( $args['clear'] ) ) )
|
638 |
+
$after = '<div class="clear"></div>';
|
639 |
+
else
|
640 |
+
$after = '';
|
641 |
|
642 |
+
if( $args['wooccm_required'] ) {
|
643 |
+
$args['class'][] = 'validate-required';
|
644 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
645 |
+
} else {
|
646 |
+
$required = '';
|
647 |
+
}
|
648 |
+
|
649 |
+
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
650 |
+
|
651 |
+
$options = '';
|
652 |
|
653 |
+
if( !empty( $args['options'] ) )
|
654 |
+
foreach (explode('||',$args['options']) as $option_key => $option_text )
|
655 |
+
$options .= '<option value="'.wooccm_wpml_string( esc_attr( $option_text ) ).'" '. selected( $value, $option_key, false ) . '>' . wooccm_wpml_string( esc_attr( $option_text ) ) .'</option>';
|
|
|
656 |
|
657 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">';
|
658 |
|
659 |
+
if ( $args['label'] )
|
660 |
+
$field .= '<label for="' . esc_attr( $key ) . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>';
|
661 |
|
662 |
+
$field .= '<select data-placeholder="' . __( 'Select some options', 'wc_checkout_fields' ) . '" multiple="multiple" name="' . esc_attr( $key ) . '[]" id="' . esc_attr( $key ) . '" class="checkout_chosen_select select">
|
663 |
+
' . $options . '
|
664 |
+
</select>
|
665 |
+
</p>' . $after;
|
666 |
|
667 |
+
return $field;
|
668 |
|
669 |
}
|
670 |
+
add_filter( 'woocommerce_form_field_multiselect', 'wooccm_checkout_field_multiselect_handler', 10, 4 );
|
671 |
+
|
672 |
+
// WooCommerce Checkout field - Multi-Checkbox
|
673 |
+
function wooccm_checkout_field_multicheckbox_handler( $field = '', $key, $args, $value ) {
|
674 |
+
|
675 |
+
global $current_user;
|
676 |
|
|
|
|
|
|
|
677 |
$user_roles = $current_user->roles;
|
678 |
+
$user_role = array_shift( $user_roles );
|
679 |
+
|
680 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
681 |
$rolekeys = explode('||',$args['role_options']);
|
682 |
$rolekeys2 = explode('||',$args['role_options2']);
|
683 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
684 |
+
return;
|
685 |
+
}
|
686 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
687 |
+
return;
|
688 |
+
}
|
689 |
+
}
|
|
|
|
|
|
|
|
|
690 |
|
691 |
+
if( ( !empty( $args['clear'] ) ) )
|
692 |
+
$after = '<div class="clear"></div>';
|
693 |
+
else
|
694 |
+
$after = '';
|
695 |
+
|
696 |
+
if( $args['wooccm_required'] ) {
|
697 |
+
$args['class'][] = 'validate-required';
|
698 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
699 |
+
} else {
|
700 |
+
$required = '';
|
701 |
+
}
|
702 |
+
|
703 |
+
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
704 |
+
|
705 |
+
$options = '';
|
706 |
+
|
707 |
+
if( !empty( $args['options'] ) ) {
|
708 |
+
foreach( explode('||',$args['options']) as $option_key => $option_text ) {
|
709 |
+
$options .= '<label><input type="checkbox" name="' . esc_attr( $key ) . '[]" value="'.wooccm_wpml_string( esc_attr( $option_text ) ).'"'. selected( $value, $option_key, false ) . ' /> ' . wooccm_wpml_string( esc_attr( $option_text ) ) . '</label>';
|
710 |
}
|
711 |
+
}
|
712 |
|
713 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">';
|
|
|
714 |
|
715 |
+
if( $args['label'] )
|
716 |
+
$field .= '<label class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label']. $required . '</label>';
|
717 |
|
718 |
+
$field .= $options . '
|
719 |
+
</p>' . $after;
|
720 |
|
721 |
+
return $field;
|
722 |
|
723 |
}
|
724 |
+
add_filter( 'woocommerce_form_field_multicheckbox', 'wooccm_checkout_field_multicheckbox_handler', 10, 4 );
|
725 |
+
|
726 |
+
// WooCommerce Checkout field - Color Picker
|
727 |
+
function wooccm_checkout_field_colorpicker_handler( $field = '', $key, $args, $value ) {
|
728 |
|
729 |
+
global $current_user;
|
730 |
|
|
|
|
|
|
|
731 |
$user_roles = $current_user->roles;
|
732 |
$user_role = array_shift($user_roles);
|
733 |
|
734 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
735 |
$rolekeys = explode('||',$args['role_options']);
|
736 |
$rolekeys2 = explode('||',$args['role_options2']);
|
737 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
738 |
+
return;
|
739 |
+
}
|
740 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
741 |
+
return;
|
742 |
+
}
|
743 |
+
}
|
744 |
|
745 |
+
if( ( !empty( $args['clear'] ) ) )
|
746 |
+
$after = '<div class="clear"></div>';
|
747 |
+
else
|
748 |
+
$after = '';
|
749 |
|
750 |
+
if( $args['wooccm_required'] ) {
|
751 |
+
$args['class'][] = 'validate-required';
|
752 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
753 |
+
} else {
|
754 |
+
$required = '';
|
755 |
+
}
|
756 |
|
757 |
+
//if ( isset($value) ) {
|
758 |
+
$value = $args['color'];
|
759 |
+
//}
|
760 |
|
761 |
+
$field = '
|
762 |
+
<p class="form-row ' . implode( ' ', $args['class'] ) .' wccs_colorpicker" id="' . $key . '_field">
|
763 |
+
<label for="' . $key . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label'] . $required . '</label>
|
764 |
+
<input type="text" class="input-text" maxlength="7" size="6" name="' . $key . '" id="' . $key . '_colorpicker" placeholder="' . $args['placeholder'] . '" value="'.$value.'" />
|
765 |
+
<span id="' . $key . '_colorpickerdiv" class="spec_shootd"></span>
|
766 |
+
</p>' . $after;
|
767 |
+
|
768 |
+
return $field;
|
769 |
|
|
|
770 |
}
|
771 |
+
add_filter( 'woocommerce_form_field_colorpicker', 'wooccm_checkout_field_colorpicker_handler', 10, 4 );
|
772 |
|
773 |
+
// WooCommerce Checkout field - Date Picker
|
774 |
+
function wooccm_checkout_field_datepicker_handler( $field = '', $key, $args, $value ) {
|
775 |
+
|
776 |
+
global $current_user;
|
777 |
|
|
|
|
|
|
|
778 |
$user_roles = $current_user->roles;
|
779 |
$user_role = array_shift($user_roles);
|
780 |
+
|
781 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
782 |
$rolekeys = explode('||',$args['role_options']);
|
783 |
$rolekeys2 = explode('||',$args['role_options2']);
|
784 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
785 |
+
return;
|
786 |
+
}
|
787 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
788 |
+
return;
|
789 |
+
}
|
790 |
+
}
|
791 |
|
792 |
|
793 |
+
if( ( !empty( $args['clear'] ) ) )
|
794 |
+
$after = '<div class="clear"></div>';
|
795 |
+
else
|
796 |
+
$after = '';
|
797 |
|
798 |
+
if( $args['wooccm_required'] ) {
|
799 |
+
$args['class'][] = 'validate-required';
|
800 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
801 |
+
} else {
|
802 |
+
$required = '';
|
803 |
+
}
|
804 |
|
805 |
+
$field = '<p class="form-row ' . implode( ' ', $args['class'] ) .'MyDate'.$args['cow'].' wccs-form-row-wide" id="' . $key . '_field">
|
806 |
<label for="' . $key . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label'] . $required . '</label>
|
807 |
<input type="text" class="input-text" name="' . $key . '" id="' . $key . '" placeholder="' . $args['placeholder'] . '" value="'. $value.'" />
|
808 |
</p>' . $after;
|
809 |
|
810 |
+
return $field;
|
811 |
+
|
812 |
}
|
813 |
+
add_filter( 'woocommerce_form_field_datepicker', 'wooccm_checkout_field_datepicker_handler', 10, 4 );
|
814 |
+
|
815 |
+
// WooCommerce Checkout field - Time Picker
|
816 |
+
function wooccm_checkout_field_timepicker_handler( $field = '', $key, $args, $value ) {
|
817 |
|
818 |
+
global $current_user;
|
819 |
|
|
|
|
|
|
|
820 |
$user_roles = $current_user->roles;
|
821 |
$user_role = array_shift($user_roles);
|
822 |
+
|
823 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
824 |
$rolekeys = explode('||',$args['role_options']);
|
825 |
$rolekeys2 = explode('||',$args['role_options2']);
|
826 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
827 |
+
return;
|
828 |
+
}
|
829 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
830 |
+
return;
|
831 |
+
}
|
832 |
+
}
|
|
|
833 |
|
834 |
+
if( ( !empty( $args['clear'] ) ) )
|
835 |
+
$after = '<div class="clear"></div>';
|
836 |
+
else
|
837 |
+
$after = '';
|
838 |
|
839 |
+
if( $args['wooccm_required'] ) {
|
840 |
+
$args['class'][] = 'validate-required';
|
841 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
842 |
+
} else {
|
843 |
+
$required = '';
|
844 |
+
}
|
845 |
|
846 |
+
$field = '<p class="form-row ' . implode( ' ', $args['class'] ) .'MyTime'.$args['cow'].' wccs-form-row-wide" id="' . $key . '_field">
|
847 |
<label for="' . $key . '" class="' . implode( ' ', $args['label_class'] ) .'">' . $args['label'] . $required . '</label>
|
848 |
<input type="text" class="input-text" name="' . $key . '" id="' . $key . '" placeholder="' . $args['placeholder'] . '" value="'. $value.'" />
|
849 |
</p>' . $after;
|
850 |
|
851 |
+
return $field;
|
852 |
+
|
853 |
}
|
854 |
+
add_filter( 'woocommerce_form_field_time', 'wooccm_checkout_field_timepicker_handler', 10, 4 );
|
855 |
+
|
856 |
+
// WooCommerce Checkout field - File Picker
|
857 |
+
function wooccm_checkout_field_upload_handler( $field = '', $key, $args, $value ) {
|
858 |
|
859 |
+
global $wpdb, $woocommerce, $post, $current_user;
|
860 |
|
|
|
|
|
|
|
861 |
$user_roles = $current_user->roles;
|
862 |
$user_role = array_shift($user_roles);
|
863 |
|
864 |
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
865 |
$rolekeys = explode('||',$args['role_options']);
|
866 |
$rolekeys2 = explode('||',$args['role_options2']);
|
867 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
868 |
+
return;
|
869 |
+
}
|
870 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
871 |
+
return;
|
872 |
+
}
|
873 |
+
}
|
|
|
|
|
874 |
|
875 |
+
$upload_name = ( !empty($args['placeholder'] ) ? esc_attr( $args['placeholder'] ) : __( 'Upload Files', 'woocommerce-checkout-manager' ) );
|
|
|
876 |
|
877 |
+
if( ( !empty( $args['clear'] ) ) ) {
|
878 |
+
$after = '<div class="clear"></div>';
|
879 |
+
} else {
|
880 |
+
$after = '';
|
881 |
+
}
|
882 |
|
883 |
+
if( $args['wooccm_required'] ) {
|
884 |
+
$args['class'][] = 'validate-required';
|
885 |
+
$required = ' <abbr class="required" title="' . esc_attr( 'required', 'woocommerce-checkout-manager' ) . '">*</abbr>';
|
886 |
+
} else {
|
887 |
+
$required = '';
|
888 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
889 |
|
890 |
+
$args['maxlength'] = ( $args['maxlength'] ) ? 'maxlength="' . absint( $args['maxlength'] ) . '"' : '';
|
891 |
|
892 |
+
if( is_string( $args['label_class'] ) ) {
|
893 |
+
$args['label_class'] = array( $args['label_class'] );
|
894 |
+
}
|
895 |
+
|
896 |
+
if( is_null( $value ) ) {
|
897 |
+
$value = $args['default'];
|
898 |
+
}
|
899 |
+
|
900 |
+
// Custom attribute handling
|
901 |
+
$custom_attributes = array();
|
902 |
+
|
903 |
+
if( !empty( $args['custom_attributes'] ) && is_array( $args['custom_attributes'] ) ) {
|
904 |
+
foreach( $args['custom_attributes'] as $attribute => $attribute_value ) {
|
905 |
+
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"';
|
906 |
+
}
|
907 |
+
}
|
908 |
+
|
909 |
+
if( !empty( $args['validate'] ) ) {
|
910 |
+
foreach( $args['validate'] as $validate ) {
|
911 |
+
$args['class'][] = 'validate-' . $validate;
|
912 |
+
}
|
913 |
+
}
|
914 |
+
|
915 |
+
$field = '<p class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $args['id'] ) . '_field">';
|
916 |
+
|
917 |
+
if( $args['label'] ) {
|
918 |
+
$field .= '<label for="' . esc_attr( $args['id'] ) . '" class="' . esc_attr( implode( ' ', $args['label_class'] ) ) .'">' . $args['label'] . $required . '</label>';
|
919 |
+
}
|
920 |
+
|
921 |
+
/*
|
922 |
+
// @mod - It looks like the file picker ignores required
|
923 |
+
$field .= '
|
924 |
+
<!-- <input style="display:none;" type="hidden" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" value="1||" /> -->
|
925 |
+
';
|
926 |
+
*/
|
927 |
+
$field .= '
|
928 |
+
<input style="display:none;" type="hidden" name="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '" value="" />
|
929 |
+
<input style="display:none;" type="file" name="' . esc_attr( $key ) . '_file" id="' . esc_attr( $key ) . '_file" class="file_upload_button_hide" multiple />
|
930 |
+
|
931 |
+
<button type="button" class="file_upload_account wooccm-btn wooccm-btn-primary start" id="' . esc_attr( $key ) . '_files_button_wccm">'.$upload_name.'</button>';
|
932 |
+
|
933 |
+
$field .= '</p>' . $after;
|
934 |
+
|
935 |
+
return $field;
|
936 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
937 |
}
|
938 |
+
add_filter( 'woocommerce_form_field_wooccmupload', 'wooccm_checkout_field_upload_handler', 10, 4 );
|
939 |
+
|
940 |
+
// WooCommerce Checkout field - Heading
|
941 |
+
function wooccm_checkout_field_heading_handler( $field = '', $key, $args, $value ) {
|
942 |
+
|
943 |
+
global $current_user;
|
944 |
+
|
945 |
+
$user_roles = $current_user->roles;
|
946 |
+
$user_role = array_shift($user_roles);
|
947 |
|
948 |
+
if( !empty($args['user_role']) && (!empty($args['role_options']) || !empty($args['role_options2'])) ) {
|
949 |
+
$rolekeys = explode('||',$args['role_options']);
|
950 |
+
$rolekeys2 = explode('||',$args['role_options2']);
|
951 |
+
if( !empty($args['role_options']) && !in_array($user_role, $rolekeys) ) {
|
952 |
+
return;
|
953 |
+
}
|
954 |
+
if( !empty($args['role_options2']) && in_array($user_role, $rolekeys2) ) {
|
955 |
+
return;
|
956 |
+
}
|
957 |
+
}
|
958 |
+
|
959 |
+
$field = '<h3 class="form-row ' . esc_attr( implode( ' ', $args['class'] ) ) .'" id="' . esc_attr( $key ) . '_field">' . $args['label'] . '</h3>';
|
960 |
|
961 |
+
return $field;
|
962 |
+
|
963 |
+
}
|
964 |
+
add_filter( 'woocommerce_form_field_heading', 'wooccm_checkout_field_heading_handler', 10, 4 );
|
965 |
+
?>
|
|
includes/classes/file_upload/button_style.css
DELETED
@@ -1,61 +0,0 @@
|
|
1 |
-
#files-listing-wccm img {
|
2 |
-
width: 64px;
|
3 |
-
height: 64px;
|
4 |
-
float:left;
|
5 |
-
margin-right: 8px;
|
6 |
-
margin-top: 4px;
|
7 |
-
}
|
8 |
-
#files-listing-wccm {
|
9 |
-
list-style: none;
|
10 |
-
}
|
11 |
-
#wccm_uploader_select {
|
12 |
-
float:left;
|
13 |
-
margin-top: 10px;
|
14 |
-
margin-left: 20px;
|
15 |
-
}
|
16 |
-
#files_wccm {
|
17 |
-
display:none !important;
|
18 |
-
}
|
19 |
-
#response_wccm {
|
20 |
-
float: right;
|
21 |
-
clear: left;
|
22 |
-
margin-top: -25px;
|
23 |
-
}
|
24 |
-
#wccm_make_smaller {
|
25 |
-
font-size: 80%;
|
26 |
-
}
|
27 |
-
#wccm_save_order_submit {
|
28 |
-
margin-bottom: 30px;
|
29 |
-
}
|
30 |
-
|
31 |
-
.file_upload_delete:before{ content: "\f182";font-family: dashicons; margin-right: 5px; }
|
32 |
-
.file_upload_account:before{ content: "\f317";font-family: dashicons; margin-right: 5px; }
|
33 |
-
.wooccm-btn{
|
34 |
-
display: inline-block;
|
35 |
-
padding: 6px 12px;
|
36 |
-
margin-bottom: 0;
|
37 |
-
font-size: 14px;
|
38 |
-
font-weight: 400;
|
39 |
-
line-height: 1.42857143;
|
40 |
-
text-align: center;
|
41 |
-
white-space: nowrap;
|
42 |
-
vertical-align: middle;
|
43 |
-
cursor: pointer;
|
44 |
-
-webkit-user-select: none;
|
45 |
-
-moz-user-select: none;
|
46 |
-
-ms-user-select: none;
|
47 |
-
user-select: none;
|
48 |
-
background-image: none;
|
49 |
-
border: 1px solid transparent;
|
50 |
-
border-radius: 4px;
|
51 |
-
}
|
52 |
-
.wooccm-btn-primary {
|
53 |
-
color: #fff;
|
54 |
-
background-color: #428bca;
|
55 |
-
border-color: #357ebd;
|
56 |
-
}
|
57 |
-
.wooccm-btn-danger {
|
58 |
-
color: #fff;
|
59 |
-
background-color: #d9534f;
|
60 |
-
border-color: #d43f3a;
|
61 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/classes/file_upload/file_editing_table.css
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
/*Copied from bootstrap */
|
2 |
-
|
3 |
-
.woocommerce_order_items.front_end tbody td, .woocommerce_order_items.back_end tbody td {
|
4 |
-
text-align: center;
|
5 |
-
}
|
6 |
-
|
7 |
-
.btn {
|
8 |
-
display: inline-block;
|
9 |
-
padding: 6px 12px;
|
10 |
-
margin-bottom: 0;
|
11 |
-
font-size: 14px;
|
12 |
-
font-weight: normal;
|
13 |
-
line-height: 1.42857143;
|
14 |
-
text-align: center;
|
15 |
-
white-space: nowrap;
|
16 |
-
vertical-align: middle;
|
17 |
-
cursor: pointer;
|
18 |
-
-webkit-user-select: none;
|
19 |
-
-moz-user-select: none;
|
20 |
-
-ms-user-select: none;
|
21 |
-
user-select: none;
|
22 |
-
background-image: none;
|
23 |
-
border: 1px solid transparent;
|
24 |
-
border-radius: 4px;
|
25 |
-
}
|
26 |
-
/*Also */
|
27 |
-
.btn-success {
|
28 |
-
color: #fff;
|
29 |
-
background-color: #5cb85c;
|
30 |
-
border-color: #4cae4c;
|
31 |
-
}
|
32 |
-
/* This is copied from https://github.com/blueimp/jQuery-File-Upload/blob/master/css/jquery.fileupload.css */
|
33 |
-
.fileinput-button {
|
34 |
-
position: relative;
|
35 |
-
overflow: hidden;
|
36 |
-
}
|
37 |
-
/*Also*/
|
38 |
-
.fileinput-button input {
|
39 |
-
position: absolute;
|
40 |
-
top: 0;
|
41 |
-
right: 0;
|
42 |
-
margin: 0;
|
43 |
-
opacity: 0;
|
44 |
-
-ms-filter:'alpha(opacity=0)';
|
45 |
-
font-size: 200px;
|
46 |
-
direction: ltr;
|
47 |
-
cursor: pointer;
|
48 |
-
}
|
49 |
-
|
50 |
-
|
51 |
-
.image.wccm_filesli span {
|
52 |
-
text-align: center;
|
53 |
-
word-wrap: break-word;
|
54 |
-
}
|
55 |
-
|
56 |
-
.file_size_wccm {
|
57 |
-
display: inline-block;
|
58 |
-
width: 15%;
|
59 |
-
float: left;
|
60 |
-
}
|
61 |
-
|
62 |
-
.product_images.ui-sortable .image {
|
63 |
-
clear: both;
|
64 |
-
text-align: center;
|
65 |
-
}
|
66 |
-
.product_images.ui-sortable .image img {
|
67 |
-
width: 75px;
|
68 |
-
height: 75px;
|
69 |
-
}
|
70 |
-
.image.wccm_filesli li {
|
71 |
-
margin-left: 0 !important;
|
72 |
-
}
|
73 |
-
.image.wccm_filesli {
|
74 |
-
clear: both;
|
75 |
-
margin-left: 0 !important;
|
76 |
-
}
|
77 |
-
.add_product_images .wccm_add_order_link:hover {
|
78 |
-
background: #bb77ae;
|
79 |
-
border-color: #aa559a;
|
80 |
-
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);
|
81 |
-
box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);
|
82 |
-
}
|
83 |
-
#wccm_name {
|
84 |
-
float: right;
|
85 |
-
}
|
86 |
-
.tips.wccm_delete {
|
87 |
-
cursor: pointer;
|
88 |
-
}
|
89 |
-
.add_product_images .wccm_add_order_link {
|
90 |
-
background: #cc99c2;
|
91 |
-
border-color: #b366a4;
|
92 |
-
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);
|
93 |
-
box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);
|
94 |
-
color: #fff;
|
95 |
-
text-decoration: none;
|
96 |
-
float: left;
|
97 |
-
clear: both;
|
98 |
-
margin-top: 10px;
|
99 |
-
}
|
100 |
-
#wccm_align_right_file {
|
101 |
-
float:left;
|
102 |
-
}
|
103 |
-
#wccm_save_order_submit {
|
104 |
-
float: left;
|
105 |
-
margin-left: 10px;
|
106 |
-
margin-top: 10px;
|
107 |
-
}
|
108 |
-
.wccm_results {
|
109 |
-
float: left;
|
110 |
-
margin-left: 20px;
|
111 |
-
font-weight: bold;
|
112 |
-
margin-top: 13px;
|
113 |
-
}
|
114 |
-
.product_images.front_end {
|
115 |
-
margin: 0;
|
116 |
-
list-style: none;
|
117 |
-
}
|
118 |
-
.delete_action_wccm ul {
|
119 |
-
list-style: none;
|
120 |
-
margin: 0;
|
121 |
-
}
|
122 |
-
#wccm_save_order_submit.front_end {
|
123 |
-
clear: both;
|
124 |
-
margin-bottom: 20px !important;
|
125 |
-
}
|
126 |
-
.woocommerce_order_items_wrapper.front_end table.woocommerce_order_items thead th {
|
127 |
-
background: #f5f5f5;
|
128 |
-
padding: 8px;
|
129 |
-
font-size: 11px;
|
130 |
-
text-align: center;
|
131 |
-
font-weight: bold;
|
132 |
-
}
|
133 |
-
.woocommerce_order_items.front_end {
|
134 |
-
border-collapse: separate;
|
135 |
-
border-spacing: 2px;
|
136 |
-
border-color: gray;
|
137 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/classes/file_upload/main_upload.php
DELETED
@@ -1,624 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* WooCommerce Checkout Manager
|
5 |
-
*/
|
6 |
-
|
7 |
-
// Exit if accessed directly
|
8 |
-
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
-
|
10 |
-
function wccm_set_html_content_type() {
|
11 |
-
return 'text/html';
|
12 |
-
}
|
13 |
-
|
14 |
-
function wccm_validate_upload_process_customer() {
|
15 |
-
$options = get_option( 'wccs_settings' );
|
16 |
-
|
17 |
-
if ( !empty($options['checkness']['enable_file_upload'])) {return true;} else {return false;}
|
18 |
-
}
|
19 |
-
|
20 |
-
if ( wccm_validate_upload_process_customer() ) {
|
21 |
-
add_action('woocommerce_view_order','wccs_file_uploader_front_end');
|
22 |
-
add_action( 'add_meta_boxes', 'wccs_initialize_metabox');
|
23 |
-
}
|
24 |
-
|
25 |
-
|
26 |
-
//////////////////////////////
|
27 |
-
add_action("wp_ajax_wccs_upload_file_func", "wccs_upload_file_func_callback");
|
28 |
-
add_action("wp_ajax_nopriv_wccs_upload_file_func", "wccs_upload_file_func_callback");
|
29 |
-
|
30 |
-
function wccs_upload_file_func_callback($order_id) {
|
31 |
-
global $wpdb, $woocommerce, $post; // this is how you get access to the database
|
32 |
-
|
33 |
-
$options = get_option( 'wccs_settings' );
|
34 |
-
$order_id = $_REQUEST["order_id"];
|
35 |
-
$order = new WC_Order( $order_id );
|
36 |
-
|
37 |
-
// load files
|
38 |
-
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
39 |
-
require_once( ABSPATH . 'wp-admin/includes/media.php' );
|
40 |
-
|
41 |
-
$upload_dir = wp_upload_dir();
|
42 |
-
$files = $_FILES[''.$_REQUEST["name"].''];
|
43 |
-
$upload_overrides = array( 'test_form' => false );
|
44 |
-
|
45 |
-
|
46 |
-
foreach ($files['name'] as $key => $value) {
|
47 |
-
if ($files['name'][$key]) {
|
48 |
-
|
49 |
-
|
50 |
-
// using the wp_handle_upload
|
51 |
-
if ( empty($options['checkness']['cat_file_upload']) ) {
|
52 |
-
$file = array(
|
53 |
-
'name' => $files['name'][$key],
|
54 |
-
'type' => $files['type'][$key],
|
55 |
-
'tmp_name' => $files['tmp_name'][$key],
|
56 |
-
'error' => $files['error'][$key],
|
57 |
-
'size' => $files['size'][$key]
|
58 |
-
);
|
59 |
-
$movefile = wp_handle_upload($file, $upload_overrides);
|
60 |
-
|
61 |
-
$attachment = array(
|
62 |
-
'guid' => $movefile['url'],
|
63 |
-
'post_mime_type' => $movefile['type'],
|
64 |
-
'post_title' => preg_replace( '/\.[^.]+$/', '', basename($movefile['file'])),
|
65 |
-
'post_content' => '',
|
66 |
-
'post_status' => 'inherit'
|
67 |
-
);
|
68 |
-
|
69 |
-
$attach_id = wp_insert_attachment( $attachment, $movefile['url'], $order_id);
|
70 |
-
|
71 |
-
// you must first include the image.php file
|
72 |
-
// for the function wp_generate_attachment_metadata() to work
|
73 |
-
|
74 |
-
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
75 |
-
$attach_data = wp_generate_attachment_metadata( $attach_id, $movefile['url'] );
|
76 |
-
wp_update_attachment_metadata( $attach_id, $attach_data );
|
77 |
-
|
78 |
-
// send email
|
79 |
-
$email_recipients = $options['checkness']['wooccm_notification_email'];
|
80 |
-
$message_content = '
|
81 |
-
This is an automatic message from WooCommerce Checkout Manager, reporting that files has been uploaded by '.$order->billing_first_name.' '.$order->billing_last_name.'.<br />
|
82 |
-
<h3>Customer Details</h3>
|
83 |
-
Name: '.$order->billing_first_name.' '.$order->billing_last_name.'<br />
|
84 |
-
E-mail: '.$order->billing_email.'<br />
|
85 |
-
Order Number: '.$order_id.' <br />
|
86 |
-
You can view the files and order details via back-end by following this <a href="'.admin_url('/post.php?post='.$order_id.'&action=edit').'">link</a>.
|
87 |
-
';
|
88 |
-
|
89 |
-
add_filter( 'wp_mail_content_type', 'wccm_set_html_content_type' );
|
90 |
-
wp_mail( $email_recipients, 'WooCCM - Files Uploaded by Customer ['.$order->billing_first_name.' '.$order->billing_last_name.']', $message_content );
|
91 |
-
|
92 |
-
// Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578
|
93 |
-
remove_filter( 'wp_mail_content_type', 'wccm_set_html_content_type' );
|
94 |
-
|
95 |
-
} else {
|
96 |
-
|
97 |
-
// using move_uploaded_file to categorized uploaded images
|
98 |
-
if (!file_exists($upload_dir['basedir']. '/wooccm_uploads/'.$order_id.'/')) {
|
99 |
-
wp_mkdir_p($upload_dir['basedir']. '/wooccm_uploads/'.$order_id.'/');
|
100 |
-
}
|
101 |
-
|
102 |
-
$filename = $files['name'][$key];
|
103 |
-
$wp_filetype = wp_check_filetype($filename);
|
104 |
-
$URLpath = $upload_dir['baseurl']. '/wooccm_uploads/'.$order_id.'/'.$filename;
|
105 |
-
|
106 |
-
move_uploaded_file( $files["tmp_name"][$key], $upload_dir['basedir']. '/wooccm_uploads/'.$order_id.'/'.$filename);
|
107 |
-
|
108 |
-
$attachment = array(
|
109 |
-
'guid' => $URLpath,
|
110 |
-
'post_mime_type' => $wp_filetype['type'],
|
111 |
-
'post_title' => preg_replace( '/\.[^.]+$/', '', $filename),
|
112 |
-
'post_content' => '',
|
113 |
-
'post_status' => 'inherit'
|
114 |
-
);
|
115 |
-
|
116 |
-
$attach_id = wp_insert_attachment( $attachment, $URLpath, $order_id);
|
117 |
-
|
118 |
-
// you must first include the image.php file
|
119 |
-
// for the function wp_generate_attachment_metadata() to work
|
120 |
-
|
121 |
-
|
122 |
-
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
123 |
-
$attach_data = wp_generate_attachment_metadata( $attach_id, $URLpath );
|
124 |
-
wp_update_attachment_metadata( $attach_id, $attach_data );
|
125 |
-
// send email
|
126 |
-
$email_recipients = get_option('admin_email');
|
127 |
-
$message_content = '
|
128 |
-
This is an automatic message from WooCommerce Checkout Manager, reporting that files has been uploaded by '.$order->billing_first_name.' '.$order->billing_last_name.'.<br />
|
129 |
-
<h3>Customer Details</h3>
|
130 |
-
Name: '.$order->billing_first_name.' '.$order->billing_last_name.'<br />
|
131 |
-
E-mail: '.$order->billing_email.'<br />
|
132 |
-
Order Number: '.$order_id.' <br />
|
133 |
-
You can view the files and order details via back-end by following this <a href="'.admin_url('/post.php?post='.$order_id.'&action=edit').'">link</a>.
|
134 |
-
';
|
135 |
-
|
136 |
-
add_filter( 'wp_mail_content_type', 'wccm_set_html_content_type' );
|
137 |
-
wp_mail( $email_recipients, 'WooCCM - Files Uploaded by Customer', $message_content );
|
138 |
-
|
139 |
-
// Reset content-type to avoid conflicts -- http://core.trac.wordpress.org/ticket/23578
|
140 |
-
remove_filter( 'wp_mail_content_type', 'wccm_set_html_content_type' );
|
141 |
-
|
142 |
-
}
|
143 |
-
}}
|
144 |
-
echo ' '.__('Files was uploaded successfully.','woocommerce-checkout-manager').'';
|
145 |
-
die();
|
146 |
-
}
|
147 |
-
|
148 |
-
|
149 |
-
function wccs_initialize_metabox() {
|
150 |
-
global $post;
|
151 |
-
add_meta_box( 'woocommerce-order-files', __( 'Order Uploaded files', 'woocommerce-checkout-manager' ), 'wccs_file_uploader_data_meta_box', 'shop_order', 'normal', 'default' );
|
152 |
-
}
|
153 |
-
|
154 |
-
function wccs_file_uploader_data_meta_box($post) {
|
155 |
-
global $wpdb, $thepostid, $theorder, $woocommerce, $post;
|
156 |
-
|
157 |
-
$options = get_option( 'wccs_settings' );
|
158 |
-
$upload_dir = wp_upload_dir();
|
159 |
-
$args = array(
|
160 |
-
'post_type' => 'attachment',
|
161 |
-
'numberposts' => -1,
|
162 |
-
'post_status' => null,
|
163 |
-
'post_parent' => $post->ID
|
164 |
-
);
|
165 |
-
?>
|
166 |
-
|
167 |
-
<script type="text/javascript" >
|
168 |
-
jQuery(document).ready(function($) {
|
169 |
-
|
170 |
-
$('#wccm_save_order_submit').click(function() {
|
171 |
-
|
172 |
-
$(".wccm_results").html("Saving, please wait....");
|
173 |
-
|
174 |
-
var data = {
|
175 |
-
action: 'update_attachment_wccm',
|
176 |
-
post_id : '<?php echo $post->ID; ?>',
|
177 |
-
product_image_gallery : $('#product_image_gallery').val(),
|
178 |
-
wccm_default_keys_load : $('#wccm_default_keys_load').val()
|
179 |
-
};
|
180 |
-
|
181 |
-
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
182 |
-
$.post(ajaxurl, data, function(response) {
|
183 |
-
|
184 |
-
$(".wccm_results").html(response);
|
185 |
-
});
|
186 |
-
}); });
|
187 |
-
</script>
|
188 |
-
|
189 |
-
<?php wp_enqueue_style( 'wccm_upload_file_style', plugins_url('/woocommerce-checkout-manager/includes/classes/file_upload/file_editing_table.css') ); ?>
|
190 |
-
|
191 |
-
<div class="woocommerce_order_items_wrapper">
|
192 |
-
<table class="woocommerce_order_items back_end">
|
193 |
-
<thead>
|
194 |
-
<tr>
|
195 |
-
<th style="width:12%;text-align: center;"><?php _e('File Image','woocommerce-checkout-manager'); ?></th>
|
196 |
-
<th style="width:10%;text-align: center;"><?php _e('Action','woocommerce-checkout-manager'); ?></th>
|
197 |
-
<th style="width:12%;text-align: center;"><?php _e('Width x Height','woocommerce-checkout-manager'); ?></th>
|
198 |
-
<th style="width:8%;text-align: center;"><?php _e('Extension','woocommerce-checkout-manager'); ?></th>
|
199 |
-
<th style="width:15%;text-align: center;"><?php _e('ID #','woocommerce-checkout-manager'); ?></th>
|
200 |
-
<th style="width:4%"><?php _e('Link','woocommerce-checkout-manager'); ?></th>
|
201 |
-
<th style="width:30%;text-align: center;"><?php _e('Name','woocommerce-checkout-manager'); ?></th>
|
202 |
-
</tr>
|
203 |
-
</thead>
|
204 |
-
|
205 |
-
<tbody class="product_images">
|
206 |
-
<?php
|
207 |
-
|
208 |
-
|
209 |
-
$attachment_args = get_posts( $args );
|
210 |
-
|
211 |
-
if ($attachment_args) {
|
212 |
-
foreach($attachment_args as $attachment) {
|
213 |
-
$array[] = $attachment->ID;
|
214 |
-
}
|
215 |
-
|
216 |
-
$default_wccm_values = implode(',',$array);
|
217 |
-
$product_image_gallery = implode(',',$array);
|
218 |
-
}
|
219 |
-
|
220 |
-
if ( empty($product_image_gallery)) {
|
221 |
-
$product_image_gallery = '';
|
222 |
-
}
|
223 |
-
$attachments = array_filter( explode( ',', $product_image_gallery ) );
|
224 |
-
|
225 |
-
|
226 |
-
if ( $attachments ) {
|
227 |
-
foreach ( $attachments as $attachment_id ) {
|
228 |
-
|
229 |
-
$image_attributes = wp_get_attachment_url( $attachment_id );
|
230 |
-
$image_attributes2 = wp_get_attachment_image_src( $attachment_id );
|
231 |
-
$filename = basename($image_attributes);
|
232 |
-
$wp_filetype = wp_check_filetype($filename);
|
233 |
-
|
234 |
-
$value_declear = array_diff(explode( ',',$default_wccm_values), explode( ',',$attachment_id));
|
235 |
-
|
236 |
-
echo '<tr class="image wccm_filesli wccmv_' . esc_attr( $attachment_id ) . '">
|
237 |
-
|
238 |
-
<span style="display:none;"><script type="text/javascript">
|
239 |
-
jQuery(document).ready(function(){
|
240 |
-
|
241 |
-
jQuery(".wccmx_' . esc_attr( $attachment_id ) . '").click(function(){
|
242 |
-
jQuery(".wccmv_' . esc_attr( $attachment_id ) . '").hide();
|
243 |
-
jQuery("#product_image_gallery").val(jQuery("#product_image_gallery").val().replace("'.esc_attr( $attachment_id ).'", ""));
|
244 |
-
|
245 |
-
});
|
246 |
-
});
|
247 |
-
</script>
|
248 |
-
</td>
|
249 |
-
|
250 |
-
<td>
|
251 |
-
'.wp_get_attachment_image( $attachment_id, array(75,75), true ).'
|
252 |
-
</td>
|
253 |
-
|
254 |
-
<td>
|
255 |
-
<a class="delete tips wccm_delete wccmx_' . esc_attr( $attachment_id ) . '" data-tip="' . __( 'Delete image', 'woocommerce' ) . '">' . __( 'Delete', 'woocommerce' ) . '</a>
|
256 |
-
</td>
|
257 |
-
|
258 |
-
<td>';
|
259 |
-
if($image_attributes2[1] == '') { echo '-';}else{ echo $image_attributes2[1].' x '.$image_attributes2[2];}
|
260 |
-
echo '</td>
|
261 |
-
|
262 |
-
<td>
|
263 |
-
'.$wp_filetype['ext'].'
|
264 |
-
</td>
|
265 |
-
|
266 |
-
<td>
|
267 |
-
'.$attachment_id.'
|
268 |
-
</td>
|
269 |
-
|
270 |
-
<td>
|
271 |
-
'.wp_get_attachment_link( $attachment_id, '' , false, false, 'Link' ).'
|
272 |
-
</td>
|
273 |
-
|
274 |
-
<td>
|
275 |
-
'.preg_replace( '/\.[^.]+$/', '', $filename).'
|
276 |
-
</td>
|
277 |
-
</tr>';
|
278 |
-
}}
|
279 |
-
?>
|
280 |
-
</tbody>
|
281 |
-
|
282 |
-
<input type="hidden" class="wccm_add_to_list" id="product_image_gallery" name="product_image_gallery" value="<?php echo esc_attr( $product_image_gallery ); ?>" />
|
283 |
-
|
284 |
-
<input type="hidden" id="wccm_default_keys_load" name="wccm_default_keys_load" value="<?php echo esc_attr($default_wccm_values); ?>" />
|
285 |
-
|
286 |
-
</table>
|
287 |
-
|
288 |
-
<p class="add_product_images hide-if-no-js">
|
289 |
-
|
290 |
-
|
291 |
-
<form method="POST" action="myurl"> <span class="btn button-primary wccm_add_order_link fileinput-button">
|
292 |
-
<span>Add Order Files</span>
|
293 |
-
|
294 |
-
<input type="file" name="files_wccm" id="files_wccm" multiple />
|
295 |
-
<button type="button" id="files_button_wccm">Upload Files!</button>
|
296 |
-
|
297 |
-
|
298 |
-
</span>
|
299 |
-
</form>
|
300 |
-
|
301 |
-
</p>
|
302 |
-
|
303 |
-
|
304 |
-
<script type="text/javascript">
|
305 |
-
jQuery(document).ready(function($){
|
306 |
-
(function post_image_content() {
|
307 |
-
var input = document.getElementById("files_wccm"),
|
308 |
-
formdata = false;
|
309 |
-
|
310 |
-
if (window.FormData) {
|
311 |
-
formdata = new FormData();
|
312 |
-
document.getElementById("files_button_wccm").style.display = "none";
|
313 |
-
}
|
314 |
-
|
315 |
-
|
316 |
-
input.addEventListener("change", function (evt) {
|
317 |
-
|
318 |
-
$(".wccm_results").html("Uploading, please wait....");
|
319 |
-
|
320 |
-
var i = 0, len = this.files.length, img, reader, file;
|
321 |
-
|
322 |
-
for ( ; i < len; i++ ) {
|
323 |
-
file = this.files[i];
|
324 |
-
|
325 |
-
if (formdata) {
|
326 |
-
formdata.append("files_wccm[]",file);
|
327 |
-
}
|
328 |
-
}
|
329 |
-
|
330 |
-
if (formdata) {
|
331 |
-
$.ajax({
|
332 |
-
url: "<?php echo admin_url('/admin-ajax.php?action=wccs_upload_file_func&order_id='.$post->ID.''); ?>",
|
333 |
-
type: "POST",
|
334 |
-
data: formdata,
|
335 |
-
processData: false,
|
336 |
-
contentType: false,
|
337 |
-
success: function (res) {
|
338 |
-
$('#files_wccm').show();
|
339 |
-
|
340 |
-
$(".wccm_results").html("Files Uploaded Successfully.");
|
341 |
-
|
342 |
-
$.ajax({
|
343 |
-
url: '<?php echo admin_url('/post.php?post='.$post->ID.'&action=edit'); ?>',
|
344 |
-
data: {},
|
345 |
-
success: function (data) {
|
346 |
-
$("div#product_images_container").html($(data).find("div#product_images_container"));
|
347 |
-
$(".wccm_results").html("Files Uploaded Successfully.");
|
348 |
-
},
|
349 |
-
dataType: 'html'
|
350 |
-
});
|
351 |
-
|
352 |
-
}
|
353 |
-
});
|
354 |
-
}
|
355 |
-
}, false);
|
356 |
-
}());
|
357 |
-
|
358 |
-
});
|
359 |
-
</script>
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
<input type="button" id="wccm_save_order_submit" class="button button-primary" value="Save Changes">
|
365 |
-
<div class="wccm_results"></div>
|
366 |
-
|
367 |
-
<div class="clear"></div></div>
|
368 |
-
<?php
|
369 |
-
|
370 |
-
}
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
function wooccm_js_str($s)
|
375 |
-
{
|
376 |
-
return '"' . addcslashes($s, "\0..\37\"\\") . '"';
|
377 |
-
}
|
378 |
-
|
379 |
-
function wooccm_js_array($array)
|
380 |
-
{
|
381 |
-
$temp = array_map('wooccm_js_str', $array);
|
382 |
-
return '[' . implode(',', $temp) . ']';
|
383 |
-
}
|
384 |
-
|
385 |
-
// front end for user
|
386 |
-
function wccs_file_uploader_front_end($order_id) {
|
387 |
-
global $wpdb, $thepostid, $theorder, $woocommerce, $post;
|
388 |
-
|
389 |
-
$order = new WC_Order($order_id);
|
390 |
-
|
391 |
-
$options = get_option( 'wccs_settings' );
|
392 |
-
$length = (empty( $options['checkness']['file_upload_number'])) ? 'this.files.length' : $options['checkness']['file_upload_number'];
|
393 |
-
|
394 |
-
$file_types = explode(",", $options['checkness']['file_types']);
|
395 |
-
$number_of_types = count($file_types);
|
396 |
-
|
397 |
-
$prefix = 'wc-';
|
398 |
-
|
399 |
-
if ( empty($options['checkness']['upload_os']) || ($order->post_status == $prefix.$options['checkness']['upload_os']) ) {
|
400 |
-
|
401 |
-
$upload_dir = wp_upload_dir();
|
402 |
-
$args = array(
|
403 |
-
'post_type' => 'attachment',
|
404 |
-
'numberposts' => -1,
|
405 |
-
'post_status' => null,
|
406 |
-
'post_parent' => $order_id
|
407 |
-
);
|
408 |
-
?>
|
409 |
-
|
410 |
-
<script type="text/javascript" >
|
411 |
-
jQuery(document).ready(function($) {
|
412 |
-
|
413 |
-
$('#wccm_save_order_submit').click(function() {
|
414 |
-
$(".wccm_results").html("Deleting files, please wait....");
|
415 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
416 |
-
data = {
|
417 |
-
action: 'update_attachment_wccm',
|
418 |
-
product_image_gallery : $('#product_image_gallery').val(),
|
419 |
-
wccm_default_keys_load : $('#wccm_default_keys_load').val()
|
420 |
-
};
|
421 |
-
|
422 |
-
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
423 |
-
$.post(ajaxurl, data, function(response) {
|
424 |
-
$(".wccm_results").html(response);
|
425 |
-
});
|
426 |
-
}); });
|
427 |
-
</script>
|
428 |
-
|
429 |
-
<?php wp_enqueue_style( 'wccm_upload_file_style', plugins_url('/woocommerce-checkout-manager/includes/classes/file_upload/file_editing_table.css') ); ?>
|
430 |
-
|
431 |
-
<h2><?php echo (empty($options['checkness']['upload_title'])) ? 'Order Uploaded Files' : esc_attr($options['checkness']['upload_title']); ?></h2>
|
432 |
-
<div class="woocommerce_order_items_wrapper front_end">
|
433 |
-
<table class="woocommerce_order_items front_end">
|
434 |
-
<thead>
|
435 |
-
<tr>
|
436 |
-
<th style="width:12%"><?php _e('File Image','woocommerce-checkout-manager'); ?></th>
|
437 |
-
<th style="width:10%"><?php _e('Action','woocommerce-checkout-manager'); ?></th>
|
438 |
-
<th style="width:12%"><?php _e('Width x Height','woocommerce-checkout-manager'); ?></th>
|
439 |
-
<th style="width:8%"><?php _e('Extension','woocommerce-checkout-manager'); ?></th>
|
440 |
-
<th style="width:15%;text-align: center;"><?php _e('ID #','woocommerce-checkout-manager'); ?></th>
|
441 |
-
<th style="width:4%"><?php _e('Link','woocommerce-checkout-manager'); ?></th>
|
442 |
-
<th style="width:30%;text-align: center;"><?php _e('Name','woocommerce-checkout-manager'); ?></th>
|
443 |
-
</tr>
|
444 |
-
</thead>
|
445 |
-
|
446 |
-
<tbody class="product_images front_end">
|
447 |
-
<?php
|
448 |
-
|
449 |
-
|
450 |
-
$attachment_args = get_posts( $args );
|
451 |
-
|
452 |
-
if ($attachment_args) {
|
453 |
-
foreach($attachment_args as $attachment) {
|
454 |
-
$array[] = $attachment->ID;
|
455 |
-
}
|
456 |
-
|
457 |
-
$default_wccm_values = implode(',',$array);
|
458 |
-
$product_image_gallery = implode(',',$array);
|
459 |
-
}
|
460 |
-
|
461 |
-
$attachments = array_filter( explode( ',', $product_image_gallery ) );
|
462 |
-
|
463 |
-
if ( $attachments ) {
|
464 |
-
foreach ( $attachments as $attachment_id ) {
|
465 |
-
|
466 |
-
|
467 |
-
$image_attributes = wp_get_attachment_url( $attachment_id );
|
468 |
-
$image_attributes2 = wp_get_attachment_image_src( $attachment_id );
|
469 |
-
$filename = basename($image_attributes);
|
470 |
-
$wp_filetype = wp_check_filetype($filename);
|
471 |
-
|
472 |
-
$value_declear = array_diff(explode( ',',$default_wccm_values), explode( ',',$attachment_id));
|
473 |
-
|
474 |
-
echo '<tr class="image wccm_filesli wccmv_' . esc_attr( $attachment_id ) . '">
|
475 |
-
|
476 |
-
<td style="display:none;"><script type="text/javascript">
|
477 |
-
jQuery(document).ready(function(){
|
478 |
-
|
479 |
-
jQuery(".wccmx_' . esc_attr( $attachment_id ) . '").click(function(){
|
480 |
-
jQuery(".wccmv_' . esc_attr( $attachment_id ) . '").hide();
|
481 |
-
jQuery("#product_image_gallery").val(jQuery("#product_image_gallery").val().replace("'.esc_attr( $attachment_id ).'", ""));
|
482 |
-
|
483 |
-
});
|
484 |
-
});
|
485 |
-
</script></td>
|
486 |
-
|
487 |
-
<td>
|
488 |
-
'.wp_get_attachment_link( $attachment_id, '' , false, false, wp_get_attachment_image( $attachment_id, array(75,75), true ) ).'
|
489 |
-
</td>
|
490 |
-
|
491 |
-
<td>
|
492 |
-
<a class="delete tips wccm_delete wccmx_' . esc_attr( $attachment_id ) . '" data-tip="' . __( 'Delete image', 'woocommerce' ) . '">' . __( 'Delete', 'woocommerce' ) . '</a>
|
493 |
-
</td>
|
494 |
-
|
495 |
-
<td>';
|
496 |
-
if($image_attributes2[1] == '') { echo '-';}else{ echo $image_attributes2[1].' x '.$image_attributes2[2];}
|
497 |
-
echo '</td>
|
498 |
-
|
499 |
-
<td>
|
500 |
-
'.$wp_filetype['ext'].'
|
501 |
-
</td>
|
502 |
-
|
503 |
-
<td>
|
504 |
-
'.$attachment_id.'
|
505 |
-
</td>
|
506 |
-
|
507 |
-
<td>
|
508 |
-
'.wp_get_attachment_link( $attachment_id, '' , false, false, 'Link' ).'
|
509 |
-
</td>
|
510 |
-
|
511 |
-
<td>
|
512 |
-
'.preg_replace( '/\.[^.]+$/', '', $filename).'
|
513 |
-
</td>
|
514 |
-
</tr>';
|
515 |
-
}}
|
516 |
-
|
517 |
-
?>
|
518 |
-
</tbody>
|
519 |
-
|
520 |
-
<input type="hidden" class="wccm_add_to_list" id="product_image_gallery" name="product_image_gallery" value="<?php echo esc_attr( $product_image_gallery ); ?>" />
|
521 |
-
|
522 |
-
<input type="hidden" id="wccm_default_keys_load" name="wccm_default_keys_load" value="<?php echo esc_attr($default_wccm_values); ?>" />
|
523 |
-
|
524 |
-
</table>
|
525 |
-
</div>
|
526 |
-
|
527 |
-
<button type="button" id="wccm_save_order_submit" class="file_upload_delete wooccm-btn wooccm-btn-danger delete">Confirm Delete</button>
|
528 |
-
|
529 |
-
<span id="wccm_uploader_select">
|
530 |
-
<input type="file" style="display:none;" name="files_wccm" id="files_wccm" multiple />
|
531 |
-
<button type="button" class="file_upload_account wooccm-btn wooccm-btn-primary start" id="files_button_wccm">Upload Files</button>
|
532 |
-
</span>
|
533 |
-
|
534 |
-
<div class="wccm_results front_end"></div>
|
535 |
-
|
536 |
-
<div class="clear"></div>
|
537 |
-
<?php
|
538 |
-
// script for uploading the files
|
539 |
-
echo '<script type="text/javascript">
|
540 |
-
jQuery(document).ready(function($){
|
541 |
-
(function post_image_content() {
|
542 |
-
var input = document.getElementById("files_wccm"),
|
543 |
-
formdata = false;
|
544 |
-
|
545 |
-
$("#files_button_wccm").click( function(){
|
546 |
-
$("#wccm_uploader_select input[type=file]").click();
|
547 |
-
return false;
|
548 |
-
});
|
549 |
-
|
550 |
-
if (window.FormData) {
|
551 |
-
formdata = new FormData();
|
552 |
-
}
|
553 |
-
|
554 |
-
input.addEventListener("change", function (evt) {
|
555 |
-
$("#wccm_uploader_select").block({message: null, overlayCSS: {background: "#fff url(" + woocommerce_params.plugin_url + "/assets/images/ajax-loader.gif) no-repeat center", opacity: 0.6}});
|
556 |
-
|
557 |
-
$("#wccm_uploader_select").block({message: null, overlayCSS: {background: "#fff url(" + woocommerce_params.ajax_loader_url + ") no-repeat center", opacity: 0.6}});
|
558 |
-
|
559 |
-
var length = '.$length.';
|
560 |
-
var file_array = '.wooccm_js_array($file_types).';
|
561 |
-
var wooempt = '.$file_types.';
|
562 |
-
|
563 |
-
|
564 |
-
for ( i = 0; i < length; i++ ) {
|
565 |
-
file = this.files[i];
|
566 |
-
for(x=0; x < '.$number_of_types.'; x++){
|
567 |
-
if( !wooempt || file.type.match(file_array[x]) ) {
|
568 |
-
if (formdata) {
|
569 |
-
formdata.append("files_wccm[]",file);
|
570 |
-
}
|
571 |
-
}
|
572 |
-
}
|
573 |
-
}
|
574 |
-
|
575 |
-
if (formdata) {
|
576 |
-
$.ajax({
|
577 |
-
url: "'.admin_url('/admin-ajax.php?action=wccs_upload_file_func&order_id='.$order_id.'&name=files_wccm').'",
|
578 |
-
type: "POST",
|
579 |
-
data: formdata,
|
580 |
-
processData: false,
|
581 |
-
contentType: false,
|
582 |
-
success: function (res) {
|
583 |
-
$("#files_wccm").show();
|
584 |
-
|
585 |
-
$.ajax({
|
586 |
-
url: "'.$order->get_view_order_url().'",
|
587 |
-
data: {},
|
588 |
-
success: function (data) {
|
589 |
-
|
590 |
-
$("div.woocommerce_order_items_wrapper.front_end").html($(data).find("div.woocommerce_order_items_wrapper.front_end"));
|
591 |
-
jQuery("#wccm_uploader_select").unblock();
|
592 |
-
},
|
593 |
-
dataType: "html"
|
594 |
-
});
|
595 |
-
}
|
596 |
-
});
|
597 |
-
}
|
598 |
-
}, false);
|
599 |
-
}());
|
600 |
-
});
|
601 |
-
</script>';
|
602 |
-
// end script
|
603 |
-
// ------------
|
604 |
-
}
|
605 |
-
}
|
606 |
-
|
607 |
-
add_action("wp_ajax_update_attachment_wccm", "update_attachment_wccm_callback");
|
608 |
-
add_action("wp_ajax_nopriv_update_attachment_wccm", "update_attachment_wccm_callback");
|
609 |
-
|
610 |
-
function update_attachment_wccm_callback() {
|
611 |
-
global $post, $wpdb, $woocommerce;
|
612 |
-
|
613 |
-
$array1 = explode( ',',$_POST['wccm_default_keys_load']);
|
614 |
-
$array2 = explode( ',',$_POST['product_image_gallery']);
|
615 |
-
$attachment_id_each = array_diff($array1, $array2);
|
616 |
-
|
617 |
-
if (isset($_POST['wccm_default_keys_load'])) {
|
618 |
-
foreach($attachment_id_each as $key => $values) {
|
619 |
-
wp_delete_attachment( $attachment_id_each[$key] );
|
620 |
-
}
|
621 |
-
echo ''.__('Deleted Successfully.','woocommerce-checkout-manager').'';
|
622 |
-
}
|
623 |
-
die();
|
624 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/classes/file_upload/upload_settings.php
DELETED
@@ -1,191 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* WooCommerce Checkout Manager
|
5 |
-
*/
|
6 |
-
|
7 |
-
// Exit if accessed directly
|
8 |
-
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
-
?>
|
10 |
-
|
11 |
-
<div class="widefat general-semi upload_files" border="0">
|
12 |
-
|
13 |
-
<div class="section"><h3 class="heading"><?php _e('General File Upload', 'woocommerce-checkout-manager'); ?></h3></div>
|
14 |
-
|
15 |
-
<div class="section">
|
16 |
-
<h3 class="heading checkbox">
|
17 |
-
|
18 |
-
<div class="option">
|
19 |
-
<input name="wccs_settings[checkness][enable_file_upload]" type="checkbox" value="true" <?php if ( !empty($options['checkness']['enable_file_upload'])) echo "checked='checked'"; ?> /><span></span>
|
20 |
-
|
21 |
-
<div class="info-of"><?php _e('Allow Customers to Upload Files', 'woocommerce-checkout-manager'); ?></div>
|
22 |
-
</div>
|
23 |
-
</h3>
|
24 |
-
</div>
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
<div class="section">
|
29 |
-
<h3 class="heading checkbox">
|
30 |
-
|
31 |
-
<div class="option" >
|
32 |
-
<input name="wccs_settings[checkness][cat_file_upload]" type="checkbox" value="true" <?php if ( !empty($options['checkness']['cat_file_upload'])) echo "checked='checked'"; ?> /><span></span>
|
33 |
-
|
34 |
-
<div class="info-of"><?php _e('Categorize Uploaded Files', 'woocommerce-checkout-manager'); ?>
|
35 |
-
|
36 |
-
| <span style="cursor: pointer;" class="show_hide2"><a>read more</a></span>
|
37 |
-
|
38 |
-
<span style="display:none;" class="slidingDiv2">
|
39 |
-
<br /><br />
|
40 |
-
|
41 |
-
<?php _e('Changes uploaded files location folder from', 'woocommerce-checkout-manager'); ?> <br />
|
42 |
-
<strong><?php echo $upload_dir['url']; ?>/</strong> <br />
|
43 |
-
<?php _e('to', 'woocommerce-checkout-manager'); ?><br />
|
44 |
-
<strong><?php echo $upload_dir['baseurl']; ?>/wooccm_uploads/{order number}/</strong>
|
45 |
-
</span>
|
46 |
-
|
47 |
-
</div>
|
48 |
-
</div>
|
49 |
-
</h3>
|
50 |
-
</div>
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
<div class="section">
|
55 |
-
<h3 class="heading">
|
56 |
-
<?php _e('Notification E-mail', 'woocommerce-checkout-manager'); ?>
|
57 |
-
</h3>
|
58 |
-
|
59 |
-
<div class="option">
|
60 |
-
<input name="wccs_settings[checkness]['upload_title']" type="text" placeholder="Order Uploaded Files" value="<?php echo esc_attr($options['checkness']['upload_title']); ?>" />
|
61 |
-
</div>
|
62 |
-
</div>
|
63 |
-
|
64 |
-
<div class="section">
|
65 |
-
<h3 class="heading">
|
66 |
-
<?php _e('Notification E-mail', 'woocommerce-checkout-manager'); ?>
|
67 |
-
</h3>
|
68 |
-
|
69 |
-
<div class="option">
|
70 |
-
<input name="wccs_settings[checkness][wooccm_notification_email]" type="text" value="<?php echo $options['checkness']['wooccm_notification_email']; ?>" />
|
71 |
-
</div>
|
72 |
-
</div>
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
<div class="section">
|
77 |
-
<h3 class="heading">
|
78 |
-
<?php _e('Products', 'woocommerce-checkout-manager'); ?>
|
79 |
-
</h3>
|
80 |
-
|
81 |
-
<div class="info-of">
|
82 |
-
<?php _e('Allow File Upload', 'woocommerce-checkout-manager'); ?>
|
83 |
-
</div>
|
84 |
-
|
85 |
-
<div class="option allow" >
|
86 |
-
<input name="wccs_settings[checkness][allow_file_upload]" placeholder="Enter Product ID(s); Example: 1674, 1423, 1234" type="text" value="<?php echo (empty($options['checkness']['allow_file_upload']) ) ? '' : $options['checkness']['allow_file_upload']; ?>" />
|
87 |
-
</div>
|
88 |
-
</div>
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
<div class="section">
|
93 |
-
<div class="info-of">
|
94 |
-
<?php _e('Deny File Upload', 'woocommerce-checkout-manager'); ?>
|
95 |
-
</div>
|
96 |
-
|
97 |
-
<div class="option" >
|
98 |
-
<input name="wccs_settings[checkness][deny_file_upload]" placeholder="Enter Product ID(s); Example: 1674, 1423, 1234" type="text" value="<?php echo (empty($options['checkness']['deny_file_upload'])) ? '' : $options['checkness']['deny_file_upload']; ?>" />
|
99 |
-
</div>
|
100 |
-
</div>
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
<div class="section">
|
105 |
-
<h3 class="heading">
|
106 |
-
<?php _e('Categories', 'woocommerce-checkout-manager'); ?>
|
107 |
-
</h3>
|
108 |
-
|
109 |
-
<div class="info-of">
|
110 |
-
<?php _e('Allow File Upload', 'woocommerce-checkout-manager'); ?>
|
111 |
-
</div>
|
112 |
-
|
113 |
-
<div class="option allow" >
|
114 |
-
<input name="wccs_settings[checkness][allow_file_upload_cat]" placeholder="Enter Category Slug(s); Example: my-cat, flowers_in" type="text" value="<?php echo ( empty($options['checkness']['allow_file_upload_cat']) ) ? '' : $options['checkness']['allow_file_upload_cat']; ?>" />
|
115 |
-
</div>
|
116 |
-
</div>
|
117 |
-
|
118 |
-
|
119 |
-
<div class="section">
|
120 |
-
<div class="info-of">
|
121 |
-
<?php _e('Deny File Upload', 'woocommerce-checkout-manager'); ?>
|
122 |
-
</div>
|
123 |
-
|
124 |
-
<div class="option" >
|
125 |
-
<input name="wccs_settings[checkness][deny_file_upload_cat]" placeholder="Enter Category Slug(s); Example: my-cat, flowers_in" type="text" value="<?php echo (empty( $options['checkness']['deny_file_upload_cat'])) ? '' : $options['checkness']['deny_file_upload_cat']; ?>" />
|
126 |
-
</div>
|
127 |
-
</div>
|
128 |
-
|
129 |
-
|
130 |
-
<div class="section">
|
131 |
-
<h3 class="heading">
|
132 |
-
<?php _e('General Alerts', 'woocommerce-checkout-manager'); ?>
|
133 |
-
</h3>
|
134 |
-
|
135 |
-
<div class="info-of">
|
136 |
-
<?php _e('Picture Editing Saved', 'woocommerce-checkout-manager'); ?>
|
137 |
-
</div>
|
138 |
-
|
139 |
-
<div class="option allow" >
|
140 |
-
<input name="wccs_settings[checkness][picture_success]" placeholder="Picture Saved" type="text" value="<?php echo ( empty($options['checkness']['picture_success']) ) ? 'Picture Saved!' : $options['checkness']['picture_success']; ?>" />
|
141 |
-
</div>
|
142 |
-
</div>
|
143 |
-
|
144 |
-
<div class="section">
|
145 |
-
<div class="info-of">
|
146 |
-
<?php _e('Deletion confirmation', 'woocommerce-checkout-manager'); ?>
|
147 |
-
</div>
|
148 |
-
|
149 |
-
<div class="option" >
|
150 |
-
<input name="wccs_settings[checkness][file_delete]" placeholder="Delete" type="text" value="<?php echo (empty( $options['checkness']['file_delete'])) ? 'Delete' : $options['checkness']['file_delete']; ?>" />
|
151 |
-
</div>
|
152 |
-
</div>
|
153 |
-
|
154 |
-
|
155 |
-
<div class="section">
|
156 |
-
<h3 class="heading">
|
157 |
-
<?php _e('Restrictions', 'woocommerce-checkout-manager'); ?>
|
158 |
-
</h3>
|
159 |
-
|
160 |
-
<div class="info-of">
|
161 |
-
<?php _e('File types', 'woocommerce-checkout-manager'); ?>
|
162 |
-
</div>
|
163 |
-
|
164 |
-
<div class="option allow" >
|
165 |
-
<input name="wccs_settings[checkness][file_types]" placeholder="png,jpeg,gif" type="text" value="<?php echo ( empty($options['checkness']['file_types']) ) ? '' : $options['checkness']['file_types']; ?>" />
|
166 |
-
</div>
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
<div class="info-of">
|
171 |
-
<?php _e('Number Of Files to Upload', 'woocommerce-checkout-manager'); ?>
|
172 |
-
</div>
|
173 |
-
|
174 |
-
<div class="option allow" >
|
175 |
-
<input name="wccs_settings[checkness][file_upload_number]" placeholder="4" type="text" value="<?php echo (empty( $options['checkness']['file_upload_number'])) ? '' : $options['checkness']['file_upload_number']; ?>" />
|
176 |
-
</div>
|
177 |
-
</div>
|
178 |
-
|
179 |
-
<div class="section">
|
180 |
-
<div class="info-of">
|
181 |
-
<?php _e('Allow Upload for Order Status', 'woocommerce-checkout-manager'); ?>
|
182 |
-
</div>
|
183 |
-
|
184 |
-
<div class="option" >
|
185 |
-
<input name="wccs_settings[checkness][upload_os]" placeholder="completed" type="text" value="<?php echo (empty( $options['checkness']['upload_os'])) ? '' : $options['checkness']['upload_os']; ?>" />
|
186 |
-
</div>
|
187 |
-
</div>
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/classes/import.php
CHANGED
@@ -14,145 +14,174 @@ $options = get_option( 'wccs_settings' );
|
|
14 |
$options2 = get_option( 'wccs_settings2' );
|
15 |
$options3 = get_option( 'wccs_settings3' );
|
16 |
|
17 |
-
if
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
$encode_options = $_FILES['import']['tmp_name'];
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
}
|
39 |
}
|
40 |
|
41 |
// BILLING IMPORT ===========================================================
|
42 |
// ==========================================================================
|
43 |
-
if
|
44 |
-
|
|
|
|
|
|
|
45 |
} else {
|
46 |
$encode_options = $_FILES['billing-import']['tmp_name'];
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
}
|
64 |
-
}
|
65 |
|
|
|
66 |
|
67 |
// SHIPPING IMPORT ================================================================
|
68 |
// ================================================================================
|
69 |
-
if
|
70 |
-
|
|
|
|
|
|
|
71 |
} else {
|
72 |
$encode_options = $_FILES['shipping-import']['tmp_name'];
|
73 |
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
}
|
90 |
-
}
|
91 |
|
|
|
92 |
|
93 |
// GENERAL IMPORT =========================================================== ..
|
94 |
// ==========================================================================
|
95 |
-
if
|
96 |
-
|
|
|
|
|
|
|
97 |
} else {
|
98 |
$encode_options = $_FILES['general-import']['tmp_name'];
|
99 |
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
fclose($handle);
|
116 |
-
}
|
117 |
-
}
|
118 |
-
|
119 |
-
|
120 |
|
|
|
121 |
|
122 |
// =======================================================================================================
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
<script type="text/javascript">
|
152 |
jQuery(document).ready(function() {
|
153 |
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
157 |
});
|
158 |
</script>
|
14 |
$options2 = get_option( 'wccs_settings2' );
|
15 |
$options3 = get_option( 'wccs_settings3' );
|
16 |
|
17 |
+
if( isset($_FILES['import']) && check_admin_referer('ie-import') ) {
|
18 |
+
|
19 |
+
if( $_FILES['import']['error'] > 0 ) {
|
20 |
+
// @mod - Add in error reporting
|
21 |
+
// Do something
|
22 |
+
} else {
|
23 |
$encode_options = $_FILES['import']['tmp_name'];
|
24 |
|
25 |
+
if( ( $handle = fopen( $encode_options , "r" ) ) !== FALSE ) {
|
26 |
+
$rows = 0;
|
27 |
+
$header = fgetcsv($handle, 10000, ",");
|
28 |
+
while( ( $data = fgetcsv($handle, 10000, ",")) !== FALSE ) {
|
29 |
+
$c = 0;
|
30 |
+
foreach( $header as $value ) {
|
31 |
+
$options['buttons'][$rows][$value] = $data[$c];
|
32 |
+
$c++;
|
33 |
+
}
|
34 |
+
$rows++;
|
35 |
+
update_option( 'wccs_settings', $options );
|
36 |
+
}
|
37 |
+
fclose($handle);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
|
|
41 |
}
|
42 |
|
43 |
// BILLING IMPORT ===========================================================
|
44 |
// ==========================================================================
|
45 |
+
if( isset( $_FILES['billing-import'] ) && check_admin_referer( 'ie-import' ) ) {
|
46 |
+
|
47 |
+
if( $_FILES['billing-import']['error'] > 0 ) {
|
48 |
+
// @mod - Add in error reporting
|
49 |
+
// Do something
|
50 |
} else {
|
51 |
$encode_options = $_FILES['billing-import']['tmp_name'];
|
52 |
|
53 |
+
if( ( $handle = fopen( $encode_options , "r") ) !== FALSE ) {
|
54 |
+
$rows = 0;
|
55 |
+
$header = fgetcsv($handle, 10000, ",");
|
56 |
+
while( ( $data = fgetcsv($handle, 10000, ",")) !== FALSE ) {
|
57 |
+
$c = 0;
|
58 |
+
foreach( $header as $value ) {
|
59 |
+
$options3['billing_buttons'][$rows][$value] = $data[$c];
|
60 |
+
$c++;
|
61 |
+
}
|
62 |
+
$rows++;
|
63 |
+
update_option( 'wccs_settings3', $options3 );
|
64 |
+
}
|
65 |
+
fclose($handle);
|
66 |
+
}
|
67 |
+
}
|
|
|
|
|
68 |
|
69 |
+
}
|
70 |
|
71 |
// SHIPPING IMPORT ================================================================
|
72 |
// ================================================================================
|
73 |
+
if( isset( $_FILES['shipping-import'] ) && check_admin_referer( 'ie-import' ) ) {
|
74 |
+
|
75 |
+
if( $_FILES['shipping-import']['error'] > 0 ) {
|
76 |
+
// @mod - Add in error reporting
|
77 |
+
// Do something
|
78 |
} else {
|
79 |
$encode_options = $_FILES['shipping-import']['tmp_name'];
|
80 |
|
81 |
+
if( ( $handle = fopen( $encode_options , "r" ) ) !== FALSE ) {
|
82 |
+
$rows = 0;
|
83 |
+
$header = fgetcsv($handle, 10000, ",");
|
84 |
+
while( ($data = fgetcsv($handle, 10000, ",")) !== FALSE ) {
|
85 |
+
$c = 0;
|
86 |
+
foreach( $header as $value ) {
|
87 |
+
$options2['shipping_buttons'][$rows][$value] = $data[$c];
|
88 |
+
$c++;
|
89 |
+
}
|
90 |
+
$rows++;
|
91 |
+
update_option( 'wccs_settings2', $options2 );
|
92 |
+
}
|
93 |
+
fclose($handle);
|
94 |
+
}
|
95 |
+
}
|
|
|
|
|
96 |
|
97 |
+
}
|
98 |
|
99 |
// GENERAL IMPORT =========================================================== ..
|
100 |
// ==========================================================================
|
101 |
+
if( isset( $_FILES['general-import'] ) && check_admin_referer( 'ie-import' ) ) {
|
102 |
+
|
103 |
+
if( $_FILES['general-import']['error'] > 0 ) {
|
104 |
+
// @mod - Add in error reporting
|
105 |
+
// Do something
|
106 |
} else {
|
107 |
$encode_options = $_FILES['general-import']['tmp_name'];
|
108 |
|
109 |
+
if( ( $handle = fopen( $encode_options , "r" ) ) !== FALSE ) {
|
110 |
+
$rows = 0;
|
111 |
+
$header = fgetcsv($handle, 10000, ",");
|
112 |
+
while( ($data = fgetcsv($handle, 10000, ",") ) !== FALSE ) {
|
113 |
+
$c = 0;
|
114 |
+
foreach( $header as $value ) {
|
115 |
+
$options['checkness'][$value] = $data[$c];
|
116 |
+
$c++;
|
117 |
+
}
|
118 |
+
$rows++;
|
119 |
+
update_option( 'wccs_settings', $options );
|
120 |
+
}
|
121 |
+
}
|
122 |
+
fclose($handle);
|
123 |
+
}
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
+
}
|
126 |
|
127 |
// =======================================================================================================
|
128 |
+
?>
|
129 |
+
|
130 |
+
<form method='post' class='import_form' enctype='multipart/form-data'>
|
131 |
+
|
132 |
+
<?php wp_nonce_field('ie-import'); ?>
|
133 |
+
<input type="button" id="wccs_import_submit" class="button button-hero button-secondary import" value="Import" />
|
134 |
+
|
135 |
+
<div id="wp-auth-check-wrap" class="click_showWccm" style="display:none;">
|
136 |
+
<div id="wp-auth-check-bg"></div>
|
137 |
+
<div id="wp-auth-check" style="max-height: 700px;">
|
138 |
+
<div class="wp-auth-check-close" tabindex="0" title="Close"></div>
|
139 |
+
<div class="updated">
|
140 |
+
<h3><?php _e( 'Field Data Import', 'woocommerce-checkout-manager' ); ?></h3>
|
141 |
+
<p>
|
142 |
+
<?php _e( 'Import General Settings or new Billing, Shipping or Additional fields exported from the WooCheckout > Export screen back into WooCheckout.' ); ?><br /><br />
|
143 |
+
<span class="make_smalla">Max Upload Size: <?php echo size_format( wp_max_upload_size() ); ?> <br /></span>
|
144 |
+
</p>
|
145 |
+
</div>
|
146 |
+
<div class="updated jellow">
|
147 |
+
<p>
|
148 |
+
<span class="heading_smalla"><?php _e( 'General Settings', 'woocommerce-checkout-manager'); ?><br></span>
|
149 |
+
<input type="file" name="general-import" class="wccm_importer" />
|
150 |
+
<input type="submit" class="button button-primary wccm_importer_submit" name="submit" value="<?php _e('Import CSV', 'woocommerce-checkout-manager'); ?>" />
|
151 |
+
</p>
|
152 |
+
<hr />
|
153 |
+
<p>
|
154 |
+
<span class="heading_smalla"><?php _e( 'Billing fields', 'woocommerce-checkout-manager'); ?></span>
|
155 |
+
<input type="file" name="billing-import" class="wccm_importer" />
|
156 |
+
<input type="submit" class="button button-primary wccm_importer_submit" name="submit" value="<?php _e('Import CSV', 'woocommerce-checkout-manager'); ?>" />
|
157 |
+
</p>
|
158 |
+
<hr />
|
159 |
+
<p>
|
160 |
+
<span class="heading_smalla"><?php _e( 'Shipping fields', 'woocommerce-checkout-manager'); ?></span>
|
161 |
+
<input type="file" name="shipping-import" class="wccm_importer" />
|
162 |
+
<input type="submit" class="button button-primary wccm_importer_submit" name="submit" value="<?php _e('Import CSV', 'woocommerce-checkout-manager'); ?>" />
|
163 |
+
</p>
|
164 |
+
<hr />
|
165 |
+
<p>
|
166 |
+
<span class="heading_smalla"><?php _e( 'Additional fields', 'woocommerce-checkout-manager'); ?></span>
|
167 |
+
<input type="file" name="import" class="wccm_importer" />
|
168 |
+
<input type="submit" class="button button-primary wccm_importer_submit" name="submit" value="<?php _e('Import CSV', 'woocommerce-checkout-manager'); ?>" />
|
169 |
+
</p>
|
170 |
+
</div>
|
171 |
+
<!-- .updated -->
|
172 |
+
</div>
|
173 |
+
<!-- #wp-auth-check -->
|
174 |
+
</div>
|
175 |
+
<!-- #wp-auth-check-wrap -->
|
176 |
+
|
177 |
+
</form>
|
178 |
|
179 |
<script type="text/javascript">
|
180 |
jQuery(document).ready(function() {
|
181 |
|
182 |
+
jQuery('#wccs_import_submit').click(function() {
|
183 |
+
jQuery('#wp-auth-check-wrap').slideToggle('slow');
|
184 |
+
});
|
185 |
+
|
186 |
});
|
187 |
</script>
|
includes/classes/main.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* WooCommerce Checkout Manager
|
4 |
*
|
5 |
* MAIN
|
6 |
*
|
@@ -9,2481 +9,984 @@
|
|
9 |
// Exit if accessed directly
|
10 |
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
|
|
12 |
|
13 |
-
function
|
14 |
-
$wccs_plugin_links = array(
|
15 |
-
'<a href="admin.php?page=woocommerce-checkout-manager">'.__('Settings', 'woocommerce-checkout-manager' ).'</a>',
|
16 |
-
'<a href="https://wordpress.org/plugins/woocommerce-checkout-manager/developers/">'.__('Support', 'woocommerce-checkout-manager' ).'</a>',
|
17 |
-
);
|
18 |
-
return array_merge( $wccs_plugin_links, $links );
|
19 |
-
}
|
20 |
-
|
21 |
-
|
22 |
-
function add_payment_method_to_new_order( $order, $sent_to_admin, $plain_text ) {
|
23 |
-
|
24 |
-
$shipping = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' );
|
25 |
-
$billing = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'email', 'phone' );
|
26 |
-
|
27 |
-
$names = array( 'billing', 'shipping' );
|
28 |
-
$inc = 3;
|
29 |
-
|
30 |
-
if( $plain_text ) {
|
31 |
-
|
32 |
-
foreach( $names as $name ) {
|
33 |
|
34 |
-
$
|
|
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
if ( !in_array( $btn['cow'], $array ) ) {
|
42 |
-
if ( (''.get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
43 |
-
echo ''.wpml_string_wccm_pro($btn['label']).': '.nl2br(get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true)).'';
|
44 |
-
echo "\n";
|
45 |
-
|
46 |
-
} elseif ( !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
47 |
-
echo '' .wpml_string_wccm_pro($btn['label']). '';
|
48 |
-
echo "\n";
|
49 |
-
|
50 |
-
} elseif ( (''.get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
51 |
-
$strings = unserialize(get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true));
|
52 |
-
$iww = 0;
|
53 |
-
$len = count($strings);
|
54 |
-
|
55 |
-
echo ''.wpml_string_wccm_pro($btn['label']).': ';
|
56 |
-
foreach($strings as $key ) {
|
57 |
-
if ($iww == $len - 1) {
|
58 |
-
echo ''.$key.'';
|
59 |
-
} else {
|
60 |
-
echo ''.$key.', ';
|
61 |
-
}
|
62 |
-
$iww++;
|
63 |
-
}
|
64 |
-
echo "\n";
|
65 |
-
}elseif( $btn['type'] == 'wooccmupload' ){
|
66 |
-
$info = explode( "||", get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true));
|
67 |
-
echo ''.wpml_string_wccm_pro($btn['force_title2']).': '.$info[0].'';
|
68 |
-
echo "\n";
|
69 |
-
}
|
70 |
-
}
|
71 |
-
endforeach;
|
72 |
-
$inc--;
|
73 |
-
}
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
if ( (''.get_post_meta( $order->id , ''.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] !== 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
80 |
-
echo ''.wpml_string_wccm_pro($btn['label']).': '.nl2br(get_post_meta( $order->id , ''.$btn['cow'].'', true)).'';
|
81 |
-
echo "\n";
|
82 |
-
|
83 |
-
} elseif ( !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
84 |
-
echo ''.wpml_string_wccm_pro($btn['label']).'';
|
85 |
-
echo "\n";
|
86 |
-
|
87 |
-
} elseif ( (''.get_post_meta( $order->id , ''.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
88 |
-
|
89 |
-
$strings = unserialize(get_post_meta( $order->id , ''.$btn['cow'].'', true));
|
90 |
-
$iww = 0;
|
91 |
-
$len = count($strings);
|
92 |
-
|
93 |
-
echo ''.wpml_string_wccm_pro($btn['label']).': ';
|
94 |
-
foreach($strings as $key ) {
|
95 |
-
if ($iww == $len - 1) {
|
96 |
-
echo ''.$key.'';
|
97 |
-
} else {
|
98 |
-
echo ''.$key.', ';
|
99 |
-
}
|
100 |
-
$iww++;
|
101 |
-
}
|
102 |
-
echo "\n";
|
103 |
-
}elseif( $btn['type'] == 'wooccmupload' ){
|
104 |
-
$info = explode("||", get_post_meta( $order->id , ''.$btn['cow'].'', true));
|
105 |
-
echo ''.wpml_string_wccm_pro($btn['force_title2']).': '.$info[0].'';
|
106 |
-
echo "\n";
|
107 |
-
}
|
108 |
-
endforeach;
|
109 |
-
|
110 |
-
|
111 |
-
if ( !empty($options['checkness']['set_timezone']) ) {
|
112 |
-
date_default_timezone_set(''.$options['checkness']['set_timezone'].'');
|
113 |
-
}
|
114 |
-
$date = ( !empty($options['checkness']['twenty_hour'])) ? date("G:i T (P").' GMT)' : date("g:i a");
|
115 |
-
if ( $options['checkness']['time_stamp'] == true ) {
|
116 |
-
echo ''.$options['checkness']['time_stamp_title'].' ' . $date . "\n";
|
117 |
-
}
|
118 |
-
if ( $order->payment_method_title && $options['checkness']['payment_method_t'] == true ) {
|
119 |
-
echo ''.$options['checkness']['payment_method_d'].': ' . $order->payment_method_title . "\n";
|
120 |
-
}
|
121 |
-
if ( $order->shipping_method_title && ($options['checkness']['shipping_method_t'] == true)) {
|
122 |
-
echo ''.$options['checkness']['shipping_method_d'].': ' . $order->shipping_method_title . "\n";
|
123 |
-
}
|
124 |
-
|
125 |
-
echo "\n";
|
126 |
-
} else {
|
127 |
-
foreach( $names as $name ) {
|
128 |
-
|
129 |
-
$array = ($name == 'billing') ? $billing : $shipping;
|
130 |
-
|
131 |
-
$options = get_option( 'wccs_settings'.$inc.'' );
|
132 |
-
|
133 |
-
foreach ( $options[''.$name.'_buttons'] as $btn ) :
|
134 |
-
|
135 |
-
|
136 |
-
if ( !in_array( $btn['cow'], $array ) ) {
|
137 |
-
if ( (''.get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
138 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['label']).':</strong> '.nl2br(get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true)).'</p>';
|
139 |
-
|
140 |
-
} elseif ( !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
141 |
-
echo '<h2>' .wpml_string_wccm_pro($btn['label']). '</h2>';
|
142 |
-
|
143 |
-
} elseif ( (''.get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
144 |
-
$strings = unserialize(get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true));
|
145 |
-
$iww = 0;
|
146 |
-
$len = count($strings);
|
147 |
-
|
148 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['label']).':</strong> ';
|
149 |
-
foreach($strings as $key ) {
|
150 |
-
if ($iww == $len - 1) {
|
151 |
-
echo ''.$key.'';
|
152 |
-
} else {
|
153 |
-
echo ''.$key.', ';
|
154 |
-
}
|
155 |
-
$iww++;
|
156 |
-
}
|
157 |
-
echo '</p>';
|
158 |
-
}elseif( $btn['type'] == 'wooccmupload' ){
|
159 |
-
$info = explode("||", get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true));
|
160 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['force_title2']).':</strong> '.$info[0].'</p>';
|
161 |
-
}
|
162 |
}
|
163 |
-
endforeach;
|
164 |
-
$inc--;
|
165 |
-
}
|
166 |
|
167 |
-
$options = get_option( 'wccs_settings' );
|
168 |
-
|
169 |
-
foreach ( $options['buttons'] as $btn ) :
|
170 |
-
|
171 |
-
if ( (''.get_post_meta( $order->id , ''.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] !== 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
172 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['label']).':</strong> '.nl2br(get_post_meta( $order->id , ''.$btn['cow'].'', true)).'</p>';
|
173 |
-
|
174 |
-
} elseif ( !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
175 |
-
echo '<h2>'.wpml_string_wccm_pro($btn['label']).'</h2>';
|
176 |
-
|
177 |
-
} elseif ( (''.get_post_meta( $order->id , ''.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
178 |
-
|
179 |
-
$strings = unserialize(get_post_meta( $order->id , ''.$btn['cow'].'', true));
|
180 |
-
$iww = 0;
|
181 |
-
$len = count($strings);
|
182 |
-
|
183 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['label']).':</strong> ';
|
184 |
-
foreach($strings as $key ) {
|
185 |
-
if ($iww == $len - 1) {
|
186 |
-
echo ''.$key.'';
|
187 |
-
} else {
|
188 |
-
echo ''.$key.', ';
|
189 |
-
}
|
190 |
-
$iww++;
|
191 |
-
}
|
192 |
-
echo '</p>';
|
193 |
-
}elseif( $btn['type'] == 'wooccmupload' ){
|
194 |
-
$info = explode( "||", get_post_meta( $order->id , ''.$btn['cow'].'', true));
|
195 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['force_title2']).':</strong> '.$info[0].'</p>';
|
196 |
-
}
|
197 |
-
endforeach;
|
198 |
-
|
199 |
-
|
200 |
-
if ( !empty($options['checkness']['set_timezone']) ) {
|
201 |
-
date_default_timezone_set(''.$options['checkness']['set_timezone'].'');
|
202 |
-
}
|
203 |
-
$date = ( !empty($options['checkness']['twenty_hour'])) ? date("G:i T (P").' GMT)' : date("g:i a");
|
204 |
-
if ( $options['checkness']['time_stamp'] == true ) {
|
205 |
-
echo '<p><strong>'.$options['checkness']['time_stamp_title'].':</strong> ' . $date . '</p>';
|
206 |
-
}
|
207 |
-
if ( $order->payment_method_title && $options['checkness']['payment_method_t'] == true ) {
|
208 |
-
echo '<p><strong>'.$options['checkness']['payment_method_d'].':</strong> ' . $order->payment_method_title . '</p>';
|
209 |
-
}
|
210 |
-
if ( $order->shipping_method_title && ($options['checkness']['shipping_method_t'] == true)) {
|
211 |
-
echo '<p><strong>'.$options['checkness']['shipping_method_d'].':</strong> ' . $order->shipping_method_title . '</p>';
|
212 |
-
}
|
213 |
}
|
214 |
-
|
215 |
-
|
216 |
-
}
|
217 |
|
|
|
218 |
|
|
|
|
|
219 |
|
|
|
|
|
|
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
if ( $btn['type'] == 'heading' && empty($btn['deny_checkout'] ) ) {
|
227 |
-
echo '<h3 class="form-row '.$btn['position'].'" id="'.$btn['cow'].'_field">' . wpml_string_wccm_pro(''.$btn['label'].'') . '</h3>';
|
228 |
-
}
|
229 |
-
|
230 |
-
|
231 |
-
if ( $btn['type'] == 'wooccmtext' ) {
|
232 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
233 |
-
'type' => 'wooccmtext',
|
234 |
-
'class' => array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].''),
|
235 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
236 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
237 |
-
'clear' => ''.$btn['clear_row'].'',
|
238 |
-
'user_role' => ''.$btn['user_role'].'',
|
239 |
-
'role_options' => ''.$btn['role_options'].'',
|
240 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
241 |
-
'placeholder' => wpml_string_wccm_pro(''.$btn['placeholder'].''),
|
242 |
-
|
243 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
244 |
-
}
|
245 |
-
|
246 |
-
|
247 |
-
if ( $btn['type'] == 'wooccmtextarea' ) {
|
248 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
249 |
-
'type' => 'wooccmtextarea',
|
250 |
-
'class' => array(''.$btn['position'].' wccs-form-row-wide '.$btn['conditional_tie'].' '.$btn['extra_class'].''),
|
251 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
252 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
253 |
-
'clear' => ''.$btn['clear_row'].'',
|
254 |
-
'user_role' => ''.$btn['user_role'].'',
|
255 |
-
'role_options' => ''.$btn['role_options'].'',
|
256 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
257 |
-
'placeholder' => wpml_string_wccm_pro(''.$btn['placeholder'].''),
|
258 |
-
|
259 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
260 |
-
}
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
if ( $btn['type'] == 'colorpicker' ) {
|
265 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
266 |
-
'type' => 'colorpicker',
|
267 |
-
'class' => array(''.$btn['position'].' '.$btn['conditional_tie'].' wccs_colorpicker '.$btn['extra_class'].''),
|
268 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
269 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
270 |
-
'clear' => ''.$btn['clear_row'].'',
|
271 |
-
'user_role' => ''.$btn['user_role'].'',
|
272 |
-
'role_options' => ''.$btn['role_options'].'',
|
273 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
274 |
-
'placeholder' => wpml_string_wccm_pro(''.$btn['placeholder'].''),
|
275 |
-
'color' => ''.$btn['colorpickerd'].'',
|
276 |
-
'colorpickertype' => ''.$btn['colorpickertype'].''
|
277 |
-
|
278 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
279 |
-
}
|
280 |
-
|
281 |
-
|
282 |
-
if ( $btn['type'] == 'datepicker' ) {
|
283 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
284 |
-
'type' => 'wooccmtext',
|
285 |
-
'class' => array(''.$btn['position'].' MyDate'.$btn['cow'].' wccs-form-row-wide '.$btn['conditional_tie'].' '.$btn['extra_class'].''),
|
286 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
287 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
288 |
-
'user_role' => ''.$btn['user_role'].'',
|
289 |
-
'role_options' => ''.$btn['role_options'].'',
|
290 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
291 |
-
'clear' => ''.$btn['clear_row'].'',
|
292 |
-
'placeholder' => wpml_string_wccm_pro(''.$btn['placeholder'].''),
|
293 |
-
|
294 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
295 |
-
}
|
296 |
-
|
297 |
-
|
298 |
-
if ( $btn['type'] == 'time' ) {
|
299 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
300 |
-
'type' => 'wooccmtext',
|
301 |
-
'class' => array(''.$btn['position'].' MyTime'.$btn['cow'].' wccs-form-row-wide '.$btn['conditional_tie'].' '.$btn['extra_class'].''),
|
302 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
303 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
304 |
-
'user_role' => ''.$btn['user_role'].'',
|
305 |
-
'role_options' => ''.$btn['role_options'].'',
|
306 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
307 |
-
'clear' => ''.$btn['clear_row'].'',
|
308 |
-
'placeholder' => wpml_string_wccm_pro(''.$btn['placeholder'].''),
|
309 |
-
|
310 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
311 |
-
}
|
312 |
-
|
313 |
-
|
314 |
-
if ( $btn['type'] == 'checkbox_wccm' ) {
|
315 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
316 |
-
'type' => 'checkbox_wccm',
|
317 |
-
'class' => array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].''),
|
318 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
319 |
-
'user_role' => ''.$btn['user_role'].'',
|
320 |
-
'role_options' => ''.$btn['role_options'].'',
|
321 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
322 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
323 |
-
'clear' => ''.$btn['clear_row'].'',
|
324 |
-
'options' => ''.$btn['option_array'].'',
|
325 |
-
|
326 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
327 |
-
}
|
328 |
-
|
329 |
-
|
330 |
-
if ( $btn['type'] == 'wooccmpassword' ) {
|
331 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
332 |
-
'type' => 'wooccmpassword',
|
333 |
-
'class' => array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].' '.$btn['extra_class'].''),
|
334 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
335 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
336 |
-
'user_role' => ''.$btn['user_role'].'',
|
337 |
-
'role_options' => ''.$btn['role_options'].'',
|
338 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
339 |
-
'clear' => ''.$btn['clear_row'].'',
|
340 |
-
'placeholder' => ''.$btn['placeholder'].'',
|
341 |
-
|
342 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
343 |
-
}
|
344 |
-
|
345 |
-
|
346 |
-
if ( $btn['type'] == 'wooccmradio' ) {
|
347 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
348 |
-
'type' => 'wooccmradio',
|
349 |
-
'class' => array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].''),
|
350 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
351 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
352 |
-
'default' => ''.$btn['force_title2'].'',
|
353 |
-
'user_role' => ''.$btn['user_role'].'',
|
354 |
-
'role_options' => ''.$btn['role_options'].'',
|
355 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
356 |
-
'clear' => ''.$btn['clear_row'].'',
|
357 |
-
'options' => ''.$btn['option_array'].'',
|
358 |
-
|
359 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
360 |
-
}
|
361 |
-
|
362 |
-
|
363 |
-
if ( $btn['type'] == 'multiselect' ) {
|
364 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
365 |
-
'type' => 'multiselect',
|
366 |
-
'class' => array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].''),
|
367 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
368 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
369 |
-
'user_role' => ''.$btn['user_role'].'',
|
370 |
-
'role_options' => ''.$btn['role_options'].'',
|
371 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
372 |
-
'clear' => ''.$btn['clear_row'].'',
|
373 |
-
'options' => ''.$btn['option_array'].'',
|
374 |
-
|
375 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
376 |
-
}
|
377 |
-
|
378 |
-
|
379 |
-
if ( $btn['type'] == 'multicheckbox' ) {
|
380 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
381 |
-
'type' => 'multicheckbox',
|
382 |
-
'class' => array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].''),
|
383 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
384 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
385 |
-
'user_role' => ''.$btn['user_role'].'',
|
386 |
-
'role_options' => ''.$btn['role_options'].'',
|
387 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
388 |
-
'clear' => ''.$btn['clear_row'].'',
|
389 |
-
'options' => ''.$btn['option_array'].'',
|
390 |
-
|
391 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
392 |
-
}
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
if ( $btn['type'] == 'wooccmselect' ) {
|
398 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
399 |
-
'type' => 'wooccmselect',
|
400 |
-
'class' => array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].''),
|
401 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
402 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
403 |
-
'clear' => ''.$btn['clear_row'].'',
|
404 |
-
'user_role' => ''.$btn['user_role'].'',
|
405 |
-
'role_options' => ''.$btn['role_options'].'',
|
406 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
407 |
-
'fancy' => ''.$btn['fancy'].'',
|
408 |
-
'default' => ''.$btn['force_title2'].'',
|
409 |
-
'options' => ''.$btn['option_array'].'',
|
410 |
-
|
411 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
412 |
-
}
|
413 |
-
|
414 |
-
if ( $btn['type'] == 'wooccmupload' ) {
|
415 |
-
woocommerce_form_field( ''.$btn['cow'].'' , array(
|
416 |
-
'type' => 'wooccmupload',
|
417 |
-
'placeholder' => ''.$btn['placeholder'].'',
|
418 |
-
'class' => array(''.$btn['position'].' '.$btn['conditional_tie'].' '.$btn['extra_class'].''),
|
419 |
-
'label' => wpml_string_wccm_pro(''.$btn['label'].''),
|
420 |
-
'wooccm_required' => ''.$btn['checkbox'].'',
|
421 |
-
'clear' => ''.$btn['clear_row'].'',
|
422 |
-
'user_role' => ''.$btn['user_role'].'',
|
423 |
-
'role_options' => ''.$btn['role_options'].'',
|
424 |
-
'role_options2' => ''.$btn['role_options2'].'',
|
425 |
-
'fancy' => ''.$btn['fancy'].'',
|
426 |
-
'default' => ''.$btn['force_title2'].'',
|
427 |
-
'options' => ''.$btn['option_array'].'',
|
428 |
-
|
429 |
-
), $checkout->get_value( ''.$btn['cow'].'' ));
|
430 |
-
}
|
431 |
-
|
432 |
-
endforeach;
|
433 |
}
|
434 |
-
}
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
function wccs_positioning() {
|
440 |
-
$options = get_option( 'wccs_settings' );
|
441 |
-
if ( $options['checkness']['position'] == 'before_shipping_form' ) {
|
442 |
-
return 'before_shipping_form';
|
443 |
-
}elseif( $options['checkness']['position'] == 'after_shipping_form' ) {
|
444 |
-
return 'after_shipping_form';
|
445 |
-
}elseif( $options['checkness']['position'] == 'before_billing_form' ) {
|
446 |
-
return 'before_billing_form';
|
447 |
-
}elseif( $options['checkness']['position'] == 'after_billing_form' ) {
|
448 |
-
return 'after_billing_form';
|
449 |
-
}elseif( $options['checkness']['position'] == 'after_order_notes' ) {
|
450 |
-
return 'after_order_notes';
|
451 |
}
|
452 |
-
}
|
453 |
-
|
454 |
-
function wccs_custom_checkout_field_pro_update_order_meta( $order ) {
|
455 |
-
$options = get_option( 'wccs_settings' );
|
456 |
-
|
457 |
-
foreach ( $options['buttons'] as $btn ) :
|
458 |
-
$label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
|
459 |
-
|
460 |
-
if ( $btn['type'] !== 'multiselect' && $btn['type'] !== 'multicheckbox' ) {
|
461 |
-
if ( $_POST[ ''.$btn['cow'].'' ]) {
|
462 |
-
update_post_meta( $order, ''.$btn['cow'].'' , $_POST[ ''.$btn['cow'].'' ] );
|
463 |
-
}
|
464 |
-
} elseif ( $btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox' ) {
|
465 |
-
|
466 |
-
if ( $_POST[ ''.$btn['cow'].'' ]) {
|
467 |
-
update_post_meta( $order, ''.$btn['cow'].'' , serialize( $_POST[ ''.$btn['cow'].'' ] ));
|
468 |
-
}
|
469 |
-
}
|
470 |
-
|
471 |
-
endforeach;
|
472 |
-
}
|
473 |
|
474 |
-
|
475 |
-
|
476 |
-
function wccs_custom_checkout_field_pro_process() {
|
477 |
-
global $woocommerce;
|
478 |
-
|
479 |
-
$options = get_option( 'wccs_settings' );
|
480 |
-
|
481 |
-
foreach ( $options['buttons'] as $btn ) :
|
482 |
-
|
483 |
-
if( $btn['checkbox'] === 'true' ) {
|
484 |
-
// without checkbox
|
485 |
-
if ( empty($btn['single_px_cat']) && empty($btn['single_p_cat']) && empty($btn['single_px']) && empty($btn['single_p']) && !empty( $btn['label'] ) && $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && ($btn['type'] !== 'heading') ) {
|
486 |
-
if (!$_POST[''.$btn['cow'].''] ) {
|
487 |
-
wc_add_notice( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> '.wpml_string_wccm_pro('is a required field.').'' , 'error');
|
488 |
-
}
|
489 |
-
}
|
490 |
-
|
491 |
-
// checkbox
|
492 |
-
if ( empty($btn['single_px_cat']) && empty($btn['single_p_cat']) && empty($btn['single_px']) && empty($btn['single_p']) && $btn['type'] == 'checkbox' && !empty( $btn['label'] ) && $btn['type'] !== 'changename' && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'heading') ) {
|
493 |
-
if ( ($_POST[ ''.$btn['cow'].'' ] == ''.$btn['check_2'].'') && (!empty ($btn['checkbox']) ) ) {
|
494 |
-
wc_add_notice( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> '.wpml_string_wccm_pro('is a required field.').'', 'error');
|
495 |
-
}
|
496 |
-
}
|
497 |
-
|
498 |
-
}
|
499 |
-
endforeach;
|
500 |
-
}
|
501 |
-
|
502 |
-
/**
|
503 |
-
*breakdown csv and change to descending order by $key
|
504 |
-
*
|
505 |
-
function wooccm_descending_order_csv($heading){
|
506 |
-
$heading = str_replace( array('["Name", "', '", ]', '", "'), array('', '', '||'), $heading);
|
507 |
-
$heading = explode('||', $heading);
|
508 |
-
krsort($heading);
|
509 |
-
$heading = implode('||', $heading);
|
510 |
-
$heading = str_replace( '||', '", "', $heading);
|
511 |
-
$heading = '["Name", "'.$heading.'", ]';
|
512 |
-
|
513 |
-
return $heading;
|
514 |
-
}
|
515 |
-
**/
|
516 |
-
|
517 |
-
|
518 |
-
function wooccm_mul_array($val, $array) {
|
519 |
-
foreach ($array as $item)
|
520 |
-
if (isset($item['cow']) && $item['cow'] == $val)
|
521 |
-
return true;
|
522 |
-
return false;
|
523 |
-
}
|
524 |
-
|
525 |
-
function wooccm_mul_array2($val) {
|
526 |
-
global $wpdb;
|
527 |
-
foreach ($wpdb->last_result as $item => $tru ) {
|
528 |
-
if (isset($tru->meta_key) && $tru->meta_key == $val) {
|
529 |
-
return true;
|
530 |
-
}
|
531 |
}
|
532 |
-
return false;
|
533 |
-
}
|
534 |
|
535 |
-
function wooccm_get_value_by_key($array,$key) {
|
536 |
-
foreach($array as $k=>$each){
|
537 |
-
if($k==$key) {
|
538 |
-
return $each;
|
539 |
-
}
|
540 |
-
if(is_array($each)){
|
541 |
-
if($return = wooccm_get_value_by_key($each,$key)) {
|
542 |
-
return $return;
|
543 |
-
}
|
544 |
-
}
|
545 |
-
}
|
546 |
}
|
547 |
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
}
|
553 |
-
}
|
554 |
-
}
|
555 |
|
|
|
556 |
|
557 |
-
|
558 |
-
|
559 |
-
$detect_error = 0;
|
560 |
-
// translate additional fields
|
561 |
-
if ( !empty($input['buttons']) ) {
|
562 |
-
foreach( $input['buttons'] as $i => $btn ) :
|
563 |
-
|
564 |
-
if( function_exists( 'icl_register_string' ) ) {
|
565 |
-
if ( !empty($btn['label']) ) {
|
566 |
-
icl_register_string('WooCommerce Checkout Manager', ''.$btn['label'].'', ''.$btn['label'].'');
|
567 |
-
}
|
568 |
-
if ( !empty($btn['placeholder']) ) {
|
569 |
-
icl_register_string('WooCommerce Checkout Manager', ''.$btn['placeholder'].'', ''.$btn['placeholder'].'');
|
570 |
-
}
|
571 |
-
|
572 |
-
if ( !empty($btn['option_array']) ) {
|
573 |
-
$mysecureop = explode( '||', $btn['option_array']);
|
574 |
-
foreach ( $mysecureop as $one ) {
|
575 |
-
icl_register_string('WooCommerce Checkout Manager', ''.$one.'', ''.$one.'');
|
576 |
-
}
|
577 |
-
}
|
578 |
-
}
|
579 |
-
|
580 |
-
if( !empty($btn['role_options']) && !empty($btn['role_options2']) ) {
|
581 |
-
$input['buttons'][$i]['role_options2'] = '';
|
582 |
-
add_settings_error(
|
583 |
-
'wooccm_settings_errors',
|
584 |
-
esc_attr( 'settings_updated' ),
|
585 |
-
__( 'Sorry! An error occurred. WooCheckout requires you to not have values in both role options. OK.', 'woocommerce-checkout-manager' ),
|
586 |
-
'error'
|
587 |
-
);
|
588 |
-
}
|
589 |
-
|
590 |
-
if( !empty($btn['single_p']) && !empty($btn['single_px']) ) {
|
591 |
-
$input['buttons'][$i]['single_px'] = '';
|
592 |
-
add_settings_error(
|
593 |
-
'wooccm_settings_errors',
|
594 |
-
esc_attr( 'settings_updated' ),
|
595 |
-
__( 'Sorry! An error occurred. WooCheckout requires you to not have values in both hidden product options. OK.', 'woocommerce-checkout-manager' ),
|
596 |
-
'error'
|
597 |
-
);
|
598 |
-
}
|
599 |
-
|
600 |
-
if( !empty($btn['single_p_cat']) && !empty($btn['single_px_cat']) ) {
|
601 |
-
$input['buttons'][$i]['single_px_cat'] = '';
|
602 |
-
add_settings_error(
|
603 |
-
'wooccm_settings_errors',
|
604 |
-
esc_attr( 'settings_updated' ),
|
605 |
-
__( 'Sorry! An error occurred. WooCheckout requires you to not have values in both hidden category options. OK.', 'woocommerce-checkout-manager' ),
|
606 |
-
'error'
|
607 |
-
);
|
608 |
-
}
|
609 |
-
|
610 |
-
|
611 |
-
if( empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
612 |
-
unset( $input['buttons'][$i] );
|
613 |
-
|
614 |
-
if ( $i != 999 ) {
|
615 |
-
$detect_error++;
|
616 |
-
$fieldnum = $i + 1;
|
617 |
-
add_settings_error(
|
618 |
-
'wooccm_settings_errors',
|
619 |
-
esc_attr( 'settings_updated' ),
|
620 |
-
__( 'Sorry! An error occurred. WooCheckout removed field # '.$fieldnum.' because no Label or Placeholder name was detected.', 'woocommerce-checkout-manager' ),
|
621 |
-
'error'
|
622 |
-
);
|
623 |
-
}
|
624 |
-
}
|
625 |
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
$input['buttons'][$i]['cow'] = 'myfield'.$newNum.'';
|
632 |
-
}
|
633 |
-
|
634 |
-
}
|
635 |
-
|
636 |
-
if( !empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
637 |
-
unset( $input['buttons'][$i] );
|
638 |
-
|
639 |
-
if ( $i != 999 ) {
|
640 |
-
$detect_error++;
|
641 |
-
$fieldnum = $i + 1;
|
642 |
-
add_settings_error(
|
643 |
-
'wooccm_settings_errors',
|
644 |
-
esc_attr( 'settings_updated' ),
|
645 |
-
__( 'Sorry! An error occurred. WooCheckout removed field # '.$fieldnum.' because no Label or Placeholder name was detected.', 'woocommerce-checkout-manager' ),
|
646 |
-
'error'
|
647 |
-
);
|
648 |
}
|
649 |
-
}
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
endforeach;
|
654 |
-
}
|
655 |
-
|
656 |
-
if( $detect_error == 0 ) {
|
657 |
-
add_settings_error(
|
658 |
-
'wooccm_settings_errors',
|
659 |
-
esc_attr( 'settings_updated' ),
|
660 |
-
__( 'Your settings has been saved.', 'woocommerce-checkout-manager' ),
|
661 |
-
'updated'
|
662 |
-
);
|
663 |
-
}
|
664 |
-
|
665 |
-
return $input;
|
666 |
-
}
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
function wccs_options_validate_pro2( $input ) {
|
672 |
-
|
673 |
-
$detect_error = 0;
|
674 |
-
// translate shipping fields
|
675 |
-
if ( !empty($input['shipping_buttons']) ) {
|
676 |
-
foreach( $input['shipping_buttons'] as $i => $btn ) :
|
677 |
-
|
678 |
-
if( function_exists( 'icl_register_string' ) ) {
|
679 |
-
if ( !empty($btn['label']) ) {
|
680 |
-
icl_register_string('WooCommerce Checkout Manager', ''.$btn['label'].'', ''.$btn['label'].'');
|
681 |
-
}
|
682 |
-
if ( !empty($btn['placeholder']) ) {
|
683 |
-
icl_register_string('WooCommerce Checkout Manager', ''.$btn['placeholder'].'', ''.$btn['placeholder'].'');
|
684 |
-
}
|
685 |
-
|
686 |
-
if ( !empty($btn['option_array']) ) {
|
687 |
-
$mysecureop = explode( '||', $btn['option_array']);
|
688 |
-
foreach ( $mysecureop as $one ) {
|
689 |
-
icl_register_string('WooCommerce Checkout Manager', ''.$one.'', ''.$one.'');
|
690 |
}
|
691 |
}
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
if( !empty($btn['role_options']) && !empty($btn['role_options2']) ) {
|
696 |
-
$input['buttons'][$i]['role_options2'] = '';
|
697 |
-
add_settings_error(
|
698 |
-
'wooccm_settings_errors',
|
699 |
-
esc_attr( 'settings_updated' ),
|
700 |
-
__( 'Sorry! An error occurred. WooCheckout requires you to not have values in both role options.', 'woocommerce-checkout-manager' ),
|
701 |
-
'error'
|
702 |
-
);
|
703 |
-
}
|
704 |
-
|
705 |
-
if( !empty($btn['single_p']) && !empty($btn['single_px']) ) {
|
706 |
-
$input['buttons'][$i]['single_px'] = '';
|
707 |
-
add_settings_error(
|
708 |
-
'wooccm_settings_errors',
|
709 |
-
esc_attr( 'settings_updated' ),
|
710 |
-
__( 'Sorry! An error occurred. WooCheckout requires you to not have values in both hidden product options.', 'woocommerce-checkout-manager' ),
|
711 |
-
'error'
|
712 |
-
);
|
713 |
-
}
|
714 |
-
|
715 |
-
if( !empty($btn['single_p_cat']) && !empty($btn['single_px_cat']) ) {
|
716 |
-
$input['buttons'][$i]['single_px_cat'] = '';
|
717 |
-
add_settings_error(
|
718 |
-
'wooccm_settings_errors',
|
719 |
-
esc_attr( 'settings_updated' ),
|
720 |
-
__( 'Sorry! An error occurred. WooCheckout requires you to not have values in both hidden category options.', 'woocommerce-checkout-manager' ),
|
721 |
-
'error'
|
722 |
-
);
|
723 |
-
}
|
724 |
-
|
725 |
-
if( empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
726 |
-
unset( $input['shipping_buttons'][$i] );
|
727 |
-
|
728 |
-
if ( $i != 999 ) {
|
729 |
-
$detect_error++;
|
730 |
-
$fieldnum = $i + 1;
|
731 |
-
add_settings_error(
|
732 |
-
'wooccm_settings_errors',
|
733 |
-
esc_attr( 'settings_updated' ),
|
734 |
-
__( 'Sorry! An error occurred. WooCheckout removed field # '.$fieldnum.' because no Label or Placeholder name was detected.', 'woocommerce-checkout-manager' ),
|
735 |
-
'error'
|
736 |
-
);
|
737 |
-
}
|
738 |
-
}
|
739 |
-
|
740 |
-
if ( empty( $btn['cow'] ) && (!empty( $btn['label'] ) || !empty( $btn['placeholder'] )) ) {
|
741 |
-
$newNum = $i + 1;
|
742 |
-
if( wooccm_mul_array( 'myfield'.$newNum.'' , $input['shipping_buttons'] ) ) {
|
743 |
-
$input['shipping_buttons'][$i]['cow'] = 'myfield'.$newNum.'c';
|
744 |
-
} else {
|
745 |
-
$input['shipping_buttons'][$i]['cow'] = 'myfield'.$newNum.'';
|
746 |
-
}
|
747 |
-
|
748 |
-
}
|
749 |
-
|
750 |
-
if( !empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
751 |
-
unset( $input['shipping_buttons'][$i] );
|
752 |
-
|
753 |
-
if ( $i != 999 ) {
|
754 |
-
$detect_error++;
|
755 |
-
$fieldnum = $i + 1;
|
756 |
-
add_settings_error(
|
757 |
-
'wooccm_settings_errors',
|
758 |
-
esc_attr( 'settings_updated' ),
|
759 |
-
__( 'Sorry! An error occurred. WooCheckout removed field # '.$fieldnum.' because no Label or Placeholder name was detected.', 'woocommerce-checkout-manager' ),
|
760 |
-
'error'
|
761 |
-
);
|
762 |
-
}
|
763 |
-
}
|
764 |
-
|
765 |
-
|
766 |
-
endforeach;
|
767 |
-
}
|
768 |
-
|
769 |
-
|
770 |
-
if( $detect_error == 0 ) {
|
771 |
-
add_settings_error(
|
772 |
-
'wooccm_settings_errors',
|
773 |
-
esc_attr( 'settings_updated' ),
|
774 |
-
__( 'Your settings has been saved.', 'woocommerce-checkout-manager' ),
|
775 |
-
'updated'
|
776 |
-
);
|
777 |
-
}
|
778 |
|
779 |
-
return $input;
|
780 |
}
|
781 |
|
|
|
782 |
|
783 |
-
function
|
784 |
-
|
785 |
-
|
786 |
-
$detect_error = 0;
|
787 |
-
|
788 |
-
// translate billing fields
|
789 |
-
if ( !empty($input['billing_buttons']) ) {
|
790 |
-
foreach( $input['billing_buttons'] as $i => $btn ) :
|
791 |
-
|
792 |
-
if( function_exists( 'icl_register_string' ) ) {
|
793 |
-
if ( !empty($btn['label']) ) {
|
794 |
-
icl_register_string('WooCommerce Checkout Manager', ''.$btn['label'].'', ''.$btn['label'].'');
|
795 |
-
}
|
796 |
-
if ( !empty($btn['placeholder']) ) {
|
797 |
-
icl_register_string('WooCommerce Checkout Manager', ''.$btn['placeholder'].'', ''.$btn['placeholder'].'');
|
798 |
-
}
|
799 |
-
|
800 |
-
if ( !empty($btn['option_array']) ) {
|
801 |
-
$mysecureop = explode( '||', $btn['option_array']);
|
802 |
-
foreach ( $mysecureop as $one ) {
|
803 |
-
icl_register_string('WooCommerce Checkout Manager', ''.$one.'', ''.$one.'');
|
804 |
-
}
|
805 |
-
}
|
806 |
-
}
|
807 |
-
|
808 |
-
|
809 |
-
if( !empty($btn['role_options']) && !empty($btn['role_options2']) ) {
|
810 |
-
$input['buttons'][$i]['role_options2'] = '';
|
811 |
-
add_settings_error(
|
812 |
-
'wooccm_settings_errors',
|
813 |
-
esc_attr( 'settings_updated' ),
|
814 |
-
__( 'Sorry! An error occurred. WooCheckout requires you to not have values in both role options.', 'woocommerce-checkout-manager' ),
|
815 |
-
'error'
|
816 |
-
);
|
817 |
-
}
|
818 |
-
|
819 |
-
if( !empty($btn['single_p']) && !empty($btn['single_px']) ) {
|
820 |
-
$input['buttons'][$i]['single_px'] = '';
|
821 |
-
add_settings_error(
|
822 |
-
'wooccm_settings_errors',
|
823 |
-
esc_attr( 'settings_updated' ),
|
824 |
-
__( 'Sorry! An error occurred. WooCheckout requires you to not have values in both hidden product options.', 'woocommerce-checkout-manager' ),
|
825 |
-
'error'
|
826 |
-
);
|
827 |
-
}
|
828 |
-
|
829 |
-
if( !empty($btn['single_p_cat']) && !empty($btn['single_px_cat']) ) {
|
830 |
-
$input['buttons'][$i]['single_px_cat'] = '';
|
831 |
-
add_settings_error(
|
832 |
-
'wooccm_settings_errors',
|
833 |
-
esc_attr( 'settings_updated' ),
|
834 |
-
__( 'Sorry! An error occurred. WooCheckout requires you to not have values in both hidden category options.', 'woocommerce-checkout-manager' ),
|
835 |
-
'error'
|
836 |
-
);
|
837 |
-
}
|
838 |
-
|
839 |
-
if( empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
840 |
-
unset( $input['billing_buttons'][$i] );
|
841 |
-
|
842 |
-
if ( $i != 999 ) {
|
843 |
-
$detect_error++;
|
844 |
-
$fieldnum = $i + 1;
|
845 |
-
add_settings_error(
|
846 |
-
'wooccm_settings_errors',
|
847 |
-
esc_attr( 'settings_updated' ),
|
848 |
-
__( 'Sorry! An error occurred. WooCheckout removed field # '.$fieldnum.' because no Label or Placeholder name was detected.', 'woocommerce-checkout-manager' ),
|
849 |
-
'error'
|
850 |
-
);
|
851 |
-
}
|
852 |
-
}
|
853 |
-
|
854 |
-
if ( empty( $btn['cow'] ) && (!empty( $btn['label'] ) || !empty( $btn['placeholder'] )) ) {
|
855 |
-
$newNum = $i + 1;
|
856 |
-
if( wooccm_mul_array( 'myfield'.$newNum.'' , $input['billing_buttons'] ) ) {
|
857 |
-
$input['billing_buttons'][$i]['cow'] = 'myfield'.$newNum.'c';
|
858 |
-
} else {
|
859 |
-
$input['billing_buttons'][$i]['cow'] = 'myfield'.$newNum.'';
|
860 |
-
}
|
861 |
-
}
|
862 |
-
|
863 |
-
|
864 |
-
if( !empty( $btn['cow'] ) && empty( $btn['label'] ) && empty( $btn['placeholder'] ) ) {
|
865 |
-
$detect_error++;
|
866 |
-
unset( $input['billing_buttons'][$i] );
|
867 |
-
|
868 |
-
if ( $i != 999 ) {
|
869 |
-
$detect_error++;
|
870 |
-
$fieldnum = $i + 1;
|
871 |
-
add_settings_error(
|
872 |
-
'wooccm_settings_errors',
|
873 |
-
esc_attr( 'settings_updated' ),
|
874 |
-
__( 'Sorry! An error occurred. WooCheckout removed field # '.$fieldnum.' because no Label or Placeholder name was detected.', 'woocommerce-checkout-manager' ),
|
875 |
-
'error'
|
876 |
-
);
|
877 |
-
}
|
878 |
-
}
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
endforeach;
|
884 |
-
}
|
885 |
-
|
886 |
-
if( $detect_error == 0 ) {
|
887 |
-
add_settings_error(
|
888 |
-
'wooccm_settings_errors',
|
889 |
-
esc_attr( 'settings_updated' ),
|
890 |
-
__( 'Your settings has been saved.', 'woocommerce-checkout-manager' ),
|
891 |
-
'updated'
|
892 |
-
);
|
893 |
-
}
|
894 |
|
895 |
-
|
896 |
-
|
|
|
|
|
|
|
|
|
897 |
|
|
|
|
|
|
|
|
|
|
|
|
|
898 |
|
|
|
899 |
|
|
|
900 |
|
901 |
-
|
902 |
|
|
|
903 |
|
904 |
-
|
905 |
-
|
|
|
906 |
|
907 |
-
|
908 |
-
|
|
|
909 |
|
910 |
-
if
|
911 |
-
foreach( $names as $name ) {
|
912 |
|
913 |
-
|
|
|
914 |
|
915 |
-
|
916 |
-
|
917 |
-
foreach ( $options[''.$name.'_buttons'] as $btn ) :
|
918 |
-
|
919 |
-
|
920 |
-
if ( !in_array( $btn['cow'], $array ) ) {
|
921 |
-
if ( (''.get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multiselect') && ($btn['type'] !== 'multicheckbox') ) {
|
922 |
-
echo '<tr><th>'.wpml_string_wccm_pro($btn['label']).':</th> <td>'.nl2br(get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true)).'</td></tr>';
|
923 |
-
|
924 |
-
} elseif ( !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && ($btn['type'] !== 'multicheckbox') ) {
|
925 |
-
echo '<tr><th colspan="2">' .wpml_string_wccm_pro($btn['label']). '</th><td></td></tr>';
|
926 |
-
|
927 |
-
} elseif ( (''.get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true).'' !== '') && $btn['type'] !== 'wooccmupload' && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
928 |
-
$strings = unserialize(get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true));
|
929 |
-
echo '<tr><th>'.wpml_string_wccm_pro($btn['label']).':</th>';
|
930 |
-
|
931 |
-
foreach($strings as $key ) {
|
932 |
-
echo '<td data-title="' .wpml_string_wccm_pro($btn['label']). '">'.wpml_string_wccm_pro($key).'</td>';
|
933 |
-
}
|
934 |
-
echo '</tr>';
|
935 |
-
}elseif( $btn['type'] == 'wooccmupload' ){
|
936 |
-
$info = explode("||", get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true));
|
937 |
-
echo '<tr><th>'.wpml_string_wccm_pro($btn['force_title2']).':</th> <td>'.$info[0].'</td></tr>';
|
938 |
-
}
|
939 |
-
}
|
940 |
-
endforeach;
|
941 |
-
$inc--;
|
942 |
-
}
|
943 |
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
if ( (''.get_post_meta( $order->id , ''.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multiselect') && ($btn['type'] !== 'multicheckbox') ) {
|
949 |
-
echo '<tr><th>'.wpml_string_wccm_pro($btn['label']).':</th><td data-title="' .wpml_string_wccm_pro($btn['label']). '">'.nl2br(get_post_meta( $order->id , ''.$btn['cow'].'', true)).'</td></tr>';
|
950 |
-
|
951 |
-
} elseif ( !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] == 'heading') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multiselect') && ($btn['type'] !== 'multicheckbox') ) {
|
952 |
-
echo '<tr><th colspan="2">' .wpml_string_wccm_pro($btn['label']). '</th><td></td></tr>';
|
953 |
-
|
954 |
-
} elseif ( (''.get_post_meta( $order->id , ''.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
955 |
-
$strings = unserialize(get_post_meta( $order->id , ''.$btn['cow'].'', true));
|
956 |
-
echo '<tr><th>'.wpml_string_wccm_pro($btn['label']).':</th>';
|
957 |
-
|
958 |
-
foreach($strings as $key ) {
|
959 |
-
echo '<td data-title="' .wpml_string_wccm_pro($btn['label']). '">'.wpml_string_wccm_pro($key).'</td>';
|
960 |
-
}
|
961 |
-
echo '</tr>';
|
962 |
-
}elseif( $btn['type'] == 'wooccmupload' ){
|
963 |
-
$info = explode("||", get_post_meta( $order->id , ''.$btn['cow'].'', true));
|
964 |
-
echo '<tr><th>'.wpml_string_wccm_pro($btn['force_title2']).':</th><td data-title="' .wpml_string_wccm_pro($btn['force_title2']). '">'.$info[0].'</td></tr>';
|
965 |
-
}
|
966 |
-
endforeach;
|
967 |
-
} else {
|
968 |
-
foreach( $names as $name ) {
|
969 |
|
970 |
-
|
|
|
|
|
971 |
|
972 |
-
|
973 |
-
|
974 |
-
foreach ( $options[''.$name.'_buttons'] as $btn ) :
|
975 |
-
|
976 |
-
|
977 |
-
if ( !in_array( $btn['cow'], $array ) ) {
|
978 |
-
if ( (''.get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
979 |
-
echo '<dt>'.wpml_string_wccm_pro($btn['label']).':</dt> <dd>'.nl2br(get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true)).'</dd>';
|
980 |
-
|
981 |
-
} elseif ( !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && ($btn['type'] !== 'multicheckbox') ) {
|
982 |
-
echo '<h2>' .wpml_string_wccm_pro($btn['label']). '</h2>';
|
983 |
-
|
984 |
-
} elseif ( (''.get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
985 |
-
$strings = unserialize(get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true));
|
986 |
-
echo '<dt>'.wpml_string_wccm_pro($btn['label']).':</dt><dd>';
|
987 |
-
|
988 |
-
foreach($strings as $key ) {
|
989 |
-
echo ''.wpml_string_wccm_pro($key).', ';
|
990 |
-
}
|
991 |
-
echo '</dd>';
|
992 |
-
}elseif( $btn['type'] == 'wooccmupload' ){
|
993 |
-
$info = explode("||", get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true));
|
994 |
-
echo '<dt>'.wpml_string_wccm_pro($btn['force_title2']).':</dt> <dd>'.$info[0].'</dd>';
|
995 |
-
}
|
996 |
-
}
|
997 |
-
endforeach;
|
998 |
-
$inc--;
|
999 |
-
}
|
1000 |
|
1001 |
-
|
1002 |
-
|
1003 |
-
foreach ( $options['buttons'] as $btn ) :
|
1004 |
-
|
1005 |
-
if ( (''.get_post_meta( $order->id , ''.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && ($btn['type'] !== 'wooccmupload' && $btn['type'] !== 'multiselect') && ($btn['type'] !== 'multicheckbox') ) {
|
1006 |
-
echo '<dt>'.wpml_string_wccm_pro($btn['label']).':</dt> <dd>'.nl2br(get_post_meta( $order->id , ''.$btn['cow'].'', true)).'</dd>';
|
1007 |
-
|
1008 |
-
} elseif ( !empty( $btn['label'] ) && $btn['type'] !== 'wooccmupload' && empty( $btn['deny_receipt'] ) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && ($btn['type'] !== 'multicheckbox') ) {
|
1009 |
-
echo '<h2>' .wpml_string_wccm_pro($btn['label']). '</h2>';
|
1010 |
-
|
1011 |
-
} elseif ( (''.get_post_meta( $order->id , ''.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && empty( $btn['deny_receipt'] ) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
1012 |
-
$strings = unserialize(get_post_meta( $order->id , ''.$btn['cow'].'', true));
|
1013 |
-
echo '<dt>'.wpml_string_wccm_pro($btn['label']).':</dt><dd>';
|
1014 |
-
|
1015 |
-
foreach($strings as $key ) {
|
1016 |
-
echo ''.wpml_string_wccm_pro($key).', ';
|
1017 |
-
}
|
1018 |
-
echo '</dd>';
|
1019 |
-
}elseif( $btn['type'] == 'wooccmupload' ){
|
1020 |
-
$info = explode("||", get_post_meta( $order->id , ''.$btn['cow'].'', true));
|
1021 |
-
echo '<dt>'.wpml_string_wccm_pro($btn['force_title2']).':</dt> <dd>'.$info[0].'</dd>';
|
1022 |
-
}
|
1023 |
-
endforeach;
|
1024 |
-
}
|
1025 |
|
1026 |
-
}
|
1027 |
|
|
|
1028 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1029 |
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
if ( !empty($options['checkness']['text2']) ) {
|
1034 |
-
if ( $options['checkness']['checkbox3'] == true || $options['checkness']['checkbox4'] == true ) {
|
1035 |
-
if ( $options['checkness']['checkbox4'] == true ) {
|
1036 |
-
echo ''.$options['checkness']['text2'].'';
|
1037 |
-
}}}
|
1038 |
-
|
1039 |
-
if ( !empty($options['checkness']['text1']) ) {
|
1040 |
-
if ( $options['checkness']['checkbox1'] == true || $options['checkness']['checkbox2'] == true ) {
|
1041 |
-
if ( $options['checkness']['checkbox2'] == true ) {
|
1042 |
-
echo ''.$options['checkness']['text1'].'';
|
1043 |
-
}}}
|
1044 |
-
}
|
1045 |
-
|
1046 |
|
1047 |
-
|
1048 |
-
function wccm_checkout_text_before(){
|
1049 |
-
$options = get_option( 'wccs_settings' );
|
1050 |
-
|
1051 |
-
if ( !empty($options['checkness']['text2']) ) {
|
1052 |
-
if ( $options['checkness']['checkbox3'] == true || $options['checkness']['checkbox4'] == true ) {
|
1053 |
-
if ( $options['checkness']['checkbox3'] == true ) {
|
1054 |
-
echo ''.$options['checkness']['text2'].'';
|
1055 |
-
}}}
|
1056 |
-
|
1057 |
-
if ( !empty($options['checkness']['text1']) ) {
|
1058 |
-
if ( $options['checkness']['checkbox1'] == true || $options['checkness']['checkbox2'] == true ) {
|
1059 |
-
if ( $options['checkness']['checkbox1'] == true ) {
|
1060 |
-
echo ''.$options['checkness']['text1'].'';
|
1061 |
-
}}}
|
1062 |
}
|
1063 |
|
|
|
1064 |
|
|
|
1065 |
|
|
|
|
|
|
|
1066 |
|
1067 |
-
|
1068 |
-
|
1069 |
|
1070 |
-
|
1071 |
-
|
1072 |
-
// $string = preg_replace('/\s+/', '', strip_tags($string)); // removes html and spaces
|
1073 |
-
// $string = preg_replace('/\d/', '', $string); // Replaces multiple hyphens with single one.
|
1074 |
|
1075 |
-
|
1076 |
-
}
|
1077 |
|
|
|
|
|
1078 |
|
1079 |
-
|
1080 |
-
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
-
|
1093 |
-
|
1094 |
-
|
1095 |
-
} elseif ( !empty( $btn['label'] ) && $btn['type'] !== 'wooccmupload' && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && ($btn['type'] !== 'multicheckbox') ) {
|
1096 |
-
echo '<h4>' .wpml_string_wccm_pro($btn['label']). '</h4>';
|
1097 |
-
|
1098 |
-
} elseif ( (''.get_post_meta( $order->id , '_billing_'.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
1099 |
-
|
1100 |
-
$strings = unserialize(get_post_meta( $order->id , '_billing_'.$btn['cow'].'', true));
|
1101 |
-
$iww = 0;
|
1102 |
-
$len = count($strings);
|
1103 |
-
|
1104 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['label']).':</strong> ';
|
1105 |
-
foreach($strings as $key ) {
|
1106 |
-
if ($iww == $len - 1) {
|
1107 |
-
echo ''.wpml_string_wccm_pro($key).'';
|
1108 |
-
} else {
|
1109 |
-
echo ''.wpml_string_wccm_pro($key).', ';
|
1110 |
-
}
|
1111 |
-
$iww++;
|
1112 |
-
}
|
1113 |
-
echo '</p>';
|
1114 |
-
}elseif( $btn['type'] == 'wooccmupload' ){
|
1115 |
-
$info = explode("||", get_post_meta( $order->id , 'billing_'.$btn['cow'].'', true));
|
1116 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['force_title2']).':</strong> '.$info[0].'</p>';
|
1117 |
-
}
|
1118 |
}
|
1119 |
-
|
1120 |
-
}
|
1121 |
|
|
|
1122 |
|
|
|
1123 |
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
-
|
1128 |
-
|
1129 |
-
|
1130 |
-
$
|
1131 |
-
|
1132 |
-
|
1133 |
-
|
1134 |
-
|
1135 |
-
|
1136 |
-
|
1137 |
-
|
1138 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['label']).':</strong> '.nl2br(get_post_meta( $order->id , '_shipping_'.$btn['cow'].'', true)).'</p>';
|
1139 |
-
|
1140 |
-
} elseif ( !empty( $btn['label'] ) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && ($btn['type'] !== 'multicheckbox') ) {
|
1141 |
-
echo '<h4>' .wpml_string_wccm_pro($btn['label']). '</h4>';
|
1142 |
-
|
1143 |
-
} elseif ( (''.get_post_meta( $order->id , '_shipping_'.$btn['cow'].'', true).'' !== '') && !empty( $btn['label'] ) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
1144 |
-
|
1145 |
-
$strings = unserialize(get_post_meta( $order->id , '_shipping_'.$btn['cow'].'', true));
|
1146 |
-
$iww = 0;
|
1147 |
-
$len = count($strings);
|
1148 |
-
|
1149 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['label']).':</strong> ';
|
1150 |
-
foreach($strings as $key ) {
|
1151 |
-
if ($iww == $len - 1) {
|
1152 |
-
echo ''.wpml_string_wccm_pro($key).'';
|
1153 |
-
} else {
|
1154 |
-
echo ''.wpml_string_wccm_pro($key).', ';
|
1155 |
-
}
|
1156 |
-
$iww++;
|
1157 |
-
}
|
1158 |
-
echo '</p>';
|
1159 |
-
}elseif( $btn['type'] == 'wooccmupload' ){
|
1160 |
-
$info = explode("||", get_post_meta( $order->id , '_shipping_'.$btn['cow'].'', true));
|
1161 |
-
echo '<p><strong>'.wpml_string_wccm_pro($btn['force_title2']).':</strong> '.$info[0].'</p>';
|
1162 |
}
|
1163 |
-
|
1164 |
-
endforeach;
|
1165 |
-
}
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
function remove_fields_filter($fields){
|
1170 |
-
global $woocommerce;
|
1171 |
-
$options = get_option( 'wccs_settings' );
|
1172 |
-
|
1173 |
-
foreach ($woocommerce->cart->cart_contents as $key => $values ) {
|
1174 |
-
|
1175 |
-
$multiCategoriesx = $options['checkness']['productssave'];
|
1176 |
-
$multiCategoriesArrayx = explode(',',$multiCategoriesx);
|
1177 |
-
|
1178 |
-
if(in_array($values['product_id'],$multiCategoriesArrayx) && ($woocommerce->cart->cart_contents_count < 2) ){
|
1179 |
-
unset($fields['billing']['billing_address_1']);
|
1180 |
-
unset($fields['billing']['billing_address_2']);
|
1181 |
-
unset($fields['billing']['billing_phone']);
|
1182 |
-
unset($fields['billing']['billing_country']);
|
1183 |
-
unset($fields['billing']['billing_city']);
|
1184 |
-
unset($fields['billing']['billing_postcode']);
|
1185 |
-
unset($fields['billing']['billing_state']);
|
1186 |
-
break;
|
1187 |
-
}
|
1188 |
-
}
|
1189 |
-
|
1190 |
-
return $fields;
|
1191 |
-
}
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
function remove_fields_filter3($fields){
|
1196 |
-
global $woocommerce;
|
1197 |
-
$options = get_option( 'wccs_settings' );
|
1198 |
-
|
1199 |
-
foreach ($woocommerce->cart->cart_contents as $key => $values ) {
|
1200 |
-
|
1201 |
-
$multiCategoriesx = $options['checkness']['productssave'];
|
1202 |
-
$multiCategoriesArrayx = explode(',',$multiCategoriesx);
|
1203 |
-
$_product = $values['data'];
|
1204 |
-
|
1205 |
-
if( ($woocommerce->cart->cart_contents_count > 1) && ($_product->needs_shipping()) ){
|
1206 |
-
remove_filter('woocommerce_checkout_fields','remove_fields_filter',15);
|
1207 |
-
break;
|
1208 |
-
}
|
1209 |
-
}
|
1210 |
-
return $fields;
|
1211 |
-
}
|
1212 |
-
|
1213 |
-
function woocmmatl() {
|
1214 |
-
global $wp_version;
|
1215 |
-
wooccmadd();
|
1216 |
-
if ( wooccmcurr() ){
|
1217 |
-
return true;
|
1218 |
-
}
|
1219 |
-
return false;
|
1220 |
-
}
|
1221 |
-
|
1222 |
-
if ( validator_changename() ) {
|
1223 |
-
function wccm_before_checkout() {
|
1224 |
-
$options = get_option( 'wccs_settings' );
|
1225 |
-
|
1226 |
-
foreach ( $options['buttons'] as $btn ) :
|
1227 |
-
$label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
|
1228 |
-
ob_start();
|
1229 |
-
endforeach;
|
1230 |
-
}
|
1231 |
-
|
1232 |
-
|
1233 |
-
function wccm_after_checkout() {
|
1234 |
-
$options = get_option( 'wccs_settings' );
|
1235 |
-
|
1236 |
-
foreach ( $options['buttons'] as $btn ) :
|
1237 |
-
|
1238 |
-
if ( $btn['type'] == 'changename' ) {
|
1239 |
-
$content = ob_get_clean();
|
1240 |
-
echo str_replace( ''.$btn['changenamep'].'', ''.$btn['changename'].'', $content);
|
1241 |
-
}
|
1242 |
-
endforeach;
|
1243 |
-
}
|
1244 |
-
}
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
function display_front_wccs_pro() {
|
1249 |
-
global $woocommerce;
|
1250 |
-
$options = get_option( 'wccs_settings' );
|
1251 |
-
|
1252 |
-
if ( is_checkout() ) {
|
1253 |
-
if (!empty($options['checkness']['additional_info'])) {
|
1254 |
-
echo '<style type="text/css">.woocommerce-shipping-fields h3:first-child { display: none; }</style>';
|
1255 |
-
}
|
1256 |
-
|
1257 |
-
echo '<style type="text/css">'.$options['checkness']['custom_css_w'].'
|
1258 |
-
|
1259 |
-
@media screen and (max-width: 685px) {
|
1260 |
-
|
1261 |
-
.woocommerce .checkout .container .wooccm-btn {
|
1262 |
-
padding: 1% 6% !important;
|
1263 |
-
}
|
1264 |
-
}
|
1265 |
-
|
1266 |
-
@media screen and (max-width: 685px) {
|
1267 |
-
|
1268 |
-
.woocommerce .checkout .container .wooccm-btn {
|
1269 |
-
padding: 1% 8% !important;
|
1270 |
-
}
|
1271 |
-
}
|
1272 |
-
|
1273 |
-
@media screen and (max-width: 770px) {
|
1274 |
|
1275 |
-
.checkout .wooccm_each_file .wooccm-image-holder {
|
1276 |
-
width: 20% !important;
|
1277 |
-
}
|
1278 |
-
.checkout name.wooccm_name, .wooccm_each_file span.container{
|
1279 |
-
width: 80% !important;
|
1280 |
}
|
1281 |
-
.checkout .container .wooccm-btn {
|
1282 |
-
padding: 1% 10% !important;
|
1283 |
-
}
|
1284 |
-
}
|
1285 |
-
|
1286 |
-
@media screen and (max-width: 992px) {
|
1287 |
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1297 |
}
|
1298 |
-
}
|
1299 |
-
|
1300 |
-
.container .wooccm-btn {
|
1301 |
-
padding: 1.7% 6.7%;
|
1302 |
-
}
|
1303 |
-
|
1304 |
-
#caman_content .blockUI.blockOverlay:before, #caman_content .loader:before {
|
1305 |
-
height: 1em;
|
1306 |
-
width: 1em;
|
1307 |
-
position: absolute;
|
1308 |
-
top: 50%;
|
1309 |
-
left: 50%;
|
1310 |
-
margin-left: -.5em;
|
1311 |
-
margin-top: -.5em;
|
1312 |
-
display: block;
|
1313 |
-
-webkit-animation: spin 1s ease-in-out infinite;
|
1314 |
-
-moz-animation: spin 1s ease-in-out infinite;
|
1315 |
-
animation: spin 1s ease-in-out infinite;
|
1316 |
-
content: "";
|
1317 |
-
background: url('.plugins_url('woocommerce/assets/images/icons/loader.svg').') center center/cover;
|
1318 |
-
line-height: 1;
|
1319 |
-
text-align: center;
|
1320 |
-
font-size: 2em;
|
1321 |
-
color: rgba(0,0,0,.75);
|
1322 |
-
}
|
1323 |
|
1324 |
-
.file_upload_button_hide { display: none !important; }
|
1325 |
-
|
1326 |
-
.wooccm_each_file {
|
1327 |
-
display: block;
|
1328 |
-
padding-top: 20px;
|
1329 |
-
clear: both;
|
1330 |
-
text-align: center;
|
1331 |
-
}
|
1332 |
-
.wooccm_each_file .wooccm-image-holder {
|
1333 |
-
width: 20%;
|
1334 |
-
display: block;
|
1335 |
-
float: left;
|
1336 |
-
}
|
1337 |
-
.wooccm-btn.disable {
|
1338 |
-
margin-right: 10px;
|
1339 |
-
cursor: auto;
|
1340 |
-
}
|
1341 |
-
zoom.wooccm_zoom, edit.wooccm_edit, dele.wooccm_dele {
|
1342 |
-
padding: 5px;
|
1343 |
-
}
|
1344 |
-
.wooccm_each_file name {
|
1345 |
-
font-size: 18px;
|
1346 |
-
}
|
1347 |
-
name.wooccm_name, .wooccm_each_file span.container {
|
1348 |
-
display: block;
|
1349 |
-
padding: 0 0 10px 20px;
|
1350 |
-
float: left;
|
1351 |
-
width: 80%;
|
1352 |
}
|
|
|
1353 |
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
border: 2px solid #767676 !important;
|
1358 |
-
border-radius: 4px;
|
1359 |
-
}
|
1360 |
-
.file_upload_account:before{ content: "\f317";font-family: dashicons; margin-right: 10px; }
|
1361 |
-
.wooccm_each_file .wooccm_zoom:before{ content: "\f179";font-family: dashicons; margin-right: 5px; }
|
1362 |
-
.wooccm_each_file .wooccm_edit:before{ content: "\f464";font-family: dashicons; margin-right: 5px; }
|
1363 |
-
.wooccm_each_file .wooccm_dele:before{ content: "\f158";font-family: dashicons; margin-right: 5px; }
|
1364 |
-
.wooccm-btn{
|
1365 |
-
display: inline-block;
|
1366 |
-
padding: 6px 12px;
|
1367 |
-
margin-bottom: 0;
|
1368 |
-
font-size: 14px;
|
1369 |
-
font-weight: 400;
|
1370 |
-
line-height: 1.42857143;
|
1371 |
-
text-align: center;
|
1372 |
-
white-space: nowrap;
|
1373 |
-
vertical-align: middle;
|
1374 |
-
cursor: pointer;
|
1375 |
-
-webkit-user-select: none;
|
1376 |
-
-moz-user-select: none;
|
1377 |
-
-ms-user-select: none;
|
1378 |
-
user-select: none;
|
1379 |
-
background-image: none;
|
1380 |
-
border: 1px solid transparent;
|
1381 |
-
border-radius: 4px;
|
1382 |
-
font-family: "Raleway", Arial, Helvetica, sans-serif;
|
1383 |
-
color: #767676;
|
1384 |
-
background-color: buttonface;
|
1385 |
-
align-items: flex-start;
|
1386 |
-
text-indent: 0px;
|
1387 |
-
text-shadow: none;
|
1388 |
-
letter-spacing: normal;
|
1389 |
-
word-spacing: normal;
|
1390 |
-
text-rendering: auto;
|
1391 |
-
}
|
1392 |
-
.wooccm-btn-primary {
|
1393 |
-
width: 100%;
|
1394 |
-
color: #fff;
|
1395 |
-
background-color: #428bca;
|
1396 |
-
border-color: #357ebd;
|
1397 |
-
}
|
1398 |
|
1399 |
-
|
1400 |
-
color: #fff;
|
1401 |
-
background-color: #d9534f;
|
1402 |
-
border-color: #d43f3a;
|
1403 |
-
margin-right: 10px;
|
1404 |
-
}
|
1405 |
-
.wooccm_each_file .container a:hover, .wooccm_each_file .container a:focus, .wooccm_each_file .container a:active, .wooccm_each_file .container a:visited, .wooccm_each_file .container a:link {
|
1406 |
-
color: #fff !important;
|
1407 |
-
}
|
1408 |
-
#caman_content #wooccmtoolbar #close:hover, #caman_content #wooccmtoolbar #save:hover {
|
1409 |
-
background: #1B1917 !Important;
|
1410 |
-
}
|
1411 |
-
.wooccm-btn-zoom {
|
1412 |
-
color: #fff;
|
1413 |
-
background-color: #5cb85c;
|
1414 |
-
border-color: #4cae4c;
|
1415 |
-
margin-right: 10px;
|
1416 |
-
}
|
1417 |
-
|
1418 |
-
.wooccm-btn-edit {
|
1419 |
-
color: #fff;
|
1420 |
-
background-color: #f0ad4e;
|
1421 |
-
border-color: #eea236;
|
1422 |
-
margin-right: 10px;
|
1423 |
-
}
|
1424 |
|
1425 |
-
|
1426 |
-
|
1427 |
-
}
|
1428 |
-
}
|
1429 |
|
|
|
|
|
1430 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1431 |
|
|
|
1432 |
|
1433 |
-
|
1434 |
-
// -----------------------------------------------------------
|
1435 |
-
// -----------------------------------------------------------
|
1436 |
-
// -----------------------------------------------------------
|
1437 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1438 |
|
1439 |
-
function validator_changename() {
|
1440 |
-
$options = get_option( 'wccs_settings' );
|
1441 |
-
if ( !empty($options['buttons']) ) {
|
1442 |
-
foreach ( $options['buttons'] as $btn ) :
|
1443 |
-
if (!empty($btn['type']) ) {
|
1444 |
-
if ( $btn['type'] == 'changename' && !empty($btn['label']) ){
|
1445 |
-
return true;
|
1446 |
-
}
|
1447 |
-
}
|
1448 |
-
endforeach;
|
1449 |
}
|
1450 |
-
}
|
1451 |
-
|
1452 |
-
|
1453 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1454 |
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
?>
|
1460 |
-
<header>
|
1461 |
-
<h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2>
|
1462 |
-
</header>
|
1463 |
-
|
1464 |
-
<dl class="customer_details">
|
1465 |
-
<?php
|
1466 |
-
if ($order->billing_email) echo '<dt>'.__( 'Email:', 'woocommerce' ).'</dt><dd>'.$order->billing_email.'</dd>';
|
1467 |
-
if ($order->billing_phone) echo '<dt>'.__( 'Telephone:', 'woocommerce' ).'</dt><dd>'.$order->billing_phone.'</dd>';
|
1468 |
-
?>
|
1469 |
-
</dl>
|
1470 |
-
|
1471 |
-
<?php if (get_option('woocommerce_ship_to_billing_address_only')=='no') : ?>
|
1472 |
-
|
1473 |
-
<div class="col2-set addresses">
|
1474 |
-
|
1475 |
-
<div class="col-1">
|
1476 |
-
|
1477 |
-
<?php endif; ?>
|
1478 |
-
|
1479 |
-
|
1480 |
-
<header class="title">
|
1481 |
-
<h3><?php _e( 'Billing Address', 'woocommerce' ); ?></h3>
|
1482 |
-
</header>
|
1483 |
-
|
1484 |
-
<address>
|
1485 |
-
<p><?php if (!$order->get_formatted_billing_address()) _e( 'N/A', 'woocommerce' ); else echo $order->get_formatted_billing_address(); ?></p>
|
1486 |
-
</address>
|
1487 |
-
|
1488 |
-
<?php if (get_option('woocommerce_ship_to_billing_address_only')=='no') : ?>
|
1489 |
-
|
1490 |
-
</div><!-- /.col-1 -->
|
1491 |
-
|
1492 |
-
<div class="col-2">
|
1493 |
-
|
1494 |
-
<header class="title">
|
1495 |
-
<h3><?php _e( 'Shipping Address', 'woocommerce' ); ?></h3>
|
1496 |
-
</header>
|
1497 |
-
|
1498 |
-
<address>
|
1499 |
-
<p><?php if (!$order->get_formatted_shipping_address()) _e( 'N/A', 'woocommerce' ); else echo $order->get_formatted_shipping_address(); ?></p>
|
1500 |
-
</address>
|
1501 |
-
|
1502 |
-
</div><!-- /.col-2 -->
|
1503 |
-
|
1504 |
-
</div><!-- /.col2-set -->
|
1505 |
-
|
1506 |
-
<?php endif; ?>
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
<div class="clear"></div>
|
1511 |
-
|
1512 |
-
<script type="text/javascript">
|
1513 |
-
var array = [];
|
1514 |
-
<?php
|
1515 |
-
foreach ( $options['buttons'] as $btn ) : ?>
|
1516 |
-
|
1517 |
-
array.push("<?php echo $btn['changenamep']; ?>" , "<?php echo $btn['changename']; ?>")
|
1518 |
-
|
1519 |
-
<?php
|
1520 |
-
endforeach;
|
1521 |
-
?>
|
1522 |
-
|
1523 |
-
b(array);
|
1524 |
-
|
1525 |
-
function b(array){
|
1526 |
-
for(var i = 0; i<(array.length-1); i=i+2) {
|
1527 |
-
document.body.innerHTML= document.body.innerHTML.replace(array[i],array[i+1])
|
1528 |
-
}
|
1529 |
-
}
|
1530 |
-
</script>
|
1531 |
|
1532 |
-
|
1533 |
-
|
1534 |
|
|
|
|
|
1535 |
|
|
|
1536 |
|
|
|
1537 |
|
|
|
1538 |
|
|
|
1539 |
|
|
|
1540 |
|
1541 |
-
if ( enable_auto_complete_wccs()) {
|
1542 |
-
function retain_field_values_wccm() {
|
1543 |
-
|
1544 |
$options = get_option( 'wccs_settings' );
|
1545 |
$options2 = get_option( 'wccs_settings2' );
|
1546 |
$options3 = get_option( 'wccs_settings3' );
|
1547 |
-
|
1548 |
-
|
1549 |
-
if ( is_checkout() ) :
|
1550 |
|
1551 |
-
|
1552 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1553 |
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
<?php }
|
1567 |
-
endforeach;
|
1568 |
}
|
1569 |
-
|
1570 |
-
if( !is_user_logged_in() ){
|
1571 |
-
if ( WC()->cart->needs_shipping_address() === true && $_POST['ship_to_different_address'] == 1 ) :
|
1572 |
-
foreach ( $options2['shipping_buttons'] as $btn ) :
|
1573 |
-
if ( $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && $btn['type'] !== 'heading' && empty($btn['tax_remove']) && empty($btn['add_amount']) ) { ?>
|
1574 |
-
document.forms['checkout'].elements['shipping_<?php echo $btn['cow']; ?>'].value = "<?php echo $saved['shipping_'.$btn['cow'].'']; ?>";
|
1575 |
-
|
1576 |
-
<?php }
|
1577 |
-
endforeach;
|
1578 |
-
endif;
|
1579 |
-
|
1580 |
-
foreach ( $options3['billing_buttons'] as $btn ) :
|
1581 |
-
if ( $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && $btn['type'] !== 'heading' && empty($btn['tax_remove']) && empty($btn['add_amount']) ) { ?>
|
1582 |
-
document.forms['checkout'].elements['billing_<?php echo $btn['cow']; ?>'].value = "<?php echo $saved['billing_'.$btn['cow'].'']; ?>";
|
1583 |
-
|
1584 |
-
<?php }
|
1585 |
-
endforeach;
|
1586 |
-
}
|
1587 |
-
|
1588 |
-
?>
|
1589 |
-
|
1590 |
-
}
|
1591 |
-
});
|
1592 |
-
</script>
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
1597 |
-
|
1598 |
-
<script type="text/javascript">
|
1599 |
-
jQuery(document).ready(function() {
|
1600 |
-
jQuery('body').change(function() {
|
1601 |
-
|
1602 |
-
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
|
1603 |
-
data = { action: 'retain_val_wccs',
|
1604 |
-
|
1605 |
-
<?php
|
1606 |
-
if( !empty($options) ) {
|
1607 |
-
foreach ( $options['buttons'] as $btn ) :
|
1608 |
-
if ( $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && $btn['type'] !== 'heading' && empty($btn['tax_remove']) && empty($btn['add_amount']) ) { ?>
|
1609 |
-
<?php echo $btn['cow']; ?>: jQuery("#<?php echo $btn['cow']; ?>").val(),
|
1610 |
-
|
1611 |
-
<?php }
|
1612 |
-
endforeach;
|
1613 |
-
}
|
1614 |
-
|
1615 |
-
if(!is_user_logged_in()){
|
1616 |
-
if ( WC()->cart->needs_shipping_address() === true && $_POST['ship_to_different_address'] == 1 ) :
|
1617 |
-
foreach ( $options2['shipping_buttons'] as $btn ) :
|
1618 |
-
if ( $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && $btn['type'] !== 'heading' && empty($btn['tax_remove']) && empty($btn['add_amount']) ) { ?>
|
1619 |
-
shipping_<?php echo $btn['cow']; ?>: jQuery("shipping_<?php echo $btn['cow']; ?>").val(),
|
1620 |
-
|
1621 |
-
<?php }
|
1622 |
-
endforeach;
|
1623 |
-
endif;
|
1624 |
-
|
1625 |
-
foreach ( $options3['billing_buttons'] as $btn ) :
|
1626 |
-
if ( $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && $btn['type'] !== 'heading' && empty($btn['tax_remove']) && empty($btn['add_amount']) ) { ?>
|
1627 |
-
billing_<?php echo $btn['cow']; ?>: jQuery("#billing_<?php echo $btn['cow']; ?>").val(),
|
1628 |
-
|
1629 |
-
<?php }
|
1630 |
-
endforeach;
|
1631 |
-
}
|
1632 |
-
?>
|
1633 |
-
};
|
1634 |
-
|
1635 |
-
jQuery.post(ajaxurl, data, function(response) { });
|
1636 |
-
return false;
|
1637 |
-
});
|
1638 |
-
});
|
1639 |
-
</script>
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
<?php
|
1644 |
-
endif;
|
1645 |
-
|
1646 |
-
}
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
add_action( 'wp_ajax_retain_val_wccs', 'retain_val_wccs_callback' );
|
1653 |
-
add_action('wp_ajax_nopriv_retain_val_wccs', 'retain_val_wccs_callback');
|
1654 |
-
|
1655 |
-
function retain_val_wccs_callback() {
|
1656 |
-
global $wpdb; // this is how you get access to the database
|
1657 |
-
|
1658 |
-
$options = get_option( 'wccs_settings' );
|
1659 |
-
$options2 = get_option( 'wccs_settings2' );
|
1660 |
-
$options3 = get_option( 'wccs_settings3' );
|
1661 |
-
|
1662 |
-
if (!empty($options) ) {
|
1663 |
-
foreach ( $options['buttons'] as $btn ) :
|
1664 |
-
if ( $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && $btn['type'] !== 'heading' && empty($btn['tax_remove']) && empty($btn['add_amount']) ) {
|
1665 |
-
if( $_POST[''.$btn['cow'].''] ) {
|
1666 |
-
$saved[''.$btn['cow'].''] = $_POST[''.$btn['cow'].''];
|
1667 |
}
|
1668 |
-
|
1669 |
-
endforeach;
|
1670 |
}
|
1671 |
-
|
1672 |
-
if
|
1673 |
-
foreach
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1677 |
}
|
1678 |
-
}
|
1679 |
-
endforeach;
|
1680 |
-
endif;
|
1681 |
-
|
1682 |
-
foreach ( $options3['billing_buttons'] as $btn ) :
|
1683 |
-
if ( $btn['type'] !== 'wooccmupload' && $btn['type'] !== 'changename' && $btn['type'] !== 'heading' && empty($btn['tax_remove']) && empty($btn['add_amount']) ) {
|
1684 |
-
if( $_POST['billing_'.$btn['cow'].''] ) {
|
1685 |
-
$saved['billing_'.$btn['cow'].''] = $_POST['billing_'.$btn['cow'].''];
|
1686 |
}
|
1687 |
-
|
1688 |
-
|
1689 |
-
|
1690 |
-
WC()->session->set('wooccm_retain', $saved );
|
1691 |
-
|
1692 |
-
die();
|
1693 |
-
|
1694 |
-
} // end function retain_val_wccs_callback()
|
1695 |
|
1696 |
-
|
1697 |
|
|
|
1698 |
|
1699 |
-
|
1700 |
-
|
|
|
1701 |
|
1702 |
-
if ( !empty($options['checkness']['retainval']) ) {
|
1703 |
-
return true;
|
1704 |
-
} else {
|
1705 |
-
return false;
|
1706 |
-
}
|
1707 |
}
|
1708 |
|
|
|
1709 |
|
|
|
1710 |
|
1711 |
-
|
1712 |
-
|
|
|
|
|
|
|
1713 |
|
1714 |
-
if ( !empty($options['checkness']['auto_create_wccm_account']) ) {
|
1715 |
-
?>
|
1716 |
-
<script type="text/javascript">
|
1717 |
-
jQuery(document).ready(function() {
|
1718 |
-
jQuery( "input#createaccount" ).prop("checked","checked");
|
1719 |
-
});
|
1720 |
-
</script>
|
1721 |
-
|
1722 |
-
<style type="text/css">
|
1723 |
-
.create-account {
|
1724 |
-
display:none;
|
1725 |
-
}
|
1726 |
-
</style>
|
1727 |
-
|
1728 |
-
<?php }
|
1729 |
}
|
1730 |
|
|
|
1731 |
|
|
|
|
|
|
|
|
|
1732 |
|
|
|
1733 |
|
1734 |
-
|
1735 |
-
add_action( '
|
1736 |
-
|
1737 |
|
1738 |
-
$
|
1739 |
-
$saved['wooccm_tax_save_method'] = $_POST['tax_remove_aj'];
|
1740 |
-
$saved['wooccm_addamount453user'] = $_POST['add_amount_aj'];
|
1741 |
|
1742 |
-
|
1743 |
|
1744 |
-
|
1745 |
-
|
|
|
1746 |
|
|
|
1747 |
|
1748 |
-
|
1749 |
-
|
1750 |
-
global $woocommerce, $wpdb;
|
1751 |
-
$options = get_option( 'wccs_settings' );
|
1752 |
-
$options2 = get_option( 'wccs_settings2' );
|
1753 |
-
$options3 = get_option( 'wccs_settings3' );
|
1754 |
|
1755 |
-
$
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
if ( !empty( $btn['add_amount'] ) && !empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
1762 |
-
if ( $saved['wooccm_addamount453user'] == $btn['chosen_valt'] ) {
|
1763 |
-
$woocommerce->cart->add_fee( $btn['fee_name'], $btn['add_amount_field'], false, '' );
|
1764 |
-
}
|
1765 |
-
}
|
1766 |
-
|
1767 |
-
if ( !empty( $btn['add_amount'] ) && empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
1768 |
-
if ( !empty($saved['wooccm_addamount453userf']) && is_numeric($saved['wooccm_addamount453userf']) ) {
|
1769 |
-
$woocommerce->cart->add_fee( $btn['fee_name'], $saved['wooccm_addamount453userf'], false, '' );
|
1770 |
-
}
|
1771 |
-
}
|
1772 |
-
|
1773 |
-
}
|
1774 |
-
}
|
1775 |
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
if ( $saved['wooccm_addamount453user'] == $btn['chosen_valt'] ) {
|
1782 |
-
$woocommerce->cart->add_fee( $btn['fee_name'], $btn['add_amount_field'], false, '' );
|
1783 |
-
}
|
1784 |
-
}
|
1785 |
-
|
1786 |
-
if ( !empty( $btn['add_amount'] ) && empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
1787 |
-
if ( !empty($saved['wooccm_addamount453userf']) && is_numeric($saved['wooccm_addamount453userf']) ) {
|
1788 |
-
$woocommerce->cart->add_fee( $btn['fee_name'], $saved['wooccm_addamount453userf'], false, '' );
|
1789 |
-
}
|
1790 |
-
}
|
1791 |
-
|
1792 |
-
}
|
1793 |
-
}
|
1794 |
|
1795 |
-
|
1796 |
-
if ( !empty($options2['shipping_buttons']) ) {
|
1797 |
-
foreach ( $options2['shipping_buttons'] as $btn ) {
|
1798 |
-
|
1799 |
-
if ( !empty( $btn['add_amount'] ) && !empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
1800 |
-
if ( $saved['wooccm_addamount453user'] == $btn['chosen_valt'] ) {
|
1801 |
-
$woocommerce->cart->add_fee( $btn['fee_name'], $btn['add_amount_field'], false, '' );
|
1802 |
-
}
|
1803 |
-
}
|
1804 |
-
|
1805 |
-
if ( !empty( $btn['add_amount'] ) && empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
1806 |
-
if ( !empty($saved['wooccm_addamount453userf']) && is_numeric($saved['wooccm_addamount453userf']) ) {
|
1807 |
-
$woocommerce->cart->add_fee( $btn['fee_name'], $saved['wooccm_addamount453userf'], false, '' );
|
1808 |
-
}
|
1809 |
-
}
|
1810 |
-
|
1811 |
-
}
|
1812 |
}
|
1813 |
|
1814 |
-
|
1815 |
-
|
1816 |
|
1817 |
-
|
1818 |
-
|
1819 |
-
|
|
|
|
|
1820 |
|
1821 |
-
|
1822 |
-
|
1823 |
-
|
|
|
|
|
1824 |
|
1825 |
-
$saved = WC()->session->get('wooccm_retain', array() );
|
1826 |
-
|
1827 |
-
if ( !empty($options['buttons']) ) {
|
1828 |
-
foreach ( $options['buttons'] as $btn ) {
|
1829 |
-
if ( !empty( $btn['tax_remove'] ) ) {
|
1830 |
-
if ( $saved['wooccm_tax_save_method'] == $btn['chosen_valt'] ) {
|
1831 |
-
$cart->remove_taxes();
|
1832 |
-
}
|
1833 |
}
|
1834 |
-
}
|
1835 |
}
|
1836 |
|
1837 |
-
if
|
1838 |
-
|
1839 |
-
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
|
|
|
|
|
|
|
|
|
|
1846 |
|
1847 |
-
|
1848 |
-
if ( !empty($options2['shipping_buttons']) ) {
|
1849 |
-
foreach ( $options2['shipping_buttons'] as $btn ) {
|
1850 |
-
if ( !empty( $btn['tax_remove'] ) ) {
|
1851 |
-
if ( $saved['wooccm_tax_save_method'] == $btn['chosen_valt'] ) {
|
1852 |
-
$cart->remove_taxes();
|
1853 |
-
}
|
1854 |
}
|
1855 |
-
}
|
1856 |
}
|
1857 |
|
1858 |
-
return $cart;
|
1859 |
}
|
|
|
1860 |
|
|
|
1861 |
|
1862 |
-
|
1863 |
-
$options = get_option( 'wccs_settings' );
|
1864 |
-
if( !empty($options['checkness']['per_state']) && !empty($options['checkness']['per_state_check']) ) {
|
1865 |
-
return ''.$options['checkness']['per_state'].'';
|
1866 |
-
}
|
1867 |
-
}
|
1868 |
|
|
|
|
|
|
|
1869 |
|
1870 |
-
|
1871 |
-
function wooccm_pro_csv_export_modify_column_headers( $column_headers ) {
|
1872 |
|
1873 |
-
$
|
1874 |
-
|
1875 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1876 |
|
1877 |
-
|
1878 |
-
$
|
1879 |
-
|
1880 |
-
|
1881 |
-
|
1882 |
-
|
1883 |
-
|
1884 |
-
$new_headers['_'.$name.'_'.$btn['cow'].''] = ''.wpml_string_wccm_pro($btn['label']).'';
|
1885 |
}
|
1886 |
-
|
1887 |
-
$inc--;
|
1888 |
-
}
|
1889 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1890 |
|
1891 |
-
$
|
1892 |
-
foreach ( $options['buttons'] as $btn ) :
|
1893 |
-
$new_headers[''.$btn['cow'].''] = ''.wpml_string_wccm_pro($btn['label']).'';
|
1894 |
-
endforeach;
|
1895 |
|
1896 |
-
return array_merge( $column_headers, $new_headers );
|
1897 |
}
|
|
|
1898 |
|
|
|
1899 |
|
|
|
1900 |
|
1901 |
-
|
1902 |
-
|
1903 |
-
|
1904 |
-
$custom_data = array();
|
1905 |
-
|
1906 |
-
$shipping = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' );
|
1907 |
-
$billing = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'email', 'phone' );
|
1908 |
-
|
1909 |
-
$names = array( 'billing', 'shipping' );
|
1910 |
-
$inc = 3;
|
1911 |
-
foreach( $names as $name ) {
|
1912 |
-
|
1913 |
-
$array = ($name == 'billing') ? $billing : $shipping;
|
1914 |
-
|
1915 |
-
$options = get_option( 'wccs_settings'.$inc.'' );
|
1916 |
-
|
1917 |
-
foreach ( $options[''.$name.'_buttons'] as $btn ) :
|
1918 |
-
|
1919 |
-
|
1920 |
-
if ( !in_array( $btn['cow'], $array ) ) {
|
1921 |
-
|
1922 |
-
if( get_post_meta( $order->id, '_'.$name.'_'.$btn['cow'].'', true ) && (($btn['type'] !== 'multiselect') || ($btn['type'] !== 'multicheckbox')) && ($btn['type'] !== 'heading') ) {
|
1923 |
-
$custom_data['_'.$name.'_'.$btn['cow'].''] = get_post_meta( $order->id, '_'.$name.'_'.$btn['cow'].'', true );
|
1924 |
-
}
|
1925 |
-
|
1926 |
-
if( get_post_meta( $order->id, '_'.$name.'_'.$btn['cow'].'', true ) && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' ) {
|
1927 |
-
$custom_data['_'.$name.'_'.$btn['cow'].''] = '';
|
1928 |
-
$strings = unserialize(get_post_meta( $order->id , '_'.$name.'_'.$btn['cow'].'', true));
|
1929 |
-
$iww = 0;
|
1930 |
-
|
1931 |
-
foreach( $strings as $key ) {
|
1932 |
-
if ( $iww == count($strings) - 1) {
|
1933 |
-
$custom_data['_'.$name.'_'.$btn['cow'].''] .= $key;
|
1934 |
-
} else {
|
1935 |
-
$custom_data['_'.$name.'_'.$btn['cow'].''] .= $key.', ';
|
1936 |
-
}
|
1937 |
-
|
1938 |
-
$iww++;
|
1939 |
-
}
|
1940 |
-
}
|
1941 |
|
1942 |
}
|
1943 |
-
endforeach;
|
1944 |
-
$inc--;
|
1945 |
-
}
|
1946 |
-
|
1947 |
-
|
1948 |
-
$options = get_option( 'wccs_settings' );
|
1949 |
|
1950 |
-
|
1951 |
-
|
1952 |
-
if( get_post_meta( $order->id, ''.$btn['cow'].'', true ) && (($btn['type'] !== 'multiselect') || ($btn['type'] !== 'multicheckbox')) && ($btn['type'] !== 'heading') ) {
|
1953 |
-
$custom_data[''.$btn['cow'].''] = get_post_meta( $order->id, ''.$btn['cow'].'', true );
|
1954 |
-
}
|
1955 |
-
|
1956 |
-
if( get_post_meta( $order->id, ''.$btn['cow'].'', true ) && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' ) {
|
1957 |
-
$custom_data[''.$btn['cow'].''] = '';
|
1958 |
-
$strings = unserialize(get_post_meta( $order->id , ''.$btn['cow'].'', true));
|
1959 |
-
$iww = 0;
|
1960 |
-
|
1961 |
-
foreach( $strings as $key ) {
|
1962 |
-
if ( $iww == count($strings) - 1) {
|
1963 |
-
$custom_data[''.$btn['cow'].''] .= $key;
|
1964 |
-
} else {
|
1965 |
-
$custom_data[''.$btn['cow'].''] .= $key.', ';
|
1966 |
-
}
|
1967 |
-
|
1968 |
-
$iww++;
|
1969 |
-
}
|
1970 |
-
}
|
1971 |
-
endforeach;
|
1972 |
-
|
1973 |
-
|
1974 |
-
// defaults set back
|
1975 |
-
$new_order_data = array();
|
1976 |
-
|
1977 |
-
if ( isset( $csv_generator->order_format ) && ( 'default_one_row_per_item' == $csv_generator->order_format || 'legacy_one_row_per_item' == $csv_generator->order_format ) ) {
|
1978 |
-
|
1979 |
-
foreach ( $order_data as $data ) {
|
1980 |
-
$new_order_data[] = array_merge( (array) $data, $custom_data );
|
1981 |
-
}
|
1982 |
|
|
|
|
|
1983 |
} else {
|
1984 |
-
|
1985 |
-
$new_order_data = array_merge( $order_data, $custom_data );
|
1986 |
}
|
1987 |
|
1988 |
-
|
1989 |
-
|
1990 |
-
|
1991 |
-
|
1992 |
-
|
1993 |
-
|
1994 |
-
|
1995 |
-
|
1996 |
-
|
1997 |
-
|
1998 |
-
|
1999 |
-
|
2000 |
-
|
2001 |
-
|
2002 |
-
|
2003 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004 |
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
$info = explode("||",get_post_meta( $order->id, '_'.$name.'_'.$btn['cow'].'', true ));
|
2036 |
-
$new_fields['_'.$name.'_'.$btn['cow'].''] = array(
|
2037 |
-
'label' => ''.wpml_string_wccm_pro($btn['force_title2']).'',
|
2038 |
-
'value' => $info[0]
|
2039 |
-
);
|
2040 |
-
}
|
2041 |
|
2042 |
-
}
|
2043 |
-
|
2044 |
-
$
|
2045 |
-
|
|
|
|
|
|
|
|
|
2046 |
|
|
|
2047 |
|
2048 |
-
|
2049 |
-
|
2050 |
-
foreach ( $options['buttons'] as $btn ) :
|
2051 |
-
|
2052 |
-
if( get_post_meta( $order->id, ''.$btn['cow'].'', true ) && (($btn['type'] !== 'multiselect') || ($btn['type'] !== 'multicheckbox')) && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'heading') ) {
|
2053 |
-
$new_fields[''.$btn['cow'].''] = array(
|
2054 |
-
'label' => ''.wpml_string_wccm_pro($btn['label']).'',
|
2055 |
-
'value' => get_post_meta( $order->id, ''.$btn['cow'].'', true )
|
2056 |
-
);
|
2057 |
-
}
|
2058 |
-
|
2059 |
-
if( get_post_meta( $order->id, ''.$btn['cow'].'', true ) && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'heading')) {
|
2060 |
-
$new_fields[''.$btn['cow'].'']['label'] = ''.wpml_string_wccm_pro($btn['label']).'';
|
2061 |
-
$new_fields[''.$btn['cow'].'']['value'] = '';
|
2062 |
-
$strings = unserialize(get_post_meta( $order->id , ''.$btn['cow'].'', true));
|
2063 |
-
$iww = 0;
|
2064 |
-
|
2065 |
-
foreach( $strings as $key ) {
|
2066 |
-
if ( $iww == count($strings) - 1) {
|
2067 |
-
$new_fields[''.$btn['cow'].'']['value'] .= $key;
|
2068 |
-
} else {
|
2069 |
-
$new_fields[''.$btn['cow'].'']['value'] .= $key.', ';
|
2070 |
-
}
|
2071 |
-
|
2072 |
-
$iww++;
|
2073 |
-
}
|
2074 |
-
}
|
2075 |
-
|
2076 |
-
if( $btn['type'] == 'wooccmupload' ){
|
2077 |
-
$info = get_post_meta( $order->id, ''.$btn['cow'].'', true );
|
2078 |
-
$new_fields[''.$btn['cow'].''] = array(
|
2079 |
-
'label' => ''.wpml_string_wccm_pro($btn['force_title2']).'',
|
2080 |
-
'value' => $info[0]
|
2081 |
-
);
|
2082 |
}
|
2083 |
-
|
2084 |
-
|
2085 |
-
|
2086 |
-
return array_merge( $fields, $new_fields );
|
2087 |
-
}
|
2088 |
-
|
2089 |
|
|
|
2090 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2091 |
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2099 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2100 |
|
2101 |
-
|
2102 |
-
$name = 'woocommerce-checkout-manager/woocommerce-checkout-manager.php';
|
2103 |
-
|
2104 |
-
if ( !is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
2105 |
-
add_action('admin_notices', 'wooccm_admin_notice_woo');
|
2106 |
-
deactivate_plugins( $name );
|
2107 |
-
}
|
2108 |
-
|
2109 |
-
}
|
2110 |
|
2111 |
-
function wooccm_admin_notice_woo() {
|
2112 |
-
echo '<div class="error"><p><strong>'.__( 'WooCommerce is not active! WooCommerce Checkout Manager Pro requires WooCommerce to be active.', 'woocommerce-checkout-manager' ).'</strong></p></div>';
|
2113 |
}
|
2114 |
|
2115 |
-
|
2116 |
function wooccm_order_notes( $fields ) {
|
2117 |
-
$options = get_option( 'wccs_settings' );
|
2118 |
|
2119 |
-
|
2120 |
-
$fields['order']['order_comments']['label'] = $options['checkness']['noteslabel'];
|
2121 |
-
}
|
2122 |
|
2123 |
-
|
2124 |
-
|
2125 |
-
|
2126 |
-
|
2127 |
-
|
2128 |
-
|
2129 |
-
|
|
|
|
|
|
|
2130 |
|
2131 |
-
return $fields;
|
2132 |
}
|
2133 |
|
|
|
2134 |
|
2135 |
-
|
2136 |
-
$
|
2137 |
-
$
|
2138 |
-
$options3 = get_option( 'wccs_settings3' );
|
2139 |
-
$billing = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'email', 'phone' );
|
2140 |
-
$shipping = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' );
|
2141 |
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2146 |
}
|
2147 |
-
if( !empty($values) ) {
|
2148 |
-
array_unique($values);
|
2149 |
}
|
2150 |
-
|
2151 |
-
|
2152 |
-
|
2153 |
-
|
|
|
|
|
|
|
2154 |
}
|
2155 |
}
|
2156 |
-
if( !empty($values2) ) {
|
2157 |
-
array_unique($values2);
|
2158 |
}
|
2159 |
-
|
2160 |
-
|
2161 |
-
|
2162 |
-
|
|
|
|
|
|
|
2163 |
}
|
2164 |
}
|
2165 |
-
if( !empty($values3) ) {
|
2166 |
-
array_unique($values3);
|
2167 |
}
|
2168 |
-
|
2169 |
if( !empty($values) && !empty($values2) && !empty($values3) ) {
|
2170 |
$values = array_merge($values, $values2);
|
2171 |
$values = array_merge($values, $values3);
|
2172 |
} elseif( !empty($values) && !empty($values2) && empty($values3) ) {
|
2173 |
-
|
2174 |
-
|
2175 |
-
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
|
2180 |
-
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
|
2185 |
-
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
|
2190 |
-
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
|
2195 |
-
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
|
2200 |
-
|
2201 |
-
|
2202 |
-
|
2203 |
-
|
2204 |
-
|
2205 |
-
|
2206 |
-
|
2207 |
-
|
2208 |
-
|
2209 |
-
}
|
2210 |
-
}
|
2211 |
|
2212 |
-
function wooccm_query_list( $query ){
|
2213 |
-
global $pagenow;
|
2214 |
-
if ( is_admin() && $pagenow=='edit.php' && isset($_GET['wooccm_abbreviation']) && $_GET['wooccm_abbreviation'] != '') {
|
2215 |
-
$query->query_vars[ 'meta_key' ] = $_GET['wooccm_abbreviation'];
|
2216 |
-
}
|
2217 |
}
|
2218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2219 |
|
2220 |
-
function display_notices_wooccm(){
|
2221 |
-
echo '<form method="post" name="clickhere" action=""><div id="setting-error-settings_updated" class="updated settings-error click-here-wooccm"><p><strong>'.__('Almost done! Install latest settings.','woocommerce-checkout-manager').'</strong> | <input type="hidden" name="click-here-wooccm" value="y" /><input type="submit" class="button button-primary button-hero" value="Click Here" /></p></div></form>';
|
2222 |
-
|
2223 |
-
if( isset($_POST['click-here-wooccm']) && $_POST['click-here-wooccm'] == 'y') { ?>
|
2224 |
-
|
2225 |
-
<!-- First Use -->
|
2226 |
-
<script type="text/javascript">
|
2227 |
-
jQuery(document).ready(function($) {
|
2228 |
-
|
2229 |
-
$( '#wpbody-content' ).block({message:null,overlayCSS:{background:"#fff url(<?php echo plugins_url('woocommerce/assets/images/ajax-loader.gif'); ?> ) no-repeat center",opacity:.6}});
|
2230 |
-
|
2231 |
-
var form = $('#frm1');
|
2232 |
-
data = $('#frm1');
|
2233 |
-
forma = $('#frm2');
|
2234 |
-
dataa = $('#frm2');
|
2235 |
-
formb = $('#frm3');
|
2236 |
-
datab = $('#frm3');
|
2237 |
-
|
2238 |
-
$.ajax( {
|
2239 |
-
type: "POST",
|
2240 |
-
url: form.attr( 'action' ),
|
2241 |
-
data: data.serialize(),
|
2242 |
-
success: function( response ) {
|
2243 |
-
$.ajax( {
|
2244 |
-
type: "POST",
|
2245 |
-
url: forma.attr( 'action' ),
|
2246 |
-
data: dataa.serialize(),
|
2247 |
-
success: function( response ) {
|
2248 |
-
}
|
2249 |
-
});
|
2250 |
-
|
2251 |
-
$.ajax( {
|
2252 |
-
type: "POST",
|
2253 |
-
url: formb.attr( 'action' ),
|
2254 |
-
data: datab.serialize(),
|
2255 |
-
success: function( response ) {
|
2256 |
-
}
|
2257 |
-
});
|
2258 |
-
$('.settings-error.click-here-wooccm').hide();
|
2259 |
-
$('#wpbody-content').unblock();
|
2260 |
-
}
|
2261 |
-
});
|
2262 |
-
});
|
2263 |
-
</script>
|
2264 |
-
|
2265 |
-
<?php
|
2266 |
-
update_option('wooccm_update_notice', 'yep');
|
2267 |
-
}
|
2268 |
}
|
2269 |
|
2270 |
// ========================================
|
2271 |
// Remove conditional notices
|
2272 |
// ========================================
|
2273 |
|
2274 |
-
|
2275 |
-
|
2276 |
-
$notice = WC()->session->get( 'wc_notices' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2277 |
|
2278 |
-
$
|
2279 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2280 |
|
2281 |
-
|
2282 |
-
$
|
2283 |
-
|
2284 |
-
foreach( $names as $name ) {
|
2285 |
|
2286 |
-
|
|
|
|
|
2287 |
|
2288 |
-
$options2 = get_option( 'wccs_settings'.$inc.'' );
|
2289 |
-
|
2290 |
-
foreach ( $options2[''.$name.'_buttons'] as $btn ) :
|
2291 |
-
|
2292 |
-
if( !empty($btn['chosen_valt']) && !empty($btn['conditional_parent_use']) && !empty($btn['conditional_tie']) && $btn['type'] !== 'changename' && ($btn['type'] !== 'heading') && !empty($btn['conditional_parent']) ) {
|
2293 |
-
|
2294 |
-
if( !empty($_POST[$btn['cow']]) ) {
|
2295 |
-
|
2296 |
-
foreach( $options['buttons'] as $btn2 ) {
|
2297 |
-
if( !empty($btn2['chosen_valt']) && !empty($btn2['conditional_parent_use']) && !empty($btn2['conditional_tie']) && $btn2['type'] !== 'changename' && ($btn2['type'] !== 'heading') && empty($btn2['conditional_parent']) ) {
|
2298 |
-
|
2299 |
-
|
2300 |
-
if( $_POST[''.$btn['cow'].''] != $btn2['chosen_valt'] ) {
|
2301 |
-
if( empty($_POST[''.$btn2['cow'].'']) ) {
|
2302 |
-
foreach( $notice['error'] as $position => $value ) {
|
2303 |
-
if( strip_tags($value) == ''.wpml_string_wccm_pro($btn2['label']).' is a required field.' ) {
|
2304 |
-
unset($notice['error'][$position]);
|
2305 |
}
|
2306 |
}
|
2307 |
}
|
2308 |
-
|
2309 |
-
}
|
2310 |
}
|
2311 |
-
} else {
|
2312 |
-
foreach( $notice['error'] as $position => $value ) {
|
2313 |
-
if( strip_tags($value) == ''.wpml_string_wccm_pro($btn2['label']).' is a required field.' ) {
|
2314 |
-
unset($notice['error'][$position]);
|
2315 |
-
}
|
2316 |
-
}
|
2317 |
}
|
2318 |
-
|
2319 |
-
|
2320 |
-
|
2321 |
-
$inc--;
|
2322 |
-
}
|
2323 |
|
2324 |
$options = get_option( 'wccs_settings' );
|
|
|
2325 |
global $woocommerce;
|
2326 |
-
|
2327 |
-
foreach( $options['buttons'] as $btn ) {
|
2328 |
-
if( !empty($btn['chosen_valt']) && !empty($btn['conditional_parent_use']) && !empty($btn['conditional_tie']) && $btn['type'] !== 'changename' && ($btn['type'] !== 'heading') && !empty($btn['conditional_parent']) ) {
|
2329 |
-
|
2330 |
-
if( !empty($_POST[$btn['cow']]) ) {
|
2331 |
-
|
2332 |
-
foreach( $options['buttons'] as $btn2 ) {
|
2333 |
-
if( !empty($btn2['chosen_valt']) && !empty($btn2['conditional_parent_use']) && !empty($btn2['conditional_tie']) && $btn2['type'] !== 'changename' && ($btn2['type'] !== 'heading') && empty($btn2['conditional_parent']) ) {
|
2334 |
-
|
2335 |
-
|
2336 |
-
if( $_POST[''.$btn['cow'].''] != $btn2['chosen_valt'] ) {
|
2337 |
-
if( empty($_POST[''.$btn2['cow'].'']) ) {
|
2338 |
-
foreach( $notice['error'] as $position => $value ) {
|
2339 |
-
if( strip_tags($value) == ''.wpml_string_wccm_pro($btn2['label']).' is a required field.' ) {
|
2340 |
-
unset($notice['error'][$position]);
|
2341 |
-
}
|
2342 |
-
}
|
2343 |
-
}
|
2344 |
-
}
|
2345 |
-
}
|
2346 |
-
}
|
2347 |
-
} else {
|
2348 |
-
foreach( $notice['error'] as $position => $value ) {
|
2349 |
-
if( strip_tags($value) == ''.wpml_string_wccm_pro($btn2['label']).' is a required field.' ) {
|
2350 |
-
unset($notice['error'][$position]);
|
2351 |
-
}
|
2352 |
-
}
|
2353 |
-
}
|
2354 |
-
}
|
2355 |
-
}
|
2356 |
-
|
2357 |
-
WC()->session->set( 'wc_notices', $notice );
|
2358 |
-
}
|
2359 |
|
|
|
|
|
|
|
|
|
2360 |
|
2361 |
-
|
2362 |
-
function wooccm_update_attachmentids( $order_id ){
|
2363 |
|
2364 |
-
|
2365 |
-
$billing = array( 'country', 'first_name', 'last_name', 'company', 'address_1', 'address_2', 'city', 'state', 'postcode', 'email', 'phone' );
|
2366 |
|
2367 |
-
$
|
2368 |
-
$
|
|
|
|
|
2369 |
|
2370 |
-
|
2371 |
-
|
2372 |
-
|
2373 |
-
foreach ( $options[''.$name.'_buttons'] as $btn ) :
|
2374 |
|
2375 |
-
if ( !in_array( $btn['cow'], $array ) ) {
|
2376 |
-
if( $btn['type'] == 'wooccmupload' ){
|
2377 |
-
$info = explode("||", get_post_meta( $order_id , '_'.$name.'_'.$btn['cow'].'', true));
|
2378 |
-
if( $info ){
|
2379 |
-
$new_info = explode( "||", $info[1] );
|
2380 |
-
foreach( $new_info as $image_id ) {
|
2381 |
-
if( !empty($image_id ) ){
|
2382 |
-
wp_update_post( array( 'ID' => $image_id, 'post_parent' => $order_id ));
|
2383 |
-
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
2384 |
-
wp_update_attachment_metadata( $image_id, wp_generate_attachment_metadata( $image_id, wp_get_attachment_url($image_id) ) );
|
2385 |
}
|
2386 |
}
|
2387 |
-
}
|
2388 |
}
|
2389 |
-
}
|
2390 |
-
endforeach;
|
2391 |
-
$inc--;
|
2392 |
-
}
|
2393 |
|
2394 |
-
$options = get_option( 'wccs_settings' );
|
2395 |
-
foreach ( $options['buttons'] as $btn ) :
|
2396 |
-
|
2397 |
-
if( $btn['type'] == 'wooccmupload' ){
|
2398 |
-
$info = explode( "||", get_post_meta( $order_id , ''.$btn['cow'].'', true));
|
2399 |
-
if( $info ){
|
2400 |
-
$new_info = explode( "||", $info[1] );
|
2401 |
-
foreach( $new_info as $image_id ) {
|
2402 |
-
if( !empty($image_id ) ){
|
2403 |
-
wp_update_post( array( 'ID' => $image_id, 'post_parent' => $order_id ));
|
2404 |
-
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
2405 |
-
wp_update_attachment_metadata( $image_id, wp_generate_attachment_metadata( $image_id, wp_get_attachment_url($image_id) ) );
|
2406 |
-
}
|
2407 |
-
}
|
2408 |
-
}
|
2409 |
}
|
2410 |
-
endforeach;
|
2411 |
-
}
|
2412 |
-
|
2413 |
-
add_action("wp_ajax_wooccm_front_endupload", "wooccm_front_endupload");
|
2414 |
-
add_action("wp_ajax_nopriv_wooccm_front_endupload", "wooccm_front_endupload");
|
2415 |
-
|
2416 |
-
function wooccm_front_endupload() {
|
2417 |
-
|
2418 |
-
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
2419 |
-
require_once( ABSPATH . 'wp-admin/includes/media.php' );
|
2420 |
-
|
2421 |
-
$wp_upload_dir = wp_upload_dir();
|
2422 |
-
$name = $_REQUEST["name"];
|
2423 |
-
$upload_overrides = array( 'test_form' => false );
|
2424 |
-
$number_of_files = 0;
|
2425 |
-
|
2426 |
-
$file = array(
|
2427 |
-
'name' => $_FILES[''.$name.'']['name'],
|
2428 |
-
'type' => $_FILES[''.$name.'']['type'],
|
2429 |
-
'tmp_name' => $_FILES[''.$name.'']['tmp_name'],
|
2430 |
-
'error' => $_FILES[''.$name.'']['error'],
|
2431 |
-
'size' => $_FILES[''.$name.'']['size']
|
2432 |
-
);
|
2433 |
-
|
2434 |
-
$movefile = wp_handle_upload($file, $upload_overrides);
|
2435 |
-
|
2436 |
-
$attachment = array(
|
2437 |
-
'guid' => $movefile['url'],
|
2438 |
-
'post_mime_type' => $movefile['type'],
|
2439 |
-
'post_title' => preg_replace( '/\.[^.]+$/', '', basename($movefile['file'])),
|
2440 |
-
'post_content' => '',
|
2441 |
-
'post_status' => 'inherit'
|
2442 |
-
);
|
2443 |
-
|
2444 |
-
$attach_id = wp_insert_attachment( $attachment, $movefile['url'] );
|
2445 |
-
$number_of_files++;
|
2446 |
-
|
2447 |
-
echo json_encode( array( $number_of_files, $attach_id ) );
|
2448 |
-
|
2449 |
-
die();
|
2450 |
-
}
|
2451 |
-
|
2452 |
|
2453 |
-
|
2454 |
-
add_action("wp_ajax_wooccm_front_enduploadsave", "wooccm_front_enduploadsave");
|
2455 |
-
add_action("wp_ajax_nopriv_wooccm_front_enduploadsave", "wooccm_front_enduploadsave");
|
2456 |
|
2457 |
-
|
2458 |
-
global $wpdb, $woocommerce, $post;
|
2459 |
|
2460 |
-
|
2461 |
-
|
|
|
2462 |
|
2463 |
-
|
2464 |
-
|
2465 |
-
$upload_overrides = array( 'test_form' => false );
|
2466 |
|
2467 |
-
|
2468 |
|
2469 |
-
|
2470 |
-
|
2471 |
-
'type' => $_FILES[''.$name.'']['type'],
|
2472 |
-
'tmp_name' => $_FILES[''.$name.'']['tmp_name'],
|
2473 |
-
'error' => $_FILES[''.$name.'']['error'],
|
2474 |
-
'size' => $_FILES[''.$name.'']['size']
|
2475 |
-
);
|
2476 |
-
$movefile = wp_handle_upload($file, $upload_overrides);
|
2477 |
|
2478 |
-
|
2479 |
-
'guid' => $movefile['url'],
|
2480 |
-
'post_mime_type' => $movefile['type'],
|
2481 |
-
'post_title' => preg_replace( '/\.[^.]+$/', '', basename($movefile['file'])),
|
2482 |
-
'post_content' => '',
|
2483 |
-
'post_status' => 'inherit'
|
2484 |
-
);
|
2485 |
|
2486 |
-
|
2487 |
-
|
2488 |
-
|
2489 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
*
|
5 |
* MAIN
|
6 |
*
|
9 |
// Exit if accessed directly
|
10 |
if ( !defined( 'ABSPATH' ) ) exit;
|
11 |
|
12 |
+
if( wooccm_validator_changename() ) {
|
13 |
|
14 |
+
function wooccm_before_checkout() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
+
$options = get_option( 'wccs_settings' );
|
17 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
18 |
|
19 |
+
// Check if the buttons exist
|
20 |
+
if( empty( $buttons ) )
|
21 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
foreach( $buttons as $btn ) {
|
24 |
+
$label = ( isset( $btn['label'] ) ) ? $btn['label'] : '';
|
25 |
+
ob_start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
|
|
|
|
|
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
|
|
|
|
|
|
29 |
|
30 |
+
function wooccm_after_checkout() {
|
31 |
|
32 |
+
$options = get_option( 'wccs_settings' );
|
33 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
34 |
|
35 |
+
// Check if the buttons exist
|
36 |
+
if( empty( $buttons ) )
|
37 |
+
return;
|
38 |
|
39 |
+
foreach( $buttons as $btn ) {
|
40 |
+
if( $btn['type'] == 'changename' ) {
|
41 |
+
$content = ob_get_clean();
|
42 |
+
echo str_replace( $btn['changenamep'], $btn['changename'], $content );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
}
|
|
|
|
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
|
50 |
+
// -----------------------------------------------------------
|
51 |
+
// -----------------------------------------------------------
|
52 |
+
// -----------------------------------------------------------
|
53 |
+
// -----------------------------------------------------------
|
|
|
|
|
|
|
54 |
|
55 |
+
function wooccm_validator_changename() {
|
56 |
|
57 |
+
$options = get_option( 'wccs_settings' );
|
58 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
+
if( !empty( $buttons ) ) {
|
61 |
+
foreach( $buttons as $btn ) {
|
62 |
+
if (!empty($btn['type']) ) {
|
63 |
+
if ( $btn['type'] == 'changename' && !empty($btn['label']) ){
|
64 |
+
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
}
|
67 |
}
|
68 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
|
|
70 |
}
|
71 |
|
72 |
+
if( wooccm_validator_changename() ) {
|
73 |
|
74 |
+
// @mod - This function isn't referenced anywhere
|
75 |
+
function wooccm_string_replacer( $order ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
+
$options = get_option( 'wccs_settings' );
|
78 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
79 |
+
?>
|
80 |
+
<header>
|
81 |
+
<h2><?php _e( 'Customer details', 'woocommerce-checkout-manager' ); ?></h2>
|
82 |
+
</header>
|
83 |
|
84 |
+
<dl class="customer_details">
|
85 |
+
<?php
|
86 |
+
if( $order->billing_email ) echo '<dt>'.__( 'Email:', 'woocommerce-checkout-manager' ).'</dt><dd>'.$order->billing_email.'</dd>';
|
87 |
+
if( $order->billing_phone ) echo '<dt>'.__( 'Telephone:', 'woocommerce-checkout-manager' ).'</dt><dd>'.$order->billing_phone.'</dd>';
|
88 |
+
?>
|
89 |
+
</dl>
|
90 |
|
91 |
+
<?php if( get_option('woocommerce_ship_to_billing_address_only') == 'no' ) { ?>
|
92 |
|
93 |
+
<div class="col2-set addresses">
|
94 |
|
95 |
+
<div class="col-1">
|
96 |
|
97 |
+
<?php } ?>
|
98 |
|
99 |
+
<header class="title">
|
100 |
+
<h3><?php _e( 'Billing Address', 'woocommerce-checkout-manager' ); ?></h3>
|
101 |
+
</header>
|
102 |
|
103 |
+
<address>
|
104 |
+
<p><?php if (!$order->get_formatted_billing_address()) _e( 'N/A', 'woocommerce-checkout-manager' ); else echo $order->get_formatted_billing_address(); ?></p>
|
105 |
+
</address>
|
106 |
|
107 |
+
<?php if( get_option('woocommerce_ship_to_billing_address_only') == 'no' ) { ?>
|
|
|
108 |
|
109 |
+
</div>
|
110 |
+
<!-- .col-1 -->
|
111 |
|
112 |
+
<div class="col-2">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
+
<header class="title">
|
115 |
+
<h3><?php _e( 'Shipping Address', 'woocommerce-checkout-manager' ); ?></h3>
|
116 |
+
</header>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
+
<address>
|
119 |
+
<p><?php if (!$order->get_formatted_shipping_address()) _e( 'N/A', 'woocommerce-checkout-manager' ); else echo $order->get_formatted_shipping_address(); ?></p>
|
120 |
+
</address>
|
121 |
|
122 |
+
</div>
|
123 |
+
<!-- .col-2 -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
+
</div>
|
126 |
+
<!-- .col2-set -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
+
<?php } ?>
|
129 |
|
130 |
+
<div class="clear"></div>
|
131 |
|
132 |
+
<script type="text/javascript">
|
133 |
+
var array = [];
|
134 |
+
<?php foreach( $buttons as $btn ) { ?>
|
135 |
+
array.push("<?php echo $btn['changenamep']; ?>" , "<?php echo $btn['changename']; ?>")
|
136 |
+
<?php } ?>
|
137 |
+
b(array);
|
138 |
+
function b(array){
|
139 |
+
for(var i = 0; i<(array.length-1); i=i+2) {
|
140 |
+
document.body.innerHTML= document.body.innerHTML.replace(array[i],array[i+1])
|
141 |
+
}
|
142 |
+
}
|
143 |
+
</script>
|
144 |
|
145 |
+
<?php
|
146 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
}
|
149 |
|
150 |
+
if( wooccm_enable_auto_complete() ) {
|
151 |
|
152 |
+
function wooccm_retain_field_values() {
|
153 |
|
154 |
+
$options = get_option( 'wccs_settings' );
|
155 |
+
$options2 = get_option( 'wccs_settings2' );
|
156 |
+
$options3 = get_option( 'wccs_settings3' );
|
157 |
|
158 |
+
if( is_checkout() == false )
|
159 |
+
return;
|
160 |
|
161 |
+
$saved = WC()->session->get('wooccm_retain', array() );
|
162 |
+
?>
|
|
|
|
|
163 |
|
164 |
+
<script type="text/javascript">
|
|
|
165 |
|
166 |
+
jQuery(document).ready(function() {
|
167 |
+
window.onload = function() {
|
168 |
|
169 |
+
<?php
|
170 |
+
if( !empty( $options['buttons'] ) ) {
|
171 |
+
foreach ( $options['buttons'] as $btn ) {
|
172 |
+
if(
|
173 |
+
$btn['type'] !== 'wooccmupload' &&
|
174 |
+
$btn['type'] !== 'changename' &&
|
175 |
+
$btn['type'] !== 'heading' &&
|
176 |
+
$btn['disabled'] !== 'true' &&
|
177 |
+
empty( $btn['tax_remove'] ) &&
|
178 |
+
empty( $btn['add_amount'] )
|
179 |
+
) {
|
180 |
+
?>
|
181 |
+
document.forms['checkout'].elements['<?php echo $btn['cow']; ?>'].value = "<?php echo $saved[$btn['cow']]; ?>";
|
182 |
+
<?php
|
183 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
}
|
185 |
+
}
|
|
|
186 |
|
187 |
+
if( !is_user_logged_in() ) {
|
188 |
|
189 |
+
if( WC()->cart->needs_shipping_address() === true && sanitize_text_field( $_POST['ship_to_different_address'] ) == 1 ) {
|
190 |
|
191 |
+
if( !empty( $options2['shipping_buttons'] ) ) {
|
192 |
+
foreach ( $options2['shipping_buttons'] as $btn ) {
|
193 |
+
if(
|
194 |
+
$btn['type'] !== 'wooccmupload' &&
|
195 |
+
$btn['type'] !== 'changename' &&
|
196 |
+
$btn['type'] !== 'heading' &&
|
197 |
+
$btn['disabled'] !== 'true' &&
|
198 |
+
empty( $btn['tax_remove'] ) &&
|
199 |
+
empty( $btn['add_amount'] )
|
200 |
+
) {
|
201 |
+
?>
|
202 |
+
document.forms['checkout'].elements['shipping_<?php echo $btn['cow']; ?>'].value = "<?php echo $saved[sprintf( 'shipping_%s', $btn['cow'] )]; ?>";
|
203 |
+
<?php
|
204 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
}
|
206 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
|
|
|
|
|
|
|
|
|
|
208 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
|
210 |
+
if( !empty( $options3['billing_buttons'] ) ) {
|
211 |
+
foreach( $options3['billing_buttons'] as $btn ) {
|
212 |
+
if(
|
213 |
+
$btn['type'] !== 'wooccmupload' &&
|
214 |
+
$btn['type'] !== 'changename' &&
|
215 |
+
$btn['type'] !== 'heading' &&
|
216 |
+
$btn['disabled'] !== 'true' &&
|
217 |
+
empty( $btn['tax_remove'] ) &&
|
218 |
+
empty( $btn['add_amount'] )
|
219 |
+
) {
|
220 |
+
?>
|
221 |
+
document.forms['checkout'].elements['billing_<?php echo $btn['cow']; ?>'].value = "<?php echo $saved[sprintf( 'billing_%s', $btn['cow'] )]; ?>";
|
222 |
+
<?php
|
223 |
+
}
|
224 |
+
}
|
225 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
}
|
228 |
+
?>
|
229 |
|
230 |
+
}
|
231 |
+
});
|
232 |
+
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
|
234 |
+
<script type="text/javascript">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
+
jQuery(document).ready(function() {
|
237 |
+
jQuery('body').change(function() {
|
|
|
|
|
238 |
|
239 |
+
var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
|
240 |
+
data = { action: 'retain_val_wccs',
|
241 |
|
242 |
+
<?php
|
243 |
+
if( !empty( $options['buttons'] ) ) {
|
244 |
+
foreach( $options['buttons'] as $btn ) {
|
245 |
+
if(
|
246 |
+
$btn['type'] !== 'wooccmupload' &&
|
247 |
+
$btn['type'] !== 'changename' &&
|
248 |
+
$btn['type'] !== 'heading' &&
|
249 |
+
empty( $btn['tax_remove'] ) &&
|
250 |
+
empty( $btn['add_amount'] )
|
251 |
+
) {
|
252 |
+
?>
|
253 |
+
<?php echo $btn['cow']; ?>: jQuery("#<?php echo $btn['cow']; ?>").val(),
|
254 |
+
<?php
|
255 |
+
}
|
256 |
+
}
|
257 |
+
}
|
258 |
|
259 |
+
if( !is_user_logged_in() ) {
|
260 |
|
261 |
+
if( WC()->cart->needs_shipping_address() === true && sanitize_text_field( $_POST['ship_to_different_address'] ) == 1 ) {
|
|
|
|
|
|
|
262 |
|
263 |
+
if( !empty( $options2['shipping_buttons'] ) ) {
|
264 |
+
foreach ( $options2['shipping_buttons'] as $btn ) {
|
265 |
+
if(
|
266 |
+
$btn['type'] !== 'wooccmupload' &&
|
267 |
+
$btn['type'] !== 'changename' &&
|
268 |
+
$btn['type'] !== 'heading' &&
|
269 |
+
empty( $btn['tax_remove'] ) &&
|
270 |
+
empty( $btn['add_amount'] )
|
271 |
+
) {
|
272 |
+
?>
|
273 |
+
shipping_<?php echo $btn['cow']; ?>: jQuery("shipping_<?php echo $btn['cow']; ?>").val(),
|
274 |
+
<?php
|
275 |
+
}
|
276 |
+
}
|
277 |
+
}
|
278 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
}
|
|
|
|
|
|
|
280 |
|
281 |
+
if( !empty( $options3['billing_buttons'] ) ) {
|
282 |
+
foreach( $options3['billing_buttons'] as $btn ) {
|
283 |
+
if(
|
284 |
+
$btn['type'] !== 'wooccmupload' &&
|
285 |
+
$btn['type'] !== 'changename' &&
|
286 |
+
$btn['type'] !== 'heading' &&
|
287 |
+
empty( $btn['tax_remove'] ) &&
|
288 |
+
empty( $btn['add_amount'] )
|
289 |
+
) {
|
290 |
+
?>
|
291 |
+
billing_<?php echo $btn['cow']; ?>: jQuery("#billing_<?php echo $btn['cow']; ?>").val(),
|
292 |
+
<?php
|
293 |
+
}
|
294 |
+
}
|
295 |
+
}
|
296 |
|
297 |
+
}
|
298 |
+
?>
|
299 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
|
301 |
+
jQuery.post(ajaxurl, data, function(response) { });
|
302 |
+
return false;
|
303 |
|
304 |
+
});
|
305 |
+
});
|
306 |
|
307 |
+
</script>
|
308 |
|
309 |
+
<?php
|
310 |
|
311 |
+
}
|
312 |
|
313 |
+
function wooccm_retain_val_callback() {
|
314 |
|
315 |
+
global $wpdb;
|
316 |
|
|
|
|
|
|
|
317 |
$options = get_option( 'wccs_settings' );
|
318 |
$options2 = get_option( 'wccs_settings2' );
|
319 |
$options3 = get_option( 'wccs_settings3' );
|
|
|
|
|
|
|
320 |
|
321 |
+
if( !empty( $options['buttons'] ) ) {
|
322 |
+
foreach( $options['buttons'] as $btn ) {
|
323 |
+
if(
|
324 |
+
$btn['type'] !== 'wooccmupload' &&
|
325 |
+
$btn['type'] !== 'changename' &&
|
326 |
+
$btn['type'] !== 'heading' &&
|
327 |
+
empty( $btn['tax_remove'] ) &&
|
328 |
+
empty( $btn['add_amount'] )
|
329 |
+
) {
|
330 |
+
if( !empty( $_POST[$btn['cow']] ) ) {
|
331 |
+
$saved[$btn['cow']] = sanitize_text_field( $_POST[$btn['cow']] );
|
332 |
+
}
|
333 |
+
}
|
334 |
+
}
|
335 |
+
}
|
336 |
|
337 |
+
if( WC()->cart->needs_shipping_address() === true && sanitize_text_field( $_POST['ship_to_different_address'] ) == 1 ) {
|
338 |
+
if( !empty( $options2['shipping_buttons'] ) ) {
|
339 |
+
foreach( $options2['shipping_buttons'] as $btn ) {
|
340 |
+
if(
|
341 |
+
$btn['type'] !== 'wooccmupload' &&
|
342 |
+
$btn['type'] !== 'changename' &&
|
343 |
+
$btn['type'] !== 'heading' &&
|
344 |
+
empty( $btn['tax_remove'] ) &&
|
345 |
+
empty( $btn['add_amount'] )
|
346 |
+
) {
|
347 |
+
if( !empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
|
348 |
+
$saved[sprintf( 'shipping_%s', $btn['cow'] )] = sanitize_text_field( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] );
|
|
|
|
|
349 |
}
|
350 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
}
|
352 |
+
}
|
|
|
353 |
}
|
354 |
+
|
355 |
+
if( !empty( $options3['billing_buttons'] ) ) {
|
356 |
+
foreach( $options3['billing_buttons'] as $btn ) {
|
357 |
+
if(
|
358 |
+
$btn['type'] !== 'wooccmupload' &&
|
359 |
+
$btn['type'] !== 'changename' &&
|
360 |
+
$btn['type'] !== 'heading' &&
|
361 |
+
empty( $btn['tax_remove'] ) &&
|
362 |
+
empty( $btn['add_amount'] )
|
363 |
+
) {
|
364 |
+
if( !empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
365 |
+
$saved[sprintf( 'billing_%s', $btn['cow'] )] = sanitize_text_field( $_POST[sprintf( 'billing_%s', $btn['cow'] )] );
|
366 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
}
|
368 |
+
}
|
369 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
|
371 |
+
WC()->session->set('wooccm_retain', $saved );
|
372 |
|
373 |
+
die();
|
374 |
|
375 |
+
}
|
376 |
+
add_action( 'wp_ajax_retain_val_wccs', 'wooccm_retain_val_callback' );
|
377 |
+
add_action('wp_ajax_nopriv_retain_val_wccs', 'wooccm_retain_val_callback');
|
378 |
|
|
|
|
|
|
|
|
|
|
|
379 |
}
|
380 |
|
381 |
+
function wooccm_enable_auto_complete() {
|
382 |
|
383 |
+
$options = get_option( 'wccs_settings' );
|
384 |
|
385 |
+
if( !empty( $options['checkness']['retainval'] ) ) {
|
386 |
+
return true;
|
387 |
+
} else {
|
388 |
+
return false;
|
389 |
+
}
|
390 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
391 |
}
|
392 |
|
393 |
+
function wooccm_remove_tax_wccm() {
|
394 |
|
395 |
+
$saved['wooccm_addamount453userf'] = sanitize_text_field( $_POST['add_amount_faj'] );
|
396 |
+
$saved['wooccm_tax_save_method'] = sanitize_text_field( $_POST['tax_remove_aj'] );
|
397 |
+
$saved['wooccm_addamount453user'] = sanitize_text_field( $_POST['add_amount_aj'] );
|
398 |
+
WC()->session->set('wooccm_retain', $saved );
|
399 |
|
400 |
+
die();
|
401 |
|
402 |
+
}
|
403 |
+
add_action( 'wp_ajax_remove_tax_wccm', 'wooccm_remove_tax_wccm' );
|
404 |
+
add_action( 'wp_ajax_nopriv_remove_tax_wccm', 'wooccm_remove_tax_wccm' );
|
405 |
|
406 |
+
function wooccm_custom_user_charge_man( $cart ) {
|
|
|
|
|
407 |
|
408 |
+
global $woocommerce, $wpdb;
|
409 |
|
410 |
+
$options = get_option( 'wccs_settings' );
|
411 |
+
$options2 = get_option( 'wccs_settings2' );
|
412 |
+
$options3 = get_option( 'wccs_settings3' );
|
413 |
|
414 |
+
$saved = WC()->session->get('wooccm_retain', array() );
|
415 |
|
416 |
+
if( !empty( $options['buttons'] ) ) {
|
417 |
+
foreach( $options['buttons'] as $btn ) {
|
|
|
|
|
|
|
|
|
418 |
|
419 |
+
if( !empty( $btn['add_amount'] ) && !empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
420 |
+
if( $saved['wooccm_addamount453user'] == $btn['chosen_valt'] ) {
|
421 |
+
$woocommerce->cart->add_fee( $btn['fee_name'], $btn['add_amount_field'], false, '' );
|
422 |
+
}
|
423 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
424 |
|
425 |
+
if( !empty( $btn['add_amount'] ) && empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
426 |
+
if( !empty($saved['wooccm_addamount453userf']) && is_numeric($saved['wooccm_addamount453userf']) ) {
|
427 |
+
$woocommerce->cart->add_fee( $btn['fee_name'], $saved['wooccm_addamount453userf'], false, '' );
|
428 |
+
}
|
429 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
|
431 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
}
|
433 |
|
434 |
+
if( !empty( $options3['billing_buttons'] ) ) {
|
435 |
+
foreach( $options3['billing_buttons'] as $btn ) {
|
436 |
|
437 |
+
if( !empty( $btn['add_amount'] ) && !empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
438 |
+
if( $saved['wooccm_addamount453user'] == $btn['chosen_valt'] ) {
|
439 |
+
$woocommerce->cart->add_fee( $btn['fee_name'], $btn['add_amount_field'], false, '' );
|
440 |
+
}
|
441 |
+
}
|
442 |
|
443 |
+
if( !empty( $btn['add_amount'] ) && empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
444 |
+
if( !empty($saved['wooccm_addamount453userf']) && is_numeric($saved['wooccm_addamount453userf']) ) {
|
445 |
+
$woocommerce->cart->add_fee( $btn['fee_name'], $saved['wooccm_addamount453userf'], false, '' );
|
446 |
+
}
|
447 |
+
}
|
448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
}
|
|
|
450 |
}
|
451 |
|
452 |
+
if( !empty( $options2['shipping_buttons'] ) ) {
|
453 |
+
foreach( $options2['shipping_buttons'] as $btn ) {
|
454 |
+
|
455 |
+
if( !empty( $btn['add_amount'] ) && !empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
456 |
+
if( $saved['wooccm_addamount453user'] == $btn['chosen_valt'] ) {
|
457 |
+
$woocommerce->cart->add_fee( $btn['fee_name'], $btn['add_amount_field'], false, '' );
|
458 |
+
}
|
459 |
+
}
|
460 |
+
|
461 |
+
if( !empty( $btn['add_amount'] ) && empty( $btn['add_amount_field'] ) && !empty( $btn['label'] ) && !empty( $btn['fee_name'] ) ) {
|
462 |
+
if( !empty($saved['wooccm_addamount453userf']) && is_numeric($saved['wooccm_addamount453userf']) ) {
|
463 |
+
$woocommerce->cart->add_fee( $btn['fee_name'], $saved['wooccm_addamount453userf'], false, '' );
|
464 |
+
}
|
465 |
+
}
|
466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
}
|
|
|
468 |
}
|
469 |
|
|
|
470 |
}
|
471 |
+
add_action( 'woocommerce_cart_calculate_fees','wooccm_custom_user_charge_man' );
|
472 |
|
473 |
+
function wooccm_remove_tax_for_exempt( $cart ) {
|
474 |
|
475 |
+
global $woocommerce, $wpdb;
|
|
|
|
|
|
|
|
|
|
|
476 |
|
477 |
+
$options = get_option( 'wccs_settings' );
|
478 |
+
$options2 = get_option( 'wccs_settings2' );
|
479 |
+
$options3 = get_option( 'wccs_settings3' );
|
480 |
|
481 |
+
$saved = WC()->session->get('wooccm_retain', array() );
|
|
|
482 |
|
483 |
+
if( !empty( $options['buttons'] ) ) {
|
484 |
+
foreach( $options['buttons'] as $btn ) {
|
485 |
+
if( !empty( $btn['tax_remove'] ) ) {
|
486 |
+
if( $saved['wooccm_tax_save_method'] == $btn['chosen_valt'] ) {
|
487 |
+
$cart->remove_taxes();
|
488 |
+
}
|
489 |
+
}
|
490 |
+
}
|
491 |
+
}
|
492 |
|
493 |
+
if( !empty( $options3['billing_buttons'] ) ) {
|
494 |
+
foreach( $options3['billing_buttons'] as $btn ) {
|
495 |
+
if( !empty( $btn['tax_remove'] ) ) {
|
496 |
+
if( $saved['wooccm_tax_save_method'] == $btn['chosen_valt'] ) {
|
497 |
+
$cart->remove_taxes();
|
498 |
+
}
|
499 |
+
}
|
|
|
500 |
}
|
501 |
+
}
|
|
|
|
|
502 |
|
503 |
+
if( !empty( $options2['shipping_buttons'] ) ) {
|
504 |
+
foreach( $options2['shipping_buttons'] as $btn ) {
|
505 |
+
if( !empty( $btn['tax_remove'] ) ) {
|
506 |
+
if( $saved['wooccm_tax_save_method'] == $btn['chosen_valt'] ) {
|
507 |
+
$cart->remove_taxes();
|
508 |
+
}
|
509 |
+
}
|
510 |
+
}
|
511 |
+
}
|
512 |
|
513 |
+
return $cart;
|
|
|
|
|
|
|
514 |
|
|
|
515 |
}
|
516 |
+
add_action( 'woocommerce_calculate_totals', 'wooccm_remove_tax_for_exempt' );
|
517 |
|
518 |
+
function wooccm_state_default_switch() {
|
519 |
|
520 |
+
$options = get_option( 'wccs_settings' );
|
521 |
|
522 |
+
if( !empty( $options['checkness']['per_state'] ) && !empty( $options['checkness']['per_state_check'] ) ) {
|
523 |
+
return $options['checkness']['per_state'];
|
524 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
525 |
|
526 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
527 |
|
528 |
+
function wooccm_woocommerce_delivery_notes_compat( $fields, $order ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
529 |
|
530 |
+
if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) ) {
|
531 |
+
$order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
|
532 |
} else {
|
533 |
+
$order_id = ( isset( $order->id ) ? $order->id : 0 );
|
|
|
534 |
}
|
535 |
|
536 |
+
$new_fields = array();
|
537 |
+
|
538 |
+
$shipping = array(
|
539 |
+
'country',
|
540 |
+
'first_name',
|
541 |
+
'last_name',
|
542 |
+
'company',
|
543 |
+
'address_1',
|
544 |
+
'address_2',
|
545 |
+
'city',
|
546 |
+
'state',
|
547 |
+
'postcode'
|
548 |
+
);
|
549 |
+
$billing = array(
|
550 |
+
'country',
|
551 |
+
'first_name',
|
552 |
+
'last_name',
|
553 |
+
'company',
|
554 |
+
'address_1',
|
555 |
+
'address_2',
|
556 |
+
'city',
|
557 |
+
'state',
|
558 |
+
'postcode',
|
559 |
+
'email',
|
560 |
+
'phone'
|
561 |
+
);
|
562 |
+
|
563 |
+
$names = array(
|
564 |
+
'billing',
|
565 |
+
'shipping'
|
566 |
+
);
|
567 |
+
$inc = 3;
|
568 |
+
foreach( $names as $name ) {
|
569 |
+
|
570 |
+
$array = ( $name == 'billing' ) ? $billing : $shipping;
|
571 |
+
|
572 |
+
$options = get_option( 'wccs_settings'.$inc );
|
573 |
+
if( !empty( $options[$name.'_buttons'] ) ) {
|
574 |
+
foreach( $options[$name.'_buttons'] as $btn ) {
|
575 |
+
|
576 |
+
if( !in_array( $btn['cow'], $array ) ) {
|
577 |
+
|
578 |
+
if(
|
579 |
+
get_post_meta( $order_id, sprintf( '_%s_%s', $name, $btn['cow'] ), true ) &&
|
580 |
+
$btn['type'] !== 'wooccmupload' &&
|
581 |
+
$btn['type'] !== 'heading' &&
|
582 |
+
(
|
583 |
+
$btn['type'] !== 'multiselect' || $btn['type'] !== 'multicheckbox'
|
584 |
+
)
|
585 |
+
) {
|
586 |
+
$new_fields[sprintf( '_%s_%s', $name, $btn['cow'] )] = array(
|
587 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
588 |
+
'value' => get_post_meta( $order_id, sprintf( '_%s_%s', $name, $btn['cow'] ), true )
|
589 |
+
);
|
590 |
+
}
|
591 |
|
592 |
+
if(
|
593 |
+
get_post_meta( $order_id, sprintf( '_%s_%s', $name, $btn['cow'] ), true ) &&
|
594 |
+
$btn['type'] !== 'wooccmupload' &&
|
595 |
+
$btn['type'] !== 'heading' &&
|
596 |
+
(
|
597 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
598 |
+
)
|
599 |
+
) {
|
600 |
+
$new_fields[sprintf( '_%s_%s', $name, $btn['cow'] )]['label'] = wooccm_wpml_string( $btn['label'] );
|
601 |
+
$new_fields[sprintf( '_%s_%s', $name, $btn['cow'] )]['value'] = '';
|
602 |
+
$value = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
|
603 |
+
$strings = maybe_unserialize( $value );
|
604 |
+
if( !empty( $strings ) ) {
|
605 |
+
if( is_array( $strings ) ) {
|
606 |
+
$iww = 0;
|
607 |
+
$len = count( $strings );
|
608 |
+
foreach( $strings as $key ) {
|
609 |
+
if( $iww == $len - 1 ) {
|
610 |
+
$new_fields[sprintf( '_%s_%s', $name, $btn['cow'] )]['value'] .= $key;
|
611 |
+
} else {
|
612 |
+
$new_fields[sprintf( '_%s_%s', $name, $btn['cow'] )]['value'] .= $key.', ';
|
613 |
+
}
|
614 |
+
$iww++;
|
615 |
+
}
|
616 |
+
} else {
|
617 |
+
echo $strings;
|
618 |
+
}
|
619 |
+
} else {
|
620 |
+
echo '-';
|
621 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
622 |
|
623 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
624 |
+
$info = explode( "||",get_post_meta( $order_id, sprintf( '_%s_%s', $name, $btn['cow'] ), true ) );
|
625 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
626 |
+
$new_fields[sprintf( '_%s_%s', $name, $btn['cow'] )] = array(
|
627 |
+
'label' => wooccm_wpml_string( trim( $btn['label'] ) ),
|
628 |
+
'value' => $info[0]
|
629 |
+
);
|
630 |
+
}
|
631 |
|
632 |
+
}
|
633 |
|
634 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
635 |
}
|
636 |
+
$inc--;
|
|
|
|
|
|
|
|
|
|
|
637 |
|
638 |
+
}
|
639 |
|
640 |
+
$options = get_option( 'wccs_settings' );
|
641 |
+
if( !empty( $options['buttons'] ) ) {
|
642 |
+
foreach( $options['buttons'] as $btn ) {
|
643 |
+
|
644 |
+
if(
|
645 |
+
get_post_meta( $order_id, $btn['cow'], true ) &&
|
646 |
+
$btn['type'] !== 'wooccmupload' &&
|
647 |
+
$btn['type'] !== 'heading' &&
|
648 |
+
(
|
649 |
+
$btn['type'] !== 'multiselect' || $btn['type'] !== 'multicheckbox'
|
650 |
+
)
|
651 |
+
) {
|
652 |
+
$new_fields[$btn['cow']] = array(
|
653 |
+
'label' => wooccm_wpml_string( $btn['label'] ),
|
654 |
+
'value' => get_post_meta( $order_id, $btn['cow'], true )
|
655 |
+
);
|
656 |
+
}
|
657 |
|
658 |
+
if(
|
659 |
+
get_post_meta( $order_id, $btn['cow'], true ) &&
|
660 |
+
$btn['type'] !== 'wooccmupload' &&
|
661 |
+
$btn['type'] !== 'heading' &&
|
662 |
+
(
|
663 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
664 |
+
)
|
665 |
+
) {
|
666 |
+
$new_fields[$btn['cow']]['label'] = wooccm_wpml_string( $btn['label'] );
|
667 |
+
$new_fields[$btn['cow']]['value'] = '';
|
668 |
+
$value = get_post_meta( $order_id , $btn['cow'], true );
|
669 |
+
$strings = maybe_unserialize( $value );
|
670 |
+
if( !empty( $strings ) ) {
|
671 |
+
if( is_array( $strings ) ) {
|
672 |
+
$iww = 0;
|
673 |
+
$len = count( $strings );
|
674 |
+
foreach( $strings as $key ) {
|
675 |
+
if( $iww == $len - 1) {
|
676 |
+
$new_fields[$btn['cow']]['value'] .= $key;
|
677 |
+
} else {
|
678 |
+
$new_fields[$btn['cow']]['value'] .= $key.', ';
|
679 |
+
}
|
680 |
+
$iww++;
|
681 |
+
}
|
682 |
+
} else {
|
683 |
+
echo $strings;
|
684 |
+
}
|
685 |
+
} else {
|
686 |
+
echo '-';
|
687 |
+
}
|
688 |
+
}
|
689 |
|
690 |
+
if( $btn['type'] == 'wooccmupload' ){
|
691 |
+
$info = get_post_meta( $order_id, $btn['cow'], true );
|
692 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
693 |
+
$new_fields[$btn['cow']] = array(
|
694 |
+
'label' => wooccm_wpml_string( trim( $btn['label'] ) ),
|
695 |
+
'value' => $info[0]
|
696 |
+
);
|
697 |
+
}
|
698 |
+
}
|
699 |
+
}
|
700 |
|
701 |
+
return array_merge( $fields, $new_fields );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
702 |
|
|
|
|
|
703 |
}
|
704 |
|
|
|
705 |
function wooccm_order_notes( $fields ) {
|
|
|
706 |
|
707 |
+
$options = get_option( 'wccs_settings' );
|
|
|
|
|
708 |
|
709 |
+
if( !empty($options['checkness']['noteslabel']) ) {
|
710 |
+
$fields['order']['order_comments']['label'] = $options['checkness']['noteslabel'];
|
711 |
+
}
|
712 |
+
if( !empty($options['checkness']['notesplaceholder']) ) {
|
713 |
+
$fields['order']['order_comments']['placeholder'] = $options['checkness']['notesplaceholder'];
|
714 |
+
}
|
715 |
+
if( !empty($options['checkness']['notesenable']) ) {
|
716 |
+
unset($fields['order']['order_comments']);
|
717 |
+
}
|
718 |
+
return $fields;
|
719 |
|
|
|
720 |
}
|
721 |
|
722 |
+
function woooccm_restrict_manage_posts() {
|
723 |
|
724 |
+
$options = get_option( 'wccs_settings' );
|
725 |
+
$options2 = get_option( 'wccs_settings2' );
|
726 |
+
$options3 = get_option( 'wccs_settings3' );
|
|
|
|
|
|
|
727 |
|
728 |
+
$billing = array(
|
729 |
+
'country',
|
730 |
+
'first_name',
|
731 |
+
'last_name',
|
732 |
+
'company',
|
733 |
+
'address_1',
|
734 |
+
'address_2',
|
735 |
+
'city',
|
736 |
+
'state',
|
737 |
+
'postcode',
|
738 |
+
'email',
|
739 |
+
'phone'
|
740 |
+
);
|
741 |
+
$shipping = array(
|
742 |
+
'country',
|
743 |
+
'first_name',
|
744 |
+
'last_name',
|
745 |
+
'company',
|
746 |
+
'address_1',
|
747 |
+
'address_2',
|
748 |
+
'city',
|
749 |
+
'state',
|
750 |
+
'postcode'
|
751 |
+
);
|
752 |
+
|
753 |
+
$post_type = 'shop_order';
|
754 |
+
if( get_current_screen()->post_type == $post_type ) {
|
755 |
+
|
756 |
+
$values = array();
|
757 |
+
if( !empty( $options['buttons'] ) ) {
|
758 |
+
foreach( $options['buttons'] as $name ) {
|
759 |
+
$values[$name['label']] = $name['cow'];
|
760 |
+
}
|
761 |
}
|
762 |
+
if( !empty( $values ) ) {
|
763 |
+
array_unique( $values );
|
764 |
}
|
765 |
+
|
766 |
+
$values2 = array();
|
767 |
+
if( !empty( $options2['shipping_buttons'] ) ) {
|
768 |
+
foreach( $options2['shipping_buttons'] as $name ) {
|
769 |
+
if( !in_array( $name['cow'], $shipping ) ) {
|
770 |
+
$values2['Shipping ' . $name['label']] = sprintf( '_shipping_%s', $name['cow'] );
|
771 |
+
}
|
772 |
}
|
773 |
}
|
774 |
+
if( !empty( $values2 ) ) {
|
775 |
+
array_unique( $values2 );
|
776 |
}
|
777 |
+
|
778 |
+
$values3 = array();
|
779 |
+
if( !empty( $options3['billing_buttons'] ) ) {
|
780 |
+
foreach( $options3['billing_buttons'] as $name ) {
|
781 |
+
if( !in_array( $name['cow'], $billing ) ) {
|
782 |
+
$values3['Billing ' . $name['label']] = sprintf( '_billing_%s', $name['cow'] );
|
783 |
+
}
|
784 |
}
|
785 |
}
|
786 |
+
if( !empty( $values3 ) ) {
|
787 |
+
array_unique( $values3 );
|
788 |
}
|
789 |
+
|
790 |
if( !empty($values) && !empty($values2) && !empty($values3) ) {
|
791 |
$values = array_merge($values, $values2);
|
792 |
$values = array_merge($values, $values3);
|
793 |
} elseif( !empty($values) && !empty($values2) && empty($values3) ) {
|
794 |
+
$values = array_merge($values, $values2);
|
795 |
+
} elseif( !empty($values) && empty($values2) && !empty($values3) ) {
|
796 |
+
$values = array_merge($values, $values3);
|
797 |
+
} elseif( empty($values) && !empty($values2) && !empty($values3) ) {
|
798 |
+
$values = array_merge($values2, $values3);
|
799 |
+
} elseif( empty($values) && empty($values2) && !empty($values3) ) {
|
800 |
+
$values = $values3;
|
801 |
+
} elseif( empty($values) && !empty($values2) && empty($values3) ) {
|
802 |
+
$values = $values2;
|
803 |
+
} elseif( !empty($values) && empty($values2) && empty($values3) ) {
|
804 |
+
$values = $values;
|
805 |
+
}
|
806 |
+
?>
|
807 |
+
<select name="wooccm_abbreviation">
|
808 |
+
<?php if( empty($values) && empty($values2) && empty($values3) ) { ?>
|
809 |
+
<option value=""><?php _e('No Added Fields', 'woocommerce-checkout-manager'); ?></option>
|
810 |
+
<?php } else { ?>
|
811 |
+
<option value=""><?php _e('Field Name', 'woocommerce-checkout-manager'); ?></option>
|
812 |
+
<?php } ?>
|
813 |
+
<?php
|
814 |
+
$current_v = ( isset( $_GET['wooccm_abbreviation'] ) ? sanitize_text_field( $_GET['wooccm_abbreviation'] ) : '' );
|
815 |
+
if( !empty( $values ) ) {
|
816 |
+
foreach( $values as $label => $value ) {
|
817 |
+
printf(
|
818 |
+
'<option value="%s"%s>%s</option>',
|
819 |
+
$value,
|
820 |
+
$value == $current_v? ' selected="selected"':'',
|
821 |
+
$label
|
822 |
+
);
|
823 |
+
}
|
824 |
+
}
|
825 |
+
?>
|
826 |
+
</select>
|
827 |
+
<?php
|
828 |
+
|
829 |
+
}
|
|
|
|
|
830 |
|
|
|
|
|
|
|
|
|
|
|
831 |
}
|
832 |
|
833 |
+
function wooccm_query_list( $query ) {
|
834 |
+
|
835 |
+
global $pagenow;
|
836 |
+
|
837 |
+
$wooccm_abbreviation = ( isset( $_GET['wooccm_abbreviation'] ) ? sanitize_text_field( $_GET['wooccm_abbreviation'] ) : '' );
|
838 |
+
if( is_admin() && $pagenow == 'edit.php' && $wooccm_abbreviation != '' ) {
|
839 |
+
$query->query_vars[ 'meta_key' ] = $wooccm_abbreviation;
|
840 |
+
}
|
841 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
842 |
}
|
843 |
|
844 |
// ========================================
|
845 |
// Remove conditional notices
|
846 |
// ========================================
|
847 |
|
848 |
+
function wooccm_remove_notices_conditional( $posted ) {
|
849 |
+
|
850 |
+
$notice = WC()->session->get( 'wc_notices' );
|
851 |
+
|
852 |
+
$shipping = array(
|
853 |
+
'country',
|
854 |
+
'first_name',
|
855 |
+
'last_name',
|
856 |
+
'company',
|
857 |
+
'address_1',
|
858 |
+
'address_2',
|
859 |
+
'city',
|
860 |
+
'state',
|
861 |
+
'postcode'
|
862 |
+
);
|
863 |
+
$billing = array(
|
864 |
+
'country',
|
865 |
+
'first_name',
|
866 |
+
'last_name',
|
867 |
+
'company',
|
868 |
+
'address_1',
|
869 |
+
'address_2',
|
870 |
+
'city',
|
871 |
+
'state',
|
872 |
+
'postcode',
|
873 |
+
'email',
|
874 |
+
'phone'
|
875 |
+
);
|
876 |
|
877 |
+
$options = get_option( 'wccs_settings' );
|
878 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
879 |
+
|
880 |
+
$names = array(
|
881 |
+
'billing',
|
882 |
+
'shipping'
|
883 |
+
);
|
884 |
+
$inc = 3;
|
885 |
+
foreach( $names as $name ) {
|
886 |
+
|
887 |
+
$array = ( $name == 'billing' ) ? $billing : $shipping;
|
888 |
+
|
889 |
+
$options2 = get_option( 'wccs_settings'.$inc );
|
890 |
+
if( !empty( $options2[$name.'_buttons'] ) ) {
|
891 |
+
foreach( $options2[$name.'_buttons'] as $btn ) {
|
892 |
+
|
893 |
+
if(
|
894 |
+
!empty( $btn['chosen_valt'] ) &&
|
895 |
+
!empty( $btn['conditional_parent_use'] ) &&
|
896 |
+
!empty( $btn['conditional_tie'] ) &&
|
897 |
+
$btn['type'] !== 'changename' &&
|
898 |
+
$btn['type'] !== 'heading' &&
|
899 |
+
!empty( $btn['conditional_parent'] )
|
900 |
+
) {
|
901 |
+
if( !empty( $_POST[$btn['cow']] ) ) {
|
902 |
+
foreach( $buttons as $btn2 ) {
|
903 |
+
|
904 |
+
if(
|
905 |
+
!empty( $btn2['chosen_valt'] ) &&
|
906 |
+
!empty( $btn2['conditional_parent_use'] ) &&
|
907 |
+
!empty( $btn2['conditional_tie'] ) &&
|
908 |
+
$btn2['type'] !== 'changename' &&
|
909 |
+
$btn2['type'] !== 'heading' &&
|
910 |
+
empty( $btn2['conditional_parent'] )
|
911 |
+
) {
|
912 |
+
if( sanitize_text_field( $_POST[$btn['cow']] ) != $btn2['chosen_valt'] ) {
|
913 |
+
if( empty( $_POST[$btn2['cow']] ) ) {
|
914 |
+
foreach( $notice['error'] as $position => $value ) {
|
915 |
+
|
916 |
+
if( strip_tags( $value ) == sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), wooccm_wpml_string( $btn2['label'] ) ) ) {
|
917 |
+
unset( $notice['error'][$position] );
|
918 |
+
}
|
919 |
+
|
920 |
+
}
|
921 |
+
}
|
922 |
+
}
|
923 |
+
}
|
924 |
+
}
|
925 |
|
926 |
+
} else {
|
927 |
+
foreach( $notice['error'] as $position => $value ) {
|
|
|
|
|
928 |
|
929 |
+
if( strip_tags( $value ) == sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), wooccm_wpml_string( $btn2['label'] ) ) ) {
|
930 |
+
unset( $notice['error'][$position] );
|
931 |
+
}
|
932 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
933 |
}
|
934 |
}
|
935 |
}
|
936 |
+
|
|
|
937 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
938 |
}
|
939 |
+
$inc--;
|
940 |
+
|
941 |
+
}
|
|
|
|
|
942 |
|
943 |
$options = get_option( 'wccs_settings' );
|
944 |
+
|
945 |
global $woocommerce;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
946 |
|
947 |
+
if( !empty( $options['buttons'] ) ) {
|
948 |
+
foreach( $options['buttons'] as $btn ) {
|
949 |
+
|
950 |
+
if( !empty($btn['chosen_valt']) && !empty($btn['conditional_parent_use']) && !empty($btn['conditional_tie']) && $btn['type'] !== 'changename' && ($btn['type'] !== 'heading') && !empty($btn['conditional_parent']) ) {
|
951 |
|
952 |
+
if( !empty( $_POST[$btn['cow']] ) ) {
|
|
|
953 |
|
954 |
+
foreach( $options['buttons'] as $btn2 ) {
|
|
|
955 |
|
956 |
+
if( !empty($btn2['chosen_valt']) && !empty($btn2['conditional_parent_use']) && !empty($btn2['conditional_tie']) && $btn2['type'] !== 'changename' && ($btn2['type'] !== 'heading') && empty($btn2['conditional_parent']) ) {
|
957 |
+
if( sanitize_text_field( $_POST[$btn['cow']] ) != $btn2['chosen_valt'] ) {
|
958 |
+
if( empty( $_POST[$btn2['cow']] ) ) {
|
959 |
+
foreach( $notice['error'] as $position => $value ) {
|
960 |
|
961 |
+
if( strip_tags($value) == sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), wooccm_wpml_string( $btn2['label'] ) ) ) {
|
962 |
+
unset( $notice['error'][$position] );
|
963 |
+
}
|
|
|
964 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
965 |
}
|
966 |
}
|
967 |
+
}
|
968 |
}
|
|
|
|
|
|
|
|
|
969 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
970 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
971 |
|
972 |
+
} else {
|
|
|
|
|
973 |
|
974 |
+
foreach( $notice['error'] as $position => $value ) {
|
|
|
975 |
|
976 |
+
if( strip_tags($value) == sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), wooccm_wpml_string( $btn2['label'] ) ) ) {
|
977 |
+
unset( $notice['error'][$position] );
|
978 |
+
}
|
979 |
|
980 |
+
}
|
981 |
+
}
|
|
|
982 |
|
983 |
+
}
|
984 |
|
985 |
+
}
|
986 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
987 |
|
988 |
+
WC()->session->set( 'wc_notices', $notice );
|
|
|
|
|
|
|
|
|
|
|
|
|
989 |
|
990 |
+
}
|
991 |
+
add_action( 'woocommerce_after_checkout_validation', 'wooccm_remove_notices_conditional' );
|
992 |
+
?>
|
|
includes/email.php
ADDED
@@ -0,0 +1,367 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wooccm_add_payment_method_to_new_order( $order, $sent_to_admin, $plain_text = '' ) {
|
3 |
+
|
4 |
+
if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) ) {
|
5 |
+
$order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
|
6 |
+
} else {
|
7 |
+
$order_id = ( isset( $order->id ) ? $order->id : 0 );
|
8 |
+
}
|
9 |
+
|
10 |
+
$shipping = array(
|
11 |
+
'country',
|
12 |
+
'first_name',
|
13 |
+
'last_name',
|
14 |
+
'company',
|
15 |
+
'address_1',
|
16 |
+
'address_2',
|
17 |
+
'city',
|
18 |
+
'state',
|
19 |
+
'postcode'
|
20 |
+
);
|
21 |
+
$billing = array(
|
22 |
+
'country',
|
23 |
+
'first_name',
|
24 |
+
'last_name',
|
25 |
+
'company',
|
26 |
+
'address_1',
|
27 |
+
'address_2',
|
28 |
+
'city',
|
29 |
+
'state',
|
30 |
+
'postcode',
|
31 |
+
'email',
|
32 |
+
'phone'
|
33 |
+
);
|
34 |
+
|
35 |
+
$names = array( 'billing', 'shipping' );
|
36 |
+
$inc = 3;
|
37 |
+
|
38 |
+
if( $plain_text ) {
|
39 |
+
|
40 |
+
foreach( $names as $name ) {
|
41 |
+
|
42 |
+
$array = ($name == 'billing') ? $billing : $shipping;
|
43 |
+
|
44 |
+
$options = get_option( 'wccs_settings'.$inc );
|
45 |
+
if( !empty( $options[$name.'_buttons'] ) ) {
|
46 |
+
foreach( $options[$name.'_buttons'] as $btn ) {
|
47 |
+
|
48 |
+
if( !in_array( $btn['cow'], $array ) ) {
|
49 |
+
if(
|
50 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
|
51 |
+
!empty( $btn['label'] ) &&
|
52 |
+
empty( $btn['deny_receipt'] ) &&
|
53 |
+
$btn['type'] !== 'heading' &&
|
54 |
+
$btn['type'] !== 'multiselect' &&
|
55 |
+
$btn['type'] !== 'wooccmupload' &&
|
56 |
+
$btn['type'] !== 'multicheckbox'
|
57 |
+
) {
|
58 |
+
echo wooccm_wpml_string( $btn['label'] ).': '.nl2br( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) );
|
59 |
+
echo "\n";
|
60 |
+
} elseif (
|
61 |
+
!empty( $btn['label'] ) &&
|
62 |
+
empty( $btn['deny_receipt'] ) &&
|
63 |
+
$btn['type'] == 'heading' &&
|
64 |
+
$btn['type'] !== 'multiselect' &&
|
65 |
+
$btn['type'] !== 'wooccmupload' &&
|
66 |
+
$btn['type'] !== 'multicheckbox'
|
67 |
+
) {
|
68 |
+
echo wooccm_wpml_string( $btn['label'] );
|
69 |
+
echo "\n";
|
70 |
+
} elseif(
|
71 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
|
72 |
+
!empty( $btn['label'] ) &&
|
73 |
+
empty( $btn['deny_receipt'] ) &&
|
74 |
+
$btn['type'] !== 'heading' &&
|
75 |
+
$btn['type'] !== 'wooccmupload' &&
|
76 |
+
(
|
77 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
78 |
+
)
|
79 |
+
) {
|
80 |
+
$value = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
|
81 |
+
$strings = maybe_unserialize( $value );
|
82 |
+
echo wooccm_wpml_string($btn['label']).': ';
|
83 |
+
if( !empty( $strings ) ) {
|
84 |
+
if( is_array( $strings ) ) {
|
85 |
+
$iww = 0;
|
86 |
+
$len = count( $strings );
|
87 |
+
foreach( $strings as $key ) {
|
88 |
+
if( $iww == $len - 1 ) {
|
89 |
+
echo $key;
|
90 |
+
} else {
|
91 |
+
echo $key.', ';
|
92 |
+
}
|
93 |
+
$iww++;
|
94 |
+
}
|
95 |
+
} else {
|
96 |
+
echo $strings;
|
97 |
+
}
|
98 |
+
} else {
|
99 |
+
echo '-';
|
100 |
+
}
|
101 |
+
echo "\n";
|
102 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
103 |
+
$info = explode( "||", get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true));
|
104 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
105 |
+
echo wooccm_wpml_string( trim( $btn['label'] ) ).': '.$info[0];
|
106 |
+
echo "\n";
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
}
|
111 |
+
}
|
112 |
+
$inc--;
|
113 |
+
|
114 |
+
}
|
115 |
+
|
116 |
+
$options = get_option( 'wccs_settings' );
|
117 |
+
if( !empty( $options['buttons'] ) ) {
|
118 |
+
foreach( $options['buttons'] as $btn ) {
|
119 |
+
|
120 |
+
if(
|
121 |
+
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
122 |
+
!empty( $btn['label'] ) &&
|
123 |
+
empty( $btn['deny_receipt'] ) &&
|
124 |
+
$btn['type'] !== 'heading' &&
|
125 |
+
$btn['type'] !== 'multiselect' &&
|
126 |
+
$btn['type'] !== 'wooccmupload' &&
|
127 |
+
$btn['type'] !== 'multicheckbox'
|
128 |
+
) {
|
129 |
+
echo wooccm_wpml_string( $btn['label'] ).': '.nl2br( get_post_meta( $order_id , $btn['cow'], true ) );
|
130 |
+
echo "\n";
|
131 |
+
} elseif(
|
132 |
+
!empty( $btn['label'] ) &&
|
133 |
+
empty( $btn['deny_receipt'] ) &&
|
134 |
+
$btn['type'] == 'heading' &&
|
135 |
+
$btn['type'] !== 'multiselect' &&
|
136 |
+
$btn['type'] !== 'wooccmupload' &&
|
137 |
+
$btn['type'] !== 'multicheckbox'
|
138 |
+
) {
|
139 |
+
echo wooccm_wpml_string( $btn['label'] );
|
140 |
+
echo "\n";
|
141 |
+
} elseif(
|
142 |
+
( get_post_meta( $order_id, $btn['cow'], true ) !== '' ) &&
|
143 |
+
!empty( $btn['label'] ) &&
|
144 |
+
empty( $btn['deny_receipt'] ) &&
|
145 |
+
$btn['type'] !== 'heading' &&
|
146 |
+
$btn['type'] !== 'wooccmupload' &&
|
147 |
+
(
|
148 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
149 |
+
)
|
150 |
+
) {
|
151 |
+
$value = get_post_meta( $order_id , $btn['cow'], true );
|
152 |
+
$strings = maybe_unserialize( $value );
|
153 |
+
echo wooccm_wpml_string($btn['label']).': ';
|
154 |
+
if( !empty( $strings ) ) {
|
155 |
+
if( is_array( $strings ) ) {
|
156 |
+
$iww = 0;
|
157 |
+
$len = count($strings);
|
158 |
+
foreach($strings as $key ) {
|
159 |
+
if( $iww == $len - 1 ) {
|
160 |
+
echo $key;
|
161 |
+
} else {
|
162 |
+
echo $key.', ';
|
163 |
+
}
|
164 |
+
$iww++;
|
165 |
+
}
|
166 |
+
} else {
|
167 |
+
echo $strings;
|
168 |
+
}
|
169 |
+
} else {
|
170 |
+
echo '-';
|
171 |
+
}
|
172 |
+
echo "\n";
|
173 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
174 |
+
$info = explode( "||", get_post_meta( $order_id, $btn['cow'], true ) );
|
175 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
176 |
+
echo wooccm_wpml_string( trim( $btn['label'] ) ).': '.$info[0];
|
177 |
+
echo "\n";
|
178 |
+
}
|
179 |
+
|
180 |
+
}
|
181 |
+
}
|
182 |
+
|
183 |
+
if ( !empty( $options['checkness']['set_timezone'] ) ) {
|
184 |
+
date_default_timezone_set( $options['checkness']['set_timezone'] );
|
185 |
+
}
|
186 |
+
$date = ( !empty( $options['checkness']['twenty_hour'] ) ) ? date( "G:i T (P" ).' GMT)' : date( "g:i a" );
|
187 |
+
$options['checkness']['time_stamp'] = ( isset( $options['checkness']['time_stamp'] ) ? $options['checkness']['time_stamp'] : false );
|
188 |
+
if ( $options['checkness']['time_stamp'] == true ) {
|
189 |
+
echo $options['checkness']['time_stamp_title'].' ' . $date . "\n";
|
190 |
+
}
|
191 |
+
if( $order->get_payment_method_title() && isset( $options['checkness']['payment_method_t'] ) && $options['checkness']['payment_method_t'] == true ) {
|
192 |
+
echo $options['checkness']['payment_method_d'].': ' . $order->get_payment_method_title() . "\n";
|
193 |
+
}
|
194 |
+
if( $order->get_shipping_method() && isset( $options['checkness']['shipping_method_t'] ) && $options['checkness']['shipping_method_t'] == true ) {
|
195 |
+
echo $options['checkness']['shipping_method_d'].': ' . $order->get_shipping_method() . "\n";
|
196 |
+
}
|
197 |
+
|
198 |
+
echo "\n";
|
199 |
+
|
200 |
+
} else {
|
201 |
+
|
202 |
+
foreach( $names as $name ) {
|
203 |
+
|
204 |
+
$array = ( $name == 'billing' ) ? $billing : $shipping;
|
205 |
+
|
206 |
+
$options = get_option( 'wccs_settings'.$inc );
|
207 |
+
if( !empty( $options[$name.'_buttons'] ) ) {
|
208 |
+
foreach( $options[$name.'_buttons'] as $btn ) {
|
209 |
+
|
210 |
+
if( !in_array( $btn['cow'], $array ) ) {
|
211 |
+
if(
|
212 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
|
213 |
+
!empty( $btn['label'] ) &&
|
214 |
+
empty( $btn['deny_receipt'] ) &&
|
215 |
+
$btn['type'] !== 'heading' &&
|
216 |
+
$btn['type'] !== 'multiselect' &&
|
217 |
+
$btn['type'] !== 'wooccmupload' &&
|
218 |
+
$btn['type'] !== 'multicheckbox'
|
219 |
+
) {
|
220 |
+
echo '
|
221 |
+
<p>
|
222 |
+
<strong>'.wooccm_wpml_string($btn['label']).':</strong> '.nl2br( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) ).'
|
223 |
+
</p>';
|
224 |
+
} elseif (
|
225 |
+
!empty( $btn['label'] ) &&
|
226 |
+
empty( $btn['deny_receipt'] ) &&
|
227 |
+
$btn['type'] == 'heading' &&
|
228 |
+
$btn['type'] !== 'multiselect' &&
|
229 |
+
$btn['type'] !== 'wooccmupload' &&
|
230 |
+
$btn['type'] !== 'multicheckbox'
|
231 |
+
) {
|
232 |
+
echo '
|
233 |
+
<h2>' .wooccm_wpml_string($btn['label']). '</h2>';
|
234 |
+
} elseif (
|
235 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
|
236 |
+
!empty( $btn['label'] ) &&
|
237 |
+
empty( $btn['deny_receipt'] ) &&
|
238 |
+
$btn['type'] !== 'heading' &&
|
239 |
+
$btn['type'] !== 'wooccmupload' &&
|
240 |
+
(
|
241 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
242 |
+
)
|
243 |
+
) {
|
244 |
+
$value = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
|
245 |
+
$strings = maybe_unserialize( $value );
|
246 |
+
echo '
|
247 |
+
<p>
|
248 |
+
<strong>'.wooccm_wpml_string($btn['label']).':</strong> ';
|
249 |
+
if( !empty( $strings ) ) {
|
250 |
+
if( is_array( $strings ) ) {
|
251 |
+
$iww = 0;
|
252 |
+
$len = count( $strings );
|
253 |
+
foreach( $strings as $key ) {
|
254 |
+
if( $iww == $len - 1 ) {
|
255 |
+
echo $key;
|
256 |
+
} else {
|
257 |
+
echo $key.', ';
|
258 |
+
}
|
259 |
+
$iww++;
|
260 |
+
}
|
261 |
+
} else {
|
262 |
+
echo $strings;
|
263 |
+
}
|
264 |
+
} else {
|
265 |
+
echo '-';
|
266 |
+
}
|
267 |
+
echo '
|
268 |
+
</p>';
|
269 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
270 |
+
$info = explode( "||", get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) );
|
271 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
272 |
+
echo '
|
273 |
+
<p>
|
274 |
+
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> '.$info[0].'
|
275 |
+
</p>';
|
276 |
+
}
|
277 |
+
}
|
278 |
+
|
279 |
+
}
|
280 |
+
}
|
281 |
+
$inc--;
|
282 |
+
|
283 |
+
}
|
284 |
+
|
285 |
+
$options = get_option( 'wccs_settings' );
|
286 |
+
if( !empty( $options['buttons'] ) ) {
|
287 |
+
foreach( $options['buttons'] as $btn ) {
|
288 |
+
|
289 |
+
if(
|
290 |
+
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
291 |
+
!empty( $btn['label'] ) &&
|
292 |
+
empty( $btn['deny_receipt'] ) &&
|
293 |
+
$btn['type'] !== 'heading' &&
|
294 |
+
$btn['type'] !== 'multiselect' &&
|
295 |
+
$btn['type'] !== 'wooccmupload' &&
|
296 |
+
$btn['type'] !== 'multicheckbox'
|
297 |
+
) {
|
298 |
+
echo '<p><strong>'.wooccm_wpml_string( $btn['label'] ).':</strong> '.nl2br( get_post_meta( $order_id , $btn['cow'], true ) ).'</p>';
|
299 |
+
} elseif ( !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] == 'heading') && ($btn['type'] !== 'multiselect') && $btn['type'] !== 'wooccmupload' && ($btn['type'] !== 'multicheckbox') ) {
|
300 |
+
echo '<h2>'.wooccm_wpml_string($btn['label']).'</h2>';
|
301 |
+
} elseif ( ( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) && !empty( $btn['label'] ) && empty($btn['deny_receipt']) && ($btn['type'] !== 'heading') && $btn['type'] !== 'wooccmupload' && (($btn['type'] == 'multiselect') || ($btn['type'] == 'multicheckbox')) ) {
|
302 |
+
$value = get_post_meta( $order_id , $btn['cow'], true );
|
303 |
+
$strings = maybe_unserialize( $value );
|
304 |
+
echo '
|
305 |
+
<p>
|
306 |
+
<strong>'.wooccm_wpml_string($btn['label']).':</strong> ';
|
307 |
+
if( !empty( $strings ) ) {
|
308 |
+
if( is_array( $strings ) ) {
|
309 |
+
$iww = 0;
|
310 |
+
$len = count( $strings );
|
311 |
+
foreach( $strings as $key ) {
|
312 |
+
if( $iww == $len - 1 ) {
|
313 |
+
echo $key;
|
314 |
+
} else {
|
315 |
+
echo $key.', ';
|
316 |
+
}
|
317 |
+
$iww++;
|
318 |
+
}
|
319 |
+
} else {
|
320 |
+
echo $strings;
|
321 |
+
}
|
322 |
+
} else {
|
323 |
+
echo '-';
|
324 |
+
}
|
325 |
+
echo '
|
326 |
+
</p>';
|
327 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
328 |
+
$info = explode( "||", get_post_meta( $order_id , $btn['cow'], true ) );
|
329 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
330 |
+
echo '
|
331 |
+
<p>
|
332 |
+
<strong>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</strong> '.$info[0].'
|
333 |
+
</p>';
|
334 |
+
}
|
335 |
+
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
// @mod - We are not doing any checking for valid TimeZone
|
340 |
+
if ( !empty($options['checkness']['set_timezone']) ) {
|
341 |
+
date_default_timezone_set( $options['checkness']['set_timezone'] );
|
342 |
+
}
|
343 |
+
$date = ( !empty($options['checkness']['twenty_hour'])) ? date("G:i T (P").' GMT)' : date("g:i a");
|
344 |
+
$options['checkness']['time_stamp'] = ( isset( $options['checkness']['time_stamp'] ) ? $options['checkness']['time_stamp'] : false );
|
345 |
+
if( $options['checkness']['time_stamp'] == true ) {
|
346 |
+
echo '
|
347 |
+
<p>
|
348 |
+
<strong>'.$options['checkness']['time_stamp_title'].':</strong> ' . $date . '
|
349 |
+
</p>';
|
350 |
+
}
|
351 |
+
if( $order->get_payment_method_title() && isset( $options['checkness']['payment_method_t'] ) && $options['checkness']['payment_method_t'] == true ) {
|
352 |
+
echo '
|
353 |
+
<p>
|
354 |
+
<strong>'.$options['checkness']['payment_method_d'].':</strong> ' . $order->get_payment_method_title() . '
|
355 |
+
</p>';
|
356 |
+
}
|
357 |
+
if( $order->get_shipping_method() && $options['checkness']['shipping_method_t'] == true ) {
|
358 |
+
echo '
|
359 |
+
<p>
|
360 |
+
<strong>'.$options['checkness']['shipping_method_d'].':</strong> ' . $order->get_shipping_method() . '
|
361 |
+
</p>';
|
362 |
+
}
|
363 |
+
|
364 |
+
}
|
365 |
+
|
366 |
+
}
|
367 |
+
?>
|
includes/export.php
ADDED
@@ -0,0 +1,983 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Exit if accessed directly
|
3 |
+
if ( !defined( 'ABSPATH' ) )
|
4 |
+
exit;
|
5 |
+
|
6 |
+
// add custom column headers
|
7 |
+
function wooccm_csv_export_modify_column_headers( $column_headers ) {
|
8 |
+
|
9 |
+
$new_headers = array();
|
10 |
+
|
11 |
+
$shipping = array(
|
12 |
+
'country',
|
13 |
+
'first_name',
|
14 |
+
'last_name',
|
15 |
+
'company',
|
16 |
+
'address_1',
|
17 |
+
'address_2',
|
18 |
+
'city',
|
19 |
+
'state',
|
20 |
+
'postcode'
|
21 |
+
);
|
22 |
+
$billing = array(
|
23 |
+
'country',
|
24 |
+
'first_name',
|
25 |
+
'last_name',
|
26 |
+
'company',
|
27 |
+
'address_1',
|
28 |
+
'address_2',
|
29 |
+
'city',
|
30 |
+
'state',
|
31 |
+
'postcode',
|
32 |
+
'email',
|
33 |
+
'phone'
|
34 |
+
);
|
35 |
+
|
36 |
+
$names = array(
|
37 |
+
'billing',
|
38 |
+
'shipping'
|
39 |
+
);
|
40 |
+
$inc = 3;
|
41 |
+
foreach( $names as $name ) {
|
42 |
+
|
43 |
+
$array = ( $name == 'billing' ) ? $billing : $shipping;
|
44 |
+
$options = get_option( 'wccs_settings'.$inc );
|
45 |
+
if( !empty( $options[$name.'_buttons'] ) ) {
|
46 |
+
foreach( $options[$name.'_buttons'] as $btn ) {
|
47 |
+
if( !in_array( $btn['cow'], $array ) ) {
|
48 |
+
$new_headers[sprintf( '_%s_%s', $name, $btn['cow'] )] = wooccm_wpml_string($btn['label']);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
$inc--;
|
53 |
+
}
|
54 |
+
|
55 |
+
$options = get_option( 'wccs_settings' );
|
56 |
+
if( !empty( $options['buttons'] ) ) {
|
57 |
+
foreach( $options['buttons'] as $btn ) {
|
58 |
+
$new_headers[$btn['cow']] = wooccm_wpml_string($btn['label']);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
return array_merge( $column_headers, $new_headers );
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
// set the data for each for custom columns
|
67 |
+
function wooccm_csv_export_modify_row_data( $order_data, $order, $csv_generator ) {
|
68 |
+
|
69 |
+
if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) ) {
|
70 |
+
$order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
|
71 |
+
} else {
|
72 |
+
$order_id = ( isset( $order->id ) ? $order->id : 0 );
|
73 |
+
}
|
74 |
+
|
75 |
+
$custom_data = array();
|
76 |
+
|
77 |
+
$shipping = array(
|
78 |
+
'country',
|
79 |
+
'first_name',
|
80 |
+
'last_name',
|
81 |
+
'company',
|
82 |
+
'address_1',
|
83 |
+
'address_2',
|
84 |
+
'city',
|
85 |
+
'state',
|
86 |
+
'postcode'
|
87 |
+
);
|
88 |
+
$billing = array(
|
89 |
+
'country',
|
90 |
+
'first_name',
|
91 |
+
'last_name',
|
92 |
+
'company',
|
93 |
+
'address_1',
|
94 |
+
'address_2',
|
95 |
+
'city',
|
96 |
+
'state',
|
97 |
+
'postcode',
|
98 |
+
'email',
|
99 |
+
'phone'
|
100 |
+
);
|
101 |
+
|
102 |
+
$names = array(
|
103 |
+
'billing',
|
104 |
+
'shipping'
|
105 |
+
);
|
106 |
+
$inc = 3;
|
107 |
+
foreach( $names as $name ) {
|
108 |
+
|
109 |
+
$array = ( $name == 'billing' ) ? $billing : $shipping;
|
110 |
+
|
111 |
+
$options = get_option( 'wccs_settings'.$inc );
|
112 |
+
|
113 |
+
if( !empty( $options[$name.'_buttons'] ) ) {
|
114 |
+
foreach( $options[$name.'_buttons'] as $btn ) {
|
115 |
+
|
116 |
+
if( !in_array( $btn['cow'], $array ) ) {
|
117 |
+
|
118 |
+
if(
|
119 |
+
get_post_meta( $order_id, sprintf( '_%s_%s', $name, $btn['cow'] ), true ) &&
|
120 |
+
$btn['type'] !== 'heading' &&
|
121 |
+
(
|
122 |
+
$btn['type'] !== 'multiselect' || $btn['type'] !== 'multicheckbox'
|
123 |
+
)
|
124 |
+
) {
|
125 |
+
$custom_data[sprintf( '_%s_%s', $name, $btn['cow'] )] = get_post_meta( $order_id, sprintf( '_%s_%s', $name, $btn['cow'] ), true );
|
126 |
+
}
|
127 |
+
|
128 |
+
if(
|
129 |
+
get_post_meta( $order_id, sprintf( '_%s_%s', $name, $btn['cow'] ), true ) &&
|
130 |
+
$btn['type'] !== 'heading' &&
|
131 |
+
$btn['type'] !== 'wooccmupload' &&
|
132 |
+
(
|
133 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
134 |
+
)
|
135 |
+
) {
|
136 |
+
$custom_data[sprintf( '_%s_%s', $name, $btn['cow'] )] = '';
|
137 |
+
$value = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
|
138 |
+
$strings = maybe_unserialize( $value );
|
139 |
+
if( !empty( $strings ) ) {
|
140 |
+
if( is_array( $strings ) ) {
|
141 |
+
$iww = 0;
|
142 |
+
$len = count($strings);
|
143 |
+
foreach( $strings as $key ) {
|
144 |
+
if ( $iww == $len - 1) {
|
145 |
+
$custom_data[sprintf( '_%s_%s', $name, $btn['cow'] )] .= $key;
|
146 |
+
} else {
|
147 |
+
$custom_data[sprintf( '_%s_%s', $name, $btn['cow'] )] .= $key.', ';
|
148 |
+
}
|
149 |
+
$iww++;
|
150 |
+
}
|
151 |
+
} else {
|
152 |
+
echo $strings;
|
153 |
+
}
|
154 |
+
} else {
|
155 |
+
echo '-';
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
}
|
160 |
+
|
161 |
+
}
|
162 |
+
}
|
163 |
+
$inc--;
|
164 |
+
}
|
165 |
+
|
166 |
+
$options = get_option( 'wccs_settings' );
|
167 |
+
if( !empty( $options['buttons'] ) ) {
|
168 |
+
foreach( $options['buttons'] as $btn ) {
|
169 |
+
|
170 |
+
if(
|
171 |
+
get_post_meta( $order_id, $btn['cow'], true ) &&
|
172 |
+
$btn['type'] !== 'heading' &&
|
173 |
+
(
|
174 |
+
$btn['type'] !== 'multiselect' || $btn['type'] !== 'multicheckbox'
|
175 |
+
)
|
176 |
+
) {
|
177 |
+
$custom_data[$btn['cow']] = get_post_meta( $order_id, $btn['cow'], true );
|
178 |
+
}
|
179 |
+
|
180 |
+
if(
|
181 |
+
get_post_meta( $order_id, $btn['cow'], true ) &&
|
182 |
+
$btn['type'] !== 'heading' &&
|
183 |
+
$btn['type'] !== 'wooccmupload' &&
|
184 |
+
(
|
185 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
186 |
+
)
|
187 |
+
) {
|
188 |
+
$custom_data[$btn['cow']] = '';
|
189 |
+
$value = get_post_meta( $order_id, $btn['cow'], true );
|
190 |
+
$strings = maybe_unserialize( $value );
|
191 |
+
if( !empty( $strings ) ) {
|
192 |
+
if( is_array( $strings ) ) {
|
193 |
+
$iww = 0;
|
194 |
+
$len = count($strings);
|
195 |
+
foreach( $strings as $key ) {
|
196 |
+
if( $iww == $len - 1) {
|
197 |
+
$custom_data[$btn['cow']] .= $key;
|
198 |
+
} else {
|
199 |
+
$custom_data[$btn['cow']] .= $key.', ';
|
200 |
+
}
|
201 |
+
$iww++;
|
202 |
+
}
|
203 |
+
echo $strings;
|
204 |
+
}
|
205 |
+
} else {
|
206 |
+
echo '-';
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
// defaults set back
|
214 |
+
$new_order_data = array();
|
215 |
+
|
216 |
+
if( isset( $csv_generator->order_format ) && ( 'default_one_row_per_item' == $csv_generator->order_format || 'legacy_one_row_per_item' == $csv_generator->order_format ) ) {
|
217 |
+
if( !empty( $order_data ) ) {
|
218 |
+
foreach( $order_data as $data ) {
|
219 |
+
$new_order_data[] = array_merge( (array) $data, $custom_data );
|
220 |
+
}
|
221 |
+
}
|
222 |
+
} else {
|
223 |
+
$new_order_data = array_merge( $order_data, $custom_data );
|
224 |
+
}
|
225 |
+
|
226 |
+
return $new_order_data;
|
227 |
+
|
228 |
+
}
|
229 |
+
|
230 |
+
// Exit if accessed directly
|
231 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
232 |
+
|
233 |
+
function wooccm_additional_gen( $tab, $abbr, $section, $wooname = '' ) {
|
234 |
+
|
235 |
+
global $woocommerce, $wpdb;
|
236 |
+
|
237 |
+
$options = get_option( 'wccs_settings' );
|
238 |
+
$options2 = get_option( 'wccs_settings2' ); // shipping
|
239 |
+
$options3 = get_option( 'wccs_settings3' ); // billing
|
240 |
+
|
241 |
+
$args = array(
|
242 |
+
'post_type' => 'shop_order',
|
243 |
+
'posts_per_page' => -1,
|
244 |
+
'post_status' => array( 'wc-processing', 'wc-completed' )
|
245 |
+
);
|
246 |
+
|
247 |
+
$loop = new WP_Query( $args );
|
248 |
+
$csv_output = '';
|
249 |
+
|
250 |
+
$optionname = false;
|
251 |
+
switch( $wooname ) {
|
252 |
+
|
253 |
+
case 'additional':
|
254 |
+
$optionname = $options['buttons'];
|
255 |
+
break;
|
256 |
+
|
257 |
+
case 'shipping':
|
258 |
+
$optionname = $options2['shipping_buttons'];
|
259 |
+
break;
|
260 |
+
|
261 |
+
case 'billing':
|
262 |
+
$optionname = $options3['billing_buttons'];
|
263 |
+
break;
|
264 |
+
|
265 |
+
}
|
266 |
+
|
267 |
+
if( !empty($abbr) && $section == 1 ) {
|
268 |
+
if( $tab == $wooname ) {
|
269 |
+
|
270 |
+
while( $loop->have_posts() ) {
|
271 |
+
$loop->the_post();
|
272 |
+
$order_id = $loop->post->ID;
|
273 |
+
$order = new WC_Order( $order_id );
|
274 |
+
if( get_post_meta($order_id, $abbr, true) ) {
|
275 |
+
$csv_output .= '["'.$order->billing_first_name.' '.$order->billing_last_name.'", "'.get_post_meta($order_id, $abbr, true).'" ], ';
|
276 |
+
}
|
277 |
+
}
|
278 |
+
|
279 |
+
} elseif( $tab == 'heading' ) {
|
280 |
+
|
281 |
+
$csv_output .= '["Name","'.$abbr.'"]';
|
282 |
+
|
283 |
+
}
|
284 |
+
} elseif( empty($abbr) && $section == 2 ) {
|
285 |
+
if( $tab == $wooname ) {
|
286 |
+
|
287 |
+
$listida = array();
|
288 |
+
while ( $loop->have_posts() ) {
|
289 |
+
$loop->the_post();
|
290 |
+
$order_id = $loop->post->ID;
|
291 |
+
$order = new WC_Order( $order_id );
|
292 |
+
if( !empty( $optionname ) ) {
|
293 |
+
foreach( $optionname as $name ) {
|
294 |
+
if ( get_post_meta($order_id, $name['cow'], true) ) {
|
295 |
+
$listida[] = $order_id;
|
296 |
+
}
|
297 |
+
}
|
298 |
+
}
|
299 |
+
}
|
300 |
+
$csv_output = array_unique( $listida );
|
301 |
+
|
302 |
+
} elseif( $tab == 'heading' ) {
|
303 |
+
|
304 |
+
$lista = array();
|
305 |
+
while ( $loop->have_posts() ) {
|
306 |
+
$loop->the_post();
|
307 |
+
$order_id = $loop->post->ID;
|
308 |
+
$order = new WC_Order( $order_id );
|
309 |
+
if( !empty( $optionname ) ) {
|
310 |
+
foreach( $optionname as $n ) {
|
311 |
+
if( get_post_meta($order_id, $n['cow'], true) ) {
|
312 |
+
$lista[] = $n['label'];
|
313 |
+
}
|
314 |
+
}
|
315 |
+
}
|
316 |
+
}
|
317 |
+
$csv_output = array_unique( $lista );
|
318 |
+
|
319 |
+
}
|
320 |
+
}
|
321 |
+
return $csv_output;
|
322 |
+
|
323 |
+
}
|
324 |
+
|
325 |
+
/**
|
326 |
+
* Converting data to CSV [ SETTINGS DATA ]
|
327 |
+
*/
|
328 |
+
function wooccm_generate_csv( $tab = '' ) {
|
329 |
+
|
330 |
+
$options = get_option( 'wccs_settings' );
|
331 |
+
$options2 = get_option( 'wccs_settings2' );
|
332 |
+
$options3 = get_option( 'wccs_settings3' );
|
333 |
+
|
334 |
+
$csv_output = '';
|
335 |
+
switch( $tab ) {
|
336 |
+
|
337 |
+
case 'additional':
|
338 |
+
if ( !empty($options['buttons']) ) {
|
339 |
+
$total = count($options['buttons']) - 1;
|
340 |
+
foreach( $options['buttons'] as $i => $btn ) {
|
341 |
+
if( $i != 999 && !empty($btn['cow']) ) {
|
342 |
+
$csv_output .= '[';
|
343 |
+
foreach( $btn as $n => $dataw ) {
|
344 |
+
$csv_output .= '"'.$dataw.'",';
|
345 |
+
}
|
346 |
+
if( $i != $total ) {
|
347 |
+
$csv_output .= '], ';
|
348 |
+
} else {
|
349 |
+
$csv_output .= ']';
|
350 |
+
}
|
351 |
+
}
|
352 |
+
}
|
353 |
+
}
|
354 |
+
break;
|
355 |
+
|
356 |
+
case 'billing':
|
357 |
+
if( !empty($options3['billing_buttons']) ) {
|
358 |
+
$total = count($options3['billing_buttons']) - 1;
|
359 |
+
foreach( $options3['billing_buttons'] as $i => $btn ) {
|
360 |
+
if( $i != 999 && !empty($btn['cow']) ) {
|
361 |
+
$csv_output .= '[';
|
362 |
+
foreach( $btn as $n => $dataw ) {
|
363 |
+
$csv_output .= '"'.$dataw.'",';
|
364 |
+
}
|
365 |
+
if( $i != $total ) {
|
366 |
+
$csv_output .= '], ';
|
367 |
+
} else {
|
368 |
+
$csv_output .= ']';
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
+
}
|
373 |
+
break;
|
374 |
+
|
375 |
+
case 'shipping':
|
376 |
+
if( !empty($options2['shipping_buttons']) ) {
|
377 |
+
$total = count($options2['shipping_buttons']) -1;
|
378 |
+
foreach( $options2['shipping_buttons'] as $i => $btn) {
|
379 |
+
if( $i != 999 && !empty($btn['cow']) ) {
|
380 |
+
$csv_output .= '[';
|
381 |
+
foreach( $btn as $n => $dataw ) {
|
382 |
+
$csv_output .= '"'.$dataw.'",';
|
383 |
+
}
|
384 |
+
if( $i != $total ) {
|
385 |
+
$csv_output .= '], ';
|
386 |
+
} else {
|
387 |
+
$csv_output .= ']';
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
}
|
392 |
+
break;
|
393 |
+
|
394 |
+
case 'general':
|
395 |
+
if( !empty($options['checkness']) ) {
|
396 |
+
$csv_output .= '[';
|
397 |
+
foreach( $options['checkness'] as $i => $btn ) {
|
398 |
+
$csv_output .= '"'.$btn.'",';
|
399 |
+
}
|
400 |
+
$csv_output .= ']';
|
401 |
+
}
|
402 |
+
break;
|
403 |
+
|
404 |
+
case 'heading':
|
405 |
+
if( !empty($options3['billing_buttons']) ) {
|
406 |
+
$csv_output .= '[';
|
407 |
+
foreach( $options3['billing_buttons'][0] as $n => $dataw) {
|
408 |
+
$csv_output .= '"'.$n.'",';
|
409 |
+
}
|
410 |
+
$csv_output .= ']';
|
411 |
+
}
|
412 |
+
break;
|
413 |
+
|
414 |
+
case 'heading2':
|
415 |
+
if( !empty($options['checkness']) ) {
|
416 |
+
$csv_output .= '[';
|
417 |
+
foreach( $options['checkness'] as $n => $btn) {
|
418 |
+
$csv_output .= '"'.$n.'",';
|
419 |
+
}
|
420 |
+
$csv_output .= ']';
|
421 |
+
}
|
422 |
+
break;
|
423 |
+
|
424 |
+
case 'heading3':
|
425 |
+
if( !empty($options['buttons']) ) {
|
426 |
+
$csv_output .= '[';
|
427 |
+
foreach( $options['buttons'][0] as $n => $dataw) {
|
428 |
+
$csv_output .= '"'.$n.'",';
|
429 |
+
}
|
430 |
+
$csv_output .= ']';
|
431 |
+
}
|
432 |
+
break;
|
433 |
+
|
434 |
+
}
|
435 |
+
return $csv_output;
|
436 |
+
|
437 |
+
}
|
438 |
+
// --------------- END SETTINGS DATA ----------------
|
439 |
+
|
440 |
+
function wooccm_csvall_heading( $heading ) {
|
441 |
+
|
442 |
+
$csv_output = '';
|
443 |
+
$csv_output .= '["Name", ';
|
444 |
+
foreach($heading as $data ){
|
445 |
+
$csv_output .= '"'.$data.'", ';
|
446 |
+
}
|
447 |
+
$csv_output .= ']';
|
448 |
+
return $csv_output;
|
449 |
+
|
450 |
+
}
|
451 |
+
|
452 |
+
function wooccm_csvall_info( $orderids, $wooname = '' ){
|
453 |
+
|
454 |
+
$options = get_option( 'wccs_settings' );
|
455 |
+
$options2 = get_option( 'wccs_settings2' );
|
456 |
+
$options3 = get_option( 'wccs_settings3' );
|
457 |
+
|
458 |
+
$csv_output = '';
|
459 |
+
if( !empty( $orderids ) ) {
|
460 |
+
foreach( $orderids as $order_id ) {
|
461 |
+
$csv_output .= '["'.get_post_meta($order_id, '_billing_first_name', true).' '.get_post_meta($order_id, '_billing_last_name', true).'", ';
|
462 |
+
switch( $wooname ) {
|
463 |
+
|
464 |
+
case 'additional':
|
465 |
+
if( !empty( $options['buttons'] ) ) {
|
466 |
+
foreach( $options['buttons'] as $name2 ) {
|
467 |
+
$csv_output .= '"'.get_post_meta($order_id, $name2['cow'], true).'", ';
|
468 |
+
}
|
469 |
+
}
|
470 |
+
break;
|
471 |
+
|
472 |
+
case 'billing':
|
473 |
+
if( !empty( $options3['billing_buttons'] ) ) {
|
474 |
+
foreach( $options3['billing_buttons'] as $name2 ) {
|
475 |
+
$csv_output .= '"'.get_post_meta($order_id, $name2['cow'], true).'", ';
|
476 |
+
}
|
477 |
+
}
|
478 |
+
break;
|
479 |
+
|
480 |
+
case 'shipping':
|
481 |
+
if( !empty( $options2['shipping_buttons'] ) ) {
|
482 |
+
foreach( $options2['shipping_buttons'] as $name2 ) {
|
483 |
+
$csv_output .= '"'.get_post_meta($order_id, $name2['cow'], true).'", ';
|
484 |
+
}
|
485 |
+
}
|
486 |
+
break;
|
487 |
+
|
488 |
+
}
|
489 |
+
$csv_output .= '], ';
|
490 |
+
}
|
491 |
+
}
|
492 |
+
return $csv_output;
|
493 |
+
|
494 |
+
}
|
495 |
+
|
496 |
+
|
497 |
+
function wooccm_advance_export(){
|
498 |
+
|
499 |
+
$options = get_option( 'wccs_settings' );
|
500 |
+
$options2 = get_option( 'wccs_settings2' );
|
501 |
+
$options3 = get_option( 'wccs_settings3' );
|
502 |
+
|
503 |
+
$single_download = ( isset( $_POST['single-download'] ) ? sanitize_text_field( $_POST['single-download'] ) : false );
|
504 |
+
if( !empty( $single_download ) ) {
|
505 |
+
switch( $single_download ) {
|
506 |
+
|
507 |
+
case 'additional':
|
508 |
+
$csv = wooccm_additional_gen('additional', ( isset( $_POST['selectedval'] ) ? sanitize_text_field( $_POST['selectedval'] ) : false ), 1, 'additional' );
|
509 |
+
$heading = wooccm_additional_gen('heading', ( isset( $_POST['selectedval'] ) ? sanitize_text_field( $_POST['selectedval'] ) : false ), 1, 'additional' );
|
510 |
+
break;
|
511 |
+
|
512 |
+
case 'shipping':
|
513 |
+
$csv = wooccm_additional_gen('shipping', ( isset( $_POST['shippingselectedval'] ) ? sanitize_text_field( $_POST['shippingselectedval'] ) : false ), 1, 'shipping');
|
514 |
+
$heading = wooccm_additional_gen('heading', ( isset( $_POST['shippingselectedval'] ) ? sanitize_text_field( $_POST['shippingselectedval'] ) : false ), 1, 'shipping' );
|
515 |
+
break;
|
516 |
+
|
517 |
+
case 'billing':
|
518 |
+
$csv = wooccm_additional_gen('billing', ( isset( $_POST['billingselectedval'] ) ? $_POST['billingselectedval'] : false ), 1, 'billing' );
|
519 |
+
$heading = wooccm_additional_gen('heading', ( isset( $_POST['billingselectedval'] ) ? $_POST['billingselectedval'] : false ), 1, 'billing' );
|
520 |
+
break;
|
521 |
+
|
522 |
+
}
|
523 |
+
?>
|
524 |
+
|
525 |
+
<script type="text/javascript">
|
526 |
+
jQuery(document).ready(function($) {
|
527 |
+
|
528 |
+
var A = [<?php echo $heading.','.$csv; ?>]; // initialize array of rows with header row as 1st item
|
529 |
+
|
530 |
+
var csvRows = [];
|
531 |
+
for(var i=0, l=A.length; i<l; ++i){ // for each array( [..] ), join with commas for csv
|
532 |
+
for (index = 0; index < A[i].length; ++index) {
|
533 |
+
A[i][index] = '"'+A[i][index]+'"'; // add back quotes for each string, to store special characters and commas
|
534 |
+
}
|
535 |
+
csvRows.push( A[i] ); // put data in a java useable array
|
536 |
+
}
|
537 |
+
|
538 |
+
var csvString = csvRows.join("\n"); // make rows for each array
|
539 |
+
|
540 |
+
var a = document.createElement('a');
|
541 |
+
|
542 |
+
a.href = 'data:attachment/csv,' + encodeURIComponent(csvString);
|
543 |
+
a.target = '_blank';
|
544 |
+
a.download = 'only_additional_fieldname.csv';
|
545 |
+
document.body.appendChild(a);
|
546 |
+
a.click();
|
547 |
+
|
548 |
+
});
|
549 |
+
</script>
|
550 |
+
|
551 |
+
<?php
|
552 |
+
}
|
553 |
+
|
554 |
+
// ----------- ALL DOWNLOAD ---------
|
555 |
+
$all_download = ( isset( $_POST['all-download'] ) ? sanitize_text_field( $_POST['all-download'] ) : false );
|
556 |
+
if( !empty( $all_download ) ) {
|
557 |
+
|
558 |
+
$abbr = '';
|
559 |
+
switch( $all_download ) {
|
560 |
+
|
561 |
+
case 'additional':
|
562 |
+
$csv = wooccm_additional_gen('additional', $abbr, 2);
|
563 |
+
$csv = wooccm_csvall_info($csv, 'additional' );
|
564 |
+
$heading = wooccm_additional_gen('heading', $abbr, 2);
|
565 |
+
$heading = wooccm_csvall_heading($heading);
|
566 |
+
break;
|
567 |
+
|
568 |
+
case 'shipping':
|
569 |
+
$csv = wooccm_additional_gen('additional', $abbr, 2, 'shipping' );
|
570 |
+
$csv = wooccm_csvall_info($csv, 'shipping' );
|
571 |
+
$heading = wooccm_additional_gen('heading', $abbr, 2, 'shipping');
|
572 |
+
$heading = wooccm_csvall_heading($heading);
|
573 |
+
break;
|
574 |
+
|
575 |
+
case 'billing':
|
576 |
+
$csv = wooccm_additional_gen('billing', $abbr, 2, 'billing' );
|
577 |
+
$csv = wooccm_csvall_info($csv, 'billing' );
|
578 |
+
$heading = wooccm_additional_gen('heading', $abbr, 2, 'billing' );
|
579 |
+
$heading = wooccm_csvall_heading($heading);
|
580 |
+
break;
|
581 |
+
|
582 |
+
}
|
583 |
+
?>
|
584 |
+
|
585 |
+
<script type="text/javascript">
|
586 |
+
jQuery(document).ready(function($) {
|
587 |
+
|
588 |
+
var A = [<?php echo $heading.','.$csv; ?>]; // initialize array of rows with header row as 1st item
|
589 |
+
|
590 |
+
var csvRows = [];
|
591 |
+
for(var i=0, l=A.length; i<l; ++i){ // for each array( [..] ), join with commas for csv
|
592 |
+
for (index = 0; index < A[i].length; ++index) {
|
593 |
+
A[i][index] = '"'+A[i][index]+'"'; // add back quotes for each string, to store special characters and commas
|
594 |
+
}
|
595 |
+
csvRows.push( A[i] ); // put data in a java useable array
|
596 |
+
}
|
597 |
+
|
598 |
+
var csvString = csvRows.join("\n"); // make rows for each array
|
599 |
+
|
600 |
+
var a = document.createElement('a');
|
601 |
+
|
602 |
+
a.href = 'data:attachment/csv,' + encodeURIComponent(csvString);
|
603 |
+
a.target = '_blank';
|
604 |
+
a.download = 'only_additional_fieldname.csv';
|
605 |
+
document.body.appendChild(a);
|
606 |
+
a.click();
|
607 |
+
|
608 |
+
});
|
609 |
+
</script>
|
610 |
+
|
611 |
+
<?php
|
612 |
+
}
|
613 |
+
// ---------- END ALL DOWNLOAD --------------
|
614 |
+
|
615 |
+
// ---------- SETTING DOWNLOAD --------------
|
616 |
+
$setting_download = ( isset( $_POST['setting-download'] ) ? sanitize_text_field( $_POST['setting-download'] ) : false );
|
617 |
+
if( !empty( $setting_download ) ) {
|
618 |
+
switch( $setting_download ) {
|
619 |
+
|
620 |
+
case 'additional':
|
621 |
+
$csv = wooccm_generate_csv('additional');
|
622 |
+
$heading = wooccm_generate_csv('heading3');
|
623 |
+
break;
|
624 |
+
|
625 |
+
case 'billing':
|
626 |
+
$csv = wooccm_generate_csv('billing');
|
627 |
+
$heading = wooccm_generate_csv('heading');
|
628 |
+
break;
|
629 |
+
|
630 |
+
case 'shipping':
|
631 |
+
$csv = wooccm_generate_csv('shipping');
|
632 |
+
$heading = wooccm_generate_csv('heading');
|
633 |
+
break;
|
634 |
+
|
635 |
+
case 'general':
|
636 |
+
$csv = wooccm_generate_csv('general');
|
637 |
+
$heading = wooccm_generate_csv('heading2');
|
638 |
+
break;
|
639 |
+
|
640 |
+
}
|
641 |
+
?>
|
642 |
+
|
643 |
+
<script type="text/javascript">
|
644 |
+
jQuery(document).ready(function($) {
|
645 |
+
|
646 |
+
var A = [<?php echo $heading.','.$csv; ?>]; // initialize array of rows with header row as 1st item
|
647 |
+
|
648 |
+
var csvRows = [];
|
649 |
+
for(var i=0, l=A.length; i<l; ++i){ // for each array( [..] ), join with commas for csv
|
650 |
+
for (index = 0; index < A[i].length; ++index) {
|
651 |
+
A[i][index] = '"'+A[i][index]+'"'; // add back quotes for each string, to store special characters and commas
|
652 |
+
}
|
653 |
+
csvRows.push( A[i] ); // put data in a java useable array
|
654 |
+
}
|
655 |
+
|
656 |
+
var csvString = csvRows.join("\n"); // make rows for each array
|
657 |
+
|
658 |
+
var a = document.createElement('a');
|
659 |
+
|
660 |
+
a.href = 'data:attachment/csv,' + encodeURIComponent(csvString);
|
661 |
+
a.target = '_blank';
|
662 |
+
a.download = 'only_additional_fieldname.csv';
|
663 |
+
document.body.appendChild(a);
|
664 |
+
a.click();
|
665 |
+
|
666 |
+
});
|
667 |
+
</script>
|
668 |
+
|
669 |
+
<?php
|
670 |
+
}
|
671 |
+
// ---------------- END SETTING DOWNLOAD --------------
|
672 |
+
?>
|
673 |
+
|
674 |
+
<script type="text/javascript">
|
675 |
+
jQuery(document).ready(function() {
|
676 |
+
jQuery(function () {
|
677 |
+
|
678 |
+
jQuery(".button.single-download.additional").click(function() {
|
679 |
+
jQuery("input[name=single-download]").val("additional");
|
680 |
+
jQuery("#additional_export").submit();
|
681 |
+
});
|
682 |
+
|
683 |
+
jQuery(".button.all-download.additional").click(function() {
|
684 |
+
jQuery("input[name=all-download]").val("additional");
|
685 |
+
jQuery("#additional_export").submit();
|
686 |
+
});
|
687 |
+
|
688 |
+
jQuery(".button.setting-download.additional").click(function() {
|
689 |
+
jQuery("input[name=setting-download]").val("additional");
|
690 |
+
jQuery("#additional_export").submit();
|
691 |
+
});
|
692 |
+
|
693 |
+
<!-- shipping -->
|
694 |
+
jQuery(".button.single-download.shipping").click(function() {
|
695 |
+
jQuery("input[name=single-download]").val("shipping");
|
696 |
+
jQuery("#additional_export").submit();
|
697 |
+
});
|
698 |
+
|
699 |
+
jQuery(".button.all-download.shipping").click(function() {
|
700 |
+
jQuery("input[name=all-download]").val("shipping");
|
701 |
+
jQuery("#additional_export").submit();
|
702 |
+
});
|
703 |
+
jQuery(".button.setting-download.additional").click(function() {
|
704 |
+
jQuery("input[name=setting-download]").val("shipping");
|
705 |
+
jQuery("#additional_export").submit();
|
706 |
+
});
|
707 |
+
<!-- end shipping -->
|
708 |
+
|
709 |
+
<!-- billing -->
|
710 |
+
jQuery(".button.single-download.billing").click(function() {
|
711 |
+
jQuery("input[name=single-download]").val("billing");
|
712 |
+
jQuery("#additional_export").submit();
|
713 |
+
});
|
714 |
+
|
715 |
+
jQuery(".button.all-download.billing").click(function() {
|
716 |
+
jQuery("input[name=all-download]").val("billing");
|
717 |
+
jQuery("#additional_export").submit();
|
718 |
+
});
|
719 |
+
|
720 |
+
jQuery(".button.setting-download.additional").click(function() {
|
721 |
+
jQuery("input[name=setting-download]").val("billing");
|
722 |
+
jQuery("#additional_export").submit();
|
723 |
+
});
|
724 |
+
<!-- end billing -->
|
725 |
+
|
726 |
+
});
|
727 |
+
|
728 |
+
});
|
729 |
+
</script>
|
730 |
+
|
731 |
+
<h2><?php _e( 'WooCommerce Checkout Manager', 'woocommerce-checkout-manager' ); ?></h2>
|
732 |
+
<div class="wrap">
|
733 |
+
|
734 |
+
<div id="content">
|
735 |
+
|
736 |
+
<h2 class="nav-tab-wrapper add_tip_wrap">
|
737 |
+
<a class="nav-tab general-tab nav-tab-active"><?php _e( 'Export', 'woocommerce-checkout-manager' ); ?></a>
|
738 |
+
<a class="nav-tab star" href="https://wordpress.org/support/view/plugin-reviews/woocommerce-checkout-manager?filter=5" target="_blank">
|
739 |
+
<div id="star-five" title="<?php _e('Like the plugin? Rate it! On WordPress.org', 'woocommerce-checkout-manager' ); ?>">
|
740 |
+
<div class="star-rating">
|
741 |
+
<div class="star star-full"></div>
|
742 |
+
<div class="star star-full"></div>
|
743 |
+
<div class="star star-full"></div>
|
744 |
+
<div class="star star-full"></div>
|
745 |
+
<div class="star star-full"></div>
|
746 |
+
</div>
|
747 |
+
<!-- .star-rating -->
|
748 |
+
</div>
|
749 |
+
<!-- #star-five -->
|
750 |
+
</a>
|
751 |
+
</h2>
|
752 |
+
<!-- .nav-tab-wrapper -->
|
753 |
+
|
754 |
+
<ul class="subsubsub">
|
755 |
+
<li><a href="#billing-fields-section"><?php _e( 'Billing Fields', 'woocommerce-checkout-manager' ); ?></a> |</li>
|
756 |
+
<li><a href="#shipping-fields-section"><?php _e( 'Shipping Fields', 'woocommerce-checkout-manager' ); ?></a> |</li>
|
757 |
+
<li><a href="#additional-fields-section"><?php _e( 'Additional Fields', 'woocommerce-checkout-manager' ); ?></a></li>
|
758 |
+
</ul>
|
759 |
+
<!-- .subsubsub -->
|
760 |
+
<br class="clear">
|
761 |
+
|
762 |
+
<h3><?php _e( 'Field Data Export', 'woocommerce-checkout-manager'); ?></h3>
|
763 |
+
|
764 |
+
<div id="welcome-panel" class="welcome-panel heading">
|
765 |
+
|
766 |
+
<form name="additionalexport" method="post" action="" id="additional_export">
|
767 |
+
|
768 |
+
<input type="hidden" name="single-download" val="" />
|
769 |
+
<input type="hidden" name="all-download" val="" />
|
770 |
+
<input type="hidden" name="setting-download" val="" />
|
771 |
+
|
772 |
+
<div id="welcome-panel" class="welcome-panel left billing">
|
773 |
+
|
774 |
+
<!-- BILLING SECTION -->
|
775 |
+
|
776 |
+
<p id="billing-fields-section" class="about-description heading"><?php _e( 'Billing Fields Section', 'woocommerce-checkout-manager'); ?></p>
|
777 |
+
<hr />
|
778 |
+
|
779 |
+
<?php if( !empty( $options3['billing_buttons'] ) ) { ?>
|
780 |
+
<div class="welcome-panel-content">
|
781 |
+
|
782 |
+
<p class="about-description inner"><?php _e( 'Export All Orders with abbreviation name : ', 'woocommerce-checkout-manager'); ?>
|
783 |
+
<select name="billingselectedval">
|
784 |
+
<?php foreach( $options3['billing_buttons'] as $name ) { ?>
|
785 |
+
<option value="<?php echo $name['cow']; ?>"><?php echo $name['cow']; ?></option>
|
786 |
+
<?php } ?>
|
787 |
+
</select>
|
788 |
+
</p>
|
789 |
+
<!-- .about-description inner -->
|
790 |
+
|
791 |
+
<div class="welcome-panel-column-container">
|
792 |
+
<div class="welcome-panel-column">
|
793 |
+
<ul>
|
794 |
+
<li>
|
795 |
+
<a class="button button-primary button-hero single-download billing" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
796 |
+
</li>
|
797 |
+
</ul>
|
798 |
+
</div>
|
799 |
+
</div>
|
800 |
+
<!-- .welcome-panel-column-container -->
|
801 |
+
<?php } ?>
|
802 |
+
|
803 |
+
<div class="sheet"></div>
|
804 |
+
<p style="clear:both;" class="about-description inner"><?php _e( 'Export All Orders', 'woocommerce-checkout-manager'); ?></p>
|
805 |
+
|
806 |
+
<div class="welcome-panel-column-container">
|
807 |
+
<div class="welcome-panel-column">
|
808 |
+
<ul>
|
809 |
+
<li>
|
810 |
+
<a class="button button-primary button-hero all-download billing" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
811 |
+
</li>
|
812 |
+
</ul>
|
813 |
+
</div>
|
814 |
+
</div>
|
815 |
+
<!-- .welcome-panel-column-container -->
|
816 |
+
|
817 |
+
<div class="sheet"></div>
|
818 |
+
<p style="clear:both;" class="about-description inner"><?php _e( 'Export Settings', 'woocommerce-checkout-manager'); ?></p>
|
819 |
+
|
820 |
+
<div class="welcome-panel-column-container">
|
821 |
+
<div class="welcome-panel-column">
|
822 |
+
<ul>
|
823 |
+
<li>
|
824 |
+
<a class="button button-primary button-hero setting-download billing" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
825 |
+
</li>
|
826 |
+
</ul>
|
827 |
+
</div>
|
828 |
+
</div>
|
829 |
+
<!-- .welcome-panel-column-container -->
|
830 |
+
|
831 |
+
</div>
|
832 |
+
<!-- .welcome-panel-content -->
|
833 |
+
</div>
|
834 |
+
<!-- #welcome-panel -->
|
835 |
+
|
836 |
+
<!-- END BILLING SECTION -->
|
837 |
+
|
838 |
+
<div id="welcome-panel" class="welcome-panel left shipping">
|
839 |
+
|
840 |
+
<!-- SHIPPING SECTION -->
|
841 |
+
|
842 |
+
<p id="shipping-fields-section" class="about-description heading"><?php _e( 'Shipping Fields Section', 'woocommerce-checkout-manager'); ?></p>
|
843 |
+
<hr />
|
844 |
+
|
845 |
+
<?php if( !empty( $options2['shipping_buttons'] ) ) { ?>
|
846 |
+
<div class="welcome-panel-content">
|
847 |
+
|
848 |
+
<p class="about-description inner"><?php _e( 'Export All Orders with abbreviation name : ', 'woocommerce-checkout-manager'); ?>
|
849 |
+
<select name="shippingselectedval">
|
850 |
+
<?php foreach( $options2['shipping_buttons'] as $name ) { ?>
|
851 |
+
<option value="<?php echo $name['cow']; ?>"><?php echo $name['cow']; ?></option>
|
852 |
+
<?php } ?>
|
853 |
+
</select>
|
854 |
+
</p>
|
855 |
+
<!-- .about-description inner -->
|
856 |
+
|
857 |
+
<div class="welcome-panel-column-container">
|
858 |
+
<div class="welcome-panel-column">
|
859 |
+
<ul>
|
860 |
+
<li>
|
861 |
+
<a class="button button-primary button-hero single-download shipping" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
862 |
+
</li>
|
863 |
+
</ul>
|
864 |
+
</div>
|
865 |
+
</div>
|
866 |
+
<!-- .welcome-panel-column-container -->
|
867 |
+
<?php } ?>
|
868 |
+
|
869 |
+
<div class="sheet"></div>
|
870 |
+
<p style="clear:both;" class="about-description inner"><?php _e( 'Export All Orders', 'woocommerce-checkout-manager'); ?></p>
|
871 |
+
|
872 |
+
<div class="welcome-panel-column-container">
|
873 |
+
<div class="welcome-panel-column">
|
874 |
+
<ul>
|
875 |
+
<li>
|
876 |
+
<a class="button button-primary button-hero all-download shipping" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
877 |
+
</li>
|
878 |
+
</ul>
|
879 |
+
</div>
|
880 |
+
</div>
|
881 |
+
<!-- .welcome-panel-column-container -->
|
882 |
+
|
883 |
+
<div class="sheet"></div>
|
884 |
+
<p style="clear:both;" class="about-description inner"><?php _e( 'Export Settings', 'woocommerce-checkout-manager'); ?></p>
|
885 |
+
|
886 |
+
<div class="welcome-panel-column-container">
|
887 |
+
<div class="welcome-panel-column">
|
888 |
+
<ul>
|
889 |
+
<li>
|
890 |
+
<a class="button button-primary button-hero setting-download shipping" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
891 |
+
</li>
|
892 |
+
</ul>
|
893 |
+
</div>
|
894 |
+
</div>
|
895 |
+
<!-- .welcome-panel-column-container -->
|
896 |
+
|
897 |
+
</div>
|
898 |
+
<!-- .welcome-panel-content -->
|
899 |
+
|
900 |
+
</div>
|
901 |
+
<!-- #welcome-panel -->
|
902 |
+
|
903 |
+
<!-- END SHIPPING SECTION -->
|
904 |
+
|
905 |
+
<?php if( !empty( $options['buttons'] ) ) { ?>
|
906 |
+
<div id="welcome-panel" class="welcome-panel left">
|
907 |
+
|
908 |
+
<!-- ADDITIONAL SECTION -->
|
909 |
+
<p id="additional-fields-section" class="about-description heading"><?php _e( 'Additional Fields Section', 'woocommerce-checkout-manager'); ?></p>
|
910 |
+
<hr />
|
911 |
+
<div class="welcome-panel-content">
|
912 |
+
|
913 |
+
<p class="about-description inner"><?php _e( 'Export All Orders with abbreviation name : ', 'woocommerce-checkout-manager'); ?>
|
914 |
+
<select name="selectedval">
|
915 |
+
<?php foreach( $options['buttons'] as $name ) { ?>
|
916 |
+
<option value="<?php echo $name['cow']; ?>"><?php echo $name['cow']; ?></option>
|
917 |
+
<?php } ?>
|
918 |
+
</select>
|
919 |
+
</p>
|
920 |
+
<!-- .about-description inner -->
|
921 |
+
|
922 |
+
<div class="welcome-panel-column-container">
|
923 |
+
<div class="welcome-panel-column">
|
924 |
+
<ul>
|
925 |
+
<li>
|
926 |
+
<a class="button button-primary button-hero single-download additional" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
927 |
+
</li>
|
928 |
+
</ul>
|
929 |
+
</div>
|
930 |
+
</div>
|
931 |
+
<!-- .welcome-panel-column-container -->
|
932 |
+
<?php } ?>
|
933 |
+
|
934 |
+
<div class="sheet"></div>
|
935 |
+
<p style="clear:both;" class="about-description inner"><?php _e( 'Export All Orders', 'woocommerce-checkout-manager'); ?></p>
|
936 |
+
|
937 |
+
<div class="welcome-panel-column-container">
|
938 |
+
<div class="welcome-panel-column">
|
939 |
+
<ul>
|
940 |
+
<li>
|
941 |
+
<a class="button button-primary button-hero all-download additional" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
942 |
+
</li>
|
943 |
+
</ul>
|
944 |
+
</div>
|
945 |
+
</div>
|
946 |
+
<!-- .welcome-panel-column-container -->
|
947 |
+
|
948 |
+
<div class="sheet"></div>
|
949 |
+
<p style="clear:both;" class="about-description inner"><?php _e( 'Export Settings', 'woocommerce-checkout-manager'); ?></p>
|
950 |
+
|
951 |
+
<div class="welcome-panel-column-container">
|
952 |
+
<div class="welcome-panel-column">
|
953 |
+
<ul>
|
954 |
+
<li>
|
955 |
+
<a class="button button-primary button-hero setting-download additional" href="#"><?php _e( 'Download', 'woocommerce-checkout-manager'); ?></a>
|
956 |
+
</li>
|
957 |
+
</ul>
|
958 |
+
</div>
|
959 |
+
</div>
|
960 |
+
<!-- .welcome-panel-column-container -->
|
961 |
+
|
962 |
+
</div>
|
963 |
+
<!-- .welcome-panel-content -->
|
964 |
+
|
965 |
+
<!-- // END ADDITIONAL SECTION -->
|
966 |
+
|
967 |
+
</div>
|
968 |
+
<!-- #welcome-panel -->
|
969 |
+
|
970 |
+
</form>
|
971 |
+
<!-- #additional_export -->
|
972 |
+
|
973 |
+
</div>
|
974 |
+
<!-- #welcome-panel -->
|
975 |
+
|
976 |
+
</div>
|
977 |
+
<!-- #content -->
|
978 |
+
|
979 |
+
</div>
|
980 |
+
<!-- .wrap -->
|
981 |
+
<?php
|
982 |
+
}
|
983 |
+
?>
|
includes/formatting.php
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wooccm_mul_array( $val, $array ) {
|
3 |
+
|
4 |
+
if( !empty( $array ) ) {
|
5 |
+
if( is_array( $array ) ) {
|
6 |
+
foreach( $array as $item ) {
|
7 |
+
if( isset( $item['cow'] ) && $item['cow'] == $val ) {
|
8 |
+
return true;
|
9 |
+
}
|
10 |
+
}
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
}
|
15 |
+
|
16 |
+
function wooccm_mul_array2( $val ) {
|
17 |
+
|
18 |
+
global $wpdb;
|
19 |
+
|
20 |
+
foreach( $wpdb->last_result as $item => $tru ) {
|
21 |
+
if( isset($tru->meta_key) && $tru->meta_key == $val ) {
|
22 |
+
return true;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
return false;
|
26 |
+
|
27 |
+
}
|
28 |
+
|
29 |
+
function wooccm_get_value_by_key( $array, $key ) {
|
30 |
+
|
31 |
+
if( !empty( $array ) ) {
|
32 |
+
foreach( $array as $k => $each ){
|
33 |
+
if( $k == $key ) {
|
34 |
+
return $each;
|
35 |
+
}
|
36 |
+
if( is_array( $each ) ) {
|
37 |
+
if( $return = wooccm_get_value_by_key( $each,$key ) ) {
|
38 |
+
return $return;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
function wooccm_does_existw( $array ) {
|
47 |
+
|
48 |
+
if( empty( $array ) )
|
49 |
+
return;
|
50 |
+
|
51 |
+
if( !is_array( $array ) )
|
52 |
+
return;
|
53 |
+
|
54 |
+
foreach( $array as $sub ) {
|
55 |
+
if( wooccm_mul_array2( wooccm_get_value_by_key( $sub, 'cow' ) ) ) {
|
56 |
+
return true;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
function wooccm_clean( $string ) {
|
63 |
+
|
64 |
+
$trim_length = 200; //desired length of text to display
|
65 |
+
$string = str_replace('-', '', $string); // Replaces all spaces with hyphens.
|
66 |
+
$string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
|
67 |
+
// $string = preg_replace('/\s+/', '', strip_tags($string)); // removes html and spaces
|
68 |
+
// $string = preg_replace('/\d/', '', $string); // Replaces multiple hyphens with single one.
|
69 |
+
return rtrim( substr( $string, 0, $trim_length ) );
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
function wooccm_wpml_string( $input = '' ) {
|
74 |
+
|
75 |
+
if( function_exists( 'icl_t' ) ) {
|
76 |
+
return icl_t('WooCommerce Checkout Manager', $input, $input );
|
77 |
+
} else {
|
78 |
+
return $input;
|
79 |
+
}
|
80 |
+
|
81 |
+
}
|
82 |
+
|
83 |
+
// Sort Checkout fields based on order
|
84 |
+
function wooccm_sort_fields( $a, $b ) {
|
85 |
+
|
86 |
+
if( !isset( $a['order'] ) || !isset( $b['order'] ) )
|
87 |
+
return 0;
|
88 |
+
|
89 |
+
if( $a['order'] == $b['order'] )
|
90 |
+
return 0;
|
91 |
+
return ( $a['order'] < $b['order'] ) ? -1 : 1;
|
92 |
+
|
93 |
+
}
|
94 |
+
?>
|
includes/functions.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// We use wooccm_error_log() for reporting to the WooCommerce Logs system
|
3 |
+
function wooccm_error_log( $message = '' ) {
|
4 |
+
|
5 |
+
if( $message == '' )
|
6 |
+
return;
|
7 |
+
|
8 |
+
if( class_exists( 'WC_Logger' ) ) {
|
9 |
+
$logger = new WC_Logger();
|
10 |
+
$logger->add( 'wooccm', $message );
|
11 |
+
return true;
|
12 |
+
} else {
|
13 |
+
// Fallback where the WooCommerce logging engine is unavailable
|
14 |
+
error_log( sprintf( '[checkout-manager] %s', $message ) );
|
15 |
+
}
|
16 |
+
|
17 |
+
}
|
18 |
+
|
19 |
+
function wooccm_get_woo_version() {
|
20 |
+
|
21 |
+
$version = false;
|
22 |
+
if( defined( 'WC_VERSION' ) ) {
|
23 |
+
$version = WC_VERSION;
|
24 |
+
// Backwards compatibility
|
25 |
+
} else if( defined( 'WOOCOMMERCE_VERSION' ) ) {
|
26 |
+
$version = WOOCOMMERCE_VERSION;
|
27 |
+
}
|
28 |
+
return $version;
|
29 |
+
|
30 |
+
}
|
31 |
+
?>
|
includes/install.php
ADDED
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Plugin activation script
|
3 |
+
function wooccm_install() {
|
4 |
+
|
5 |
+
$options = get_option( 'wccs_settings' );
|
6 |
+
$options2 = get_option( 'wccs_settings2' );
|
7 |
+
$options3 = get_option( 'wccs_settings3' );
|
8 |
+
|
9 |
+
update_option( WOOCCM_PREFIX . '_update_notice', 0 );
|
10 |
+
|
11 |
+
if( function_exists( 'icl_register_string' ) ) {
|
12 |
+
icl_register_string( 'WooCommerce Checkout Manager', 'is a required field.', 'is a required field.' );
|
13 |
+
}
|
14 |
+
if( empty( $options['checkness']['position'] ) ) {
|
15 |
+
$options['checkness']['position'] = 'after_order_notes';
|
16 |
+
}
|
17 |
+
if( empty( $options['checkness']['wooccm_notification_email'] ) ) {
|
18 |
+
$options['checkness']['wooccm_notification_email'] = get_option( 'admin_email' );
|
19 |
+
}
|
20 |
+
if( empty( $options['checkness']['payment_method_d'] ) ) {
|
21 |
+
$options['checkness']['payment_method_d'] = 'Payment Method';
|
22 |
+
}
|
23 |
+
if( empty( $options['checkness']['time_stamp_title'] ) ) {
|
24 |
+
$options['checkness']['time_stamp_title'] = 'Order Time';
|
25 |
+
}
|
26 |
+
if( empty( $options['checkness']['payment_method_t'] ) ) {
|
27 |
+
$options['checkness']['payment_method_t'] = '1';
|
28 |
+
}
|
29 |
+
if( empty( $options['checkness']['shipping_method_d'] ) ) {
|
30 |
+
$options['checkness']['shipping_method_d'] = 'Shipping Method';
|
31 |
+
}
|
32 |
+
if( empty( $options['checkness']['shipping_method_t'] ) ) {
|
33 |
+
$options['checkness']['shipping_method_t'] = '1';
|
34 |
+
}
|
35 |
+
if( empty( $options2['shipping_buttons'] ) ) {
|
36 |
+
$shipping = array(
|
37 |
+
'country' => 'Country',
|
38 |
+
'first_name' => 'First Name',
|
39 |
+
'last_name' => 'Last Name',
|
40 |
+
'company' => 'Company Name',
|
41 |
+
'address_1' => 'Address',
|
42 |
+
'address_2' => '',
|
43 |
+
'city' => 'Town/ City',
|
44 |
+
'state' => 'State',
|
45 |
+
'postcode' => 'Zip'
|
46 |
+
);
|
47 |
+
$ship = 0;
|
48 |
+
foreach( $shipping as $name => $value ) {
|
49 |
+
|
50 |
+
$options2['shipping_buttons'][$ship]['label'] = __( $value, 'woocommerce-checkout-manager' );
|
51 |
+
$options2['shipping_buttons'][$ship]['cow'] = $name;
|
52 |
+
$options2['shipping_buttons'][$ship]['checkbox'] = 'true';
|
53 |
+
$options2['shipping_buttons'][$ship]['order'] = $ship + 1;
|
54 |
+
$options2['shipping_buttons'][$ship]['type'] = 'wooccmtext';
|
55 |
+
|
56 |
+
if ( $name == 'country') {
|
57 |
+
$options2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
|
58 |
+
}
|
59 |
+
|
60 |
+
if ( $name == 'first_name') {
|
61 |
+
$options2['shipping_buttons'][$ship]['position'] = 'form-row-first';
|
62 |
+
}
|
63 |
+
|
64 |
+
if ( $name == 'last_name') {
|
65 |
+
$options2['shipping_buttons'][$ship]['position'] = 'form-row-last';
|
66 |
+
$options2['shipping_buttons'][$ship]['clear_row'] = true;
|
67 |
+
}
|
68 |
+
|
69 |
+
if ( $name == 'company') {
|
70 |
+
$options2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
|
71 |
+
}
|
72 |
+
|
73 |
+
if ( $name == 'address_1') {
|
74 |
+
$options2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
|
75 |
+
$options2['shipping_buttons'][$ship]['placeholder'] = __('Street address', 'woocommerce-checkout-manager');
|
76 |
+
}
|
77 |
+
|
78 |
+
if ( $name == 'address_2') {
|
79 |
+
$options2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
|
80 |
+
$options2['shipping_buttons'][$ship]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce-checkout-manager');
|
81 |
+
}
|
82 |
+
|
83 |
+
if ( $name == 'city') {
|
84 |
+
$options2['shipping_buttons'][$ship]['position'] = 'form-row-wide';
|
85 |
+
$options2['shipping_buttons'][$ship]['placeholder'] = __('Town / City', 'woocommerce-checkout-manager');
|
86 |
+
}
|
87 |
+
|
88 |
+
if ( $name == 'state') {
|
89 |
+
$options2['shipping_buttons'][$ship]['position'] = 'form-row-first';
|
90 |
+
}
|
91 |
+
|
92 |
+
if ( $name == 'postcode') {
|
93 |
+
$options2['shipping_buttons'][$ship]['position'] = 'form-row-last';
|
94 |
+
$options2['shipping_buttons'][$ship]['placeholder'] = __('Postcode / Zip', 'woocommerce-checkout-manager');
|
95 |
+
$options2['shipping_buttons'][$ship]['clear_row'] = true;
|
96 |
+
}
|
97 |
+
|
98 |
+
$ship++;
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
if( empty( $options3['billing_buttons'] ) ) {
|
103 |
+
$billing = array(
|
104 |
+
'country' => 'Country',
|
105 |
+
'first_name' => 'First Name',
|
106 |
+
'last_name' => 'Last Name',
|
107 |
+
'company' => 'Company Name',
|
108 |
+
'address_1' => 'Address',
|
109 |
+
'address_2' => '',
|
110 |
+
'city' => 'Town/ City',
|
111 |
+
'state' => 'State',
|
112 |
+
'postcode' => 'Zip',
|
113 |
+
'email' => 'Email Address',
|
114 |
+
'phone' => 'Phone'
|
115 |
+
);
|
116 |
+
$bill = 0;
|
117 |
+
foreach( $billing as $name => $value ) {
|
118 |
+
|
119 |
+
$options3['billing_buttons'][$bill]['label'] = __( $value, 'woocommerce-checkout-manager' );
|
120 |
+
$options3['billing_buttons'][$bill]['cow'] = $name;
|
121 |
+
$options3['billing_buttons'][$bill]['checkbox'] = 'true';
|
122 |
+
$options3['billing_buttons'][$bill]['order'] = $bill + 1;
|
123 |
+
$options3['billing_buttons'][$bill]['type'] = 'wooccmtext';
|
124 |
+
|
125 |
+
if ( $name == 'country') {
|
126 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-wide';
|
127 |
+
}
|
128 |
+
|
129 |
+
if ( $name == 'first_name') {
|
130 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-first';
|
131 |
+
}
|
132 |
+
|
133 |
+
if ( $name == 'last_name') {
|
134 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-last';
|
135 |
+
$options3['billing_buttons'][$bill]['clear_row'] = true;
|
136 |
+
}
|
137 |
+
|
138 |
+
if ( $name == 'company') {
|
139 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-wide';
|
140 |
+
}
|
141 |
+
|
142 |
+
if ( $name == 'address_1') {
|
143 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-wide';
|
144 |
+
$options3['billing_buttons'][$bill]['placeholder'] = __('Street address', 'woocommerce-checkout-manager');
|
145 |
+
}
|
146 |
+
|
147 |
+
if ( $name == 'address_2') {
|
148 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-wide';
|
149 |
+
$options3['billing_buttons'][$bill]['placeholder'] = __('Apartment, suite, unit etc. (optional)', 'woocommerce-checkout-manager');
|
150 |
+
}
|
151 |
+
|
152 |
+
if ( $name == 'city') {
|
153 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-wide';
|
154 |
+
$options3['billing_buttons'][$bill]['placeholder'] = __('Town / City', 'woocommerce-checkout-manager');
|
155 |
+
}
|
156 |
+
|
157 |
+
if ( $name == 'state') {
|
158 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-first';
|
159 |
+
}
|
160 |
+
|
161 |
+
if ( $name == 'postcode') {
|
162 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-last';
|
163 |
+
$options3['billing_buttons'][$bill]['placeholder'] = __('Postcode / Zip', 'woocommerce-checkout-manager');
|
164 |
+
$options3['billing_buttons'][$bill]['clear_row'] = true;
|
165 |
+
}
|
166 |
+
|
167 |
+
if ( $name == 'email') {
|
168 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-first';
|
169 |
+
}
|
170 |
+
|
171 |
+
if ( $name == 'phone') {
|
172 |
+
$options3['billing_buttons'][$bill]['position'] = 'form-row-last';
|
173 |
+
$options3['billing_buttons'][$bill]['clear_row'] = true;
|
174 |
+
}
|
175 |
+
|
176 |
+
$bill++;
|
177 |
+
}
|
178 |
+
}
|
179 |
+
|
180 |
+
if ( !empty($options['buttons']) ) {
|
181 |
+
foreach( $options['buttons'] as $i => $btn ) {
|
182 |
+
|
183 |
+
if( !empty($btn['check_1']) || !empty($btn['check_2']) ) {
|
184 |
+
$options['buttons'][$i]['option_array'] = implode( '||', array( wooccm_wpml_string( $btn['check_1'] ), wooccm_wpml_string( $btn['check_2'] ) ) );
|
185 |
+
$options['buttons'][$i]['check_1'] = '';
|
186 |
+
$options['buttons'][$i]['check_2'] = '';
|
187 |
+
}
|
188 |
+
|
189 |
+
$options['buttons'][$i]['type'] = ( $btn['type'] == 'checkbox' ) ? 'checkbox_wccm' : $btn['type'];
|
190 |
+
$options['buttons'][$i]['type'] = ( $btn['type'] == 'text' ) ? 'wooccmtext' : $btn['type'];
|
191 |
+
$options['buttons'][$i]['type'] = ( $btn['type'] == 'select' ) ? 'wooccmselect' : $btn['type'];
|
192 |
+
$options['buttons'][$i]['type'] = ( $btn['type'] == 'date' ) ? 'datepicker' : $btn['type'];
|
193 |
+
|
194 |
+
if (empty($btn['option_array'])) {
|
195 |
+
$btn['option_array'] = '';
|
196 |
+
}
|
197 |
+
|
198 |
+
$mysecureop = explode( '||', $btn['option_array']);
|
199 |
+
|
200 |
+
if ( !empty($btn['option_a']) ) {
|
201 |
+
array_push($mysecureop, $btn['option_a'] );
|
202 |
+
}
|
203 |
+
|
204 |
+
if ( !empty($btn['option_b']) ) {
|
205 |
+
array_push($mysecureop, $btn['option_b'] );
|
206 |
+
}
|
207 |
+
|
208 |
+
$uniqueThevalues = array_unique($mysecureop);
|
209 |
+
|
210 |
+
$options['buttons'][$i]['option_array'] = implode( '||', $uniqueThevalues);
|
211 |
+
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
+
foreach( $options3['billing_buttons'] as $i => $btn ) {
|
216 |
+
|
217 |
+
if( !empty($btn['check_1']) || !empty($btn['check_2']) ) {
|
218 |
+
$options3['billing_buttons'][$i]['option_array'] = implode( '||', array( wooccm_wpml_string( $btn['check_1'] ), wooccm_wpml_string( $btn['check_2'] ) ) );
|
219 |
+
$options3['billing_buttons'][$i]['check_1'] = '';
|
220 |
+
$options3['billing_buttons'][$i]['check_2'] = '';
|
221 |
+
}
|
222 |
+
|
223 |
+
$options3['billing_buttons'][$i]['type'] = ( $btn['type'] == 'checkbox' ) ? 'checkbox_wccm' : $btn['type'];
|
224 |
+
$options3['billing_buttons'][$i]['type'] = ( $btn['type'] == 'text' ) ? 'wooccmtext' : $btn['type'];
|
225 |
+
$options3['billing_buttons'][$i]['type'] = ( $btn['type'] == 'select' ) ? 'wooccmselect' : $btn['type'];
|
226 |
+
$options3['billing_buttons'][$i]['type'] = ( $btn['type'] == 'date' ) ? 'datepicker' : $btn['type'];
|
227 |
+
|
228 |
+
}
|
229 |
+
|
230 |
+
foreach( $options2['shipping_buttons'] as $i => $btn ) {
|
231 |
+
|
232 |
+
if( !empty($btn['check_1']) || !empty($btn['check_2']) ) {
|
233 |
+
$options2['shipping_buttons'][$i]['option_array'] = implode( '||', array( wooccm_wpml_string( $btn['check_1'] ), wooccm_wpml_string( $btn['check_2'] ) ) );
|
234 |
+
$options2['shipping_buttons'][$i]['check_1'] = '';
|
235 |
+
$options2['shipping_buttons'][$i]['check_2'] = '';
|
236 |
+
}
|
237 |
+
|
238 |
+
$options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'checkbox' ) ? 'checkbox_wccm' : $btn['type'];
|
239 |
+
$options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'text' ) ? 'wooccmtext' : $btn['type'];
|
240 |
+
$options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'select' ) ? 'wooccmselect' : $btn['type'];
|
241 |
+
$options2['shipping_buttons'][$i]['type'] = ( $btn['type'] == 'date' ) ? 'datepicker' : $btn['type'];
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
update_option( 'wccs_settings', $options );
|
246 |
+
update_option( 'wccs_settings2', $options2 );
|
247 |
+
update_option( 'wccs_settings3', $options3 );
|
248 |
+
|
249 |
+
}
|
250 |
+
?>
|
includes/pickers/caman/dist/caman.css
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
@media screen and (max-width: 596px) {
|
31 |
|
32 |
body #caman_content .wooccmsidebar #Filters .Filter {
|
33 |
-
width: 100
|
34 |
}
|
35 |
}
|
36 |
|
@@ -53,9 +53,9 @@ float:left;
|
|
53 |
|
54 |
#Filters .Filter .FilterName p{
|
55 |
margin:0;
|
56 |
-
text-shadow: none
|
57 |
-
text-rendering: optimizeLegibility
|
58 |
-
text-decoration: none
|
59 |
color: #777;
|
60 |
}
|
61 |
|
@@ -115,7 +115,7 @@ box-shadow:inset 1px 1px 3px rgba(0,0,0,0.3);
|
|
115 |
}
|
116 |
|
117 |
#caman_content {
|
118 |
-
color: #fff
|
119 |
text-align: center;
|
120 |
position: fixed;
|
121 |
width: 100%;
|
@@ -132,7 +132,7 @@ box-shadow:inset 1px 1px 3px rgba(0,0,0,0.3);
|
|
132 |
}
|
133 |
|
134 |
#caman_content h3{
|
135 |
-
color: #777
|
136 |
font-weight: normal;
|
137 |
text-shadow: none;
|
138 |
padding-top: 8px;
|
@@ -180,7 +180,7 @@ box-shadow:inset 1px 1px 3px rgba(0,0,0,0.3);
|
|
180 |
}
|
181 |
|
182 |
#caman_content #wooccmtoolbar #close {
|
183 |
-
margin-left: 0
|
184 |
}
|
185 |
|
186 |
#caman_content #wooccmtoolbar .button {
|
30 |
@media screen and (max-width: 596px) {
|
31 |
|
32 |
body #caman_content .wooccmsidebar #Filters .Filter {
|
33 |
+
width: 100%;
|
34 |
}
|
35 |
}
|
36 |
|
53 |
|
54 |
#Filters .Filter .FilterName p{
|
55 |
margin:0;
|
56 |
+
text-shadow: none;
|
57 |
+
text-rendering: optimizeLegibility;
|
58 |
+
text-decoration: none;
|
59 |
color: #777;
|
60 |
}
|
61 |
|
115 |
}
|
116 |
|
117 |
#caman_content {
|
118 |
+
color: #fff;
|
119 |
text-align: center;
|
120 |
position: fixed;
|
121 |
width: 100%;
|
132 |
}
|
133 |
|
134 |
#caman_content h3{
|
135 |
+
color: #777;
|
136 |
font-weight: normal;
|
137 |
text-shadow: none;
|
138 |
padding-top: 8px;
|
180 |
}
|
181 |
|
182 |
#caman_content #wooccmtoolbar #close {
|
183 |
+
margin-left: 0;
|
184 |
}
|
185 |
|
186 |
#caman_content #wooccmtoolbar .button {
|
includes/pickers/caman/proxies/caman_proxy.php
CHANGED
@@ -5,30 +5,46 @@ define('ALLOW_NO_EXT', false);
|
|
5 |
|
6 |
$proxyParam = 'camanProxyUrl';
|
7 |
|
8 |
-
if (
|
9 |
exit;
|
10 |
}
|
11 |
|
12 |
// Grab the URL
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
$urlinfo = parse_url($url, PHP_URL_PATH);
|
16 |
$ext = array_reverse(explode(".", $urlinfo));
|
17 |
|
18 |
$ctype = null;
|
19 |
switch ($ext[0]) {
|
20 |
-
case 'gif': $ctype = 'image/gif'; break;
|
21 |
-
case 'png': $ctype = 'image/png'; break;
|
22 |
-
case 'jpeg':
|
23 |
-
case 'jpg': $ctype = 'image/jpg'; break;
|
24 |
-
default:
|
25 |
-
if (ALLOW_NO_EXT) {
|
26 |
-
$ctype = 'application/octet-stream';
|
27 |
-
} else {
|
28 |
-
exit;
|
29 |
-
}
|
30 |
-
}
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
// Route the image through this script
|
34 |
header("Content-Type: $ctype");
|
5 |
|
6 |
$proxyParam = 'camanProxyUrl';
|
7 |
|
8 |
+
if ( isset( $_GET[$proxyParam] ) == false ) {
|
9 |
exit;
|
10 |
}
|
11 |
|
12 |
// Grab the URL
|
13 |
+
// @mod - Checking if WordPress reaches this far into this part of the Plugin
|
14 |
+
if( function_exists( 'esc_url_raw' ) ) {
|
15 |
+
$url = trim( urldecode( esc_url_raw( $_GET[$proxyParam] ) ) );
|
16 |
+
} else {
|
17 |
+
$url = trim( urldecode( $_GET[$proxyParam] ) );
|
18 |
+
}
|
19 |
|
20 |
$urlinfo = parse_url($url, PHP_URL_PATH);
|
21 |
$ext = array_reverse(explode(".", $urlinfo));
|
22 |
|
23 |
$ctype = null;
|
24 |
switch ($ext[0]) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
case 'gif':
|
27 |
+
$ctype = 'image/gif';
|
28 |
+
break;
|
29 |
+
|
30 |
+
case 'png':
|
31 |
+
$ctype = 'image/png';
|
32 |
+
break;
|
33 |
+
|
34 |
+
case 'jpeg':
|
35 |
+
case 'jpg':
|
36 |
+
$ctype = 'image/jpg';
|
37 |
+
break;
|
38 |
+
|
39 |
+
default:
|
40 |
+
if (ALLOW_NO_EXT) {
|
41 |
+
$ctype = 'application/octet-stream';
|
42 |
+
} else {
|
43 |
+
exit;
|
44 |
+
}
|
45 |
+
break;
|
46 |
+
|
47 |
+
}
|
48 |
|
49 |
// Route the image through this script
|
50 |
header("Content-Type: $ctype");
|
includes/pickers/css/backend_css.css
CHANGED
@@ -1,318 +1,336 @@
|
|
1 |
-
|
2 |
-
width: 1% !important;
|
3 |
-
float:left;
|
4 |
-
margin-right: 14px;
|
5 |
-
}
|
6 |
.refreshwooccm {
|
7 |
border-top: 10px solid #222;
|
8 |
margin-right: 20px;
|
9 |
}
|
|
|
10 |
.button.button-hero {
|
11 |
-
padding: 0px 16px
|
12 |
}
|
13 |
input[type=text] {
|
14 |
-
border: 1px solid #555;
|
15 |
}
|
16 |
td.wccs-remove {
|
17 |
-
text-align: center;
|
18 |
}
|
19 |
td.billing-wccs-remove {
|
20 |
-
text-align: center;
|
21 |
}
|
22 |
select[readonly] {
|
23 |
-
background-color: #eee;
|
24 |
-
color: #333;
|
25 |
}
|
26 |
a.billing-wccs-remove-button, a.shipping-wccs-remove-button, a.wccs-remove-button {
|
27 |
-
font-size: 22px;
|
28 |
-
text-align: center
|
29 |
-
vertical-align: middle;
|
30 |
-
}
|
31 |
-
#general-semi-nav #content-nav-right h3.heading.address {
|
32 |
-
border-bottom: 0;
|
33 |
-
}
|
34 |
-
#general-semi-nav #content-nav-right .option.allow {
|
35 |
-
border-bottom: 0;
|
36 |
}
|
37 |
#general-semi-nav {
|
38 |
-
display: block;
|
39 |
-
clear: both;
|
40 |
-
background-color: #f1f1f1;
|
41 |
}
|
42 |
#main-nav-left {
|
43 |
-
float: left;
|
44 |
-
position: relative;
|
45 |
-
width: 160px;
|
46 |
}
|
47 |
#main-nav-left li {
|
48 |
-
margin-bottom: 0;
|
49 |
-
-moz-box-shadow: inset 0 1px 0 #f9f9f9;
|
50 |
-
-webkit-box-shadow: inset 0 1px 0 #f9f9f9;
|
51 |
-
box-shadow: inset 0 1px 0 #f9f9f9;
|
52 |
-
margin-right: 1px;
|
53 |
-
border-bottom: 1px solid #d8d8d8;
|
54 |
-
cursor: pointer;
|
55 |
}
|
56 |
#main-nav-left li.current {
|
57 |
-
margin-right: 0;
|
58 |
}
|
59 |
#main-nav-left li a, #main-nav-left ul li a:link, #main-nav-left ul li a:visited {
|
60 |
-
display: block;
|
61 |
-
padding: 10px 10px 10px 10px;
|
62 |
-
background-repeat: no-repeat;
|
63 |
-
background-position: 13px 10px;
|
64 |
-
font-weight: bold;
|
65 |
-
font-size: 12px;
|
66 |
-
text-decoration: none;
|
67 |
-
color: #555;
|
68 |
-
opacity: 0.5;
|
69 |
-
outline: none;
|
70 |
}
|
71 |
#main-nav-left ul li.current a {
|
72 |
-
background-color: #fcfcfc;
|
73 |
-
color: #646464;
|
74 |
-
opacity: 1;
|
75 |
-
}
|
76 |
-
#
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
border-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
.option {
|
90 |
-
padding: 10px;
|
91 |
-
border-width: 1px 0;
|
92 |
-
border-style: solid;
|
93 |
-
border-top-color: #fff;
|
94 |
-
border-bottom-color: #dfdfdf;
|
95 |
-
background-color: #f5f5f5;
|
96 |
-
}
|
97 |
-
#
|
98 |
-
width:
|
99 |
-
float:left;
|
100 |
-
margin-right:
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
.info-of {
|
103 |
-
color: #999;
|
104 |
-
font-size: 11px;
|
105 |
-
margin-top: -5px;
|
106 |
-
}
|
107 |
-
#
|
108 |
-
float: left;
|
109 |
-
margin-top: 1px;
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
font-size: 13px;
|
128 |
-
font-weight: bold;
|
129 |
}
|
130 |
#main-nav-left ul {
|
131 |
-
margin-top: 1px;
|
132 |
}
|
133 |
th.wccm_title {
|
134 |
-
text-align: center;
|
135 |
-
font-weight: bold;
|
136 |
-
font-size: 18px;
|
137 |
}
|
138 |
.nav-tab {
|
139 |
-
cursor: pointer;
|
140 |
}
|
141 |
table.widefat.general-semi thead:first-child {
|
142 |
-
border-left: 5px solid #278ab7
|
143 |
}
|
144 |
th.hide_stuff_color.daoo, th.add_amount, th.apply_tick {
|
145 |
-
background: #38B3E4;
|
146 |
-
cursor: pointer;
|
147 |
}
|
148 |
.hide_stuff_color.daoo.current_opener, th.add_amount.current_opener, th.apply_tick.current_opener {
|
149 |
-
background: #FF2876;
|
150 |
-
color: #fff;
|
151 |
}
|
152 |
th.hide_stuff_days {
|
153 |
-
text-align:center;
|
154 |
}
|
155 |
-
.wccs_submit_button {
|
156 |
-
float: left;
|
157 |
-
margin-bottom: 20px
|
158 |
-
margin-
|
159 |
-
|
|
|
|
|
|
|
160 |
}
|
161 |
.reset_form {
|
162 |
-
float: left;
|
163 |
}
|
164 |
.import_form {
|
165 |
-
float: left;
|
166 |
-
margin-left: 15px;
|
167 |
-
margin-top: 10px;
|
168 |
}
|
169 |
.wccm_importer {
|
170 |
-
font-size:
|
171 |
}
|
172 |
-
|
173 |
-
float: left;
|
|
|
174 |
}
|
175 |
#wccs_reset_submit {
|
176 |
-
float: left;
|
177 |
-
margin-bottom: 20px;
|
178 |
-
width: inherit;
|
179 |
-
margin-top: 10px;
|
180 |
-
}
|
181 |
-
.updated.realStop p .make_smalla {
|
182 |
-
font-size: 16px !important;
|
183 |
}
|
184 |
span.heading_smalla {
|
185 |
-
font-
|
186 |
-
float: left;
|
187 |
-
padding-left: 12px;
|
188 |
-
|
189 |
-
|
190 |
}
|
191 |
.updated.jellow p {
|
192 |
-
margin
|
193 |
-
|
194 |
-
padding-top: 12px;
|
195 |
-
padding-bottom: 12px;
|
196 |
-
}
|
197 |
-
.updated.realStop p {
|
198 |
-
font-size: 24px !important;
|
199 |
}
|
200 |
.updated.jellow {
|
201 |
-
border-left: none;
|
202 |
-
text-align: center;
|
203 |
-
padding: 5px;
|
204 |
-
}
|
205 |
-
.button-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
margin-right: 12px;
|
210 |
-
}
|
211 |
-
.wooccm_name_heading {
|
212 |
-
margin-right: 20px;
|
213 |
-
padding: 10px 20px !important;
|
214 |
-
color: #eee;
|
215 |
-
background: #222;
|
216 |
}
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
|
225 |
td.shipping-wccs-order.ui-sortable-handle, td.billing-wccs-order.ui-sortable-handle, td.wccs-order.ui-sortable-handle {
|
226 |
-
width: 3%;
|
227 |
-
color: #aaa;
|
228 |
-
text-align: center;
|
229 |
-
vertical-align: middle;
|
230 |
}
|
231 |
|
232 |
td.wccs-remove a:hover, td.billing-wccs-remove a:hover, td.shipping-wccs-remove a:hover {
|
233 |
-
color:red;
|
234 |
}
|
235 |
td.wccs-remove a, td.billing-wccs-remove a. td.shipping-wccs-remove a {
|
236 |
-
font-size: 20px;
|
237 |
-
font-weight: 700;
|
238 |
}
|
239 |
.wccs-clone, .billing-wccs-clone, .shipping-wccs-clone {
|
240 |
-
display:none;
|
241 |
}
|
242 |
#floatright_set .widefat input {
|
243 |
-
float:right;
|
244 |
}
|
245 |
.wccs_replace {
|
246 |
-
width: 20%;
|
247 |
}
|
248 |
-
.wccs-order, .billing-wccs-order, .shipping-wccs-order {
|
249 |
-
cursor:move;
|
250 |
}
|
251 |
.wccs-table > tbody > tr > td, .billing-wccs-table > tbody > tr > td, .shipping-wccs-table > tbody > tr > td {
|
252 |
-
background: #fff;
|
253 |
-
border: none;
|
254 |
-
padding: 8px;
|
255 |
-
position: relative;
|
256 |
-
vertical-align: middle;
|
257 |
-
text-align: center;
|
258 |
}
|
259 |
|
260 |
table.widefat {
|
261 |
-
background: #FCFCFC;
|
262 |
}
|
263 |
|
264 |
-
.wccs-table > tbody > tr:last-child td, .billing-wccs-table > tbody > tr:last-child td, .shipping-wccs-table > tbody > tr:last-child td {
|
265 |
-
|
266 |
-
|
267 |
-
.wccs-table >
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
|
269 |
.wccs-table tr td.wccs-order,
|
270 |
.wccs-table tr td.billing-wccs-order,
|
271 |
.wccs-table tr th.billing-wccs-order,
|
272 |
.wccs-table tr td.shipping-wccs-order,
|
273 |
.wccs-table tr th.shipping-wccs-order {
|
274 |
-
width: 16px;
|
275 |
-
text-align: center;
|
276 |
-
vertical-align: middle;
|
277 |
-
color: #aaa;
|
278 |
-
text-shadow: #fff 0 1px 0;
|
279 |
}
|
280 |
|
281 |
.wccs-table .wccs-remove, .billing-wccs-table .wccs-remove, .shipping-wccs-table .wccs-remove {
|
282 |
-
width: 16px;
|
283 |
-
vertical-align: middle;
|
284 |
}
|
285 |
.wccs-table input[type="text"], .billing-wccs-table input[type="text"], .shipping-wccs-table input[type="text"] {
|
286 |
-
width: 100%;
|
|
|
|
|
|
|
287 |
}
|
288 |
|
289 |
.wccs-table-footer, .billing-wccs-table-footer, .shipping-wccs-table-footer {
|
290 |
-
position: relative;
|
291 |
-
overflow: hidden;
|
292 |
-
margin-top: 10px;
|
293 |
-
padding: 8px 0;
|
294 |
}
|
295 |
.toggle_shower {
|
296 |
-
color: #278ab7;
|
297 |
-
font-weight: 700
|
298 |
}
|
299 |
.current_opener {
|
300 |
-
color: red;
|
301 |
-
font-weight: 700
|
302 |
}
|
303 |
.spongagge {
|
304 |
-
float: left;
|
305 |
-
position: relative;
|
306 |
-
-moz-transform: rotate(270deg); /* FF3.5+ */
|
307 |
-
-o-transform: rotate(270deg); /* Opera 10.5 */
|
308 |
-
-webkit-transform: rotate(270deg); /* Saf3.1+, Chrome */
|
309 |
-
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); /* IE6,IE7 */
|
310 |
-
-ms-filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); /* IE8 */
|
311 |
-
margin-top: -25%;
|
312 |
}
|
313 |
a.nav-tab.star {
|
314 |
-
background: #fff;
|
315 |
}
|
316 |
div#star-five img {
|
317 |
-
margin-bottom: -5px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
}
|
1 |
+
/*
|
|
|
|
|
|
|
|
|
2 |
.refreshwooccm {
|
3 |
border-top: 10px solid #222;
|
4 |
margin-right: 20px;
|
5 |
}
|
6 |
+
*/
|
7 |
.button.button-hero {
|
8 |
+
padding: 0px 16px;
|
9 |
}
|
10 |
input[type=text] {
|
11 |
+
border: 1px solid #555;
|
12 |
}
|
13 |
td.wccs-remove {
|
14 |
+
text-align: center;
|
15 |
}
|
16 |
td.billing-wccs-remove {
|
17 |
+
text-align: center;
|
18 |
}
|
19 |
select[readonly] {
|
20 |
+
background-color: #eee;
|
21 |
+
color: #333;
|
22 |
}
|
23 |
a.billing-wccs-remove-button, a.shipping-wccs-remove-button, a.wccs-remove-button {
|
24 |
+
font-size: 22px;
|
25 |
+
text-align: center;
|
26 |
+
vertical-align: middle;
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
#general-semi-nav {
|
29 |
+
display: block;
|
30 |
+
clear: both;
|
31 |
+
background-color: #f1f1f1;
|
32 |
}
|
33 |
#main-nav-left {
|
34 |
+
float: left;
|
35 |
+
position: relative;
|
|
|
36 |
}
|
37 |
#main-nav-left li {
|
38 |
+
margin-bottom: 0;
|
39 |
+
-moz-box-shadow: inset 0 1px 0 #f9f9f9;
|
40 |
+
-webkit-box-shadow: inset 0 1px 0 #f9f9f9;
|
41 |
+
box-shadow: inset 0 1px 0 #f9f9f9;
|
42 |
+
margin-right: 1px;
|
43 |
+
border-bottom: 1px solid #d8d8d8;
|
44 |
+
cursor: pointer;
|
45 |
}
|
46 |
#main-nav-left li.current {
|
47 |
+
margin-right: 0;
|
48 |
}
|
49 |
#main-nav-left li a, #main-nav-left ul li a:link, #main-nav-left ul li a:visited {
|
50 |
+
display: block;
|
51 |
+
padding: 10px 10px 10px 10px;
|
52 |
+
background-repeat: no-repeat;
|
53 |
+
background-position: 13px 10px;
|
54 |
+
font-weight: bold;
|
55 |
+
font-size: 12px;
|
56 |
+
text-decoration: none;
|
57 |
+
color: #555;
|
58 |
+
opacity: 0.5;
|
59 |
+
outline: none;
|
60 |
}
|
61 |
#main-nav-left ul li.current a {
|
62 |
+
background-color: #fcfcfc;
|
63 |
+
color: #646464;
|
64 |
+
opacity: 1;
|
65 |
+
}
|
66 |
+
#content-nav-right h3.heading.address {
|
67 |
+
border-bottom: 0;
|
68 |
+
}
|
69 |
+
#content-nav-right .option.allow {
|
70 |
+
border-bottom: 0;
|
71 |
+
}
|
72 |
+
#content-nav-right .option input, #content-nav-right .option select, #content-nav-right .option textarea {
|
73 |
+
margin-bottom: 9px;
|
74 |
+
background-color: #f1f1f1;
|
75 |
+
border: 1px solid;
|
76 |
+
border-color: #ccc #e6e6e6 #e6e6e6 #ccc;
|
77 |
+
width: 340px;
|
78 |
+
padding: 4px;
|
79 |
+
font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, sans-serif;
|
80 |
+
font-size: 12px;
|
81 |
+
}
|
82 |
+
#content-nav-right .option .full-width {
|
83 |
+
width: 100%;
|
84 |
+
}
|
85 |
+
#content-nav-right .section h3.heading.checkbox {
|
86 |
+
border-bottom: 0;
|
87 |
}
|
88 |
.option {
|
89 |
+
padding: 10px;
|
90 |
+
border-width: 1px 0;
|
91 |
+
border-style: solid;
|
92 |
+
border-top-color: #fff;
|
93 |
+
border-bottom-color: #dfdfdf;
|
94 |
+
background-color: #f5f5f5;
|
95 |
+
}
|
96 |
+
#content-nav-right .option input[type="radio"] {
|
97 |
+
width: 1%;
|
98 |
+
float:left;
|
99 |
+
margin-right: 14px;
|
100 |
+
}
|
101 |
+
#content-nav-right .option input[type="checkbox"] {
|
102 |
+
width: 10px;
|
103 |
+
float:left;
|
104 |
+
margin-right: 14px;
|
105 |
}
|
106 |
.info-of {
|
107 |
+
color: #999;
|
108 |
+
font-size: 11px;
|
109 |
+
margin-top: -5px;
|
110 |
+
}
|
111 |
+
#content-nav-right.general-vibe {
|
112 |
+
float: left;
|
113 |
+
margin-top: 1px;
|
114 |
+
margin-left: -1px;
|
115 |
+
padding: 0 14px;
|
116 |
+
padding-bottom: 14px;
|
117 |
+
font-family: "Lucida Grande", Sans-serif;
|
118 |
+
background-color: #FCFCFC;
|
119 |
+
border-left: 1px solid #d8d8d8;
|
120 |
+
-moz-box-shadow: inset 0 1px 0 #fff;
|
121 |
+
-webkit-box-shadow: inset 0 1px 0 #fff;
|
122 |
+
box-shadow: inset 0 1px 0 #fff;
|
123 |
+
}
|
124 |
+
#content-nav-right h3.heading {
|
125 |
+
font-family: Arial, Helvetica, sans-serif;
|
126 |
+
margin: 10px 0 10px 0;
|
127 |
+
padding: 7px 0px;
|
128 |
+
border-bottom: 1px solid #e7e7e7;
|
129 |
+
font-size: 13px;
|
130 |
+
font-weight: bold;
|
|
|
|
|
131 |
}
|
132 |
#main-nav-left ul {
|
133 |
+
margin-top: 1px;
|
134 |
}
|
135 |
th.wccm_title {
|
136 |
+
text-align: center;
|
137 |
+
font-weight: bold;
|
138 |
+
font-size: 18px;
|
139 |
}
|
140 |
.nav-tab {
|
141 |
+
cursor: pointer;
|
142 |
}
|
143 |
table.widefat.general-semi thead:first-child {
|
144 |
+
border-left: 5px solid #278ab7;
|
145 |
}
|
146 |
th.hide_stuff_color.daoo, th.add_amount, th.apply_tick {
|
147 |
+
background: #38B3E4;
|
148 |
+
cursor: pointer;
|
149 |
}
|
150 |
.hide_stuff_color.daoo.current_opener, th.add_amount.current_opener, th.apply_tick.current_opener {
|
151 |
+
background: #FF2876;
|
152 |
+
color: #fff;
|
153 |
}
|
154 |
th.hide_stuff_days {
|
155 |
+
text-align:center;
|
156 |
}
|
157 |
+
input.wccs_submit_button {
|
158 |
+
float: left;
|
159 |
+
margin-bottom: 20px;
|
160 |
+
margin-left: 15px;
|
161 |
+
}
|
162 |
+
input#wccs_reset_submit,
|
163 |
+
input#wccs_submit_button {
|
164 |
+
margin-top:10px;
|
165 |
}
|
166 |
.reset_form {
|
167 |
+
float: left;
|
168 |
}
|
169 |
.import_form {
|
170 |
+
float: left;
|
171 |
+
margin-left: 15px;
|
172 |
+
margin-top: 10px;
|
173 |
}
|
174 |
.wccm_importer {
|
175 |
+
font-size:16px;
|
176 |
}
|
177 |
+
#wccs_import_submit {
|
178 |
+
float: left;
|
179 |
+
margin-right:15px;
|
180 |
}
|
181 |
#wccs_reset_submit {
|
182 |
+
float: left;
|
183 |
+
margin-bottom: 20px;
|
184 |
+
width: inherit;
|
|
|
|
|
|
|
|
|
185 |
}
|
186 |
span.heading_smalla {
|
187 |
+
font-weight:600;
|
188 |
+
float: left;
|
189 |
+
padding-left: 12px;
|
190 |
+
padding-right: 12px;
|
191 |
+
margin-bottom:0.2em;
|
192 |
}
|
193 |
.updated.jellow p {
|
194 |
+
margin:1em 0;
|
195 |
+
padding-top: 0;
|
|
|
|
|
|
|
|
|
|
|
196 |
}
|
197 |
.updated.jellow {
|
198 |
+
border-left: none;
|
199 |
+
text-align: center;
|
200 |
+
padding: 5px;
|
201 |
+
}
|
202 |
+
.button-primary.wccm_importer_submit {
|
203 |
+
margin-top:0.4em;
|
204 |
+
margin-left:12px;
|
205 |
+
display:block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
td.shipping-wccs-order.ui-sortable-handle, td.billing-wccs-order.ui-sortable-handle, td.wccs-order.ui-sortable-handle {
|
209 |
+
width: 3%;
|
210 |
+
color: #aaa;
|
211 |
+
text-align: center;
|
212 |
+
vertical-align: middle;
|
213 |
}
|
214 |
|
215 |
td.wccs-remove a:hover, td.billing-wccs-remove a:hover, td.shipping-wccs-remove a:hover {
|
216 |
+
color:red;
|
217 |
}
|
218 |
td.wccs-remove a, td.billing-wccs-remove a. td.shipping-wccs-remove a {
|
219 |
+
font-size: 20px;
|
220 |
+
font-weight: 700;
|
221 |
}
|
222 |
.wccs-clone, .billing-wccs-clone, .shipping-wccs-clone {
|
223 |
+
display:none;
|
224 |
}
|
225 |
#floatright_set .widefat input {
|
226 |
+
float:right;
|
227 |
}
|
228 |
.wccs_replace {
|
229 |
+
width: 20%;
|
230 |
}
|
231 |
+
td.wccs-order, td.billing-wccs-order, td.shipping-wccs-order {
|
232 |
+
cursor:move;
|
233 |
}
|
234 |
.wccs-table > tbody > tr > td, .billing-wccs-table > tbody > tr > td, .shipping-wccs-table > tbody > tr > td {
|
235 |
+
background: #fff;
|
236 |
+
border: none;
|
237 |
+
padding: 8px;
|
238 |
+
position: relative;
|
239 |
+
vertical-align: middle;
|
240 |
+
text-align: center;
|
241 |
}
|
242 |
|
243 |
table.widefat {
|
244 |
+
background: #FCFCFC;
|
245 |
}
|
246 |
|
247 |
+
.wccs-table > tbody > tr:last-child td, .billing-wccs-table > tbody > tr:last-child td, .shipping-wccs-table > tbody > tr:last-child td {
|
248 |
+
border-bottom: 0 none;
|
249 |
+
}
|
250 |
+
.wccs-table > tbody > tr td:last-child, .billing-wccs-table > tbody > tr td:last-child, .shipping-wccs-table > tbody > tr td:last-child {
|
251 |
+
border-right: 0 none;
|
252 |
+
}
|
253 |
+
.wccs-table > thead > tr > th, .billing-wccs-table > thead > tr > th, .shipping-wccs-table > thead > tr > th {
|
254 |
+
border: none;
|
255 |
+
text-align: center;
|
256 |
+
}
|
257 |
+
.wccs-table > thead > tr > th:last-child, .billing-wccs-table > thead > tr > th:last-child , .shipping-wccs-table > thead > tr > th:last-child {
|
258 |
+
border-right: 0 none;
|
259 |
+
}
|
260 |
|
261 |
.wccs-table tr td.wccs-order,
|
262 |
.wccs-table tr td.billing-wccs-order,
|
263 |
.wccs-table tr th.billing-wccs-order,
|
264 |
.wccs-table tr td.shipping-wccs-order,
|
265 |
.wccs-table tr th.shipping-wccs-order {
|
266 |
+
width: 16px;
|
267 |
+
text-align: center;
|
268 |
+
vertical-align: middle;
|
269 |
+
color: #aaa;
|
270 |
+
text-shadow: #fff 0 1px 0;
|
271 |
}
|
272 |
|
273 |
.wccs-table .wccs-remove, .billing-wccs-table .wccs-remove, .shipping-wccs-table .wccs-remove {
|
274 |
+
width: 16px;
|
275 |
+
vertical-align: middle;
|
276 |
}
|
277 |
.wccs-table input[type="text"], .billing-wccs-table input[type="text"], .shipping-wccs-table input[type="text"] {
|
278 |
+
width: 100%;
|
279 |
+
}
|
280 |
+
.wccs-table tr td.more_toggler1c, .billing-wccs-table tr td.more_toggler1c, .shipping-wccs-table tr td.more_toggler1c {
|
281 |
+
cursor: pointer;
|
282 |
}
|
283 |
|
284 |
.wccs-table-footer, .billing-wccs-table-footer, .shipping-wccs-table-footer {
|
285 |
+
position: relative;
|
286 |
+
overflow: hidden;
|
287 |
+
margin-top: 10px;
|
288 |
+
padding: 8px 0;
|
289 |
}
|
290 |
.toggle_shower {
|
291 |
+
color: #278ab7;
|
292 |
+
font-weight: 700;
|
293 |
}
|
294 |
.current_opener {
|
295 |
+
color: red;
|
296 |
+
font-weight: 700;
|
297 |
}
|
298 |
.spongagge {
|
299 |
+
float: left;
|
300 |
+
position: relative;
|
301 |
+
-moz-transform: rotate(270deg); /* FF3.5+ */
|
302 |
+
-o-transform: rotate(270deg); /* Opera 10.5 */
|
303 |
+
-webkit-transform: rotate(270deg); /* Saf3.1+, Chrome */
|
304 |
+
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); /* IE6,IE7 */
|
305 |
+
-ms-filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3); /* IE8 */
|
306 |
+
margin-top: -25%;
|
307 |
}
|
308 |
a.nav-tab.star {
|
309 |
+
background: #fff;
|
310 |
}
|
311 |
div#star-five img {
|
312 |
+
margin-bottom: -5px;
|
313 |
+
}
|
314 |
+
|
315 |
+
@media screen and (max-width: 680px) {
|
316 |
+
|
317 |
+
#main-nav-left {
|
318 |
+
width: 24%;
|
319 |
+
min-width:135px;
|
320 |
+
}
|
321 |
+
#content-nav-right {
|
322 |
+
width: 70%;
|
323 |
+
}
|
324 |
+
|
325 |
+
}
|
326 |
+
@media screen and (min-width: 681px) {
|
327 |
+
|
328 |
+
#main-nav-left {
|
329 |
+
width: 16%;
|
330 |
+
min-width:135px;
|
331 |
+
}
|
332 |
+
#content-nav-right {
|
333 |
+
width: 76%;
|
334 |
+
}
|
335 |
+
|
336 |
}
|
includes/pickers/include/ui-1.10.0/ui-lightness/dislawooccm.php
DELETED
@@ -1,287 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WooCommerce Checkout Manager Pro
|
4 |
-
*
|
5 |
-
*
|
6 |
-
* Copyright (C) 2014 Ephrain Marchan, trottyzone
|
7 |
-
*
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( !defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
if( !woocmmatl() ) {
|
14 |
-
remove_action('admin_menu', 'wccs_admin_menu_pro');
|
15 |
-
add_action('admin_menu', 'wccs_admin_menu_pro2');
|
16 |
-
}
|
17 |
-
|
18 |
-
|
19 |
-
if ( is_admin() ) {
|
20 |
-
add_action('admin_menu', 'wccm_admin_menu');
|
21 |
-
}
|
22 |
-
|
23 |
-
|
24 |
-
function wccs_admin_menu_pro2() {
|
25 |
-
add_menu_page( __('WooCCM', 'woocommerce-checkout-manager-pro'), __('WooCCM', 'woocommerce-checkout-manager-pro'), 'manage_options', 'woocommerce-checkout-manager-pro' , 'wooccm_welcome_screen', 'dashicons-businessman', 57);
|
26 |
-
}
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
function wccm_admin_menu() {
|
31 |
-
add_submenu_page( 'woocommerce-checkout-manager-pro' , 'License', 'License', 'manage_options', 'License_check_slug', 'pg_eptxml');
|
32 |
-
}
|
33 |
-
|
34 |
-
|
35 |
-
function wooccm_welcome_screen(){ ?>
|
36 |
-
|
37 |
-
<div class="wrap about-wrap">
|
38 |
-
|
39 |
-
<h1 style="margin-right:0px !important;">Welcome to WooCommerce Checkout Manager Pro <?php $version = get_plugin_data( __FILE__); echo $version['Version']; ?></h1>
|
40 |
-
|
41 |
-
<div class="about-text">Thank you for your purchase! WooCommerce Checkout Manager Pro helps you manage the checkout fields using advance options.<br /><br /> Let's Get started! Install your license key provided by your e-mail receipt.</div>
|
42 |
-
|
43 |
-
<div class="changelog headline-feature">
|
44 |
-
<h2>Email Receipt</h2>
|
45 |
-
|
46 |
-
<div class="feature-section">
|
47 |
-
<div class="col">
|
48 |
-
<h3>Installing your license key is quite easy, just a simple matter of copy and paste.</h3>
|
49 |
-
<p>The license key is also called a License Code and can be installed on the <a href="admin.php?page=License_check_slug">License Page</a>.</p>
|
50 |
-
<p>The image at the side shows the Email Receipt that should have been received via email after your purchase.</p>
|
51 |
-
<p>Copy and paste the code next to title of <strong>License Code</strong> without the comma.</p>
|
52 |
-
</div>
|
53 |
-
<div class="col">
|
54 |
-
<img src="<?php echo plugins_url('../../../images/receipt.png', __FILE__); ?>">
|
55 |
-
</div>
|
56 |
-
</div>
|
57 |
-
|
58 |
-
<div class="clear"></div>
|
59 |
-
</div>
|
60 |
-
|
61 |
-
<hr>
|
62 |
-
|
63 |
-
<div class="return-to-dashboard">
|
64 |
-
<a href="admin.php?page=License_check_slug">Go to WooCCM → License</a>
|
65 |
-
</div>
|
66 |
-
<br />
|
67 |
-
<br />
|
68 |
-
<br />
|
69 |
-
|
70 |
-
</div>
|
71 |
-
|
72 |
-
<?php }
|
73 |
-
|
74 |
-
|
75 |
-
function esip($ip_addr)
|
76 |
-
{
|
77 |
-
//first of all the format of the ip address is matched
|
78 |
-
if(preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$ip_addr))
|
79 |
-
{
|
80 |
-
//now all the intger values are separated
|
81 |
-
$parts=explode(".",$ip_addr);
|
82 |
-
//now we need to check each part can range from 0-255
|
83 |
-
foreach($parts as $ip_parts)
|
84 |
-
{
|
85 |
-
if(intval($ip_parts)>255 || intval($ip_parts)<0)
|
86 |
-
return FALSE; //if number is not within range of 0-255
|
87 |
-
}
|
88 |
-
return TRUE;
|
89 |
-
}
|
90 |
-
else
|
91 |
-
return FALSE; //if format of ip address doesn't matches
|
92 |
-
}
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
function domain($domainb)
|
97 |
-
{
|
98 |
-
$bits = explode('/', $domainb);
|
99 |
-
if ($bits[0]=='http:' || $bits[0]=='https:')
|
100 |
-
{
|
101 |
-
$domainb= $bits[2];
|
102 |
-
} else {
|
103 |
-
$domainb= $bits[0];
|
104 |
-
}
|
105 |
-
unset($bits);
|
106 |
-
$bits = explode('.', $domainb);
|
107 |
-
$idz=count($bits);
|
108 |
-
$idz-=3;
|
109 |
-
if (strlen($bits[($idz+2)])==2) {
|
110 |
-
$url=$bits[$idz].'.'.$bits[($idz+1)].'.'.$bits[($idz+2)];
|
111 |
-
} else if (strlen($bits[($idz+2)])==0) {
|
112 |
-
$url=$bits[($idz)].'.'.$bits[($idz+1)];
|
113 |
-
} else {
|
114 |
-
$url=$bits[($idz+1)].'.'.$bits[($idz+2)];
|
115 |
-
}
|
116 |
-
return $url;
|
117 |
-
}
|
118 |
-
|
119 |
-
function check_domainIP( $domain ) {
|
120 |
-
$bits = explode('.', $domain);
|
121 |
-
|
122 |
-
if ( count( $bits ) == 4 ) {
|
123 |
-
if ( is_numeric($bits[0]) && is_numeric($bits[1]) && is_numeric($bits[2]) && is_numeric($bits[3]) ) {
|
124 |
-
return true;
|
125 |
-
}
|
126 |
-
else {
|
127 |
-
return false;
|
128 |
-
}
|
129 |
-
} else {
|
130 |
-
return false;
|
131 |
-
}
|
132 |
-
|
133 |
-
}
|
134 |
-
|
135 |
-
|
136 |
-
add_option( 'wccmkelizn32aunique', '0' );
|
137 |
-
function pg_eptxml() {
|
138 |
-
if( isset($_POST['lw_eptxml']) ) {
|
139 |
-
if (substr($_POST['lw_eptxml'],-1,1) == ',') {
|
140 |
-
$_POST['lw_eptxml'] = str_replace(',','',$_POST['lw_eptxml']);
|
141 |
-
}
|
142 |
-
update_option( 'wccmkelizn32aunique', $_POST['lw_eptxml'] );
|
143 |
-
echo '<div class="updated"><p><strong>'.__('License Code Saved.').'</strong></p></div>';
|
144 |
-
}
|
145 |
-
?>
|
146 |
-
|
147 |
-
<div class="wrap"></div>
|
148 |
-
|
149 |
-
<style type="text/css">
|
150 |
-
#lw_eptxml {
|
151 |
-
width:55.8%;
|
152 |
-
}
|
153 |
-
.no {
|
154 |
-
background:red;
|
155 |
-
padding:25.5%;
|
156 |
-
color:#fff;
|
157 |
-
}
|
158 |
-
.yes{
|
159 |
-
background:green;
|
160 |
-
padding:26%;
|
161 |
-
color:#fff;
|
162 |
-
}
|
163 |
-
h1.heading-blue {
|
164 |
-
font-size: 1.5em;
|
165 |
-
margin-right: 0px !important;
|
166 |
-
background: #222;
|
167 |
-
border-color: #0074a2;
|
168 |
-
padding: 20px 20px 20px 26px;
|
169 |
-
color: #eee;
|
170 |
-
}
|
171 |
-
form.form-left, .welcome-panel.left {
|
172 |
-
margin-left: 20px;
|
173 |
-
max-width: 1050px;
|
174 |
-
}
|
175 |
-
div#welcome-panel {
|
176 |
-
padding-right: 0px;
|
177 |
-
max-width: 1040px;
|
178 |
-
}
|
179 |
-
.return-to-dashboard {
|
180 |
-
float: right;
|
181 |
-
margin-right: 23px;
|
182 |
-
font-weight: bold;
|
183 |
-
margin-top: 5px;
|
184 |
-
}
|
185 |
-
</style>
|
186 |
-
|
187 |
-
|
188 |
-
<div class="wrap about-wrap">
|
189 |
-
<h1 class="heading-blue">License Page</h1>
|
190 |
-
</div>
|
191 |
-
|
192 |
-
|
193 |
-
<?php if ( !function_exists('curl_version') ) { echo '<div class="error" style="padding:10px !important;font-size:14px;margin-left:0px !important">'.__('Please contact your hosting company to enable cURL. Plugin will need this to activate.', 'woocommerce-checkout-manager-pro').'</div>'; } ?>
|
194 |
-
|
195 |
-
|
196 |
-
<form action="admin.php?page=License_check_slug" method="post" class="form-left">
|
197 |
-
<table style="margin-top:20px;padding-left: 20px;padding-top: 10px;padding-bottom: 10px;" class="wp-list-table widefat tags ui-sortable">
|
198 |
-
<thead>
|
199 |
-
<tr>
|
200 |
-
<th><?php _e('Licensing Validator','woocommerce-checkout-manager-pro'); ?></th>
|
201 |
-
<th>
|
202 |
-
<span style="font-size: 11px;color:red;">
|
203 |
-
<?php
|
204 |
-
if ( !woocmmatl() && get_option('errfafvetcgrt6434cwooccminfo15907833') == 'connection_error' ) {
|
205 |
-
_e('Unable to connect! ', 'woocommerce-checkout-manager-pro'); echo get_option('hostnamewooccmerrfafvetcgrt6434cwooccminfo15907833').'. '; _e('Please contact your hosting company to add trottyzone.com to the whitelist.','woocommerce-checkout-manager-pro');
|
206 |
-
}elseif (woocmmatl() && get_option('errfafvetcgrt6434cwooccminfo15907833') == 'clear') {
|
207 |
-
|
208 |
-
}elseif ( !woocmmatl() && get_option('errfafvetcgrt6434cwooccminfo15907833') == 'change_site' ) {
|
209 |
-
_e('Current site running the plguin is not registered. Click Change Site button to register this site.', 'woocommerce-checkout-manager-pro');
|
210 |
-
}elseif ( !woocmmatl() && get_option('errfafvetcgrt6434cwooccminfo15907833') == 'not_exsit') {
|
211 |
-
_e('License Code does not exist! Please check the code.', 'woocommerce-checkout-manager-pro');
|
212 |
-
}
|
213 |
-
|
214 |
-
?>
|
215 |
-
</span>
|
216 |
-
</th>
|
217 |
-
</tr>
|
218 |
-
</thead>
|
219 |
-
|
220 |
-
<tbody>
|
221 |
-
<tr>
|
222 |
-
<td><?php _e('Status','woocommerce-checkout-manager-pro'); ?></td>
|
223 |
-
<td>
|
224 |
-
|
225 |
-
<?php if( woocmmatl() ) { ?>
|
226 |
-
<span class="yes"><?php _e('Valid','woocommerce-checkout-manager-pro'); ?></span>
|
227 |
-
<?php } ?>
|
228 |
-
|
229 |
-
<?php if( !woocmmatl() ) { ?>
|
230 |
-
<span class="no"><?php _e('Invalid','woocommerce-checkout-manager-pro'); ?></span>
|
231 |
-
<?php } ?>
|
232 |
-
|
233 |
-
</td>
|
234 |
-
</tr>
|
235 |
-
</tbody>
|
236 |
-
|
237 |
-
|
238 |
-
<tbody>
|
239 |
-
<tr>
|
240 |
-
<td><?php _e('License Code','woocommerce-checkout-manager-pro'); ?></td>
|
241 |
-
<td><input id="lw_eptxml" name="lw_eptxml" size="70" type="text" value="<?php echo get_option('wccmkelizn32aunique'); ?>" /></td>
|
242 |
-
</tr>
|
243 |
-
|
244 |
-
<tr>
|
245 |
-
<td><a href="http://www.trottyzone.com/edit-account/"><input type="button" class="button-secondary" value="<?php _e('Change Site','woocommerce-checkout-manager-pro'); ?>" /></a></td>
|
246 |
-
<td><input type="submit" class="button-primary" value="<?php _e('Validate','woocommerce-checkout-manager-pro'); ?>" />
|
247 |
-
|
248 |
-
<?php if ( woocmmatl() ) { ?>
|
249 |
-
<div class="return-to-dashboard">
|
250 |
-
<a class="return-dashboard-blue" href="admin.php?page=woocommerce-checkout-manager-pro/woocommerce-checkout-manager-pro.php">← Go to WooCCM</a>
|
251 |
-
</div>
|
252 |
-
<?php } ?>
|
253 |
-
|
254 |
-
|
255 |
-
</td>
|
256 |
-
</tr>
|
257 |
-
</tbody>
|
258 |
-
|
259 |
-
</table>
|
260 |
-
</form>
|
261 |
-
|
262 |
-
|
263 |
-
<div id="welcome-panel" class="welcome-panel left">
|
264 |
-
<div class="welcome-panel-content">
|
265 |
-
<h3>Welcome to WooCommerce Checkout Manager!</h3>
|
266 |
-
<p class="about-description">Above is the plugin's License Code Validator, it will activate the plugin.</p>
|
267 |
-
<p class="about-description">Just need to enter in the license code that is provided in the plugin <b>e-mail receipt</b> or you can view the license code <b>on trottyzone.com</b></p>
|
268 |
-
|
269 |
-
<div class="welcome-panel-column-container">
|
270 |
-
<div class="welcome-panel-column">
|
271 |
-
<ul>
|
272 |
-
<a class="button button-primary button-hero" href="http://www.trottyzone.com/edit-account/">Login to trottyzone.com</a>
|
273 |
-
</ul>
|
274 |
-
</div>
|
275 |
-
<div class="welcome-panel-column">
|
276 |
-
<ul>
|
277 |
-
<a class="button button-primary button-hero" href="http://www.trottyzone.com/woocommerce-checkout-manager-pro-documentation/">Proceed to documentation</a>
|
278 |
-
</ul>
|
279 |
-
</div>
|
280 |
-
<p>Note: The <b>Change Site</b> button allows you to change the website URL for the license code on <a href="http://www.trottyzone.com/">trottyzone.com</a>. Support is also available at the plugin's <a href="http://www.trottyzone.com/forums/forum/wooccm/">forum</a>.
|
281 |
-
</div>
|
282 |
-
</div>
|
283 |
-
</div>
|
284 |
-
<?php
|
285 |
-
}
|
286 |
-
|
287 |
-
function woocmmatl() { global $wp_version; $address= $_SERVER['HTTP_HOST']; if ( check_domainIP( $address ) == false ) { $parsed_url = parse_url($address); $check = @esip($parsed_url['host']); $host = @$parsed_url['host']; if ($check == FALSE){ if ($host != ""){ if ( substr(domain($host), 0, 1) == '.' ) { $host = str_replace('www.','',substr(domain($host), 1)); } else { $host = str_replace('www.','',domain($host)); } }else{ if ( substr(domain($address), 0, 1) == '.' ) { $host = str_replace('www.','',substr(domain($address), 1)); } else { $host = str_replace('www.','',domain($address)); } } } } else { $host = $address; } $valuexg = get_option('wccmkelizn32aunique'); if ( strpos($_SERVER['REQUEST_URI'], 'License_check_slug') || strpos($_SERVER['REQUEST_URI'], 'woocommerce-checkout-manager-pro') ) { if ( substr( $_SERVER['REMOTE_ADDR'] , 0, 3) == "127" || $_SERVER['REMOTE_ADDR'] == "1" || $_SERVER['REMOTE_ADDR'] == "::1" ) { return true; } else { if ( !empty( $valuexg ) ) { $api_url = 'http://www.trottyzone.com/wp-content/plugins/wp-licensing/auth/verify.php'; $request_string = array( 'body' => array( 'key' => $valuexg, 'domain' => $host, 'product' => 'woocommerce-checkout-manager-pro' ), 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url') ); $resultx = wp_remote_post($api_url, $request_string ); $result = wp_remote_retrieve_body( $resultx ); if (is_wp_error($result)) { update_option('errfafvetcgrt6434cwooccminfo15907833', 'connection_error'); update_option('hostnamewooccmerrfafvetcgrt6434cwooccminfo15907833', $host); }else { $result = json_decode($result, true); if ($result['valid'] == 'true') { update_option('errfafvetcgrt6434cwooccminfo15907833', 'clear'); }elseif ($result['info']['domain'] !== 'NA' && $result['valid'] == 'false' ) { update_option('errfafvetcgrt6434cwooccminfo15907833', 'change_site'); }elseif ($result['info']['domain'] == 'NA') { update_option('errfafvetcgrt6434cwooccminfo15907833', 'not_exsit'); } } if($result['valid'] == 'true'){ return true; } } } } return false; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/pickers/jcrop/css/jquery.Jcrop.css
CHANGED
@@ -23,13 +23,13 @@
|
|
23 |
}
|
24 |
.jcrop-vline {
|
25 |
height: 100%;
|
26 |
-
width: 1px
|
27 |
}
|
28 |
.jcrop-vline.right {
|
29 |
right: 0;
|
30 |
}
|
31 |
.jcrop-hline {
|
32 |
-
height: 1px
|
33 |
width: 100%;
|
34 |
}
|
35 |
.jcrop-hline.bottom {
|
@@ -131,7 +131,7 @@
|
|
131 |
.jcrop-light .jcrop-vline,
|
132 |
.jcrop-light .jcrop-hline {
|
133 |
background: #ffffff;
|
134 |
-
filter: alpha(opacity=70)
|
135 |
opacity: .70!important;
|
136 |
}
|
137 |
.jcrop-light .jcrop-handle {
|
@@ -145,8 +145,8 @@
|
|
145 |
.jcrop-dark .jcrop-vline,
|
146 |
.jcrop-dark .jcrop-hline {
|
147 |
background: #000000;
|
148 |
-
filter: alpha(opacity=70)
|
149 |
-
opacity: 0.7
|
150 |
}
|
151 |
.jcrop-dark .jcrop-handle {
|
152 |
-moz-border-radius: 3px;
|
23 |
}
|
24 |
.jcrop-vline {
|
25 |
height: 100%;
|
26 |
+
width: 1px;
|
27 |
}
|
28 |
.jcrop-vline.right {
|
29 |
right: 0;
|
30 |
}
|
31 |
.jcrop-hline {
|
32 |
+
height: 1px;
|
33 |
width: 100%;
|
34 |
}
|
35 |
.jcrop-hline.bottom {
|
131 |
.jcrop-light .jcrop-vline,
|
132 |
.jcrop-light .jcrop-hline {
|
133 |
background: #ffffff;
|
134 |
+
filter: alpha(opacity=70);
|
135 |
opacity: .70!important;
|
136 |
}
|
137 |
.jcrop-light .jcrop-handle {
|
145 |
.jcrop-dark .jcrop-vline,
|
146 |
.jcrop-dark .jcrop-hline {
|
147 |
background: #000000;
|
148 |
+
filter: alpha(opacity=70);
|
149 |
+
opacity: 0.7;
|
150 |
}
|
151 |
.jcrop-dark .jcrop-handle {
|
152 |
-moz-border-radius: 3px;
|
includes/pickers/jquery.ui.css
CHANGED
@@ -59,7 +59,7 @@
|
|
59 |
/* Interaction Cues
|
60 |
----------------------------------*/
|
61 |
.ui-state-disabled {
|
62 |
-
cursor: default
|
63 |
}
|
64 |
|
65 |
|
59 |
/* Interaction Cues
|
60 |
----------------------------------*/
|
61 |
.ui-state-disabled {
|
62 |
+
cursor: default;
|
63 |
}
|
64 |
|
65 |
|
includes/pickers/magnificpopup/dist/magnific-popup.css
CHANGED
@@ -40,7 +40,7 @@
|
|
40 |
height: 100%;
|
41 |
z-index: 1043;
|
42 |
position: fixed;
|
43 |
-
outline: none
|
44 |
-webkit-backface-visibility: hidden; }
|
45 |
|
46 |
.mfp-container {
|
@@ -85,10 +85,10 @@
|
|
85 |
cursor: zoom-out; }
|
86 |
|
87 |
.mfp-zoom {
|
88 |
-
cursor: pointer
|
89 |
-
cursor: -webkit-zoom-in
|
90 |
-
cursor: -moz-zoom-in
|
91 |
-
cursor: zoom-in
|
92 |
|
93 |
.mfp-auto-cursor .mfp-content {
|
94 |
cursor: auto; }
|
@@ -102,7 +102,7 @@
|
|
102 |
display: none; }
|
103 |
|
104 |
.mfp-hide {
|
105 |
-
display: none
|
106 |
|
107 |
.mfp-preloader {
|
108 |
color: #CCC;
|
40 |
height: 100%;
|
41 |
z-index: 1043;
|
42 |
position: fixed;
|
43 |
+
outline: none;
|
44 |
-webkit-backface-visibility: hidden; }
|
45 |
|
46 |
.mfp-container {
|
85 |
cursor: zoom-out; }
|
86 |
|
87 |
.mfp-zoom {
|
88 |
+
cursor: pointer;
|
89 |
+
cursor: -webkit-zoom-in;
|
90 |
+
cursor: -moz-zoom-in;
|
91 |
+
cursor: zoom-in; }
|
92 |
|
93 |
.mfp-auto-cursor .mfp-content {
|
94 |
cursor: auto; }
|
102 |
display: none; }
|
103 |
|
104 |
.mfp-hide {
|
105 |
+
display: none; }
|
106 |
|
107 |
.mfp-preloader {
|
108 |
color: #CCC;
|
includes/pickers/magnificpopup/libs/jquery/jquery.js
CHANGED
@@ -7088,7 +7088,7 @@ function css_defaultDisplay( nodeName ) {
|
|
7088 |
// Use the already-created iframe if possible
|
7089 |
iframe = ( iframe ||
|
7090 |
jQuery("<iframe frameborder='0' width='0' height='0'/>")
|
7091 |
-
.css( "cssText", "display:block
|
7092 |
).appendTo( doc.documentElement );
|
7093 |
|
7094 |
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
|
7088 |
// Use the already-created iframe if possible
|
7089 |
iframe = ( iframe ||
|
7090 |
jQuery("<iframe frameborder='0' width='0' height='0'/>")
|
7091 |
+
.css( "cssText", "display:block" )
|
7092 |
).appendTo( doc.documentElement );
|
7093 |
|
7094 |
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
|
includes/pickers/wooccm_upload_script.js
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* WooCommerce Checkout Manager
|
4 |
-
*
|
5 |
-
*
|
6 |
-
* Copyright (C) 2014 Ephrain Marchan, trottyzone
|
7 |
-
*
|
8 |
*/
|
9 |
|
10 |
// Exit if accessed directly
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WooCommerce Checkout Manager
|
|
|
|
|
|
|
|
|
4 |
*/
|
5 |
|
6 |
// Exit if accessed directly
|
includes/template.php
ADDED
@@ -0,0 +1,544 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wooccm_front_endupload() {
|
3 |
+
|
4 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
5 |
+
require_once( ABSPATH . 'wp-admin/includes/media.php' );
|
6 |
+
|
7 |
+
$wp_upload_dir = wp_upload_dir();
|
8 |
+
$name = ( isset( $_REQUEST["name"] ) ? $_REQUEST["name"] : false );
|
9 |
+
$number_of_files = 0;
|
10 |
+
|
11 |
+
// Check if a file has been uploaded
|
12 |
+
if( empty( $_FILES ) ) {
|
13 |
+
wooccm_error_log( '[' . $name . '] $_FILES is empty' );
|
14 |
+
return;
|
15 |
+
}
|
16 |
+
|
17 |
+
// Check if the $_REQUEST name attribute matches the $_FILES field name
|
18 |
+
if( !isset( $_FILES[$name] ) ) {
|
19 |
+
wooccm_error_log( '[' . $name . '] $_REQUEST name does not match' );
|
20 |
+
return;
|
21 |
+
}
|
22 |
+
|
23 |
+
$file = array(
|
24 |
+
'name' => $_FILES[$name]['name'],
|
25 |
+
'type' => $_FILES[$name]['type'],
|
26 |
+
'tmp_name' => $_FILES[$name]['tmp_name'],
|
27 |
+
'error' => $_FILES[$name]['error'],
|
28 |
+
'size' => $_FILES[$name]['size']
|
29 |
+
);
|
30 |
+
|
31 |
+
$upload_overrides = array( 'test_form' => false );
|
32 |
+
$movefile = wp_handle_upload( $file, $upload_overrides );
|
33 |
+
|
34 |
+
// Check if upload was successful
|
35 |
+
if( isset( $movefile['error'] ) && $movefile['error'][0] > 0 ) {
|
36 |
+
wooccm_error_log( '[' . $name . '] upload failed: ' . print_r( $movefile, true ) );
|
37 |
+
return;
|
38 |
+
} else {
|
39 |
+
$post_title = basename( $file['name'] );
|
40 |
+
if( isset( $movefile['file'] ) )
|
41 |
+
$post_title = basename( $movefile['file'] );
|
42 |
+
$attachment = array(
|
43 |
+
'guid' => ( isset( $movefile['url'] ) ? $movefile['url'] : false ),
|
44 |
+
'post_mime_type' => ( isset( $movefile['type'] ) ? $movefile['type'] : $file['type'] ),
|
45 |
+
'post_title' => preg_replace( '/\.[^.]+$/', '', $post_title ),
|
46 |
+
'post_content' => '',
|
47 |
+
'post_status' => 'inherit'
|
48 |
+
);
|
49 |
+
if( !empty( $movefile['url'] ) ) {
|
50 |
+
$attach_id = wp_insert_attachment( $attachment, $movefile['url'] );
|
51 |
+
$number_of_files++;
|
52 |
+
echo json_encode( $attach_id );
|
53 |
+
// echo json_encode( array( $number_of_files, $attach_id ) );
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
die();
|
58 |
+
|
59 |
+
}
|
60 |
+
add_action("wp_ajax_wooccm_front_endupload", "wooccm_front_endupload");
|
61 |
+
add_action("wp_ajax_nopriv_wooccm_front_endupload", "wooccm_front_endupload");
|
62 |
+
|
63 |
+
function wooccm_front_enduploadsave() {
|
64 |
+
|
65 |
+
global $wpdb, $woocommerce, $post;
|
66 |
+
|
67 |
+
require_once( ABSPATH . 'wp-admin/includes/file.php' );
|
68 |
+
require_once( ABSPATH . 'wp-admin/includes/media.php' );
|
69 |
+
|
70 |
+
$name = ( isset( $_REQUEST["name"] ) ? $_REQUEST["name"] : false );
|
71 |
+
$attachtoremove = ( isset( $_REQUEST["remove"] ) ? $_REQUEST["remove"] : false );
|
72 |
+
|
73 |
+
wp_delete_attachment( $attachtoremove );
|
74 |
+
|
75 |
+
$file = array(
|
76 |
+
'name' => $_FILES[$name]['name'],
|
77 |
+
'type' => $_FILES[$name]['type'],
|
78 |
+
'tmp_name' => $_FILES[$name]['tmp_name'],
|
79 |
+
'error' => $_FILES[$name]['error'],
|
80 |
+
'size' => $_FILES[$name]['size']
|
81 |
+
);
|
82 |
+
|
83 |
+
$upload_overrides = array( 'test_form' => false );
|
84 |
+
$movefile = wp_handle_upload( $file, $upload_overrides );
|
85 |
+
|
86 |
+
$attachment = array(
|
87 |
+
'guid' => $movefile['url'],
|
88 |
+
'post_mime_type' => $movefile['type'],
|
89 |
+
'post_title' => preg_replace( '/\.[^.]+$/', '', basename($movefile['file'])),
|
90 |
+
'post_content' => '',
|
91 |
+
'post_status' => 'inherit'
|
92 |
+
);
|
93 |
+
|
94 |
+
$attach_id = wp_insert_attachment( $attachment, $movefile['url'] );
|
95 |
+
|
96 |
+
echo json_encode( $attach_id );
|
97 |
+
|
98 |
+
die();
|
99 |
+
|
100 |
+
}
|
101 |
+
//frontend handle
|
102 |
+
add_action("wp_ajax_wooccm_front_enduploadsave", "wooccm_front_enduploadsave");
|
103 |
+
add_action("wp_ajax_nopriv_wooccm_front_enduploadsave", "wooccm_front_enduploadsave");
|
104 |
+
|
105 |
+
function wooccm_update_attachment_ids( $order_id = 0 ) {
|
106 |
+
|
107 |
+
$shipping = array(
|
108 |
+
'country',
|
109 |
+
'first_name',
|
110 |
+
'last_name',
|
111 |
+
'company',
|
112 |
+
'address_1',
|
113 |
+
'address_2',
|
114 |
+
'city',
|
115 |
+
'state',
|
116 |
+
'postcode'
|
117 |
+
);
|
118 |
+
$billing = array(
|
119 |
+
'country',
|
120 |
+
'first_name',
|
121 |
+
'last_name',
|
122 |
+
'company',
|
123 |
+
'address_1',
|
124 |
+
'address_2',
|
125 |
+
'city',
|
126 |
+
'state',
|
127 |
+
'postcode',
|
128 |
+
'email',
|
129 |
+
'phone'
|
130 |
+
);
|
131 |
+
|
132 |
+
$names = array(
|
133 |
+
'billing',
|
134 |
+
'shipping'
|
135 |
+
);
|
136 |
+
$inc = 3;
|
137 |
+
|
138 |
+
foreach( $names as $name ) {
|
139 |
+
|
140 |
+
$array = ( $name == 'billing' ) ? $billing : $shipping;
|
141 |
+
|
142 |
+
$options = get_option( 'wccs_settings'.$inc );
|
143 |
+
if( !empty( $options[sprintf( '%s_buttons', $name )] ) ) {
|
144 |
+
foreach( $options[sprintf( '%s_buttons', $name )] as $btn ) {
|
145 |
+
|
146 |
+
if( !in_array( $btn['cow'], $array ) ) {
|
147 |
+
if( $btn['type'] == 'wooccmupload' ) {
|
148 |
+
$attachments = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
|
149 |
+
if( !empty( $attachments ) ) {
|
150 |
+
$attachments = explode( ",", $attachments );
|
151 |
+
if( !empty( $attachments ) ) {
|
152 |
+
foreach( $attachments as $image_id ) {
|
153 |
+
|
154 |
+
if( !empty( $image_id ) ){
|
155 |
+
wp_update_post( array( 'ID' => $image_id, 'post_parent' => $order_id ) );
|
156 |
+
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
157 |
+
wp_update_attachment_metadata( $image_id, wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) ) );
|
158 |
+
}
|
159 |
+
|
160 |
+
}
|
161 |
+
}
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
|
166 |
+
}
|
167 |
+
}
|
168 |
+
$inc--;
|
169 |
+
}
|
170 |
+
|
171 |
+
$options = get_option( 'wccs_settings' );
|
172 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
173 |
+
if( !empty( $buttons ) ) {
|
174 |
+
foreach( $buttons as $btn ) {
|
175 |
+
|
176 |
+
if( $btn['type'] == 'wooccmupload' ) {
|
177 |
+
$attachments = get_post_meta( $order_id , $btn['cow'], true );
|
178 |
+
if( !empty( $attachments ) ) {
|
179 |
+
$attachments = explode( ",", $attachments );
|
180 |
+
foreach( $attachments as $image_id ) {
|
181 |
+
|
182 |
+
if( !empty( $image_id ) ) {
|
183 |
+
wp_update_post( array( 'ID' => $image_id, 'post_parent' => $order_id ) );
|
184 |
+
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
185 |
+
wp_update_attachment_metadata( $image_id, wp_generate_attachment_metadata( $image_id, get_attached_file( $image_id ) ) );
|
186 |
+
}
|
187 |
+
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
}
|
196 |
+
add_action( 'woocommerce_thankyou', 'wooccm_update_attachment_ids' );
|
197 |
+
// @mod - Change to thank you page to catch all Order Status
|
198 |
+
add_action( 'woocommerce_order_status_completed', 'wooccm_update_attachment_ids' );
|
199 |
+
|
200 |
+
// Checkout - Order Received
|
201 |
+
function wooccm_custom_checkout_details( $order ) {
|
202 |
+
|
203 |
+
if( version_compare( wooccm_get_woo_version(), '2.7', '>=' ) ) {
|
204 |
+
$order_id = ( method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id );
|
205 |
+
} else {
|
206 |
+
$order_id = ( isset( $order->id ) ? $order->id : 0 );
|
207 |
+
}
|
208 |
+
|
209 |
+
$shipping = array(
|
210 |
+
'country',
|
211 |
+
'first_name',
|
212 |
+
'last_name',
|
213 |
+
'company',
|
214 |
+
'address_1',
|
215 |
+
'address_2',
|
216 |
+
'city',
|
217 |
+
'state',
|
218 |
+
'postcode'
|
219 |
+
);
|
220 |
+
$billing = array(
|
221 |
+
'country',
|
222 |
+
'first_name',
|
223 |
+
'last_name',
|
224 |
+
'company',
|
225 |
+
'address_1',
|
226 |
+
'address_2',
|
227 |
+
'city',
|
228 |
+
'state',
|
229 |
+
'postcode',
|
230 |
+
'email',
|
231 |
+
'phone'
|
232 |
+
);
|
233 |
+
|
234 |
+
$names = array(
|
235 |
+
'billing',
|
236 |
+
'shipping'
|
237 |
+
);
|
238 |
+
$inc = 3;
|
239 |
+
|
240 |
+
// Check if above WooCommerce 2.3+
|
241 |
+
if( defined( 'WOOCOMMERCE_VERSION' ) && version_compare( WOOCOMMERCE_VERSION, '2.3', '>=' ) ) {
|
242 |
+
|
243 |
+
foreach( $names as $name ) {
|
244 |
+
|
245 |
+
$array = ( $name == 'billing' ) ? $billing : $shipping;
|
246 |
+
|
247 |
+
$options = get_option( 'wccs_settings'.$inc );
|
248 |
+
if( !empty( $options[sprintf( '%s_buttons', $name )] ) ) {
|
249 |
+
foreach( $options[sprintf( '%s_buttons', $name )] as $btn ) {
|
250 |
+
|
251 |
+
if( !in_array( $btn['cow'], $array ) ) {
|
252 |
+
if(
|
253 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true) !== '' ) &&
|
254 |
+
!empty( $btn['label'] ) &&
|
255 |
+
empty( $btn['deny_receipt'] ) &&
|
256 |
+
$btn['type'] !== 'heading' &&
|
257 |
+
$btn['type'] !== 'wooccmupload' &&
|
258 |
+
$btn['type'] !== 'multiselect' &&
|
259 |
+
$btn['type'] !== 'multicheckbox'
|
260 |
+
) {
|
261 |
+
echo '
|
262 |
+
<tr>
|
263 |
+
<th>'.wooccm_wpml_string($btn['label']).':</th>
|
264 |
+
<td>'.nl2br( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) ).'</td>
|
265 |
+
</tr>';
|
266 |
+
} elseif (
|
267 |
+
!empty( $btn['label'] ) &&
|
268 |
+
empty( $btn['deny_receipt'] ) &&
|
269 |
+
$btn['type'] !== 'multiselect' &&
|
270 |
+
$btn['type'] !== 'multicheckbox' &&
|
271 |
+
$btn['type'] == 'heading'
|
272 |
+
) {
|
273 |
+
echo '
|
274 |
+
<tr>
|
275 |
+
<th colspan="2">' .wooccm_wpml_string($btn['label']). '</th>
|
276 |
+
</tr>';
|
277 |
+
} elseif (
|
278 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true) !== '') &&
|
279 |
+
$btn['type'] !== 'wooccmupload' &&
|
280 |
+
!empty( $btn['label'] ) &&
|
281 |
+
empty( $btn['deny_receipt'] ) &&
|
282 |
+
$btn['type'] !== 'heading' &&
|
283 |
+
(
|
284 |
+
( $btn['type'] == 'multiselect' ) || ( $btn['type'] == 'multicheckbox' )
|
285 |
+
)
|
286 |
+
) {
|
287 |
+
$value = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
|
288 |
+
$strings = maybe_unserialize( $value );
|
289 |
+
echo '
|
290 |
+
<tr>
|
291 |
+
<th>'.wooccm_wpml_string($btn['label']).':</th>
|
292 |
+
<td data-title="' .wooccm_wpml_string($btn['label']). '">';
|
293 |
+
if( !empty( $strings ) ) {
|
294 |
+
if( is_array( $strings ) ) {
|
295 |
+
foreach( $strings as $key ) {
|
296 |
+
echo wooccm_wpml_string( $key ) . ', ';
|
297 |
+
}
|
298 |
+
} else {
|
299 |
+
echo $strings;
|
300 |
+
}
|
301 |
+
} else {
|
302 |
+
echo '-';
|
303 |
+
}
|
304 |
+
echo '
|
305 |
+
</td>
|
306 |
+
</tr>';
|
307 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
308 |
+
$info = explode("||", get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true));
|
309 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
310 |
+
echo '
|
311 |
+
<tr>
|
312 |
+
<th>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</th>
|
313 |
+
<td>'.$info[0].'</td>
|
314 |
+
</tr>';
|
315 |
+
}
|
316 |
+
}
|
317 |
+
|
318 |
+
}
|
319 |
+
}
|
320 |
+
$inc--;
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
$options = get_option( 'wccs_settings' );
|
325 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
326 |
+
if( !empty( $buttons ) ) {
|
327 |
+
foreach( $buttons as $btn ) {
|
328 |
+
|
329 |
+
if(
|
330 |
+
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
331 |
+
!empty( $btn['label'] ) &&
|
332 |
+
empty( $btn['deny_receipt'] ) &&
|
333 |
+
$btn['type'] !== 'heading' &&
|
334 |
+
$btn['type'] !== 'wooccmupload' &&
|
335 |
+
$btn['type'] !== 'multiselect' &&
|
336 |
+
$btn['type'] !== 'multicheckbox'
|
337 |
+
) {
|
338 |
+
echo '
|
339 |
+
<tr>
|
340 |
+
<th>'.wooccm_wpml_string($btn['label']).':</th>
|
341 |
+
<td data-title="' .wooccm_wpml_string($btn['label']). '">'.nl2br( get_post_meta( $order_id, $btn['cow'], true ) ).'</td>
|
342 |
+
</tr>';
|
343 |
+
} elseif(
|
344 |
+
!empty( $btn['label'] ) &&
|
345 |
+
empty( $btn['deny_receipt'] ) &&
|
346 |
+
$btn['type'] !== 'wooccmupload' &&
|
347 |
+
$btn['type'] !== 'multiselect' &&
|
348 |
+
$btn['type'] !== 'multicheckbox' &&
|
349 |
+
$btn['type'] == 'heading'
|
350 |
+
) {
|
351 |
+
echo '
|
352 |
+
<tr>
|
353 |
+
<th colspan="2">' .wooccm_wpml_string($btn['label']). '</th>
|
354 |
+
</tr>';
|
355 |
+
} elseif(
|
356 |
+
( get_post_meta( $order_id, $btn['cow'], true ) !== '' ) &&
|
357 |
+
!empty( $btn['label'] ) &&
|
358 |
+
empty( $btn['deny_receipt'] ) &&
|
359 |
+
$btn['type'] !== 'heading' &&
|
360 |
+
$btn['type'] !== 'wooccmupload' &&
|
361 |
+
(
|
362 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
363 |
+
)
|
364 |
+
) {
|
365 |
+
$value = get_post_meta( $order_id , $btn['cow'], true );
|
366 |
+
$strings = maybe_unserialize( $value );
|
367 |
+
echo '
|
368 |
+
<tr>
|
369 |
+
<th>'.wooccm_wpml_string($btn['label']).':</th>
|
370 |
+
<td data-title="' .wooccm_wpml_string($btn['label']). '">';
|
371 |
+
if( !empty( $strings ) ) {
|
372 |
+
if( is_array( $strings ) ) {
|
373 |
+
foreach( $strings as $key ) {
|
374 |
+
echo wooccm_wpml_string($key) . ', ';
|
375 |
+
}
|
376 |
+
} else {
|
377 |
+
echo $strings;
|
378 |
+
}
|
379 |
+
} else {
|
380 |
+
echo '-';
|
381 |
+
}
|
382 |
+
echo '
|
383 |
+
</td>
|
384 |
+
</tr>';
|
385 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
386 |
+
$info = explode("||", get_post_meta( $order_id , $btn['cow'], true));
|
387 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
388 |
+
echo '
|
389 |
+
<tr>
|
390 |
+
<th>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</th>
|
391 |
+
<td data-title="' .wooccm_wpml_string( trim( $btn['label'] ) ). '">'.$info[0].'</td>
|
392 |
+
</tr>';
|
393 |
+
}
|
394 |
+
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
} else {
|
399 |
+
|
400 |
+
// @mod - Legacy support below WooCommerce 2.3
|
401 |
+
|
402 |
+
foreach( $names as $name ) {
|
403 |
+
|
404 |
+
$array = ( $name == 'billing' ) ? $billing : $shipping;
|
405 |
+
|
406 |
+
$options = get_option( 'wccs_settings'.$inc );
|
407 |
+
if( !empty( $options[sprintf( '%s_buttons', $name )] ) ) {
|
408 |
+
foreach( $options[sprintf( '%s_buttons', $name )] as $btn ) {
|
409 |
+
|
410 |
+
if( !in_array( $btn['cow'], $array ) ) {
|
411 |
+
if(
|
412 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
|
413 |
+
!empty( $btn['label'] ) &&
|
414 |
+
empty( $btn['deny_receipt'] ) &&
|
415 |
+
$btn['type'] !== 'heading' &&
|
416 |
+
$btn['type'] !== 'multiselect' &&
|
417 |
+
$btn['type'] !== 'wooccmupload' &&
|
418 |
+
$btn['type'] !== 'multicheckbox'
|
419 |
+
) {
|
420 |
+
echo '
|
421 |
+
<dt>'.wooccm_wpml_string($btn['label']).':</dt>
|
422 |
+
<dd>'.nl2br( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) ).'</dd>';
|
423 |
+
} elseif(
|
424 |
+
!empty( $btn['label'] ) &&
|
425 |
+
empty( $btn['deny_receipt'] ) &&
|
426 |
+
$btn['type'] !== 'multiselect' &&
|
427 |
+
$btn['type'] !== 'multicheckbox' &&
|
428 |
+
$btn['type'] == 'heading'
|
429 |
+
) {
|
430 |
+
echo '
|
431 |
+
<h2>' .wooccm_wpml_string($btn['label']). '</h2>';
|
432 |
+
} elseif(
|
433 |
+
( get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) !== '' ) &&
|
434 |
+
!empty( $btn['label'] ) &&
|
435 |
+
empty( $btn['deny_receipt'] ) &&
|
436 |
+
$btn['type'] !== 'heading' &&
|
437 |
+
(
|
438 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
439 |
+
)
|
440 |
+
) {
|
441 |
+
$value = get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true );
|
442 |
+
$strings = maybe_unserialize( $value );
|
443 |
+
echo '
|
444 |
+
<dt>'.wooccm_wpml_string($btn['label']).':</dt>
|
445 |
+
<dd>';
|
446 |
+
if( !empty( $strings ) ) {
|
447 |
+
if( is_array( $strings ) ) {
|
448 |
+
foreach( $strings as $key ) {
|
449 |
+
echo wooccm_wpml_string($key).', ';
|
450 |
+
}
|
451 |
+
} else {
|
452 |
+
echo $strings;
|
453 |
+
}
|
454 |
+
} else {
|
455 |
+
echo '-';
|
456 |
+
}
|
457 |
+
echo '
|
458 |
+
</dd>';
|
459 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
460 |
+
$info = explode( "||", get_post_meta( $order_id , sprintf( '_%s_%s', $name, $btn['cow'] ), true ) );
|
461 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
462 |
+
echo '
|
463 |
+
<dt>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</dt>
|
464 |
+
<dd>'.$info[0].'</dd>';
|
465 |
+
}
|
466 |
+
}
|
467 |
+
|
468 |
+
}
|
469 |
+
}
|
470 |
+
$inc--;
|
471 |
+
|
472 |
+
}
|
473 |
+
|
474 |
+
$options = get_option( 'wccs_settings' );
|
475 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
476 |
+
if( !empty( $buttons ) ) {
|
477 |
+
foreach( $buttons as $btn ) {
|
478 |
+
|
479 |
+
if(
|
480 |
+
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
481 |
+
!empty( $btn['label'] ) &&
|
482 |
+
empty( $btn['deny_receipt'] ) &&
|
483 |
+
$btn['type'] !== 'heading' &&
|
484 |
+
$btn['type'] !== 'multicheckbox' &&
|
485 |
+
(
|
486 |
+
$btn['type'] !== 'wooccmupload' && $btn['type'] !== 'multiselect'
|
487 |
+
)
|
488 |
+
) {
|
489 |
+
echo '
|
490 |
+
<dt>'.wooccm_wpml_string($btn['label']).':</dt>
|
491 |
+
<dd>'.nl2br( get_post_meta( $order_id , $btn['cow'], true ) ).'</dd>';
|
492 |
+
} elseif(
|
493 |
+
!empty( $btn['label'] ) &&
|
494 |
+
empty( $btn['deny_receipt'] ) &&
|
495 |
+
$btn['type'] !== 'wooccmupload' &&
|
496 |
+
$btn['type'] !== 'multiselect' &&
|
497 |
+
$btn['type'] !== 'multicheckbox' &&
|
498 |
+
$btn['type'] == 'heading'
|
499 |
+
) {
|
500 |
+
echo '
|
501 |
+
<h2>' .wooccm_wpml_string($btn['label']). '</h2>';
|
502 |
+
} elseif(
|
503 |
+
( get_post_meta( $order_id , $btn['cow'], true ) !== '' ) &&
|
504 |
+
!empty( $btn['label'] ) &&
|
505 |
+
empty( $btn['deny_receipt'] ) &&
|
506 |
+
$btn['type'] !== 'heading' &&
|
507 |
+
$btn['type'] !== 'wooccmupload' &&
|
508 |
+
(
|
509 |
+
$btn['type'] == 'multiselect' || $btn['type'] == 'multicheckbox'
|
510 |
+
)
|
511 |
+
) {
|
512 |
+
$value = get_post_meta( $order_id , $btn['cow'], true );
|
513 |
+
$strings = maybe_unserialize( $value );
|
514 |
+
echo '
|
515 |
+
<dt>'.wooccm_wpml_string($btn['label']).':</dt>
|
516 |
+
<dd>';
|
517 |
+
if( !empty( $strings ) ) {
|
518 |
+
if( is_array( $strings ) ) {
|
519 |
+
foreach( $strings as $key ) {
|
520 |
+
echo wooccm_wpml_string($key).', ';
|
521 |
+
}
|
522 |
+
} else {
|
523 |
+
echo $strings;
|
524 |
+
}
|
525 |
+
} else {
|
526 |
+
echo '-';
|
527 |
+
}
|
528 |
+
echo '
|
529 |
+
</dd>';
|
530 |
+
} elseif( $btn['type'] == 'wooccmupload' ) {
|
531 |
+
$info = explode( "||", get_post_meta( $order_id , $btn['cow'], true ) );
|
532 |
+
$btn['label'] = ( !empty( $btn['force_title2'] ) ? $btn['force_title2'] : $btn['label'] );
|
533 |
+
echo '
|
534 |
+
<dt>'.wooccm_wpml_string( trim( $btn['label'] ) ).':</dt>
|
535 |
+
<dd>'.$info[0].'</dd>';
|
536 |
+
}
|
537 |
+
|
538 |
+
}
|
539 |
+
}
|
540 |
+
|
541 |
+
}
|
542 |
+
|
543 |
+
}
|
544 |
+
?>
|
includes/templates/admin/edit-order-uploads-button_style.css
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#files-listing-wccm img {
|
2 |
+
width: 64px;
|
3 |
+
height: 64px;
|
4 |
+
float:left;
|
5 |
+
margin-right: 8px;
|
6 |
+
margin-top: 4px;
|
7 |
+
}
|
8 |
+
#files-listing-wccm {
|
9 |
+
list-style: none;
|
10 |
+
}
|
11 |
+
#wccm_uploader_select {
|
12 |
+
float:left;
|
13 |
+
margin-top: 10px;
|
14 |
+
margin-left: 20px;
|
15 |
+
}
|
16 |
+
#response_wccm {
|
17 |
+
float: right;
|
18 |
+
clear: left;
|
19 |
+
margin-top: -25px;
|
20 |
+
}
|
21 |
+
#wccm_make_smaller {
|
22 |
+
font-size: 80%;
|
23 |
+
}
|
24 |
+
#wccm_save_order_submit {
|
25 |
+
margin-bottom: 30px;
|
26 |
+
}
|
27 |
+
|
28 |
+
.file_upload_delete:before{
|
29 |
+
content: "\f182";
|
30 |
+
font-family: dashicons;
|
31 |
+
margin-right: 5px;
|
32 |
+
}
|
33 |
+
.file_upload_account:before{
|
34 |
+
content: "\f317";
|
35 |
+
font-family: dashicons;
|
36 |
+
margin-right: 5px;
|
37 |
+
}
|
38 |
+
.wooccm-btn{
|
39 |
+
display: inline-block;
|
40 |
+
padding: 6px 12px;
|
41 |
+
margin-bottom: 0;
|
42 |
+
font-size: 14px;
|
43 |
+
font-weight: 400;
|
44 |
+
line-height: 1.42857143;
|
45 |
+
text-align: center;
|
46 |
+
white-space: nowrap;
|
47 |
+
vertical-align: middle;
|
48 |
+
cursor: pointer;
|
49 |
+
-webkit-user-select: none;
|
50 |
+
-moz-user-select: none;
|
51 |
+
-ms-user-select: none;
|
52 |
+
user-select: none;
|
53 |
+
background-image: none;
|
54 |
+
border: 1px solid transparent;
|
55 |
+
border-radius: 4px;
|
56 |
+
}
|
57 |
+
.wooccm-btn-primary {
|
58 |
+
color: #fff;
|
59 |
+
background-color: #428bca;
|
60 |
+
border-color: #357ebd;
|
61 |
+
}
|
62 |
+
.wooccm-btn-danger {
|
63 |
+
color: #fff;
|
64 |
+
background-color: #d9534f;
|
65 |
+
border-color: #d43f3a;
|
66 |
+
}
|
includes/templates/admin/edit-order-uploads-file_editing_table.css
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*Copied from bootstrap */
|
2 |
+
|
3 |
+
.woocommerce_order_items.front_end tbody td, .woocommerce_order_items.back_end tbody td {
|
4 |
+
text-align: center;
|
5 |
+
}
|
6 |
+
|
7 |
+
.btn {
|
8 |
+
display: inline-block;
|
9 |
+
padding: 6px 12px;
|
10 |
+
margin-bottom: 0;
|
11 |
+
font-size: 14px;
|
12 |
+
font-weight: normal;
|
13 |
+
line-height: 1.42857143;
|
14 |
+
text-align: center;
|
15 |
+
white-space: nowrap;
|
16 |
+
vertical-align: middle;
|
17 |
+
cursor: pointer;
|
18 |
+
-webkit-user-select: none;
|
19 |
+
-moz-user-select: none;
|
20 |
+
-ms-user-select: none;
|
21 |
+
user-select: none;
|
22 |
+
background-image: none;
|
23 |
+
border: 1px solid transparent;
|
24 |
+
border-radius: 4px;
|
25 |
+
}
|
26 |
+
/*Also */
|
27 |
+
.btn-success {
|
28 |
+
color: #fff;
|
29 |
+
background-color: #5cb85c;
|
30 |
+
border-color: #4cae4c;
|
31 |
+
}
|
32 |
+
/* This is copied from https://github.com/blueimp/jQuery-File-Upload/blob/master/css/jquery.fileupload.css */
|
33 |
+
.fileinput-button {
|
34 |
+
position: relative;
|
35 |
+
overflow: hidden;
|
36 |
+
}
|
37 |
+
/*Also*/
|
38 |
+
.fileinput-button input {
|
39 |
+
position: absolute;
|
40 |
+
top: 0;
|
41 |
+
right: 0;
|
42 |
+
margin: 0;
|
43 |
+
opacity: 0;
|
44 |
+
-ms-filter:'alpha(opacity=0)';
|
45 |
+
font-size: 200px;
|
46 |
+
direction: ltr;
|
47 |
+
cursor: pointer;
|
48 |
+
}
|
49 |
+
|
50 |
+
.image.wccm_filesli span {
|
51 |
+
text-align: center;
|
52 |
+
word-wrap: break-word;
|
53 |
+
}
|
54 |
+
|
55 |
+
.file_size_wccm {
|
56 |
+
display: inline-block;
|
57 |
+
width: 15%;
|
58 |
+
float: left;
|
59 |
+
}
|
60 |
+
|
61 |
+
.product_images.ui-sortable .image {
|
62 |
+
clear: both;
|
63 |
+
text-align: center;
|
64 |
+
}
|
65 |
+
.product_images.ui-sortable .image img {
|
66 |
+
width: 75px;
|
67 |
+
height: 75px;
|
68 |
+
}
|
69 |
+
.image.wccm_filesli li {
|
70 |
+
margin-left: 0;
|
71 |
+
}
|
72 |
+
.image.wccm_filesli {
|
73 |
+
clear: both;
|
74 |
+
margin-left: 0;
|
75 |
+
}
|
76 |
+
.add_product_images .wccm_add_order_link:hover {
|
77 |
+
background: #bb77ae;
|
78 |
+
border-color: #aa559a;
|
79 |
+
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);
|
80 |
+
box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);
|
81 |
+
}
|
82 |
+
#wccm_name {
|
83 |
+
float: right;
|
84 |
+
}
|
85 |
+
.tips.wccm_delete {
|
86 |
+
cursor: pointer;
|
87 |
+
}
|
88 |
+
.add_product_images .wccm_add_order_link {
|
89 |
+
background: #cc99c2;
|
90 |
+
border-color: #b366a4;
|
91 |
+
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);
|
92 |
+
box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 rgba(0,0,0,.15);
|
93 |
+
color: #fff;
|
94 |
+
text-decoration: none;
|
95 |
+
float: left;
|
96 |
+
clear: both;
|
97 |
+
margin-top: 10px;
|
98 |
+
}
|
99 |
+
#wccm_align_right_file {
|
100 |
+
float:left;
|
101 |
+
}
|
102 |
+
#wccm_save_order_submit {
|
103 |
+
float: left;
|
104 |
+
margin-left: 10px;
|
105 |
+
margin-top: 10px;
|
106 |
+
}
|
107 |
+
.wccm_results {
|
108 |
+
float: left;
|
109 |
+
margin-left: 20px;
|
110 |
+
font-weight: bold;
|
111 |
+
margin-top: 13px;
|
112 |
+
}
|
113 |
+
.product_images.front_end {
|
114 |
+
margin: 0;
|
115 |
+
list-style: none;
|
116 |
+
}
|
117 |
+
.delete_action_wccm ul {
|
118 |
+
list-style: none;
|
119 |
+
margin: 0;
|
120 |
+
}
|
121 |
+
#wccm_save_order_submit.front_end {
|
122 |
+
clear: both;
|
123 |
+
margin-bottom: 20px;
|
124 |
+
}
|
125 |
+
.woocommerce_order_items_wrapper.front_end table.woocommerce_order_items thead th {
|
126 |
+
background: #f5f5f5;
|
127 |
+
padding: 8px;
|
128 |
+
font-size: 11px;
|
129 |
+
text-align: center;
|
130 |
+
font-weight: bold;
|
131 |
+
}
|
132 |
+
.woocommerce_order_items.front_end {
|
133 |
+
border-collapse: separate;
|
134 |
+
border-spacing: 2px;
|
135 |
+
border-color: gray;
|
136 |
+
}
|
137 |
+
#woocommerce-order-files tbody.product_images td {
|
138 |
+
border-top:0;
|
139 |
+
}
|
includes/templates/admin/woocheckout-additional-clone.php
ADDED
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
// Exit if accessed directly
|
8 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
+
?>
|
10 |
+
|
11 |
+
<td style="display:none;text-align:center;" class="more_toggler1c"><input type="checkbox" name="wccs_settings[buttons][<?php echo $i; ?>][more_content]" title="<?php esc_attr_e( 'More than two content', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
12 |
+
|
13 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_p]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Hide field from this Products Only', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
14 |
+
|
15 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_px]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Display Field for these Products Only', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
16 |
+
|
17 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_p_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Hide field from Category', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
18 |
+
|
19 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_px_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Show Field for Category', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
20 |
+
|
21 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="6" name="wccs_settings[buttons][<?php echo $i; ?>][start_hour]" value="" /></td>
|
22 |
+
|
23 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="9" name="wccs_settings[buttons][<?php echo $i; ?>][end_hour]" value="" /></td>
|
24 |
+
|
25 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="15" name="wccs_settings[buttons][<?php echo $i; ?>][interval_min]" value="" /></td>
|
26 |
+
|
27 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="0, 10, 20, 30, 40" name="wccs_settings[buttons][<?php echo $i; ?>][manual_min]" value="" /></td>
|
28 |
+
|
29 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][format_date]" placeholder="dd-mm-yy" title="dd-mm-yy" value="" /></td>
|
30 |
+
|
31 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][min_before]" placeholder="+3" title="Days Before" value="" /></td>
|
32 |
+
|
33 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][max_after]" placeholder="3" title="Days After" value="" /></td>
|
34 |
+
|
35 |
+
<td style="display:none;text-align:center;" class="hide_stuff_color daoo"><input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler]" type="checkbox" value="" /></td>
|
36 |
+
|
37 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler0]" type="checkbox" value="" /></td>
|
38 |
+
|
39 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler1]" type="checkbox" value="" /></td>
|
40 |
+
|
41 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler2]" type="checkbox" value="" /></td>
|
42 |
+
|
43 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler3]" type="checkbox" value="" /></td>
|
44 |
+
|
45 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler4]" type="checkbox" value="" /></td>
|
46 |
+
|
47 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler5]" type="checkbox" value="" /></td>
|
48 |
+
|
49 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler6]" type="checkbox" value="" /></td>
|
50 |
+
|
51 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days" title="<?php esc_attr_e( 'Min Date', 'woocommerce-checkout-manager' ); ?>"><span class="spongagge"><?php _e( 'Min Date', 'woocommerce-checkout-manager' ); ?></span></td>
|
52 |
+
|
53 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
54 |
+
|
55 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
56 |
+
|
57 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
58 |
+
|
59 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days" title="<?php esc_attr_e( 'Max Date', 'woocommerce-checkout-manager' ); ?>"><span class="spongagge"><?php _e( 'Max Date', 'woocommerce-checkout-manager' ); ?></span></td>
|
60 |
+
|
61 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_max_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
62 |
+
|
63 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_max_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
64 |
+
|
65 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_max_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
66 |
+
|
67 |
+
<td class="more_toggler1" style="text-align:center;"><input name="wccs_settings[buttons][<?php echo $i; ?>][checkbox]" type="checkbox" title="<?php esc_attr_e( 'Add/Remove Required Attribute', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
68 |
+
|
69 |
+
<td class="more_toggler1" style="text-align:center;">
|
70 |
+
<select name="wccs_settings[buttons][<?php echo $i; ?>][position]" > <!--Call run() function-->
|
71 |
+
<option value="form-row-wide" ><?php _e( 'Wide','woocommerce-checkout-manager' ); ?></option>
|
72 |
+
<option value="form-row-first" ><?php _e( 'Left','woocommerce-checkout-manager' ); ?></option>
|
73 |
+
<option value="form-row-last" ><?php _e( 'Right','woocommerce-checkout-manager' ); ?></option>
|
74 |
+
</select>
|
75 |
+
</td>
|
76 |
+
|
77 |
+
<td class="more_toggler1" style="text-align:center;"><input name="wccs_settings[buttons][<?php echo $i; ?>][clear_row]" type="checkbox" title="<?php esc_attr_e( 'Clear Row', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
78 |
+
|
79 |
+
<td class="filter_field" style="display:none;text-align:center;"><input name="wccs_settings[buttons][<?php echo $i; ?>][deny_checkout]" type="checkbox" title="<?php esc_attr_e( 'Deny Checkout', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
80 |
+
|
81 |
+
<td class="filter_field_tog add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Filter Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
82 |
+
|
83 |
+
<td class="filter_field" style="display:none;text-align:center;"><input name="wccs_settings[buttons][<?php echo $i; ?>][tax_remove]" type="checkbox" title="<?php esc_attr_e( 'Remove tax', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
84 |
+
|
85 |
+
<td class="filter_field" style="display:none;text-align:center;"><input name="wccs_settings[buttons][<?php echo $i; ?>][deny_receipt]" type="checkbox" title="<?php esc_attr_e( 'Deny Receipt', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
86 |
+
|
87 |
+
<td class="filter_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;"><input name="wccs_settings[buttons][<?php echo $i; ?>][add_amount]" type="checkbox" title="<?php esc_attr_e( 'Add Amount', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
88 |
+
|
89 |
+
<td class="add_amount_field" style="display:none;text-align:center;"><input name="wccs_settings[buttons][<?php echo $i; ?>][fee_name]" type="text" title="<?php esc_attr_e( 'Amount Name', 'woocommerce-checkout-manager' ); ?>" value="" placeholder="<?php _e('My Custom Charge','woocommerce-checkout-manager'); ?>" /></td>
|
90 |
+
|
91 |
+
<td class="add_amount_field" style="display:none;text-align:center;"><input name="wccs_settings[buttons][<?php echo $i; ?>][add_amount_field]" type="text" title="<?php esc_attr_e( 'Add Amount Field', 'woocommerce-checkout-manager' ); ?>" value="" placeholder="50" /></td>
|
92 |
+
|
93 |
+
<td class="filter_field add_amount_field hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_time hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;"><input name="wccs_settings[buttons][<?php echo $i; ?>][conditional_parent_use]" type="checkbox" title="<?php esc_attr_e( 'Conditional Field On', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
94 |
+
|
95 |
+
<td class="condition_tick" style="display:none;text-align:center;"><input name="wccs_settings[buttons][<?php echo $i; ?>][conditional_parent]" type="checkbox" title="<?php esc_attr_e( 'Conditional Parent', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
96 |
+
|
97 |
+
<td class="more_toggler1"><input placeholder="<?php _e('My Field Name','woocommerce-checkout-manager'); ?>" type="text" name="wccs_settings[buttons][<?php echo $i; ?>][label]" title="<?php esc_attr_e( 'Label of the New Field', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
98 |
+
|
99 |
+
<td class="more_toggler1"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][placeholder]" placeholder="<?php _e('Example red','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Placeholder - Preview of Data to Input', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
100 |
+
|
101 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][chosen_valt]" placeholder="<?php _e('Yes','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Chosen value for conditional', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
102 |
+
|
103 |
+
<td style="display:none;" class="condition_tick"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][conditional_tie]" placeholder="<?php _e('Parent Abbr. Name','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Parent Abbr. Name', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
104 |
+
|
105 |
+
<td style="display:none;" class="filter_field"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][colorpickerd]" id="billing-colorpic<?php echo $i; ?>" title="<?php esc_attr_e( 'Default Color', 'woocommerce-checkout-manager' ); ?>" value="#000000" /></td>
|
106 |
+
|
107 |
+
<td style="display:none;" class="filter_field">
|
108 |
+
<select name="wccs_settings[buttons][<?php echo $i; ?>][colorpickertype]" > <!--Call run() function-->
|
109 |
+
<option value="farbtastic" ><?php _e('Farbtastic','woocommerce-checkout-manager'); ?></option>
|
110 |
+
<option value="iris" ><?php _e('Iris','woocommerce-checkout-manager'); ?></option>
|
111 |
+
</select>
|
112 |
+
</td>
|
113 |
+
|
114 |
+
<td style="display:none;text-align:center;" class="filter_field"><input name="wccs_settings[buttons][<?php echo $i; ?>][user_role]" type="checkbox" value="" /></td>
|
115 |
+
|
116 |
+
<td class="filter_field" style="display:none;"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][role_options]" placeholder="Option 1||Option 2||Option 3" value="" /></td>
|
117 |
+
|
118 |
+
<td class="filter_field" style="display:none;"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][role_options2]" placeholder="Option 1||Option 2||Option 3" value="" /></td>
|
119 |
+
|
120 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][extra_class]" value="" /></td>
|
121 |
+
|
122 |
+
<td style="display:none;" class="hide_stuff_change"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][changenamep]" id="billing-colorpic<?php echo $i; ?>" placeholder="<?php _e( 'Billing Details', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
123 |
+
|
124 |
+
<td style="display:none;" class="hide_stuff_change"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][changename]" id="billing-colorpic<?php echo $i; ?>" placeholder="<?php _e( 'Bill Form', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
125 |
+
|
126 |
+
<td style="display:none;text-align:center;" class="hide_stuff_op wccm1"><input type="checkbox" name="wccs_settings[buttons][<?php echo $i; ?>][fancy]" title="<?php esc_attr_e( 'Adapt to woocommerce style', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
127 |
+
|
128 |
+
<td class="hide_stuff_op wccm1" style="display:none;"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][force_title2]" value="" placeholder="<?php _e( 'Name Guide', 'woocommerce-checkout-manager' ); ?>" /></td>
|
129 |
+
|
130 |
+
<td class="hide_stuff_op wccm1" style="display:none;"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][option_array]" value="" placeholder="Option 1 || Option 2 || Option 3 || Option 4" /></td>
|
131 |
+
|
132 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e( 'Options Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
133 |
+
|
134 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change_tog hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e( 'Swapper Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
135 |
+
|
136 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e( 'Time Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
137 |
+
|
138 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;"><?php _e( 'Date Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
139 |
+
|
140 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1"><?php _e( 'Hidden Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
141 |
+
|
142 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c"><?php _e( 'More Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
143 |
+
|
144 |
+
<td class="more_toggler1">
|
145 |
+
<select name="wccs_settings[buttons][<?php echo $i; ?>][type]"> <!--Call run() function-->
|
146 |
+
<option value="wooccmtext"><?php _e('Text Input','woocommerce-checkout-manager'); ?></option>
|
147 |
+
<option value="wooccmtextarea"><?php _e('Textarea','woocommerce-checkout-manager'); ?></option>
|
148 |
+
<option value="wooccmpassword"><?php _e('Password','woocommerce-checkout-manager'); ?></option>
|
149 |
+
<option value="wooccmradio"><?php _e('Radio Buttons','woocommerce-checkout-manager'); ?></option>
|
150 |
+
<option value="checkbox_wccm"><?php _e('Check Box','woocommerce-checkout-manager'); ?></option>
|
151 |
+
<option value="wooccmselect"><?php _e('Select Options','woocommerce-checkout-manager'); ?></option>
|
152 |
+
<option value="datepicker"><?php _e('Date Picker','woocommerce-checkout-manager'); ?></option>
|
153 |
+
<option value="changename"><?php _e('Text/ Html Swapper','woocommerce-checkout-manager'); ?></option>
|
154 |
+
<option value="time"><?php _e('Time Picker','woocommerce-checkout-manager'); ?></option>
|
155 |
+
<option value="colorpicker"><?php _e('Color Picker','woocommerce-checkout-manager'); ?></option>
|
156 |
+
<option value="heading"><?php _e('Heading','woocommerce-checkout-manager'); ?></option>
|
157 |
+
<option value="multiselect"><?php _e('Multi-Select','woocommerce-checkout-manager'); ?></option>
|
158 |
+
<option value="multicheckbox" ><?php _e('Multi-Checkbox','woocommerce-checkout-manager'); ?></option>
|
159 |
+
<option value="wooccmcountry"><?php _e('Country','woocommerce-checkout-manager'); ?></option>
|
160 |
+
<option value="wooccmstate"><?php _e('State','woocommerce-checkout-manager'); ?></option>
|
161 |
+
<option value="wooccmupload"><?php _e('File Picker','woocommerce-checkout-manager'); ?></option>
|
162 |
+
</select>
|
163 |
+
</td>
|
164 |
+
|
165 |
+
<td class="more_toggler1"><input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][cow]" placeholder="MyField" title="<?php esc_attr_e( 'Abbreviation (No spaces)', 'woocommerce-checkout-manager' ); ?>" value="" <?php if ( empty($options['checkness']['abbreviation'])) { echo 'readonly="readonly"'; } ?> /></td>
|
includes/templates/admin/woocheckout-additional-tbody.php
ADDED
@@ -0,0 +1,285 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
// Exit if accessed directly
|
8 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
+
?>
|
10 |
+
|
11 |
+
<td style="display:none; text-align:center;" class="more_toggler1c">
|
12 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][more_content]" type="checkbox" value="1" <?php if ( !empty ($options['buttons'][$i]['more_content'])) echo "checked='checked'"; ?> />
|
13 |
+
</td>
|
14 |
+
|
15 |
+
<td style="display:none;" class="more_toggler1c">
|
16 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_p]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options['buttons'][$i]['single_p'])) ? '' : $options['buttons'][$i]['single_p']; ?>" />
|
17 |
+
</td>
|
18 |
+
|
19 |
+
<td style="display:none;" class="more_toggler1c">
|
20 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_px]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options['buttons'][$i]['single_px'])) ? '' : $options['buttons'][$i]['single_px']; ?>" />
|
21 |
+
</td>
|
22 |
+
|
23 |
+
<td style="display:none;" class="more_toggler1c">
|
24 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_p_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options['buttons'][$i]['single_p_cat'])) ? '' : $options['buttons'][$i]['single_p_cat']; ?>" />
|
25 |
+
</td>
|
26 |
+
|
27 |
+
<td style="display:none;" class="more_toggler1c">
|
28 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_px_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options['buttons'][$i]['single_px_cat'])) ? '' : $options['buttons'][$i]['single_px_cat']; ?>" />
|
29 |
+
</td>
|
30 |
+
|
31 |
+
<td style="display:none;" class="hide_stuff_time">
|
32 |
+
<input type="text" placeholder="6" name="wccs_settings[buttons][<?php echo $i; ?>][start_hour]" value="<?php echo (empty($options['buttons'][$i]['start_hour'])) ? '' : $options['buttons'][$i]['start_hour']; ?>" />
|
33 |
+
</td>
|
34 |
+
|
35 |
+
<td style="display:none;" class="hide_stuff_time">
|
36 |
+
<input type="text" placeholder="9" name="wccs_settings[buttons][<?php echo $i; ?>][end_hour]" value="<?php echo (empty($options['buttons'][$i]['end_hour'])) ? '' : $options['buttons'][$i]['end_hour']; ?>" />
|
37 |
+
</td>
|
38 |
+
|
39 |
+
<td style="display:none;" class="hide_stuff_time">
|
40 |
+
<input type="text" placeholder="15" name="wccs_settings[buttons][<?php echo $i; ?>][interval_min]" value="<?php echo (empty($options['buttons'][$i]['interval_min'])) ? '' : $options['buttons'][$i]['interval_min']; ?>" />
|
41 |
+
</td>
|
42 |
+
|
43 |
+
<td style="display:none;" class="hide_stuff_time">
|
44 |
+
<input type="text" placeholder="0, 10, 20, 30, 40" name="wccs_settings[buttons][<?php echo $i; ?>][manual_min]" value="<?php echo (empty($options['buttons'][$i]['manual_min'])) ? '' : $options['buttons'][$i]['manual_min']; ?>" />
|
45 |
+
</td>
|
46 |
+
|
47 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
48 |
+
<input type="text" placeholder="dd-mm-yy" name="wccs_settings[buttons][<?php echo $i; ?>][format_date]" value="<?php echo (empty($options['buttons'][$i]['format_date'])) ? '' : $options['buttons'][$i]['format_date']; ?>" />
|
49 |
+
</td>
|
50 |
+
|
51 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
52 |
+
<input type="text" placeholder="+3" name="wccs_settings[buttons][<?php echo $i; ?>][min_before]" value="<?php echo (empty($options['buttons'][$i]['min_before'])) ? '' : $options['buttons'][$i]['min_before']; ?>" />
|
53 |
+
</td>
|
54 |
+
|
55 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
56 |
+
<input type="text" placeholder="3" name="wccs_settings[buttons][<?php echo $i; ?>][max_after]" value="<?php echo (empty( $options['buttons'][$i]['max_after'])) ? '' : $options['buttons'][$i]['max_after']; ?>" />
|
57 |
+
</td>
|
58 |
+
|
59 |
+
<td style="display:none; text-align:center;" class="hide_stuff_color daoo">
|
60 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler]" type="checkbox" value="true" <?php if ( !empty ($options['buttons'][$i]['days_disabler'])) echo "checked='checked'"; ?> />
|
61 |
+
</td>
|
62 |
+
|
63 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
64 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler0]" type="checkbox" value="1" <?php if ( !empty ($options['buttons'][$i]['days_disabler0'])) echo "checked='checked'"; ?> />
|
65 |
+
</td>
|
66 |
+
|
67 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
68 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler1]" type="checkbox" value="1" <?php if ( !empty ($options['buttons'][$i]['days_disabler1'])) echo "checked='checked'"; ?> />
|
69 |
+
</td>
|
70 |
+
|
71 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
72 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler2]" type="checkbox" value="1" <?php if ( !empty ($options['buttons'][$i]['days_disabler2'])) echo "checked='checked'"; ?> />
|
73 |
+
</td>
|
74 |
+
|
75 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
76 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler3]" type="checkbox" value="1" <?php if ( !empty ($options['buttons'][$i]['days_disabler3'])) echo "checked='checked'"; ?> />
|
77 |
+
</td>
|
78 |
+
|
79 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
80 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler4]" type="checkbox" value="1" <?php if ( !empty ($options['buttons'][$i]['days_disabler4'])) echo "checked='checked'"; ?> />
|
81 |
+
</td>
|
82 |
+
|
83 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
84 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler5]" type="checkbox" value="1" <?php if ( !empty ($options['buttons'][$i]['days_disabler5'])) echo "checked='checked'"; ?> />
|
85 |
+
</td>
|
86 |
+
|
87 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
88 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][days_disabler6]" type="checkbox" value="1" <?php if ( !empty ($options['buttons'][$i]['days_disabler6'])) echo "checked='checked'"; ?> />
|
89 |
+
</td>
|
90 |
+
|
91 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
92 |
+
<span class="spongagge"><?php _e( 'Min Date', 'woocommerce-checkout-manager' ); ?></span>
|
93 |
+
</td>
|
94 |
+
|
95 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
96 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty($options['buttons'][$i]['single_yy'])) ? '' : $options['buttons'][$i]['single_yy']; ?>" />
|
97 |
+
</td>
|
98 |
+
|
99 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
100 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty($options['buttons'][$i]['single_mm'])) ? '' : $options['buttons'][$i]['single_mm']; ?>" />
|
101 |
+
</td>
|
102 |
+
|
103 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
104 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty($options['buttons'][$i]['single_dd'])) ? '' : $options['buttons'][$i]['single_dd']; ?>" />
|
105 |
+
</td>
|
106 |
+
|
107 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
108 |
+
<span class="spongagge"><?php _e( 'Max Date', 'woocommerce-checkout-manager' ); ?></span>
|
109 |
+
</td>
|
110 |
+
|
111 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
112 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_max_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty( $options['buttons'][$i]['single_max_yy'])) ? '' : $options['buttons'][$i]['single_max_yy']; ?>" />
|
113 |
+
</td>
|
114 |
+
|
115 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
116 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_max_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty( $options['buttons'][$i]['single_max_mm'])) ? '' : $options['buttons'][$i]['single_max_mm']; ?>" />
|
117 |
+
</td>
|
118 |
+
|
119 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
120 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][single_max_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty( $options['buttons'][$i]['single_max_dd'])) ? '' : $options['buttons'][$i]['single_max_dd']; ?>" />
|
121 |
+
</td>
|
122 |
+
|
123 |
+
<td class="more_toggler1" style="text-align:center;">
|
124 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][checkbox]" type="checkbox" title="<?php _e( 'Whether or not the Checkout field is required', 'woocommerce-checkout-manager' ); ?>" value="true" <?php if ( !empty ($options['buttons'][$i]['checkbox'])) echo "checked='checked'"; ?> />
|
125 |
+
</td>
|
126 |
+
|
127 |
+
<td class="more_toggler1" style="text-align:center;">
|
128 |
+
<select name="wccs_settings[buttons][<?php echo $i; ?>][position]" title="<?php _e( 'Placement of the Checkout field', 'woocommerce-checkout-manager' ); ?>"> <!--Call run() function-->
|
129 |
+
<option value="form-row-wide" <?php ( !isset( $options['buttons'][$i]['position'] ) ) ? '' : selected( $options['buttons'][$i]['position'], 'form-row-wide' ); ?>><?php _e( 'Wide','woocommerce-checkout-manager' ); ?></option>
|
130 |
+
<option value="form-row-first" <?php ( !isset( $options['buttons'][$i]['position'] ) ) ? '' : selected( $options['buttons'][$i]['position'], 'form-row-first' ); ?>><?php _e( 'Left','woocommerce-checkout-manager' ); ?></option>
|
131 |
+
<option value="form-row-last" <?php ( !isset( $options['buttons'][$i]['position'] ) ) ? '' : selected( $options['buttons'][$i]['position'], 'form-row-last' ); ?>><?php _e( 'Right','woocommerce-checkout-manager' ); ?></option>
|
132 |
+
</select>
|
133 |
+
</td>
|
134 |
+
|
135 |
+
<td class="more_toggler1" style="text-align:center;">
|
136 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][clear_row]" type="checkbox" title="<?php _e( 'Applies a clear fix to the Checkout field', 'woocommerce-checkout-manager' ); ?>" value="true" <?php if ( !empty ($options['buttons'][$i]['clear_row'])) echo "checked='checked'"; ?> />
|
137 |
+
</td>
|
138 |
+
|
139 |
+
<td class="filter_field" style="display:none;text-align:center;">
|
140 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][deny_checkout]" type="checkbox" value="true" <?php if( !empty( $options['buttons'][$i]['deny_checkout'] ) ) echo "checked='checked'"; ?> />
|
141 |
+
</td>
|
142 |
+
|
143 |
+
<td class="filter_field_tog add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
144 |
+
<?php _e('Filter Toggler', 'woocommerce-checkout-manager' ); ?>
|
145 |
+
</td>
|
146 |
+
|
147 |
+
<td class="filter_field" style="display:none;text-align:center;">
|
148 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][tax_remove]" type="checkbox" value="true" <?php if ( !empty ($options['buttons'][$i]['tax_remove'])) echo "checked='checked'"; ?> />
|
149 |
+
</td>
|
150 |
+
|
151 |
+
<td class="filter_field" style="display:none;text-align:center;">
|
152 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][deny_receipt]" type="checkbox" value="true" <?php if ( !empty ($options['buttons'][$i]['deny_receipt'])) echo "checked='checked'"; ?> />
|
153 |
+
</td>
|
154 |
+
|
155 |
+
<td class="filter_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;">
|
156 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][add_amount]" type="checkbox" value="true" <?php if ( !empty ($options['buttons'][$i]['add_amount'])) echo "checked='checked'"; ?> />
|
157 |
+
</td>
|
158 |
+
|
159 |
+
<td class="add_amount_field" style="display:none;text-align:center;">
|
160 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][fee_name]" type="text" value="<?php echo $options['buttons'][$i]['fee_name']; ?>" placeholder="<?php _e('My Custom Charge','woocommerce-checkout-manager'); ?>" />
|
161 |
+
</td>
|
162 |
+
|
163 |
+
<td class="add_amount_field" style="display:none;text-align:center;">
|
164 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][add_amount_field]" type="text" value="<?php echo $options['buttons'][$i]['add_amount_field']; ?>" placeholder="50" />
|
165 |
+
</td>
|
166 |
+
|
167 |
+
<td class="filter_field add_amount_field hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_time hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;">
|
168 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][conditional_parent_use]" type="checkbox" value="true" <?php if ( !empty ($options['buttons'][$i]['conditional_parent_use'])) echo "checked='checked'"; ?> />
|
169 |
+
</td>
|
170 |
+
|
171 |
+
<td class="condition_tick" style="display:none;text-align:center;">
|
172 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][conditional_parent]" type="checkbox" value="true" <?php if ( !empty ($options['buttons'][$i]['conditional_parent'])) echo "checked='checked'"; ?> />
|
173 |
+
</td>
|
174 |
+
|
175 |
+
<td class="more_toggler1">
|
176 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][label]" title="<?php _e( 'Label text for the Checkout field', 'woocommerce-checkout-manager' ); ?>" placeholder="<?php _e('My Field Name','woocommerce-checkout-manager'); ?>" value="<?php echo esc_attr( $options['buttons'][$i]['label'] ); ?>" />
|
177 |
+
</td>
|
178 |
+
|
179 |
+
<td class="more_toggler1">
|
180 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][placeholder]" title="<?php _e( 'Placeholder text for the Checkout field', 'woocommerce-checkout-manager' ); ?>" placeholder="<?php _e('Example red','woocommerce-checkout-manager'); ?>" value="<?php echo (empty($options['buttons'][$i]['placeholder'])) ? '' : $options['buttons'][$i]['placeholder']; ?>" <?php if ( $options['buttons'][$i]['cow'] == 'country' || $options['buttons'][$i]['cow'] == 'state' ) { echo 'readonly="readonly"'; } ?> />
|
181 |
+
</td>
|
182 |
+
|
183 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field">
|
184 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][chosen_valt]" placeholder="<?php _e('Yes','woocommerce-checkout-manager'); ?>" value="<?php echo $options['buttons'][$i]['chosen_valt']; ?>" />
|
185 |
+
</td>
|
186 |
+
|
187 |
+
<td style="display:none;" class="condition_tick">
|
188 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][conditional_tie]" placeholder="<?php _e('Parent Abbr. Name','woocommerce-checkout-manager'); ?>" value="<?php echo $options['buttons'][$i]['conditional_tie']; ?>" />
|
189 |
+
</td>
|
190 |
+
|
191 |
+
<td style="display:none;" class="filter_field">
|
192 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][colorpickerd]" id="billing-colorpic<?php echo $i; ?>" placeholder="<?php _e('#000000','woocommerce-checkout-manager'); ?>" value="<?php echo $options['buttons'][$i]['colorpickerd']; ?>" />
|
193 |
+
</td>
|
194 |
+
|
195 |
+
<td style="display:none;" class="filter_field">
|
196 |
+
<select name="wccs_settings[buttons][<?php echo $i; ?>][colorpickertype]">
|
197 |
+
<option value="farbtastic" <?php (!isset($options['buttons'][$i]['colorpickertype'])) ? '' : selected( $options['buttons'][$i]['colorpickertype'], 'farbtastic' ); ?>><?php _e('Farbtastic','woocommerce-checkout-manager'); ?></option>
|
198 |
+
<option value="iris" <?php (!isset($options['buttons'][$i]['colorpickertype'])) ? '' : selected( $options['buttons'][$i]['colorpickertype'], 'iris' ); ?>><?php _e('Iris','woocommerce-checkout-manager'); ?></option>
|
199 |
+
</select>
|
200 |
+
</td>
|
201 |
+
|
202 |
+
<td style="display:none;text-align:center;" class="filter_field">
|
203 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][user_role]" type="checkbox" value="user_role" <?php if ( !empty ($options['buttons'][$i]['user_role'])) echo "checked='checked'"; ?> />
|
204 |
+
</td>
|
205 |
+
|
206 |
+
<td class="filter_field" style="display:none;">
|
207 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][role_options]" placeholder="Option 1||Option 2||Option 3" value="<?php echo $options['buttons'][$i]['role_options']; ?>" />
|
208 |
+
</td>
|
209 |
+
|
210 |
+
<td class="filter_field" style="display:none;">
|
211 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][role_options2]" placeholder="Option 1||Option 2||Option 3" value="<?php echo $options['buttons'][$i]['role_options2']; ?>" />
|
212 |
+
</td>
|
213 |
+
|
214 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field">
|
215 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][extra_class]" value="<?php echo $options['buttons'][$i]['extra_class']; ?>" />
|
216 |
+
</td>
|
217 |
+
|
218 |
+
<td style="display:none;" class="hide_stuff_change">
|
219 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][changenamep]" id="billing-colorpic<?php echo $i; ?>" placeholder="<?php _e( 'Billing Details', 'woocommerce-checkout-manager' ); ?>" value="<?php echo $options['buttons'][$i]['changenamep']; ?>" />
|
220 |
+
</td>
|
221 |
+
|
222 |
+
<td style="display:none;" class="hide_stuff_change">
|
223 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][changename]" id="billing-colorpic<?php echo $i; ?>" placeholder="<?php _e( 'Bill Form', 'woocommerce-checkout-manager' ); ?>" value="<?php echo $options['buttons'][$i]['changename']; ?>" />
|
224 |
+
</td>
|
225 |
+
|
226 |
+
<td style="display:none;text-align:center;" class="hide_stuff_op wccm1">
|
227 |
+
<input name="wccs_settings[buttons][<?php echo $i; ?>][fancy]" type="checkbox" value="country_select" <?php if ( !empty ($options['buttons'][$i]['fancy'])) echo "checked='checked'"; ?> />
|
228 |
+
</td>
|
229 |
+
|
230 |
+
<td class="hide_stuff_op wccm1" style="display:none;">
|
231 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][force_title2]" placeholder="<?php _e( 'Name Guide', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty($options['buttons'][$i]['force_title2'])) ? '' : $options['buttons'][$i]['force_title2']; ?>" />
|
232 |
+
</td>
|
233 |
+
|
234 |
+
<td class="hide_stuff_op wccm1" style="display:none;">
|
235 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][option_array]" placeholder="Option 1||Option 2||Option 3" value="<?php echo $options['buttons'][$i]['option_array']; ?>" />
|
236 |
+
</td>
|
237 |
+
|
238 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
239 |
+
<?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?>
|
240 |
+
</td>
|
241 |
+
|
242 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change_tog hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
243 |
+
<?php _e('Swapper Toggler', 'woocommerce-checkout-manager' ); ?>
|
244 |
+
</td>
|
245 |
+
|
246 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
247 |
+
<?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?>
|
248 |
+
</td>
|
249 |
+
|
250 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;">
|
251 |
+
<?php _e('Date Toggler', 'woocommerce-checkout-manager' ); ?>
|
252 |
+
</td>
|
253 |
+
|
254 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1">
|
255 |
+
<?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?>
|
256 |
+
</td>
|
257 |
+
|
258 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c" title="<?php _e( 'Open additional options for this Checkout field', 'woocommerce-checkout-manager' ); ?>">
|
259 |
+
<?php _e('More Toggler', 'woocommerce-checkout-manager' ); ?>
|
260 |
+
</td>
|
261 |
+
|
262 |
+
<td class="more_toggler1">
|
263 |
+
<select name="wccs_settings[buttons][<?php echo $i; ?>][type]" title="<?php _e( 'Type of the Checkout field', 'woocommerce-checkout-manager' ); ?>">
|
264 |
+
<option value="wooccmtext" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'wooccmtext' ); ?>><?php _e('Text Input','woocommerce-checkout-manager'); ?></option>
|
265 |
+
<option value="wooccmtextarea" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'wooccmtextarea' ); ?>><?php _e('Textarea','woocommerce-checkout-manager'); ?></option>
|
266 |
+
<option value="wooccmpassword" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'wooccmpassword' ); ?>><?php _e('Password','woocommerce-checkout-manager'); ?></option>
|
267 |
+
<option value="wooccmradio" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'wooccmradio' ); ?>><?php _e('Radio Buttons','woocommerce-checkout-manager'); ?></option>
|
268 |
+
<option value="checkbox_wccm" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'checkbox_wccm' ); ?>><?php _e('Check Box','woocommerce-checkout-manager'); ?></option>
|
269 |
+
<option value="wooccmselect" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'wooccmselect' ); ?>><?php _e('Select Options','woocommerce-checkout-manager'); ?></option>
|
270 |
+
<option value="datepicker" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'datepicker' ); ?>><?php _e('Date Picker','woocommerce-checkout-manager'); ?></option>
|
271 |
+
<option value="changename" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'changename' ); ?>><?php _e('Text/ Html Swapper','woocommerce-checkout-manager'); ?></option>
|
272 |
+
<option value="time" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'time' ); ?>><?php _e('Time Picker','woocommerce-checkout-manager'); ?></option>
|
273 |
+
<option value="colorpicker" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'colorpicker' ); ?>><?php _e('Color Picker','woocommerce-checkout-manager'); ?></option>
|
274 |
+
<option value="heading" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'heading' ); ?>><?php _e('Heading','woocommerce-checkout-manager'); ?></option>
|
275 |
+
<option value="multiselect" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'multiselect' ); ?>><?php _e('Multi-Select','woocommerce-checkout-manager'); ?></option>
|
276 |
+
<option value="multicheckbox" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'multicheckbox' ); ?>><?php _e('Multi-Checkbox','woocommerce-checkout-manager'); ?></option>
|
277 |
+
<option value="wooccmcountry" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'wooccmcountry' ); ?>><?php _e('Country','woocommerce-checkout-manager'); ?></option>
|
278 |
+
<option value="wooccmstate" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'wooccmstate' ); ?>><?php _e('State','woocommerce-checkout-manager'); ?></option>
|
279 |
+
<option value="wooccmupload" <?php (!isset($options['buttons'][$i]['type'])) ? '' : selected( $options['buttons'][$i]['type'], 'wooccmupload' ); ?>><?php _e('File Picker','woocommerce-checkout-manager'); ?></option>
|
280 |
+
</select>
|
281 |
+
</td>
|
282 |
+
|
283 |
+
<td class="more_toggler1">
|
284 |
+
<input type="text" name="wccs_settings[buttons][<?php echo $i; ?>][cow]" placeholder="MyField" title="<?php _e( 'To edit Abbreviations open General > Switches > Editing Of Abbreviation Fields.', 'woocommerce-checkout-manager' ); ?>" value="<?php echo $options['buttons'][$i]['cow']; ?>" <?php if ( empty($options['checkness']['abbreviation'])) { echo 'readonly="readonly"'; } ?> />
|
285 |
+
</td>
|
includes/templates/admin/woocheckout-additional-thead.php
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
+
*/
|
5 |
+
|
6 |
+
// Exit if accessed directly
|
7 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
+
?>
|
9 |
+
|
10 |
+
<th class="more_toggler1c" style="display:none;width: 5%;"><?php _e('More' , 'woocommerce-checkout-manager' ); ?></th>
|
11 |
+
|
12 |
+
<th class="more_toggler1c hidefieldproduct" style="display:none;width: 17%;"><?php _e('Hide Field from Product' , 'woocommerce-checkout-manager' ); ?></th>
|
13 |
+
|
14 |
+
<th class="more_toggler1c" style="display:none;width: 17%;"><?php _e('Show Field for Product' , 'woocommerce-checkout-manager' ); ?></th>
|
15 |
+
|
16 |
+
<th class="more_toggler1c hidefieldcat" style="display:none;width: 20%;"><?php _e('Hide Field from Category' , 'woocommerce-checkout-manager' ); ?></th>
|
17 |
+
|
18 |
+
<th class="more_toggler1c" style="display:none;width: 20%;"><?php _e('Show Field for Category' , 'woocommerce-checkout-manager' ); ?></th>
|
19 |
+
|
20 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('Start Hour' , 'woocommerce-checkout-manager' ); ?></th>
|
21 |
+
|
22 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('End Hour' , 'woocommerce-checkout-manager' ); ?></th>
|
23 |
+
|
24 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('Interval Min.' , 'woocommerce-checkout-manager' ); ?></th>
|
25 |
+
|
26 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('Manual Min.' , 'woocommerce-checkout-manager' ); ?></th>
|
27 |
+
|
28 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;width: 16%;"><?php _e('Date Format' , 'woocommerce-checkout-manager' ); ?></th>
|
29 |
+
|
30 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;width: 5%;"><?php _e('Days before' , 'woocommerce-checkout-manager' ); ?></th>
|
31 |
+
|
32 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;width: 5%;"><?php _e('Days After' , 'woocommerce-checkout-manager' ); ?></th>
|
33 |
+
|
34 |
+
<th class="hide_stuff_color daoo" style="display:none;width: 7%;"><?php _e('Days Enabler' , 'woocommerce-checkout-manager' ); ?></th>
|
35 |
+
|
36 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Sundays' , 'woocommerce-checkout-manager' ); ?></th>
|
37 |
+
|
38 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Mondays' , 'woocommerce-checkout-manager' ); ?></th>
|
39 |
+
|
40 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Tuesdays' , 'woocommerce-checkout-manager' ); ?></th>
|
41 |
+
|
42 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Wednesdays' , 'woocommerce-checkout-manager' ); ?></th>
|
43 |
+
|
44 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Thursdays' , 'woocommerce-checkout-manager' ); ?></th>
|
45 |
+
|
46 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Fridays' , 'woocommerce-checkout-manager' ); ?></th>
|
47 |
+
|
48 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Satudays' , 'woocommerce-checkout-manager' ); ?></th>
|
49 |
+
|
50 |
+
<th class="hide_stuff_color separator hide_stuff_days" style="display:none;" width="3%"><?php _e('' , 'woocommerce-checkout-manager' ); ?></th>
|
51 |
+
|
52 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;text-align:center;" width="5%"><?php _e('YY' , 'woocommerce-checkout-manager' ); ?></th>
|
53 |
+
|
54 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('MM' , 'woocommerce-checkout-manager' ); ?></th>
|
55 |
+
|
56 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('DD' , 'woocommerce-checkout-manager' ); ?></th>
|
57 |
+
|
58 |
+
<th class="hide_stuff_color separator hide_stuff_days" style="display:none;" width="3%"><?php _e('' , 'woocommerce-checkout-manager' ); ?></th>
|
59 |
+
|
60 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;text-align:center;" width="5%"><?php _e('YY' , 'woocommerce-checkout-manager' ); ?></th>
|
61 |
+
|
62 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('MM' , 'woocommerce-checkout-manager' ); ?></th>
|
63 |
+
|
64 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('DD' , 'woocommerce-checkout-manager' ); ?></th>
|
65 |
+
|
66 |
+
<th class="more_toggler1" width="8%"><?php _e('Required' , 'woocommerce-checkout-manager' ); ?></th>
|
67 |
+
|
68 |
+
<th class="more_toggler1" width="5%"><?php _e('Position' , 'woocommerce-checkout-manager' ); ?></th>
|
69 |
+
|
70 |
+
<th class="more_toggler1" width="5%"><?php _e('Clear' , 'woocommerce-checkout-manager' ); ?></th>
|
71 |
+
|
72 |
+
<th class="filter_field" style="display:none;" width="5%"><?php _e('Deny Checkout' , 'woocommerce-checkout-manager' ); ?></th>
|
73 |
+
|
74 |
+
<th style="cursor: pointer; text-align: center; font-size: 30px;display:none;" class="filter_field_tog add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;" width="5%">
|
75 |
+
<span class="toggle_shower">≡</span>
|
76 |
+
</th>
|
77 |
+
|
78 |
+
<th class="filter_field" style="display:none;" width="5%"><?php _e('Remove Tax' , 'woocommerce-checkout-manager' ); ?></th>
|
79 |
+
|
80 |
+
<th class="filter_field" style="display:none;" width="5%"><?php _e('Deny Receipt' , 'woocommerce-checkout-manager' ); ?></th>
|
81 |
+
|
82 |
+
<th class="filter_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c add_amount" style="display:none;" width="5%"><?php _e('Add Amount' , 'woocommerce-checkout-manager' ); ?></th>
|
83 |
+
|
84 |
+
<th class="add_amount_field" style="display:none;" width="5%"><?php _e('Amount Name' , 'woocommerce-checkout-manager' ); ?></th>
|
85 |
+
|
86 |
+
<th class="add_amount_field" style="display:none;" width="5%"><?php _e('Enter Amount' , 'woocommerce-checkout-manager' ); ?></th>
|
87 |
+
|
88 |
+
<th class="filter_field add_amount_field hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c apply_tick" style="display:none;" width="9%"><?php _e('Conditional' , 'woocommerce-checkout-manager' ); ?></th>
|
89 |
+
|
90 |
+
<th class="condition_tick" style="display:none;" width="9%"><?php _e('Conditional Parent' , 'woocommerce-checkout-manager' ); ?></th>
|
91 |
+
|
92 |
+
<th class="more_toggler1"><?php _e('Label' , 'woocommerce-checkout-manager' ); ?></th>
|
93 |
+
|
94 |
+
<th class="more_toggler1"><?php _e('Placeholder' , 'woocommerce-checkout-manager' ); ?></th>
|
95 |
+
|
96 |
+
<th style="display:none; width: 10%;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field"><?php _e('Chosen Value' , 'woocommerce-checkout-manager' ); ?></th>
|
97 |
+
|
98 |
+
<th style="display:none;" class="condition_tick" width="16%"><?php _e('Conditional Tie' , 'woocommerce-checkout-manager' ); ?></th>
|
99 |
+
|
100 |
+
<th style="display:none;width:5%;" class="filter_field" width="1%"><?php _e('Default Color' , 'woocommerce-checkout-manager' ); ?></th>
|
101 |
+
|
102 |
+
<th style="display:none;" class="filter_field" width="5%"><?php _e('Picker Type' , 'woocommerce-checkout-manager' ); ?></th>
|
103 |
+
|
104 |
+
<th style="display:none;" class="filter_field" width="5%"><?php _e('User Role' , 'woocommerce-checkout-manager' ); ?></th>
|
105 |
+
|
106 |
+
<th class="filter_field roles" style="display:none;" width="15%">
|
107 |
+
<?php _e('Show for Roles (Separated by ' , 'woocommerce-checkout-manager' ); ?><span class="toggle_shower current_opener">||</span> )
|
108 |
+
</th>
|
109 |
+
|
110 |
+
<th class="filter_field" style="display:none;" width="15%">
|
111 |
+
<?php _e('Hide from Roles (Separated by ' , 'woocommerce-checkout-manager' ); ?><span class="toggle_shower current_opener">||</span> )
|
112 |
+
</th>
|
113 |
+
|
114 |
+
<th style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field" width="13%"><?php _e('Class' , 'woocommerce-checkout-manager' ); ?></th>
|
115 |
+
|
116 |
+
<th class="hide_stuff_change" style="display:none;"><?php _e('Input Name' , 'woocommerce-checkout-manager' ); ?></th>
|
117 |
+
|
118 |
+
<th class="hide_stuff_change" style="display:none;"><?php _e('Change Name to' , 'woocommerce-checkout-manager' ); ?></th>
|
119 |
+
|
120 |
+
<th class="hide_stuff_op wccm1" style="display:none;" width="10%"><?php _e('Adapt' , 'woocommerce-checkout-manager' ); ?></th>
|
121 |
+
|
122 |
+
<th class="hide_stuff_op wccm1" style="display:none;" width="10%"><?php _e('Title' , 'woocommerce-checkout-manager' ); ?></th>
|
123 |
+
|
124 |
+
<th class="hide_stuff_op wccm1" style="display:none;" width="60%">
|
125 |
+
<?php _e('List of Options (Separated by ' , 'woocommerce-checkout-manager' ); ?> <span class="toggle_shower current_opener">||</span> )
|
126 |
+
</th>
|
127 |
+
|
128 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_tog hide_stuff_color more_toggler1 more_toggler1c" width="2%">
|
129 |
+
<span class="toggle_shower">≡</span>
|
130 |
+
</th>
|
131 |
+
|
132 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field condition_tick hide_stuff_opcheck hide_stuff_time hide_stuff_op hide_stuff_change_tog hide_stuff_color more_toggler1 more_toggler1c" width="2%">
|
133 |
+
<span class="toggle_shower">≡</span>
|
134 |
+
</th>
|
135 |
+
|
136 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field condition_tick hide_stuff_opcheck hide_stuff_op hide_stuff_change hide_stuff_time_tog hide_stuff_color more_toggler1 more_toggler1c" width="2%">
|
137 |
+
<span class="toggle_shower">≡</span>
|
138 |
+
</th>
|
139 |
+
|
140 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_days hide_stuff_color_tog hide_stuff_op more_toggler1 more_toggler1c" width="2%">
|
141 |
+
<span class="toggle_shower">≡</span>
|
142 |
+
</th>
|
143 |
+
|
144 |
+
<th style="display:none;cursor:pointer;text-align:center;font-size:30px;" class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_time hide_stuff_op hide_stuff_color more_toggler1 more_toggler1a" width="2%">
|
145 |
+
<span class="toggle_shower">≡</span>
|
146 |
+
</th>
|
147 |
+
|
148 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler hide_stuff_op more_toggler1c" width="2%">
|
149 |
+
<span class="toggle_shower">≡</span>
|
150 |
+
</th>
|
151 |
+
|
152 |
+
<th class="more_toggler1" style="width:10%;"><?php _e('Choose Type' , 'woocommerce-checkout-manager' ); ?></th>
|
153 |
+
|
154 |
+
<th class="more_toggler1" style="width:5%"><?php _e('Abbreviation' , 'woocommerce-checkout-manager' ); ?></th>
|
includes/templates/admin/woocheckout-additional.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="widefat wccs-table additional-semi" style="display:none;" border="1" name="additional_table">
|
2 |
+
<thead>
|
3 |
+
|
4 |
+
<tr>
|
5 |
+
<th style="width:3%;" class="wccs-order" title="<?php esc_attr_e( 'Change the order of Checkout fields' , 'woocommerce-checkout-manager' ); ?>">#</th>
|
6 |
+
|
7 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-additional-thead.php' ); ?>
|
8 |
+
|
9 |
+
<th width="1%" scope="col" title="<?php esc_attr_e( 'Remove button', 'woocommerce-checkout-manager' ); ?>"><strong>X</strong><!-- remove --></th>
|
10 |
+
</tr>
|
11 |
+
|
12 |
+
</thead>
|
13 |
+
<tbody>
|
14 |
+
|
15 |
+
<?php
|
16 |
+
if( isset( $options['buttons'] ) ) {
|
17 |
+
for( $i = 0; $i < count( $options['buttons'] ); $i++ ) {
|
18 |
+
|
19 |
+
if( !isset( $options['buttons'][$i] ) )
|
20 |
+
break;
|
21 |
+
?>
|
22 |
+
|
23 |
+
<tr valign="top" id="wccs-additional-id-<?php echo $i; ?>" class="wccs-row">
|
24 |
+
|
25 |
+
<td style="display:none;" class="wccs-order-hidden" >
|
26 |
+
<input type="hidden" name="wccs_settings[buttons][<?php echo $i; ?>][order]" value="<?php echo (empty( $options['buttons'][$i]['order'])) ? $i : $options['buttons'][$i]['order']; ?>" />
|
27 |
+
</td>
|
28 |
+
<td class="wccs-order" title="<?php esc_attr_e( 'Drag-and-drop this Checkout field to adjust its ordering', 'woocommerce-checkout-manager' ); ?>"><?php echo $i+1; ?></td>
|
29 |
+
|
30 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-additional-tbody.php' ); ?>
|
31 |
+
|
32 |
+
<td class="wccs-remove"><a class="wccs-remove-button" href="javascript:;" title="<?php esc_attr_e( 'Delete this Checkout field' , 'woocommerce-checkout-manager' ); ?>">×</a></td>
|
33 |
+
|
34 |
+
</tr>
|
35 |
+
<!-- #wccs-additional-id-<?php echo $i; ?> .wccs-row -->
|
36 |
+
|
37 |
+
<?php
|
38 |
+
}
|
39 |
+
}
|
40 |
+
?>
|
41 |
+
|
42 |
+
<?php
|
43 |
+
$i = 999;
|
44 |
+
?>
|
45 |
+
|
46 |
+
<tr valign="top" id="wccs-additional-id-<?php echo $i; ?>" class="wccs-clone">
|
47 |
+
|
48 |
+
<td style="display:none;" class="wccs-order-hidden">
|
49 |
+
<input type="hidden" name="wccs_settings[buttons][<?php echo $i; ?>][order]" value="<?php echo $i; ?>" />
|
50 |
+
</td>
|
51 |
+
|
52 |
+
<td class="wccs-order" title="<?php esc_attr_e( 'Drag-and-drop this Checkout field to adjust its ordering' , 'woocommerce-checkout-manager' ); ?>"><?php echo $i; ?></td>
|
53 |
+
|
54 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-additional-clone.php' ); ?>
|
55 |
+
|
56 |
+
<td class="wccs-remove"><a class="wccs-remove-button" href="javascript:;" title="<?php esc_attr_e( 'Delete this Checkout field' , 'woocommerce-checkout-manager' ); ?>">×</a></td>
|
57 |
+
|
58 |
+
</tr>
|
59 |
+
<!-- #wccs-additional-id-<?php echo $i; ?> .wccs-clone -->
|
60 |
+
</tbody>
|
61 |
+
</table>
|
62 |
+
<!-- .widefat -->
|
63 |
+
|
64 |
+
<div class="wccs-table-footer additional-semi" style="display:none;">
|
65 |
+
<a href="javascript:;" id="wccs-add-button" class="button-secondary"><?php _e( '+ Add New Field' , 'woocommerce-checkout-manager' ); ?></a>
|
66 |
+
</div>
|
67 |
+
<!-- .wccs-table-footer -->
|
includes/templates/admin/woocheckout-billing-clone.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
// Exit if accessed directly
|
8 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
+
?>
|
10 |
+
|
11 |
+
<td style="display:none;text-align:center;" class="more_toggler1c"><input type="checkbox" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][more_content]" title="<?php esc_attr_e( 'More than two content', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
12 |
+
|
13 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_p]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Hide field from this Products Only', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
14 |
+
|
15 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_px]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Display Field for these Products Only', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
16 |
+
|
17 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_p_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Hide field from Category', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
18 |
+
|
19 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_px_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Show Field for Category', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
20 |
+
|
21 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="6" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][start_hour]" value="" /></td>
|
22 |
+
|
23 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="9" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][end_hour]" value="" /></td>
|
24 |
+
|
25 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="15" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][interval_min]" value="" /></td>
|
26 |
+
|
27 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="0, 10, 20, 30, 40" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][manual_min]" value="" /></td>
|
28 |
+
|
29 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][format_date]" placeholder="dd-mm-yy" title="dd-mm-yy" value="" /></td>
|
30 |
+
|
31 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][min_before]" placeholder="+3" title="Days Before" value="" /></td>
|
32 |
+
|
33 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][max_after]" placeholder="3" title="Days After" value="" /></td>
|
34 |
+
|
35 |
+
<td style="display:none;text-align:center;" class="hide_stuff_color daoo"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler]" type="checkbox" value="" /></td>
|
36 |
+
|
37 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler0]" type="checkbox" value="" /></td>
|
38 |
+
|
39 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler1]" type="checkbox" value="" /></td>
|
40 |
+
|
41 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler2]" type="checkbox" value="" /></td>
|
42 |
+
|
43 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler3]" type="checkbox" value="" /></td>
|
44 |
+
|
45 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler4]" type="checkbox" value="" /></td>
|
46 |
+
|
47 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler5]" type="checkbox" value="" /></td>
|
48 |
+
|
49 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler6]" type="checkbox" value="" /></td>
|
50 |
+
|
51 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days" title="<?php esc_attr_e( 'Min Date', 'woocommerce-checkout-manager' ); ?>"><span class="spongagge"><?php _e( 'Min Date', 'woocommerce-checkout-manager' ); ?></span></td>
|
52 |
+
|
53 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
54 |
+
|
55 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
56 |
+
|
57 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
58 |
+
|
59 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days" title="<?php esc_attr_e( 'Max Date', 'woocommerce-checkout-manager' ); ?>"><span class="spongagge"><?php _e( 'Max Date', 'woocommerce-checkout-manager' ); ?></span></td>
|
60 |
+
|
61 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_max_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
62 |
+
|
63 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_max_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
64 |
+
|
65 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_max_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
66 |
+
|
67 |
+
<td class="more_toggler1" style="text-align:center;"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][checkbox]" type="checkbox" title="<?php esc_attr_e( 'Add/Remove Required Attribute', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
68 |
+
|
69 |
+
<td class="more_toggler1" style="text-align:center;">
|
70 |
+
<select name="wccs_settings3[billing_buttons][<?php echo $i; ?>][position]" > <!--Call run() function-->
|
71 |
+
<option value="form-row-wide" ><?php _e( 'Wide','woocommerce-checkout-manager' ); ?></option>
|
72 |
+
<option value="form-row-first" ><?php _e( 'Left','woocommerce-checkout-manager' ); ?></option>
|
73 |
+
<option value="form-row-last" ><?php _e( 'Right','woocommerce-checkout-manager' ); ?></option>
|
74 |
+
</select>
|
75 |
+
</td>
|
76 |
+
|
77 |
+
<td class="more_toggler1" style="text-align:center;"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][clear_row]" type="checkbox" title="<?php esc_attr_e( 'Clear Row', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
78 |
+
|
79 |
+
<td class="filter_field" style="display:none;text-align:center;"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][deny_checkout]" type="checkbox" title="<?php esc_attr_e( 'Deny Checkout', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
80 |
+
|
81 |
+
<td class="filter_field_tog add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Filter Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
82 |
+
|
83 |
+
<td class="filter_field" style="display:none;text-align:center;"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][tax_remove]" type="checkbox" title="<?php esc_attr_e( 'Remove tax', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
84 |
+
|
85 |
+
<td class="filter_field" style="display:none;text-align:center;"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][deny_receipt]" type="checkbox" title="<?php esc_attr_e( 'Deny Receipt', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
86 |
+
|
87 |
+
<td class="filter_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][add_amount]" type="checkbox" title="<?php esc_attr_e( 'Add Amount', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
88 |
+
|
89 |
+
<td class="add_amount_field" style="display:none;text-align:center;"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][fee_name]" type="text" title="<?php esc_attr_e( 'Amount Name', 'woocommerce-checkout-manager' ); ?>" value="" placeholder="<?php _e('My Custom Charge','woocommerce-checkout-manager'); ?>" /></td>
|
90 |
+
|
91 |
+
<td class="add_amount_field" style="display:none;text-align:center;"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][add_amount_field]" type="text" title="<?php esc_attr_e( 'Add Amount Field', 'woocommerce-checkout-manager' ); ?>" value="" placeholder="50" /></td>
|
92 |
+
|
93 |
+
<td class="filter_field add_amount_field hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_time hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][conditional_parent_use]" type="checkbox" title="<?php esc_attr_e( 'Conditional Field On', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
94 |
+
|
95 |
+
<td class="condition_tick" style="display:none;text-align:center;"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][conditional_parent]" type="checkbox" title="<?php esc_attr_e( 'Conditional Parent', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
96 |
+
|
97 |
+
<td class="more_toggler1"><input placeholder="<?php _e('My Field Name','woocommerce-checkout-manager'); ?>" type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][label]" title="<?php esc_attr_e( 'Label of the New Field', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
98 |
+
|
99 |
+
<td class="more_toggler1"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][placeholder]" placeholder="<?php _e('Example red','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Placeholder - Preview of Data to Input', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
100 |
+
|
101 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][chosen_valt]" placeholder="<?php _e('Yes','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Chosen value for conditional', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
102 |
+
|
103 |
+
<td style="display:none;" class="condition_tick"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][conditional_tie]" placeholder="<?php _e('Parent Abbr. Name','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Parent Abbr. Name', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
104 |
+
|
105 |
+
<td style="display:none;" class="filter_field"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][colorpickerd]" id="billing-colorpic<?php echo $i; ?>" title="<?php esc_attr_e( 'Default Color', 'woocommerce-checkout-manager' ); ?>" value="#000000" /></td>
|
106 |
+
|
107 |
+
<td style="display:none;" class="filter_field">
|
108 |
+
<select name="wccs_settings3[billing_buttons][<?php echo $i; ?>][colorpickertype]" > <!--Call run() function-->
|
109 |
+
<option value="farbtastic" ><?php _e('Farbtastic','woocommerce-checkout-manager'); ?></option>
|
110 |
+
<option value="iris" ><?php _e('Iris','woocommerce-checkout-manager'); ?></option>
|
111 |
+
</select>
|
112 |
+
</td>
|
113 |
+
|
114 |
+
<td style="display:none;text-align:center;" class="filter_field"><input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][user_role]" type="checkbox" value="" /></td>
|
115 |
+
|
116 |
+
<td class="filter_field" style="display:none;"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][role_options]" placeholder="Option 1||Option 2||Option 3" value="" /></td>
|
117 |
+
|
118 |
+
<td class="filter_field" style="display:none;"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][role_options2]" placeholder="Option 1||Option 2||Option 3" value="" /></td>
|
119 |
+
|
120 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][extra_class]" value="" /></td>
|
121 |
+
|
122 |
+
<td style="display:none;text-align:center;" class="hide_stuff_op wccm1"><input type="checkbox" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][fancy]" title="<?php esc_attr_e( 'Adapt to woocommerce style', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
123 |
+
|
124 |
+
<td class="hide_stuff_op wccm1" style="display:none;"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][force_title2]" value="" placeholder="<?php _e('Name Guide','woocommerce-checkout-manager'); ?>" /></td>
|
125 |
+
|
126 |
+
<td class="hide_stuff_op wccm1" style="display:none;"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][option_array]" value="" placeholder="Option 1||Option 2||Option 3" /></td>
|
127 |
+
|
128 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
129 |
+
|
130 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
131 |
+
|
132 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;"><?php _e('Date Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
133 |
+
|
134 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1"><?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
135 |
+
|
136 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c"><?php _e('More Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
137 |
+
|
138 |
+
<td class="more_toggler1">
|
139 |
+
<select name="wccs_settings3[billing_buttons][<?php echo $i; ?>][type]" > <!--Call run() function-->
|
140 |
+
<option value="wooccmtext" ><?php _e('Text Input','woocommerce-checkout-manager'); ?></option>
|
141 |
+
<option value="wooccmtextarea" ><?php _e('Textarea','woocommerce-checkout-manager'); ?></option>
|
142 |
+
<option value="wooccmpassword" ><?php _e('Password','woocommerce-checkout-manager'); ?></option>
|
143 |
+
<option value="wooccmradio" ><?php _e('Radio Buttons','woocommerce-checkout-manager'); ?></option>
|
144 |
+
<option value="checkbox_wccm" ><?php _e('Check Box','woocommerce-checkout-manager'); ?></option>
|
145 |
+
<option value="wooccmselect" ><?php _e('Select Options','woocommerce-checkout-manager'); ?></option>
|
146 |
+
<option value="datepicker" ><?php _e('Date Picker','woocommerce-checkout-manager'); ?></option>
|
147 |
+
<option value="time" ><?php _e('Time Picker','woocommerce-checkout-manager'); ?></option>
|
148 |
+
<option value="colorpicker" ><?php _e('Color Picker','woocommerce-checkout-manager'); ?></option>
|
149 |
+
<option value="heading" ><?php _e('Heading','woocommerce-checkout-manager'); ?></option>
|
150 |
+
<option value="multiselect" ><?php _e('Multi-Select','woocommerce-checkout-manager'); ?></option>
|
151 |
+
<option value="multicheckbox" ><?php _e('Multi-Checkbox','woocommerce-checkout-manager'); ?></option>
|
152 |
+
<option value="wooccmcountry" ><?php _e('Country','woocommerce-checkout-manager'); ?></option>
|
153 |
+
<option value="wooccmstate" ><?php _e('State','woocommerce-checkout-manager'); ?></option>
|
154 |
+
<option value="wooccmupload"><?php _e('File Picker','woocommerce-checkout-manager'); ?></option>
|
155 |
+
</select>
|
156 |
+
</td>
|
157 |
+
|
158 |
+
<td class="more_toggler1"><input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][cow]" placeholder="MyField" title="<?php esc_attr_e( 'Abbreviation (No spaces)', 'woocommerce-checkout-manager' ); ?>" value="" <?php if ( empty($options['checkness']['abbreviation'])) { echo 'readonly="readonly"'; } ?> /></td>
|
includes/templates/admin/woocheckout-billing-tbody.php
ADDED
@@ -0,0 +1,272 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
// Exit if accessed directly
|
8 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
+
?>
|
10 |
+
|
11 |
+
<td style="display:none; text-align:center;" class="more_toggler1c">
|
12 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][more_content]" type="checkbox" value="1" <?php if ( !empty ($options3['billing_buttons'][$i]['more_content'])) echo "checked='checked'"; ?> />
|
13 |
+
</td>
|
14 |
+
|
15 |
+
<td style="display:none;" class="more_toggler1c">
|
16 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_p]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['single_p'] ) ? $options3['billing_buttons'][$i]['single_p'] : '' ); ?>" />
|
17 |
+
</td>
|
18 |
+
|
19 |
+
<td style="display:none;" class="more_toggler1c">
|
20 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_px]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['single_px'] ) ? $options3['billing_buttons'][$i]['single_px'] : '' ); ?>" />
|
21 |
+
</td>
|
22 |
+
|
23 |
+
<td style="display:none;" class="more_toggler1c">
|
24 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_p_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['single_p_cat'] ) ? $options3['billing_buttons'][$i]['single_p_cat'] : '' ); ?>" />
|
25 |
+
</td>
|
26 |
+
|
27 |
+
<td style="display:none;" class="more_toggler1c">
|
28 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_px_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['single_px_cat'] ) ? $options3['billing_buttons'][$i]['single_px_cat'] : '' ); ?>" />
|
29 |
+
</td>
|
30 |
+
|
31 |
+
<td style="display:none;" class="hide_stuff_time">
|
32 |
+
<input type="text" placeholder="6" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][start_hour]" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['start_hour'] ) ? $options3['billing_buttons'][$i]['start_hour'] : '' ); ?>" />
|
33 |
+
</td>
|
34 |
+
|
35 |
+
<td style="display:none;" class="hide_stuff_time">
|
36 |
+
<input type="text" placeholder="9" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][end_hour]" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['end_hour'] ) ? $options3['billing_buttons'][$i]['end_hour'] : '' ); ?>" />
|
37 |
+
</td>
|
38 |
+
|
39 |
+
<td style="display:none;" class="hide_stuff_time">
|
40 |
+
<input type="text" placeholder="15" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][interval_min]" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['interval_min'] ) ? $options3['billing_buttons'][$i]['interval_min'] : '' ); ?>" />
|
41 |
+
</td>
|
42 |
+
|
43 |
+
<td style="display:none;" class="hide_stuff_time">
|
44 |
+
<input type="text" placeholder="0, 10, 20, 30, 40" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][manual_min]" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['manual_min'] ) ? $options3['billing_buttons'][$i]['manual_min'] : '' ); ?>" />
|
45 |
+
</td>
|
46 |
+
|
47 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
48 |
+
<input type="text" placeholder="dd-mm-yy" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][format_date]" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['format_date'] ) ? $options3['billing_buttons'][$i]['format_date'] : '' ); ?>" />
|
49 |
+
</td>
|
50 |
+
|
51 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
52 |
+
<input type="text" placeholder="+3" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][min_before]" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['min_before'] ) ? $options3['billing_buttons'][$i]['min_before'] : '' ); ?>" />
|
53 |
+
</td>
|
54 |
+
|
55 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
56 |
+
<input type="text" placeholder="3" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][max_after]" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['max_after'] ) ? $options3['billing_buttons'][$i]['max_after'] : '' ); ?>" />
|
57 |
+
</td>
|
58 |
+
|
59 |
+
<td style="display:none; text-align:center;" class="hide_stuff_color daoo">
|
60 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler]" type="checkbox" value="true" <?php if ( !empty ($options3['billing_buttons'][$i]['days_disabler'])) echo "checked='checked'"; ?> />
|
61 |
+
</td>
|
62 |
+
|
63 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
64 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler0]" type="checkbox" value="1" <?php if ( !empty ($options3['billing_buttons'][$i]['days_disabler0'])) echo "checked='checked'"; ?> />
|
65 |
+
</td>
|
66 |
+
|
67 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
68 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler1]" type="checkbox" value="1" <?php if ( !empty ($options3['billing_buttons'][$i]['days_disabler1'])) echo "checked='checked'"; ?> />
|
69 |
+
</td>
|
70 |
+
|
71 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
72 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler2]" type="checkbox" value="1" <?php if ( !empty ($options3['billing_buttons'][$i]['days_disabler2'])) echo "checked='checked'"; ?> />
|
73 |
+
</td>
|
74 |
+
|
75 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
76 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler3]" type="checkbox" value="1" <?php if ( !empty ($options3['billing_buttons'][$i]['days_disabler3'])) echo "checked='checked'"; ?> />
|
77 |
+
</td>
|
78 |
+
|
79 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
80 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler4]" type="checkbox" value="1" <?php if ( !empty ($options3['billing_buttons'][$i]['days_disabler4'])) echo "checked='checked'"; ?> />
|
81 |
+
</td>
|
82 |
+
|
83 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
84 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler5]" type="checkbox" value="1" <?php if ( !empty ($options3['billing_buttons'][$i]['days_disabler5'])) echo "checked='checked'"; ?> />
|
85 |
+
</td>
|
86 |
+
|
87 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
88 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][days_disabler6]" type="checkbox" value="1" <?php if ( !empty ($options3['billing_buttons'][$i]['days_disabler6'])) echo "checked='checked'"; ?> />
|
89 |
+
</td>
|
90 |
+
|
91 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
92 |
+
<span class="spongagge"><?php _e( 'Min Date', 'woocommerce-checkout-manager' ); ?></span>
|
93 |
+
</td>
|
94 |
+
|
95 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
96 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['single_yy'] ) ? $options3['billing_buttons'][$i]['single_yy'] : '' ); ?>" />
|
97 |
+
</td>
|
98 |
+
|
99 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
100 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['single_mm'] ) ? $options3['billing_buttons'][$i]['single_mm'] : '' ); ?>" />
|
101 |
+
</td>
|
102 |
+
|
103 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
104 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['single_dd'] ) ? $options3['billing_buttons'][$i]['single_dd'] : '' ); ?>" />
|
105 |
+
</td>
|
106 |
+
|
107 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
108 |
+
<span class="spongagge"><?php _e( 'Max Date', 'woocommerce-checkout-manager' ); ?></span>
|
109 |
+
</td>
|
110 |
+
|
111 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
112 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_max_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['single_max_yy'] ) ? $options3['billing_buttons'][$i]['single_max_yy'] : '' ); ?>" />
|
113 |
+
</td>
|
114 |
+
|
115 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
116 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_max_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['single_max_mm'] ) ? $options3['billing_buttons'][$i]['single_max_mm'] : '' ); ?>" />
|
117 |
+
</td>
|
118 |
+
|
119 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
120 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][single_max_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['single_max_dd'] ) ? $options3['billing_buttons'][$i]['single_max_dd'] : '' ); ?>" />
|
121 |
+
</td>
|
122 |
+
|
123 |
+
<td class="more_toggler1" style="text-align:center;">
|
124 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][checkbox]" type="checkbox" title="<?php _e( 'Whether or not the Checkout field is required', 'woocommerce-checkout-manager' ); ?>" value="true" <?php if ( !empty( $options3['billing_buttons'][$i]['checkbox'] ) ) echo "checked='checked'"; ?> />
|
125 |
+
</td>
|
126 |
+
|
127 |
+
<td class="more_toggler1" style="text-align:center;">
|
128 |
+
<select name="wccs_settings3[billing_buttons][<?php echo $i; ?>][position]" title="<?php _e( 'Placement of the Checkout field', 'woocommerce-checkout-manager' ); ?>"> <!--Call run() function-->
|
129 |
+
<option value="form-row-wide" <?php ( !isset( $options3['billing_buttons'][$i]['position'] ) ) ? '' : selected( $options3['billing_buttons'][$i]['position'], 'form-row-wide' ); ?>><?php _e( 'Wide','woocommerce-checkout-manager' ); ?></option>
|
130 |
+
<option value="form-row-first" <?php ( !isset( $options3['billing_buttons'][$i]['position'] ) ) ? '' : selected( $options3['billing_buttons'][$i]['position'], 'form-row-first' ); ?>><?php _e( 'Left','woocommerce-checkout-manager' ); ?></option>
|
131 |
+
<option value="form-row-last" <?php ( !isset( $options3['billing_buttons'][$i]['position'] ) ) ? '' : selected( $options3['billing_buttons'][$i]['position'], 'form-row-last' ); ?>><?php _e( 'Right','woocommerce-checkout-manager' ); ?></option>
|
132 |
+
</select>
|
133 |
+
</td>
|
134 |
+
|
135 |
+
<td class="more_toggler1" style="text-align:center;">
|
136 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][clear_row]" type="checkbox" title="<?php _e( 'Applies a clear fix to the Checkout field', 'woocommerce-checkout-manager' ); ?>" value="true" <?php if ( !empty( $options3['billing_buttons'][$i]['clear_row'] ) ) echo "checked='checked'"; ?> />
|
137 |
+
</td>
|
138 |
+
|
139 |
+
<td class="filter_field" style="display:none;text-align:center;">
|
140 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][deny_checkout]" type="checkbox" value="true" <?php if( !empty( $options3['billing_buttons'][$i]['deny_checkout'] ) ) echo "checked='checked'"; ?> />
|
141 |
+
</td>
|
142 |
+
|
143 |
+
<td class="filter_field_tog add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
144 |
+
<?php _e('Filter Toggler', 'woocommerce-checkout-manager' ); ?>
|
145 |
+
</td>
|
146 |
+
|
147 |
+
<td class="filter_field" style="display:none;text-align:center;">
|
148 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][tax_remove]" type="checkbox" value="true" <?php if ( !empty ($options3['billing_buttons'][$i]['tax_remove'])) echo "checked='checked'"; ?> />
|
149 |
+
</td>
|
150 |
+
|
151 |
+
<td class="filter_field" style="display:none;text-align:center;">
|
152 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][deny_receipt]" type="checkbox" value="true" <?php if ( !empty ($options3['billing_buttons'][$i]['deny_receipt'])) echo "checked='checked'"; ?> />
|
153 |
+
</td>
|
154 |
+
|
155 |
+
<td class="filter_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;">
|
156 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][add_amount]" type="checkbox" value="true" <?php if ( !empty ($options3['billing_buttons'][$i]['add_amount'])) echo "checked='checked'"; ?> />
|
157 |
+
</td>
|
158 |
+
|
159 |
+
<td class="add_amount_field" style="display:none;text-align:center;">
|
160 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][fee_name]" type="text" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['fee_name'] ) ? $options3['billing_buttons'][$i]['fee_name'] : '' ); ?>" placeholder="<?php _e('My Custom Charge','woocommerce-checkout-manager'); ?>" />
|
161 |
+
</td>
|
162 |
+
|
163 |
+
<td class="add_amount_field" style="display:none;text-align:center;">
|
164 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][add_amount_field]" type="text" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['add_amount_field'] ) ? $options3['billing_buttons'][$i]['add_amount_field'] : '' ); ?>" placeholder="50" />
|
165 |
+
</td>
|
166 |
+
|
167 |
+
<td class="filter_field add_amount_field hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_time hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;">
|
168 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][conditional_parent_use]" type="checkbox" value="true" <?php if ( !empty ($options3['billing_buttons'][$i]['conditional_parent_use'])) echo "checked='checked'"; ?> />
|
169 |
+
</td>
|
170 |
+
|
171 |
+
<td class="condition_tick" style="display:none;text-align:center;">
|
172 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][conditional_parent]" type="checkbox" value="true" <?php if ( !empty ($options3['billing_buttons'][$i]['conditional_parent'])) echo "checked='checked'"; ?> />
|
173 |
+
</td>
|
174 |
+
|
175 |
+
<td class="more_toggler1">
|
176 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][label]" title="<?php _e( 'Label text for the Checkout field', 'woocommerce-checkout-manager' ); ?>" placeholder="<?php _e('My Field Name','woocommerce-checkout-manager'); ?>" value="<?php echo esc_attr( $options3['billing_buttons'][$i]['label'] ); ?>" />
|
177 |
+
</td>
|
178 |
+
|
179 |
+
<td class="more_toggler1">
|
180 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][placeholder]" title="<?php _e( 'Placeholder text for the Checkout field', 'woocommerce-checkout-manager' ); ?>" placeholder="<?php _e('Example red','woocommerce-checkout-manager'); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['placeholder'] ) ? $options3['billing_buttons'][$i]['placeholder'] : '' ); ?>" <?php if( $options3['billing_buttons'][$i]['cow'] == 'country' || $options3['billing_buttons'][$i]['cow'] == 'state' ) { echo 'readonly="readonly"'; } ?> />
|
181 |
+
</td>
|
182 |
+
|
183 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field">
|
184 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][chosen_valt]" placeholder="<?php _e('Yes','woocommerce-checkout-manager'); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['chosen_valt'] ) ? $options3['billing_buttons'][$i]['chosen_valt'] : '' ); ?>" />
|
185 |
+
</td>
|
186 |
+
|
187 |
+
<td style="display:none;" class="condition_tick">
|
188 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][conditional_tie]" placeholder="<?php _e('Parent Abbr. Name','woocommerce-checkout-manager'); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['conditional_tie'] ) ? $options3['billing_buttons'][$i]['conditional_tie'] : '' ); ?>" />
|
189 |
+
</td>
|
190 |
+
|
191 |
+
<td style="display:none;" class="filter_field">
|
192 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][colorpickerd]" id="billing-colorpic<?php echo $i; ?>" placeholder="<?php _e('#000000','woocommerce-checkout-manager'); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['colorpickerd'] ) ? $options3['billing_buttons'][$i]['colorpickerd'] : '' ); ?>" />
|
193 |
+
</td>
|
194 |
+
|
195 |
+
<td style="display:none;" class="filter_field">
|
196 |
+
<select name="wccs_settings3[billing_buttons][<?php echo $i; ?>][colorpickertype]">
|
197 |
+
<option value="farbtastic" <?php (!isset($options3['billing_buttons'][$i]['colorpickertype'])) ? '' : selected( $options3['billing_buttons'][$i]['colorpickertype'], 'farbtastic' ); ?>><?php _e('Farbtastic','woocommerce-checkout-manager'); ?></option>
|
198 |
+
<option value="iris" <?php (!isset($options3['billing_buttons'][$i]['colorpickertype'])) ? '' : selected( $options3['billing_buttons'][$i]['colorpickertype'], 'iris' ); ?>><?php _e('Iris','woocommerce-checkout-manager'); ?></option>
|
199 |
+
</select>
|
200 |
+
</td>
|
201 |
+
|
202 |
+
<td style="display:none;text-align:center;" class="filter_field">
|
203 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][user_role]" type="checkbox" value="user_role" <?php if ( !empty ($options3['billing_buttons'][$i]['user_role'])) echo "checked='checked'"; ?> />
|
204 |
+
</td>
|
205 |
+
|
206 |
+
<td class="filter_field" style="display:none;">
|
207 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][role_options]" placeholder="Option 1||Option 2||Option 3" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['role_options'] ) ? $options3['billing_buttons'][$i]['role_options'] : '' ); ?>" />
|
208 |
+
</td>
|
209 |
+
|
210 |
+
<td class="filter_field" style="display:none;">
|
211 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][role_options2]" placeholder="Option 1||Option 2||Option 3" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['role_options2'] ) ? $options3['billing_buttons'][$i]['role_options2'] : '' ); ?>" />
|
212 |
+
</td>
|
213 |
+
|
214 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field">
|
215 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][extra_class]" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['extra_class'] ) ? $options3['billing_buttons'][$i]['extra_class'] : '' ); ?>" />
|
216 |
+
</td>
|
217 |
+
|
218 |
+
<td style="display:none;text-align:center;" class="hide_stuff_op wccm1">
|
219 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][fancy]" type="checkbox" value="country_select" <?php if ( !empty ($options3['billing_buttons'][$i]['fancy'])) echo "checked='checked'"; ?> />
|
220 |
+
</td>
|
221 |
+
|
222 |
+
<td class="hide_stuff_op wccm1" style="display:none;">
|
223 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][force_title2]" placeholder="<?php _e('Name Guide','woocommerce-checkout-manager'); ?>" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['force_title2'] ) ? $options3['billing_buttons'][$i]['force_title2'] : '' ); ?>" />
|
224 |
+
</td>
|
225 |
+
|
226 |
+
<td class="hide_stuff_op wccm1" style="display:none;">
|
227 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][option_array]" placeholder="Option 1||Option 2||Option 3" value="<?php echo ( !empty( $options3['billing_buttons'][$i]['option_array'] ) ? $options3['billing_buttons'][$i]['option_array'] : '' ); ?>" />
|
228 |
+
</td>
|
229 |
+
|
230 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
231 |
+
<?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?>
|
232 |
+
</td>
|
233 |
+
|
234 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
235 |
+
<?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?>
|
236 |
+
</td>
|
237 |
+
|
238 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;">
|
239 |
+
<?php _e('Date Toggler', 'woocommerce-checkout-manager' ); ?>
|
240 |
+
</td>
|
241 |
+
|
242 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1">
|
243 |
+
<?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?>
|
244 |
+
</td>
|
245 |
+
|
246 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c" title="<?php _e( 'Open additional options for this Checkout field', 'woocommerce-checkout-manager' ); ?>">
|
247 |
+
<?php _e('More Toggler', 'woocommerce-checkout-manager' ); ?>
|
248 |
+
</td>
|
249 |
+
|
250 |
+
<td class="more_toggler1">
|
251 |
+
<select name="wccs_settings3[billing_buttons][<?php echo $i; ?>][type]" title="<?php _e( 'Type of the Checkout field', 'woocommerce-checkout-manager' ); ?>" <?php if ( $options3['billing_buttons'][$i]['cow'] == 'country' || $options3['billing_buttons'][$i]['cow'] == 'state' ) { echo 'readonly="readonly" style="pointer-events:none;"'; } ?> > <!--Call run() function-->
|
252 |
+
<option value="wooccmtext" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'wooccmtext' ); ?>><?php _e('Text Input','woocommerce-checkout-manager'); ?></option>
|
253 |
+
<option value="wooccmtextarea" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'wooccmtextarea' ); ?>><?php _e('Textarea','woocommerce-checkout-manager'); ?></option>
|
254 |
+
<option value="wooccmpassword" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'wooccmpassword' ); ?>><?php _e('Password','woocommerce-checkout-manager'); ?></option>
|
255 |
+
<option value="wooccmradio" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'wooccmradio' ); ?>><?php _e('Radio Buttons','woocommerce-checkout-manager'); ?></option>
|
256 |
+
<option value="checkbox_wccm" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'checkbox_wccm' ); ?>><?php _e('Check Box','woocommerce-checkout-manager'); ?></option>
|
257 |
+
<option value="wooccmselect" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'wooccmselect' ); ?>><?php _e('Select Options','woocommerce-checkout-manager'); ?></option>
|
258 |
+
<option value="datepicker" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'datepicker' ); ?>><?php _e('Date Picker','woocommerce-checkout-manager'); ?></option>
|
259 |
+
<option value="time" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'time' ); ?>><?php _e('Time Picker','woocommerce-checkout-manager'); ?></option>
|
260 |
+
<option value="colorpicker" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'colorpicker' ); ?>><?php _e('Color Picker','woocommerce-checkout-manager'); ?></option>
|
261 |
+
<option value="heading" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'heading' ); ?>><?php _e('Heading','woocommerce-checkout-manager'); ?></option>
|
262 |
+
<option value="multiselect" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'multiselect' ); ?>><?php _e('Multi-Select','woocommerce-checkout-manager'); ?></option>
|
263 |
+
<option value="multicheckbox" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'multicheckbox' ); ?>><?php _e('Multi-Checkbox','woocommerce-checkout-manager'); ?></option>
|
264 |
+
<option <?php if ( $options3['billing_buttons'][$i]['cow'] == 'country' ) { echo 'selected="selected"'; } ?> value="wooccmcountry" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'wooccmcountry' ); ?>><?php _e('Country','woocommerce-checkout-manager'); ?></option>
|
265 |
+
<option <?php if ( $options3['billing_buttons'][$i]['cow'] == 'state' ) { echo 'selected="selected"'; } ?> value="wooccmstate" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'wooccmstate' ); ?>><?php _e('State','woocommerce-checkout-manager'); ?></option>
|
266 |
+
<option value="wooccmupload" <?php (!isset($options3['billing_buttons'][$i]['type'])) ? '' : selected( $options3['billing_buttons'][$i]['type'], 'wooccmupload' ); ?>><?php _e('File Picker','woocommerce-checkout-manager'); ?></option>
|
267 |
+
</select>
|
268 |
+
</td>
|
269 |
+
|
270 |
+
<td class="more_toggler1">
|
271 |
+
<input type="text" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][cow]" placeholder="MyField" title="<?php _e( 'To edit Abbreviations open General > Switches > Editing Of Abbreviation Fields.', 'woocommerce-checkout-manager' ); ?>" value="<?php echo $options3['billing_buttons'][$i]['cow']; ?>" <?php if ( empty($options['checkness']['abbreviation'])) { echo 'readonly="readonly"'; } ?> <?php if ( in_array($options3['billing_buttons'][$i]['cow'],$htmlbillingabbr) ) { echo 'readonly="readonly" style="pointer-events:none;"'; } ?> />
|
272 |
+
</td>
|
includes/templates/admin/woocheckout-billing-thead.php
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
+
*/
|
5 |
+
|
6 |
+
// Exit if accessed directly
|
7 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
+
?>
|
9 |
+
|
10 |
+
|
11 |
+
<th class="more_toggler1c" style="display:none;width: 5%;"><?php _e('More' , 'woocommerce-checkout-manager' ); ?></th>
|
12 |
+
|
13 |
+
<th class="more_toggler1c hidefieldproduct" style="display:none;width: 17%;"><?php _e('Hide Field from Product' , 'woocommerce-checkout-manager' ); ?></th>
|
14 |
+
|
15 |
+
<th class="more_toggler1c" style="display:none;width: 17%;"><?php _e('Show Field for Product' , 'woocommerce-checkout-manager' ); ?></th>
|
16 |
+
|
17 |
+
<th class="more_toggler1c hidefieldcat" style="display:none;width: 20%;"><?php _e('Hide Field from Category' , 'woocommerce-checkout-manager' ); ?></th>
|
18 |
+
|
19 |
+
<th class="more_toggler1c" style="display:none;width: 20%;"><?php _e('Show Field for Category' , 'woocommerce-checkout-manager' ); ?></th>
|
20 |
+
|
21 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('Start Hour' , 'woocommerce-checkout-manager' ); ?></th>
|
22 |
+
|
23 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('End Hour' , 'woocommerce-checkout-manager' ); ?></th>
|
24 |
+
|
25 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('Interval Min.' , 'woocommerce-checkout-manager' ); ?></th>
|
26 |
+
|
27 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('Manual Min.' , 'woocommerce-checkout-manager' ); ?></th>
|
28 |
+
|
29 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;width: 16%;"><?php _e('Date Format' , 'woocommerce-checkout-manager' ); ?></th>
|
30 |
+
|
31 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;width: 5%;"><?php _e('Days before' , 'woocommerce-checkout-manager' ); ?></th>
|
32 |
+
|
33 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;width: 5%;"><?php _e('Days After' , 'woocommerce-checkout-manager' ); ?></th>
|
34 |
+
|
35 |
+
<th class="hide_stuff_color daoo" style="display:none;width: 7%;"><?php _e('Days Enabler' , 'woocommerce-checkout-manager' ); ?></th>
|
36 |
+
|
37 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Sundays' , 'woocommerce-checkout-manager' ); ?></th>
|
38 |
+
|
39 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Mondays' , 'woocommerce-checkout-manager' ); ?></th>
|
40 |
+
|
41 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Tuesdays' , 'woocommerce-checkout-manager' ); ?></th>
|
42 |
+
|
43 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Wednesdays' , 'woocommerce-checkout-manager' ); ?></th>
|
44 |
+
|
45 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Thursdays' , 'woocommerce-checkout-manager' ); ?></th>
|
46 |
+
|
47 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Fridays' , 'woocommerce-checkout-manager' ); ?></th>
|
48 |
+
|
49 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Satudays' , 'woocommerce-checkout-manager' ); ?></th>
|
50 |
+
|
51 |
+
<th class="hide_stuff_color separator hide_stuff_days" style="display:none;" width="3%"><?php _e('' , 'woocommerce-checkout-manager' ); ?></th>
|
52 |
+
|
53 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;text-align:center;" width="5%"><?php _e('YY' , 'woocommerce-checkout-manager' ); ?></th>
|
54 |
+
|
55 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('MM' , 'woocommerce-checkout-manager' ); ?></th>
|
56 |
+
|
57 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('DD' , 'woocommerce-checkout-manager' ); ?></th>
|
58 |
+
|
59 |
+
<th class="hide_stuff_color separator hide_stuff_days" style="display:none;" width="3%"><?php _e('' , 'woocommerce-checkout-manager' ); ?></th>
|
60 |
+
|
61 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;text-align:center;" width="5%"><?php _e('YY' , 'woocommerce-checkout-manager' ); ?></th>
|
62 |
+
|
63 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('MM' , 'woocommerce-checkout-manager' ); ?></th>
|
64 |
+
|
65 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('DD' , 'woocommerce-checkout-manager' ); ?></th>
|
66 |
+
|
67 |
+
<th class="more_toggler1" width="8%"><?php _e('Required' , 'woocommerce-checkout-manager' ); ?></th>
|
68 |
+
|
69 |
+
<th class="more_toggler1" width="5%"><?php _e('Position' , 'woocommerce-checkout-manager' ); ?></th>
|
70 |
+
|
71 |
+
<th class="more_toggler1" width="5%"><?php _e('Clear' , 'woocommerce-checkout-manager' ); ?></th>
|
72 |
+
|
73 |
+
<th class="filter_field" style="display:none;" width="5%"><?php _e('Deny Checkout' , 'woocommerce-checkout-manager' ); ?></th>
|
74 |
+
|
75 |
+
<th style="cursor: pointer; text-align: center; font-size: 30px;display:none;" class="filter_field_tog add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;" width="5%"><span class="toggle_shower">≡</span></th>
|
76 |
+
|
77 |
+
<th class="filter_field" style="display:none;" width="5%"><?php _e('Remove Tax' , 'woocommerce-checkout-manager' ); ?></th>
|
78 |
+
|
79 |
+
<th class="filter_field" style="display:none;" width="5%"><?php _e('Deny Receipt' , 'woocommerce-checkout-manager' ); ?></th>
|
80 |
+
|
81 |
+
<th class="filter_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c add_amount" style="display:none;" width="5%"><?php _e('Add Amount' , 'woocommerce-checkout-manager' ); ?></th>
|
82 |
+
|
83 |
+
<th class="add_amount_field" style="display:none;" width="5%"><?php _e('Amount Name' , 'woocommerce-checkout-manager' ); ?></th>
|
84 |
+
|
85 |
+
<th class="add_amount_field" style="display:none;" width="5%"><?php _e('Enter Amount' , 'woocommerce-checkout-manager' ); ?></th>
|
86 |
+
|
87 |
+
<th class="filter_field add_amount_field hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c apply_tick" style="display:none;" width="9%"><?php _e('Conditional' , 'woocommerce-checkout-manager' ); ?></th>
|
88 |
+
|
89 |
+
<th class="condition_tick" style="display:none;" width="9%"><?php _e('Conditional Parent' , 'woocommerce-checkout-manager' ); ?></th>
|
90 |
+
|
91 |
+
<th class="more_toggler1"><?php _e('Label' , 'woocommerce-checkout-manager' ); ?></th>
|
92 |
+
|
93 |
+
<th class="more_toggler1"><?php _e('Placeholder' , 'woocommerce-checkout-manager' ); ?></th>
|
94 |
+
|
95 |
+
<th style="display:none; width: 10%;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field"><?php _e('Chosen Value' , 'woocommerce-checkout-manager' ); ?></th>
|
96 |
+
|
97 |
+
<th style="display:none;" class="condition_tick" width="16%"><?php _e('Conditional Tie' , 'woocommerce-checkout-manager' ); ?></th>
|
98 |
+
|
99 |
+
<th style="display:none;width:5%;" class="filter_field" width="1%"><?php _e('Default Color' , 'woocommerce-checkout-manager' ); ?></th>
|
100 |
+
|
101 |
+
<th style="display:none;" class="filter_field" width="5%"><?php _e('Picker Type' , 'woocommerce-checkout-manager' ); ?></th>
|
102 |
+
|
103 |
+
<th style="display:none;" class="filter_field" width="5%"><?php _e('User Role' , 'woocommerce-checkout-manager' ); ?></th>
|
104 |
+
|
105 |
+
<th class="filter_field roles" style="display:none;" width="15%"><?php _e('Show for Roles (Separated by ' , 'woocommerce-checkout-manager' ); ?><span class="toggle_shower current_opener">||</span> )</th>
|
106 |
+
|
107 |
+
<th class="filter_field" style="display:none;" width="15%"><?php _e('Hide from Roles (Separated by ' , 'woocommerce-checkout-manager' ); ?><span class="toggle_shower current_opener">||</span> )</th>
|
108 |
+
|
109 |
+
<th style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field" width="13%"><?php _e('Class' , 'woocommerce-checkout-manager' ); ?></th>
|
110 |
+
|
111 |
+
<th class="hide_stuff_op wccm1" style="display:none;" width="10%"><?php _e('Adapt' , 'woocommerce-checkout-manager' ); ?></th>
|
112 |
+
|
113 |
+
<th class="hide_stuff_op wccm1" style="display:none;" width="10%"><?php _e('Title' , 'woocommerce-checkout-manager' ); ?></th>
|
114 |
+
|
115 |
+
<th class="hide_stuff_op wccm1" style="display:none;" width="60%"><?php _e('List of Options (Separated by ' , 'woocommerce-checkout-manager' ); ?><span class="toggle_shower current_opener">||</span> )</th>
|
116 |
+
|
117 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_tog hide_stuff_color more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
118 |
+
|
119 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field condition_tick hide_stuff_opcheck hide_stuff_op hide_stuff_change hide_stuff_time_tog hide_stuff_color more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
120 |
+
|
121 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_days hide_stuff_color_tog hide_stuff_op more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
122 |
+
|
123 |
+
<th style="display:none;cursor:pointer;text-align:center;font-size:30px;" class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_time hide_stuff_op hide_stuff_color more_toggler1 more_toggler1a" width="2%"><span class="toggle_shower">≡</span></th>
|
124 |
+
|
125 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler hide_stuff_op more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
126 |
+
|
127 |
+
<th class="more_toggler1" style="width:10%;"><?php _e('Choose Type' , 'woocommerce-checkout-manager' ); ?></th>
|
128 |
+
|
129 |
+
<th class="more_toggler1" style="width:5%"><?php _e('Abbreviation' , 'woocommerce-checkout-manager' ); ?></th>
|
130 |
+
|
includes/templates/admin/woocheckout-billing.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="widefat billing-wccs-table billing-semi" style="display:none;" border="1" name="billing_table">
|
2 |
+
<thead>
|
3 |
+
|
4 |
+
<tr>
|
5 |
+
<th style="width:3%;" class="billing-wccs-order" title="<?php esc_attr_e( 'Change the order of Checkout fields' , 'woocommerce-checkout-manager' ); ?>">#</th>
|
6 |
+
|
7 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-billing-thead.php' ); ?>
|
8 |
+
|
9 |
+
<th width="1%" scope="col" title="<?php esc_attr_e( 'Remove button', 'woocommerce-checkout-manager' ); ?>"><strong>X</strong><!-- remove --></th>
|
10 |
+
</tr>
|
11 |
+
|
12 |
+
</thead>
|
13 |
+
<tbody>
|
14 |
+
|
15 |
+
<?php
|
16 |
+
if( isset( $options3['billing_buttons'] ) ) {
|
17 |
+
$billing = array(
|
18 |
+
'country',
|
19 |
+
'first_name',
|
20 |
+
'last_name',
|
21 |
+
'company',
|
22 |
+
'address_1',
|
23 |
+
'address_2',
|
24 |
+
'city',
|
25 |
+
'state',
|
26 |
+
'postcode',
|
27 |
+
'email',
|
28 |
+
'phone'
|
29 |
+
);
|
30 |
+
for( $i = 0; $i < count( $options3['billing_buttons'] ); $i++ ) {
|
31 |
+
|
32 |
+
if( !isset( $options3['billing_buttons'][$i] ) )
|
33 |
+
break;
|
34 |
+
?>
|
35 |
+
|
36 |
+
<tr valign="top" id="wccs-billing-id-<?php echo $i; ?>" class="billing-wccs-row">
|
37 |
+
|
38 |
+
<td style="display:none;" class="billing-wccs-order-hidden" >
|
39 |
+
<input type="hidden" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][order]" value="<?php echo (empty( $options3['billing_buttons'][$i]['order'])) ? $i : $options3['billing_buttons'][$i]['order']; ?>" />
|
40 |
+
</td>
|
41 |
+
<td class="billing-wccs-order" title="<?php esc_attr_e( 'Drag-and-drop this Checkout field to adjust its ordering', 'woocommerce-checkout-manager' ); ?>"><?php echo $i+1; ?></td>
|
42 |
+
|
43 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-billing-tbody.php' ); ?>
|
44 |
+
|
45 |
+
<?php if( in_array( $options3['billing_buttons'][$i]['cow'], $billing) ) { ?>
|
46 |
+
<td style="text-align:center;">
|
47 |
+
<input name="wccs_settings3[billing_buttons][<?php echo $i; ?>][disabled]" type="checkbox" value="true" <?php if ( !empty ($options3['billing_buttons'][$i]['disabled'])) echo "checked='checked'"; ?> />
|
48 |
+
</td>
|
49 |
+
<?php } else { ?>
|
50 |
+
<td class="billing-wccs-remove"><a class="billing-wccs-remove-button" href="javascript:;" title="<?php esc_attr_e( 'Delete this Checkout field' , 'woocommerce-checkout-manager' ); ?>">×</a></td>
|
51 |
+
<?php } ?>
|
52 |
+
|
53 |
+
</tr>
|
54 |
+
<!-- #wccs-billing-id-<?php echo $i; ?> .billing-wccs-row -->
|
55 |
+
|
56 |
+
<?php
|
57 |
+
}
|
58 |
+
}
|
59 |
+
?>
|
60 |
+
|
61 |
+
<?php
|
62 |
+
$i = 999;
|
63 |
+
?>
|
64 |
+
|
65 |
+
<tr valign="top" id="wccs-billing-id-<?php echo $i; ?>" class="billing-wccs-clone" >
|
66 |
+
|
67 |
+
<td style="display:none;" class="billing-wccs-order-hidden">
|
68 |
+
<input type="hidden" name="wccs_settings3[billing_buttons][<?php echo $i; ?>][order]" value="<?php echo $i; ?>" />
|
69 |
+
</td>
|
70 |
+
|
71 |
+
<td class="billing-wccs-order" title="<?php esc_attr_e( 'Drag-and-drop this Checkout field to adjust its ordering' , 'woocommerce-checkout-manager' ); ?>"><?php echo $i; ?></td>
|
72 |
+
|
73 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-billing-clone.php' ); ?>
|
74 |
+
|
75 |
+
<td class="billing-wccs-remove"><a class="billing-wccs-remove-button" href="javascript:;" title="<?php esc_attr_e( 'Delete this Checkout field' , 'woocommerce-checkout-manager' ); ?>">×</a></td>
|
76 |
+
|
77 |
+
</tr>
|
78 |
+
<!-- #wccs-billing-id-<?php echo $i; ?> .billing-wccs-clone -->
|
79 |
+
</tbody>
|
80 |
+
</table>
|
81 |
+
<!-- .widefat -->
|
82 |
+
|
83 |
+
<div class="billing-wccs-table-footer billing-semi" style="display:none;">
|
84 |
+
<a href="javascript:;" id="billing-wccs-add-button" class="button-secondary"><?php _e( '+ Add New Field' , 'woocommerce-checkout-manager' ); ?></a>
|
85 |
+
</div>
|
86 |
+
<!-- .billing-wccs-table-footer -->
|
includes/{classes/sc/export.css → templates/admin/woocheckout-export.css}
RENAMED
@@ -1,34 +1,34 @@
|
|
1 |
div#welcome-panel.left {
|
2 |
-
|
3 |
}
|
4 |
p.about-description.inner {
|
5 |
-
|
6 |
}
|
7 |
.welcome-panel-column-container a.button.button-hero {
|
8 |
-
|
9 |
}
|
10 |
.welcome-panel .welcome-panel-column:first-child {
|
11 |
float: right;
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
width: 0;
|
17 |
}
|
18 |
p.about-description.heading {
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
}
|
26 |
.welcome-panel .about-description {
|
27 |
float: left;
|
28 |
font-size: 15px;
|
29 |
}
|
30 |
.welcome-panel .welcome-panel-column-container {
|
31 |
-
clear: none
|
32 |
}
|
33 |
.sheet {
|
34 |
background-color: #2EA2CC;
|
@@ -38,22 +38,13 @@ p.about-description.heading {
|
|
38 |
margin-bottom: 20px;
|
39 |
clear: both;
|
40 |
}
|
41 |
-
h1.heading-blue {
|
42 |
-
font-size: 1.5em;
|
43 |
-
background: #222;
|
44 |
-
border-color: #0074a2;
|
45 |
-
padding: 20px 20px 20px 26px;
|
46 |
-
color: #eee;
|
47 |
-
margin: 0;
|
48 |
-
}
|
49 |
div#welcome-panel {
|
50 |
-
max-width: 1040px;
|
51 |
border: 0;
|
52 |
margin-bottom: 0px;
|
53 |
-
background: transparent
|
54 |
}
|
55 |
.welcome-panel.heading {
|
56 |
-
padding: 0
|
57 |
}
|
58 |
.button:hover {
|
59 |
border: 0;
|
@@ -66,6 +57,7 @@ div#welcome-panel {
|
|
66 |
}
|
67 |
.welcome-panel-content {
|
68 |
padding: 10px 0;
|
|
|
69 |
}
|
70 |
div.sep {
|
71 |
border: 1px solid #fff;
|
1 |
div#welcome-panel.left {
|
2 |
+
background-color: #fff;
|
3 |
}
|
4 |
p.about-description.inner {
|
5 |
+
margin-left: 25px;
|
6 |
}
|
7 |
.welcome-panel-column-container a.button.button-hero {
|
8 |
+
padding: 6px 30px;
|
9 |
}
|
10 |
.welcome-panel .welcome-panel-column:first-child {
|
11 |
float: right;
|
12 |
+
top: -33px;
|
13 |
+
position: relative;
|
14 |
+
bottom: 0;
|
15 |
+
margin-bottom: -33px;
|
16 |
width: 0;
|
17 |
}
|
18 |
p.about-description.heading {
|
19 |
+
float: none;
|
20 |
+
margin-left: 30px;
|
21 |
+
color: black;
|
22 |
+
font-weight: 700;
|
23 |
+
margin-top: 10px;
|
24 |
+
margin-bottom: 8px;
|
25 |
}
|
26 |
.welcome-panel .about-description {
|
27 |
float: left;
|
28 |
font-size: 15px;
|
29 |
}
|
30 |
.welcome-panel .welcome-panel-column-container {
|
31 |
+
clear: none;
|
32 |
}
|
33 |
.sheet {
|
34 |
background-color: #2EA2CC;
|
38 |
margin-bottom: 20px;
|
39 |
clear: both;
|
40 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
div#welcome-panel {
|
|
|
42 |
border: 0;
|
43 |
margin-bottom: 0px;
|
44 |
+
background: transparent;
|
45 |
}
|
46 |
.welcome-panel.heading {
|
47 |
+
padding: 0;
|
48 |
}
|
49 |
.button:hover {
|
50 |
border: 0;
|
57 |
}
|
58 |
.welcome-panel-content {
|
59 |
padding: 10px 0;
|
60 |
+
max-width:100%;
|
61 |
}
|
62 |
div.sep {
|
63 |
border: 1px solid #fff;
|
includes/templates/admin/woocheckout-general-address-fields.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="widefat general-semi address_fields" border="1" style="display:none;">
|
2 |
+
|
3 |
+
<div class="section">
|
4 |
+
|
5 |
+
<h3 class="heading"><?php _e( 'Disable Billing Address fields for certain products', 'woocommerce-checkout-manager' ); ?></h3>
|
6 |
+
<div class="option">
|
7 |
+
<input type="text" name="wccs_settings[checkness][productssave]" style="width: 100%;" value="<?php echo ( !empty( $options['checkness']['productssave'] ) ? sanitize_text_field( $options['checkness']['productssave'] ) : '' ); ?>" />
|
8 |
+
<h3 class="heading address"><div class="info-of"><?php _e('To get product number, goto the listing of WooCoommerce Products then hover over each product and you will see ID. Example', 'woocommerce-checkout-manager'); ?> "ID: 3651"</div></h3>
|
9 |
+
</div>
|
10 |
+
<!-- .option -->
|
11 |
+
|
12 |
+
</div>
|
13 |
+
<!-- .section -->
|
14 |
+
|
15 |
+
</div>
|
16 |
+
<!-- .address_fields -->
|
includes/templates/admin/woocheckout-general-advanced.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="widefat general-semi advanced" border="1" style="display:none;">
|
2 |
+
|
3 |
+
<div class="section">
|
4 |
+
<h3 class="heading"><?php _e('Advanced', 'woocommerce-checkout-manager'); ?></h3>
|
5 |
+
</div>
|
6 |
+
<!-- .section -->
|
7 |
+
|
8 |
+
<div class="section">
|
9 |
+
|
10 |
+
<div class="option">
|
11 |
+
<div class="info-of"><?php _e('Administrator Actions', 'woocommerce-checkout-manager'); ?></div>
|
12 |
+
<?php if( current_user_can( 'manage_options' ) ) { ?>
|
13 |
+
<ul>
|
14 |
+
<li><a href="<?php echo add_query_arg( array( 'action' => 'wooccm_reset_update_notice', '_wpnonce' => wp_create_nonce( 'wooccm_reset_update_notice' ) ) ); ?>"><?php _e( 'Reset <em>Run the updater</em> prompt', 'woocommerce-checkout-manager' ); ?></a></li>
|
15 |
+
<li><a href="<?php echo add_query_arg( array( 'action' => 'wooccm_nuke_options', '_wpnonce' => wp_create_nonce( 'wooccm_nuke_options' ) ) ); ?>" class="confirm-button" data-confirm="<?php _e( 'This will permanently delete all WordPress Options associated with WooCommerce Checkout Manager. Are you sure you want to proceed?', 'woocommerce-checkout-manager' ); ?>"><?php _e( 'Delete WooCommerce Checkout Manager WordPress Options', 'woocommerce-checkout-manager' ); ?></a></li>
|
16 |
+
<li><a href="<?php echo add_query_arg( array( 'action' => 'wooccm_nuke_order_meta', '_wpnonce' => wp_create_nonce( 'wooccm_nuke_order_meta' ) ) ); ?>" class="confirm-button" data-confirm="<?php _e( 'This will permanently delete all WordPress Post meta associated with WooCommerce Checkout Manager that is linked to Orders. Are you sure you want to proceed?', 'woocommerce-checkout-manager' ); ?>"><?php _e( 'Delete WooCommerce Checkout Manager Orders Post meta', 'woocommerce-checkout-manager' ); ?></a></li>
|
17 |
+
<li><a href="<?php echo add_query_arg( array( 'action' => 'wooccm_nuke_user_meta', '_wpnonce' => wp_create_nonce( 'wooccm_nuke_user_meta' ) ) ); ?>" class="confirm-button" data-confirm="<?php _e( 'This will permanently delete all WordPress Post meta associated with WooCommerce Checkout Manager that is linked to Users. Are you sure you want to proceed?', 'woocommerce-checkout-manager' ); ?>"><?php _e( 'Delete WooCommerce Checkout Manager Users Post meta', 'woocommerce-checkout-manager' ); ?></a></li>
|
18 |
+
</ul>
|
19 |
+
<?php } else { ?>
|
20 |
+
<p><?php _e( 'These actions are available only to WordPress Users with the <em>manage_options</em> User Capability.', 'woocommerce-checkout-manager' ); ?></p>
|
21 |
+
<?php } ?>
|
22 |
+
</div>
|
23 |
+
<!-- .option -->
|
24 |
+
|
25 |
+
</div>
|
26 |
+
<!-- .section -->
|
27 |
+
|
28 |
+
</div>
|
29 |
+
<!--.advanced -->
|
includes/templates/admin/woocheckout-general-checkout-notices.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="widefat general-semi checkout_notices" border="1" style="display:none;" >
|
2 |
+
|
3 |
+
<div class="section">
|
4 |
+
|
5 |
+
<h3 class="heading"><?php _e('Position for notification one', 'woocommerce-checkout-manager'); ?></h3>
|
6 |
+
|
7 |
+
<h3 class="heading checkbox">
|
8 |
+
|
9 |
+
<div class="option">
|
10 |
+
<label>
|
11 |
+
<input type="checkbox" name="wccs_settings[checkness][checkbox1]" style="float:left;" value="true"<?php checked( !empty( $options['checkness']['checkbox1'] ), true ); ?> />
|
12 |
+
<div class="info-of"><?php _e('Before Customer Address Fields', 'woocommerce-checkout-manager'); ?></div>
|
13 |
+
</label>
|
14 |
+
</div>
|
15 |
+
<!-- .option -->
|
16 |
+
|
17 |
+
</h3>
|
18 |
+
<!-- .heading -->
|
19 |
+
|
20 |
+
<h3 class="heading checkbox">
|
21 |
+
|
22 |
+
<div class="option">
|
23 |
+
<label>
|
24 |
+
<input type="checkbox" name="wccs_settings[checkness][checkbox2]" style="float:left;" value="true"<?php checked( !empty( $options['checkness']['checkbox2'] ), true ); ?> />
|
25 |
+
<div class="info-of"><?php _e('Before Order Summary', 'woocommerce-checkout-manager'); ?></div>
|
26 |
+
</label>
|
27 |
+
</div>
|
28 |
+
<!-- .option -->
|
29 |
+
|
30 |
+
</h3>
|
31 |
+
<!-- .heading -->
|
32 |
+
|
33 |
+
<div class="option">
|
34 |
+
<div class="info-of"><?php _e('Notification text area: You can use class', 'woocommerce-checkout-manager'); ?> "woocommerce-info" <?php _e('for the same design as WooCommerce Coupon.', 'woocommerce-checkout-manager'); ?></div>
|
35 |
+
<textarea type="textarea" name="wccs_settings[checkness][text1]" class="full-width" style="height:150px;"><?php echo ( !empty( $options['checkness']['text1'] ) ? esc_attr( $options['checkness']['text1'] ) : '' ); ?></textarea>
|
36 |
+
</div>
|
37 |
+
<!-- .option -->
|
38 |
+
|
39 |
+
</div>
|
40 |
+
<!-- section -->
|
41 |
+
|
42 |
+
<div class="section">
|
43 |
+
|
44 |
+
<h3 class="heading"><?php _e('Position for notification two', 'woocommerce-checkout-manager'); ?></h3>
|
45 |
+
|
46 |
+
<h3 class="heading checkbox">
|
47 |
+
|
48 |
+
<div class="option">
|
49 |
+
<label>
|
50 |
+
<input type="checkbox" name="wccs_settings[checkness][checkbox3]" style="float:left;" value="true"<?php checked( !empty( $options['checkness']['checkbox3'] ), true ); ?> />
|
51 |
+
<div class="info-of"><?php _e('Before Customer Address Fields', 'woocommerce-checkout-manager'); ?></div>
|
52 |
+
</label>
|
53 |
+
</div>
|
54 |
+
<!-- .option -->
|
55 |
+
|
56 |
+
</h3>
|
57 |
+
<!-- .heading -->
|
58 |
+
|
59 |
+
<h3 class="heading checkbox">
|
60 |
+
|
61 |
+
<div class="option">
|
62 |
+
<label>
|
63 |
+
<input type="checkbox" name="wccs_settings[checkness][checkbox4]" style="float:left;" value="true"<?php checked( !empty( $options['checkness']['checkbox4'] ), true ); ?> />
|
64 |
+
<div class="info-of"><?php _e('Before Order Summary', 'woocommerce-checkout-manager'); ?></div>
|
65 |
+
</label>
|
66 |
+
</div>
|
67 |
+
<!-- .option -->
|
68 |
+
|
69 |
+
</h3>
|
70 |
+
<!-- .heading -->
|
71 |
+
|
72 |
+
<div class="option">
|
73 |
+
<div class="info-of"><?php _e('Notification text area: You can use class', 'woocommerce-checkout-manager'); ?> "woocommerce-info" <?php _e('for the same design as WooCommerce Coupon.', 'woocommerce-checkout-manager'); ?></div>
|
74 |
+
<textarea type="textarea" name="wccs_settings[checkness][text2]" class="full-width" style="height:150px;"><?php echo ( !empty( $options['checkness']['text2'] ) ? esc_attr( $options['checkness']['text2'] ) : '' ); ?></textarea>
|
75 |
+
</div>
|
76 |
+
<!-- .option -->
|
77 |
+
|
78 |
+
</div>
|
79 |
+
<!-- section -->
|
80 |
+
|
81 |
+
</div>
|
82 |
+
<!-- .checkout_notices -->
|
includes/templates/admin/woocheckout-general-custom-css.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="widefat general-semi custom_css" border="1" style="display:none;">
|
2 |
+
|
3 |
+
<div class="section">
|
4 |
+
|
5 |
+
<h3 class="heading"><?php _e('Custom CSS','woocommerce-checkout-manager'); ?></h3>
|
6 |
+
|
7 |
+
<div class="option">
|
8 |
+
<textarea type="text" name="wccs_settings[checkness][custom_css_w]" class="full-width" style="height:200px;"><?php echo ( !empty( $options['checkness']['custom_css_w'] ) ? esc_textarea( $options['checkness']['custom_css_w'] ) : '' ); ?></textarea>
|
9 |
+
</div>
|
10 |
+
<!-- .option -->
|
11 |
+
|
12 |
+
<h3 class="heading checkbox">
|
13 |
+
|
14 |
+
<div class="option">
|
15 |
+
<div class="info-of">
|
16 |
+
<?php _e('CSS language stands for Cascading Style Sheets which is used to style html content. You can change the fonts size, colours, margins of content, which lines to show or input, adjust height, width, background images etc.','woocommerce-checkout-manager'); ?>
|
17 |
+
<?php _e('Get help in our', 'woocommerce-checkout-manager'); ?> <a href="https://wordpress.org/support/plugin/woocommerce-checkout-manager" target="_blank"><?php _e('Support Forum', 'woocommerce-checkout-manager'); ?></a>.
|
18 |
+
</div>
|
19 |
+
</div>
|
20 |
+
<!-- .option -->
|
21 |
+
|
22 |
+
</h3>
|
23 |
+
|
24 |
+
</div>
|
25 |
+
<!-- .section -->
|
26 |
+
|
27 |
+
</div>
|
28 |
+
<!-- .custom_css -->
|
includes/templates/admin/woocheckout-general-order-notes.php
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="widefat general-semi order_notes" border="1" style="display:none;">
|
2 |
+
|
3 |
+
<div class="section">
|
4 |
+
|
5 |
+
<h3 class="heading"><?php _e('Order Notes','woocommerce-checkout-manager'); ?></h3>
|
6 |
+
|
7 |
+
<div class="option">
|
8 |
+
<div class="info-of"><?php _e('Order Notes Label', 'woocommerce-checkout-manager'); ?></div>
|
9 |
+
<input type="text" name="wccs_settings[checkness][noteslabel]" class="full-width" style="clear:both;" value="<?php echo ( isset( $options['checkness']['noteslabel'] ) ? sanitize_text_field( $options['checkness']['noteslabel'] ) : '' ); ?>" />
|
10 |
+
</div>
|
11 |
+
<!-- .option -->
|
12 |
+
|
13 |
+
<div class="option">
|
14 |
+
<div class="info-of"><?php _e('Order Notes Placeholder', 'woocommerce-checkout-manager'); ?></div>
|
15 |
+
<input type="text" name="wccs_settings[checkness][notesplaceholder]" class="full-width" style="clear:both;" value="<?php echo ( isset( $options['checkness']['notesplaceholder'] ) ? sanitize_text_field( $options['checkness']['notesplaceholder'] ) : '' ); ?>" />
|
16 |
+
</div>
|
17 |
+
<!-- .option -->
|
18 |
+
|
19 |
+
<h3 class="heading checkbox" style="clear:both;">
|
20 |
+
|
21 |
+
<div class="option">
|
22 |
+
<label>
|
23 |
+
<input type="checkbox" name="wccs_settings[checkness][notesenable]" value="true"<?php checked( !empty( $options['checkness']['notesenable'] ), true ); ?> />
|
24 |
+
<div class="info-of"><?php _e('Disable Order Notes.', 'woocommerce-checkout-manager'); ?></div>
|
25 |
+
</label>
|
26 |
+
</div>
|
27 |
+
<!-- .option -->
|
28 |
+
|
29 |
+
</h3>
|
30 |
+
|
31 |
+
</div>
|
32 |
+
<!-- .section -->
|
33 |
+
|
34 |
+
<div class="section">
|
35 |
+
|
36 |
+
<h3 class="heading"><?php _e('Time Order was purchased', 'woocommerce-checkout-manager'); ?></h3>
|
37 |
+
|
38 |
+
<div class="option">
|
39 |
+
<div class="info-of"><?php _e('Order time title', 'woocommerce-checkout-manager'); ?></div>
|
40 |
+
<input type="text" name="wccs_settings[checkness][time_stamp_title]" class="full-width" style="clear:both;" value="<?php echo ( !empty( $options['checkness']['time_stamp_title'] ) ? sanitize_text_field( $options['checkness']['time_stamp_title'] ) : '' ); ?>" />
|
41 |
+
</div>
|
42 |
+
<!-- .option -->
|
43 |
+
|
44 |
+
<div class="option">
|
45 |
+
<div class="info-of"><?php _e('Set TimeZone', 'woocommerce-checkout-manager'); ?></div>
|
46 |
+
<input type="text" name="wccs_settings[checkness][set_timezone]" class="full-width" style="clear:both;" value="<?php echo ( !empty( $options['checkness']['set_timezone'] ) ? sanitize_text_field( $options['checkness']['set_timezone'] ) : '' ); ?>" />
|
47 |
+
</div>
|
48 |
+
<!-- .option -->
|
49 |
+
|
50 |
+
<h3 class="heading checkbox" style="clear:both;">
|
51 |
+
|
52 |
+
<div class="option">
|
53 |
+
<label>
|
54 |
+
<input type="checkbox" name="wccs_settings[checkness][time_stamp]" value="true"<?php checked( !empty( $options['checkness']['time_stamp'] ), true ); ?> />
|
55 |
+
<div class="info-of"><?php _e('Enable display of order time.', 'woocommerce-checkout-manager'); ?></div>
|
56 |
+
</label>
|
57 |
+
</div>
|
58 |
+
<!-- .option -->
|
59 |
+
|
60 |
+
<div class="option">
|
61 |
+
<label>
|
62 |
+
<input type="checkbox" name="wccs_settings[checkness][twenty_hour]" value="true"<?php checked( !empty( $options['checkness']['twenty_hour]'] ), true ); ?> />
|
63 |
+
<div class="info-of"><?php _e('Enable 24 hour time.', 'woocommerce-checkout-manager'); ?></div>
|
64 |
+
</label>
|
65 |
+
</div>
|
66 |
+
<!-- .option -->
|
67 |
+
|
68 |
+
</h3>
|
69 |
+
<!-- .heading -->
|
70 |
+
|
71 |
+
</div>
|
72 |
+
<!-- .section -->
|
73 |
+
|
74 |
+
<div class="section">
|
75 |
+
|
76 |
+
<h3 class="heading"><?php _e('Payment Method used by Customer', 'woocommerce-checkout-manager'); ?></h3>
|
77 |
+
|
78 |
+
<div class="option">
|
79 |
+
<input type="text" name="wccs_settings[checkness][payment_method_d]" class="full-width" value="<?php echo ( !empty( $options['checkness']['payment_method_d'] ) ? sanitize_text_field( $options['checkness']['payment_method_d'] ) : '' ); ?>" />
|
80 |
+
</div>
|
81 |
+
<!-- .option -->
|
82 |
+
|
83 |
+
<h3 class="heading checkbox">
|
84 |
+
|
85 |
+
<div class="option">
|
86 |
+
<label>
|
87 |
+
<input type="checkbox" name="wccs_settings[checkness][payment_method_t]" value="true" <?php checked( !empty( $options['checkness']['payment_method_t'] ), true ) ?> />
|
88 |
+
<div class="info-of"><?php _e('Enable display of Payment Method.', 'woocommerce-checkout-manager'); ?></div>
|
89 |
+
</label>
|
90 |
+
</div>
|
91 |
+
<!-- .option -->
|
92 |
+
|
93 |
+
</h3>
|
94 |
+
<!-- .heading -->
|
95 |
+
|
96 |
+
</div>
|
97 |
+
<!-- .section -->
|
98 |
+
|
99 |
+
<div class="section">
|
100 |
+
|
101 |
+
<h3 class="heading"><?php _e('Shipping method used by customer', 'woocommerce-checkout-manager'); ?></h3>
|
102 |
+
|
103 |
+
<div class="option">
|
104 |
+
<input type="text" name="wccs_settings[checkness][shipping_method_d]" class="full-width" value="<?php echo ( !empty( $options['checkness']['shipping_method_d'] ) ? sanitize_text_field( $options['checkness']['shipping_method_d'] ) : '' ) ?>" />
|
105 |
+
</div>
|
106 |
+
<!-- .option -->
|
107 |
+
|
108 |
+
<h3 class="heading checkbox">
|
109 |
+
|
110 |
+
<div class="option">
|
111 |
+
<label>
|
112 |
+
<input type="checkbox" name="wccs_settings[checkness][shipping_method_t]" value="true"<?php checked( !empty( $options['checkness']['shipping_method_t'] ), true ); ?> />
|
113 |
+
<div class="info-of"><?php _e('Enable display of Shipping Method.', 'woocommerce-checkout-manager'); ?></div>
|
114 |
+
</label>
|
115 |
+
</div>
|
116 |
+
<!-- .option -->
|
117 |
+
|
118 |
+
</h3>
|
119 |
+
<!-- .heading -->
|
120 |
+
|
121 |
+
</div>
|
122 |
+
<!-- .section -->
|
123 |
+
|
124 |
+
<div class="section">
|
125 |
+
|
126 |
+
<h3 class="heading"><?php _e('Default State code for Checkout.', 'woocommerce-checkout-manager'); ?></h3>
|
127 |
+
|
128 |
+
<div class="option">
|
129 |
+
<input type="text" placeholder="ND" name="wccs_settings[checkness][per_state]" class="full-width" value="<?php echo ( !empty( $options['checkness']['per_state'] ) ? sanitize_text_field( $options['checkness']['per_state'] ) : '' ); ?>" />
|
130 |
+
</div>
|
131 |
+
<!-- .option -->
|
132 |
+
|
133 |
+
<h3 class="heading checkbox">
|
134 |
+
|
135 |
+
<div class="option">
|
136 |
+
<label>
|
137 |
+
<input type="checkbox" name="wccs_settings[checkness][per_state_check]" value="true" <?php checked( !empty( $options['checkness']['per_state_check'] ), true ); ?> />
|
138 |
+
<div class="info-of"><?php _e('Enable default state code.', 'woocommerce-checkout-manager'); ?></div>
|
139 |
+
</label>
|
140 |
+
</div>
|
141 |
+
<!-- .option -->
|
142 |
+
|
143 |
+
</h3>
|
144 |
+
<!-- .heading -->
|
145 |
+
|
146 |
+
</div>
|
147 |
+
<!-- .section -->
|
148 |
+
|
149 |
+
</div>
|
150 |
+
<!-- .order_notes -->
|
includes/templates/admin/woocheckout-general-switches.php
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// Defaults
|
3 |
+
$position = ( !empty( $options['checkness']['position'] ) ? sanitize_text_field( $options['checkness']['position'] ) : 'after_order_notes' );
|
4 |
+
?>
|
5 |
+
|
6 |
+
<div class="widefat general-semi switches" border="1" style="display:none;">
|
7 |
+
|
8 |
+
<div class="section">
|
9 |
+
<h3 class="heading"><?php _e('General Switches', 'woocommerce-checkout-manager'); ?></h3>
|
10 |
+
</div>
|
11 |
+
<!-- .section -->
|
12 |
+
|
13 |
+
<div class="section">
|
14 |
+
<h3 class="heading checkbox">
|
15 |
+
|
16 |
+
<div class="option">
|
17 |
+
<label>
|
18 |
+
<input type="checkbox" name="wccs_settings[checkness][additional_info]" value="true"<?php checked( !empty( $options['checkness']['additional_info'] ), true ); ?> />
|
19 |
+
<div class="info-of"><?php printf( __('Hide %s heading', 'woocommerce-checkout-manager'), __( 'Ship to a different address?', 'woocommerce-checkout-manager' ) ); ?></div>
|
20 |
+
</label>
|
21 |
+
</div>
|
22 |
+
<!-- .option -->
|
23 |
+
|
24 |
+
</h3>
|
25 |
+
</div>
|
26 |
+
<!-- section -->
|
27 |
+
|
28 |
+
<div class="section">
|
29 |
+
<h3 class="heading checkbox">
|
30 |
+
|
31 |
+
<div class="option">
|
32 |
+
<label>
|
33 |
+
<input type="checkbox" name="wccs_settings[checkness][show_shipping_fields]" value="true"<?php checked( !empty( $options['checkness']['show_shipping_fields'] ), true ); ?> />
|
34 |
+
<div class="info-of"><?php printf( __( ' Force show Shipping Checkout fields (to be used in conjunction with %s)', 'woocommerce-checkout-manager' ), sprintf( __( 'Hide %s heading', 'woocommerce-checkout-manager' ), __( 'Ship to a different address?', 'woocommerce-checkout-manager' ) ) ); ?></div>
|
35 |
+
</label>
|
36 |
+
</div>
|
37 |
+
<!-- .option -->
|
38 |
+
|
39 |
+
</h3>
|
40 |
+
</div>
|
41 |
+
<!-- section -->
|
42 |
+
|
43 |
+
<div class="section">
|
44 |
+
<h3 class="heading checkbox">
|
45 |
+
|
46 |
+
<div class="option">
|
47 |
+
<label>
|
48 |
+
<input type="checkbox" name="wccs_settings[checkness][auto_create_wccm_account]" value="true"<?php checked( !empty( $options['checkness']['auto_create_wccm_account'] ), true ); ?> />
|
49 |
+
<div class="info-of"><?php printf( __( 'Hide %s checkbox on Checkout page for guests', 'woocommerce-checkout-manager' ), __( 'Create an account?', 'woocommerce-checkout-manager' ) ); ?></div>
|
50 |
+
</label>
|
51 |
+
</div>
|
52 |
+
<!-- .option -->
|
53 |
+
|
54 |
+
</h3>
|
55 |
+
</div>
|
56 |
+
<!-- section -->
|
57 |
+
|
58 |
+
<div class="section">
|
59 |
+
<h3 class="heading checkbox">
|
60 |
+
|
61 |
+
<div class="option">
|
62 |
+
<label>
|
63 |
+
<input type="checkbox" name="wccs_settings[checkness][retainval]" value="true"<?php checked( !empty( $options['checkness']['retainval'] ), true ); ?> />
|
64 |
+
<div class="info-of"><?php _e('Retain Fields Information', 'woocommerce-checkout-manager'); ?></div>
|
65 |
+
</label>
|
66 |
+
</div>
|
67 |
+
<!-- .option -->
|
68 |
+
|
69 |
+
</h3>
|
70 |
+
</div>
|
71 |
+
<!-- section -->
|
72 |
+
|
73 |
+
<div class="section">
|
74 |
+
<h3 class="heading checkbox">
|
75 |
+
|
76 |
+
<div class="option">
|
77 |
+
<label>
|
78 |
+
<input type="checkbox" name="wccs_settings[checkness][abbreviation]" value="true"<?php checked( !empty( $options['checkness']['abbreviation'] ), true ); ?> />
|
79 |
+
<div class="info-of"><?php _e('Editing Of Abbreviation Fields', 'woocommerce-checkout-manager'); ?></div>
|
80 |
+
</label>
|
81 |
+
</div>
|
82 |
+
<!-- .option -->
|
83 |
+
|
84 |
+
</h3>
|
85 |
+
</div>
|
86 |
+
<!-- section -->
|
87 |
+
|
88 |
+
<div class="section">
|
89 |
+
<h3 class="heading checkbox">
|
90 |
+
|
91 |
+
<div class="option">
|
92 |
+
<label>
|
93 |
+
<input type="checkbox" name="wccs_settings[checkness][admin_translation]" value="true"<?php checked( !empty( $options['checkness']['admin_translation'] ), true ); ?> />
|
94 |
+
<div class="info-of"><?php _e('Translate WooCommerce Checkout Manager Options Panel', 'woocommerce-checkout-manager'); ?></div>
|
95 |
+
</label>
|
96 |
+
</div>
|
97 |
+
<!-- .option -->
|
98 |
+
|
99 |
+
</h3>
|
100 |
+
</div>
|
101 |
+
<!-- section -->
|
102 |
+
|
103 |
+
<div class="section">
|
104 |
+
<h3 class="heading"><?php _e('Additional Fields Position on Checkout', 'woocommerce-checkout-manager'); ?></h3>
|
105 |
+
</div>
|
106 |
+
<!-- .section -->
|
107 |
+
|
108 |
+
<div class="section">
|
109 |
+
<h3 class="heading checkbox radio">
|
110 |
+
|
111 |
+
<div class="option">
|
112 |
+
<label>
|
113 |
+
<input type="radio" name="wccs_settings[checkness][position]" value="before_billing_form"<?php checked( $position, 'before_billing_form' ); ?> />
|
114 |
+
<div class="info-of"><?php _e( 'Before Billing fields', 'woocommerce-checkout-manager' ); ?></div>
|
115 |
+
<div class="info-of">- <?php _e( 'Additional Checkout fields will appear before the Billing Checkout fields section.', 'woocommerce-checkout-manager' ); ?></div>
|
116 |
+
</label>
|
117 |
+
</div>
|
118 |
+
<!-- .option -->
|
119 |
+
|
120 |
+
</h3>
|
121 |
+
</div>
|
122 |
+
<!-- section -->
|
123 |
+
|
124 |
+
<div class="section">
|
125 |
+
<h3 class="heading checkbox radio">
|
126 |
+
|
127 |
+
<div class="option">
|
128 |
+
<label>
|
129 |
+
<input type="radio" name="wccs_settings[checkness][position]" value="after_billing_form"<?php checked( $position, 'after_billing_form' ); ?> />
|
130 |
+
<div class="info-of"><?php _e('After Billing fields', 'woocommerce-checkout-manager'); ?></div>
|
131 |
+
<div class="info-of">- <?php _e('Additional Checkout fields will appear after the Billing Checkout fields section.', 'woocommerce-checkout-manager'); ?></div>
|
132 |
+
</label>
|
133 |
+
</div>
|
134 |
+
<!-- .option -->
|
135 |
+
|
136 |
+
</h3>
|
137 |
+
</div>
|
138 |
+
<!-- section -->
|
139 |
+
|
140 |
+
<div class="section">
|
141 |
+
<h3 class="heading checkbox radio">
|
142 |
+
|
143 |
+
<div class="option">
|
144 |
+
<label>
|
145 |
+
<input type="radio" name="wccs_settings[checkness][position]" value="before_shipping_form"<?php checked( $position, 'before_shipping_form' ); ?> />
|
146 |
+
<div class="info-of"><?php _e('Before Shipping fields', 'woocommerce-checkout-manager'); ?></div>
|
147 |
+
<div class="info-of">- <?php _e('Additional Checkout fields will appear before the Shipping Checkout fields section.', 'woocommerce-checkout-manager'); ?></div>
|
148 |
+
</label>
|
149 |
+
</div>
|
150 |
+
<!-- .option -->
|
151 |
+
|
152 |
+
</h3>
|
153 |
+
</div>
|
154 |
+
<!-- section -->
|
155 |
+
|
156 |
+
<div class="section">
|
157 |
+
<h3 class="heading checkbox radio">
|
158 |
+
|
159 |
+
<div class="option">
|
160 |
+
<label>
|
161 |
+
<input type="radio" name="wccs_settings[checkness][position]" value="after_shipping_form"<?php checked( $position, 'after_shipping_form' ); ?> />
|
162 |
+
<div class="info-of"><?php _e('After Shipping fields', 'woocommerce-checkout-manager'); ?></div>
|
163 |
+
<div class="info-of">- <?php _e('Additional Checkout fields will appear after the Shipping Checkout fields section.', 'woocommerce-checkout-manager'); ?></div>
|
164 |
+
</label>
|
165 |
+
</div>
|
166 |
+
<!-- .option -->
|
167 |
+
|
168 |
+
</h3>
|
169 |
+
</div>
|
170 |
+
<!-- section -->
|
171 |
+
|
172 |
+
<div class="section">
|
173 |
+
<h3 class="heading checkbox radio">
|
174 |
+
|
175 |
+
<div class="option">
|
176 |
+
<label>
|
177 |
+
<input type="radio" name="wccs_settings[checkness][position]" value="after_order_notes"<?php checked( $position, 'after_order_notes' ); ?> />
|
178 |
+
<div class="info-of"><?php _e('After Order Notes', 'woocommerce-checkout-manager'); ?> (<?php _e( 'Default', 'woocommerce-checkout-manager' ); ?>)</div>
|
179 |
+
<div class="info-of">- <?php _e('Additional Checkout fields will appear after the Order Notes Checkout section.', 'woocommerce-checkout-manager'); ?></div>
|
180 |
+
</label>
|
181 |
+
</div>
|
182 |
+
<!-- .option -->
|
183 |
+
|
184 |
+
</h3>
|
185 |
+
</div>
|
186 |
+
<!-- section -->
|
187 |
+
|
188 |
+
</div>
|
189 |
+
<!-- .switches -->
|
includes/templates/admin/woocheckout-general-uploads.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="widefat general-semi upload_files" border="0">
|
2 |
+
|
3 |
+
<div class="section">
|
4 |
+
<h3 class="heading"><?php _e('General File Upload', 'woocommerce-checkout-manager'); ?></h3>
|
5 |
+
</div>
|
6 |
+
<!-- .section -->
|
7 |
+
|
8 |
+
<div class="section">
|
9 |
+
<h3 class="heading checkbox">
|
10 |
+
<div class="option">
|
11 |
+
<label>
|
12 |
+
<input type="checkbox" name="wccs_settings[checkness][enable_file_upload]" value="true"<?php checked( !empty( $options['checkness']['enable_file_upload'] ), true ); ?> /><span></span>
|
13 |
+
<div class="info-of"><?php _e('Allow Customers to Upload Files', 'woocommerce-checkout-manager'); ?></div>
|
14 |
+
</label>
|
15 |
+
</div>
|
16 |
+
<!-- .option -->
|
17 |
+
</h3>
|
18 |
+
</div>
|
19 |
+
<!-- .section -->
|
20 |
+
|
21 |
+
<div class="section">
|
22 |
+
<h3 class="heading checkbox">
|
23 |
+
<div class="option">
|
24 |
+
<label>
|
25 |
+
<input type="checkbox" name="wccs_settings[checkness][cat_file_upload]" value="true"<?php checked( !empty( $options['checkness']['cat_file_upload'] ), true ); ?> /><span></span>
|
26 |
+
<div class="info-of">
|
27 |
+
|
28 |
+
<?php _e('Categorize Uploaded Files', 'woocommerce-checkout-manager'); ?> | <span style="cursor: pointer;" class="show_hide2"><a>read more</a></span>
|
29 |
+
<span style="display:none;" class="slidingDiv2">
|
30 |
+
<br /><br />
|
31 |
+
<?php _e('Changes uploaded files location folder from', 'woocommerce-checkout-manager'); ?> <br />
|
32 |
+
<strong><?php echo $upload_dir['url']; ?>/</strong> <br />
|
33 |
+
<?php _e('to', 'woocommerce-checkout-manager'); ?><br />
|
34 |
+
<strong><?php echo $upload_dir['baseurl']; ?>/wooccm_uploads/{order number}/</strong>
|
35 |
+
</span>
|
36 |
+
|
37 |
+
</div>
|
38 |
+
</label>
|
39 |
+
</div>
|
40 |
+
<!-- .option -->
|
41 |
+
</h3>
|
42 |
+
</div>
|
43 |
+
<!-- .section -->
|
44 |
+
|
45 |
+
<div class="section">
|
46 |
+
<h3 class="heading"><?php _e('Upload Title', 'woocommerce-checkout-manager'); ?></h3>
|
47 |
+
<div class="option">
|
48 |
+
<input type="text" name="wccs_settings[checkness][upload_title]" class="full-width" placeholder="<?php _e( 'Order Uploaded Files', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( isset( $options['checkness']['upload_title'] ) ? esc_attr( $options['checkness']['upload_title'] ) : '' ); ?>" />
|
49 |
+
</div>
|
50 |
+
<!-- .option -->
|
51 |
+
</div>
|
52 |
+
<!-- .section -->
|
53 |
+
|
54 |
+
<div class="section">
|
55 |
+
<h3 class="heading"><?php _e('Notification E-mail', 'woocommerce-checkout-manager'); ?></h3>
|
56 |
+
<div class="option">
|
57 |
+
<input type="text" name="wccs_settings[checkness][wooccm_notification_email]" class="full-width" value="<?php echo ( isset( $options['checkness']['wooccm_notification_email'] ) ? sanitize_text_field( $options['checkness']['wooccm_notification_email'] ) : '' ); ?>" />
|
58 |
+
</div>
|
59 |
+
<!-- .option -->
|
60 |
+
</div>
|
61 |
+
<!-- .section -->
|
62 |
+
|
63 |
+
<div class="section">
|
64 |
+
<h3 class="heading"><?php _e('Products', 'woocommerce-checkout-manager'); ?></h3>
|
65 |
+
<div class="info-of"><?php _e('Allow File Upload', 'woocommerce-checkout-manager'); ?></div>
|
66 |
+
<div class="option allow">
|
67 |
+
<input type="text" name="wccs_settings[checkness][allow_file_upload]" class="full-width" placeholder="<?php _e( 'Enter Product ID(s); Example: 1674, 1423, 1234', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty($options['checkness']['allow_file_upload']) ? sanitize_text_field( $options['checkness']['allow_file_upload'] ) : '' ); ?>" />
|
68 |
+
</div>
|
69 |
+
<!-- .option -->
|
70 |
+
</div>
|
71 |
+
<!-- .section -->
|
72 |
+
|
73 |
+
<div class="section">
|
74 |
+
<div class="info-of"><?php _e('Deny File Upload', 'woocommerce-checkout-manager'); ?></div>
|
75 |
+
<div class="option">
|
76 |
+
<input type="text" name="wccs_settings[checkness][deny_file_upload]" class="full-width" placeholder="<?php _e( 'Enter Product ID(s); Example: 1674, 1423, 1234', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options['checkness']['deny_file_upload'] ) ? sanitize_text_field( $options['checkness']['deny_file_upload'] ) : '' ); ?>" />
|
77 |
+
</div>
|
78 |
+
<!-- .option -->
|
79 |
+
</div>
|
80 |
+
<!-- .section -->
|
81 |
+
|
82 |
+
<div class="section">
|
83 |
+
<h3 class="heading"><?php _e('Categories', 'woocommerce-checkout-manager'); ?></h3>
|
84 |
+
<div class="info-of"><?php _e('Allow File Upload', 'woocommerce-checkout-manager'); ?></div>
|
85 |
+
<div class="option allow">
|
86 |
+
<input type="text" name="wccs_settings[checkness][allow_file_upload_cat]" class="full-width" placeholder="<?php _e( 'Enter Category Slug(s); Example: my-cat, flowers_in', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options['checkness']['allow_file_upload_cat'] ) ? sanitize_text_field( $options['checkness']['allow_file_upload_cat'] ) : '' ); ?>" />
|
87 |
+
</div>
|
88 |
+
<!-- .option -->
|
89 |
+
</div>
|
90 |
+
<!-- .section -->
|
91 |
+
|
92 |
+
<div class="section">
|
93 |
+
<div class="info-of"><?php _e('Deny File Upload', 'woocommerce-checkout-manager'); ?></div>
|
94 |
+
<div class="option">
|
95 |
+
<input type="text" name="wccs_settings[checkness][deny_file_upload_cat]" class="full-width" placeholder="<?php _e( 'Enter Category Slug(s); Example: my-cat, flowers_in', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options['checkness']['deny_file_upload_cat'] ) ? sanitize_text_field( $options['checkness']['deny_file_upload_cat'] ) : '' ); ?>" />
|
96 |
+
</div>
|
97 |
+
<!-- .option -->
|
98 |
+
</div>
|
99 |
+
<!-- .section -->
|
100 |
+
|
101 |
+
<div class="section">
|
102 |
+
<h3 class="heading"><?php _e('General Alerts', 'woocommerce-checkout-manager'); ?></h3>
|
103 |
+
<div class="info-of"><?php _e('Picture Editing Saved', 'woocommerce-checkout-manager'); ?></div>
|
104 |
+
<div class="option allow">
|
105 |
+
<input type="text" name="wccs_settings[checkness][picture_success]" class="full-width" placeholder="<?php _e( 'Picture Saved', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options['checkness']['picture_success'] ) ? sanitize_text_field( $options['checkness']['picture_success'] ) : __( 'Picture Saved!', 'woocommerce-checkout-manager' ) ); ?>" />
|
106 |
+
</div>
|
107 |
+
<!-- .option -->
|
108 |
+
</div>
|
109 |
+
<!-- .section -->
|
110 |
+
|
111 |
+
<div class="section">
|
112 |
+
<div class="info-of"><?php _e('Deletion confirmation', 'woocommerce-checkout-manager'); ?></div>
|
113 |
+
<div class="option">
|
114 |
+
<input type="text" name="wccs_settings[checkness][file_delete]" class="full-width" placeholder="<?php _e( 'Delete', 'woocommerce-checkout-manager' ); ?>" value="<?php echo ( !empty( $options['checkness']['file_delete'] ) ? sanitize_text_field( $options['checkness']['file_delete'] ) : __( 'Delete', 'woocommerce-checkout-manager' ) ); ?>" />
|
115 |
+
</div>
|
116 |
+
<!-- .option -->
|
117 |
+
</div>
|
118 |
+
<!-- .section -->
|
119 |
+
|
120 |
+
<div class="section">
|
121 |
+
|
122 |
+
<h3 class="heading"><?php _e('Restrictions', 'woocommerce-checkout-manager'); ?></h3>
|
123 |
+
|
124 |
+
<div class="info-of"><?php _e('File types', 'woocommerce-checkout-manager'); ?></div>
|
125 |
+
<div class="option allow">
|
126 |
+
<input type="text" name="wccs_settings[checkness][file_types]" class="full-width" placeholder="png,jpeg,gif" value="<?php echo ( !empty( $options['checkness']['file_types'] ) ? sanitize_text_field( $options['checkness']['file_types'] ) : '' ); ?>" />
|
127 |
+
</div>
|
128 |
+
<!-- .option -->
|
129 |
+
|
130 |
+
<div class="info-of"><?php _e('Number Of Files to Upload', 'woocommerce-checkout-manager'); ?></div>
|
131 |
+
<div class="option allow">
|
132 |
+
<input type="text" name="wccs_settings[checkness][file_upload_number]" class="full-width" placeholder="4" value="<?php echo ( !empty( $options['checkness']['file_upload_number'] ) ? absint( $options['checkness']['file_upload_number'] ) : '' ); ?>" />
|
133 |
+
</div>
|
134 |
+
<!-- .option -->
|
135 |
+
|
136 |
+
</div>
|
137 |
+
<!-- .section -->
|
138 |
+
|
139 |
+
<div class="section">
|
140 |
+
|
141 |
+
<div class="info-of"><?php _e('Allow Upload for Order Status', 'woocommerce-checkout-manager'); ?></div>
|
142 |
+
<div class="option">
|
143 |
+
<input type="text" name="wccs_settings[checkness][upload_os]" class="full-width" placeholder="completed" value="<?php echo ( !empty( $options['checkness']['upload_os'] ) ? sanitize_text_field( $options['checkness']['upload_os'] ) : '' ); ?>" />
|
144 |
+
</div>
|
145 |
+
<!-- .option -->
|
146 |
+
|
147 |
+
</div>
|
148 |
+
<!-- .section -->
|
149 |
+
|
150 |
+
</div>
|
151 |
+
<!-- .upload_files -->
|
includes/templates/admin/woocheckout-general.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="general-semi-nav">
|
2 |
+
|
3 |
+
<div id="main-nav-left">
|
4 |
+
<ul>
|
5 |
+
<li class="upload_class current">
|
6 |
+
<a title="<?php _e( 'Uploads', 'woocommerce-checkout-manager' ); ?>"><?php _e( 'Uploads', 'woocommerce-checkout-manager' ); ?></a>
|
7 |
+
</li>
|
8 |
+
<li class="address_fields_class">
|
9 |
+
<a title="<?php _e( 'Address Fields', 'woocommerce-checkout-manager' ); ?>"><?php _e( 'Hide Address Fields', 'woocommerce-checkout-manager' ); ?></a>
|
10 |
+
</li>
|
11 |
+
<li class="checkout_notice_class">
|
12 |
+
<a title="<?php _e( 'Checkout Notices', 'woocommerce-checkout-manager' ); ?>"><?php _e( 'Checkout Notices', 'woocommerce-checkout-manager' ); ?></a>
|
13 |
+
</li>
|
14 |
+
<li class="switches_class">
|
15 |
+
<a title="<?php _e( 'Switches', 'woocommerce-checkout-manager' ); ?>"><?php _e( 'Switches', 'woocommerce-checkout-manager' ); ?></a>
|
16 |
+
</li>
|
17 |
+
<li class="order_notes_class">
|
18 |
+
<a title="<?php _e( 'Order Notes', 'woocommerce-checkout-manager' ); ?>"><?php _e( 'Order Notes', 'woocommerce-checkout-manager' ); ?></a>
|
19 |
+
</li>
|
20 |
+
<li class="custom_css_class">
|
21 |
+
<a title="<?php _e( 'Custom CSS', 'woocommerce-checkout-manager' ); ?>"><?php _e( 'Custom CSS', 'woocommerce-checkout-manager' ); ?></a>
|
22 |
+
</li>
|
23 |
+
<li class="advanced_class">
|
24 |
+
<a title="<?php _e( 'Advanced', 'woocommerce-checkout-manager' ); ?>"><?php _e( 'Advanced', 'woocommerce-checkout-manager' ); ?></a>
|
25 |
+
</li>
|
26 |
+
</ul>
|
27 |
+
</div>
|
28 |
+
<!-- #main-nav-left -->
|
29 |
+
|
30 |
+
<div id="content-nav-right" class="general-vibe">
|
31 |
+
|
32 |
+
<!-- Uploads tab -->
|
33 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-general-uploads.php' ); ?>
|
34 |
+
|
35 |
+
<!-- Hide Address Fields tab -->
|
36 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-general-address-fields.php' ); ?>
|
37 |
+
|
38 |
+
<!-- Order Notes tab -->
|
39 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-general-order-notes.php' ); ?>
|
40 |
+
|
41 |
+
<!-- Custom CSS tab -->
|
42 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-general-custom-css.php' ); ?>
|
43 |
+
|
44 |
+
<!-- Checkout Notices tab -->
|
45 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-general-checkout-notices.php' ); ?>
|
46 |
+
|
47 |
+
<!-- Switches tab -->
|
48 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-general-switches.php' ); ?>
|
49 |
+
|
50 |
+
<!-- Advanced tab -->
|
51 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-general-advanced.php' ); ?>
|
52 |
+
|
53 |
+
</div>
|
54 |
+
<!-- #content-nav-right -->
|
55 |
+
|
56 |
+
</div>
|
57 |
+
<!-- #general-semi-nav -->
|
includes/templates/admin/woocheckout-shipping-clone.php
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
// Exit if accessed directly
|
8 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
+
?>
|
10 |
+
|
11 |
+
<td style="display:none;text-align:center;" class="more_toggler1c"><input type="checkbox" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][more_content]" title="<?php esc_attr_e( 'More than two content', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
12 |
+
|
13 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_p]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Hide field from this Products Only', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
14 |
+
|
15 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_px]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Display Field for these Products Only', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
16 |
+
|
17 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_p_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Hide field from Category', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
18 |
+
|
19 |
+
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_px_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Show Field for Category', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
20 |
+
|
21 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="6" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][start_hour]" value="" /></td>
|
22 |
+
|
23 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="9" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][end_hour]" value="" /></td>
|
24 |
+
|
25 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="15" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][interval_min]" value="" /></td>
|
26 |
+
|
27 |
+
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="0, 10, 20, 30, 40" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][manual_min]" value="" /></td>
|
28 |
+
|
29 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][format_date]" placeholder="dd-mm-yy" title="dd-mm-yy" value="" /></td>
|
30 |
+
|
31 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][min_before]" placeholder="+3" title="Days Before" value="" /></td>
|
32 |
+
|
33 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][max_after]" placeholder="3" title="Days After" value="" /></td>
|
34 |
+
|
35 |
+
<td style="display:none;text-align:center;" class="hide_stuff_color daoo"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler]" type="checkbox" value="" /></td>
|
36 |
+
|
37 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler0]" type="checkbox" value="" /></td>
|
38 |
+
|
39 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler1]" type="checkbox" value="" /></td>
|
40 |
+
|
41 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler2]" type="checkbox" value="" /></td>
|
42 |
+
|
43 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler3]" type="checkbox" value="" /></td>
|
44 |
+
|
45 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler4]" type="checkbox" value="" /></td>
|
46 |
+
|
47 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler5]" type="checkbox" value="" /></td>
|
48 |
+
|
49 |
+
<td style="display:none;text-align:center;" class="hide_stuff_days"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler6]" type="checkbox" value="" /></td>
|
50 |
+
|
51 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days" title="<?php esc_attr_e( 'Min Date', 'woocommerce-checkout-manager' ); ?>"><span class="spongagge"><?php _e( 'Min Date', 'woocommerce-checkout-manager' ); ?></span></td>
|
52 |
+
|
53 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
54 |
+
|
55 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
56 |
+
|
57 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
58 |
+
|
59 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days" title="<?php esc_attr_e( 'Max Date', 'woocommerce-checkout-manager' ); ?>"><span class="spongagge"><?php _e( 'Max Date', 'woocommerce-checkout-manager' ); ?></span></td>
|
60 |
+
|
61 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_max_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
62 |
+
|
63 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_max_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
64 |
+
|
65 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_max_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
66 |
+
|
67 |
+
<td class="more_toggler1" style="text-align:center;"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][checkbox]" type="checkbox" title="<?php esc_attr_e( 'Add/Remove Required Attribute', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
68 |
+
|
69 |
+
<td class="more_toggler1" style="text-align:center;">
|
70 |
+
<select name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][position]" > <!--Call run() function-->
|
71 |
+
<option value="form-row-wide" ><?php _e( 'Wide','woocommerce-checkout-manager' ); ?></option>
|
72 |
+
<option value="form-row-first" ><?php _e( 'Left','woocommerce-checkout-manager' ); ?></option>
|
73 |
+
<option value="form-row-last" ><?php _e( 'Right','woocommerce-checkout-manager' ); ?></option>
|
74 |
+
</select>
|
75 |
+
</td>
|
76 |
+
|
77 |
+
<td class="more_toggler1" style="text-align:center;"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][clear_row]" type="checkbox" title="<?php esc_attr_e( 'Clear Row', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
78 |
+
|
79 |
+
<td class="filter_field" style="display:none;text-align:center;"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][deny_checkout]" type="checkbox" title="<?php esc_attr_e( 'Deny Checkout', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
80 |
+
|
81 |
+
<td class="filter_field_tog add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Filter Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
82 |
+
|
83 |
+
<td class="filter_field" style="display:none;text-align:center;"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][tax_remove]" type="checkbox" title="<?php esc_attr_e( 'Remove tax', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
84 |
+
|
85 |
+
<td class="filter_field" style="display:none;text-align:center;"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][deny_receipt]" type="checkbox" title="<?php esc_attr_e( 'Deny Receipt', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
86 |
+
|
87 |
+
<td class="filter_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][add_amount]" type="checkbox" title="<?php esc_attr_e( 'Add Amount', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
88 |
+
|
89 |
+
<td class="add_amount_field" style="display:none;text-align:center;"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][fee_name]" type="text" title="<?php esc_attr_e( 'Amount Name', 'woocommerce-checkout-manager' ); ?>" value="" placeholder="<?php _e('My Custom Charge','woocommerce-checkout-manager'); ?>" /></td>
|
90 |
+
|
91 |
+
<td class="add_amount_field" style="display:none;text-align:center;"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][add_amount_field]" type="text" title="<?php esc_attr_e( 'Add Amount Field', 'woocommerce-checkout-manager' ); ?>" value="" placeholder="50" /></td>
|
92 |
+
|
93 |
+
<td class="filter_field add_amount_field hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_time hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][conditional_parent_use]" type="checkbox" title="<?php esc_attr_e( 'Conditional Field On', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
94 |
+
|
95 |
+
<td class="condition_tick" style="display:none;text-align:center;"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][conditional_parent]" type="checkbox" title="<?php esc_attr_e( 'Conditional Parent', 'woocommerce-checkout-manager' ); ?>" value=" " /></td>
|
96 |
+
|
97 |
+
<td class="more_toggler1"><input placeholder="<?php _e('My Field Name','woocommerce-checkout-manager'); ?>" type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][label]" title="<?php esc_attr_e( 'Label of the New Field', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
98 |
+
|
99 |
+
<td class="more_toggler1"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][placeholder]" placeholder="<?php _e('Example red','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Placeholder - Preview of Data to Input', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
100 |
+
|
101 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][chosen_valt]" placeholder="<?php _e('Yes','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Chosen value for conditional', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
102 |
+
|
103 |
+
<td style="display:none;" class="condition_tick"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][conditional_tie]" placeholder="<?php _e('Parent Abbr. Name','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'Parent Abbr. Name', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
104 |
+
|
105 |
+
<td style="display:none;" class="filter_field"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][colorpickerd]" id="shipping-colorpic<?php echo $i; ?>" title="<?php esc_attr_e( 'Default Color', 'woocommerce-checkout-manager' ); ?>" value="#000000" /></td>
|
106 |
+
|
107 |
+
<td style="display:none;" class="filter_field">
|
108 |
+
<select name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][colorpickertype]" > <!--Call run() function-->
|
109 |
+
<option value="farbtastic" ><?php _e('Farbtastic','woocommerce-checkout-manager'); ?></option>
|
110 |
+
<option value="iris" ><?php _e('Iris','woocommerce-checkout-manager'); ?></option>
|
111 |
+
</select>
|
112 |
+
</td>
|
113 |
+
|
114 |
+
<td style="display:none;text-align:center;" class="filter_field"><input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][user_role]" type="checkbox" value="" /></td>
|
115 |
+
|
116 |
+
<td class="filter_field" style="display:none;"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][role_options]" placeholder="Option 1||Option 2||Option 3" value="" /></td>
|
117 |
+
|
118 |
+
<td class="filter_field" style="display:none;"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][role_options2]" placeholder="Option 1||Option 2||Option 3" value="" /></td>
|
119 |
+
|
120 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][extra_class]" value="" /></td>
|
121 |
+
|
122 |
+
|
123 |
+
<td style="display:none;text-align:center;" class="hide_stuff_op wccm1"><input type="checkbox" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][fancy]" title="<?php esc_attr_e( 'Adapt to woocommerce style', 'woocommerce-checkout-manager' ); ?>" value="" /></td>
|
124 |
+
|
125 |
+
<td class="hide_stuff_op wccm1" style="display:none;"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][force_title2]" value="" placeholder="<?php _e('Name Guide','woocommerce-checkout-manager'); ?>" /></td>
|
126 |
+
|
127 |
+
<td class="hide_stuff_op wccm1" style="display:none;"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][option_array]" value="" placeholder="Option 1||Option 2||Option 3" /></td>
|
128 |
+
|
129 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
130 |
+
|
131 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;"><?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
132 |
+
|
133 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;"><?php _e('Date Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
134 |
+
|
135 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1"><?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
136 |
+
|
137 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c"><?php _e('More Toggler', 'woocommerce-checkout-manager' ); ?></td>
|
138 |
+
|
139 |
+
<td class="more_toggler1">
|
140 |
+
<select name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][type]" > <!--Call run() function-->
|
141 |
+
<option value="wooccmtext" ><?php _e('Text Input','woocommerce-checkout-manager'); ?></option>
|
142 |
+
<option value="wooccmtextarea" ><?php _e('Textarea','woocommerce-checkout-manager'); ?></option>
|
143 |
+
<option value="wooccmpassword" ><?php _e('Password','woocommerce-checkout-manager'); ?></option>
|
144 |
+
<option value="wooccmradio" ><?php _e('Radio Buttons','woocommerce-checkout-manager'); ?></option>
|
145 |
+
<option value="checkbox_wccm" ><?php _e('Check Box','woocommerce-checkout-manager'); ?></option>
|
146 |
+
<option value="wooccmselect" ><?php _e('Select Options','woocommerce-checkout-manager'); ?></option>
|
147 |
+
<option value="datepicker" ><?php _e('Date Picker','woocommerce-checkout-manager'); ?></option>
|
148 |
+
<option value="time" ><?php _e('Time Picker','woocommerce-checkout-manager'); ?></option>
|
149 |
+
<option value="colorpicker" ><?php _e('Color Picker','woocommerce-checkout-manager'); ?></option>
|
150 |
+
<option value="heading" ><?php _e('Heading','woocommerce-checkout-manager'); ?></option>
|
151 |
+
<option value="multiselect" ><?php _e('Multi-Select','woocommerce-checkout-manager'); ?></option>
|
152 |
+
<option value="multicheckbox" ><?php _e('Multi-Checkbox','woocommerce-checkout-manager'); ?></option>
|
153 |
+
<option value="wooccmcountry" ><?php _e('Country','woocommerce-checkout-manager'); ?></option>
|
154 |
+
<option value="wooccmstate" ><?php _e('State','woocommerce-checkout-manager'); ?></option>
|
155 |
+
<option value="wooccmupload"><?php _e('File Picker','woocommerce-checkout-manager'); ?></option>
|
156 |
+
</select>
|
157 |
+
</td>
|
158 |
+
|
159 |
+
<td class="more_toggler1"><input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][cow]" placeholder="MyField" title="<?php esc_attr_e( 'Abbreviation (No spaces)', 'woocommerce-checkout-manager' ); ?>" value="" <?php if ( empty($options['checkness']['abbreviation'])) { echo 'readonly="readonly"'; } ?> /></td>
|
includes/templates/admin/woocheckout-shipping-tbody.php
ADDED
@@ -0,0 +1,272 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
// Exit if accessed directly
|
8 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
+
?>
|
10 |
+
|
11 |
+
<td style="display:none; text-align:center;" class="more_toggler1c">
|
12 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][more_content]" type="checkbox" value="1" <?php if ( !empty ($options2['shipping_buttons'][$i]['more_content'])) echo "checked='checked'"; ?> />
|
13 |
+
</td>
|
14 |
+
|
15 |
+
<td style="display:none;" class="more_toggler1c">
|
16 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_p]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options2['shipping_buttons'][$i]['single_p'])) ? '' : $options2['shipping_buttons'][$i]['single_p']; ?>" />
|
17 |
+
</td>
|
18 |
+
|
19 |
+
<td style="display:none;" class="more_toggler1c">
|
20 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_px]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options2['shipping_buttons'][$i]['single_px'])) ? '' : $options2['shipping_buttons'][$i]['single_px']; ?>" />
|
21 |
+
</td>
|
22 |
+
|
23 |
+
<td style="display:none;" class="more_toggler1c">
|
24 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_p_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options2['shipping_buttons'][$i]['single_p_cat'])) ? '' : $options2['shipping_buttons'][$i]['single_p_cat']; ?>" />
|
25 |
+
</td>
|
26 |
+
|
27 |
+
<td style="display:none;" class="more_toggler1c">
|
28 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_px_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options2['shipping_buttons'][$i]['single_px_cat'])) ? '' : $options2['shipping_buttons'][$i]['single_px_cat']; ?>" />
|
29 |
+
</td>
|
30 |
+
|
31 |
+
<td style="display:none;" class="hide_stuff_time">
|
32 |
+
<input type="text" placeholder="6" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][start_hour]" value="<?php echo (empty($options2['shipping_buttons'][$i]['start_hour'])) ? '' : $options2['shipping_buttons'][$i]['start_hour']; ?>" />
|
33 |
+
</td>
|
34 |
+
|
35 |
+
<td style="display:none;" class="hide_stuff_time">
|
36 |
+
<input type="text" placeholder="9" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][end_hour]" value="<?php echo (empty($options2['shipping_buttons'][$i]['end_hour'])) ? '' : $options2['shipping_buttons'][$i]['end_hour']; ?>" />
|
37 |
+
</td>
|
38 |
+
|
39 |
+
<td style="display:none;" class="hide_stuff_time">
|
40 |
+
<input type="text" placeholder="15" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][interval_min]" value="<?php echo (empty($options2['shipping_buttons'][$i]['interval_min'])) ? '' : $options2['shipping_buttons'][$i]['interval_min']; ?>" />
|
41 |
+
</td>
|
42 |
+
|
43 |
+
<td style="display:none;" class="hide_stuff_time">
|
44 |
+
<input type="text" placeholder="0, 10, 20, 30, 40" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][manual_min]" value="<?php echo (empty($options2['shipping_buttons'][$i]['manual_min'])) ? '' : $options2['shipping_buttons'][$i]['manual_min']; ?>" />
|
45 |
+
</td>
|
46 |
+
|
47 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
48 |
+
<input type="text" placeholder="dd-mm-yy" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][format_date]" value="<?php echo (empty($options2['shipping_buttons'][$i]['format_date'])) ? '' : $options2['shipping_buttons'][$i]['format_date']; ?>" />
|
49 |
+
</td>
|
50 |
+
|
51 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
52 |
+
<input type="text" placeholder="+3" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][min_before]" value="<?php echo (empty($options2['shipping_buttons'][$i]['min_before'])) ? '' : $options2['shipping_buttons'][$i]['min_before']; ?>" />
|
53 |
+
</td>
|
54 |
+
|
55 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
56 |
+
<input type="text" placeholder="3" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][max_after]" value="<?php echo (empty( $options2['shipping_buttons'][$i]['max_after'])) ? '' : $options2['shipping_buttons'][$i]['max_after']; ?>" />
|
57 |
+
</td>
|
58 |
+
|
59 |
+
<td style="display:none; text-align:center;" class="hide_stuff_color daoo">
|
60 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler]" type="checkbox" value="true" <?php if ( !empty ($options2['shipping_buttons'][$i]['days_disabler'])) echo "checked='checked'"; ?> />
|
61 |
+
</td>
|
62 |
+
|
63 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
64 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler0]" type="checkbox" value="1" <?php if ( !empty ($options2['shipping_buttons'][$i]['days_disabler0'])) echo "checked='checked'"; ?> />
|
65 |
+
</td>
|
66 |
+
|
67 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
68 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler1]" type="checkbox" value="1" <?php if ( !empty ($options2['shipping_buttons'][$i]['days_disabler1'])) echo "checked='checked'"; ?> />
|
69 |
+
</td>
|
70 |
+
|
71 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
72 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler2]" type="checkbox" value="1" <?php if ( !empty ($options2['shipping_buttons'][$i]['days_disabler2'])) echo "checked='checked'"; ?> />
|
73 |
+
</td>
|
74 |
+
|
75 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
76 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler3]" type="checkbox" value="1" <?php if ( !empty ($options2['shipping_buttons'][$i]['days_disabler3'])) echo "checked='checked'"; ?> />
|
77 |
+
</td>
|
78 |
+
|
79 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
80 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler4]" type="checkbox" value="1" <?php if ( !empty ($options2['shipping_buttons'][$i]['days_disabler4'])) echo "checked='checked'"; ?> />
|
81 |
+
</td>
|
82 |
+
|
83 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
84 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler5]" type="checkbox" value="1" <?php if ( !empty ($options2['shipping_buttons'][$i]['days_disabler5'])) echo "checked='checked'"; ?> />
|
85 |
+
</td>
|
86 |
+
|
87 |
+
<td style="display:none; text-align:center;" class="hide_stuff_days">
|
88 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][days_disabler6]" type="checkbox" value="1" <?php if ( !empty ($options2['shipping_buttons'][$i]['days_disabler6'])) echo "checked='checked'"; ?> />
|
89 |
+
</td>
|
90 |
+
|
91 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
92 |
+
<span class="spongagge"><?php _e( 'Min Date', 'woocommerce-checkout-manager' ); ?></span>
|
93 |
+
</td>
|
94 |
+
|
95 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
96 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty($options2['shipping_buttons'][$i]['single_yy'])) ? '' : $options2['shipping_buttons'][$i]['single_yy']; ?>" />
|
97 |
+
</td>
|
98 |
+
|
99 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
100 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty($options2['shipping_buttons'][$i]['single_mm'])) ? '' : $options2['shipping_buttons'][$i]['single_mm']; ?>" />
|
101 |
+
</td>
|
102 |
+
|
103 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
104 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty($options2['shipping_buttons'][$i]['single_dd'])) ? '' : $options2['shipping_buttons'][$i]['single_dd']; ?>" />
|
105 |
+
</td>
|
106 |
+
|
107 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
108 |
+
<span class="spongagge"><?php _e( 'Max Date', 'woocommerce-checkout-manager' ); ?></span>
|
109 |
+
</td>
|
110 |
+
|
111 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
112 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_max_yy]" placeholder="<?php _e('2013','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'yy', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty( $options2['shipping_buttons'][$i]['single_max_yy'])) ? '' : $options2['shipping_buttons'][$i]['single_max_yy']; ?>" />
|
113 |
+
</td>
|
114 |
+
|
115 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
116 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_max_mm]" placeholder="<?php _e('10','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'mm', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty( $options2['shipping_buttons'][$i]['single_max_mm'])) ? '' : $options2['shipping_buttons'][$i]['single_max_mm']; ?>" />
|
117 |
+
</td>
|
118 |
+
|
119 |
+
<td style="display:none;" class="hide_stuff_color hide_stuff_days">
|
120 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][single_max_dd]" placeholder="<?php _e('25','woocommerce-checkout-manager'); ?>" title="<?php esc_attr_e( 'dd', 'woocommerce-checkout-manager' ); ?>" value="<?php echo (empty( $options2['shipping_buttons'][$i]['single_max_dd'])) ? '' : $options2['shipping_buttons'][$i]['single_max_dd']; ?>" />
|
121 |
+
</td>
|
122 |
+
|
123 |
+
<td class="more_toggler1" style="text-align:center;">
|
124 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][checkbox]" type="checkbox" title="<?php _e( 'Whether or not the Checkout field is required', 'woocommerce-checkout-manager' ); ?>" value="true" <?php if ( !empty ($options2['shipping_buttons'][$i]['checkbox'])) echo "checked='checked'"; ?> />
|
125 |
+
</td>
|
126 |
+
|
127 |
+
<td class="more_toggler1" style="text-align:center;">
|
128 |
+
<select name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][position]" title="<?php _e( 'Placement of the Checkout field', 'woocommerce-checkout-manager' ); ?>"> <!--Call run() function-->
|
129 |
+
<option value="form-row-wide" <?php ( !isset( $options2['shipping_buttons'][$i]['position'] ) ) ? '' : selected( $options2['shipping_buttons'][$i]['position'], 'form-row-wide' ); ?>><?php _e( 'Wide','woocommerce-checkout-manager' ); ?></option>
|
130 |
+
<option value="form-row-first" <?php ( !isset( $options2['shipping_buttons'][$i]['position'] ) ) ? '' : selected( $options2['shipping_buttons'][$i]['position'], 'form-row-first' ); ?>><?php _e( 'Left','woocommerce-checkout-manager' ); ?></option>
|
131 |
+
<option value="form-row-last" <?php ( !isset( $options2['shipping_buttons'][$i]['position'] ) ) ? '' : selected( $options2['shipping_buttons'][$i]['position'], 'form-row-last' ); ?>><?php _e( 'Right','woocommerce-checkout-manager' ); ?></option>
|
132 |
+
</select>
|
133 |
+
</td>
|
134 |
+
|
135 |
+
<td class="more_toggler1" style="text-align:center;">
|
136 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][clear_row]" type="checkbox" title="<?php _e( 'Applies a clear fix to the Checkout field', 'woocommerce-checkout-manager' ); ?>" value="true" <?php if ( !empty ($options2['shipping_buttons'][$i]['clear_row'])) echo "checked='checked'"; ?> />
|
137 |
+
</td>
|
138 |
+
|
139 |
+
<td class="filter_field" style="display:none;text-align:center;">
|
140 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][deny_checkout]" type="checkbox" value="true" <?php if ( !empty ($options2['shipping_buttons'][$i]['deny_checkout'])) echo "checked='checked'"; ?> />
|
141 |
+
</td>
|
142 |
+
|
143 |
+
<td class="filter_field_tog add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
144 |
+
<?php _e('Filter Toggler', 'woocommerce-checkout-manager' ); ?>
|
145 |
+
</td>
|
146 |
+
|
147 |
+
<td class="filter_field" style="display:none;text-align:center;">
|
148 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][tax_remove]" type="checkbox" value="true" <?php if ( !empty ($options2['shipping_buttons'][$i]['tax_remove'])) echo "checked='checked'"; ?> />
|
149 |
+
</td>
|
150 |
+
|
151 |
+
<td class="filter_field" style="display:none;text-align:center;">
|
152 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][deny_receipt]" type="checkbox" value="true" <?php if ( !empty ($options2['shipping_buttons'][$i]['deny_receipt'])) echo "checked='checked'"; ?> />
|
153 |
+
</td>
|
154 |
+
|
155 |
+
<td class="filter_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;">
|
156 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][add_amount]" type="checkbox" value="true" <?php if ( !empty ($options2['shipping_buttons'][$i]['add_amount'])) echo "checked='checked'"; ?> />
|
157 |
+
</td>
|
158 |
+
|
159 |
+
<td class="add_amount_field" style="display:none;text-align:center;">
|
160 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][fee_name]" type="text" value="<?php echo ( isset( $options2['shipping_buttons'][$i]['fee_name'] ) ? $options2['shipping_buttons'][$i]['fee_name'] : '' ); ?>" placeholder="<?php _e('My Custom Charge','woocommerce-checkout-manager'); ?>" />
|
161 |
+
</td>
|
162 |
+
|
163 |
+
<td class="add_amount_field" style="display:none;text-align:center;">
|
164 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][add_amount_field]" type="text" value="<?php echo ( isset( $options2['shipping_buttons'][$i]['add_amount_field'] ) ? $options2['shipping_buttons'][$i]['add_amount_field'] : '' ); ?>" placeholder="50" />
|
165 |
+
</td>
|
166 |
+
|
167 |
+
<td class="filter_field add_amount_field hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_time hide_stuff_color more_toggler1 more_toggler1c" style="display:none;text-align:center;">
|
168 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][conditional_parent_use]" type="checkbox" value="true" <?php if ( !empty ($options2['shipping_buttons'][$i]['conditional_parent_use'])) echo "checked='checked'"; ?> />
|
169 |
+
</td>
|
170 |
+
|
171 |
+
<td class="condition_tick" style="display:none;text-align:center;">
|
172 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][conditional_parent]" type="checkbox" value="true" <?php if ( !empty ($options2['shipping_buttons'][$i]['conditional_parent'])) echo "checked='checked'"; ?> />
|
173 |
+
</td>
|
174 |
+
|
175 |
+
<td class="more_toggler1">
|
176 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][label]" title="<?php _e( 'Label text for the Checkout field', 'woocommerce-checkout-manager' ); ?>" placeholder="<?php _e('My Field Name','woocommerce-checkout-manager'); ?>" value="<?php echo esc_attr( $options2['shipping_buttons'][$i]['label'] ); ?>" />
|
177 |
+
</td>
|
178 |
+
|
179 |
+
<td class="more_toggler1">
|
180 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][placeholder]" title="<?php _e( 'Placeholder text for the Checkout field', 'woocommerce-checkout-manager' ); ?>" placeholder="<?php _e('Example red','woocommerce-checkout-manager'); ?>" value="<?php echo ( empty($options2['shipping_buttons'][$i]['placeholder'])) ? '' : $options2['shipping_buttons'][$i]['placeholder']; ?>" <?php if ( $options2['shipping_buttons'][$i]['cow'] == 'country' || $options2['shipping_buttons'][$i]['cow'] == 'state' ) { echo 'readonly="readonly"'; } ?> />
|
181 |
+
</td>
|
182 |
+
|
183 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field">
|
184 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][chosen_valt]" placeholder="<?php _e('Yes','woocommerce-checkout-manager'); ?>" value="<?php echo ( isset( $options2['shipping_buttons'][$i]['chosen_valt'] ) ? $options2['shipping_buttons'][$i]['chosen_valt'] : '' ); ?>" />
|
185 |
+
</td>
|
186 |
+
|
187 |
+
<td style="display:none;" class="condition_tick">
|
188 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][conditional_tie]" placeholder="<?php _e('Parent Abbr. Name','woocommerce-checkout-manager'); ?>" value="<?php echo ( isset( $options2['shipping_buttons'][$i]['conditional_tie'] ) ? $options2['shipping_buttons'][$i]['conditional_tie'] : '' ); ?>" />
|
189 |
+
</td>
|
190 |
+
|
191 |
+
<td style="display:none;" class="filter_field">
|
192 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][colorpickerd]" id="shipping-colorpic<?php echo $i; ?>" placeholder="<?php _e('#000000','woocommerce-checkout-manager'); ?>" value="<?php echo ( isset( $options2['shipping_buttons'][$i]['colorpickerd'] ) ? $options2['shipping_buttons'][$i]['colorpickerd'] : '' ); ?>" />
|
193 |
+
</td>
|
194 |
+
|
195 |
+
<td style="display:none;" class="filter_field">
|
196 |
+
<select name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][colorpickertype]">
|
197 |
+
<option value="farbtastic" <?php (!isset($options2['shipping_buttons'][$i]['colorpickertype'])) ? '' : selected( $options2['shipping_buttons'][$i]['colorpickertype'], 'farbtastic' ); ?>><?php _e('Farbtastic','woocommerce-checkout-manager'); ?></option>
|
198 |
+
<option value="iris" <?php (!isset($options2['shipping_buttons'][$i]['colorpickertype'])) ? '' : selected( $options2['shipping_buttons'][$i]['colorpickertype'], 'iris' ); ?>><?php _e('Iris','woocommerce-checkout-manager'); ?></option>
|
199 |
+
</select>
|
200 |
+
</td>
|
201 |
+
|
202 |
+
<td style="display:none;text-align:center;" class="filter_field">
|
203 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][user_role]" type="checkbox" value="user_role" <?php if ( !empty ($options2['shipping_buttons'][$i]['user_role'])) echo "checked='checked'"; ?> />
|
204 |
+
</td>
|
205 |
+
|
206 |
+
<td class="filter_field" style="display:none;">
|
207 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][role_options]" placeholder="Option 1||Option 2||Option 3" value="<?php echo ( isset( $options2['shipping_buttons'][$i]['role_options'] ) ? $options2['shipping_buttons'][$i]['role_options'] : '' ); ?>" />
|
208 |
+
</td>
|
209 |
+
|
210 |
+
<td class="filter_field" style="display:none;">
|
211 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][role_options2]" placeholder="Option 1||Option 2||Option 3" value="<?php echo ( isset( $options2['shipping_buttons'][$i]['role_options2'] ) ? $options2['shipping_buttons'][$i]['role_options2'] : '' ); ?>" />
|
212 |
+
</td>
|
213 |
+
|
214 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field">
|
215 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][extra_class]" value="<?php echo ( isset( $options2['shipping_buttons'][$i]['extra_class'] ) ? $options2['shipping_buttons'][$i]['extra_class'] : '' ); ?>" />
|
216 |
+
</td>
|
217 |
+
|
218 |
+
<td style="display:none;text-align:center;" class="hide_stuff_op wccm1">
|
219 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][fancy]" type="checkbox" value="country_select" <?php if ( !empty ($options2['shipping_buttons'][$i]['fancy'])) echo "checked='checked'"; ?> />
|
220 |
+
</td>
|
221 |
+
|
222 |
+
<td class="hide_stuff_op wccm1" style="display:none;">
|
223 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][force_title2]" placeholder="<?php _e('Name Guide','woocommerce-checkout-manager'); ?>" value="<?php echo (empty($options2['shipping_buttons'][$i]['force_title2'])) ? '' : $options2['shipping_buttons'][$i]['force_title2']; ?>" />
|
224 |
+
</td>
|
225 |
+
|
226 |
+
<td class="hide_stuff_op wccm1" style="display:none;">
|
227 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][option_array]" placeholder="Option 1||Option 2||Option 3" value="<?php echo ( isset( $options2['shipping_buttons'][$i]['option_array'] ) ? $options2['shipping_buttons'][$i]['option_array'] : '' ); ?>" />
|
228 |
+
</td>
|
229 |
+
|
230 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
231 |
+
<?php _e('Options Toggler', 'woocommerce-checkout-manager' ); ?>
|
232 |
+
</td>
|
233 |
+
|
234 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_timef hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;">
|
235 |
+
<?php _e('Time Toggler', 'woocommerce-checkout-manager' ); ?>
|
236 |
+
</td>
|
237 |
+
|
238 |
+
<td class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op more_toggler1 more_toggler1c hide_stuff_days" style="display:none;">
|
239 |
+
<?php _e('Date Toggler', 'woocommerce-checkout-manager' ); ?>
|
240 |
+
</td>
|
241 |
+
|
242 |
+
<td style="display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1">
|
243 |
+
<?php _e('Hidden Toggler', 'woocommerce-checkout-manager' ); ?>
|
244 |
+
</td>
|
245 |
+
|
246 |
+
<td class="filter_field add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_color hide_stuff_op more_toggler more_toggler1c" title="<?php _e( 'Open additional options for this Checkout field', 'woocommerce-checkout-manager' ); ?>">
|
247 |
+
<?php _e('More Toggler', 'woocommerce-checkout-manager' ); ?>
|
248 |
+
</td>
|
249 |
+
|
250 |
+
<td class="more_toggler1">
|
251 |
+
<select name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][type]" title="<?php _e( 'Type of the Checkout field', 'woocommerce-checkout-manager' ); ?>" <?php if ( $options2['shipping_buttons'][$i]['cow'] == 'country' || $options2['shipping_buttons'][$i]['cow'] == 'state' ) { echo 'readonly="readonly" style="pointer-events:none;"'; } ?> > <!--Call run() function-->
|
252 |
+
<option value="wooccmtext" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'wooccmtext' ); ?>><?php _e('Text Input','woocommerce-checkout-manager'); ?></option>
|
253 |
+
<option value="wooccmtextarea" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'wooccmtextarea' ); ?>><?php _e('Textarea','woocommerce-checkout-manager'); ?></option>
|
254 |
+
<option value="wooccmpassword" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'wooccmpassword' ); ?>><?php _e('Password','woocommerce-checkout-manager'); ?></option>
|
255 |
+
<option value="wooccmradio" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'wooccmradio' ); ?>><?php _e('Radio Buttons','woocommerce-checkout-manager'); ?></option>
|
256 |
+
<option value="checkbox_wccm" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'checkbox_wccm' ); ?>><?php _e('Check Box','woocommerce-checkout-manager'); ?></option>
|
257 |
+
<option value="wooccmselect" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'wooccmselect' ); ?>><?php _e('Select Options','woocommerce-checkout-manager'); ?></option>
|
258 |
+
<option value="datepicker" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'datepicker' ); ?>><?php _e('Date Picker','woocommerce-checkout-manager'); ?></option>
|
259 |
+
<option value="time" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'time' ); ?>><?php _e('Time Picker','woocommerce-checkout-manager'); ?></option>
|
260 |
+
<option value="colorpicker" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'colorpicker' ); ?>><?php _e('Color Picker','woocommerce-checkout-manager'); ?></option>
|
261 |
+
<option value="heading" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'heading' ); ?>><?php _e('Heading','woocommerce-checkout-manager'); ?></option>
|
262 |
+
<option value="multiselect" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'multiselect' ); ?>><?php _e('Multi-Select','woocommerce-checkout-manager'); ?></option>
|
263 |
+
<option value="multicheckbox" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'multicheckbox' ); ?>><?php _e('Multi-Checkbox','woocommerce-checkout-manager'); ?></option>
|
264 |
+
<option <?php if ( $options2['shipping_buttons'][$i]['cow'] == 'country' ) { echo 'selected="selected"'; } ?> value="wooccmcountry" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'wooccmcountry' ); ?>><?php _e('Country','woocommerce-checkout-manager'); ?></option>
|
265 |
+
<option <?php if ( $options2['shipping_buttons'][$i]['cow'] == 'state' ) { echo 'selected="selected"'; } ?> value="wooccmstate" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'wooccmstate' ); ?>><?php _e('State','woocommerce-checkout-manager'); ?></option>
|
266 |
+
<option value="wooccmupload" <?php (!isset($options2['shipping_buttons'][$i]['type'])) ? '' : selected( $options2['shipping_buttons'][$i]['type'], 'wooccmupload' ); ?>><?php _e('File Picker','woocommerce-checkout-manager'); ?></option>
|
267 |
+
</select>
|
268 |
+
</td>
|
269 |
+
|
270 |
+
<td class="more_toggler1">
|
271 |
+
<input type="text" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][cow]" placeholder="MyField" title="<?php _e( 'To edit Abbreviations open General > Switches > Editing Of Abbreviation Fields.', 'woocommerce-checkout-manager' ); ?>" value="<?php echo $options2['shipping_buttons'][$i]['cow']; ?>" <?php if ( empty($options['checkness']['abbreviation'])) { echo 'readonly="readonly"'; } ?> <?php if ( in_array($options2['shipping_buttons'][$i]['cow'], $htmlshippingabbr ) ) { echo 'readonly="readonly" style="pointer-events:none;"'; } ?> />
|
272 |
+
</td>
|
includes/templates/admin/woocheckout-shipping-thead.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
+
*/
|
5 |
+
|
6 |
+
// Exit if accessed directly
|
7 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
+
?>
|
9 |
+
|
10 |
+
<th class="more_toggler1c" style="display:none;width: 5%;"><?php _e('More' , 'woocommerce-checkout-manager' ); ?></th>
|
11 |
+
|
12 |
+
<th class="more_toggler1c hidefieldproduct" style="display:none;width: 17%;"><?php _e('Hide Field from Product' , 'woocommerce-checkout-manager' ); ?></th>
|
13 |
+
|
14 |
+
<th class="more_toggler1c" style="display:none;width: 17%;"><?php _e('Show Field for Product' , 'woocommerce-checkout-manager' ); ?></th>
|
15 |
+
|
16 |
+
<th class="more_toggler1c hidefieldcat" style="display:none;width: 20%;"><?php _e('Hide Field from Category' , 'woocommerce-checkout-manager' ); ?></th>
|
17 |
+
|
18 |
+
<th class="more_toggler1c" style="display:none;width: 20%;"><?php _e('Show Field for Category' , 'woocommerce-checkout-manager' ); ?></th>
|
19 |
+
|
20 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('Start Hour' , 'woocommerce-checkout-manager' ); ?></th>
|
21 |
+
|
22 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('End Hour' , 'woocommerce-checkout-manager' ); ?></th>
|
23 |
+
|
24 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('Interval Min.' , 'woocommerce-checkout-manager' ); ?></th>
|
25 |
+
|
26 |
+
<th class="hide_stuff_time" style="display:none;width: 16%;"><?php _e('Manual Min.' , 'woocommerce-checkout-manager' ); ?></th>
|
27 |
+
|
28 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;width: 16%;"><?php _e('Date Format' , 'woocommerce-checkout-manager' ); ?></th>
|
29 |
+
|
30 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;width: 5%;"><?php _e('Days before' , 'woocommerce-checkout-manager' ); ?></th>
|
31 |
+
|
32 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;width: 5%;"><?php _e('Days After' , 'woocommerce-checkout-manager' ); ?></th>
|
33 |
+
|
34 |
+
<th class="hide_stuff_color daoo" style="display:none;width: 7%;"><?php _e('Days Enabler' , 'woocommerce-checkout-manager' ); ?></th>
|
35 |
+
|
36 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Sundays' , 'woocommerce-checkout-manager' ); ?></th>
|
37 |
+
|
38 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Mondays' , 'woocommerce-checkout-manager' ); ?></th>
|
39 |
+
|
40 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Tuesdays' , 'woocommerce-checkout-manager' ); ?></th>
|
41 |
+
|
42 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Wednesdays' , 'woocommerce-checkout-manager' ); ?></th>
|
43 |
+
|
44 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Thursdays' , 'woocommerce-checkout-manager' ); ?></th>
|
45 |
+
|
46 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Fridays' , 'woocommerce-checkout-manager' ); ?></th>
|
47 |
+
|
48 |
+
<th class="hide_stuff_days" style="display:none;width: 7%;"><?php _e('Satudays' , 'woocommerce-checkout-manager' ); ?></th>
|
49 |
+
|
50 |
+
<th class="hide_stuff_color separator hide_stuff_days" style="display:none;" width="3%"><?php _e('' , 'woocommerce-checkout-manager' ); ?></th>
|
51 |
+
|
52 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;text-align:center;" width="5%"><?php _e('YY' , 'woocommerce-checkout-manager' ); ?></th>
|
53 |
+
|
54 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('MM' , 'woocommerce-checkout-manager' ); ?></th>
|
55 |
+
|
56 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('DD' , 'woocommerce-checkout-manager' ); ?></th>
|
57 |
+
|
58 |
+
<th class="hide_stuff_color separator hide_stuff_days" style="display:none;" width="3%"><?php _e('' , 'woocommerce-checkout-manager' ); ?></th>
|
59 |
+
|
60 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;text-align:center;" width="5%"><?php _e('YY' , 'woocommerce-checkout-manager' ); ?></th>
|
61 |
+
|
62 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('MM' , 'woocommerce-checkout-manager' ); ?></th>
|
63 |
+
|
64 |
+
<th class="hide_stuff_color hide_stuff_days" style="display:none;" width="4%"><?php _e('DD' , 'woocommerce-checkout-manager' ); ?></th>
|
65 |
+
|
66 |
+
<th class="more_toggler1" width="8%"><?php _e('Required' , 'woocommerce-checkout-manager' ); ?></th>
|
67 |
+
|
68 |
+
<th class="more_toggler1" width="5%"><?php _e('Position' , 'woocommerce-checkout-manager' ); ?></th>
|
69 |
+
|
70 |
+
<th class="more_toggler1" width="5%"><?php _e('Clear' , 'woocommerce-checkout-manager' ); ?></th>
|
71 |
+
|
72 |
+
<th class="filter_field" style="display:none;" width="5%"><?php _e('Deny Checkout' , 'woocommerce-checkout-manager' ); ?></th>
|
73 |
+
|
74 |
+
<th style="cursor: pointer; text-align: center; font-size: 30px;display:none;" class="filter_field_tog add_amount_field condition_tick hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c" style="display:none;" width="5%"><span class="toggle_shower">≡</span></th>
|
75 |
+
|
76 |
+
<th class="filter_field" style="display:none;" width="5%"><?php _e('Remove Tax' , 'woocommerce-checkout-manager' ); ?></th>
|
77 |
+
|
78 |
+
<th class="filter_field" style="display:none;" width="5%"><?php _e('Deny Receipt' , 'woocommerce-checkout-manager' ); ?></th>
|
79 |
+
|
80 |
+
<th class="filter_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c add_amount" style="display:none;" width="5%"><?php _e('Add Amount' , 'woocommerce-checkout-manager' ); ?></th>
|
81 |
+
|
82 |
+
<th class="add_amount_field" style="display:none;" width="5%"><?php _e('Amount Name' , 'woocommerce-checkout-manager' ); ?></th>
|
83 |
+
|
84 |
+
<th class="add_amount_field" style="display:none;" width="5%"><?php _e('Enter Amount' , 'woocommerce-checkout-manager' ); ?></th>
|
85 |
+
|
86 |
+
<th class="filter_field add_amount_field hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c apply_tick" style="display:none;" width="9%"><?php _e('Conditional' , 'woocommerce-checkout-manager' ); ?></th>
|
87 |
+
|
88 |
+
<th class="condition_tick" style="display:none;" width="9%"><?php _e('Conditional Parent' , 'woocommerce-checkout-manager' ); ?></th>
|
89 |
+
|
90 |
+
<th class="more_toggler1"><?php _e('Label' , 'woocommerce-checkout-manager' ); ?></th>
|
91 |
+
|
92 |
+
<th class="more_toggler1"><?php _e('Placeholder' , 'woocommerce-checkout-manager' ); ?></th>
|
93 |
+
|
94 |
+
<th style="display:none; width: 10%;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field"><?php _e('Chosen Value' , 'woocommerce-checkout-manager' ); ?></th>
|
95 |
+
|
96 |
+
<th style="display:none;" class="condition_tick" width="16%"><?php _e('Conditional Tie' , 'woocommerce-checkout-manager' ); ?></th>
|
97 |
+
|
98 |
+
<th style="display:none;width:5%;" class="filter_field" width="1%"><?php _e('Default Color' , 'woocommerce-checkout-manager' ); ?></th>
|
99 |
+
|
100 |
+
<th style="display:none;" class="filter_field" width="5%"><?php _e('Picker Type' , 'woocommerce-checkout-manager' ); ?></th>
|
101 |
+
|
102 |
+
<th style="display:none;" class="filter_field" width="5%"><?php _e('User Role' , 'woocommerce-checkout-manager' ); ?></th>
|
103 |
+
|
104 |
+
<th class="filter_field roles" style="display:none;" width="15%"><?php _e('Show for Roles (Separated by ' , 'woocommerce-checkout-manager' ); ?><span class="toggle_shower current_opener">||</span> )</th>
|
105 |
+
|
106 |
+
<th class="filter_field" style="display:none;" width="15%"><?php _e('Hide from Roles (Separated by ' , 'woocommerce-checkout-manager' ); ?><span class="toggle_shower current_opener">||</span> )</th>
|
107 |
+
|
108 |
+
<th style="display:none;" class="filter_field add_amount_field hide_stuff_time hide_stuff_change hide_stuff_opcheck hide_stuff_op hide_stuff_color more_toggler1 more_toggler1c condition_tick add_amount_field" width="13%"><?php _e('Class' , 'woocommerce-checkout-manager' ); ?></th>
|
109 |
+
|
110 |
+
<th class="hide_stuff_op wccm1" style="display:none;" width="10%"><?php _e('Adapt' , 'woocommerce-checkout-manager' ); ?></th>
|
111 |
+
|
112 |
+
<th class="hide_stuff_op wccm1" style="display:none;" width="10%"><?php _e('Title' , 'woocommerce-checkout-manager' ); ?></th>
|
113 |
+
|
114 |
+
<th class="hide_stuff_op wccm1" style="display:none;" width="60%"><?php _e('List of Options (Separated by ' , 'woocommerce-checkout-manager' ); ?><span class="toggle_shower current_opener">||</span> )</th>
|
115 |
+
|
116 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_time hide_stuff_opcheck hide_stuff_tog hide_stuff_color more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
117 |
+
|
118 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field condition_tick hide_stuff_opcheck hide_stuff_op hide_stuff_change hide_stuff_time_tog hide_stuff_color more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
119 |
+
|
120 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;display:none;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_days hide_stuff_color_tog hide_stuff_op more_toggler1 more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
121 |
+
|
122 |
+
<th style="display:none;cursor:pointer;text-align:center;font-size:30px;" class="filter_field add_amount_field condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_time hide_stuff_op hide_stuff_color more_toggler1 more_toggler1a" width="2%"><span class="toggle_shower">≡</span></th>
|
123 |
+
|
124 |
+
<th style="cursor:pointer;text-align:center;font-size:30px;" class="filter_field add_amount_field hide_stuff_time condition_tick hide_stuff_change hide_stuff_opcheck hide_stuff_color more_toggler hide_stuff_op more_toggler1c" width="2%"><span class="toggle_shower">≡</span></th>
|
125 |
+
|
126 |
+
<th class="more_toggler1" style="width:10%;"><?php _e('Choose Type' , 'woocommerce-checkout-manager' ); ?></th>
|
127 |
+
|
128 |
+
<th class="more_toggler1" style="width:5%"><?php _e('Abbreviation' , 'woocommerce-checkout-manager' ); ?></th>
|
includes/templates/admin/woocheckout-shipping.php
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<table class="widefat shipping-wccs-table shipping-semi" style="display:none;" border="1" name="shipping_table">
|
2 |
+
<thead>
|
3 |
+
|
4 |
+
<tr>
|
5 |
+
<th style="width:3%;" class="shipping-wccs-order" title="<?php esc_attr_e( 'Change the order of Checkout fields', 'woocommerce-checkout-manager' ); ?>">#</th>
|
6 |
+
|
7 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-shipping-thead.php' ); ?>
|
8 |
+
|
9 |
+
<th width="1%" scope="col" title="<?php esc_attr_e( 'Remove button', 'woocommerce-checkout-manager' ); ?>"><strong>X</strong><!-- remove --></th>
|
10 |
+
</tr>
|
11 |
+
|
12 |
+
</thead>
|
13 |
+
<tbody>
|
14 |
+
|
15 |
+
<?php
|
16 |
+
if( isset ( $options2['shipping_buttons'] ) ) {
|
17 |
+
$shipping = array(
|
18 |
+
'country',
|
19 |
+
'first_name',
|
20 |
+
'last_name',
|
21 |
+
'company',
|
22 |
+
'address_1',
|
23 |
+
'address_2',
|
24 |
+
'city',
|
25 |
+
'state',
|
26 |
+
'postcode'
|
27 |
+
);
|
28 |
+
for( $i = 0; $i < count( $options2['shipping_buttons'] ); $i++ ) {
|
29 |
+
|
30 |
+
if( !isset( $options2['shipping_buttons'][$i] ) )
|
31 |
+
break;
|
32 |
+
?>
|
33 |
+
|
34 |
+
<tr valign="top" id="wccs-shipping-id-<?php echo $i; ?>" class="shipping-wccs-row">
|
35 |
+
|
36 |
+
<td style="display:none;" class="shipping-wccs-order-hidden">
|
37 |
+
<input type="hidden" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][order]" value="<?php echo (empty( $options2['shipping_buttons'][$i]['order'])) ? $i : $options2['shipping_buttons'][$i]['order']; ?>" />
|
38 |
+
</td>
|
39 |
+
<td class="shipping-wccs-order" title="<?php esc_attr_e( 'Drag-and-drop this Checkout field to adjust its ordering', 'woocommerce-checkout-manager' ); ?>"><?php echo $i+1; ?></td>
|
40 |
+
|
41 |
+
<?php require(WOOCCM_PATH.'includes/templates/admin/woocheckout-shipping-tbody.php'); ?>
|
42 |
+
|
43 |
+
<?php if( in_array( $options2['shipping_buttons'][$i]['cow'],$shipping ) ) { ?>
|
44 |
+
<td style="text-align:center;">
|
45 |
+
<input name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][disabled]" type="checkbox" value="true" <?php if ( !empty ($options2['shipping_buttons'][$i]['disabled'])) echo "checked='checked'"; ?> />
|
46 |
+
</td>
|
47 |
+
<?php } else { ?>
|
48 |
+
<td class="shipping-wccs-remove"><a class="shipping-wccs-remove-button" href="javascript:;" title="<?php esc_attr_e( 'Delete this Checkout field' , 'woocommerce-checkout-manager' ); ?>">×</a></td>
|
49 |
+
<?php } ?>
|
50 |
+
|
51 |
+
</tr>
|
52 |
+
<!-- #wccs-shipping-id-<?php echo $i; ?> .shipping-wccs-row -->
|
53 |
+
|
54 |
+
<?php
|
55 |
+
}
|
56 |
+
}
|
57 |
+
?>
|
58 |
+
|
59 |
+
<?php
|
60 |
+
$i = 999;
|
61 |
+
?>
|
62 |
+
|
63 |
+
<tr valign="top" id="wccs-shipping-id-<?php echo $i; ?>" class="shipping-wccs-clone" >
|
64 |
+
|
65 |
+
<td style="display:none;" class="shipping-wccs-order-hidden" >
|
66 |
+
<input type="hidden" name="wccs_settings2[shipping_buttons][<?php echo $i; ?>][order]" value="<?php echo $i; ?>" />
|
67 |
+
</td>
|
68 |
+
|
69 |
+
<td class="shipping-wccs-order" title="<?php esc_attr_e( 'Drag-and-drop this Checkout field to adjust its ordering', 'woocommerce-checkout-manager' ); ?>"><?php echo $i; ?></td>
|
70 |
+
|
71 |
+
<?php require( WOOCCM_PATH.'includes/templates/admin/woocheckout-shipping-clone.php' ); ?>
|
72 |
+
|
73 |
+
<td class="shipping-wccs-remove"><a class="shipping-wccs-remove-button" href="javascript:;" title="<?php esc_attr_e( 'Delete this Checkout field' , 'woocommerce-checkout-manager' ); ?>">×</a></td>
|
74 |
+
|
75 |
+
</tr>
|
76 |
+
<!-- #wccs-shipping-id-<?php echo $i; ?> .shipping-wccs-clone -->
|
77 |
+
</tbody>
|
78 |
+
</table>
|
79 |
+
<!-- .widefat -->
|
80 |
+
|
81 |
+
<div class="shipping-wccs-table-footer shipping-semi" style="display:none;">
|
82 |
+
<a href="javascript:;" id="shipping-wccs-add-button" class="button-secondary"><?php _e( '+ Add New Field' , 'woocommerce-checkout-manager' ); ?></a>
|
83 |
+
</div>
|
84 |
+
<!-- .shipping-wccs-table-footer -->
|
includes/templates/functions/add_functions.php
CHANGED
@@ -7,735 +7,809 @@
|
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
|
10 |
-
function
|
11 |
-
global $woocommerce;
|
12 |
-
$options = get_option( 'wccs_settings' );
|
13 |
-
|
14 |
-
$saved = WC()->session->get('wooccm_retain', array() );
|
15 |
-
|
16 |
-
|
17 |
-
if( !empty($options['buttons']) ) {
|
18 |
-
foreach ( $options['buttons'] as $btn ) :
|
19 |
-
|
20 |
-
|
21 |
-
if ( $btn['type'] == 'datepicker' ) {
|
22 |
-
echo '<script type="text/javascript">jQuery(document).ready(function() { var today = new Date(); jQuery("input#'.$btn['cow'].'").datepicker({';
|
23 |
-
if ( empty($btn['format_date']) ) {
|
24 |
-
echo 'dateFormat : "dd-mm-yy",';
|
25 |
-
}
|
26 |
-
if ( !empty($btn['format_date']) ) {
|
27 |
-
echo 'dateFormat : "'.str_replace( ' ', '', $btn['format_date'] ).'",';
|
28 |
-
}
|
29 |
-
if ( !empty($btn['single_yy']) ) {
|
30 |
-
echo 'minDate: new Date( '.$btn['single_yy'].', '.$btn['single_mm'].' - 1, '.$btn['single_dd'].'),';
|
31 |
-
}
|
32 |
-
if ( !empty($btn['min_before']) ) {
|
33 |
-
echo 'minDate: '.$btn['min_before'].',';
|
34 |
-
}
|
35 |
-
if ( !empty($btn['single_max_yy']) ) {
|
36 |
-
echo 'maxDate: new Date( '.$btn['single_max_yy'].', '.$btn['single_max_mm'].' - 1, '.$btn['single_max_dd'].'),';
|
37 |
-
}
|
38 |
-
if ( !empty($btn['max_after']) ) {
|
39 |
-
echo 'maxDate: '.$btn['max_after'].',';
|
40 |
-
}
|
41 |
-
if ( !empty($btn['days_disabler']) ) {
|
42 |
-
echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
|
43 |
-
|
44 |
-
if ( !empty($btn['days_disabler0']) ) {
|
45 |
-
echo 'day == 0';
|
46 |
-
} else { echo 'day == "x"'; }
|
47 |
-
if ( !empty($btn['days_disabler1']) ) {
|
48 |
-
echo ' || day == 1';
|
49 |
-
}
|
50 |
-
if ( !empty($btn['days_disabler2']) ) {
|
51 |
-
echo ' || day == 2';
|
52 |
-
}
|
53 |
-
if ( !empty($btn['days_disabler3']) ) {
|
54 |
-
echo ' || day == 3';
|
55 |
-
}
|
56 |
-
if ( !empty($btn['days_disabler4']) ) {
|
57 |
-
echo ' || day == 4';
|
58 |
-
}
|
59 |
-
if ( !empty($btn['days_disabler5']) ) {
|
60 |
-
echo ' || day == 5';
|
61 |
-
}
|
62 |
-
if ( !empty($btn['days_disabler6']) ) {
|
63 |
-
echo '|| day == 6';
|
64 |
-
}
|
65 |
-
|
66 |
-
echo ')]; }';
|
67 |
-
}
|
68 |
-
echo '}); }); </script>';
|
69 |
-
}
|
70 |
-
|
71 |
-
|
72 |
-
if ( $btn['type'] == 'time' ) {
|
73 |
-
echo '<script type="text/javascript">jQuery(document).ready(function() { jQuery("#'.$btn['cow'].'_field input#'.$btn['cow'].'").timepicker({ showPeriod: true,';
|
74 |
-
|
75 |
-
if ( !empty($btn['start_hour']) ) {
|
76 |
-
echo 'hours: { starts: '.$btn['start_hour'].', ends: '.$btn['end_hour'].' },';
|
77 |
-
}
|
78 |
-
if ( !empty($btn['interval_min']) ) {
|
79 |
-
echo 'minutes: {interval: '.$btn['interval_min'].', manual: ['.$btn['manual_min'].'] },';
|
80 |
-
}
|
81 |
-
|
82 |
-
echo 'showLeadingZero: true }); }); </script>';
|
83 |
-
}
|
84 |
-
|
85 |
-
|
86 |
-
if ( $btn['type'] == 'password' ) {
|
87 |
-
echo '<script type="text/javascript">jQuery(document).ready(function() { jQuery("p#'.$btn['cow'].'_field").css("display"); }); </script>';
|
88 |
-
}
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
if ( $btn['type'] == 'colorpicker' && $btn['colorpickertype'] == 'farbtastic' ) { ?>
|
93 |
-
<script type="text/javascript">
|
94 |
-
jQuery(document).ready(function($) {
|
95 |
-
jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
96 |
-
jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#<?php echo $btn['cow']; ?>_colorpicker");
|
97 |
-
jQuery("#<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
98 |
-
|
99 |
-
});
|
100 |
-
</script>
|
101 |
-
<?php }
|
102 |
-
|
103 |
-
if ( $btn['type'] == 'colorpicker' && $btn['colorpickertype'] == 'iris' ) { ?>
|
104 |
-
<script type="text/javascript">
|
105 |
-
jQuery(document).ready(function($) {
|
106 |
-
|
107 |
-
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#fff' );
|
108 |
-
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', '<?php echo $btn['colorpickerd']; ?>' );
|
109 |
-
|
110 |
-
var options = {
|
111 |
-
wccmclass: "<?php echo $btn['cow']; ?>_colorpickerdiv",
|
112 |
-
palettes: true,
|
113 |
-
color: "",
|
114 |
-
hide: false,
|
115 |
-
change: function(event,ui){
|
116 |
-
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#000' );
|
117 |
-
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', ui.color.toString());
|
118 |
-
}
|
119 |
-
};
|
120 |
-
|
121 |
-
|
122 |
-
jQuery('#<?php echo $btn['cow']; ?>_colorpicker').iris( options );
|
123 |
-
|
124 |
-
jQuery('.<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
125 |
-
jQuery("#<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('.<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
126 |
-
});
|
127 |
-
</script>
|
128 |
-
<?php }
|
129 |
-
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
// ============================== radio button & checkbox ===========================================
|
133 |
-
if ( ($btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm') && !empty( $btn['tax_remove'] ) ) { ?>
|
134 |
-
<script type="text/javascript">
|
135 |
-
jQuery(document).ready(function($) {
|
136 |
-
|
137 |
-
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
138 |
-
jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]').prop("checked", true);
|
139 |
-
<?php } ?>
|
140 |
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
action: 'remove_tax_wccm',
|
149 |
-
tax_remove_aj: jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]:checked').val()
|
150 |
-
};
|
151 |
-
|
152 |
-
jQuery.post(ajaxurl, data, function(response) {
|
153 |
-
$( 'body' ).trigger( 'update_checkout' );
|
154 |
-
jQuery('form.checkout').unblock();
|
155 |
-
});
|
156 |
-
|
157 |
-
}); });
|
158 |
-
</script>
|
159 |
-
<?php }
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
if ( ($btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) { ?>
|
164 |
-
<script type="text/javascript">
|
165 |
-
jQuery(document).ready(function($) {
|
166 |
-
|
167 |
-
<?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
|
168 |
-
jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]').prop("checked", true);
|
169 |
<?php } ?>
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
}); });
|
187 |
-
</script>
|
188 |
-
<?php }
|
189 |
|
|
|
|
|
|
|
|
|
|
|
190 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
|
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
// =========================================== select options =========================================
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
199 |
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
200 |
-
jQuery('#<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_tax_save_method']; ?>' );
|
201 |
<?php } ?>
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
<?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
|
229 |
-
jQuery('#<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_addamount453user']; ?>' );
|
230 |
<?php } ?>
|
231 |
-
|
232 |
-
jQuery('#<?php echo $btn['cow']; ?>_field select').change(function() {
|
233 |
-
|
234 |
-
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
235 |
-
|
236 |
-
|
237 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
238 |
-
data = {
|
239 |
-
action: 'remove_tax_wccm',
|
240 |
-
add_amount_aj: jQuery('#<?php echo $btn['cow']; ?> option:selected').val()
|
241 |
-
};
|
242 |
-
|
243 |
-
jQuery.post(ajaxurl, data, function(response) {
|
244 |
-
$( 'body' ).trigger( 'update_checkout' );
|
245 |
-
jQuery('form.checkout').unblock();
|
246 |
-
});
|
247 |
-
|
248 |
-
}); });
|
249 |
-
</script>
|
250 |
-
<?php }
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
|
|
|
|
|
|
|
|
254 |
|
|
|
|
|
|
|
|
|
255 |
|
|
|
|
|
|
|
|
|
|
|
256 |
|
257 |
// =========================================== add apply button ==========================================
|
258 |
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
|
|
267 |
<?php if( !empty($saved['wooccm_addamount453userf']) ) { ?>
|
268 |
-
jQuery('input#<?php echo $btn['cow']; ?>').val( '<?php echo $saved['wooccm_addamount453userf']; ?>' );
|
269 |
<?php } ?>
|
270 |
|
271 |
-
|
272 |
-
|
273 |
-
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
274 |
-
|
275 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
276 |
-
data = {
|
277 |
-
action: 'remove_tax_wccm',
|
278 |
-
add_amount_faj: jQuery('input#<?php echo $btn['cow']; ?>').val()
|
279 |
-
};
|
280 |
-
|
281 |
-
jQuery.post(ajaxurl, data, function(response) {
|
282 |
-
$( 'body' ).trigger( 'update_checkout' );
|
283 |
-
jQuery('form.checkout').unblock();
|
284 |
-
});
|
285 |
-
|
286 |
-
}); });
|
287 |
-
</script>
|
288 |
-
<?php }
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
|
293 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
jQuery("#<?php echo $btn['cow']; ?>_checkboxhiddenfield").prop("disabled", true);
|
301 |
-
}else{
|
302 |
-
jQuery("#<?php echo $btn['cow']; ?>_checkboxhiddenfield").prop("disabled", false);
|
303 |
-
}
|
304 |
-
});
|
305 |
-
});
|
306 |
-
</script>
|
307 |
-
<?php }
|
308 |
-
endforeach;
|
309 |
}
|
310 |
-
}
|
311 |
|
|
|
|
|
|
|
|
|
|
|
312 |
|
313 |
// --------------------------------------------------------
|
314 |
// --------------------------------------------------------
|
315 |
// --------------------------------------------------------
|
316 |
-
function override_this_wccs() {
|
317 |
-
global $woocommerce;
|
318 |
-
$options = get_option( 'wccs_settings' );
|
319 |
-
if ( count( $options['buttons'] ) > 0 ) {
|
320 |
-
$i = 0;
|
321 |
-
|
322 |
-
// css sub-parent hide
|
323 |
-
foreach( $options['buttons'] as $btn ) {
|
324 |
-
if ( ($btn['type'] == 'text') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
|
325 |
-
echo '<style type="text/css">#'.$btn['cow'].'_applynow {
|
326 |
-
background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
|
327 |
-
background: -webkit-linear-gradient(#ad74a2,#96588a);
|
328 |
-
background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
|
329 |
-
background: -moz-gradient(center top,#ad74a2 0,#96588a 100%);
|
330 |
-
border-color: #76456c;
|
331 |
-
color: #fff;
|
332 |
-
text-shadow: 0 -1px 0 rgba(0,0,0,.6);
|
333 |
-
width: 100%;
|
334 |
-
text-align: center;
|
335 |
-
float: right;
|
336 |
-
cursor: pointer;
|
337 |
-
position: relative;
|
338 |
-
}
|
339 |
-
#'.$btn['cow'].'_applynow:active {
|
340 |
-
top: 1px;
|
341 |
-
}
|
342 |
-
</style>';
|
343 |
-
|
344 |
-
}
|
345 |
-
if ( !empty($btn['conditional_tie']) && empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use'])) {
|
346 |
-
|
347 |
-
echo '<style type="text/css">
|
348 |
-
.woocommerce form #customer_details #'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
349 |
-
.woocommerce-page form #customer_details #'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
350 |
-
.woocommerce form.checkout #'.$btn['cow'].'_field.'.$btn['conditional_tie'].' {
|
351 |
-
display: none;
|
352 |
-
}
|
353 |
-
</style>';
|
354 |
-
}
|
355 |
-
}
|
356 |
-
|
357 |
-
|
358 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
|
360 |
// ====================== CHECKBOX =============================
|
361 |
// script when clicked show
|
362 |
// =============================================================
|
363 |
?>
|
|
|
364 |
<script type="text/javascript">
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
empty_check_add: 'none'
|
395 |
-
};
|
396 |
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
<?php }} ?>
|
407 |
-
|
408 |
-
});
|
409 |
-
<?php }}} ?>
|
410 |
-
});
|
411 |
-
</script>
|
412 |
|
413 |
<?php
|
414 |
-
|
415 |
-
|
|
|
416 |
|
|
|
417 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
|
419 |
// ====================== SELECT OPTIONS =============================
|
420 |
// script when clicked show
|
421 |
// =============================================================
|
422 |
?>
|
|
|
423 |
<script type="text/javascript">
|
424 |
jQuery(document).ready(function($){
|
425 |
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
});
|
466 |
</script>
|
467 |
|
468 |
-
|
469 |
<?php
|
|
|
470 |
// ================================ END!!! =====================================
|
471 |
// =============================================================================
|
472 |
|
473 |
-
|
474 |
-
|
475 |
// ====================== RADIO BUTTON =============================
|
476 |
// script when clicked show
|
477 |
// =============================================================
|
|
|
478 |
?>
|
|
|
479 |
<script type="text/javascript">
|
480 |
jQuery(document).ready(function($){
|
481 |
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
if ( !empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) { ?>
|
487 |
-
|
488 |
-
jQuery("#<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input").click(function(){
|
489 |
-
|
490 |
-
<?php foreach( $options['buttons'] as $btn3 ) {
|
491 |
-
if ( empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) { ?>
|
492 |
-
|
493 |
-
if(jQuery('#<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
494 |
-
jQuery("#<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").show( "slow" );
|
495 |
-
}
|
496 |
-
|
497 |
-
if(jQuery('#<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
498 |
-
jQuery("#<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").hide( "slow" );
|
499 |
-
|
500 |
-
<?php
|
501 |
-
if ( !empty($btn2['fee_name']) && !empty($btn2['add_amount']) ) {
|
502 |
-
?>
|
503 |
-
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
504 |
-
|
505 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
506 |
-
data = {
|
507 |
-
action: 'remove_tax_wccm',
|
508 |
-
empty_check_add: 'none'
|
509 |
-
};
|
510 |
-
|
511 |
-
jQuery.post(ajaxurl, data, function(response) {
|
512 |
-
$( 'body' ).trigger( 'update_checkout' );
|
513 |
-
jQuery('form.checkout').unblock();
|
514 |
-
});
|
515 |
-
|
516 |
-
<?php } ?>
|
517 |
-
|
518 |
-
}
|
519 |
-
|
520 |
-
<?php }} ?>
|
521 |
-
|
522 |
-
});
|
523 |
-
<?php }}} ?>
|
524 |
-
});
|
525 |
-
</script>
|
526 |
|
|
|
|
|
527 |
|
|
|
528 |
|
529 |
<?php
|
530 |
-
|
531 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
532 |
|
|
|
533 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
|
535 |
// ----------------------------- CLEAR ---------------------------------
|
536 |
// ---------------------------------------------------------------------
|
537 |
// ---------------------------------------------------------------------
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
|
10 |
+
function wooccm_scripts() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
global $woocommerce;
|
13 |
+
|
14 |
+
$options = get_option( 'wccs_settings' );
|
15 |
+
|
16 |
+
$saved = WC()->session->get( 'wooccm_retain', array() );
|
17 |
+
|
18 |
+
// Check if we have any buttons
|
19 |
+
if( empty( $options['buttons'] ) )
|
20 |
+
return;
|
21 |
+
|
22 |
+
foreach( $options['buttons'] as $btn ) {
|
23 |
+
|
24 |
+
if( $btn['type'] == 'datepicker' ) {
|
25 |
+
echo '
|
26 |
+
<script type="text/javascript">
|
27 |
+
jQuery(document).ready(function() {
|
28 |
+
var today = new Date();
|
29 |
+
if( jQuery.isFunction(jQuery.fn.datepicker) ) {
|
30 |
+
jQuery("input#'.$btn['cow'].'").datepicker({
|
31 |
+
';
|
32 |
+
if( empty($btn['format_date']) ) {
|
33 |
+
echo 'dateFormat : "dd-mm-yy",';
|
34 |
+
}
|
35 |
+
if( !empty($btn['format_date']) ) {
|
36 |
+
echo 'dateFormat : "'.str_replace( ' ', '', $btn['format_date'] ).'",';
|
37 |
+
}
|
38 |
+
if( !empty($btn['single_yy']) ) {
|
39 |
+
echo 'minDate: new Date( '.$btn['single_yy'].', '.$btn['single_mm'].' - 1, '.$btn['single_dd'].'),';
|
40 |
+
}
|
41 |
+
if( !empty($btn['min_before']) ) {
|
42 |
+
echo 'minDate: '.$btn['min_before'].',';
|
43 |
+
}
|
44 |
+
if( !empty($btn['single_max_yy']) ) {
|
45 |
+
echo 'maxDate: new Date( '.$btn['single_max_yy'].', '.$btn['single_max_mm'].' - 1, '.$btn['single_max_dd'].'),';
|
46 |
+
}
|
47 |
+
if( !empty($btn['max_after']) ) {
|
48 |
+
echo 'maxDate: '.$btn['max_after'].',';
|
49 |
+
}
|
50 |
+
if( !empty($btn['days_disabler']) ) {
|
51 |
+
echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
|
52 |
+
if( !empty($btn['days_disabler0']) ) {
|
53 |
+
echo 'day == 0';
|
54 |
+
} else { echo 'day == "x"'; }
|
55 |
+
if( !empty($btn['days_disabler1']) ) {
|
56 |
+
echo ' || day == 1';
|
57 |
+
}
|
58 |
+
if( !empty($btn['days_disabler2']) ) {
|
59 |
+
echo ' || day == 2';
|
60 |
+
}
|
61 |
+
if( !empty($btn['days_disabler3']) ) {
|
62 |
+
echo ' || day == 3';
|
63 |
+
}
|
64 |
+
if( !empty($btn['days_disabler4']) ) {
|
65 |
+
echo ' || day == 4';
|
66 |
+
}
|
67 |
+
if( !empty($btn['days_disabler5']) ) {
|
68 |
+
echo ' || day == 5';
|
69 |
+
}
|
70 |
+
if( !empty($btn['days_disabler6']) ) {
|
71 |
+
echo '|| day == 6';
|
72 |
+
}
|
73 |
+
echo ')]; }';
|
74 |
+
}
|
75 |
+
do_action( 'wooccm_js_datepicker_additional_args', $btn );
|
76 |
+
echo '
|
77 |
+
});
|
78 |
+
}
|
79 |
+
});
|
80 |
+
</script>
|
81 |
+
';
|
82 |
+
}
|
83 |
+
|
84 |
+
if( $btn['type'] == 'time' ) {
|
85 |
+
$args = '
|
86 |
+
showPeriod: true,';
|
87 |
+
if( !empty($btn['start_hour']) ) {
|
88 |
+
$args .= '
|
89 |
+
hours: { starts: '.$btn['start_hour'].', ends: '.$btn['end_hour'].' },';
|
90 |
+
}
|
91 |
+
if( !empty($btn['interval_min']) ) {
|
92 |
+
$args .= '
|
93 |
+
minutes: {interval: '.$btn['interval_min'].', manual: ['.$btn['manual_min'].'] },';
|
94 |
+
}
|
95 |
+
$args .= '
|
96 |
+
showLeadingZero: true';
|
97 |
+
$args = apply_filters( 'wooccm_timepicker_jquery_args', $args, $btn );
|
98 |
+
echo '
|
99 |
+
<!-- Additional section: TimePicker -->
|
100 |
+
<script type="text/javascript">
|
101 |
+
jQuery(document).ready(function() {
|
102 |
+
if( jQuery.isFunction(jQuery.fn.timepicker) ) {
|
103 |
+
jQuery("#'.$btn['cow'].'_field input#'.$btn['cow'].'").timepicker({'
|
104 |
+
;
|
105 |
+
echo $args;
|
106 |
+
echo '
|
107 |
+
});
|
108 |
+
}
|
109 |
+
});
|
110 |
+
</script>
|
111 |
+
';
|
112 |
+
}
|
113 |
+
|
114 |
+
if ( $btn['type'] == 'password' ) {
|
115 |
+
echo '
|
116 |
+
<script type="text/javascript">
|
117 |
+
jQuery(document).ready(function() {
|
118 |
+
jQuery("p#'.$btn['cow'].'_field").css("display");
|
119 |
+
});
|
120 |
+
</script>
|
121 |
+
';
|
122 |
+
}
|
123 |
+
|
124 |
+
if( $btn['type'] == 'colorpicker' ) {
|
125 |
+
switch( $btn['colorpickertype'] ) {
|
126 |
+
|
127 |
+
case 'farbtastic':
|
128 |
+
?>
|
129 |
+
<script type="text/javascript">
|
130 |
+
jQuery(document).ready(function($) {
|
131 |
+
jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
132 |
+
if( jQuery.isFunction(jQuery.fn.farbtastic) ) {
|
133 |
+
jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#<?php echo $btn['cow']; ?>_colorpicker");
|
134 |
+
jQuery("#<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('#<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
135 |
+
}
|
136 |
+
});
|
137 |
+
</script>
|
138 |
+
<?php
|
139 |
+
break;
|
140 |
+
|
141 |
+
case 'iris':
|
142 |
+
?>
|
143 |
+
<script type="text/javascript">
|
144 |
+
jQuery(document).ready(function($) {
|
145 |
+
|
146 |
+
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#fff' );
|
147 |
+
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', '<?php echo $btn['colorpickerd']; ?>' );
|
148 |
+
|
149 |
+
var options = {
|
150 |
+
wccmclass: "<?php echo $btn['cow']; ?>_colorpickerdiv",
|
151 |
+
palettes: true,
|
152 |
+
color: "",
|
153 |
+
hide: false,
|
154 |
+
change: function(event,ui){
|
155 |
+
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#000' );
|
156 |
+
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', ui.color.toString());
|
157 |
+
}
|
158 |
+
};
|
159 |
+
|
160 |
+
jQuery('#<?php echo $btn['cow']; ?>_colorpicker').iris( options );
|
161 |
+
jQuery('.<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
162 |
+
jQuery("#<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('.<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
163 |
+
|
164 |
+
});
|
165 |
+
</script>
|
166 |
+
<?php
|
167 |
+
break;
|
168 |
+
|
169 |
+
}
|
170 |
+
}
|
171 |
|
172 |
// ============================== radio button & checkbox ===========================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
|
174 |
+
if( ( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty( $btn['tax_remove'] ) ) {
|
175 |
+
?>
|
176 |
+
<script type="text/javascript">
|
177 |
+
jQuery(document).ready(function($) {
|
178 |
+
|
179 |
+
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
180 |
+
jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]').prop("checked", true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
<?php } ?>
|
182 |
|
183 |
+
jQuery('#<?php echo $btn['cow']; ?>_field input').click(function() {
|
184 |
+
|
185 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
186 |
+
|
187 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
188 |
+
data = {
|
189 |
+
action: 'remove_tax_wccm',
|
190 |
+
tax_remove_aj: jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]:checked').val()
|
191 |
+
};
|
192 |
+
|
193 |
+
jQuery.post(ajaxurl, data, function(response) {
|
194 |
+
$( 'body' ).trigger( 'update_checkout' );
|
195 |
+
jQuery('form.checkout').unblock();
|
196 |
+
});
|
|
|
|
|
|
|
|
|
197 |
|
198 |
+
});
|
199 |
+
});
|
200 |
+
</script>
|
201 |
+
<?php
|
202 |
+
}
|
203 |
|
204 |
+
if( ( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) {
|
205 |
+
?>
|
206 |
+
<script type="text/javascript">
|
207 |
+
jQuery(document).ready(function($) {
|
208 |
+
|
209 |
+
<?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
|
210 |
+
jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]').prop("checked", true);
|
211 |
+
<?php } ?>
|
212 |
+
jQuery('#<?php echo $btn['cow']; ?>_field input').click(function() {
|
213 |
|
214 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
215 |
|
216 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
217 |
+
data = {
|
218 |
+
action: 'remove_tax_wccm',
|
219 |
+
add_amount_aj: jQuery('#<?php echo $btn['cow']; ?>_field input[name=<?php echo $btn['cow']; ?>]:checked').val()
|
220 |
+
};
|
221 |
+
|
222 |
+
jQuery.post(ajaxurl, data, function(response) {
|
223 |
+
$( 'body' ).trigger( 'update_checkout' );
|
224 |
+
jQuery('form.checkout').unblock();
|
225 |
+
});
|
226 |
+
|
227 |
+
});
|
228 |
+
});
|
229 |
+
</script>
|
230 |
+
<?php
|
231 |
+
}
|
232 |
|
233 |
// =========================================== select options =========================================
|
234 |
+
|
235 |
+
if ( ($btn['type'] == 'wooccmselect') && !empty( $btn['tax_remove'] ) ) {
|
236 |
+
?>
|
237 |
+
<script type="text/javascript">
|
238 |
+
jQuery(document).ready(function($) {
|
239 |
+
|
240 |
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
241 |
+
jQuery('#<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_tax_save_method']; ?>' );
|
242 |
<?php } ?>
|
243 |
+
jQuery('#<?php echo $btn['cow']; ?>_field select').change(function() {
|
244 |
+
|
245 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
246 |
+
|
247 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
248 |
+
data = {
|
249 |
+
action: 'remove_tax_wccm',
|
250 |
+
tax_remove_aj: jQuery('#<?php echo $btn['cow']; ?> option:selected').val()
|
251 |
+
};
|
252 |
+
|
253 |
+
jQuery.post(ajaxurl, data, function(response) {
|
254 |
+
$( 'body' ).trigger( 'update_checkout' );
|
255 |
+
jQuery('form.checkout').unblock();
|
256 |
+
});
|
257 |
+
|
258 |
+
});
|
259 |
+
});
|
260 |
+
</script>
|
261 |
+
<?php
|
262 |
+
}
|
263 |
+
|
264 |
+
if ( ($btn['type'] == 'wooccmselect') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) {
|
265 |
+
?>
|
266 |
+
<script type="text/javascript">
|
267 |
+
jQuery(document).ready(function($) {
|
268 |
+
|
269 |
+
<?php if( !empty( $saved['wooccm_addamount453user'] ) ) { ?>
|
270 |
+
jQuery('#<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_addamount453user']; ?>' );
|
271 |
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
|
273 |
+
jQuery('#<?php echo $btn['cow']; ?>_field select').change(function() {
|
274 |
|
275 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
276 |
|
277 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
278 |
+
data = {
|
279 |
+
action: 'remove_tax_wccm',
|
280 |
+
add_amount_aj: jQuery('#<?php echo $btn['cow']; ?> option:selected').val()
|
281 |
+
};
|
282 |
|
283 |
+
jQuery.post(ajaxurl, data, function(response) {
|
284 |
+
$( 'body' ).trigger( 'update_checkout' );
|
285 |
+
jQuery('form.checkout').unblock();
|
286 |
+
});
|
287 |
|
288 |
+
});
|
289 |
+
});
|
290 |
+
</script>
|
291 |
+
<?php
|
292 |
+
}
|
293 |
|
294 |
// =========================================== add apply button ==========================================
|
295 |
|
296 |
+
if ( ($btn['type'] == 'text') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
|
297 |
+
?>
|
298 |
+
<script type="text/javascript">
|
299 |
+
jQuery(document).ready(function() {
|
300 |
+
jQuery( "#<?php echo $btn['cow']; ?>_field" ).append( '<span id="<?php echo $btn['cow']; ?>_applynow"><?php _e('Apply','woocommerce-checkout-manager'); ?></span>' );
|
301 |
+
});
|
302 |
+
|
303 |
+
jQuery(document).ready(function($) {
|
304 |
+
|
305 |
<?php if( !empty($saved['wooccm_addamount453userf']) ) { ?>
|
306 |
+
jQuery('input#<?php echo $btn['cow']; ?>').val( '<?php echo $saved['wooccm_addamount453userf']; ?>' );
|
307 |
<?php } ?>
|
308 |
|
309 |
+
jQuery('#<?php echo $btn['cow']; ?>_field #<?php echo $btn['cow']; ?>_applynow').click(function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
|
311 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
312 |
+
|
313 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
314 |
+
data = {
|
315 |
+
action: 'remove_tax_wccm',
|
316 |
+
add_amount_faj: jQuery('input#<?php echo $btn['cow']; ?>').val()
|
317 |
+
};
|
318 |
+
|
319 |
+
jQuery.post(ajaxurl, data, function(response) {
|
320 |
+
$( 'body' ).trigger( 'update_checkout' );
|
321 |
+
jQuery('form.checkout').unblock();
|
322 |
+
});
|
323 |
|
324 |
+
});
|
325 |
+
|
326 |
+
});
|
327 |
+
</script>
|
328 |
+
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
}
|
|
|
330 |
|
331 |
+
// =====================================================
|
332 |
+
|
333 |
+
}
|
334 |
+
|
335 |
+
}
|
336 |
|
337 |
// --------------------------------------------------------
|
338 |
// --------------------------------------------------------
|
339 |
// --------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
|
341 |
+
function wooccm_override_this() {
|
342 |
+
|
343 |
+
global $woocommerce;
|
344 |
+
|
345 |
+
$options = get_option( 'wccs_settings' );
|
346 |
+
|
347 |
+
$options['buttons'] = ( isset( $options['buttons'] ) ? $options['buttons'] : array() );
|
348 |
+
|
349 |
+
// Check if there are any buttons
|
350 |
+
if ( count( $options['buttons'] ) == 0 )
|
351 |
+
return;
|
352 |
+
|
353 |
+
$i = 0;
|
354 |
+
|
355 |
+
// css sub-parent hide
|
356 |
+
foreach( $options['buttons'] as $btn ) {
|
357 |
+
if( ($btn['type'] == 'text') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
|
358 |
+
echo '
|
359 |
+
<style type="text/css">
|
360 |
+
#'.$btn['cow'].'_applynow {
|
361 |
+
background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
|
362 |
+
background: -webkit-linear-gradient(#ad74a2,#96588a);
|
363 |
+
background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
|
364 |
+
background: -moz-gradient(center top,#ad74a2 0,#96588a 100%);
|
365 |
+
border-color: #76456c;
|
366 |
+
color: #fff;
|
367 |
+
text-shadow: 0 -1px 0 rgba(0,0,0,.6);
|
368 |
+
width: 100%;
|
369 |
+
text-align: center;
|
370 |
+
float: right;
|
371 |
+
cursor: pointer;
|
372 |
+
position: relative;
|
373 |
+
}
|
374 |
+
#'.$btn['cow'].'_applynow:active {
|
375 |
+
top: 1px;
|
376 |
+
}
|
377 |
+
</style>';
|
378 |
+
}
|
379 |
+
if( !empty( $btn['conditional_tie'] ) && empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) ) {
|
380 |
+
echo '
|
381 |
+
<style type="text/css">
|
382 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
383 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
384 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field.'.$btn['conditional_tie'].' {
|
385 |
+
display: none;
|
386 |
+
}
|
387 |
+
</style>';
|
388 |
+
}
|
389 |
+
}
|
390 |
|
391 |
// ====================== CHECKBOX =============================
|
392 |
// script when clicked show
|
393 |
// =============================================================
|
394 |
?>
|
395 |
+
<!-- Additional section: Checkbox -->
|
396 |
<script type="text/javascript">
|
397 |
+
jQuery(document).ready(function($){
|
398 |
+
<?php
|
399 |
+
foreach( $options['buttons'] as $btn ) {
|
400 |
+
if ( !empty( $btn['label'] ) && ($btn['type'] == 'checkbox_wccm') ) {
|
401 |
+
|
402 |
+
if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
|
403 |
+
?>
|
404 |
+
|
405 |
+
jQuery("#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]").click(function(){
|
406 |
+
|
407 |
+
<?php
|
408 |
+
foreach( $options['buttons'] as $btn3 ) {
|
409 |
+
if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
|
410 |
+
?>
|
411 |
+
if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
412 |
+
jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
|
413 |
+
}
|
414 |
+
if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
415 |
+
jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
|
416 |
+
|
417 |
+
<?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
|
418 |
+
|
419 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
420 |
+
|
421 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
422 |
+
data = {
|
423 |
+
action: 'remove_tax_wccm',
|
424 |
+
empty_check_add: 'none'
|
425 |
+
};
|
|
|
|
|
426 |
|
427 |
+
jQuery.post(ajaxurl, data, function(response) {
|
428 |
+
$( 'body' ).trigger( 'update_checkout' );
|
429 |
+
jQuery('form.checkout').unblock();
|
430 |
+
});
|
431 |
+
|
432 |
+
<?php } ?>
|
433 |
+
|
434 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
|
436 |
<?php
|
437 |
+
}
|
438 |
+
}
|
439 |
+
?>
|
440 |
|
441 |
+
});
|
442 |
|
443 |
+
<?php
|
444 |
+
}
|
445 |
+
}
|
446 |
+
}
|
447 |
+
?>
|
448 |
+
});
|
449 |
+
</script>
|
450 |
+
<?php
|
451 |
+
|
452 |
+
// ================================ END!!! =====================================
|
453 |
+
// =============================================================================
|
454 |
|
455 |
// ====================== SELECT OPTIONS =============================
|
456 |
// script when clicked show
|
457 |
// =============================================================
|
458 |
?>
|
459 |
+
<!-- Additional section: Select options -->
|
460 |
<script type="text/javascript">
|
461 |
jQuery(document).ready(function($){
|
462 |
|
463 |
+
<?php
|
464 |
+
foreach( $options['buttons'] as $btn ) {
|
465 |
+
if( !empty( $btn['label'] ) && ($btn['type'] == 'wooccmselect') ) {
|
466 |
+
|
467 |
+
if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
|
468 |
+
?>
|
469 |
+
|
470 |
+
jQuery("#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> select").change(function(){
|
471 |
+
|
472 |
+
<?php
|
473 |
+
foreach( $options['buttons'] as $btn3 ) {
|
474 |
+
if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
|
475 |
+
?>
|
476 |
+
|
477 |
+
if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #' . $btn['cow']; ?> option:selected').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
478 |
+
jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
|
479 |
+
}
|
480 |
+
|
481 |
+
if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #' . $btn['cow']; ?> option:selected').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
482 |
+
jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
|
483 |
+
|
484 |
+
<?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
|
485 |
+
|
486 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
487 |
+
|
488 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
489 |
+
data = {
|
490 |
+
action: 'remove_tax_wccm',
|
491 |
+
empty_check_add: 'none'
|
492 |
+
};
|
493 |
+
|
494 |
+
jQuery.post(ajaxurl, data, function(response) {
|
495 |
+
$( 'body' ).trigger( 'update_checkout' );
|
496 |
+
jQuery('form.checkout').unblock();
|
497 |
+
});
|
498 |
+
|
499 |
+
<?php } ?>
|
500 |
+
}
|
501 |
+
<?php
|
502 |
+
}
|
503 |
+
}
|
504 |
+
?>
|
505 |
+
});
|
506 |
+
<?php
|
507 |
+
}
|
508 |
+
}
|
509 |
+
}
|
510 |
+
?>
|
511 |
});
|
512 |
</script>
|
513 |
|
|
|
514 |
<?php
|
515 |
+
|
516 |
// ================================ END!!! =====================================
|
517 |
// =============================================================================
|
518 |
|
|
|
|
|
519 |
// ====================== RADIO BUTTON =============================
|
520 |
// script when clicked show
|
521 |
// =============================================================
|
522 |
+
|
523 |
?>
|
524 |
+
<!-- Additional section: Radio buttons -->
|
525 |
<script type="text/javascript">
|
526 |
jQuery(document).ready(function($){
|
527 |
|
528 |
+
<?php
|
529 |
+
foreach( $options['buttons'] as $btn ) {
|
530 |
+
if ( !empty( $btn['label'] ) && ($btn['type'] == 'wooccmradio') ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
531 |
|
532 |
+
if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
|
533 |
+
?>
|
534 |
|
535 |
+
jQuery("#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input").click(function(){
|
536 |
|
537 |
<?php
|
538 |
+
foreach( $options['buttons'] as $btn3 ) {
|
539 |
+
if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
|
540 |
+
?>
|
541 |
+
|
542 |
+
if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
543 |
+
jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
|
544 |
+
}
|
545 |
+
|
546 |
+
if(jQuery('#<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
547 |
+
jQuery("#<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
|
548 |
|
549 |
+
<?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
|
550 |
|
551 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
552 |
+
|
553 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
554 |
+
data = {
|
555 |
+
action: 'remove_tax_wccm',
|
556 |
+
empty_check_add: 'none'
|
557 |
+
};
|
558 |
+
|
559 |
+
jQuery.post(ajaxurl, data, function(response) {
|
560 |
+
$( 'body' ).trigger( 'update_checkout' );
|
561 |
+
jQuery('form.checkout').unblock();
|
562 |
+
});
|
563 |
+
|
564 |
+
<?php } ?>
|
565 |
+
|
566 |
+
}
|
567 |
+
|
568 |
+
<?php
|
569 |
+
}
|
570 |
+
}
|
571 |
+
?>
|
572 |
+
|
573 |
+
});
|
574 |
+
<?php
|
575 |
+
}
|
576 |
+
}
|
577 |
+
}
|
578 |
+
?>
|
579 |
+
});
|
580 |
+
</script>
|
581 |
+
|
582 |
+
<?php
|
583 |
+
|
584 |
+
// ================================ END!!! =====================================
|
585 |
+
// =============================================================================
|
586 |
|
587 |
// ----------------------------- CLEAR ---------------------------------
|
588 |
// ---------------------------------------------------------------------
|
589 |
// ---------------------------------------------------------------------
|
590 |
+
|
591 |
+
$categoryarraycm = array();
|
592 |
+
$productsarraycm = array();
|
593 |
+
|
594 |
+
foreach( $options['buttons'] as $btn ) {
|
595 |
+
foreach( $woocommerce->cart->cart_contents as $key => $values ) {
|
596 |
+
|
597 |
+
$multiproductsx = $btn['single_p'];
|
598 |
+
$show_field_single = $btn['single_px'];
|
599 |
+
$multiproductsx_cat = $btn['single_p_cat'];
|
600 |
+
$show_field_single_cat = $btn['single_px_cat'];
|
601 |
+
|
602 |
+
$productsarraycm[] = $values['product_id'];
|
603 |
+
|
604 |
+
// Products
|
605 |
+
// hide field
|
606 |
+
|
607 |
+
// without more
|
608 |
+
if( !empty( $btn['single_p'] ) && empty( $btn['more_content'] ) ) {
|
609 |
+
|
610 |
+
$multiarrayproductsx = explode( ',', $multiproductsx );
|
611 |
+
|
612 |
+
if( in_array( $values['product_id'], $multiarrayproductsx ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
613 |
+
echo '
|
614 |
+
<style type="text/css">
|
615 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
616 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
617 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
618 |
+
display: none;
|
619 |
+
}
|
620 |
+
</style>';
|
621 |
+
}
|
622 |
+
}
|
623 |
+
|
624 |
+
// show field without more
|
625 |
+
if( !empty( $btn['single_px'] ) && empty( $btn['more_content'] ) ) {
|
626 |
+
|
627 |
+
$show_field_array = explode( '||', $show_field_single );
|
628 |
+
|
629 |
+
if( in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
630 |
+
echo '
|
631 |
+
<style type="text/css">
|
632 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
633 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
634 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
635 |
+
display: inline-block;
|
636 |
+
}
|
637 |
+
</style>';
|
638 |
+
}
|
639 |
+
|
640 |
+
if( !in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
641 |
+
echo '
|
642 |
+
<style type="text/css">
|
643 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
644 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
645 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
646 |
+
display: none;
|
647 |
+
}
|
648 |
+
</style>';
|
649 |
+
}
|
650 |
+
}
|
651 |
+
|
652 |
+
// Category
|
653 |
+
// hide field
|
654 |
+
$terms = get_the_terms( $values['product_id'], 'product_cat' );
|
655 |
+
if( !empty($terms) ) {
|
656 |
+
foreach( $terms as $term ) {
|
657 |
+
|
658 |
+
$categoryarraycm[] = $term->slug;
|
659 |
+
|
660 |
+
// without more
|
661 |
+
|
662 |
+
if( !empty( $btn['single_p_cat'] ) && empty( $btn['more_content'] ) ) {
|
663 |
+
|
664 |
+
$multiarrayproductsx_cat = explode( ',', $multiproductsx_cat );
|
665 |
+
|
666 |
+
if( in_array( $term->slug, $multiarrayproductsx_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
667 |
+
echo '
|
668 |
+
<style type="text/css">
|
669 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
670 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
671 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
672 |
+
display: none;
|
673 |
+
}
|
674 |
+
</style>';
|
675 |
+
}
|
676 |
+
}
|
677 |
+
|
678 |
+
// show field without more
|
679 |
+
if( !empty( $btn['single_px_cat'] ) && empty( $btn['more_content'] ) ) {
|
680 |
+
|
681 |
+
$show_field_array_cat = explode('||',$show_field_single_cat);
|
682 |
+
|
683 |
+
if( in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
684 |
+
echo '
|
685 |
+
<style type="text/css">
|
686 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
687 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
688 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
689 |
+
display: inline-block;
|
690 |
+
}
|
691 |
+
</style>';
|
692 |
+
}
|
693 |
+
|
694 |
+
if( !in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
695 |
+
echo '
|
696 |
+
<style type="text/css">
|
697 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
698 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
699 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
700 |
+
display: none;
|
701 |
+
}
|
702 |
+
</style>';
|
703 |
+
}
|
704 |
+
}
|
705 |
+
|
706 |
+
}
|
707 |
+
}
|
708 |
+
}
|
709 |
+
// end cart
|
710 |
+
|
711 |
+
// ===========================================================================================
|
712 |
+
|
713 |
+
// Products
|
714 |
+
// hide field
|
715 |
+
|
716 |
+
// with more
|
717 |
+
if( !empty( $btn['single_p'] ) && !empty( $btn['more_content'] ) ) {
|
718 |
+
|
719 |
+
$multiarrayproductsx = explode( ',', $multiproductsx );
|
720 |
+
|
721 |
+
if( array_intersect( $productsarraycm, $multiarrayproductsx ) ) {
|
722 |
+
echo '
|
723 |
+
<style type="text/css">
|
724 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
725 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
726 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
727 |
+
display: none;
|
728 |
+
}
|
729 |
+
</style>';
|
730 |
+
}
|
731 |
+
}
|
732 |
+
|
733 |
+
// show field with more
|
734 |
+
if( !empty( $btn['single_px'] ) && !empty( $btn['more_content'] ) ) {
|
735 |
+
|
736 |
+
$show_field_array = explode( '||', $show_field_single );
|
737 |
+
|
738 |
+
if( array_intersect( $productsarraycm, $show_field_array ) ) {
|
739 |
+
echo '
|
740 |
+
<style type="text/css">
|
741 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
742 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
743 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
744 |
+
display: inline-block;
|
745 |
+
}
|
746 |
+
</style>';
|
747 |
+
}
|
748 |
+
|
749 |
+
if( !array_intersect( $productsarraycm, $show_field_array ) ) {
|
750 |
+
echo '
|
751 |
+
<style type="text/css">
|
752 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
753 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
754 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
755 |
+
display: none;
|
756 |
+
}
|
757 |
+
</style>';
|
758 |
+
}
|
759 |
+
}
|
760 |
+
|
761 |
+
// Category
|
762 |
+
// hide field
|
763 |
+
|
764 |
+
// with more
|
765 |
+
if( !empty( $btn['single_p_cat'] ) && !empty( $btn['more_content'] ) ) {
|
766 |
+
|
767 |
+
$multiarrayproductsx_cat = explode( ',', $multiproductsx_cat );
|
768 |
+
|
769 |
+
if( array_intersect( $categoryarraycm, $multiarrayproductsx_cat ) ) {
|
770 |
+
echo '
|
771 |
+
<style type="text/css">
|
772 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
773 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
774 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
775 |
+
display: none;
|
776 |
+
}
|
777 |
+
</style>';
|
778 |
+
}
|
779 |
+
}
|
780 |
+
|
781 |
+
// show field with more
|
782 |
+
if( !empty( $btn['single_px_cat'] ) && !empty( $btn['more_content'] ) ) {
|
783 |
+
|
784 |
+
$show_field_array_cat = explode( '||', $show_field_single_cat );
|
785 |
+
|
786 |
+
if( array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
787 |
+
echo '
|
788 |
+
<style type="text/css">
|
789 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
790 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
791 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
792 |
+
display: inline-block;
|
793 |
+
}
|
794 |
+
</style>';
|
795 |
+
}
|
796 |
+
|
797 |
+
if( !array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
798 |
+
echo '
|
799 |
+
<style type="text/css">
|
800 |
+
.woocommerce form #customer_details #'.$btn['cow'].'_field,
|
801 |
+
.woocommerce-page form #customer_details #'.$btn['cow'].'_field,
|
802 |
+
.woocommerce form.checkout #'.$btn['cow'].'_field {
|
803 |
+
display: none;
|
804 |
+
}
|
805 |
+
</style>';
|
806 |
+
}
|
807 |
+
}
|
808 |
+
|
809 |
+
$categoryarraycm = array();
|
810 |
+
$productsarraycm = array();
|
811 |
+
|
812 |
+
} // btn cut
|
813 |
+
|
814 |
+
}
|
815 |
+
?>
|
includes/templates/functions/add_wooccmupload.php
CHANGED
@@ -1,396 +1,396 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* WooCommerce Checkout Manager
|
4 |
*/
|
5 |
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
-
function
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
<script type="text/javascript">
|
25 |
jQuery(document).ready(function($){
|
26 |
|
27 |
$("#<?php echo $btn['cow']; ?>_field").magnificPopup({
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
easing: "ease-out"
|
34 |
-
|
35 |
-
});
|
36 |
|
37 |
-
(function post_image_content() {
|
38 |
-
var input = document.getElementById("<?php echo $btn['cow']; ?>_file"),
|
39 |
-
formdata = false, loadfiles, formnames = [], loadfiles = [];
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
return false;
|
44 |
-
});
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
edit = document.createElement("a"),
|
58 |
-
dele = document.createElement("a"),
|
59 |
-
a = document.createElement("a"),
|
60 |
-
spana = document.createElement("spana"),
|
61 |
-
img = document.createElement("img");
|
62 |
-
|
63 |
-
name.innerHTML = getname;
|
64 |
-
edit.innerHTML = "Edit";
|
65 |
-
dele.innerHTML = "Delete";
|
66 |
-
if (filetype.match("image.*")) {
|
67 |
-
img.src = source;
|
68 |
-
a.href = source;
|
69 |
-
a.title = getname;
|
70 |
-
edit.href = source;
|
71 |
-
zoom.href = source;
|
72 |
-
zoom.title = getname;
|
73 |
-
zoom.innerHTML = "Zoom <img style=display:none />";
|
74 |
-
li.appendChild(a);
|
75 |
-
a.appendChild(img);
|
76 |
-
a.className = "wooccm-zoom-special wooccm-image-holder mfp-zoom";
|
77 |
-
zoom.className = "wooccm-zoom-special wooccm_zoom wooccm-btn wooccm-btn-zoom";
|
78 |
-
edit.className = "wooccm_edit wooccm-btn wooccm-btn-edit enable";
|
79 |
-
}else{
|
80 |
-
zoom.innerHTML = "Zoom";
|
81 |
-
li.appendChild(spana);
|
82 |
-
spana.appendChild(img);
|
83 |
-
spana.className = "wooccm-image-holder";
|
84 |
-
zoom.className = "wooccm_zoom wooccm-btn disable";
|
85 |
-
edit.className = "wooccm_edit wooccm-btn disable";
|
86 |
-
}
|
87 |
-
if ( ( false === filetype.match("application/ms.*") && false === filetype.match("application/x.*") && false === filetype.match("audio.*") && false === filetype.match("text.*") && false === filetype.match("video.*") ) || ( 0 === filetype.length || !filetype) ) {
|
88 |
-
img.src = "<?php echo site_url('wp-includes/images/media/interactive.png'); ?>";
|
89 |
-
}
|
90 |
-
if (filetype.match("application/ms.*")) {
|
91 |
-
img.src = "<?php echo site_url('wp-includes/images/media/spreadsheet.png'); ?>";
|
92 |
-
}
|
93 |
-
if (filetype.match("application/x.*")) {
|
94 |
-
img.src = "<?php echo site_url('wp-includes/images/media/archive.png'); ?>";
|
95 |
-
}
|
96 |
-
if (filetype.match("audio.*")) {
|
97 |
-
img.src = "<?php echo site_url('wp-includes/images/media/audio.png'); ?>";
|
98 |
-
}
|
99 |
-
if (filetype.match("text.*")) {
|
100 |
-
img.src = "<?php echo site_url('wp-includes/images/media/text.png'); ?>";
|
101 |
-
}
|
102 |
-
if (filetype.match("video.*")) {
|
103 |
-
img.src = "<?php echo site_url('wp-includes/images/media/video.png'); ?>";
|
104 |
-
}
|
105 |
-
|
106 |
-
li.title = getname;
|
107 |
-
dele.title = getname;
|
108 |
-
edit.title = getname;
|
109 |
-
li.appendChild(name);
|
110 |
-
li.appendChild(span);
|
111 |
-
span.appendChild(zoom);
|
112 |
-
span.appendChild(edit);
|
113 |
-
span.appendChild(dele);
|
114 |
-
list.appendChild(li);
|
115 |
-
li.className = "wooccm_each_file";
|
116 |
-
name.className = "wooccm_name";
|
117 |
-
dele.id = "wooccm_dele";
|
118 |
-
dele.className = "wooccm_dele wooccm-btn wooccm-btn-danger";
|
119 |
-
span.className = "container";
|
120 |
-
|
121 |
-
|
122 |
-
}
|
123 |
-
|
124 |
-
input.addEventListener("change", function (evt) {
|
125 |
-
$("#<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
126 |
-
|
127 |
-
var count = $("#<?php echo $btn['cow']; ?>_files_button_wccm").data("count") || 0;
|
128 |
-
$("#<?php echo $btn['cow']; ?>_files_button_wccm").data("count", ++count);
|
129 |
-
|
130 |
-
var img, reader, file, iname, len = <?php echo $length; ?>;
|
131 |
-
var file_array = <?php echo wooccm_js_array($file_types); ?>;
|
132 |
-
var wooempt = <?php echo $file_types; ?>;
|
133 |
-
|
134 |
-
|
135 |
-
for ( i = 0; i < len; i++ ) {
|
136 |
-
file = this.files[i];
|
137 |
-
|
138 |
-
for(x=0; x < <?php echo $number_of_types; ?>; x++){
|
139 |
-
if( !wooempt || file.type.match(file_array[x]) ) {
|
140 |
-
|
141 |
-
if ( window.FileReader ) {
|
142 |
-
reader = new FileReader();
|
143 |
-
reader.onload = (function(theFile){
|
144 |
-
var fileName = theFile.name,
|
145 |
filetype = theFile.type;
|
146 |
-
|
147 |
showUploadedItem( e.target.result, fileName, filetype );
|
148 |
};
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
$("#<?php echo $btn['cow']; ?>_field").unblock();
|
174 |
}
|
175 |
-
}
|
176 |
-
|
177 |
-
}else{
|
178 |
-
$("#<?php echo $btn['cow']; ?>_field").unblock();
|
179 |
-
}
|
180 |
-
}
|
181 |
-
}
|
182 |
|
183 |
-
if( formdata ) {
|
184 |
-
$("#<?php echo $btn['cow']; ?>_field").unblock();
|
185 |
-
}
|
186 |
-
|
187 |
-
|
188 |
-
}, false);
|
189 |
-
|
190 |
-
$("#caman_content #wooccmtoolbar #save").click( function(){
|
191 |
-
$("#caman_content #wooccmtoolbar").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
192 |
-
|
193 |
-
var title = this.title, the_file, wooxtro = document.getElementById("wooccmactualimage").getAttribute("data-caman-hidpi"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
194 |
-
formdata = new FormData();
|
195 |
-
|
196 |
-
for(var t = 0; t < count.length; t++) {
|
197 |
-
if( count[t].getAttribute("wooccm-attach-id") ){
|
198 |
-
break;
|
199 |
-
}
|
200 |
-
store.push(count[t]);
|
201 |
-
}
|
202 |
-
|
203 |
-
if( store.length !== 0 ){
|
204 |
-
listing = document.getElementById("<?php echo $btn['cow']; ?>").value.split("||");
|
205 |
-
listing = listing[1].split(",");
|
206 |
-
listing = listing.filter(Number);
|
207 |
-
|
208 |
-
$.each(listing, function(index, value){
|
209 |
-
$(store[index]).attr("wooccm-attach-id", value);
|
210 |
-
});
|
211 |
-
}
|
212 |
-
|
213 |
-
|
214 |
-
$(".wooccm_each_file").each(function(){
|
215 |
-
if( this.title === title) {
|
216 |
-
var currentgutz = this;
|
217 |
-
this.firstElementChild.href = wooxtro;
|
218 |
-
this.firstElementChild.firstElementChild.src = wooxtro;
|
219 |
-
this.lastElementChild.firstElementChild.href = wooxtro;
|
220 |
-
this.lastElementChild.lastElementChild.previousElementSibling.href = wooxtro;
|
221 |
-
|
222 |
-
var byteString;
|
223 |
-
var dataURI = wooxtro; //data:image/gif;base64,R0lGODlhyAAiALM...DfD0QAADs
|
224 |
-
|
225 |
-
if (dataURI.split(',')[0].indexOf('base64') >= 0)
|
226 |
-
|
227 |
-
byteString = atob(dataURI.split(',')[1]);
|
228 |
-
|
229 |
-
else
|
230 |
-
|
231 |
-
byteString = unescape(dataURI.split(',')[1]);
|
232 |
-
|
233 |
-
// separate out the mime component
|
234 |
-
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
235 |
-
|
236 |
-
// write the bytes of the string to a typed array
|
237 |
-
var ia = new Uint8Array(byteString.length);
|
238 |
-
for (var i = 0; i < byteString.length; i++) {
|
239 |
-
ia[i] = byteString.charCodeAt(i);
|
240 |
}
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
var
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
});
|
267 |
-
|
268 |
-
$("#caman_content #wooccmtoolbar").unblock();
|
269 |
-
alert("<?php echo wpml_string_wccm_pro($options['checkness']['picture_success']); ?>");
|
270 |
}
|
271 |
-
|
272 |
});
|
273 |
-
|
274 |
-
});
|
275 |
-
|
276 |
-
|
277 |
-
});
|
278 |
-
|
279 |
-
$(document).on('click','.wooccm_dele',function(){
|
280 |
-
|
281 |
-
var c = confirm("<?php echo wpml_string_wccm_pro($options['checkness']['file_delete']); ?> " + this.title + " ?"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
282 |
-
if (c==true) {
|
283 |
-
|
284 |
-
$("#<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
285 |
-
|
286 |
-
for(var t = 0; t < count.length; t++) {
|
287 |
-
if( count[t].getAttribute("wooccm-attach-id") ){
|
288 |
-
break;
|
289 |
-
}
|
290 |
-
store.push(count[t]);
|
291 |
-
}
|
292 |
-
|
293 |
-
if( store.length !== 0 ){
|
294 |
-
listing = document.getElementById("<?php echo $btn['cow']; ?>").value.split("||");
|
295 |
-
listing = listing[1].split(",");
|
296 |
-
listing = listing.filter(Number);
|
297 |
-
|
298 |
-
$.each(listing, function(index, value){
|
299 |
-
$(store[index]).attr("wooccm-attach-id", value);
|
300 |
});
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
|
|
|
|
|
|
|
|
310 |
}
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
remove = remove + ",";
|
322 |
$("#<?php echo $btn['cow']; ?>").val(function(index, value) {
|
323 |
return value.replace(remove, "");
|
324 |
});
|
325 |
-
|
326 |
shell.outerHTML = "";
|
327 |
-
|
328 |
-
$("#<?php echo $btn['cow']; ?>_field").unblock();
|
329 |
-
}
|
330 |
-
|
331 |
-
});
|
332 |
-
|
333 |
-
|
334 |
-
} else {
|
335 |
-
}
|
336 |
-
|
337 |
-
});
|
338 |
|
|
|
|
|
|
|
|
|
|
|
339 |
|
|
|
340 |
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
346 |
});
|
347 |
-
|
348 |
-
|
|
|
349 |
});
|
350 |
-
|
351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
});
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
$(document).on('click','.wooccm_edit',function(){
|
358 |
-
return false;
|
359 |
-
});
|
360 |
-
|
361 |
-
$(document).on('click','.wooccm_edit.enable',function(){
|
362 |
-
var imageinbase = this.href,
|
363 |
-
li = document.getElementById( "wooccmimageeditorpro" ),
|
364 |
-
data = document.createAttribute("data-caman-hidpi"),
|
365 |
-
img = document.createElement("img");
|
366 |
-
|
367 |
-
data.value = imageinbase;
|
368 |
-
|
369 |
-
$("#caman_content #wooccmtoolbar #save").attr("title", this.title);
|
370 |
-
|
371 |
-
if( $(".wooccmimageeditor img").length == 0 ){
|
372 |
-
img.id = "wooccmactualimage";
|
373 |
-
img.src = imageinbase;
|
374 |
-
img.setAttributeNode(data);
|
375 |
-
li.appendChild(img);
|
376 |
-
|
377 |
-
|
378 |
-
$.getScript( "<?php echo plugins_url('woocommerce-checkout-manager-pro/includes/pickers/caman/dist/caman_controls.js'); ?>");
|
379 |
-
}
|
380 |
-
|
381 |
-
$("#caman_content").show();
|
382 |
-
$("html").css("overflow", "hidden");
|
383 |
-
});
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
}());
|
389 |
});
|
390 |
</script>
|
391 |
-
</p>
|
392 |
<?php
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
*/
|
5 |
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
+
function wooccm_upload_scripts() {
|
10 |
+
|
11 |
+
global $woocommerce, $post;
|
12 |
+
|
13 |
+
$options = get_option( 'wccs_settings' );
|
14 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : false );
|
15 |
+
|
16 |
+
$length = ( empty( $options['checkness']['file_upload_number'] ) ) ? 'this.files.length' : $options['checkness']['file_upload_number'];
|
17 |
+
|
18 |
+
// Check if we have any buttons
|
19 |
+
if( empty( $buttons ) )
|
20 |
+
return;
|
21 |
+
|
22 |
+
foreach( $buttons as $btn ) {
|
23 |
+
|
24 |
+
if( $btn['type'] <> 'wooccmupload' )
|
25 |
+
continue;
|
26 |
+
|
27 |
+
$file_types = explode(",", $btn['option_array']);
|
28 |
+
$number_of_types = count($file_types);
|
29 |
+
?>
|
30 |
+
<!-- Additional section: File upload -->
|
31 |
<script type="text/javascript">
|
32 |
jQuery(document).ready(function($){
|
33 |
|
34 |
$("#<?php echo $btn['cow']; ?>_field").magnificPopup({
|
35 |
+
delegate: "a.wooccm-zoom-special", // child items selector, by clicking on it popup will open
|
36 |
+
type: "image",
|
37 |
+
zoom: {
|
38 |
+
enabled: true,
|
39 |
+
duration: 400,
|
40 |
easing: "ease-out"
|
41 |
+
}
|
42 |
+
});
|
43 |
|
44 |
+
(function post_image_content() {
|
|
|
|
|
45 |
|
46 |
+
var input = document.getElementById("<?php echo $btn['cow']; ?>_file"),
|
47 |
+
formdata = false, loadfiles, formnames = [], loadfiles = [];
|
|
|
|
|
48 |
|
49 |
+
$("#<?php echo $btn['cow']; ?>_files_button_wccm").click( function(){
|
50 |
+
$("#<?php echo $btn['cow']; ?>_field input[type=file]").click();
|
51 |
+
return false;
|
52 |
+
});
|
53 |
+
|
54 |
+
if (window.FormData) {
|
55 |
+
formdata = new FormData();
|
56 |
+
}
|
57 |
+
|
58 |
+
function showUploadedItem ( source, getname, filetype ) {
|
59 |
+
|
60 |
+
var
|
61 |
+
list = document.getElementById("<?php echo $btn['cow']; ?>_field"),
|
62 |
+
li = document.createElement("span"),
|
63 |
+
name = document.createElement("name"),
|
64 |
+
span = document.createElement("span"),
|
65 |
+
zoom = document.createElement("a"),
|
66 |
+
edit = document.createElement("a"),
|
67 |
+
dele = document.createElement("a"),
|
68 |
+
a = document.createElement("a"),
|
69 |
+
spana = document.createElement("spana"),
|
70 |
+
img = document.createElement("img");
|
71 |
+
|
72 |
+
name.innerHTML = getname;
|
73 |
+
edit.innerHTML = "Edit";
|
74 |
+
dele.innerHTML = "Delete";
|
75 |
+
|
76 |
+
if (filetype.match("image.*")) {
|
77 |
+
img.src = source;
|
78 |
+
a.href = source;
|
79 |
+
a.title = getname;
|
80 |
+
edit.href = source;
|
81 |
+
zoom.href = source;
|
82 |
+
zoom.title = getname;
|
83 |
+
zoom.innerHTML = "Zoom <img style=display:none />";
|
84 |
+
li.appendChild(a);
|
85 |
+
a.appendChild(img);
|
86 |
+
a.className = "wooccm-zoom-special wooccm-image-holder mfp-zoom";
|
87 |
+
zoom.className = "wooccm-zoom-special wooccm_zoom wooccm-btn wooccm-btn-zoom";
|
88 |
+
edit.className = "wooccm_edit wooccm-btn wooccm-btn-edit enable";
|
89 |
+
}else{
|
90 |
+
zoom.innerHTML = "Zoom";
|
91 |
+
li.appendChild(spana);
|
92 |
+
spana.appendChild(img);
|
93 |
+
spana.className = "wooccm-image-holder";
|
94 |
+
zoom.className = "wooccm_zoom wooccm-btn disable";
|
95 |
+
edit.className = "wooccm_edit wooccm-btn disable";
|
96 |
+
}
|
97 |
+
if ( ( false === filetype.match("application/ms.*") && false === filetype.match("application/x.*") && false === filetype.match("audio.*") && false === filetype.match("text.*") && false === filetype.match("video.*") ) || ( 0 === filetype.length || !filetype) ) {
|
98 |
+
img.src = "<?php echo site_url('wp-includes/images/media/interactive.png'); ?>";
|
99 |
+
}
|
100 |
+
if (filetype.match("application/ms.*")) {
|
101 |
+
img.src = "<?php echo site_url('wp-includes/images/media/spreadsheet.png'); ?>";
|
102 |
+
}
|
103 |
+
if (filetype.match("application/x.*")) {
|
104 |
+
img.src = "<?php echo site_url('wp-includes/images/media/archive.png'); ?>";
|
105 |
+
}
|
106 |
+
if (filetype.match("audio.*")) {
|
107 |
+
img.src = "<?php echo site_url('wp-includes/images/media/audio.png'); ?>";
|
108 |
+
}
|
109 |
+
if (filetype.match("text.*")) {
|
110 |
+
img.src = "<?php echo site_url('wp-includes/images/media/text.png'); ?>";
|
111 |
+
}
|
112 |
+
if (filetype.match("video.*")) {
|
113 |
+
img.src = "<?php echo site_url('wp-includes/images/media/video.png'); ?>";
|
114 |
+
}
|
115 |
+
|
116 |
+
li.title = getname;
|
117 |
+
dele.title = getname;
|
118 |
+
edit.title = getname;
|
119 |
+
li.appendChild(name);
|
120 |
+
li.appendChild(span);
|
121 |
+
span.appendChild(zoom);
|
122 |
+
span.appendChild(edit);
|
123 |
+
span.appendChild(dele);
|
124 |
+
list.appendChild(li);
|
125 |
+
li.className = "wooccm_each_file";
|
126 |
+
name.className = "wooccm_name";
|
127 |
+
dele.id = "wooccm_dele";
|
128 |
+
dele.className = "wooccm_dele wooccm-btn wooccm-btn-danger";
|
129 |
+
span.className = "container";
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
input.addEventListener("change", function (evt) {
|
134 |
+
$("#<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
135 |
+
|
136 |
+
var count = $("#<?php echo $btn['cow']; ?>_files_button_wccm").data("count") || 0;
|
137 |
+
$("#<?php echo $btn['cow']; ?>_files_button_wccm").data("count", ++count);
|
138 |
+
|
139 |
+
var img, reader, file, iname, len = <?php echo $length; ?>;
|
140 |
+
var file_array = <?php echo wooccm_js_array($file_types); ?>;
|
141 |
+
/* @mod - check this is correct */
|
142 |
+
var wooempt = '<?php echo implode( ',', $file_types ); ?>';
|
143 |
+
|
144 |
+
for ( i = 0; i < len; i++ ) {
|
145 |
+
|
146 |
+
file = this.files[i];
|
147 |
|
148 |
+
for(x=0; x < <?php echo $number_of_types; ?>; x++){
|
149 |
+
if( !wooempt || file.type.match(file_array[x]) ) {
|
150 |
+
|
151 |
+
if ( window.FileReader ) {
|
152 |
+
reader = new FileReader();
|
153 |
+
reader.onload = (function(theFile){
|
154 |
+
var fileName = theFile.name,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
filetype = theFile.type;
|
156 |
+
return function(e){
|
157 |
showUploadedItem( e.target.result, fileName, filetype );
|
158 |
};
|
159 |
+
})(file);
|
160 |
+
reader.readAsDataURL(file);
|
161 |
+
}
|
162 |
+
|
163 |
+
formdata.append("<?php echo $btn['cow']; ?>", file);
|
164 |
+
formnames.push(file.name);
|
165 |
+
loadfiles.push(file);
|
166 |
+
|
167 |
+
$.ajax({
|
168 |
+
/* @mod - Test change of formatting */
|
169 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&order_id='.$post->ID.'&name='.$btn['cow'].''); ?>",
|
170 |
+
/* url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&name='.$btn['cow'].''); ?>", */
|
171 |
+
type: "POST",
|
172 |
+
data: formdata,
|
173 |
+
cache: false,
|
174 |
+
processData: false,
|
175 |
+
contentType: false,
|
176 |
+
success: function (res) {
|
177 |
+
console.dir(res);
|
178 |
+
var result = $.parseJSON(res), new_val;
|
179 |
+
/* @mod - Test formatting change */
|
180 |
+
/*
|
181 |
+
document.getElementById("<?php echo $btn['cow']; ?>").value = result;
|
182 |
+
*/
|
183 |
+
new_val = document.getElementById("<?php echo $btn['cow']; ?>").value;
|
184 |
+
new_val += result + ",";
|
185 |
+
document.getElementById("<?php echo $btn['cow']; ?>").value = new_val;
|
186 |
+
/*
|
187 |
+
new_val[0] = result[0];
|
188 |
+
new_val[1] += result[1] + ",";
|
189 |
+
document.getElementById("<?php echo $btn['cow']; ?>").value = new_val[0] + "||" + new_val[1];
|
190 |
+
*/
|
191 |
+
|
192 |
+
$("#<?php echo $btn['cow']; ?>_field").unblock();
|
193 |
+
}
|
194 |
+
});
|
195 |
+
|
196 |
+
} else {
|
197 |
$("#<?php echo $btn['cow']; ?>_field").unblock();
|
198 |
}
|
199 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
}
|
202 |
+
|
203 |
+
if( formdata ) {
|
204 |
+
$("#<?php echo $btn['cow']; ?>_field").unblock();
|
205 |
+
}
|
206 |
+
|
207 |
+
}, false);
|
208 |
+
|
209 |
+
$("#caman_content #wooccmtoolbar #save").click( function(){
|
210 |
+
|
211 |
+
$("#caman_content #wooccmtoolbar").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
212 |
+
|
213 |
+
var title = this.title, the_file, wooxtro = document.getElementById("wooccmactualimage").getAttribute("data-caman-hidpi"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
214 |
+
formdata = new FormData();
|
215 |
+
|
216 |
+
for(var t = 0; t < count.length; t++) {
|
217 |
+
if( count[t].getAttribute("wooccm-attach-id") ){
|
218 |
+
break;
|
219 |
+
}
|
220 |
+
store.push(count[t]);
|
221 |
+
}
|
222 |
+
|
223 |
+
if( store.length !== 0 ){
|
224 |
+
listing = document.getElementById("<?php echo $btn['cow']; ?>").value.split("||");
|
225 |
+
listing = listing[1].split(",");
|
226 |
+
listing = listing.filter(Number);
|
227 |
+
|
228 |
+
$.each(listing, function(index, value){
|
229 |
+
$(store[index]).attr("wooccm-attach-id", value);
|
230 |
+
});
|
231 |
+
}
|
232 |
+
|
233 |
+
$(".wooccm_each_file").each(function(){
|
234 |
+
if( this.title === title) {
|
235 |
+
|
236 |
+
var currentgutz = this;
|
237 |
+
this.firstElementChild.href = wooxtro;
|
238 |
+
this.firstElementChild.firstElementChild.src = wooxtro;
|
239 |
+
this.lastElementChild.firstElementChild.href = wooxtro;
|
240 |
+
this.lastElementChild.lastElementChild.previousElementSibling.href = wooxtro;
|
241 |
+
|
242 |
+
var byteString;
|
243 |
+
var dataURI = wooxtro; //data:image/gif;base64,R0lGODlhyAAiALM...DfD0QAADs
|
244 |
+
|
245 |
+
if (dataURI.split(',')[0].indexOf('base64') >= 0)
|
246 |
+
byteString = atob(dataURI.split(',')[1]);
|
247 |
+
else
|
248 |
+
byteString = unescape(dataURI.split(',')[1]);
|
249 |
+
|
250 |
+
// separate out the mime component
|
251 |
+
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
252 |
+
|
253 |
+
// write the bytes of the string to a typed array
|
254 |
+
var ia = new Uint8Array(byteString.length);
|
255 |
+
for (var i = 0; i < byteString.length; i++) {
|
256 |
+
ia[i] = byteString.charCodeAt(i);
|
257 |
+
}
|
258 |
+
|
259 |
+
var extension = mimeString.split('/')[1];
|
260 |
+
var fileName = "image_" + new Date().getTime() + "." + extension;
|
261 |
+
var blob = new Blob([ia], {type:mimeString});
|
262 |
+
|
263 |
+
the_file = new File([blob], title, {
|
264 |
+
type: "image/png"
|
265 |
+
});
|
266 |
+
|
267 |
+
formdata.append("<?php echo $btn['cow']; ?>", the_file);
|
268 |
+
var remove = this.getAttribute("wooccm-attach-id");
|
269 |
+
|
270 |
+
$.ajax({
|
271 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_enduploadsave&name='.$btn['cow'].'&remove='); ?>" + remove,
|
272 |
+
type: "POST",
|
273 |
+
data: formdata,
|
274 |
+
cache: false,
|
275 |
+
processData: false,
|
276 |
+
contentType: false,
|
277 |
+
success: function (res) {
|
278 |
+
var result = $.parseJSON(res);
|
279 |
+
$(currentgutz).attr("wooccm-attach-id", result);
|
280 |
+
$("#<?php echo $btn['cow']; ?>").val(function(index, value) {
|
281 |
+
return value.replace(remove, result);
|
282 |
+
});
|
283 |
+
$("#caman_content #wooccmtoolbar").unblock();
|
284 |
+
alert("<?php echo wooccm_wpml_string($options['checkness']['picture_success']); ?>");
|
285 |
+
}
|
286 |
});
|
287 |
+
|
|
|
|
|
288 |
}
|
|
|
289 |
});
|
290 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
});
|
292 |
+
|
293 |
+
$(document).on('click','.wooccm_dele',function(){
|
294 |
+
|
295 |
+
var c = confirm("<?php echo wooccm_wpml_string($options['checkness']['file_delete']); ?> " + this.title + " ?"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
296 |
+
if (c==true) {
|
297 |
+
|
298 |
+
$("#<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
299 |
+
|
300 |
+
for(var t = 0; t < count.length; t++) {
|
301 |
+
if( count[t].getAttribute("wooccm-attach-id") ){
|
302 |
+
break;
|
303 |
+
}
|
304 |
+
store.push(count[t]);
|
305 |
}
|
306 |
+
|
307 |
+
if( store.length !== 0 ){
|
308 |
+
listing = document.getElementById("<?php echo $btn['cow']; ?>").value.split("||");
|
309 |
+
listing = listing[1].split(",");
|
310 |
+
listing = listing.filter(Number);
|
311 |
+
|
312 |
+
$.each(listing, function(index, value){
|
313 |
+
$(store[index]).attr("wooccm-attach-id", value);
|
314 |
+
});
|
315 |
+
}
|
316 |
+
|
317 |
+
var currentname = this.title, wooccmeachfile = document.getElementsByClassName("wooccm_each_file"), remove, shell;
|
318 |
+
formdata = new FormData();
|
319 |
+
|
320 |
+
for( i = 0; i < wooccmeachfile.length; i++ ){
|
321 |
+
if(wooccmeachfile[i].title === currentname){
|
322 |
+
remove = wooccmeachfile[i].getAttribute("wooccm-attach-id");
|
323 |
+
shell = wooccmeachfile[i];
|
324 |
+
}
|
325 |
+
}
|
326 |
+
|
327 |
+
$.ajax({
|
328 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_enduploadsave&remove='); ?>" + remove,
|
329 |
+
type: "POST",
|
330 |
+
data: formdata,
|
331 |
+
cache: false,
|
332 |
+
processData: false,
|
333 |
+
contentType: false,
|
334 |
+
success: function (res) {
|
335 |
remove = remove + ",";
|
336 |
$("#<?php echo $btn['cow']; ?>").val(function(index, value) {
|
337 |
return value.replace(remove, "");
|
338 |
});
|
339 |
+
|
340 |
shell.outerHTML = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
|
342 |
+
$("#<?php echo $btn['cow']; ?>_field").unblock();
|
343 |
+
}
|
344 |
+
});
|
345 |
+
|
346 |
+
}
|
347 |
|
348 |
+
});
|
349 |
|
350 |
+
$("#caman_content #wooccmtoolbar #close").click( function(){
|
351 |
+
var li = document.getElementById( "wooccmactualimage" );
|
352 |
+
li.outerHTML = "";
|
353 |
+
$("#caman_content .FilterValue").each(function(){
|
354 |
+
$(this).text("0");
|
355 |
+
});
|
356 |
+
$("#caman_content .FilterSetting input").each(function(){
|
357 |
+
$(this).val("0");
|
358 |
+
});
|
359 |
+
$("#PresetFilters a").each(function(){
|
360 |
+
$(this).removeClass("Active");
|
361 |
+
});
|
362 |
+
$("#caman_content").hide();
|
363 |
+
$("html").css("overflow", "visible");
|
364 |
});
|
365 |
+
|
366 |
+
$(document).on('click','.wooccm_edit',function(){
|
367 |
+
return false;
|
368 |
});
|
369 |
+
|
370 |
+
$(document).on('click','.wooccm_edit.enable',function(){
|
371 |
+
var imageinbase = this.href,
|
372 |
+
li = document.getElementById( "wooccmimageeditorpro" ),
|
373 |
+
data = document.createAttribute("data-caman-hidpi"),
|
374 |
+
img = document.createElement("img");
|
375 |
+
data.value = imageinbase;
|
376 |
+
$("#caman_content #wooccmtoolbar #save").attr("title", this.title);
|
377 |
+
if( $(".wooccmimageeditor img").length == 0 ){
|
378 |
+
img.id = "wooccmactualimage";
|
379 |
+
img.src = imageinbase;
|
380 |
+
img.setAttributeNode(data);
|
381 |
+
li.appendChild(img);
|
382 |
+
$.getScript( "<?php echo plugins_url( 'includes/pickers/caman/dist/caman_controls.js', WOOCCM_RELPATH ); ?>");
|
383 |
+
}
|
384 |
+
$("#caman_content").show();
|
385 |
+
$("html").css("overflow", "hidden");
|
386 |
});
|
387 |
+
|
388 |
+
}());
|
389 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
390 |
});
|
391 |
</script>
|
|
|
392 |
<?php
|
393 |
+
}
|
394 |
+
|
395 |
+
}
|
396 |
+
?>
|
includes/templates/functions/billing_functions.php
CHANGED
@@ -6,750 +6,841 @@
|
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
-
function
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
}
|
20 |
-
echo '
|
|
|
|
|
|
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
$saved = WC()->session->get('wooccm_retain', array() );
|
29 |
-
|
30 |
-
|
31 |
-
if( !empty($options['billing_buttons']) ) {
|
32 |
-
foreach ( $options['billing_buttons'] as $btn ) :
|
33 |
-
|
34 |
-
|
35 |
-
if ( $btn['type'] == 'datepicker' ) {
|
36 |
-
echo '<script type="text/javascript">jQuery(document).ready(function() { var today = new Date(); jQuery("input#billing_'.$btn['cow'].'").datepicker({';
|
37 |
-
if ( empty($btn['format_date']) ) {
|
38 |
-
echo 'dateFormat : "dd-mm-yy",';
|
39 |
-
}
|
40 |
-
if ( !empty($btn['format_date']) ) {
|
41 |
-
echo 'dateFormat : "'.str_replace( ' ', '', $btn['format_date'] ).'",';
|
42 |
-
}
|
43 |
-
if ( !empty($btn['single_yy']) ) {
|
44 |
-
echo 'minDate: new Date( '.$btn['single_yy'].', '.$btn['single_mm'].' - 1, '.$btn['single_dd'].'),';
|
45 |
-
}
|
46 |
-
if ( !empty($btn['min_before']) ) {
|
47 |
-
echo 'minDate: '.$btn['min_before'].',';
|
48 |
-
}
|
49 |
-
if ( !empty($btn['single_max_yy']) ) {
|
50 |
-
echo 'maxDate: new Date( '.$btn['single_max_yy'].', '.$btn['single_max_mm'].' - 1, '.$btn['single_max_dd'].'),';
|
51 |
-
}
|
52 |
-
if ( !empty($btn['max_after']) ) {
|
53 |
-
echo 'maxDate: '.$btn['max_after'].',';
|
54 |
-
}
|
55 |
-
if ( !empty($btn['days_disabler']) ) {
|
56 |
-
echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
|
57 |
-
|
58 |
-
if ( !empty($btn['days_disabler0']) ) {
|
59 |
-
echo 'day == 0';
|
60 |
-
} else { echo 'day == "x"'; }
|
61 |
-
if ( !empty($btn['days_disabler1']) ) {
|
62 |
-
echo ' || day == 1';
|
63 |
-
}
|
64 |
-
if ( !empty($btn['days_disabler2']) ) {
|
65 |
-
echo ' || day == 2';
|
66 |
-
}
|
67 |
-
if ( !empty($btn['days_disabler3']) ) {
|
68 |
-
echo ' || day == 3';
|
69 |
-
}
|
70 |
-
if ( !empty($btn['days_disabler4']) ) {
|
71 |
-
echo ' || day == 4';
|
72 |
-
}
|
73 |
-
if ( !empty($btn['days_disabler5']) ) {
|
74 |
-
echo ' || day == 5';
|
75 |
-
}
|
76 |
-
if ( !empty($btn['days_disabler6']) ) {
|
77 |
-
echo '|| day == 6';
|
78 |
-
}
|
79 |
-
|
80 |
-
echo ')]; }';
|
81 |
-
}
|
82 |
-
echo '}); }); </script>';
|
83 |
-
}
|
84 |
-
|
85 |
-
|
86 |
-
if ( $btn['type'] == 'time' ) {
|
87 |
-
echo '<script type="text/javascript">jQuery(document).ready(function() { jQuery("#billing_'.$btn['cow'].'_field input#billing_'.$btn['cow'].'").timepicker({ showPeriod: true,';
|
88 |
-
|
89 |
-
if ( !empty($btn['start_hour']) ) {
|
90 |
-
echo 'hours: { starts: '.$btn['start_hour'].', ends: '.$btn['end_hour'].' },';
|
91 |
-
}
|
92 |
-
if ( !empty($btn['interval_min']) ) {
|
93 |
-
echo 'minutes: {interval: '.$btn['interval_min'].', manual: ['.$btn['manual_min'].'] },';
|
94 |
-
}
|
95 |
-
|
96 |
-
echo 'showLeadingZero: true }); }); </script>';
|
97 |
-
}
|
98 |
-
|
99 |
-
|
100 |
-
if ( $btn['type'] == 'password' ) {
|
101 |
-
echo '<script type="text/javascript">jQuery(document).ready(function() { jQuery("p#billing_'.$btn['cow'].'_field").css("display"); }); </script>';
|
102 |
-
}
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
if ( $btn['type'] == 'colorpicker' && $btn['colorpickertype'] == 'farbtastic' ) { ?>
|
107 |
-
<script type="text/javascript">
|
108 |
-
jQuery(document).ready(function($) {
|
109 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
110 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#billing_<?php echo $btn['cow']; ?>_colorpicker");
|
111 |
-
jQuery("#billing_<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('#billing_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
112 |
-
|
113 |
-
});
|
114 |
-
</script>
|
115 |
-
<?php }
|
116 |
-
|
117 |
-
if ( $btn['type'] == 'colorpicker' && $btn['colorpickertype'] == 'iris' ) { ?>
|
118 |
-
<script type="text/javascript">
|
119 |
-
jQuery(document).ready(function($) {
|
120 |
-
|
121 |
-
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#fff' );
|
122 |
-
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', '<?php echo $btn['colorpickerd']; ?>' );
|
123 |
-
|
124 |
-
var options = {
|
125 |
-
wccmclass: "billing_<?php echo $btn['cow']; ?>_colorpickerdiv",
|
126 |
-
palettes: true,
|
127 |
-
color: "",
|
128 |
-
hide: false,
|
129 |
-
change: function(event,ui){
|
130 |
-
$( '#billing_<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#000' );
|
131 |
-
$( '#billing_<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', ui.color.toString());
|
132 |
-
}
|
133 |
-
};
|
134 |
-
|
135 |
-
|
136 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpicker').iris( options );
|
137 |
-
|
138 |
-
jQuery('.billing_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
139 |
-
jQuery("#billing_<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('.billing_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
140 |
-
});
|
141 |
-
</script>
|
142 |
-
<?php }
|
143 |
-
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
// ============================== radio button & checkbox ===========================================
|
147 |
-
if ( ($btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm') && !empty( $btn['tax_remove'] ) ) { ?>
|
148 |
-
<script type="text/javascript">
|
149 |
-
jQuery(document).ready(function($) {
|
150 |
-
|
151 |
-
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
152 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
153 |
-
<?php } ?>
|
154 |
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
action: 'remove_tax_wccm',
|
163 |
-
tax_remove_aj: jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]:checked').val()
|
164 |
-
};
|
165 |
-
|
166 |
-
jQuery.post(ajaxurl, data, function(response) {
|
167 |
-
$( 'body' ).trigger( 'update_checkout' );
|
168 |
-
jQuery('form.checkout').unblock();
|
169 |
-
});
|
170 |
-
|
171 |
-
}); });
|
172 |
-
</script>
|
173 |
-
<?php }
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
if ( ($btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) { ?>
|
178 |
-
<script type="text/javascript">
|
179 |
-
jQuery(document).ready(function($) {
|
180 |
-
|
181 |
-
<?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
|
182 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
183 |
<?php } ?>
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
|
|
|
204 |
|
|
|
|
|
|
|
|
|
|
|
205 |
|
|
|
|
|
|
|
|
|
206 |
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
// =========================================== select options =========================================
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
|
|
213 |
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
214 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_tax_save_method']; ?>' );
|
215 |
<?php } ?>
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
<?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
|
243 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_addamount453user']; ?>' );
|
244 |
<?php } ?>
|
245 |
-
|
246 |
-
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').change(function() {
|
247 |
-
|
248 |
-
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
249 |
-
|
250 |
-
|
251 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
252 |
-
data = {
|
253 |
-
action: 'remove_tax_wccm',
|
254 |
-
add_amount_aj: jQuery('#billing_<?php echo $btn['cow']; ?> option:selected').val()
|
255 |
-
};
|
256 |
-
|
257 |
-
jQuery.post(ajaxurl, data, function(response) {
|
258 |
-
$( 'body' ).trigger( 'update_checkout' );
|
259 |
-
jQuery('form.checkout').unblock();
|
260 |
-
});
|
261 |
-
|
262 |
-
}); });
|
263 |
-
</script>
|
264 |
-
<?php }
|
265 |
|
|
|
266 |
|
|
|
267 |
|
|
|
|
|
|
|
|
|
|
|
268 |
|
|
|
|
|
|
|
|
|
269 |
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
// =========================================== add apply button ==========================================
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
|
|
281 |
<?php if( !empty($saved['wooccm_addamount453userf']) ) { ?>
|
282 |
-
jQuery('input#billing_<?php echo $btn['cow']; ?>').val( '<?php echo $saved['wooccm_addamount453userf']; ?>' );
|
283 |
<?php } ?>
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
288 |
-
|
289 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
290 |
-
data = {
|
291 |
-
action: 'remove_tax_wccm',
|
292 |
-
add_amount_faj: jQuery('input#billing_<?php echo $btn['cow']; ?>').val()
|
293 |
-
};
|
294 |
-
|
295 |
-
jQuery.post(ajaxurl, data, function(response) {
|
296 |
-
$( 'body' ).trigger( 'update_checkout' );
|
297 |
-
jQuery('form.checkout').unblock();
|
298 |
-
});
|
299 |
-
|
300 |
-
}); });
|
301 |
-
</script>
|
302 |
-
<?php }
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
|
307 |
-
|
308 |
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
|
|
|
|
323 |
}
|
324 |
-
}
|
325 |
|
|
|
326 |
|
|
|
|
|
|
|
327 |
|
328 |
// --------------------------------------------------------
|
329 |
// --------------------------------------------------------
|
330 |
// --------------------------------------------------------
|
331 |
-
function billing_override_this_wccs() {
|
332 |
-
global $woocommerce;
|
333 |
-
$options = get_option( 'wccs_settings3' );
|
334 |
-
if ( count( $options['billing_buttons'] ) > 0 ) {
|
335 |
-
$i = 0;
|
336 |
-
|
337 |
-
// css sub-parent hide
|
338 |
-
foreach( $options['billing_buttons'] as $btn ) {
|
339 |
-
if ( ($btn['type'] == 'text') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
|
340 |
-
echo '<style type="text/css">#billing_'.$btn['cow'].'_applynow {
|
341 |
-
background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
|
342 |
-
background: -webkit-linear-gradient(#ad74a2,#96588a);
|
343 |
-
background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
|
344 |
-
background: -moz-gradient(center top,#ad74a2 0,#96588a 100%);
|
345 |
-
border-color: #76456c;
|
346 |
-
color: #fff;
|
347 |
-
text-shadow: 0 -1px 0 rgba(0,0,0,.6);
|
348 |
-
width: 100%;
|
349 |
-
text-align: center;
|
350 |
-
float: right;
|
351 |
-
cursor: pointer;
|
352 |
-
position: relative;
|
353 |
-
}
|
354 |
-
#billing_'.$btn['cow'].'_applynow:active {
|
355 |
-
top: 1px;
|
356 |
-
}
|
357 |
-
</style>';
|
358 |
-
|
359 |
-
}
|
360 |
-
if ( !empty($btn['conditional_tie']) && empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use'])) {
|
361 |
-
echo '<style type="text/css">
|
362 |
-
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
363 |
-
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
364 |
-
.woocommerce form.checkout #billing_'.$btn['cow'].'_field.'.$btn['conditional_tie'].' {
|
365 |
-
display: none;
|
366 |
-
}
|
367 |
-
</style>';
|
368 |
-
}
|
369 |
-
}
|
370 |
-
|
371 |
-
|
372 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
|
374 |
// ====================== CHECKBOX =============================
|
375 |
// script when clicked show
|
376 |
// =============================================================
|
377 |
?>
|
|
|
378 |
<script type="text/javascript">
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
empty_check_add: 'none'
|
409 |
-
};
|
410 |
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
<?php }} ?>
|
421 |
-
|
422 |
-
});
|
423 |
-
<?php }}} ?>
|
424 |
-
});
|
425 |
-
</script>
|
426 |
|
427 |
<?php
|
428 |
-
|
429 |
-
|
|
|
430 |
|
|
|
431 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
|
433 |
// ====================== SELECT OPTIONS =============================
|
434 |
// script when clicked show
|
435 |
// =============================================================
|
436 |
?>
|
|
|
437 |
<script type="text/javascript">
|
438 |
jQuery(document).ready(function($){
|
439 |
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
479 |
});
|
480 |
</script>
|
481 |
|
482 |
-
|
483 |
<?php
|
|
|
484 |
// ================================ END!!! =====================================
|
485 |
// =============================================================================
|
486 |
|
487 |
-
|
488 |
-
|
489 |
// ====================== RADIO BUTTON =============================
|
490 |
// script when clicked show
|
491 |
// =============================================================
|
|
|
492 |
?>
|
|
|
493 |
<script type="text/javascript">
|
494 |
jQuery(document).ready(function($){
|
495 |
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
if ( !empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) { ?>
|
501 |
-
|
502 |
-
jQuery("#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input").click(function(){
|
503 |
-
|
504 |
-
<?php foreach( $options['billing_buttons'] as $btn3 ) {
|
505 |
-
if ( empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) { ?>
|
506 |
-
|
507 |
-
if(jQuery('#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
508 |
-
jQuery("#billing_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").show( "slow" );
|
509 |
-
}
|
510 |
-
|
511 |
-
if(jQuery('#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
512 |
-
jQuery("#billing_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").hide( "slow" );
|
513 |
-
|
514 |
-
<?php
|
515 |
-
if ( !empty($btn2['fee_name']) && !empty($btn2['add_amount']) ) {
|
516 |
-
?>
|
517 |
-
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
518 |
-
|
519 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
520 |
-
data = {
|
521 |
-
action: 'remove_tax_wccm',
|
522 |
-
empty_check_add: 'none'
|
523 |
-
};
|
524 |
-
|
525 |
-
jQuery.post(ajaxurl, data, function(response) {
|
526 |
-
$( 'body' ).trigger( 'update_checkout' );
|
527 |
-
jQuery('form.checkout').unblock();
|
528 |
-
});
|
529 |
-
|
530 |
-
<?php } ?>
|
531 |
-
|
532 |
-
}
|
533 |
-
|
534 |
-
<?php }} ?>
|
535 |
-
|
536 |
-
});
|
537 |
-
<?php }}} ?>
|
538 |
-
});
|
539 |
-
</script>
|
540 |
|
|
|
|
|
541 |
|
|
|
542 |
|
543 |
<?php
|
544 |
-
|
545 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
546 |
|
|
|
|
|
|
|
|
|
547 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
|
549 |
// ----------------------------- CLEAR ---------------------------------
|
550 |
// ---------------------------------------------------------------------
|
551 |
// ---------------------------------------------------------------------
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
+
function wooccm_billing_hide_required() {
|
10 |
+
|
11 |
+
global $woocommerce;
|
12 |
+
|
13 |
+
$options = get_option( 'wccs_settings3' );
|
14 |
+
|
15 |
+
$billing = array(
|
16 |
+
'address_1',
|
17 |
+
'address_2',
|
18 |
+
'city',
|
19 |
+
'state',
|
20 |
+
'postcode'
|
21 |
+
);
|
22 |
+
|
23 |
+
if( !empty( $options['billing_buttons'] ) ) {
|
24 |
+
echo '
|
25 |
+
<style>
|
26 |
+
';
|
27 |
+
foreach( $options['billing_buttons'] as $btn ) {
|
28 |
+
if( in_array($btn['cow'], $billing) && empty($btn['checkbox']) ) {
|
29 |
+
echo '
|
30 |
+
p#billing_'.$btn['cow'].'_field .required{
|
31 |
+
display:none;
|
32 |
+
}';
|
33 |
}
|
34 |
}
|
35 |
+
echo '
|
36 |
+
</style>';
|
37 |
+
}
|
38 |
+
|
39 |
}
|
40 |
|
41 |
+
function wooccm_billing_scripts() {
|
42 |
+
|
43 |
+
global $woocommerce;
|
44 |
+
|
45 |
+
$options = get_option( 'wccs_settings3' );
|
46 |
+
|
47 |
+
$saved = WC()->session->get( 'wooccm_retain', array() );
|
48 |
+
|
49 |
+
// Check if we have any buttons
|
50 |
+
if( empty($options['billing_buttons']) )
|
51 |
+
return;
|
52 |
+
|
53 |
+
foreach( $options['billing_buttons'] as $btn ) {
|
54 |
+
|
55 |
+
if( $btn['type'] == 'datepicker' ) {
|
56 |
+
echo '
|
57 |
+
<script type="text/javascript">
|
58 |
+
jQuery(document).ready(function() {
|
59 |
+
var today = new Date();
|
60 |
+
if( jQuery.isFunction(jQuery.fn.datepicker) ) {
|
61 |
+
jQuery("input#billing_'.$btn['cow'].'").datepicker({
|
62 |
+
';
|
63 |
+
if( empty($btn['format_date']) ) {
|
64 |
+
echo 'dateFormat : "dd-mm-yy",';
|
65 |
+
}
|
66 |
+
if( !empty($btn['format_date']) ) {
|
67 |
+
echo 'dateFormat : "'.str_replace( ' ', '', $btn['format_date'] ).'",';
|
68 |
+
}
|
69 |
+
if( !empty($btn['single_yy']) ) {
|
70 |
+
echo 'minDate: new Date( '.$btn['single_yy'].', '.$btn['single_mm'].' - 1, '.$btn['single_dd'].'),';
|
71 |
+
}
|
72 |
+
if( !empty($btn['min_before']) ) {
|
73 |
+
echo 'minDate: '.$btn['min_before'].',';
|
74 |
+
}
|
75 |
+
if( !empty($btn['single_max_yy']) ) {
|
76 |
+
echo 'maxDate: new Date( '.$btn['single_max_yy'].', '.$btn['single_max_mm'].' - 1, '.$btn['single_max_dd'].'),';
|
77 |
+
}
|
78 |
+
if( !empty($btn['max_after']) ) {
|
79 |
+
echo 'maxDate: '.$btn['max_after'].',';
|
80 |
+
}
|
81 |
+
if( !empty($btn['days_disabler']) ) {
|
82 |
+
echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
|
83 |
+
if( !empty($btn['days_disabler0']) ) {
|
84 |
+
echo 'day == 0';
|
85 |
+
} else { echo 'day == "x"'; }
|
86 |
+
if( !empty($btn['days_disabler1']) ) {
|
87 |
+
echo ' || day == 1';
|
88 |
+
}
|
89 |
+
if( !empty($btn['days_disabler2']) ) {
|
90 |
+
echo ' || day == 2';
|
91 |
+
}
|
92 |
+
if( !empty($btn['days_disabler3']) ) {
|
93 |
+
echo ' || day == 3';
|
94 |
+
}
|
95 |
+
if( !empty($btn['days_disabler4']) ) {
|
96 |
+
echo ' || day == 4';
|
97 |
+
}
|
98 |
+
if( !empty($btn['days_disabler5']) ) {
|
99 |
+
echo ' || day == 5';
|
100 |
+
}
|
101 |
+
if( !empty($btn['days_disabler6']) ) {
|
102 |
+
echo '|| day == 6';
|
103 |
+
}
|
104 |
+
echo ')]; }';
|
105 |
+
}
|
106 |
+
do_action( 'wooccm_js_datepicker_billing_args', $btn );
|
107 |
+
echo '
|
108 |
+
});
|
109 |
+
}
|
110 |
+
});
|
111 |
+
</script>
|
112 |
+
';
|
113 |
+
}
|
114 |
+
|
115 |
+
if( $btn['type'] == 'time' ) {
|
116 |
+
$args = '
|
117 |
+
showPeriod: true,';
|
118 |
+
if( !empty($btn['start_hour']) ) {
|
119 |
+
$args .= '
|
120 |
+
hours: { starts: '.$btn['start_hour'].', ends: '.$btn['end_hour'].' },';
|
121 |
+
}
|
122 |
+
if( !empty($btn['interval_min']) ) {
|
123 |
+
$args .= '
|
124 |
+
minutes: {interval: '.$btn['interval_min'].', manual: ['.$btn['manual_min'].'] },';
|
125 |
+
}
|
126 |
+
$args .= '
|
127 |
+
showLeadingZero: true';
|
128 |
+
$args = apply_filters( 'wooccm_timepicker_jquery_args', $args, $btn );
|
129 |
+
echo '
|
130 |
+
<!-- Billing section: TimePicker -->
|
131 |
+
<script type="text/javascript">
|
132 |
+
jQuery(document).ready(function() {
|
133 |
+
if( jQuery.isFunction(jQuery.fn.timepicker) ) {
|
134 |
+
jQuery("#billing_'.$btn['cow'].'_field input#billing_'.$btn['cow'].'").timepicker({
|
135 |
+
';
|
136 |
+
echo $args;
|
137 |
+
echo '
|
138 |
+
});
|
139 |
+
}
|
140 |
+
});
|
141 |
+
</script>
|
142 |
+
';
|
143 |
+
}
|
144 |
+
|
145 |
+
if ( $btn['type'] == 'password' ) {
|
146 |
+
echo '
|
147 |
+
<script type="text/javascript">
|
148 |
+
jQuery(document).ready(function() {
|
149 |
+
jQuery("p#billing_'.$btn['cow'].'_field").css("display");
|
150 |
+
});
|
151 |
+
</script>
|
152 |
+
';
|
153 |
+
}
|
154 |
+
|
155 |
+
if( $btn['type'] == 'colorpicker' ) {
|
156 |
+
switch( $btn['colorpickertype'] ) {
|
157 |
+
|
158 |
+
case 'farbtastic':
|
159 |
+
?>
|
160 |
+
<script type="text/javascript">
|
161 |
+
jQuery(document).ready(function($) {
|
162 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
163 |
+
if( jQuery.isFunction(jQuery.fn.farbtastic) ) {
|
164 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#billing_<?php echo $btn['cow']; ?>_colorpicker");
|
165 |
+
jQuery("#billing_<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('#billing_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
166 |
+
}
|
167 |
+
});
|
168 |
+
</script>
|
169 |
+
<?php
|
170 |
+
break;
|
171 |
+
|
172 |
+
case 'iris':
|
173 |
+
?>
|
174 |
+
<script type="text/javascript">
|
175 |
+
jQuery(document).ready(function($) {
|
176 |
+
|
177 |
+
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#fff' );
|
178 |
+
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', '<?php echo $btn['colorpickerd']; ?>' );
|
179 |
+
|
180 |
+
var options = {
|
181 |
+
wccmclass: "billing_<?php echo $btn['cow']; ?>_colorpickerdiv",
|
182 |
+
palettes: true,
|
183 |
+
color: "",
|
184 |
+
hide: false,
|
185 |
+
change: function(event,ui){
|
186 |
+
$( '#billing_<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#000' );
|
187 |
+
$( '#billing_<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', ui.color.toString());
|
188 |
+
}
|
189 |
+
};
|
190 |
|
191 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_colorpicker').iris( options );
|
192 |
+
jQuery('.billing_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
193 |
+
jQuery("#billing_<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('.billing_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
+
});
|
196 |
+
</script>
|
197 |
+
<?php
|
198 |
+
break;
|
199 |
+
|
200 |
+
}
|
201 |
+
}
|
202 |
|
203 |
// ============================== radio button & checkbox ===========================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
+
if( ( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty( $btn['tax_remove'] ) ) {
|
206 |
+
?>
|
207 |
+
<script type="text/javascript">
|
208 |
+
jQuery(document).ready(function($) {
|
209 |
+
|
210 |
+
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
211 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
<?php } ?>
|
213 |
|
214 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field input').click(function() {
|
215 |
+
|
216 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
217 |
+
|
218 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
219 |
+
data = {
|
220 |
+
action: 'remove_tax_wccm',
|
221 |
+
tax_remove_aj: jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]:checked').val()
|
222 |
+
};
|
223 |
+
|
224 |
+
jQuery.post(ajaxurl, data, function(response) {
|
225 |
+
$( 'body' ).trigger( 'update_checkout' );
|
226 |
+
jQuery('form.checkout').unblock();
|
227 |
+
});
|
228 |
+
|
229 |
+
});
|
230 |
+
});
|
231 |
+
</script>
|
232 |
+
<?php
|
233 |
+
}
|
234 |
+
|
235 |
+
if( ( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) {
|
236 |
+
?>
|
237 |
+
<script type="text/javascript">
|
238 |
+
jQuery(document).ready(function($) {
|
239 |
+
|
240 |
+
<?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
|
241 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
242 |
+
<?php } ?>
|
243 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field input').click(function() {
|
244 |
|
245 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
246 |
|
247 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
248 |
+
data = {
|
249 |
+
action: 'remove_tax_wccm',
|
250 |
+
add_amount_aj: jQuery('#billing_<?php echo $btn['cow']; ?>_field input[name=billing_<?php echo $btn['cow']; ?>]:checked').val()
|
251 |
+
};
|
252 |
|
253 |
+
jQuery.post(ajaxurl, data, function(response) {
|
254 |
+
$( 'body' ).trigger( 'update_checkout' );
|
255 |
+
jQuery('form.checkout').unblock();
|
256 |
+
});
|
257 |
|
258 |
+
});
|
259 |
+
});
|
260 |
+
</script>
|
261 |
+
<?php
|
262 |
+
}
|
263 |
|
264 |
// =========================================== select options =========================================
|
265 |
+
|
266 |
+
if( $btn['type'] == 'wooccmselect' && !empty( $btn['tax_remove'] ) ) {
|
267 |
+
?>
|
268 |
+
<script type="text/javascript">
|
269 |
+
jQuery(document).ready(function($) {
|
270 |
+
|
271 |
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
272 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_tax_save_method']; ?>' );
|
273 |
<?php } ?>
|
274 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').change(function() {
|
275 |
+
|
276 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
277 |
+
|
278 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
279 |
+
data = {
|
280 |
+
action: 'remove_tax_wccm',
|
281 |
+
tax_remove_aj: jQuery('#billing_<?php echo $btn['cow']; ?> option:selected').val()
|
282 |
+
};
|
283 |
+
|
284 |
+
jQuery.post(ajaxurl, data, function(response) {
|
285 |
+
$( 'body' ).trigger( 'update_checkout' );
|
286 |
+
jQuery('form.checkout').unblock();
|
287 |
+
});
|
288 |
+
|
289 |
+
});
|
290 |
+
});
|
291 |
+
</script>
|
292 |
+
<?php
|
293 |
+
}
|
294 |
+
|
295 |
+
if( $btn['type'] == 'wooccmselect' && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) {
|
296 |
+
?>
|
297 |
+
<script type="text/javascript">
|
298 |
+
jQuery(document).ready(function($) {
|
299 |
+
|
300 |
+
<?php if( !empty( $saved['wooccm_addamount453user'] ) ) { ?>
|
301 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_addamount453user']; ?>' );
|
302 |
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
|
304 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field select').change(function() {
|
305 |
|
306 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
307 |
|
308 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
309 |
+
data = {
|
310 |
+
action: 'remove_tax_wccm',
|
311 |
+
add_amount_aj: jQuery('#billing_<?php echo $btn['cow']; ?> option:selected').val()
|
312 |
+
};
|
313 |
|
314 |
+
jQuery.post(ajaxurl, data, function(response) {
|
315 |
+
$( 'body' ).trigger( 'update_checkout' );
|
316 |
+
jQuery('form.checkout').unblock();
|
317 |
+
});
|
318 |
|
319 |
+
});
|
320 |
+
});
|
321 |
+
</script>
|
322 |
+
<?php
|
323 |
+
}
|
324 |
|
325 |
// =========================================== add apply button ==========================================
|
326 |
|
327 |
+
if( $btn['type'] == 'text' && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
|
328 |
+
?>
|
329 |
+
<script type="text/javascript">
|
330 |
+
jQuery(document).ready(function() {
|
331 |
+
jQuery( "#billing_<?php echo $btn['cow']; ?>_field" ).append( '<span id="billing_<?php echo $btn['cow']; ?>_applynow"><?php _e('Apply','woocommerce-checkout-manager'); ?></span>' );
|
332 |
+
});
|
333 |
+
|
334 |
+
jQuery(document).ready(function($) {
|
335 |
+
|
336 |
<?php if( !empty($saved['wooccm_addamount453userf']) ) { ?>
|
337 |
+
jQuery('input#billing_<?php echo $btn['cow']; ?>').val( '<?php echo $saved['wooccm_addamount453userf']; ?>' );
|
338 |
<?php } ?>
|
339 |
|
340 |
+
jQuery('#billing_<?php echo $btn['cow']; ?>_field #billing_<?php echo $btn['cow']; ?>_applynow').click(function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
|
342 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
343 |
|
344 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
345 |
+
data = {
|
346 |
+
action: 'remove_tax_wccm',
|
347 |
+
add_amount_faj: jQuery('input#billing_<?php echo $btn['cow']; ?>').val()
|
348 |
+
};
|
349 |
+
|
350 |
+
jQuery.post(ajaxurl, data, function(response) {
|
351 |
+
$( 'body' ).trigger( 'update_checkout' );
|
352 |
+
jQuery('form.checkout').unblock();
|
353 |
+
});
|
354 |
+
|
355 |
+
});
|
356 |
+
|
357 |
+
});
|
358 |
+
</script>
|
359 |
+
<?php
|
360 |
}
|
|
|
361 |
|
362 |
+
// =====================================================
|
363 |
|
364 |
+
}
|
365 |
+
|
366 |
+
}
|
367 |
|
368 |
// --------------------------------------------------------
|
369 |
// --------------------------------------------------------
|
370 |
// --------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
|
372 |
+
function wooccm_billing_override_this() {
|
373 |
+
|
374 |
+
global $woocommerce;
|
375 |
+
|
376 |
+
$options = get_option( 'wccs_settings3' );
|
377 |
+
|
378 |
+
$options['billing_buttons'] = ( isset( $options['billing_buttons'] ) ? $options['billing_buttons'] : array() );
|
379 |
+
|
380 |
+
// Check if there are any buttons
|
381 |
+
if( count( $options['billing_buttons'] ) == 0 )
|
382 |
+
return;
|
383 |
+
|
384 |
+
$i = 0;
|
385 |
+
|
386 |
+
// css sub-parent hide
|
387 |
+
foreach( $options['billing_buttons'] as $btn ) {
|
388 |
+
if( $btn['type'] == 'text' && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
|
389 |
+
echo '
|
390 |
+
<style type="text/css">
|
391 |
+
#billing_'.$btn['cow'].'_applynow {
|
392 |
+
background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
|
393 |
+
background: -webkit-linear-gradient(#ad74a2,#96588a);
|
394 |
+
background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
|
395 |
+
background: -moz-gradient(center top,#ad74a2 0,#96588a 100%);
|
396 |
+
border-color: #76456c;
|
397 |
+
color: #fff;
|
398 |
+
text-shadow: 0 -1px 0 rgba(0,0,0,.6);
|
399 |
+
width: 100%;
|
400 |
+
text-align: center;
|
401 |
+
float: right;
|
402 |
+
cursor: pointer;
|
403 |
+
position: relative;
|
404 |
+
}
|
405 |
+
#billing_'.$btn['cow'].'_applynow:active {
|
406 |
+
top: 1px;
|
407 |
+
}
|
408 |
+
</style>';
|
409 |
+
}
|
410 |
+
if( !empty( $btn['conditional_tie'] ) && empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) ) {
|
411 |
+
echo '
|
412 |
+
<style type="text/css">
|
413 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
414 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
415 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field.'.$btn['conditional_tie'].' {
|
416 |
+
display: none;
|
417 |
+
}
|
418 |
+
</style>';
|
419 |
+
}
|
420 |
+
}
|
421 |
|
422 |
// ====================== CHECKBOX =============================
|
423 |
// script when clicked show
|
424 |
// =============================================================
|
425 |
?>
|
426 |
+
<!-- Billing section: Checkbox -->
|
427 |
<script type="text/javascript">
|
428 |
+
jQuery(document).ready(function($){
|
429 |
+
<?php
|
430 |
+
foreach( $options['billing_buttons'] as $btn ) {
|
431 |
+
if( $btn['type'] == 'checkbox_wccm' ) {
|
432 |
+
|
433 |
+
if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
|
434 |
+
?>
|
435 |
+
|
436 |
+
jQuery("#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]").click(function(){
|
437 |
+
|
438 |
+
<?php
|
439 |
+
foreach( $options['billing_buttons'] as $btn3 ) {
|
440 |
+
if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
|
441 |
+
?>
|
442 |
+
if(jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
443 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
|
444 |
+
}
|
445 |
+
if(jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
446 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
|
447 |
+
|
448 |
+
<?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
|
449 |
+
|
450 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
451 |
+
|
452 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
453 |
+
data = {
|
454 |
+
action: 'remove_tax_wccm',
|
455 |
+
empty_check_add: 'none'
|
456 |
+
};
|
|
|
|
|
457 |
|
458 |
+
jQuery.post(ajaxurl, data, function(response) {
|
459 |
+
$( 'body' ).trigger( 'update_checkout' );
|
460 |
+
jQuery('form.checkout').unblock();
|
461 |
+
});
|
462 |
+
|
463 |
+
<?php } ?>
|
464 |
+
|
465 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
|
467 |
<?php
|
468 |
+
}
|
469 |
+
}
|
470 |
+
?>
|
471 |
|
472 |
+
});
|
473 |
|
474 |
+
<?php
|
475 |
+
}
|
476 |
+
}
|
477 |
+
}
|
478 |
+
?>
|
479 |
+
});
|
480 |
+
</script>
|
481 |
+
<?php
|
482 |
+
|
483 |
+
// ================================ END!!! =====================================
|
484 |
+
// =============================================================================
|
485 |
|
486 |
// ====================== SELECT OPTIONS =============================
|
487 |
// script when clicked show
|
488 |
// =============================================================
|
489 |
?>
|
490 |
+
<!-- Billing section: Select options -->
|
491 |
<script type="text/javascript">
|
492 |
jQuery(document).ready(function($){
|
493 |
|
494 |
+
<?php
|
495 |
+
foreach( $options['billing_buttons'] as $btn ) {
|
496 |
+
if( $btn['type'] == 'wooccmselect' ) {
|
497 |
+
|
498 |
+
if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
|
499 |
+
?>
|
500 |
+
|
501 |
+
jQuery("#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> select").change(function(){
|
502 |
+
|
503 |
+
<?php
|
504 |
+
foreach( $options['billing_buttons'] as $btn3 ) {
|
505 |
+
if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
|
506 |
+
?>
|
507 |
+
|
508 |
+
if(jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #billing_' . $btn['cow']; ?> option:selected').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
509 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
|
510 |
+
}
|
511 |
+
|
512 |
+
if(jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #billing_' . $btn['cow']; ?> option:selected').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
513 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
|
514 |
+
|
515 |
+
<?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
|
516 |
+
|
517 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
518 |
+
|
519 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
520 |
+
data = {
|
521 |
+
action: 'remove_tax_wccm',
|
522 |
+
empty_check_add: 'none'
|
523 |
+
};
|
524 |
+
|
525 |
+
jQuery.post(ajaxurl, data, function(response) {
|
526 |
+
$( 'body' ).trigger( 'update_checkout' );
|
527 |
+
jQuery('form.checkout').unblock();
|
528 |
+
});
|
529 |
+
|
530 |
+
<?php } ?>
|
531 |
+
}
|
532 |
+
<?php
|
533 |
+
}
|
534 |
+
}
|
535 |
+
?>
|
536 |
+
});
|
537 |
+
<?php
|
538 |
+
}
|
539 |
+
}
|
540 |
+
}
|
541 |
+
?>
|
542 |
});
|
543 |
</script>
|
544 |
|
|
|
545 |
<?php
|
546 |
+
|
547 |
// ================================ END!!! =====================================
|
548 |
// =============================================================================
|
549 |
|
|
|
|
|
550 |
// ====================== RADIO BUTTON =============================
|
551 |
// script when clicked show
|
552 |
// =============================================================
|
553 |
+
|
554 |
?>
|
555 |
+
<!-- Billing section: Radio buttons -->
|
556 |
<script type="text/javascript">
|
557 |
jQuery(document).ready(function($){
|
558 |
|
559 |
+
<?php
|
560 |
+
foreach( $options['billing_buttons'] as $btn ) {
|
561 |
+
if( $btn['type'] == 'wooccmradio' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
|
563 |
+
if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
|
564 |
+
?>
|
565 |
|
566 |
+
jQuery("#billing_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input").click(function(){
|
567 |
|
568 |
<?php
|
569 |
+
foreach( $options['billing_buttons'] as $btn3 ) {
|
570 |
+
if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
|
571 |
+
?>
|
572 |
+
|
573 |
+
if(jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
574 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
|
575 |
+
}
|
576 |
+
|
577 |
+
if(jQuery('#billing_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=billing_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
578 |
+
jQuery("#billing_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
|
579 |
+
|
580 |
+
<?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
|
581 |
+
|
582 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
583 |
+
|
584 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
585 |
+
data = {
|
586 |
+
action: 'remove_tax_wccm',
|
587 |
+
empty_check_add: 'none'
|
588 |
+
};
|
589 |
|
590 |
+
jQuery.post(ajaxurl, data, function(response) {
|
591 |
+
$( 'body' ).trigger( 'update_checkout' );
|
592 |
+
jQuery('form.checkout').unblock();
|
593 |
+
});
|
594 |
|
595 |
+
<?php } ?>
|
596 |
+
|
597 |
+
}
|
598 |
+
|
599 |
+
<?php
|
600 |
+
}
|
601 |
+
}
|
602 |
+
?>
|
603 |
+
|
604 |
+
});
|
605 |
+
<?php
|
606 |
+
}
|
607 |
+
}
|
608 |
+
}
|
609 |
+
?>
|
610 |
+
});
|
611 |
+
</script>
|
612 |
+
|
613 |
+
<?php
|
614 |
+
|
615 |
+
// ================================ END!!! =====================================
|
616 |
+
// =============================================================================
|
617 |
|
618 |
// ----------------------------- CLEAR ---------------------------------
|
619 |
// ---------------------------------------------------------------------
|
620 |
// ---------------------------------------------------------------------
|
621 |
+
|
622 |
+
$categoryarraycm = array();
|
623 |
+
$productsarraycm = array();
|
624 |
+
|
625 |
+
foreach( $options['billing_buttons'] as $btn ) {
|
626 |
+
foreach( $woocommerce->cart->cart_contents as $key => $values ) {
|
627 |
+
|
628 |
+
$multiproductsx = ( isset( $btn['single_p'] ) ? $btn['single_p'] : '' );
|
629 |
+
$show_field_single = ( isset( $btn['single_px'] ) ? $btn['single_px'] : '' );
|
630 |
+
$multiproductsx_cat = ( isset( $btn['single_p_cat'] ) ? $btn['single_p_cat'] : '' );
|
631 |
+
$show_field_single_cat = ( isset( $btn['single_px_cat'] ) ? $btn['single_px_cat'] : '' );
|
632 |
+
|
633 |
+
$productsarraycm[] = $values['product_id'];
|
634 |
+
|
635 |
+
// Products
|
636 |
+
// hide field
|
637 |
+
|
638 |
+
// without more
|
639 |
+
if( !empty( $btn['single_p'] ) && empty( $btn['more_content'] ) ) {
|
640 |
+
|
641 |
+
$multiarrayproductsx = explode( ',', $multiproductsx );
|
642 |
+
|
643 |
+
if( in_array( $values['product_id'], $multiarrayproductsx ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
644 |
+
echo '
|
645 |
+
<style type="text/css">
|
646 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
647 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
648 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
649 |
+
display: none;
|
650 |
+
}
|
651 |
+
</style>';
|
652 |
+
}
|
653 |
+
}
|
654 |
+
|
655 |
+
// show field without more
|
656 |
+
if( !empty( $btn['single_px'] ) && empty( $btn['more_content'] ) ) {
|
657 |
+
|
658 |
+
$show_field_array = explode( '||', $show_field_single );
|
659 |
+
|
660 |
+
if( in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
661 |
+
echo '
|
662 |
+
<style type="text/css">
|
663 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
664 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
665 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
666 |
+
display: inline-block;
|
667 |
+
}
|
668 |
+
</style>';
|
669 |
+
}
|
670 |
+
|
671 |
+
if( !in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
672 |
+
echo '
|
673 |
+
<style type="text/css">
|
674 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
675 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
676 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
677 |
+
display: none;
|
678 |
+
}
|
679 |
+
</style>';
|
680 |
+
}
|
681 |
+
}
|
682 |
+
|
683 |
+
// Category
|
684 |
+
// hide field
|
685 |
+
$terms = get_the_terms( $values['product_id'], 'product_cat' );
|
686 |
+
if( !empty($terms) ) {
|
687 |
+
foreach( $terms as $term ) {
|
688 |
+
|
689 |
+
$categoryarraycm[] = $term->slug;
|
690 |
+
|
691 |
+
// without more
|
692 |
+
|
693 |
+
if( !empty( $btn['single_p_cat'] ) && empty( $btn['more_content'] ) ) {
|
694 |
+
|
695 |
+
$multiarrayproductsx_cat = explode( ',', $multiproductsx_cat );
|
696 |
+
|
697 |
+
if( in_array( $term->slug, $multiarrayproductsx_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
698 |
+
echo '
|
699 |
+
<style type="text/css">
|
700 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
701 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
702 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
703 |
+
display: none;
|
704 |
+
}
|
705 |
+
</style>';
|
706 |
+
}
|
707 |
+
}
|
708 |
+
|
709 |
+
// show field without more
|
710 |
+
if( !empty( $btn['single_px_cat'] ) && empty( $btn['more_content'] ) ) {
|
711 |
+
|
712 |
+
$show_field_array_cat = explode('||',$show_field_single_cat);
|
713 |
+
|
714 |
+
if( in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
715 |
+
echo '
|
716 |
+
<style type="text/css">
|
717 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
718 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
719 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
720 |
+
display: inline-block;
|
721 |
+
}
|
722 |
+
</style>';
|
723 |
+
}
|
724 |
+
|
725 |
+
if( !in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
726 |
+
echo '
|
727 |
+
<style type="text/css">
|
728 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
729 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
730 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
731 |
+
display: none;
|
732 |
+
}
|
733 |
+
</style>';
|
734 |
+
}
|
735 |
+
}
|
736 |
+
|
737 |
+
}
|
738 |
+
}
|
739 |
+
}
|
740 |
+
// end cart
|
741 |
+
|
742 |
+
// ===========================================================================================
|
743 |
+
|
744 |
+
// Products
|
745 |
+
// hide field
|
746 |
+
|
747 |
+
// with more
|
748 |
+
if( !empty( $btn['single_p'] ) && !empty( $btn['more_content'] ) ) {
|
749 |
+
|
750 |
+
$multiarrayproductsx = explode( ',', $multiproductsx );
|
751 |
+
|
752 |
+
if( array_intersect( $productsarraycm, $multiarrayproductsx ) ) {
|
753 |
+
echo '
|
754 |
+
<style type="text/css">
|
755 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
756 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
757 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
758 |
+
display: none;
|
759 |
+
}
|
760 |
+
</style>';
|
761 |
+
}
|
762 |
+
}
|
763 |
+
|
764 |
+
// show field with more
|
765 |
+
if( !empty( $btn['single_px'] ) && !empty( $btn['more_content'] ) ) {
|
766 |
+
|
767 |
+
$show_field_array = explode( '||', $show_field_single );
|
768 |
+
|
769 |
+
if( array_intersect( $productsarraycm, $show_field_array ) ) {
|
770 |
+
echo '
|
771 |
+
<style type="text/css">
|
772 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
773 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
774 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
775 |
+
display: inline-block;
|
776 |
+
}
|
777 |
+
</style>';
|
778 |
+
}
|
779 |
+
|
780 |
+
if( !array_intersect( $productsarraycm, $show_field_array ) ) {
|
781 |
+
echo '
|
782 |
+
<style type="text/css">
|
783 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
784 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
785 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
786 |
+
display: none;
|
787 |
+
}
|
788 |
+
</style>';
|
789 |
+
}
|
790 |
+
}
|
791 |
+
|
792 |
+
// Category
|
793 |
+
// hide field
|
794 |
+
|
795 |
+
// with more
|
796 |
+
if( !empty( $btn['single_p_cat'] ) && !empty( $btn['more_content'] ) ) {
|
797 |
+
|
798 |
+
$multiarrayproductsx_cat = explode( ',', $multiproductsx_cat );
|
799 |
+
|
800 |
+
if( array_intersect( $categoryarraycm, $multiarrayproductsx_cat ) ) {
|
801 |
+
echo '
|
802 |
+
<style type="text/css">
|
803 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
804 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
805 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
806 |
+
display: none;
|
807 |
+
}
|
808 |
+
</style>';
|
809 |
+
}
|
810 |
+
}
|
811 |
+
|
812 |
+
// show field with more
|
813 |
+
if( !empty( $btn['single_px_cat'] ) && !empty( $btn['more_content'] ) ) {
|
814 |
+
|
815 |
+
$show_field_array_cat = explode( '||', $show_field_single_cat );
|
816 |
+
|
817 |
+
if( array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
818 |
+
echo '
|
819 |
+
<style type="text/css">
|
820 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
821 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
822 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
823 |
+
display: inline-block;
|
824 |
+
}
|
825 |
+
</style>';
|
826 |
+
}
|
827 |
+
|
828 |
+
if( !array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
829 |
+
echo '
|
830 |
+
<style type="text/css">
|
831 |
+
.woocommerce form #customer_details #billing_'.$btn['cow'].'_field,
|
832 |
+
.woocommerce-page form #customer_details #billing_'.$btn['cow'].'_field,
|
833 |
+
.woocommerce form.checkout #billing_'.$btn['cow'].'_field {
|
834 |
+
display: none;
|
835 |
+
}
|
836 |
+
</style>';
|
837 |
+
}
|
838 |
+
}
|
839 |
+
|
840 |
+
$categoryarraycm = array();
|
841 |
+
$productsarraycm = array();
|
842 |
+
|
843 |
+
} // btn cut
|
844 |
+
|
845 |
+
}
|
846 |
+
?>
|
includes/templates/functions/billing_wooccmupload.php
CHANGED
@@ -1,378 +1,369 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
* WooCommerce Checkout Manager
|
4 |
*/
|
5 |
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
-
function
|
10 |
-
global $woocommerce;
|
11 |
-
$options = get_option( 'wccs_settings3' );
|
12 |
-
|
13 |
-
if( !empty($options['billing_buttons']) ) {
|
14 |
-
foreach ( $options['billing_buttons'] as $btn ) :
|
15 |
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
<script type="text/javascript">
|
21 |
jQuery(document).ready(function($){
|
22 |
|
23 |
$("#billing_<?php echo $btn['cow']; ?>_field").magnificPopup({
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
easing: "ease-out"
|
30 |
-
|
31 |
-
});
|
32 |
|
33 |
-
(function post_image_content() {
|
34 |
-
var input = document.getElementById("<?php echo $btn['cow']; ?>_file"),
|
35 |
-
formdata = false, loadfiles, formnames = [], loadfiles = [];
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
return false;
|
40 |
-
});
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
}
|
86 |
-
if (filetype.match("application/ms.*")) {
|
87 |
-
img.src = "<?php echo site_url('wp-includes/images/media/spreadsheet.png'); ?>";
|
88 |
-
}
|
89 |
-
if (filetype.match("application/x.*")) {
|
90 |
-
img.src = "<?php echo site_url('wp-includes/images/media/archive.png'); ?>";
|
91 |
-
}
|
92 |
-
if (filetype.match("audio.*")) {
|
93 |
-
img.src = "<?php echo site_url('wp-includes/images/media/audio.png'); ?>";
|
94 |
-
}
|
95 |
-
if (filetype.match("text.*")) {
|
96 |
-
img.src = "<?php echo site_url('wp-includes/images/media/text.png'); ?>";
|
97 |
-
}
|
98 |
-
if (filetype.match("video.*")) {
|
99 |
-
img.src = "<?php echo site_url('wp-includes/images/media/video.png'); ?>";
|
100 |
-
}
|
101 |
-
|
102 |
-
li.title = getname;
|
103 |
-
dele.title = getname;
|
104 |
-
edit.title = getname;
|
105 |
-
li.appendChild(name);
|
106 |
-
li.appendChild(span);
|
107 |
-
span.appendChild(zoom);
|
108 |
-
span.appendChild(edit);
|
109 |
-
span.appendChild(dele);
|
110 |
-
list.appendChild(li);
|
111 |
-
li.className = "wooccm_each_file";
|
112 |
-
name.className = "wooccm_name";
|
113 |
-
dele.id = "wooccm_dele";
|
114 |
-
dele.className = "wooccm_dele wooccm-btn wooccm-btn-danger";
|
115 |
-
span.className = "container";
|
116 |
-
|
117 |
-
|
118 |
-
}
|
119 |
-
|
120 |
-
input.addEventListener("change", function (evt) {
|
121 |
-
$("#billing_<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
122 |
-
|
123 |
-
var count = $("#billing_<?php echo $btn['cow']; ?>_files_button_wccm").data("count") || 0;
|
124 |
-
$("#billing_<?php echo $btn['cow']; ?>_files_button_wccm").data("count", ++count);
|
125 |
-
|
126 |
-
var img, reader, file, iname, len = this.files.length;
|
127 |
-
|
128 |
-
for ( i = 0; i < len; i++ ) {
|
129 |
-
file = this.files[i];
|
130 |
-
|
131 |
-
if ( window.FileReader ) {
|
132 |
-
reader = new FileReader();
|
133 |
-
reader.onload = (function(theFile){
|
134 |
-
var fileName = theFile.name,
|
135 |
-
filetype = theFile.type;
|
136 |
-
return function(e){
|
137 |
-
showUploadedItem( e.target.result, fileName, filetype );
|
138 |
-
};
|
139 |
-
})(file);
|
140 |
-
reader.readAsDataURL(file);
|
141 |
}
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
formdata.append("billing_<?php echo $btn['cow']; ?>[]", file);
|
144 |
formnames.push(file.name);
|
145 |
loadfiles.push(file);
|
146 |
-
|
147 |
$.ajax({
|
148 |
-
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&name='.$btn['cow'].''); ?>",
|
149 |
type: "POST",
|
150 |
data: formdata,
|
151 |
processData: false,
|
152 |
contentType: false,
|
153 |
success: function (res) {
|
154 |
var result = $.parseJSON(res), new_val;
|
155 |
-
|
156 |
-
|
|
|
|
|
157 |
new_val[0] = result[0];
|
158 |
new_val[1] += result[1] + ",";
|
159 |
document.getElementById("billing_<?php echo $btn['cow']; ?>").value = new_val[0] + "||" + new_val[1];
|
160 |
-
|
|
|
161 |
$("#billing_<?php echo $btn['cow']; ?>_field").unblock();
|
162 |
}
|
163 |
});
|
164 |
-
}
|
165 |
|
166 |
-
if( formdata ) {
|
167 |
-
$("#billing_<?php echo $btn['cow']; ?>_field").unblock();
|
168 |
-
}
|
169 |
-
|
170 |
-
|
171 |
-
}, false);
|
172 |
-
|
173 |
-
$("#caman_content #wooccmtoolbar #save").click( function(){
|
174 |
-
$("#caman_content #wooccmtoolbar").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
175 |
-
|
176 |
-
var title = this.title, the_file, wooxtro = document.getElementById("wooccmactualimage").getAttribute("data-caman-hidpi"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
177 |
-
formdata = new FormData();
|
178 |
-
|
179 |
-
for(var t = 0; t < count.length; t++) {
|
180 |
-
if( count[t].getAttribute("wooccm-attach-id") ){
|
181 |
-
break;
|
182 |
-
}
|
183 |
-
store.push(count[t]);
|
184 |
-
}
|
185 |
-
|
186 |
-
if( store.length !== 0 ){
|
187 |
-
listing = document.getElementById("billing_<?php echo $btn['cow']; ?>").value.split("||");
|
188 |
-
listing = listing[1].split(",");
|
189 |
-
listing = listing.filter(Number);
|
190 |
-
|
191 |
-
$.each(listing, function(index, value){
|
192 |
-
$(store[index]).attr("wooccm-attach-id", value);
|
193 |
-
});
|
194 |
-
}
|
195 |
-
|
196 |
-
|
197 |
-
$(".wooccm_each_file").each(function(){
|
198 |
-
if( this.title === title) {
|
199 |
-
var currentgutz = this;
|
200 |
-
this.firstElementChild.href = wooxtro;
|
201 |
-
this.firstElementChild.firstElementChild.src = wooxtro;
|
202 |
-
this.lastElementChild.firstElementChild.href = wooxtro;
|
203 |
-
this.lastElementChild.lastElementChild.previousElementSibling.href = wooxtro;
|
204 |
-
|
205 |
-
var byteString;
|
206 |
-
var dataURI = wooxtro; //data:image/gif;base64,R0lGODlhyAAiALM...DfD0QAADs
|
207 |
-
|
208 |
-
if (dataURI.split(',')[0].indexOf('base64') >= 0)
|
209 |
-
|
210 |
-
byteString = atob(dataURI.split(',')[1]);
|
211 |
-
|
212 |
-
else
|
213 |
-
|
214 |
-
byteString = unescape(dataURI.split(',')[1]);
|
215 |
-
|
216 |
-
// separate out the mime component
|
217 |
-
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
218 |
-
|
219 |
-
// write the bytes of the string to a typed array
|
220 |
-
var ia = new Uint8Array(byteString.length);
|
221 |
-
for (var i = 0; i < byteString.length; i++) {
|
222 |
-
ia[i] = byteString.charCodeAt(i);
|
223 |
}
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
var
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
});
|
249 |
-
|
250 |
-
$("#caman_content #wooccmtoolbar").unblock();
|
251 |
-
alert("billing_<?php echo $options['checkness']['picture_success']; ?>");
|
252 |
}
|
253 |
-
|
254 |
});
|
255 |
-
|
256 |
-
});
|
257 |
-
|
258 |
-
|
259 |
-
});
|
260 |
-
|
261 |
-
$(document).on('click','.wooccm_dele',function(){
|
262 |
-
|
263 |
-
var c = confirm("<?php echo $options['checkness']['file_delete']; ?> " + this.title + " ?"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
264 |
-
if (c==true) {
|
265 |
-
|
266 |
-
$("#billing_<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
267 |
-
|
268 |
-
for(var t = 0; t < count.length; t++) {
|
269 |
-
if( count[t].getAttribute("wooccm-attach-id") ){
|
270 |
-
break;
|
271 |
-
}
|
272 |
-
store.push(count[t]);
|
273 |
-
}
|
274 |
-
|
275 |
-
if( store.length !== 0 ){
|
276 |
-
listing = document.getElementById("billing_<?php echo $btn['cow']; ?>").value.split("||");
|
277 |
-
listing = listing[1].split(",");
|
278 |
-
listing = listing.filter(Number);
|
279 |
-
|
280 |
-
$.each(listing, function(index, value){
|
281 |
-
$(store[index]).attr("wooccm-attach-id", value);
|
282 |
});
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
|
|
|
|
|
|
|
|
292 |
}
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
remove = remove + ",";
|
303 |
$("#billing_<?php echo $btn['cow']; ?>").val(function(index, value) {
|
304 |
return value.replace(remove, "");
|
305 |
});
|
306 |
-
|
307 |
shell.outerHTML = "";
|
308 |
-
|
309 |
-
$("#billing_<?php echo $btn['cow']; ?>_field").unblock();
|
310 |
-
}
|
311 |
-
|
312 |
-
});
|
313 |
-
|
314 |
-
|
315 |
-
} else {
|
316 |
-
}
|
317 |
-
|
318 |
-
});
|
319 |
|
|
|
|
|
|
|
320 |
|
|
|
321 |
|
322 |
-
$("#caman_content #wooccmtoolbar #close").click( function(){
|
323 |
-
var li = document.getElementById( "wooccmactualimage" );
|
324 |
-
li.outerHTML = "";
|
325 |
-
$("#caman_content .FilterValue").each(function(){
|
326 |
-
$(this).text("0");
|
327 |
});
|
328 |
-
|
329 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
});
|
331 |
-
|
332 |
-
|
|
|
333 |
});
|
334 |
-
|
335 |
-
$(
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
img.setAttributeNode(data);
|
356 |
-
li.appendChild(img);
|
357 |
-
|
358 |
-
|
359 |
-
$.getScript( "<?php echo plugins_url('woocommerce-checkout-manager-pro/includes/pickers/caman/dist/caman_controls.js'); ?>");
|
360 |
-
}
|
361 |
-
|
362 |
-
$("#caman_content").show();
|
363 |
-
$("html").css("overflow", "hidden");
|
364 |
-
});
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
}());
|
370 |
});
|
371 |
</script>
|
372 |
-
</p>
|
373 |
-
|
374 |
<?php
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* WooCommerce Checkout Manager
|
4 |
*/
|
5 |
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
+
function wooccm_upload_billing_scripts() {
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
global $woocommerce;
|
12 |
|
13 |
+
$options = get_option( 'wccs_settings3' );
|
14 |
+
|
15 |
+
// Check if we have any buttons
|
16 |
+
if( empty( $options['billing_buttons'] ) )
|
17 |
+
return;
|
18 |
+
|
19 |
+
foreach( $options['billing_buttons'] as $btn ) {
|
20 |
+
|
21 |
+
if( $btn['type'] <> 'wooccmupload' )
|
22 |
+
continue;
|
23 |
+
?>
|
24 |
+
<!-- Billing section: File upload -->
|
25 |
<script type="text/javascript">
|
26 |
jQuery(document).ready(function($){
|
27 |
|
28 |
$("#billing_<?php echo $btn['cow']; ?>_field").magnificPopup({
|
29 |
+
delegate: "a.wooccm-zoom-special", // child items selector, by clicking on it popup will open
|
30 |
+
type: "image",
|
31 |
+
zoom: {
|
32 |
+
enabled: true,
|
33 |
+
duration: 400,
|
34 |
easing: "ease-out"
|
35 |
+
}
|
36 |
+
});
|
37 |
|
38 |
+
(function post_image_content() {
|
|
|
|
|
39 |
|
40 |
+
var input = document.getElementById("billing_<?php echo $btn['cow']; ?>_file"),
|
41 |
+
formdata = false, loadfiles, formnames = [], loadfiles = [];
|
|
|
|
|
42 |
|
43 |
+
$("#billing_<?php echo $btn['cow']; ?>_files_button_wccm").click( function(){
|
44 |
+
$("#billing_<?php echo $btn['cow']; ?>_field input[type=file]").click();
|
45 |
+
return false;
|
46 |
+
});
|
47 |
+
|
48 |
+
if (window.FormData) {
|
49 |
+
formdata = new FormData();
|
50 |
+
}
|
51 |
+
|
52 |
+
function showUploadedItem ( source, getname, filetype ) {
|
53 |
|
54 |
+
var
|
55 |
+
list = document.getElementById("billing_<?php echo $btn['cow']; ?>_field"),
|
56 |
+
li = document.createElement("span"),
|
57 |
+
name = document.createElement("name"),
|
58 |
+
span = document.createElement("span"),
|
59 |
+
zoom = document.createElement("a"),
|
60 |
+
edit = document.createElement("a"),
|
61 |
+
dele = document.createElement("a"),
|
62 |
+
a = document.createElement("a"),
|
63 |
+
spana = document.createElement("spana"),
|
64 |
+
img = document.createElement("img");
|
65 |
+
|
66 |
+
name.innerHTML = getname;
|
67 |
+
edit.innerHTML = "Edit";
|
68 |
+
dele.innerHTML = "Delete";
|
69 |
+
|
70 |
+
if (filetype.match("image.*")) {
|
71 |
+
img.src = source;
|
72 |
+
a.href = source;
|
73 |
+
a.title = getname;
|
74 |
+
edit.href = source;
|
75 |
+
zoom.href = source;
|
76 |
+
zoom.title = getname;
|
77 |
+
zoom.innerHTML = "Zoom <img style=display:none />";
|
78 |
+
li.appendChild(a);
|
79 |
+
a.appendChild(img);
|
80 |
+
a.className = "wooccm-zoom-special wooccm-image-holder mfp-zoom";
|
81 |
+
zoom.className = "wooccm-zoom-special wooccm_zoom wooccm-btn wooccm-btn-zoom";
|
82 |
+
edit.className = "wooccm_edit wooccm-btn wooccm-btn-edit enable";
|
83 |
+
}else{
|
84 |
+
zoom.innerHTML = "Zoom";
|
85 |
+
li.appendChild(spana);
|
86 |
+
spana.appendChild(img);
|
87 |
+
spana.className = "wooccm-image-holder";
|
88 |
+
zoom.className = "wooccm_zoom wooccm-btn disable";
|
89 |
+
edit.className = "wooccm_edit wooccm-btn disable";
|
90 |
+
}
|
91 |
+
if ( ( false === filetype.match("application/ms.*") && false === filetype.match("application/x.*") && false === filetype.match("audio.*") && false === filetype.match("text.*") && false === filetype.match("video.*") ) || ( 0 === filetype.length || !filetype) ) {
|
92 |
+
img.src = "<?php echo site_url('wp-includes/images/media/interactive.png'); ?>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
+
if (filetype.match("application/ms.*")) {
|
95 |
+
img.src = "<?php echo site_url('wp-includes/images/media/spreadsheet.png'); ?>";
|
96 |
+
}
|
97 |
+
if (filetype.match("application/x.*")) {
|
98 |
+
img.src = "<?php echo site_url('wp-includes/images/media/archive.png'); ?>";
|
99 |
+
}
|
100 |
+
if (filetype.match("audio.*")) {
|
101 |
+
img.src = "<?php echo site_url('wp-includes/images/media/audio.png'); ?>";
|
102 |
+
}
|
103 |
+
if (filetype.match("text.*")) {
|
104 |
+
img.src = "<?php echo site_url('wp-includes/images/media/text.png'); ?>";
|
105 |
+
}
|
106 |
+
if (filetype.match("video.*")) {
|
107 |
+
img.src = "<?php echo site_url('wp-includes/images/media/video.png'); ?>";
|
108 |
+
}
|
109 |
+
|
110 |
+
li.title = getname;
|
111 |
+
dele.title = getname;
|
112 |
+
edit.title = getname;
|
113 |
+
li.appendChild(name);
|
114 |
+
li.appendChild(span);
|
115 |
+
span.appendChild(zoom);
|
116 |
+
span.appendChild(edit);
|
117 |
+
span.appendChild(dele);
|
118 |
+
list.appendChild(li);
|
119 |
+
li.className = "wooccm_each_file";
|
120 |
+
name.className = "wooccm_name";
|
121 |
+
dele.id = "wooccm_dele";
|
122 |
+
dele.className = "wooccm_dele wooccm-btn wooccm-btn-danger";
|
123 |
+
span.className = "container";
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
input.addEventListener("change", function (evt) {
|
128 |
+
$("#billing_<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
129 |
+
|
130 |
+
var count = $("#billing_<?php echo $btn['cow']; ?>_files_button_wccm").data("count") || 0;
|
131 |
+
$("#billing_<?php echo $btn['cow']; ?>_files_button_wccm").data("count", ++count);
|
132 |
+
|
133 |
+
var img, reader, file, iname, len = this.files.length;
|
134 |
+
|
135 |
+
for ( i = 0; i < len; i++ ) {
|
136 |
+
|
137 |
+
file = this.files[i];
|
138 |
+
|
139 |
+
if ( window.FileReader ) {
|
140 |
+
reader = new FileReader();
|
141 |
+
reader.onload = (function(theFile){
|
142 |
+
var fileName = theFile.name,
|
143 |
+
filetype = theFile.type;
|
144 |
+
return function(e){
|
145 |
+
showUploadedItem( e.target.result, fileName, filetype );
|
146 |
+
};
|
147 |
+
})(file);
|
148 |
+
reader.readAsDataURL(file);
|
149 |
+
}
|
150 |
+
|
151 |
formdata.append("billing_<?php echo $btn['cow']; ?>[]", file);
|
152 |
formnames.push(file.name);
|
153 |
loadfiles.push(file);
|
154 |
+
|
155 |
$.ajax({
|
156 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&name=billing_'.$btn['cow'].''); ?>",
|
157 |
type: "POST",
|
158 |
data: formdata,
|
159 |
processData: false,
|
160 |
contentType: false,
|
161 |
success: function (res) {
|
162 |
var result = $.parseJSON(res), new_val;
|
163 |
+
document.getElementById("billing_<?php echo $btn['cow']; ?>").value = result;
|
164 |
+
/* @mod - Test formatting change */
|
165 |
+
/*
|
166 |
+
new_val = document.getElementById("billing_<?php echo $btn['cow']; ?>").value.split("||");
|
167 |
new_val[0] = result[0];
|
168 |
new_val[1] += result[1] + ",";
|
169 |
document.getElementById("billing_<?php echo $btn['cow']; ?>").value = new_val[0] + "||" + new_val[1];
|
170 |
+
*/
|
171 |
+
|
172 |
$("#billing_<?php echo $btn['cow']; ?>_field").unblock();
|
173 |
}
|
174 |
});
|
|
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
+
|
178 |
+
if( formdata ) {
|
179 |
+
$("#billing_<?php echo $btn['cow']; ?>_field").unblock();
|
180 |
+
}
|
181 |
+
|
182 |
+
}, false);
|
183 |
+
|
184 |
+
$("#caman_content #wooccmtoolbar #save").click( function(){
|
185 |
+
|
186 |
+
$("#caman_content #wooccmtoolbar").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
187 |
+
|
188 |
+
var title = this.title, the_file, wooxtro = document.getElementById("wooccmactualimage").getAttribute("data-caman-hidpi"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
189 |
+
formdata = new FormData();
|
190 |
+
|
191 |
+
for(var t = 0; t < count.length; t++) {
|
192 |
+
if( count[t].getAttribute("wooccm-attach-id") ){
|
193 |
+
break;
|
194 |
+
}
|
195 |
+
store.push(count[t]);
|
196 |
+
}
|
197 |
+
|
198 |
+
if( store.length !== 0 ){
|
199 |
+
listing = document.getElementById("billing_<?php echo $btn['cow']; ?>").value.split("||");
|
200 |
+
listing = listing[1].split(",");
|
201 |
+
listing = listing.filter(Number);
|
202 |
+
|
203 |
+
$.each(listing, function(index, value){
|
204 |
+
$(store[index]).attr("wooccm-attach-id", value);
|
205 |
+
});
|
206 |
+
}
|
207 |
+
|
208 |
+
$(".wooccm_each_file").each(function(){
|
209 |
+
if( this.title === title) {
|
210 |
+
|
211 |
+
var currentgutz = this;
|
212 |
+
this.firstElementChild.href = wooxtro;
|
213 |
+
this.firstElementChild.firstElementChild.src = wooxtro;
|
214 |
+
this.lastElementChild.firstElementChild.href = wooxtro;
|
215 |
+
this.lastElementChild.lastElementChild.previousElementSibling.href = wooxtro;
|
216 |
+
|
217 |
+
var byteString;
|
218 |
+
var dataURI = wooxtro; //data:image/gif;base64,R0lGODlhyAAiALM...DfD0QAADs
|
219 |
+
|
220 |
+
if (dataURI.split(',')[0].indexOf('base64') >= 0)
|
221 |
+
byteString = atob(dataURI.split(',')[1]);
|
222 |
+
else
|
223 |
+
byteString = unescape(dataURI.split(',')[1]);
|
224 |
+
|
225 |
+
// separate out the mime component
|
226 |
+
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
227 |
+
|
228 |
+
// write the bytes of the string to a typed array
|
229 |
+
var ia = new Uint8Array(byteString.length);
|
230 |
+
for (var i = 0; i < byteString.length; i++) {
|
231 |
+
ia[i] = byteString.charCodeAt(i);
|
232 |
+
}
|
233 |
+
|
234 |
+
var extension = mimeString.split('/')[1];
|
235 |
+
var fileName = "image_" + new Date().getTime() + "." + extension;
|
236 |
+
var blob = new Blob([ia], {type:mimeString});
|
237 |
+
|
238 |
+
the_file = new File([blob], title, {
|
239 |
+
type: "image/png"
|
240 |
+
});
|
241 |
+
|
242 |
+
formdata.append("billing_<?php echo $btn['cow']; ?>[]", the_file);
|
243 |
+
var remove = this.getAttribute("wooccm-attach-id");
|
244 |
+
|
245 |
+
$.ajax({
|
246 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_enduploadsave&name=billing_'.$btn['cow'].'&remove='); ?>" + remove,
|
247 |
+
type: "POST",
|
248 |
+
data: formdata,
|
249 |
+
processData: false,
|
250 |
+
contentType: false,
|
251 |
+
success: function (res) {
|
252 |
+
var result = $.parseJSON(res);
|
253 |
+
$(currentgutz).attr("wooccm-attach-id", result);
|
254 |
+
$("#billing_<?php echo $btn['cow']; ?>").val(function(index, value) {
|
255 |
+
return value.replace(remove, result);
|
256 |
+
});
|
257 |
+
$("#caman_content #wooccmtoolbar").unblock();
|
258 |
+
alert("billing_<?php echo ( !empty( $options['checkness']['picture_success'] ) ? $options['checkness']['picture_success'] : 'Picture Saved' ); ?>");
|
259 |
+
}
|
260 |
});
|
261 |
+
|
|
|
|
|
262 |
}
|
|
|
263 |
});
|
264 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
});
|
266 |
+
|
267 |
+
$(document).on('click','.wooccm_dele',function(){
|
268 |
+
|
269 |
+
var c = confirm("<?php echo ( !empty( $options['checkness']['file_delete'] ) ? $options['checkness']['file_delete'] : 'Delete' ); ?> " + this.title + " ?"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
270 |
+
if (c==true) {
|
271 |
+
|
272 |
+
$("#billing_<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
273 |
+
|
274 |
+
for(var t = 0; t < count.length; t++) {
|
275 |
+
if( count[t].getAttribute("wooccm-attach-id") ){
|
276 |
+
break;
|
277 |
+
}
|
278 |
+
store.push(count[t]);
|
279 |
}
|
280 |
+
|
281 |
+
if( store.length !== 0 ){
|
282 |
+
listing = document.getElementById("billing_<?php echo $btn['cow']; ?>").value.split("||");
|
283 |
+
listing = listing[1].split(",");
|
284 |
+
listing = listing.filter(Number);
|
285 |
+
|
286 |
+
$.each(listing, function(index, value){
|
287 |
+
$(store[index]).attr("wooccm-attach-id", value);
|
288 |
+
});
|
289 |
+
}
|
290 |
+
|
291 |
+
var currentname = this.title, wooccmeachfile = document.getElementsByClassName("wooccm_each_file"), remove, shell;
|
292 |
+
formdata = new FormData();
|
293 |
+
|
294 |
+
for( i = 0; i < wooccmeachfile.length; i++ ){
|
295 |
+
if(wooccmeachfile[i].title === currentname){
|
296 |
+
remove = wooccmeachfile[i].getAttribute("wooccm-attach-id");
|
297 |
+
shell = wooccmeachfile[i];
|
298 |
+
}
|
299 |
+
}
|
300 |
+
|
301 |
+
$.ajax({
|
302 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_enduploadsave&remove='); ?>" + remove,
|
303 |
+
type: "POST",
|
304 |
+
data: formdata,
|
305 |
+
processData: false,
|
306 |
+
contentType: false,
|
307 |
+
success: function (res) {
|
308 |
remove = remove + ",";
|
309 |
$("#billing_<?php echo $btn['cow']; ?>").val(function(index, value) {
|
310 |
return value.replace(remove, "");
|
311 |
});
|
312 |
+
|
313 |
shell.outerHTML = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
|
315 |
+
$("#billing_<?php echo $btn['cow']; ?>_field").unblock();
|
316 |
+
}
|
317 |
+
});
|
318 |
|
319 |
+
}
|
320 |
|
|
|
|
|
|
|
|
|
|
|
321 |
});
|
322 |
+
|
323 |
+
$("#caman_content #wooccmtoolbar #close").click( function(){
|
324 |
+
var li = document.getElementById( "wooccmactualimage" );
|
325 |
+
li.outerHTML = "";
|
326 |
+
$("#caman_content .FilterValue").each(function(){
|
327 |
+
$(this).text("0");
|
328 |
+
});
|
329 |
+
$("#caman_content .FilterSetting input").each(function(){
|
330 |
+
$(this).val("0");
|
331 |
+
});
|
332 |
+
$("#PresetFilters a").each(function(){
|
333 |
+
$(this).removeClass("Active");
|
334 |
+
});
|
335 |
+
$("#caman_content").hide();
|
336 |
+
$("html").css("overflow", "visible");
|
337 |
});
|
338 |
+
|
339 |
+
$(document).on('click','.wooccm_edit',function(){
|
340 |
+
return false;
|
341 |
});
|
342 |
+
|
343 |
+
$(document).on('click','.wooccm_edit.enable',function(){
|
344 |
+
var imageinbase = this.href,
|
345 |
+
li = document.getElementById( "wooccmimageeditorpro" ),
|
346 |
+
data = document.createAttribute("data-caman-hidpi"),
|
347 |
+
img = document.createElement("img");
|
348 |
+
data.value = imageinbase;
|
349 |
+
$("#caman_content #wooccmtoolbar #save").attr("title", this.title);
|
350 |
+
if( $(".wooccmimageeditor img").length == 0 ){
|
351 |
+
img.id = "wooccmactualimage";
|
352 |
+
img.src = imageinbase;
|
353 |
+
img.setAttributeNode(data);
|
354 |
+
li.appendChild(img);
|
355 |
+
$.getScript( "<?php echo plugins_url( 'includes/pickers/caman/dist/caman_controls.js', WOOCCM_RELPATH ); ?>");
|
356 |
+
}
|
357 |
+
$("#caman_content").show();
|
358 |
+
$("html").css("overflow", "hidden");
|
359 |
+
});
|
360 |
+
|
361 |
+
}());
|
362 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
});
|
364 |
</script>
|
|
|
|
|
365 |
<?php
|
366 |
+
}
|
367 |
+
|
368 |
+
}
|
369 |
+
?>
|
includes/templates/functions/required/add_required.php
CHANGED
@@ -1,114 +1,114 @@
|
|
1 |
<?php
|
2 |
-
function
|
3 |
-
global $woocommerce;
|
4 |
-
$options = get_option( 'wccs_settings' );
|
5 |
-
|
6 |
-
|
7 |
-
if ( count( $options['buttons'] ) > 0 ) {
|
8 |
-
|
9 |
-
foreach( $options['buttons'] as $btn ) {
|
10 |
-
foreach ($woocommerce->cart->cart_contents as $key => $values ) {
|
11 |
-
|
12 |
-
$multiproductsx = $btn['single_p'];
|
13 |
-
$show_field_single = $btn['single_px'];
|
14 |
-
$multiproductsx_cat = $btn['single_p_cat'];
|
15 |
-
$show_field_single_cat = $btn['single_px_cat'];
|
16 |
-
|
17 |
-
|
18 |
-
$productsarraycm[] = $values['product_id'];
|
19 |
-
|
20 |
-
// Products
|
21 |
-
// hide field
|
22 |
-
|
23 |
-
|
24 |
-
// show field without more
|
25 |
-
if ( !empty($btn['single_px']) && empty($btn['more_content']) ) {
|
26 |
-
$show_field_array = explode('||',$show_field_single);
|
27 |
-
|
28 |
-
if(in_array($values['product_id'], $show_field_array) && ( count($woocommerce->cart->cart_contents) < 2) ){
|
29 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
30 |
-
if (!$_POST[''.$btn['cow'].''] ) {
|
31 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
32 |
-
}
|
33 |
-
}
|
34 |
-
}
|
35 |
-
}
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
// hide field
|
41 |
-
$terms = get_the_terms( $values['product_id'], 'product_cat' );
|
42 |
-
if ( !empty($terms) ) {
|
43 |
-
foreach ( $terms as $term ) {
|
44 |
|
45 |
-
$
|
|
|
46 |
|
47 |
-
//
|
48 |
-
|
49 |
-
|
50 |
-
if ( !empty($btn['single_px_cat']) && empty($btn['more_content']) ) {
|
51 |
-
$show_field_array_cat = explode('||',$show_field_single_cat);
|
52 |
-
|
53 |
-
if(in_array($term->slug, $show_field_array_cat) && ( count($woocommerce->cart->cart_contents) < 2) ){
|
54 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
55 |
-
if (!$_POST[''.$btn['cow'].''] ) {
|
56 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
|
62 |
-
|
63 |
-
|
64 |
|
|
|
65 |
|
|
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
// show field with more
|
73 |
-
if ( !empty($btn['single_px']) && !empty($btn['more_content']) ) {
|
74 |
-
$show_field_array = explode('||',$show_field_single);
|
75 |
-
|
76 |
-
if(array_intersect($productsarraycm, $show_field_array) ){
|
77 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
78 |
-
if (!$_POST[''.$btn['cow'].''] ) {
|
79 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
80 |
-
}
|
81 |
-
}
|
82 |
-
}
|
83 |
-
}
|
84 |
|
|
|
85 |
|
|
|
|
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
|
90 |
-
// hide field
|
91 |
|
92 |
-
//
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
$show_field_array_cat = explode('||',$show_field_single_cat);
|
98 |
-
|
99 |
-
if(array_intersect($categoryarraycm, $show_field_array_cat) ){
|
100 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
101 |
-
if (!$_POST[''.$btn['cow'].''] ) {
|
102 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
103 |
-
}
|
104 |
-
}
|
105 |
-
}
|
106 |
-
}
|
107 |
|
|
|
|
|
108 |
|
109 |
-
|
110 |
-
$productsarraycm = '';
|
111 |
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
|
|
114 |
?>
|
1 |
<?php
|
2 |
+
function wooccm_custom_checkout_process() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
global $woocommerce;
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
$options = get_option( 'wccs_settings' );
|
7 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['buttons'] : array() );
|
8 |
|
9 |
+
// Check if we have any buttons
|
10 |
+
if( empty( $buttons ) )
|
11 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
$categoryarraycm = array();
|
14 |
+
$productsarraycm = array();
|
15 |
|
16 |
+
foreach( $buttons as $btn ) {
|
17 |
|
18 |
+
foreach( $woocommerce->cart->cart_contents as $key => $values ) {
|
19 |
|
20 |
+
$multiproductsx = ( isset( $btn['single_p'] ) ? $btn['single_p'] : '' );
|
21 |
+
$show_field_single = ( isset( $btn['single_px'] ) ? $btn['single_px'] : '' );
|
22 |
+
$multiproductsx_cat = ( isset( $btn['single_p_cat'] ) ? $btn['single_p_cat'] : '' );
|
23 |
+
$show_field_single_cat = ( isset( $btn['single_px_cat'] ) ? $btn['single_px_cat'] : '' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
$productsarraycm[] = $values['product_id'];
|
26 |
|
27 |
+
// Products
|
28 |
+
// hide field
|
29 |
|
30 |
+
// show field without more
|
31 |
+
if( !empty($btn['single_px']) && empty($btn['more_content']) ) {
|
32 |
+
$show_field_array = explode('||',$show_field_single);
|
33 |
+
if( in_array($values['product_id'], $show_field_array) && ( count($woocommerce->cart->cart_contents) < 2) ) {
|
34 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
35 |
+
if( empty( $_POST[$btn['cow']] ) ) {
|
36 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
37 |
+
wc_add_notice( $message, 'error' );
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
|
43 |
+
// Category
|
44 |
+
// hide field
|
45 |
+
$terms = get_the_terms( $values['product_id'], 'product_cat' );
|
46 |
+
if( !empty( $terms ) ) {
|
47 |
+
foreach( $terms as $term ) {
|
48 |
|
49 |
+
$categoryarraycm[] = $term->slug;
|
|
|
50 |
|
51 |
+
// without more
|
52 |
|
53 |
+
// show field without more
|
54 |
+
if( !empty($btn['single_px_cat']) && empty($btn['more_content']) ) {
|
55 |
+
$show_field_array_cat = explode('||',$show_field_single_cat);
|
56 |
+
if( in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
57 |
+
if( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
58 |
+
if( empty( $_POST[$btn['cow']] ) ) {
|
59 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
60 |
+
wc_add_notice( $message, 'error' );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
|
66 |
+
}
|
67 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
+
}
|
70 |
+
// end cart
|
71 |
|
72 |
+
// ===========================================================================================
|
|
|
73 |
|
74 |
+
// Products
|
75 |
+
// hide field
|
76 |
+
|
77 |
+
// show field with more
|
78 |
+
if( !empty( $btn['single_px'] ) && !empty( $btn['more_content'] ) ) {
|
79 |
+
$show_field_array = explode( '||', $show_field_single );
|
80 |
+
if( array_intersect( $productsarraycm, $show_field_array ) ) {
|
81 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
82 |
+
if( empty( $_POST[$btn['cow']] ) ) {
|
83 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
84 |
+
wc_add_notice( $message, 'error' );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
|
90 |
+
// Category
|
91 |
+
// hide field
|
92 |
+
|
93 |
+
// with more
|
94 |
+
|
95 |
+
// show field with more
|
96 |
+
if( !empty( $btn['single_px_cat'] ) && !empty( $btn['more_content'] ) ) {
|
97 |
+
$show_field_array_cat = explode( '||' , $show_field_single_cat );
|
98 |
+
if( array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
99 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
100 |
+
if( empty( $_POST[$btn['cow']] ) ) {
|
101 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
102 |
+
wc_add_notice( $message, 'error' );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
$categoryarraycm = array();
|
109 |
+
$productsarraycm = array();
|
110 |
+
|
111 |
+
}
|
112 |
|
113 |
+
}
|
114 |
?>
|
includes/templates/functions/required/billing_required.php
CHANGED
@@ -1,132 +1,151 @@
|
|
1 |
<?php
|
2 |
-
function
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
-
|
28 |
-
foreach ($woocommerce->cart->cart_contents as $key => $values ) {
|
29 |
-
|
30 |
-
$multiproductsx = $btn['single_p'];
|
31 |
-
$show_field_single = $btn['single_px'];
|
32 |
-
$multiproductsx_cat = $btn['single_p_cat'];
|
33 |
-
$show_field_single_cat = $btn['single_px_cat'];
|
34 |
-
|
35 |
-
|
36 |
-
$productsarraycm[] = $values['product_id'];
|
37 |
-
|
38 |
-
// Products
|
39 |
-
// hide field
|
40 |
-
|
41 |
-
|
42 |
-
// show field without more
|
43 |
-
if ( !empty($btn['single_px']) && empty($btn['more_content']) ) {
|
44 |
-
$show_field_array = explode('||',$show_field_single);
|
45 |
-
|
46 |
-
if(in_array($values['product_id'], $show_field_array) && ( count($woocommerce->cart->cart_contents) < 2) ){
|
47 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
48 |
-
if (!$_POST['billing_'.$btn['cow'].''] ) {
|
49 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
// Category
|
58 |
-
// hide field
|
59 |
-
$terms = get_the_terms( $values['product_id'], 'product_cat' );
|
60 |
-
if ( !empty($terms) ) {
|
61 |
-
foreach ( $terms as $term ) {
|
62 |
-
|
63 |
-
$categoryarraycm[] = $term->slug;
|
64 |
-
|
65 |
-
// without more
|
66 |
|
67 |
-
//
|
68 |
-
if
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
|
|
|
|
84 |
|
85 |
// ===========================================================================================
|
86 |
-
// Products
|
87 |
-
// hide field
|
88 |
-
|
89 |
-
|
90 |
-
// show field with more
|
91 |
-
if ( !empty($btn['single_px']) && !empty($btn['more_content']) ) {
|
92 |
-
$show_field_array = explode('||',$show_field_single);
|
93 |
-
|
94 |
-
if(array_intersect($productsarraycm, $show_field_array) ){
|
95 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
96 |
-
if (!$_POST['billing_'.$btn['cow'].''] ) {
|
97 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
98 |
-
}
|
99 |
-
}
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
|
|
|
|
106 |
|
107 |
-
|
108 |
-
// hide field
|
109 |
-
|
110 |
-
// with more
|
111 |
-
|
112 |
|
113 |
-
// show field with more
|
114 |
-
if ( !empty($btn['single_px_cat']) && !empty($btn['more_content']) ) {
|
115 |
-
$show_field_array_cat = explode('||',$show_field_single_cat);
|
116 |
-
|
117 |
-
if(array_intersect($categoryarraycm, $show_field_array_cat) ){
|
118 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
119 |
-
if (!$_POST['billing_'.$btn['cow'].''] ) {
|
120 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
121 |
-
}
|
122 |
-
}
|
123 |
-
}
|
124 |
}
|
125 |
-
|
126 |
-
|
127 |
-
$categoryarraycm = '';
|
128 |
-
$productsarraycm = '';
|
129 |
-
|
130 |
-
}}}
|
131 |
-
|
132 |
?>
|
1 |
<?php
|
2 |
+
function wooccm_billing_custom_checkout_process() {
|
3 |
+
|
4 |
+
global $woocommerce;
|
5 |
+
|
6 |
+
$options = get_option( 'wccs_settings3' );
|
7 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['billing_buttons'] : array() );
|
8 |
+
|
9 |
+
// Check if we have any buttons
|
10 |
+
if( empty( $buttons ) )
|
11 |
+
return;
|
12 |
+
|
13 |
+
$categoryarraycm = array();
|
14 |
+
$productsarraycm = array();
|
15 |
+
|
16 |
+
foreach( $buttons as $btn ) {
|
17 |
+
|
18 |
+
$btn['checkbox'] = ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : false );
|
19 |
+
if( $btn['checkbox'] === 'true' ) {
|
20 |
+
// without checkbox
|
21 |
+
if(
|
22 |
+
empty( $btn['single_px_cat'] ) &&
|
23 |
+
empty( $btn['single_p_cat'] ) &&
|
24 |
+
empty( $btn['single_px'] ) &&
|
25 |
+
empty( $btn['single_p'] ) &&
|
26 |
+
empty( $btn['disabled'] ) &&
|
27 |
+
!empty( $btn['label'] ) &&
|
28 |
+
$btn['type'] !== 'changename' &&
|
29 |
+
$btn['type'] !== 'heading'
|
30 |
+
) {
|
31 |
+
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
32 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
33 |
+
wc_add_notice( $message, 'error' );
|
34 |
+
}
|
35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
+
// checkbox
|
38 |
+
if(
|
39 |
+
empty( $btn['single_px_cat'] ) &&
|
40 |
+
empty( $btn['single_p_cat'] ) &&
|
41 |
+
empty( $btn['single_px'] ) &&
|
42 |
+
empty( $btn['single_p'] ) &&
|
43 |
+
$btn['type'] == 'checkbox' &&
|
44 |
+
!empty( $btn['label'] ) &&
|
45 |
+
$btn['type'] !== 'changename' &&
|
46 |
+
$btn['type'] !== 'heading'
|
47 |
+
) {
|
48 |
+
if( ( sanitize_text_field( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) == $btn['check_2'] ) && ( !empty( $btn['checkbox'] ) ) ) {
|
49 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
50 |
+
wc_add_notice( $message, 'error');
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
foreach( $woocommerce->cart->cart_contents as $key => $values ) {
|
56 |
+
|
57 |
+
$multiproductsx = ( isset( $btn['single_p'] ) ? $btn['single_p'] : '' );
|
58 |
+
$show_field_single = ( isset( $btn['single_px'] ) ? $btn['single_px'] : '' );
|
59 |
+
$multiproductsx_cat = ( isset( $btn['single_p_cat'] ) ? $btn['single_p_cat'] : '' );
|
60 |
+
$show_field_single_cat = ( isset( $btn['single_px_cat'] ) ? $btn['single_px_cat'] : '' );
|
61 |
+
|
62 |
+
$productsarraycm[] = $values['product_id'];
|
63 |
+
|
64 |
+
// Products
|
65 |
+
// hide field
|
66 |
+
|
67 |
+
// show field without more
|
68 |
+
if( !empty( $btn['single_px'] ) && empty( $btn['more_content'] ) ) {
|
69 |
+
$show_field_array = explode( '||', $show_field_single );
|
70 |
+
if( in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
71 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
72 |
+
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
73 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
74 |
+
wc_add_notice( $message, 'error' );
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
|
80 |
+
// Category
|
81 |
+
// hide field
|
82 |
+
$terms = get_the_terms( $values['product_id'], 'product_cat' );
|
83 |
+
if( !empty( $terms ) ) {
|
84 |
+
foreach( $terms as $term ) {
|
85 |
+
|
86 |
+
$categoryarraycm[] = $term->slug;
|
87 |
+
|
88 |
+
// without more
|
89 |
+
|
90 |
+
// show field without more
|
91 |
+
if( !empty( $btn['single_px_cat'] ) && empty( $btn['more_content'] ) ) {
|
92 |
+
$show_field_array_cat = explode( '||' , $show_field_single_cat );
|
93 |
+
if( in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
94 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
95 |
+
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
96 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
97 |
+
wc_add_notice( $message, 'error' );
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
}
|
105 |
|
106 |
+
}
|
107 |
+
// end cart
|
108 |
|
109 |
// ===========================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
+
// Products
|
112 |
+
// hide field
|
113 |
+
|
114 |
+
// show field with more
|
115 |
+
if( !empty( $btn['single_px'] ) && !empty( $btn['more_content'] ) ) {
|
116 |
+
$show_field_array = explode( '||', $show_field_single );
|
117 |
+
if( array_intersect( $productsarraycm, $show_field_array ) ) {
|
118 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
119 |
+
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
120 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
121 |
+
wc_add_notice( $message, 'error' );
|
122 |
+
}
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
// Category
|
128 |
+
// hide field
|
129 |
+
|
130 |
+
// with more
|
131 |
+
|
132 |
+
// show field with more
|
133 |
+
if( !empty( $btn['single_px_cat'] ) && !empty( $btn['more_content'] ) ) {
|
134 |
+
$show_field_array_cat = explode( '||', $show_field_single_cat );
|
135 |
+
if( array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
136 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
137 |
+
if( empty( $_POST[sprintf( 'billing_%s', $btn['cow'] )] ) ) {
|
138 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
139 |
+
wc_add_notice( $message, 'error' );
|
140 |
+
}
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
|
145 |
+
$categoryarraycm = array();
|
146 |
+
$productsarraycm = array();
|
147 |
|
148 |
+
}
|
|
|
|
|
|
|
|
|
149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
?>
|
includes/templates/functions/required/shipping_required.php
CHANGED
@@ -1,135 +1,156 @@
|
|
1 |
<?php
|
2 |
-
function
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
-
|
28 |
-
foreach ($woocommerce->cart->cart_contents as $key => $values ) {
|
29 |
-
|
30 |
-
$multiproductsx = $btn['single_p'];
|
31 |
-
$show_field_single = $btn['single_px'];
|
32 |
-
$multiproductsx_cat = $btn['single_p_cat'];
|
33 |
-
$show_field_single_cat = $btn['single_px_cat'];
|
34 |
-
|
35 |
-
|
36 |
-
$productsarraycm[] = $values['product_id'];
|
37 |
-
|
38 |
-
// Products
|
39 |
-
// hide field
|
40 |
-
|
41 |
-
|
42 |
-
// show field without more
|
43 |
-
if ( !empty($btn['single_px']) && empty($btn['more_content']) ) {
|
44 |
-
$show_field_array = explode('||',$show_field_single);
|
45 |
-
|
46 |
-
if(in_array($values['product_id'], $show_field_array) && ( count($woocommerce->cart->cart_contents) < 2) ){
|
47 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
48 |
-
if (!$_POST['shipping_'.$btn['cow'].''] ) {
|
49 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
|
|
56 |
|
57 |
-
|
58 |
-
// hide field
|
59 |
-
$terms = get_the_terms( $values['product_id'], 'product_cat' );
|
60 |
-
if ( !empty($terms) ) {
|
61 |
-
foreach ( $terms as $term ) {
|
62 |
|
63 |
-
$
|
|
|
|
|
|
|
64 |
|
65 |
-
|
66 |
|
67 |
-
//
|
68 |
-
|
69 |
-
$show_field_array_cat = explode('||',$show_field_single_cat);
|
70 |
-
|
71 |
-
if(in_array($term->slug, $show_field_array_cat) && ( count($woocommerce->cart->cart_contents) < 2) ){
|
72 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
73 |
-
if (!$_POST['shipping_'.$btn['cow'].''] ) {
|
74 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
}
|
79 |
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
|
|
|
|
84 |
|
85 |
// ===========================================================================================
|
86 |
-
// Products
|
87 |
-
// hide field
|
88 |
-
|
89 |
-
|
90 |
-
// show field with more
|
91 |
-
if ( !empty($btn['single_px']) && !empty($btn['more_content']) ) {
|
92 |
-
$show_field_array = explode('||',$show_field_single);
|
93 |
-
|
94 |
-
if(array_intersect($productsarraycm, $show_field_array) ){
|
95 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
96 |
-
if (!$_POST['shipping_'.$btn['cow'].''] ) {
|
97 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
98 |
-
}
|
99 |
-
}
|
100 |
-
}
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
// Category
|
108 |
-
// hide field
|
109 |
-
|
110 |
-
// with more
|
111 |
-
|
112 |
-
|
113 |
-
// show field with more
|
114 |
-
if ( !empty($btn['single_px_cat']) && !empty($btn['more_content']) ) {
|
115 |
-
$show_field_array_cat = explode('||',$show_field_single_cat);
|
116 |
-
|
117 |
-
if(array_intersect($categoryarraycm, $show_field_array_cat) ){
|
118 |
-
if ( !empty ($btn['checkbox']) && !empty( $btn['label'] ) && ($btn['type'] !== 'changename') ) {
|
119 |
-
if (!$_POST['shipping_'.$btn['cow'].''] ) {
|
120 |
-
wc_add_notice( __( '<strong>'.wpml_string_wccm_pro($btn['label']).'</strong> is a required field.' ), 'error' );
|
121 |
-
}
|
122 |
-
}
|
123 |
-
}
|
124 |
-
}
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
-
$categoryarraycm =
|
128 |
-
$productsarraycm =
|
129 |
|
130 |
-
}
|
131 |
|
132 |
-
endif;
|
133 |
}
|
134 |
-
|
135 |
?>
|
1 |
<?php
|
2 |
+
function wooccm_shipping_custom_checkout_process() {
|
3 |
+
|
4 |
+
global $woocommerce;
|
5 |
+
|
6 |
+
$options = get_option( 'wccs_settings2' );
|
7 |
+
$buttons = ( isset( $options['buttons'] ) ? $options['shipping_buttons'] : array() );
|
8 |
+
|
9 |
+
// Check if we have any buttons
|
10 |
+
if( empty( $buttons ) )
|
11 |
+
return;
|
12 |
+
|
13 |
+
$ship_to_another_address = ( isset( $_POST['ship_to_different_address'] ) ? sanitize_text_field( $_POST['ship_to_different_address'] ) : false );
|
14 |
+
if( WC()->cart->needs_shipping_address() === false && empty( $ship_to_another_address ) )
|
15 |
+
return false;
|
16 |
+
|
17 |
+
$categoryarraycm = array();
|
18 |
+
$productsarraycm = array();
|
19 |
+
|
20 |
+
foreach( $buttons as $btn ) {
|
21 |
+
|
22 |
+
$btn['checkbox'] = ( isset( $btn['checkbox'] ) ? $btn['checkbox'] : false );
|
23 |
+
if( $btn['checkbox'] === 'true' ) {
|
24 |
+
// without checkbox
|
25 |
+
if(
|
26 |
+
empty( $btn['single_px_cat'] ) &&
|
27 |
+
empty( $btn['single_p_cat'] ) &&
|
28 |
+
empty( $btn['single_px'] ) &&
|
29 |
+
empty( $btn['single_p'] ) &&
|
30 |
+
empty( $btn['disabled'] ) &&
|
31 |
+
!empty( $btn['label'] ) &&
|
32 |
+
$btn['type'] !== 'changename' &&
|
33 |
+
$btn['type'] !== 'heading'
|
34 |
+
) {
|
35 |
+
if( empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
|
36 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
37 |
+
wc_add_notice( $message, 'error' );
|
38 |
+
}
|
39 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
+
// checkbox
|
42 |
+
if(
|
43 |
+
empty( $btn['single_px_cat'] ) &&
|
44 |
+
empty( $btn['single_p_cat'] ) &&
|
45 |
+
empty( $btn['single_px'] ) &&
|
46 |
+
empty( $btn['single_p'] ) &&
|
47 |
+
$btn['type'] == 'checkbox' &&
|
48 |
+
!empty( $btn['label'] ) &&
|
49 |
+
$btn['type'] !== 'changename' &&
|
50 |
+
$btn['type'] !== 'heading'
|
51 |
+
) {
|
52 |
+
if( ( sanitize_text_field( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) == $btn['check_2'] ) && ( !empty( $btn['checkbox'] ) ) ) {
|
53 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
54 |
+
wc_add_notice( $message, 'error');
|
55 |
+
}
|
56 |
+
}
|
57 |
|
58 |
+
}
|
59 |
|
60 |
+
foreach( $woocommerce->cart->cart_contents as $key => $values ) {
|
|
|
|
|
|
|
|
|
61 |
|
62 |
+
$multiproductsx = ( isset( $btn['single_p'] ) ? $btn['single_p'] : '' );
|
63 |
+
$show_field_single = ( isset( $btn['single_px'] ) ? $btn['single_px'] : '' );
|
64 |
+
$multiproductsx_cat = ( isset( $btn['single_p_cat'] ) ? $btn['single_p_cat'] : '' );
|
65 |
+
$show_field_single_cat = ( isset( $btn['single_px_cat'] ) ? $btn['single_px_cat'] : '' );
|
66 |
|
67 |
+
$productsarraycm[] = $values['product_id'];
|
68 |
|
69 |
+
// Products
|
70 |
+
// hide field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
+
// show field without more
|
73 |
+
if( !empty( $btn['single_px'] ) && empty( $btn['more_content'] ) ) {
|
74 |
+
$show_field_array = explode( '||', $show_field_single );
|
75 |
+
if( in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2) ) {
|
76 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
77 |
+
if( empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
|
78 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
79 |
+
wc_add_notice( $message, 'error' );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
+
}
|
84 |
|
85 |
+
// Category
|
86 |
+
// hide field
|
87 |
+
$terms = get_the_terms( $values['product_id'], 'product_cat' );
|
88 |
+
if( !empty( $terms ) ) {
|
89 |
+
foreach( $terms as $term ) {
|
90 |
+
|
91 |
+
$categoryarraycm[] = $term->slug;
|
92 |
+
|
93 |
+
// without more
|
94 |
+
|
95 |
+
// show field without more
|
96 |
+
if( !empty( $btn['single_px_cat'] ) && empty( $btn['more_content'] ) ) {
|
97 |
+
$show_field_array_cat = explode( '||', $show_field_single_cat );
|
98 |
+
if( in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
99 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
100 |
+
if( empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
|
101 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
102 |
+
wc_add_notice( $message, 'error' );
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
}
|
109 |
+
}
|
110 |
|
111 |
+
}
|
112 |
+
// end cart
|
113 |
|
114 |
// ===========================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
+
// Products
|
117 |
+
// hide field
|
118 |
+
|
119 |
+
// show field with more
|
120 |
+
if( !empty( $btn['single_px'] ) && !empty( $btn['more_content'] ) ) {
|
121 |
+
$show_field_array = explode( '||', $show_field_single );
|
122 |
+
if(array_intersect( $productsarraycm, $show_field_array ) ){
|
123 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
124 |
+
if( empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
|
125 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
126 |
+
wc_add_notice( $message, 'error' );
|
127 |
+
}
|
128 |
+
}
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
// Category
|
133 |
+
// hide field
|
134 |
+
|
135 |
+
// with more
|
136 |
+
|
137 |
+
// show field with more
|
138 |
+
if( !empty( $btn['single_px_cat'] ) && !empty( $btn['more_content'] ) ) {
|
139 |
+
$show_field_array_cat = explode( '||', $show_field_single_cat );
|
140 |
+
if( array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
141 |
+
if( !empty( $btn['checkbox'] ) && !empty( $btn['label'] ) && ( $btn['type'] !== 'changename' ) ) {
|
142 |
+
if( empty( $_POST[sprintf( 'shipping_%s', $btn['cow'] )] ) ) {
|
143 |
+
$message = sprintf( __( '%s is a required field.', 'woocommerce-checkout-manager' ), '<strong>' . wooccm_wpml_string( $btn['label'] ) . '</strong>' );
|
144 |
+
wc_add_notice( $message, 'error' );
|
145 |
+
}
|
146 |
+
}
|
147 |
+
}
|
148 |
+
}
|
149 |
|
150 |
+
$categoryarraycm = array();
|
151 |
+
$productsarraycm = array();
|
152 |
|
153 |
+
}
|
154 |
|
|
|
155 |
}
|
|
|
156 |
?>
|
includes/templates/functions/shipping_functions.php
CHANGED
@@ -6,751 +6,844 @@
|
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
-
function
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
}
|
20 |
-
echo '
|
|
|
|
|
|
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
global $woocommerce;
|
26 |
-
$options = get_option( 'wccs_settings2' );
|
27 |
-
|
28 |
-
if ( WC()->cart->needs_shipping_address() === true ) {
|
29 |
-
$saved = WC()->session->get('wooccm_retain', array() );
|
30 |
-
|
31 |
-
|
32 |
-
if( !empty($options['shipping_buttons']) ) {
|
33 |
-
foreach ( $options['shipping_buttons'] as $btn ) :
|
34 |
-
|
35 |
-
if ( $btn['type'] == 'datepicker' ) {
|
36 |
-
echo '<script type="text/javascript">jQuery(document).ready(function() { var today = new Date(); jQuery("input#shipping_'.$btn['cow'].'").datepicker({';
|
37 |
-
if ( empty($btn['format_date']) ) {
|
38 |
-
echo 'dateFormat : "dd-mm-yy",';
|
39 |
-
}
|
40 |
-
if ( !empty($btn['format_date']) ) {
|
41 |
-
echo 'dateFormat : "'.str_replace( ' ', '', $btn['format_date'] ).'",';
|
42 |
-
}
|
43 |
-
if ( !empty($btn['single_yy']) ) {
|
44 |
-
echo 'minDate: new Date( '.$btn['single_yy'].', '.$btn['single_mm'].' - 1, '.$btn['single_dd'].'),';
|
45 |
-
}
|
46 |
-
if ( !empty($btn['min_before']) ) {
|
47 |
-
echo 'minDate: '.$btn['min_before'].',';
|
48 |
-
}
|
49 |
-
if ( !empty($btn['single_max_yy']) ) {
|
50 |
-
echo 'maxDate: new Date( '.$btn['single_max_yy'].', '.$btn['single_max_mm'].' - 1, '.$btn['single_max_dd'].'),';
|
51 |
-
}
|
52 |
-
if ( !empty($btn['max_after']) ) {
|
53 |
-
echo 'maxDate: '.$btn['max_after'].',';
|
54 |
-
}
|
55 |
-
if ( !empty($btn['days_disabler']) ) {
|
56 |
-
echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
|
57 |
-
|
58 |
-
if ( !empty($btn['days_disabler0']) ) {
|
59 |
-
echo 'day == 0';
|
60 |
-
} else { echo 'day == "x"'; }
|
61 |
-
if ( !empty($btn['days_disabler1']) ) {
|
62 |
-
echo ' || day == 1';
|
63 |
-
}
|
64 |
-
if ( !empty($btn['days_disabler2']) ) {
|
65 |
-
echo ' || day == 2';
|
66 |
-
}
|
67 |
-
if ( !empty($btn['days_disabler3']) ) {
|
68 |
-
echo ' || day == 3';
|
69 |
-
}
|
70 |
-
if ( !empty($btn['days_disabler4']) ) {
|
71 |
-
echo ' || day == 4';
|
72 |
-
}
|
73 |
-
if ( !empty($btn['days_disabler5']) ) {
|
74 |
-
echo ' || day == 5';
|
75 |
-
}
|
76 |
-
if ( !empty($btn['days_disabler6']) ) {
|
77 |
-
echo '|| day == 6';
|
78 |
-
}
|
79 |
-
|
80 |
-
echo ')]; }';
|
81 |
-
}
|
82 |
-
echo '}); }); </script>';
|
83 |
-
}
|
84 |
-
|
85 |
-
|
86 |
-
if ( $btn['type'] == 'time' ) {
|
87 |
-
echo '<script type="text/javascript">jQuery(document).ready(function() { jQuery("#shipping_'.$btn['cow'].'_field input#shipping_'.$btn['cow'].'").timepicker({ showPeriod: true,';
|
88 |
-
|
89 |
-
if ( !empty($btn['start_hour']) ) {
|
90 |
-
echo 'hours: { starts: '.$btn['start_hour'].', ends: '.$btn['end_hour'].' },';
|
91 |
-
}
|
92 |
-
if ( !empty($btn['interval_min']) ) {
|
93 |
-
echo 'minutes: {interval: '.$btn['interval_min'].', manual: ['.$btn['manual_min'].'] },';
|
94 |
-
}
|
95 |
-
|
96 |
-
echo 'showLeadingZero: true }); }); </script>';
|
97 |
-
}
|
98 |
-
|
99 |
-
|
100 |
-
if ( $btn['type'] == 'password' ) {
|
101 |
-
echo '<script type="text/javascript">jQuery(document).ready(function() { jQuery("p#shipping_'.$btn['cow'].'_field").css("display"); }); </script>';
|
102 |
-
}
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
if ( $btn['type'] == 'colorpicker' && $btn['colorpickertype'] == 'farbtastic' ) { ?>
|
107 |
-
<script type="text/javascript">
|
108 |
-
jQuery(document).ready(function($) {
|
109 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
110 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#shipping_<?php echo $btn['cow']; ?>_colorpicker");
|
111 |
-
jQuery("#shipping_<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
112 |
-
|
113 |
-
});
|
114 |
-
</script>
|
115 |
-
<?php }
|
116 |
-
|
117 |
-
if ( $btn['type'] == 'colorpicker' && $btn['colorpickertype'] == 'iris' ) { ?>
|
118 |
-
<script type="text/javascript">
|
119 |
-
jQuery(document).ready(function($) {
|
120 |
-
|
121 |
-
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#fff' );
|
122 |
-
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', '<?php echo $btn['colorpickerd']; ?>' );
|
123 |
-
|
124 |
-
var options = {
|
125 |
-
wccmclass: "shipping_<?php echo $btn['cow']; ?>_colorpickerdiv",
|
126 |
-
palettes: true,
|
127 |
-
color: "",
|
128 |
-
hide: false,
|
129 |
-
change: function(event,ui){
|
130 |
-
$( '#shipping_<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#000' );
|
131 |
-
$( '#shipping_<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', ui.color.toString());
|
132 |
-
}
|
133 |
-
};
|
134 |
-
|
135 |
-
|
136 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpicker').iris( options );
|
137 |
-
|
138 |
-
jQuery('.shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
139 |
-
jQuery("#shipping_<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('.shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
140 |
-
});
|
141 |
-
</script>
|
142 |
-
<?php }
|
143 |
-
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
// ============================== radio button & checkbox ===========================================
|
147 |
-
if ( ($btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm') && !empty( $btn['tax_remove'] ) ) { ?>
|
148 |
-
<script type="text/javascript">
|
149 |
-
jQuery(document).ready(function($) {
|
150 |
-
|
151 |
-
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
152 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
153 |
-
<?php } ?>
|
154 |
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
action: 'remove_tax_wccm',
|
163 |
-
tax_remove_aj: jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val()
|
164 |
-
};
|
165 |
-
|
166 |
-
jQuery.post(ajaxurl, data, function(response) {
|
167 |
-
$( 'body' ).trigger( 'update_checkout' );
|
168 |
-
jQuery('form.checkout').unblock();
|
169 |
-
});
|
170 |
-
|
171 |
-
}); });
|
172 |
-
</script>
|
173 |
-
<?php }
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
if ( ($btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) { ?>
|
178 |
-
<script type="text/javascript">
|
179 |
-
jQuery(document).ready(function($) {
|
180 |
-
|
181 |
-
<?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
|
182 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
183 |
<?php } ?>
|
184 |
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
|
|
|
204 |
|
|
|
|
|
|
|
|
|
|
|
205 |
|
|
|
|
|
|
|
|
|
206 |
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
// =========================================== select options =========================================
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
|
|
|
213 |
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
214 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_tax_save_method']; ?>' );
|
215 |
<?php } ?>
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
<?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
|
243 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_addamount453user']; ?>' );
|
244 |
<?php } ?>
|
245 |
-
|
246 |
-
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').change(function() {
|
247 |
-
|
248 |
-
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
249 |
-
|
250 |
-
|
251 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
252 |
-
data = {
|
253 |
-
action: 'remove_tax_wccm',
|
254 |
-
add_amount_aj: jQuery('#shipping_<?php echo $btn['cow']; ?> option:selected').val()
|
255 |
-
};
|
256 |
-
|
257 |
-
jQuery.post(ajaxurl, data, function(response) {
|
258 |
-
$( 'body' ).trigger( 'update_checkout' );
|
259 |
-
jQuery('form.checkout').unblock();
|
260 |
-
});
|
261 |
-
|
262 |
-
}); });
|
263 |
-
</script>
|
264 |
-
<?php }
|
265 |
|
|
|
266 |
|
|
|
267 |
|
|
|
|
|
|
|
|
|
|
|
268 |
|
|
|
|
|
|
|
|
|
269 |
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
// =========================================== add apply button ==========================================
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
|
|
281 |
<?php if( !empty($saved['wooccm_addamount453userf']) ) { ?>
|
282 |
-
jQuery('input#shipping_<?php echo $btn['cow']; ?>').val( '<?php echo $saved['wooccm_addamount453userf']; ?>' );
|
283 |
<?php } ?>
|
284 |
|
285 |
-
|
286 |
-
|
287 |
-
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
288 |
-
|
289 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
290 |
-
data = {
|
291 |
-
action: 'remove_tax_wccm',
|
292 |
-
add_amount_faj: jQuery('input#shipping_<?php echo $btn['cow']; ?>').val()
|
293 |
-
};
|
294 |
-
|
295 |
-
jQuery.post(ajaxurl, data, function(response) {
|
296 |
-
$( 'body' ).trigger( 'update_checkout' );
|
297 |
-
jQuery('form.checkout').unblock();
|
298 |
-
});
|
299 |
-
|
300 |
-
}); });
|
301 |
-
</script>
|
302 |
-
<?php }
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
|
307 |
-
|
308 |
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
|
|
|
|
323 |
}
|
324 |
-
}
|
325 |
-
}
|
326 |
|
|
|
327 |
|
|
|
|
|
|
|
328 |
|
329 |
// --------------------------------------------------------
|
330 |
// --------------------------------------------------------
|
331 |
// --------------------------------------------------------
|
332 |
-
function shipping_override_this_wccs() {
|
333 |
-
global $woocommerce;
|
334 |
-
$options = get_option( 'wccs_settings3' );
|
335 |
-
if ( count( $options['shipping_buttons'] ) > 0 ) {
|
336 |
-
$i = 0;
|
337 |
-
|
338 |
-
// css sub-parent hide
|
339 |
-
foreach( $options['shipping_buttons'] as $btn ) {
|
340 |
-
if ( ($btn['type'] == 'text') && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
|
341 |
-
echo '<style type="text/css">#shipping_'.$btn['cow'].'_applynow {
|
342 |
-
background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
|
343 |
-
background: -webkit-linear-gradient(#ad74a2,#96588a);
|
344 |
-
background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
|
345 |
-
background: -moz-gradient(center top,#ad74a2 0,#96588a 100%);
|
346 |
-
border-color: #76456c;
|
347 |
-
color: #fff;
|
348 |
-
text-shadow: 0 -1px 0 rgba(0,0,0,.6);
|
349 |
-
width: 100%;
|
350 |
-
text-align: center;
|
351 |
-
float: right;
|
352 |
-
cursor: pointer;
|
353 |
-
position: relative;
|
354 |
-
}
|
355 |
-
#shipping_'.$btn['cow'].'_applynow:active {
|
356 |
-
top: 1px;
|
357 |
-
}
|
358 |
-
</style>';
|
359 |
-
|
360 |
-
}
|
361 |
-
if ( !empty($btn['conditional_tie']) && empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use'])) {
|
362 |
-
echo '<style type="text/css">
|
363 |
-
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
364 |
-
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
365 |
-
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field.'.$btn['conditional_tie'].' {
|
366 |
-
display: none;
|
367 |
-
}
|
368 |
-
</style>';
|
369 |
-
}
|
370 |
-
}
|
371 |
-
|
372 |
-
|
373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
375 |
// ====================== CHECKBOX =============================
|
376 |
// script when clicked show
|
377 |
// =============================================================
|
378 |
?>
|
|
|
379 |
<script type="text/javascript">
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
empty_check_add: 'none'
|
410 |
-
};
|
411 |
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
<?php }} ?>
|
422 |
-
|
423 |
-
});
|
424 |
-
<?php }}} ?>
|
425 |
-
});
|
426 |
-
</script>
|
427 |
|
428 |
<?php
|
429 |
-
|
430 |
-
|
|
|
|
|
|
|
431 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
|
|
|
|
|
433 |
|
434 |
// ====================== SELECT OPTIONS =============================
|
435 |
// script when clicked show
|
436 |
// =============================================================
|
437 |
?>
|
|
|
438 |
<script type="text/javascript">
|
439 |
jQuery(document).ready(function($){
|
440 |
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
480 |
});
|
481 |
</script>
|
482 |
|
483 |
-
|
484 |
<?php
|
|
|
485 |
// ================================ END!!! =====================================
|
486 |
// =============================================================================
|
487 |
|
488 |
-
|
489 |
-
|
490 |
// ====================== RADIO BUTTON =============================
|
491 |
// script when clicked show
|
492 |
// =============================================================
|
|
|
493 |
?>
|
|
|
494 |
<script type="text/javascript">
|
495 |
jQuery(document).ready(function($){
|
496 |
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
if ( !empty($btn['conditional_parent']) && !empty($btn['conditional_parent_use']) && !empty($btn['chosen_valt'])) { ?>
|
502 |
-
|
503 |
-
jQuery("#shipping_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input").click(function(){
|
504 |
-
|
505 |
-
<?php foreach( $options['shipping_buttons'] as $btn3 ) {
|
506 |
-
if ( empty($btn3['conditional_parent']) && !empty($btn3['conditional_parent_use']) && !empty($btn3['conditional_tie'])) { ?>
|
507 |
-
|
508 |
-
if(jQuery('#shipping_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
509 |
-
jQuery("#shipping_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").show( "slow" );
|
510 |
-
}
|
511 |
-
|
512 |
-
if(jQuery('#shipping_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
513 |
-
jQuery("#shipping_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").hide( "slow" );
|
514 |
-
|
515 |
-
<?php
|
516 |
-
if ( !empty($btn2['fee_name']) && !empty($btn2['add_amount']) ) {
|
517 |
-
?>
|
518 |
-
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
519 |
-
|
520 |
-
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
521 |
-
data = {
|
522 |
-
action: 'remove_tax_wccm',
|
523 |
-
empty_check_add: 'none'
|
524 |
-
};
|
525 |
-
|
526 |
-
jQuery.post(ajaxurl, data, function(response) {
|
527 |
-
$( 'body' ).trigger( 'update_checkout' );
|
528 |
-
jQuery('form.checkout').unblock();
|
529 |
-
});
|
530 |
-
|
531 |
-
<?php } ?>
|
532 |
-
|
533 |
-
}
|
534 |
-
|
535 |
-
<?php }} ?>
|
536 |
-
|
537 |
-
});
|
538 |
-
<?php }}} ?>
|
539 |
-
});
|
540 |
-
</script>
|
541 |
|
|
|
|
|
542 |
|
|
|
543 |
|
544 |
<?php
|
545 |
-
|
546 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
|
|
|
548 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
|
550 |
// ----------------------------- CLEAR ---------------------------------
|
551 |
// ---------------------------------------------------------------------
|
552 |
// ---------------------------------------------------------------------
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
+
function wooccm_shipping_hide_required() {
|
10 |
+
|
11 |
+
global $woocommerce;
|
12 |
+
|
13 |
+
$options = get_option( 'wccs_settings2' );
|
14 |
+
|
15 |
+
$billing = array(
|
16 |
+
'address_1',
|
17 |
+
'address_2',
|
18 |
+
'city',
|
19 |
+
'state',
|
20 |
+
'postcode'
|
21 |
+
);
|
22 |
+
|
23 |
+
if( !empty( $options['shipping_buttons'] ) ) {
|
24 |
+
echo '
|
25 |
+
<style>
|
26 |
+
';
|
27 |
+
foreach( $options['shipping_buttons'] as $btn ) {
|
28 |
+
if( in_array($btn['cow'], $billing) && empty($btn['checkbox']) ) {
|
29 |
+
echo '
|
30 |
+
p#shipping_'.$btn['cow'].'_field .required{
|
31 |
+
display:none;
|
32 |
+
}';
|
33 |
}
|
34 |
}
|
35 |
+
echo '
|
36 |
+
</style>';
|
37 |
+
}
|
38 |
+
|
39 |
}
|
40 |
|
41 |
+
function wooccm_shipping_scripts() {
|
42 |
+
|
43 |
+
global $woocommerce;
|
44 |
+
|
45 |
+
$options = get_option( 'wccs_settings2' );
|
46 |
+
|
47 |
+
if ( WC()->cart->needs_shipping_address() !== true )
|
48 |
+
return;
|
49 |
|
50 |
+
$saved = WC()->session->get( 'wooccm_retain', array() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
+
// Check if we have any buttons
|
53 |
+
if( empty($options['shipping_buttons']) )
|
54 |
+
return;
|
55 |
+
|
56 |
+
foreach ( $options['shipping_buttons'] as $btn ) {
|
57 |
+
|
58 |
+
if( $btn['type'] == 'datepicker' ) {
|
59 |
+
echo '
|
60 |
+
<script type="text/javascript">
|
61 |
+
jQuery(document).ready(function() {
|
62 |
+
var today = new Date();
|
63 |
+
if( jQuery.isFunction(jQuery.fn.datepicker) ) {
|
64 |
+
jQuery("input#shipping_'.$btn['cow'].'").datepicker({
|
65 |
+
';
|
66 |
+
if( empty($btn['format_date']) ) {
|
67 |
+
echo 'dateFormat : "dd-mm-yy",';
|
68 |
+
}
|
69 |
+
if( !empty($btn['format_date']) ) {
|
70 |
+
echo 'dateFormat : "'.str_replace( ' ', '', $btn['format_date'] ).'",';
|
71 |
+
}
|
72 |
+
if( !empty($btn['single_yy']) ) {
|
73 |
+
echo 'minDate: new Date( '.$btn['single_yy'].', '.$btn['single_mm'].' - 1, '.$btn['single_dd'].'),';
|
74 |
+
}
|
75 |
+
if( !empty($btn['min_before']) ) {
|
76 |
+
echo 'minDate: '.$btn['min_before'].',';
|
77 |
+
}
|
78 |
+
if( !empty($btn['single_max_yy']) ) {
|
79 |
+
echo 'maxDate: new Date( '.$btn['single_max_yy'].', '.$btn['single_max_mm'].' - 1, '.$btn['single_max_dd'].'),';
|
80 |
+
}
|
81 |
+
if( !empty($btn['max_after']) ) {
|
82 |
+
echo 'maxDate: '.$btn['max_after'].',';
|
83 |
+
}
|
84 |
+
if( !empty($btn['days_disabler']) ) {
|
85 |
+
echo 'beforeShowDay: function(date) { var day = date.getDay(); return [(';
|
86 |
+
if( !empty($btn['days_disabler0']) ) {
|
87 |
+
echo 'day == 0';
|
88 |
+
} else { echo 'day == "x"'; }
|
89 |
+
if( !empty($btn['days_disabler1']) ) {
|
90 |
+
echo ' || day == 1';
|
91 |
+
}
|
92 |
+
if( !empty($btn['days_disabler2']) ) {
|
93 |
+
echo ' || day == 2';
|
94 |
+
}
|
95 |
+
if( !empty($btn['days_disabler3']) ) {
|
96 |
+
echo ' || day == 3';
|
97 |
+
}
|
98 |
+
if( !empty($btn['days_disabler4']) ) {
|
99 |
+
echo ' || day == 4';
|
100 |
+
}
|
101 |
+
if( !empty($btn['days_disabler5']) ) {
|
102 |
+
echo ' || day == 5';
|
103 |
+
}
|
104 |
+
if( !empty($btn['days_disabler6']) ) {
|
105 |
+
echo '|| day == 6';
|
106 |
+
}
|
107 |
+
echo ')]; }';
|
108 |
+
}
|
109 |
+
do_action( 'wooccm_js_datepicker_shipping_args', $btn );
|
110 |
+
echo '
|
111 |
+
});
|
112 |
+
}
|
113 |
+
});
|
114 |
+
</script>
|
115 |
+
';
|
116 |
+
}
|
117 |
+
|
118 |
+
if( $btn['type'] == 'time' ) {
|
119 |
+
$args = '
|
120 |
+
showPeriod: true,';
|
121 |
+
if( !empty($btn['start_hour']) ) {
|
122 |
+
$args .= '
|
123 |
+
hours: { starts: '.$btn['start_hour'].', ends: '.$btn['end_hour'].' },';
|
124 |
+
}
|
125 |
+
if( !empty($btn['interval_min']) ) {
|
126 |
+
$args .= '
|
127 |
+
minutes: {interval: '.$btn['interval_min'].', manual: ['.$btn['manual_min'].'] },';
|
128 |
+
}
|
129 |
+
$args .= '
|
130 |
+
showLeadingZero: true';
|
131 |
+
$args = apply_filters( 'wooccm_timepicker_jquery_args', $args, $btn );
|
132 |
+
echo '
|
133 |
+
<!-- Shipping section: TimePicker -->
|
134 |
+
<script type="text/javascript">
|
135 |
+
jQuery(document).ready(function() {
|
136 |
+
if( jQuery.isFunction(jQuery.fn.timepicker) ) {
|
137 |
+
jQuery("#shipping_'.$btn['cow'].'_field input#shipping_'.$btn['cow'].'").timepicker({
|
138 |
+
';
|
139 |
+
echo $args;
|
140 |
+
echo '
|
141 |
+
});
|
142 |
+
}
|
143 |
+
});
|
144 |
+
</script>
|
145 |
+
';
|
146 |
+
}
|
147 |
+
|
148 |
+
if ( $btn['type'] == 'password' ) {
|
149 |
+
echo '
|
150 |
+
<script type="text/javascript">
|
151 |
+
jQuery(document).ready(function() {
|
152 |
+
jQuery("p#shipping_'.$btn['cow'].'_field").css("display");
|
153 |
+
});
|
154 |
+
</script>
|
155 |
+
';
|
156 |
+
}
|
157 |
+
|
158 |
+
if( $btn['type'] == 'colorpicker' ) {
|
159 |
+
switch( $btn['colorpickertype'] ) {
|
160 |
+
|
161 |
+
case 'farbtastic':
|
162 |
+
?>
|
163 |
+
<script type="text/javascript">
|
164 |
+
jQuery(document).ready(function($) {
|
165 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
166 |
+
if( jQuery.isFunction(jQuery.fn.farbtastic) ) {
|
167 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').farbtastic("#shipping_<?php echo $btn['cow']; ?>_colorpicker");
|
168 |
+
jQuery("#shipping_<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
169 |
+
}
|
170 |
+
});
|
171 |
+
</script>
|
172 |
+
<?php
|
173 |
+
break;
|
174 |
+
|
175 |
+
case 'iris':
|
176 |
+
?>
|
177 |
+
<script type="text/javascript">
|
178 |
+
jQuery(document).ready(function($) {
|
179 |
+
|
180 |
+
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#fff' );
|
181 |
+
$( '#<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', '<?php echo $btn['colorpickerd']; ?>' );
|
182 |
+
|
183 |
+
var options = {
|
184 |
+
wccmclass: "shipping_<?php echo $btn['cow']; ?>_colorpickerdiv",
|
185 |
+
palettes: true,
|
186 |
+
color: "",
|
187 |
+
hide: false,
|
188 |
+
change: function(event,ui){
|
189 |
+
$( '#shipping_<?php echo $btn['cow']; ?>_colorpicker' ).css( 'color', '#000' );
|
190 |
+
$( '#shipping_<?php echo $btn['cow']; ?>_colorpicker' ).css( 'background', ui.color.toString());
|
191 |
+
}
|
192 |
+
};
|
193 |
+
|
194 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_colorpicker').iris( options );
|
195 |
+
jQuery('.shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').hide();
|
196 |
+
jQuery("#shipping_<?php echo $btn['cow']; ?>_colorpicker").click(function(){jQuery('.shipping_<?php echo $btn['cow']; ?>_colorpickerdiv').slideToggle()});
|
197 |
+
|
198 |
+
});
|
199 |
+
</script>
|
200 |
+
<?php
|
201 |
+
break;
|
202 |
+
|
203 |
+
}
|
204 |
+
}
|
205 |
|
206 |
// ============================== radio button & checkbox ===========================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
+
if( ( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty( $btn['tax_remove'] ) ) {
|
209 |
+
?>
|
210 |
+
<script type="text/javascript">
|
211 |
+
jQuery(document).ready(function($) {
|
212 |
+
|
213 |
+
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
214 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
<?php } ?>
|
216 |
|
217 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_field input').click(function() {
|
218 |
+
|
219 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
220 |
+
|
221 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
222 |
+
data = {
|
223 |
+
action: 'remove_tax_wccm',
|
224 |
+
tax_remove_aj: jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val()
|
225 |
+
};
|
226 |
+
|
227 |
+
jQuery.post(ajaxurl, data, function(response) {
|
228 |
+
$( 'body' ).trigger( 'update_checkout' );
|
229 |
+
jQuery('form.checkout').unblock();
|
230 |
+
});
|
231 |
+
|
232 |
+
});
|
233 |
+
});
|
234 |
+
</script>
|
235 |
+
<?php
|
236 |
+
}
|
237 |
+
|
238 |
+
if( ( $btn['type'] == 'wooccmradio' || $btn['type'] == 'checkbox_wccm' ) && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) {
|
239 |
+
?>
|
240 |
+
<script type="text/javascript">
|
241 |
+
jQuery(document).ready(function($) {
|
242 |
+
|
243 |
+
<?php if( !empty($saved['wooccm_addamount453user']) ) { ?>
|
244 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]').prop("checked", true);
|
245 |
+
<?php } ?>
|
246 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_field input').click(function() {
|
247 |
|
248 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
249 |
|
250 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
251 |
+
data = {
|
252 |
+
action: 'remove_tax_wccm',
|
253 |
+
add_amount_aj: jQuery('#shipping_<?php echo $btn['cow']; ?>_field input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val()
|
254 |
+
};
|
255 |
|
256 |
+
jQuery.post(ajaxurl, data, function(response) {
|
257 |
+
$( 'body' ).trigger( 'update_checkout' );
|
258 |
+
jQuery('form.checkout').unblock();
|
259 |
+
});
|
260 |
|
261 |
+
});
|
262 |
+
});
|
263 |
+
</script>
|
264 |
+
<?php
|
265 |
+
}
|
266 |
|
267 |
// =========================================== select options =========================================
|
268 |
+
|
269 |
+
if( $btn['type'] == 'wooccmselect' && !empty( $btn['tax_remove'] ) ) {
|
270 |
+
?>
|
271 |
+
<script type="text/javascript">
|
272 |
+
jQuery(document).ready(function($) {
|
273 |
+
|
274 |
<?php if( !empty($saved['wooccm_tax_save_method']) ) { ?>
|
275 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_tax_save_method']; ?>' );
|
276 |
<?php } ?>
|
277 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').change(function() {
|
278 |
+
|
279 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
280 |
+
|
281 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
282 |
+
data = {
|
283 |
+
action: 'remove_tax_wccm',
|
284 |
+
tax_remove_aj: jQuery('#shipping_<?php echo $btn['cow']; ?> option:selected').val()
|
285 |
+
};
|
286 |
+
|
287 |
+
jQuery.post(ajaxurl, data, function(response) {
|
288 |
+
$( 'body' ).trigger( 'update_checkout' );
|
289 |
+
jQuery('form.checkout').unblock();
|
290 |
+
});
|
291 |
+
|
292 |
+
});
|
293 |
+
});
|
294 |
+
</script>
|
295 |
+
<?php
|
296 |
+
}
|
297 |
+
|
298 |
+
if( $btn['type'] == 'wooccmselect' && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && !empty( $btn['add_amount_field'] ) ) {
|
299 |
+
?>
|
300 |
+
<script type="text/javascript">
|
301 |
+
jQuery(document).ready(function($) {
|
302 |
+
|
303 |
+
<?php if( !empty( $saved['wooccm_addamount453user'] ) ) { ?>
|
304 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').val( '<?php echo $saved['wooccm_addamount453user']; ?>' );
|
305 |
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
|
307 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_field select').change(function() {
|
308 |
|
309 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
310 |
|
311 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
312 |
+
data = {
|
313 |
+
action: 'remove_tax_wccm',
|
314 |
+
add_amount_aj: jQuery('#shipping_<?php echo $btn['cow']; ?> option:selected').val()
|
315 |
+
};
|
316 |
|
317 |
+
jQuery.post(ajaxurl, data, function(response) {
|
318 |
+
$( 'body' ).trigger( 'update_checkout' );
|
319 |
+
jQuery('form.checkout').unblock();
|
320 |
+
});
|
321 |
|
322 |
+
});
|
323 |
+
});
|
324 |
+
</script>
|
325 |
+
<?php
|
326 |
+
}
|
327 |
|
328 |
// =========================================== add apply button ==========================================
|
329 |
|
330 |
+
if( $btn['type'] == 'text' && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
|
331 |
+
?>
|
332 |
+
<script type="text/javascript">
|
333 |
+
jQuery(document).ready(function() {
|
334 |
+
jQuery( "#shipping_<?php echo $btn['cow']; ?>_field" ).append( '<span id="shipping_<?php echo $btn['cow']; ?>_applynow"><?php _e('Apply','woocommerce-checkout-manager'); ?></span>' );
|
335 |
+
});
|
336 |
+
|
337 |
+
jQuery(document).ready(function($) {
|
338 |
+
|
339 |
<?php if( !empty($saved['wooccm_addamount453userf']) ) { ?>
|
340 |
+
jQuery('input#shipping_<?php echo $btn['cow']; ?>').val( '<?php echo $saved['wooccm_addamount453userf']; ?>' );
|
341 |
<?php } ?>
|
342 |
|
343 |
+
jQuery('#shipping_<?php echo $btn['cow']; ?>_field #shipping_<?php echo $btn['cow']; ?>_applynow').click(function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
|
345 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
346 |
|
347 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
348 |
+
data = {
|
349 |
+
action: 'remove_tax_wccm',
|
350 |
+
add_amount_faj: jQuery('input#shipping_<?php echo $btn['cow']; ?>').val()
|
351 |
+
};
|
352 |
+
|
353 |
+
jQuery.post(ajaxurl, data, function(response) {
|
354 |
+
$( 'body' ).trigger( 'update_checkout' );
|
355 |
+
jQuery('form.checkout').unblock();
|
356 |
+
});
|
357 |
+
|
358 |
+
});
|
359 |
+
|
360 |
+
});
|
361 |
+
</script>
|
362 |
+
<?php
|
363 |
}
|
|
|
|
|
364 |
|
365 |
+
// =====================================================
|
366 |
|
367 |
+
}
|
368 |
+
|
369 |
+
}
|
370 |
|
371 |
// --------------------------------------------------------
|
372 |
// --------------------------------------------------------
|
373 |
// --------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
375 |
+
function wooccm_shipping_override_this() {
|
376 |
+
|
377 |
+
global $woocommerce;
|
378 |
+
|
379 |
+
$options = get_option( 'wccs_settings3' );
|
380 |
+
|
381 |
+
$options['shipping_buttons'] = ( isset( $options['shipping_buttons'] ) ? $options['shipping_buttons'] : array() );
|
382 |
+
|
383 |
+
// Check if there are any buttons
|
384 |
+
if ( count( $options['shipping_buttons'] ) == 0 )
|
385 |
+
return;
|
386 |
+
|
387 |
+
$i = 0;
|
388 |
+
|
389 |
+
// css sub-parent hide
|
390 |
+
foreach( $options['shipping_buttons'] as $btn ) {
|
391 |
+
if( $btn['type'] == 'text' && !empty( $btn['add_amount'] ) && !empty( $btn['fee_name'] ) && empty( $btn['add_amount_field'] ) ) {
|
392 |
+
echo '
|
393 |
+
<style type="text/css">
|
394 |
+
#shipping_'.$btn['cow'].'_applynow {
|
395 |
+
background: -webkit-gradient(linear,left top,left bottom,from(#ad74a2),to(#96588a));
|
396 |
+
background: -webkit-linear-gradient(#ad74a2,#96588a);
|
397 |
+
background: -moz-linear-gradient(center top,#ad74a2 0,#96588a 100%);
|
398 |
+
background: -moz-gradient(center top,#ad74a2 0,#96588a 100%);
|
399 |
+
border-color: #76456c;
|
400 |
+
color: #fff;
|
401 |
+
text-shadow: 0 -1px 0 rgba(0,0,0,.6);
|
402 |
+
width: 100%;
|
403 |
+
text-align: center;
|
404 |
+
float: right;
|
405 |
+
cursor: pointer;
|
406 |
+
position: relative;
|
407 |
+
}
|
408 |
+
#shipping_'.$btn['cow'].'_applynow:active {
|
409 |
+
top: 1px;
|
410 |
+
}
|
411 |
+
</style>';
|
412 |
+
}
|
413 |
+
if( !empty( $btn['conditional_tie'] ) && empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) ) {
|
414 |
+
echo '
|
415 |
+
<style type="text/css">
|
416 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
417 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field.'.$btn['conditional_tie'].',
|
418 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field.'.$btn['conditional_tie'].' {
|
419 |
+
display: none;
|
420 |
+
}
|
421 |
+
</style>';
|
422 |
+
}
|
423 |
+
}
|
424 |
|
425 |
// ====================== CHECKBOX =============================
|
426 |
// script when clicked show
|
427 |
// =============================================================
|
428 |
?>
|
429 |
+
<!-- Shipping section: Checkbox -->
|
430 |
<script type="text/javascript">
|
431 |
+
jQuery(document).ready(function($){
|
432 |
+
<?php
|
433 |
+
foreach( $options['shipping_buttons'] as $btn ) {
|
434 |
+
if( $btn['type'] == 'checkbox_wccm' ) {
|
435 |
+
|
436 |
+
if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
|
437 |
+
?>
|
438 |
+
|
439 |
+
jQuery("#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]").click(function(){
|
440 |
+
|
441 |
+
<?php
|
442 |
+
foreach( $options['shipping_buttons'] as $btn3 ) {
|
443 |
+
if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
|
444 |
+
?>
|
445 |
+
if(jQuery('#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
446 |
+
jQuery("#shipping_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
|
447 |
+
}
|
448 |
+
if(jQuery('#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
449 |
+
jQuery("#shipping_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
|
450 |
+
|
451 |
+
<?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
|
452 |
+
|
453 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
454 |
+
|
455 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
456 |
+
data = {
|
457 |
+
action: 'remove_tax_wccm',
|
458 |
+
empty_check_add: 'none'
|
459 |
+
};
|
|
|
|
|
460 |
|
461 |
+
jQuery.post(ajaxurl, data, function(response) {
|
462 |
+
$( 'body' ).trigger( 'update_checkout' );
|
463 |
+
jQuery('form.checkout').unblock();
|
464 |
+
});
|
465 |
+
|
466 |
+
<?php } ?>
|
467 |
+
|
468 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
469 |
|
470 |
<?php
|
471 |
+
}
|
472 |
+
}
|
473 |
+
?>
|
474 |
+
|
475 |
+
});
|
476 |
|
477 |
+
<?php
|
478 |
+
}
|
479 |
+
}
|
480 |
+
}
|
481 |
+
?>
|
482 |
+
});
|
483 |
+
</script>
|
484 |
+
<?php
|
485 |
|
486 |
+
// ================================ END!!! =====================================
|
487 |
+
// =============================================================================
|
488 |
|
489 |
// ====================== SELECT OPTIONS =============================
|
490 |
// script when clicked show
|
491 |
// =============================================================
|
492 |
?>
|
493 |
+
<!-- Shipping section: Select options -->
|
494 |
<script type="text/javascript">
|
495 |
jQuery(document).ready(function($){
|
496 |
|
497 |
+
<?php
|
498 |
+
foreach( $options['shipping_buttons'] as $btn ) {
|
499 |
+
if( $btn['type'] == 'wooccmselect' ) {
|
500 |
+
|
501 |
+
if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
|
502 |
+
?>
|
503 |
+
|
504 |
+
jQuery("#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> select").change(function(){
|
505 |
+
|
506 |
+
<?php
|
507 |
+
foreach( $options['shipping_buttons'] as $btn3 ) {
|
508 |
+
if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
|
509 |
+
?>
|
510 |
+
|
511 |
+
if(jQuery('#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #shipping_' . $btn['cow']; ?> option:selected').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
512 |
+
jQuery("#shipping_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").show( "slow" );
|
513 |
+
}
|
514 |
+
|
515 |
+
if(jQuery('#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie'] . ' #shipping_' . $btn['cow']; ?> option:selected').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
516 |
+
jQuery("#shipping_<?php echo $btn3['cow'] . '_field.' . $btn['conditional_tie']; ?>").hide( "slow" );
|
517 |
+
|
518 |
+
<?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
|
519 |
+
|
520 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
521 |
+
|
522 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
523 |
+
data = {
|
524 |
+
action: 'remove_tax_wccm',
|
525 |
+
empty_check_add: 'none'
|
526 |
+
};
|
527 |
+
|
528 |
+
jQuery.post(ajaxurl, data, function(response) {
|
529 |
+
$( 'body' ).trigger( 'update_checkout' );
|
530 |
+
jQuery('form.checkout').unblock();
|
531 |
+
});
|
532 |
+
|
533 |
+
<?php } ?>
|
534 |
+
}
|
535 |
+
<?php
|
536 |
+
}
|
537 |
+
}
|
538 |
+
?>
|
539 |
+
});
|
540 |
+
<?php
|
541 |
+
}
|
542 |
+
}
|
543 |
+
}
|
544 |
+
?>
|
545 |
});
|
546 |
</script>
|
547 |
|
|
|
548 |
<?php
|
549 |
+
|
550 |
// ================================ END!!! =====================================
|
551 |
// =============================================================================
|
552 |
|
|
|
|
|
553 |
// ====================== RADIO BUTTON =============================
|
554 |
// script when clicked show
|
555 |
// =============================================================
|
556 |
+
|
557 |
?>
|
558 |
+
<!-- Shipping section: Radio buttons -->
|
559 |
<script type="text/javascript">
|
560 |
jQuery(document).ready(function($){
|
561 |
|
562 |
+
<?php
|
563 |
+
foreach( $options['shipping_buttons'] as $btn ) {
|
564 |
+
if( $btn['type'] == 'wooccmradio' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
|
566 |
+
if( !empty( $btn['conditional_parent'] ) && !empty( $btn['conditional_parent_use'] ) && !empty( $btn['chosen_valt'] ) ) {
|
567 |
+
?>
|
568 |
|
569 |
+
jQuery("#shipping_<?php echo $btn['cow'] . '_field.' . $btn['conditional_tie']; ?> input").click(function(){
|
570 |
|
571 |
<?php
|
572 |
+
foreach( $options['shipping_buttons'] as $btn3 ) {
|
573 |
+
if( empty( $btn3['conditional_parent'] ) && !empty( $btn3['conditional_parent_use'] ) && !empty( $btn3['conditional_tie'] ) ) {
|
574 |
+
?>
|
575 |
+
|
576 |
+
if(jQuery('#shipping_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val() === '<?php echo $btn3['chosen_valt']; ?>' ) {
|
577 |
+
jQuery("#shipping_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").show( "slow" );
|
578 |
+
}
|
579 |
+
|
580 |
+
if(jQuery('#shipping_<?php echo ''.$btn['cow'].'_field.'.$btn['conditional_tie']; ?> input[name=shipping_<?php echo $btn['cow']; ?>]:checked').val() !== '<?php echo $btn3['chosen_valt']; ?>' ) {
|
581 |
+
jQuery("#shipping_<?php echo ''.$btn3['cow'].'_field.'.$btn['conditional_tie']; ?>").hide( "slow" );
|
582 |
+
|
583 |
+
<?php if( !empty( $btn2['fee_name'] ) && !empty( $btn2['add_amount'] ) ) { ?>
|
584 |
|
585 |
+
$( 'form.checkout' ).block({ message: null, overlayCSS: { background: '#fff url(' + wc_checkout_params.ajax_loader_url + ') no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
586 |
|
587 |
+
var ajaxurl = '<?php echo admin_url('/admin-ajax.php'); ?>';
|
588 |
+
data = {
|
589 |
+
action: 'remove_tax_wccm',
|
590 |
+
empty_check_add: 'none'
|
591 |
+
};
|
592 |
+
|
593 |
+
jQuery.post(ajaxurl, data, function(response) {
|
594 |
+
$( 'body' ).trigger( 'update_checkout' );
|
595 |
+
jQuery('form.checkout').unblock();
|
596 |
+
});
|
597 |
+
|
598 |
+
<?php } ?>
|
599 |
+
|
600 |
+
}
|
601 |
+
|
602 |
+
<?php
|
603 |
+
}
|
604 |
+
}
|
605 |
+
?>
|
606 |
+
|
607 |
+
});
|
608 |
+
<?php
|
609 |
+
}
|
610 |
+
}
|
611 |
+
}
|
612 |
+
?>
|
613 |
+
});
|
614 |
+
</script>
|
615 |
+
|
616 |
+
<?php
|
617 |
+
|
618 |
+
// ================================ END!!! =====================================
|
619 |
+
// =============================================================================
|
620 |
|
621 |
// ----------------------------- CLEAR ---------------------------------
|
622 |
// ---------------------------------------------------------------------
|
623 |
// ---------------------------------------------------------------------
|
624 |
+
|
625 |
+
$categoryarraycm = '';
|
626 |
+
$productsarraycm = '';
|
627 |
+
|
628 |
+
foreach( $options['shipping_buttons'] as $btn ) {
|
629 |
+
foreach( $woocommerce->cart->cart_contents as $key => $values ) {
|
630 |
+
|
631 |
+
$multiproductsx = $btn['single_p'];
|
632 |
+
$show_field_single = $btn['single_px'];
|
633 |
+
$multiproductsx_cat = $btn['single_p_cat'];
|
634 |
+
$show_field_single_cat = $btn['single_px_cat'];
|
635 |
+
|
636 |
+
$productsarraycm[] = $values['product_id'];
|
637 |
+
|
638 |
+
// Products
|
639 |
+
// hide field
|
640 |
+
|
641 |
+
// without more
|
642 |
+
if( !empty( $btn['single_p'] ) && empty( $btn['more_content'] ) ) {
|
643 |
+
|
644 |
+
$multiarrayproductsx = explode( ',', $multiproductsx );
|
645 |
+
|
646 |
+
if( in_array( $values['product_id'], $multiarrayproductsx ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
647 |
+
echo '
|
648 |
+
<style type="text/css">
|
649 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
650 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
651 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
652 |
+
display: none;
|
653 |
+
}
|
654 |
+
</style>';
|
655 |
+
}
|
656 |
+
}
|
657 |
+
|
658 |
+
// show field without more
|
659 |
+
if( !empty( $btn['single_px'] ) && empty( $btn['more_content'] ) ) {
|
660 |
+
|
661 |
+
$show_field_array = explode( '||', $show_field_single );
|
662 |
+
|
663 |
+
if( in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
664 |
+
echo '
|
665 |
+
<style type="text/css">
|
666 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
667 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
668 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
669 |
+
display: inline-block;
|
670 |
+
}
|
671 |
+
</style>';
|
672 |
+
}
|
673 |
+
|
674 |
+
if( !in_array( $values['product_id'], $show_field_array ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
675 |
+
echo '
|
676 |
+
<style type="text/css">
|
677 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
678 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
679 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
680 |
+
display: none;
|
681 |
+
}
|
682 |
+
</style>';
|
683 |
+
}
|
684 |
+
}
|
685 |
+
|
686 |
+
// Category
|
687 |
+
// hide field
|
688 |
+
$terms = get_the_terms( $values['product_id'], 'product_cat' );
|
689 |
+
if( !empty($terms) ) {
|
690 |
+
foreach( $terms as $term ) {
|
691 |
+
|
692 |
+
$categoryarraycm[] = $term->slug;
|
693 |
+
|
694 |
+
// without more
|
695 |
+
|
696 |
+
if( !empty( $btn['single_p_cat'] ) && empty( $btn['more_content'] ) ) {
|
697 |
+
|
698 |
+
$multiarrayproductsx_cat = explode( ',', $multiproductsx_cat );
|
699 |
+
|
700 |
+
if( in_array( $term->slug, $multiarrayproductsx_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
701 |
+
echo '
|
702 |
+
<style type="text/css">
|
703 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
704 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
705 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
706 |
+
display: none;
|
707 |
+
}
|
708 |
+
</style>';
|
709 |
+
}
|
710 |
+
}
|
711 |
+
|
712 |
+
// show field without more
|
713 |
+
if( !empty( $btn['single_px_cat'] ) && empty( $btn['more_content'] ) ) {
|
714 |
+
|
715 |
+
$show_field_array_cat = explode('||',$show_field_single_cat);
|
716 |
+
|
717 |
+
if( in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
718 |
+
echo '
|
719 |
+
<style type="text/css">
|
720 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
721 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
722 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
723 |
+
display: inline-block;
|
724 |
+
}
|
725 |
+
</style>';
|
726 |
+
}
|
727 |
+
|
728 |
+
if( !in_array( $term->slug, $show_field_array_cat ) && ( count( $woocommerce->cart->cart_contents ) < 2 ) ) {
|
729 |
+
echo '
|
730 |
+
<style type="text/css">
|
731 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
732 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
733 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
734 |
+
display: none;
|
735 |
+
}
|
736 |
+
</style>';
|
737 |
+
}
|
738 |
+
}
|
739 |
+
|
740 |
+
}
|
741 |
+
}
|
742 |
+
}
|
743 |
+
// end cart
|
744 |
+
|
745 |
+
// ===========================================================================================
|
746 |
+
|
747 |
+
// Products
|
748 |
+
// hide field
|
749 |
+
|
750 |
+
// with more
|
751 |
+
if( !empty( $btn['single_p'] ) && !empty( $btn['more_content'] ) ) {
|
752 |
+
|
753 |
+
$multiarrayproductsx = explode( ',', $multiproductsx );
|
754 |
+
|
755 |
+
if( array_intersect( $productsarraycm, $multiarrayproductsx ) ) {
|
756 |
+
echo '
|
757 |
+
<style type="text/css">
|
758 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
759 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
760 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
761 |
+
display: none;
|
762 |
+
}
|
763 |
+
</style>';
|
764 |
+
}
|
765 |
+
}
|
766 |
+
|
767 |
+
// show field with more
|
768 |
+
if( !empty( $btn['single_px'] ) && !empty( $btn['more_content'] ) ) {
|
769 |
+
|
770 |
+
$show_field_array = explode( '||', $show_field_single );
|
771 |
+
|
772 |
+
if( array_intersect( $productsarraycm, $show_field_array ) ) {
|
773 |
+
echo '
|
774 |
+
<style type="text/css">
|
775 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
776 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
777 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
778 |
+
display: inline-block;
|
779 |
+
}
|
780 |
+
</style>';
|
781 |
+
}
|
782 |
+
|
783 |
+
if( !array_intersect( $productsarraycm, $show_field_array ) ) {
|
784 |
+
echo '
|
785 |
+
<style type="text/css">
|
786 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
787 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
788 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
789 |
+
display: none;
|
790 |
+
}
|
791 |
+
</style>';
|
792 |
+
}
|
793 |
+
}
|
794 |
+
|
795 |
+
// Category
|
796 |
+
// hide field
|
797 |
+
|
798 |
+
// with more
|
799 |
+
if( !empty( $btn['single_p_cat'] ) && !empty( $btn['more_content'] ) ) {
|
800 |
+
|
801 |
+
$multiarrayproductsx_cat = explode( ',', $multiproductsx_cat );
|
802 |
+
|
803 |
+
if( array_intersect( $categoryarraycm, $multiarrayproductsx_cat ) ) {
|
804 |
+
echo '
|
805 |
+
<style type="text/css">
|
806 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
807 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
808 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
809 |
+
display: none;
|
810 |
+
}
|
811 |
+
</style>';
|
812 |
+
}
|
813 |
+
}
|
814 |
+
|
815 |
+
// show field with more
|
816 |
+
if( !empty( $btn['single_px_cat'] ) && !empty( $btn['more_content'] ) ) {
|
817 |
+
|
818 |
+
$show_field_array_cat = explode( '||', $show_field_single_cat );
|
819 |
+
|
820 |
+
if( array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
821 |
+
echo '
|
822 |
+
<style type="text/css">
|
823 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
824 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
825 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
826 |
+
display: inline-block;
|
827 |
+
}
|
828 |
+
</style>';
|
829 |
+
}
|
830 |
+
|
831 |
+
if( !array_intersect( $categoryarraycm, $show_field_array_cat ) ) {
|
832 |
+
echo '
|
833 |
+
<style type="text/css">
|
834 |
+
.woocommerce form #customer_details #shipping_'.$btn['cow'].'_field,
|
835 |
+
.woocommerce-page form #customer_details #shipping_'.$btn['cow'].'_field,
|
836 |
+
.woocommerce form.checkout #shipping_'.$btn['cow'].'_field {
|
837 |
+
display: none;
|
838 |
+
}
|
839 |
+
</style>';
|
840 |
+
}
|
841 |
+
}
|
842 |
+
|
843 |
+
$categoryarraycm = '';
|
844 |
+
$productsarraycm = '';
|
845 |
+
|
846 |
+
} // btn cut
|
847 |
+
|
848 |
+
}
|
849 |
+
?>
|
includes/templates/functions/shipping_wooccmupload.php
CHANGED
@@ -6,147 +6,157 @@
|
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
-
function
|
10 |
-
global $woocommerce;
|
11 |
-
$options = get_option( 'wccs_settings2' );
|
12 |
-
|
13 |
-
if ( WC()->cart->needs_shipping_address() === true ) {
|
14 |
-
$saved = WC()->session->get('wooccm_retain', array() );
|
15 |
|
|
|
16 |
|
17 |
-
|
18 |
-
foreach ( $options['shipping_buttons'] as $btn ) :
|
19 |
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<script type="text/javascript">
|
24 |
jQuery(document).ready(function($){
|
25 |
|
26 |
$("#shipping_<?php echo $btn['cow']; ?>_field").magnificPopup({
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
easing: "ease-out"
|
33 |
-
|
34 |
-
});
|
35 |
|
36 |
-
(function post_image_content() {
|
37 |
-
var input = document.getElementById("shipping_<?php echo $btn['cow']; ?>_file"),
|
38 |
-
formdata = false, loadfiles, formnames = [], loadfiles = [];
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
return false;
|
43 |
-
});
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
}
|
89 |
-
if (filetype.match("application/ms.*")) {
|
90 |
-
img.src = "<?php echo site_url('wp-includes/images/media/spreadsheet.png'); ?>";
|
91 |
-
}
|
92 |
-
if (filetype.match("application/x.*")) {
|
93 |
-
img.src = "<?php echo site_url('wp-includes/images/media/archive.png'); ?>";
|
94 |
-
}
|
95 |
-
if (filetype.match("audio.*")) {
|
96 |
-
img.src = "<?php echo site_url('wp-includes/images/media/audio.png'); ?>";
|
97 |
-
}
|
98 |
-
if (filetype.match("text.*")) {
|
99 |
-
img.src = "<?php echo site_url('wp-includes/images/media/text.png'); ?>";
|
100 |
-
}
|
101 |
-
if (filetype.match("video.*")) {
|
102 |
-
img.src = "<?php echo site_url('wp-includes/images/media/video.png'); ?>";
|
103 |
-
}
|
104 |
-
|
105 |
-
li.title = getname;
|
106 |
-
dele.title = getname;
|
107 |
-
edit.title = getname;
|
108 |
-
li.appendChild(name);
|
109 |
-
li.appendChild(span);
|
110 |
-
span.appendChild(zoom);
|
111 |
-
span.appendChild(edit);
|
112 |
-
span.appendChild(dele);
|
113 |
-
list.appendChild(li);
|
114 |
-
li.className = "wooccm_each_file";
|
115 |
-
name.className = "wooccm_name";
|
116 |
-
dele.id = "wooccm_dele";
|
117 |
-
dele.className = "wooccm_dele wooccm-btn wooccm-btn-danger";
|
118 |
-
span.className = "container";
|
119 |
-
|
120 |
-
|
121 |
-
}
|
122 |
-
|
123 |
-
input.addEventListener("change", function (evt) {
|
124 |
-
$("#shipping_<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
125 |
-
|
126 |
-
var count = $("#shipping_<?php echo $btn['cow']; ?>_files_button_wccm").data("count") || 0;
|
127 |
-
$("#shipping_<?php echo $btn['cow']; ?>_files_button_wccm").data("count", ++count);
|
128 |
-
|
129 |
-
var img, reader, file, iname, len = this.files.length;
|
130 |
-
|
131 |
-
for ( i = 0; i < len; i++ ) {
|
132 |
-
file = this.files[i];
|
133 |
-
|
134 |
-
if ( window.FileReader ) {
|
135 |
-
reader = new FileReader();
|
136 |
-
reader.onload = (function(theFile){
|
137 |
-
var fileName = theFile.name,
|
138 |
-
filetype = theFile.type;
|
139 |
-
return function(e){
|
140 |
-
showUploadedItem( e.target.result, fileName, filetype );
|
141 |
-
};
|
142 |
-
})(file);
|
143 |
-
reader.readAsDataURL(file);
|
144 |
}
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
formdata.append("shipping_<?php echo $btn['cow']; ?>[]", file);
|
147 |
formnames.push(file.name);
|
148 |
loadfiles.push(file);
|
149 |
-
|
150 |
$.ajax({
|
151 |
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&name='.$btn['cow'].''); ?>",
|
152 |
type: "POST",
|
@@ -155,228 +165,208 @@ input.addEventListener("change", function (evt) {
|
|
155 |
contentType: false,
|
156 |
success: function (res) {
|
157 |
var result = $.parseJSON(res), new_val;
|
158 |
-
|
159 |
-
|
|
|
|
|
160 |
new_val[0] = result[0];
|
161 |
new_val[1] += result[1] + ",";
|
162 |
document.getElementById("shipping_<?php echo $btn['cow']; ?>").value = new_val[0] + "||" + new_val[1];
|
163 |
-
|
|
|
164 |
$("#shipping_<?php echo $btn['cow']; ?>_field").unblock();
|
165 |
}
|
166 |
});
|
167 |
-
}
|
168 |
|
169 |
-
if( formdata ) {
|
170 |
-
$("#shipping_<?php echo $btn['cow']; ?>_field").unblock();
|
171 |
-
}
|
172 |
-
|
173 |
-
|
174 |
-
}, false);
|
175 |
-
|
176 |
-
$("#caman_content #wooccmtoolbar #save").click( function(){
|
177 |
-
$("#caman_content #wooccmtoolbar").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
178 |
-
|
179 |
-
var title = this.title, the_file, wooxtro = document.getElementById("wooccmactualimage").getAttribute("data-caman-hidpi"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
180 |
-
formdata = new FormData();
|
181 |
-
|
182 |
-
for(var t = 0; t < count.length; t++) {
|
183 |
-
if( count[t].getAttribute("wooccm-attach-id") ){
|
184 |
-
break;
|
185 |
-
}
|
186 |
-
store.push(count[t]);
|
187 |
-
}
|
188 |
-
|
189 |
-
if( store.length !== 0 ){
|
190 |
-
listing = document.getElementById("shipping_<?php echo $btn['cow']; ?>").value.split("||");
|
191 |
-
listing = listing[1].split(",");
|
192 |
-
listing = listing.filter(Number);
|
193 |
-
|
194 |
-
$.each(listing, function(index, value){
|
195 |
-
$(store[index]).attr("wooccm-attach-id", value);
|
196 |
-
});
|
197 |
-
}
|
198 |
-
|
199 |
-
|
200 |
-
$(".wooccm_each_file").each(function(){
|
201 |
-
if( this.title === title) {
|
202 |
-
var currentgutz = this;
|
203 |
-
this.firstElementChild.href = wooxtro;
|
204 |
-
this.firstElementChild.firstElementChild.src = wooxtro;
|
205 |
-
this.lastElementChild.firstElementChild.href = wooxtro;
|
206 |
-
this.lastElementChild.lastElementChild.previousElementSibling.href = wooxtro;
|
207 |
-
|
208 |
-
var byteString;
|
209 |
-
var dataURI = wooxtro; //data:image/gif;base64,R0lGODlhyAAiALM...DfD0QAADs
|
210 |
-
|
211 |
-
if (dataURI.split(',')[0].indexOf('base64') >= 0)
|
212 |
-
|
213 |
-
byteString = atob(dataURI.split(',')[1]);
|
214 |
-
|
215 |
-
else
|
216 |
-
|
217 |
-
byteString = unescape(dataURI.split(',')[1]);
|
218 |
-
|
219 |
-
// separate out the mime component
|
220 |
-
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
221 |
-
|
222 |
-
// write the bytes of the string to a typed array
|
223 |
-
var ia = new Uint8Array(byteString.length);
|
224 |
-
for (var i = 0; i < byteString.length; i++) {
|
225 |
-
ia[i] = byteString.charCodeAt(i);
|
226 |
}
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
var
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
});
|
252 |
-
|
253 |
-
$("#caman_content #wooccmtoolbar").unblock();
|
254 |
-
alert("<?php echo $options['checkness']['picture_success']; ?>");
|
255 |
}
|
256 |
-
|
257 |
});
|
258 |
-
|
259 |
-
});
|
260 |
-
|
261 |
-
|
262 |
-
});
|
263 |
-
|
264 |
-
$(document).on('click','.wooccm_dele',function(){
|
265 |
-
|
266 |
-
var c = confirm("<?php echo $options['checkness']['file_delete']; ?> " + this.title + " ?"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
267 |
-
if (c==true) {
|
268 |
-
|
269 |
-
$("#shipping_<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
270 |
-
|
271 |
-
for(var t = 0; t < count.length; t++) {
|
272 |
-
if( count[t].getAttribute("wooccm-attach-id") ){
|
273 |
-
break;
|
274 |
-
}
|
275 |
-
store.push(count[t]);
|
276 |
-
}
|
277 |
-
|
278 |
-
if( store.length !== 0 ){
|
279 |
-
listing = document.getElementById("shipping_<?php echo $btn['cow']; ?>").value.split("||");
|
280 |
-
listing = listing[1].split(",");
|
281 |
-
listing = listing.filter(Number);
|
282 |
-
|
283 |
-
$.each(listing, function(index, value){
|
284 |
-
$(store[index]).attr("wooccm-attach-id", value);
|
285 |
});
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
|
|
|
|
|
|
|
|
295 |
}
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
remove = remove + ",";
|
306 |
$("#shipping_<?php echo $btn['cow']; ?>").val(function(index, value) {
|
307 |
return value.replace(remove, "");
|
308 |
});
|
309 |
-
|
310 |
shell.outerHTML = "";
|
311 |
-
|
312 |
-
$("#shipping_<?php echo $btn['cow']; ?>_field").unblock();
|
313 |
-
}
|
314 |
-
|
315 |
-
});
|
316 |
-
|
317 |
-
|
318 |
-
} else {
|
319 |
-
}
|
320 |
-
|
321 |
-
});
|
322 |
|
|
|
|
|
|
|
323 |
|
|
|
324 |
|
325 |
-
$("#caman_content #wooccmtoolbar #close").click( function(){
|
326 |
-
var li = document.getElementById( "wooccmactualimage" );
|
327 |
-
li.outerHTML = "";
|
328 |
-
$("#caman_content .FilterValue").each(function(){
|
329 |
-
$(this).text("0");
|
330 |
});
|
331 |
-
|
332 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
});
|
334 |
-
|
335 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
});
|
337 |
-
$("#caman_content").hide();
|
338 |
-
$("html").css("overflow", "visible");
|
339 |
-
});
|
340 |
-
|
341 |
-
$(document).on('click','.wooccm_edit',function(){
|
342 |
-
return false;
|
343 |
-
});
|
344 |
-
|
345 |
-
$(document).on('click','.wooccm_edit.enable',function(){
|
346 |
-
var imageinbase = this.href,
|
347 |
-
li = document.getElementById( "wooccmimageeditorpro" ),
|
348 |
-
data = document.createAttribute("data-caman-hidpi"),
|
349 |
-
img = document.createElement("img");
|
350 |
-
|
351 |
-
data.value = imageinbase;
|
352 |
-
|
353 |
-
$("#caman_content #wooccmtoolbar #save").attr("title", this.title);
|
354 |
-
|
355 |
-
if( $(".wooccmimageeditor img").length == 0 ){
|
356 |
-
img.id = "wooccmactualimage";
|
357 |
-
img.src = imageinbase;
|
358 |
-
img.setAttributeNode(data);
|
359 |
-
li.appendChild(img);
|
360 |
-
|
361 |
-
|
362 |
-
$.getScript( "<?php echo plugins_url('woocommerce-checkout-manager-pro/includes/pickers/caman/dist/caman_controls.js'); ?>");
|
363 |
-
}
|
364 |
-
|
365 |
-
$("#caman_content").show();
|
366 |
-
$("html").css("overflow", "hidden");
|
367 |
-
});
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
}());
|
373 |
-
});
|
374 |
-
</script>
|
375 |
|
|
|
376 |
|
|
|
|
|
377 |
<?php
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
}
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
+
function wooccm_upload_shipping_scripts() {
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
global $woocommerce;
|
12 |
|
13 |
+
$options = get_option( 'wccs_settings2' );
|
|
|
14 |
|
15 |
+
if( WC()->cart->needs_shipping_address() !== true )
|
16 |
+
return;
|
17 |
|
18 |
+
// Check if we have any buttons
|
19 |
+
if( empty($options['shipping_buttons']) )
|
20 |
+
return;
|
21 |
+
|
22 |
+
$saved = WC()->session->get('wooccm_retain', array() );
|
23 |
+
|
24 |
+
foreach( $options['shipping_buttons'] as $btn ) {
|
25 |
+
|
26 |
+
if( $btn['type'] <> 'wooccmupload' )
|
27 |
+
continue;
|
28 |
+
?>
|
29 |
+
<!-- Shipping section: File upload -->
|
30 |
<script type="text/javascript">
|
31 |
jQuery(document).ready(function($){
|
32 |
|
33 |
$("#shipping_<?php echo $btn['cow']; ?>_field").magnificPopup({
|
34 |
+
delegate: "a.wooccm-zoom-special", // child items selector, by clicking on it popup will open
|
35 |
+
type: "image",
|
36 |
+
zoom: {
|
37 |
+
enabled: true,
|
38 |
+
duration: 400,
|
39 |
easing: "ease-out"
|
40 |
+
}
|
41 |
+
});
|
42 |
|
43 |
+
(function post_image_content() {
|
|
|
|
|
44 |
|
45 |
+
var input = document.getElementById("shipping_<?php echo $btn['cow']; ?>_file"),
|
46 |
+
formdata = false, loadfiles, formnames = [], loadfiles = [];
|
|
|
|
|
47 |
|
48 |
+
$("#shipping_<?php echo $btn['cow']; ?>_files_button_wccm").click( function(){
|
49 |
+
$("#shipping_<?php echo $btn['cow']; ?>_field input[type=file]").click();
|
50 |
+
return false;
|
51 |
+
});
|
52 |
+
|
53 |
+
if (window.FormData) {
|
54 |
+
formdata = new FormData();
|
55 |
+
}
|
56 |
+
|
57 |
+
function showUploadedItem ( source, getname, filetype ) {
|
58 |
|
59 |
+
var
|
60 |
+
list = document.getElementById("shipping_<?php echo $btn['cow']; ?>_field"),
|
61 |
+
li = document.createElement("span"),
|
62 |
+
name = document.createElement("name"),
|
63 |
+
span = document.createElement("span"),
|
64 |
+
zoom = document.createElement("a"),
|
65 |
+
edit = document.createElement("a"),
|
66 |
+
dele = document.createElement("a"),
|
67 |
+
a = document.createElement("a"),
|
68 |
+
spana = document.createElement("spana"),
|
69 |
+
img = document.createElement("img");
|
70 |
+
|
71 |
+
name.innerHTML = getname;
|
72 |
+
edit.innerHTML = "Edit";
|
73 |
+
dele.innerHTML = "Delete";
|
74 |
+
|
75 |
+
if (filetype.match("image.*")) {
|
76 |
+
img.src = source;
|
77 |
+
a.href = source;
|
78 |
+
a.title = getname;
|
79 |
+
edit.href = source;
|
80 |
+
zoom.href = source;
|
81 |
+
zoom.title = getname;
|
82 |
+
zoom.innerHTML = "Zoom <img style=display:none />";
|
83 |
+
li.appendChild(a);
|
84 |
+
a.appendChild(img);
|
85 |
+
a.className = "wooccm-zoom-special wooccm-image-holder mfp-zoom";
|
86 |
+
zoom.className = "wooccm-zoom-special wooccm_zoom wooccm-btn wooccm-btn-zoom";
|
87 |
+
edit.className = "wooccm_edit wooccm-btn wooccm-btn-edit enable";
|
88 |
+
}else{
|
89 |
+
zoom.innerHTML = "Zoom";
|
90 |
+
li.appendChild(spana);
|
91 |
+
spana.appendChild(img);
|
92 |
+
spana.className = "wooccm-image-holder";
|
93 |
+
zoom.className = "wooccm_zoom wooccm-btn disable";
|
94 |
+
edit.className = "wooccm_edit wooccm-btn disable";
|
95 |
+
}
|
96 |
+
if ( ( false === filetype.match("application/ms.*") && false === filetype.match("application/x.*") && false === filetype.match("audio.*") && false === filetype.match("text.*") && false === filetype.match("video.*") ) || ( 0 === filetype.length || !filetype) ) {
|
97 |
+
img.src = "<?php echo site_url('wp-includes/images/media/interactive.png'); ?>";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
}
|
99 |
+
if (filetype.match("application/ms.*")) {
|
100 |
+
img.src = "<?php echo site_url('wp-includes/images/media/spreadsheet.png'); ?>";
|
101 |
+
}
|
102 |
+
if (filetype.match("application/x.*")) {
|
103 |
+
img.src = "<?php echo site_url('wp-includes/images/media/archive.png'); ?>";
|
104 |
+
}
|
105 |
+
if (filetype.match("audio.*")) {
|
106 |
+
img.src = "<?php echo site_url('wp-includes/images/media/audio.png'); ?>";
|
107 |
+
}
|
108 |
+
if (filetype.match("text.*")) {
|
109 |
+
img.src = "<?php echo site_url('wp-includes/images/media/text.png'); ?>";
|
110 |
+
}
|
111 |
+
if (filetype.match("video.*")) {
|
112 |
+
img.src = "<?php echo site_url('wp-includes/images/media/video.png'); ?>";
|
113 |
+
}
|
114 |
+
|
115 |
+
li.title = getname;
|
116 |
+
dele.title = getname;
|
117 |
+
edit.title = getname;
|
118 |
+
li.appendChild(name);
|
119 |
+
li.appendChild(span);
|
120 |
+
span.appendChild(zoom);
|
121 |
+
span.appendChild(edit);
|
122 |
+
span.appendChild(dele);
|
123 |
+
list.appendChild(li);
|
124 |
+
li.className = "wooccm_each_file";
|
125 |
+
name.className = "wooccm_name";
|
126 |
+
dele.id = "wooccm_dele";
|
127 |
+
dele.className = "wooccm_dele wooccm-btn wooccm-btn-danger";
|
128 |
+
span.className = "container";
|
129 |
+
|
130 |
+
}
|
131 |
+
|
132 |
+
input.addEventListener("change", function (evt) {
|
133 |
+
$("#shipping_<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
134 |
+
|
135 |
+
var count = $("#shipping_<?php echo $btn['cow']; ?>_files_button_wccm").data("count") || 0;
|
136 |
+
$("#shipping_<?php echo $btn['cow']; ?>_files_button_wccm").data("count", ++count);
|
137 |
+
|
138 |
+
var img, reader, file, iname, len = this.files.length;
|
139 |
+
|
140 |
+
for ( i = 0; i < len; i++ ) {
|
141 |
+
|
142 |
+
file = this.files[i];
|
143 |
+
|
144 |
+
if ( window.FileReader ) {
|
145 |
+
reader = new FileReader();
|
146 |
+
reader.onload = (function(theFile){
|
147 |
+
var fileName = theFile.name,
|
148 |
+
filetype = theFile.type;
|
149 |
+
return function(e){
|
150 |
+
showUploadedItem( e.target.result, fileName, filetype );
|
151 |
+
};
|
152 |
+
})(file);
|
153 |
+
reader.readAsDataURL(file);
|
154 |
+
}
|
155 |
+
|
156 |
formdata.append("shipping_<?php echo $btn['cow']; ?>[]", file);
|
157 |
formnames.push(file.name);
|
158 |
loadfiles.push(file);
|
159 |
+
|
160 |
$.ajax({
|
161 |
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_endupload&name='.$btn['cow'].''); ?>",
|
162 |
type: "POST",
|
165 |
contentType: false,
|
166 |
success: function (res) {
|
167 |
var result = $.parseJSON(res), new_val;
|
168 |
+
document.getElementById("shipping_<?php echo $btn['cow']; ?>").value = result;
|
169 |
+
/* @mod - Test formatting change */
|
170 |
+
/*
|
171 |
+
new_val = document.getElementById("shipping_<?php echo $btn['cow']; ?>").value.split("||");
|
172 |
new_val[0] = result[0];
|
173 |
new_val[1] += result[1] + ",";
|
174 |
document.getElementById("shipping_<?php echo $btn['cow']; ?>").value = new_val[0] + "||" + new_val[1];
|
175 |
+
*/
|
176 |
+
|
177 |
$("#shipping_<?php echo $btn['cow']; ?>_field").unblock();
|
178 |
}
|
179 |
});
|
|
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
}
|
182 |
+
|
183 |
+
if( formdata ) {
|
184 |
+
$("#shipping_<?php echo $btn['cow']; ?>_field").unblock();
|
185 |
+
}
|
186 |
+
|
187 |
+
}, false);
|
188 |
+
|
189 |
+
$("#caman_content #wooccmtoolbar #save").click( function(){
|
190 |
+
|
191 |
+
$("#caman_content #wooccmtoolbar").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
192 |
+
|
193 |
+
var title = this.title, the_file, wooxtro = document.getElementById("wooccmactualimage").getAttribute("data-caman-hidpi"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
194 |
+
formdata = new FormData();
|
195 |
+
|
196 |
+
for(var t = 0; t < count.length; t++) {
|
197 |
+
if( count[t].getAttribute("wooccm-attach-id") ){
|
198 |
+
break;
|
199 |
+
}
|
200 |
+
store.push(count[t]);
|
201 |
+
}
|
202 |
+
|
203 |
+
if( store.length !== 0 ){
|
204 |
+
listing = document.getElementById("shipping_<?php echo $btn['cow']; ?>").value.split("||");
|
205 |
+
listing = listing[1].split(",");
|
206 |
+
listing = listing.filter(Number);
|
207 |
+
|
208 |
+
$.each(listing, function(index, value){
|
209 |
+
$(store[index]).attr("wooccm-attach-id", value);
|
210 |
+
});
|
211 |
+
}
|
212 |
+
|
213 |
+
$(".wooccm_each_file").each(function(){
|
214 |
+
if( this.title === title) {
|
215 |
+
var currentgutz = this;
|
216 |
+
this.firstElementChild.href = wooxtro;
|
217 |
+
this.firstElementChild.firstElementChild.src = wooxtro;
|
218 |
+
this.lastElementChild.firstElementChild.href = wooxtro;
|
219 |
+
this.lastElementChild.lastElementChild.previousElementSibling.href = wooxtro;
|
220 |
+
|
221 |
+
var byteString;
|
222 |
+
var dataURI = wooxtro; //data:image/gif;base64,R0lGODlhyAAiALM...DfD0QAADs
|
223 |
+
|
224 |
+
if (dataURI.split(',')[0].indexOf('base64') >= 0)
|
225 |
+
byteString = atob(dataURI.split(',')[1]);
|
226 |
+
else
|
227 |
+
byteString = unescape(dataURI.split(',')[1]);
|
228 |
+
|
229 |
+
// separate out the mime component
|
230 |
+
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
|
231 |
+
|
232 |
+
// write the bytes of the string to a typed array
|
233 |
+
var ia = new Uint8Array(byteString.length);
|
234 |
+
for (var i = 0; i < byteString.length; i++) {
|
235 |
+
ia[i] = byteString.charCodeAt(i);
|
236 |
+
}
|
237 |
+
|
238 |
+
var extension = mimeString.split('/')[1];
|
239 |
+
var fileName = "image_" + new Date().getTime() + "." + extension;
|
240 |
+
var blob = new Blob([ia], {type:mimeString});
|
241 |
+
|
242 |
+
the_file = new File([blob], title, {
|
243 |
+
type: "image/png"
|
244 |
+
});
|
245 |
+
|
246 |
+
formdata.append("shipping_<?php echo $btn['cow']; ?>[]", the_file);
|
247 |
+
var remove = this.getAttribute("wooccm-attach-id");
|
248 |
+
|
249 |
+
$.ajax({
|
250 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_enduploadsave&name='.$btn['cow'].'&remove='); ?>" + remove,
|
251 |
+
type: "POST",
|
252 |
+
data: formdata,
|
253 |
+
processData: false,
|
254 |
+
contentType: false,
|
255 |
+
success: function (res) {
|
256 |
+
var result = $.parseJSON(res);
|
257 |
+
$(currentgutz).attr("wooccm-attach-id", result);
|
258 |
+
$("#shipping_<?php echo $btn['cow']; ?>").val(function(index, value) {
|
259 |
+
return value.replace(remove, result);
|
260 |
+
});
|
261 |
+
$("#caman_content #wooccmtoolbar").unblock();
|
262 |
+
alert("<?php echo ( !empty( $options['checkness']['picture_success'] ) ? $options['checkness']['picture_success'] : 'Picture Saved' ); ?>");
|
263 |
+
}
|
264 |
});
|
|
|
|
|
|
|
265 |
}
|
|
|
266 |
});
|
267 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
});
|
269 |
+
|
270 |
+
$(document).on('click','.wooccm_dele',function(){
|
271 |
+
|
272 |
+
var c = confirm("<?php echo ( !empty( $options['checkness']['file_delete'] ) ? $options['checkness']['file_delete'] : 'Delete' ); ?> " + this.title + " ?"), listing, store = [], count = $(".wooccm_each_file").each(function(){});
|
273 |
+
if (c==true) {
|
274 |
+
|
275 |
+
$("#shipping_<?php echo $btn['cow']; ?>_field").block({ message: null, overlayCSS: { background: '#fff no-repeat center', backgroundSize: '16px 16px', opacity: 0.6 } });
|
276 |
+
|
277 |
+
for(var t = 0; t < count.length; t++) {
|
278 |
+
if( count[t].getAttribute("wooccm-attach-id") ){
|
279 |
+
break;
|
280 |
+
}
|
281 |
+
store.push(count[t]);
|
282 |
}
|
283 |
+
|
284 |
+
if( store.length !== 0 ){
|
285 |
+
listing = document.getElementById("shipping_<?php echo $btn['cow']; ?>").value.split("||");
|
286 |
+
listing = listing[1].split(",");
|
287 |
+
listing = listing.filter(Number);
|
288 |
+
|
289 |
+
$.each(listing, function(index, value){
|
290 |
+
$(store[index]).attr("wooccm-attach-id", value);
|
291 |
+
});
|
292 |
+
}
|
293 |
+
|
294 |
+
var currentname = this.title, wooccmeachfile = document.getElementsByClassName("wooccm_each_file"), remove, shell;
|
295 |
+
formdata = new FormData();
|
296 |
+
|
297 |
+
for( i = 0; i < wooccmeachfile.length; i++ ){
|
298 |
+
if(wooccmeachfile[i].title === currentname){
|
299 |
+
remove = wooccmeachfile[i].getAttribute("wooccm-attach-id");
|
300 |
+
shell = wooccmeachfile[i];
|
301 |
+
}
|
302 |
+
}
|
303 |
+
|
304 |
+
$.ajax({
|
305 |
+
url: "<?php echo admin_url('/admin-ajax.php?action=wooccm_front_enduploadsave&remove='); ?>" + remove,
|
306 |
+
type: "POST",
|
307 |
+
data: formdata,
|
308 |
+
processData: false,
|
309 |
+
contentType: false,
|
310 |
+
success: function (res) {
|
311 |
remove = remove + ",";
|
312 |
$("#shipping_<?php echo $btn['cow']; ?>").val(function(index, value) {
|
313 |
return value.replace(remove, "");
|
314 |
});
|
315 |
+
|
316 |
shell.outerHTML = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
318 |
+
$("#shipping_<?php echo $btn['cow']; ?>_field").unblock();
|
319 |
+
}
|
320 |
+
});
|
321 |
|
322 |
+
}
|
323 |
|
|
|
|
|
|
|
|
|
|
|
324 |
});
|
325 |
+
|
326 |
+
$("#caman_content #wooccmtoolbar #close").click( function(){
|
327 |
+
var li = document.getElementById( "wooccmactualimage" );
|
328 |
+
li.outerHTML = "";
|
329 |
+
$("#caman_content .FilterValue").each(function(){
|
330 |
+
$(this).text("0");
|
331 |
+
});
|
332 |
+
$("#caman_content .FilterSetting input").each(function(){
|
333 |
+
$(this).val("0");
|
334 |
+
});
|
335 |
+
$("#PresetFilters a").each(function(){
|
336 |
+
$(this).removeClass("Active");
|
337 |
+
});
|
338 |
+
$("#caman_content").hide();
|
339 |
+
$("html").css("overflow", "visible");
|
340 |
});
|
341 |
+
|
342 |
+
$(document).on('click','.wooccm_edit',function(){
|
343 |
+
return false;
|
344 |
+
});
|
345 |
+
|
346 |
+
$(document).on('click','.wooccm_edit.enable',function(){
|
347 |
+
var imageinbase = this.href,
|
348 |
+
li = document.getElementById( "wooccmimageeditorpro" ),
|
349 |
+
data = document.createAttribute("data-caman-hidpi"),
|
350 |
+
img = document.createElement("img");
|
351 |
+
data.value = imageinbase;
|
352 |
+
$("#caman_content #wooccmtoolbar #save").attr("title", this.title);
|
353 |
+
if( $(".wooccmimageeditor img").length == 0 ){
|
354 |
+
img.id = "wooccmactualimage";
|
355 |
+
img.src = imageinbase;
|
356 |
+
img.setAttributeNode(data);
|
357 |
+
li.appendChild(img);
|
358 |
+
$.getScript( "<?php echo plugins_url( 'includes/pickers/caman/dist/caman_controls.js', WOOCCM_RELPATH ); ?>");
|
359 |
+
}
|
360 |
+
$("#caman_content").show();
|
361 |
+
$("html").css("overflow", "hidden");
|
362 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
|
364 |
+
}());
|
365 |
|
366 |
+
});
|
367 |
+
</script>
|
368 |
<?php
|
369 |
+
}
|
370 |
+
|
371 |
+
}
|
372 |
+
?>
|
|
includes/templates/functions/woocm_editing_wrapper.php
CHANGED
@@ -6,205 +6,228 @@
|
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
9 |
-
add_action('wp_head', 'wooccm_photo_editor_content');
|
10 |
function wooccm_photo_editor_content() {
|
11 |
-
|
|
|
|
|
12 |
?>
|
13 |
<div id="caman_content" style="display:none;">
|
14 |
|
15 |
<div id="wooccmtoolbar">
|
16 |
-
|
17 |
-
<div class="button" id="close"
|
18 |
-
<h3
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
</div>
|
|
|
207 |
|
208 |
-
<?php
|
209 |
-
|
210 |
-
}
|
|
|
|
6 |
// Exit if accessed directly
|
7 |
if ( !defined( 'ABSPATH' ) ) exit;
|
8 |
|
|
|
9 |
function wooccm_photo_editor_content() {
|
10 |
+
|
11 |
+
if( is_checkout() == false )
|
12 |
+
return;
|
13 |
?>
|
14 |
<div id="caman_content" style="display:none;">
|
15 |
|
16 |
<div id="wooccmtoolbar">
|
17 |
+
<div class="button" id="save"><?php _e( 'Save', 'woocommerce-checkout-manager' ); ?></div>
|
18 |
+
<div class="button" id="close"><?php _e( 'Close', 'woocommerce-checkout-manager' ); ?></div>
|
19 |
+
<h3><?php _e( 'Photo Editing', 'woocommerce-checkout-manager' ); ?></h3>
|
20 |
+
</div>
|
21 |
+
<!-- #wooccmtoolbar -->
|
22 |
+
|
23 |
+
<div class="wooccmsidebar">
|
24 |
+
<div id="Filters">
|
25 |
+
|
26 |
+
<div class="Filter">
|
27 |
+
<div class="FilterName">
|
28 |
+
<p><?php _e( 'Brightness', 'woocommerce-checkout-manager' ); ?></p>
|
29 |
+
</div>
|
30 |
+
<!-- .FilterName -->
|
31 |
+
|
32 |
+
<div class="FilterSetting">
|
33 |
+
<input type="range" min="-100" max="100" step="1" value="0" data-filter="brightness">
|
34 |
+
<span class="FilterValue">0</span>
|
35 |
+
</div>
|
36 |
+
<!-- .FilterSetting -->
|
37 |
+
</div>
|
38 |
+
<!-- .Filter -->
|
39 |
+
|
40 |
+
<div class="Filter">
|
41 |
+
<div class="FilterName">
|
42 |
+
<p><?php _e( 'Contrast', 'woocommerce-checkout-manager' ); ?></p>
|
43 |
+
</div>
|
44 |
+
<!-- .FilterName -->
|
45 |
+
|
46 |
+
<div class="FilterSetting">
|
47 |
+
<input type="range" min="-100" max="100" step="1" value="0" data-filter="contrast">
|
48 |
+
<span class="FilterValue">0</span>
|
49 |
+
</div>
|
50 |
+
<!-- .FilterSetting -->
|
51 |
+
</div>
|
52 |
+
<!-- .Filter -->
|
53 |
+
|
54 |
+
<div class="Filter">
|
55 |
+
<div class="FilterName">
|
56 |
+
<p><?php _e( 'Saturation', 'woocommerce-checkout-manager' ); ?></p>
|
57 |
+
</div>
|
58 |
+
<!-- .FilterName -->
|
59 |
+
|
60 |
+
<div class="FilterSetting">
|
61 |
+
<input type="range" min="-100" max="100" step="1" value="0" data-filter="saturation">
|
62 |
+
<span class="FilterValue">0</span>
|
63 |
+
</div>
|
64 |
+
<!-- .FilterSetting -->
|
65 |
+
</div>
|
66 |
+
<!-- .Filter -->
|
67 |
+
|
68 |
+
<div class="Filter">
|
69 |
+
<div class="FilterName">
|
70 |
+
<p><?php _e( 'Vibrance', 'woocommerce-checkout-manager' ); ?></p>
|
71 |
+
</div>
|
72 |
+
<!-- .FilterName -->
|
73 |
+
|
74 |
+
<div class="FilterSetting">
|
75 |
+
<input type="range" min="-100" max="100" step="1" value="0" data-filter="vibrance">
|
76 |
+
<span class="FilterValue">0</span>
|
77 |
+
</div>
|
78 |
+
<!-- .FilterSetting -->
|
79 |
+
</div>
|
80 |
+
<!-- .Filter -->
|
81 |
+
|
82 |
+
<div class="Filter">
|
83 |
+
<div class="FilterName">
|
84 |
+
<p><?php _e( 'Exposure', 'woocommerce-checkout-manager' ); ?></p>
|
85 |
+
</div>
|
86 |
+
<!-- .FilterName -->
|
87 |
+
|
88 |
+
<div class="FilterSetting">
|
89 |
+
<input type="range" min="-100" max="100" step="1" value="0" data-filter="exposure">
|
90 |
+
<span class="FilterValue">0</span>
|
91 |
+
</div>
|
92 |
+
<!-- .FilterSetting -->
|
93 |
+
</div>
|
94 |
+
<!-- .Filter -->
|
95 |
+
|
96 |
+
<div class="Filter">
|
97 |
+
<div class="FilterName">
|
98 |
+
<p><?php _e( 'Hue', 'woocommerce-checkout-manager' ); ?></p>
|
99 |
+
</div>
|
100 |
+
<!-- .FilterName -->
|
101 |
+
|
102 |
+
<div class="FilterSetting">
|
103 |
+
<input type="range" min="0" max="100" step="1" value="0" data-filter="hue">
|
104 |
+
<span class="FilterValue">0</span>
|
105 |
+
</div>
|
106 |
+
<!-- .FilterSetting -->
|
107 |
+
</div>
|
108 |
+
<!-- .Filter -->
|
109 |
+
|
110 |
+
<div class="Filter">
|
111 |
+
<div class="FilterName">
|
112 |
+
<p><?php _e( 'Sepia', 'woocommerce-checkout-manager' ); ?></p>
|
113 |
+
</div>
|
114 |
+
<!-- .FilterName -->
|
115 |
+
|
116 |
+
<div class="FilterSetting">
|
117 |
+
<input type="range" min="0" max="100" step="1" value="0" data-filter="sepia">
|
118 |
+
<span class="FilterValue">0</span>
|
119 |
+
</div>
|
120 |
+
<!-- .FilterSetting -->
|
121 |
+
</div>
|
122 |
+
<!-- .Filter -->
|
123 |
+
|
124 |
+
<div class="Filter">
|
125 |
+
<div class="FilterName">
|
126 |
+
<p><?php _e( 'Gamma', 'woocommerce-checkout-manager' ); ?></p>
|
127 |
+
</div>
|
128 |
+
<!-- .FilterName -->
|
129 |
+
|
130 |
+
<div class="FilterSetting">
|
131 |
+
<input type="range" min="0" max="10" step="0.1" value="0" data-filter="gamma">
|
132 |
+
<span class="FilterValue">0</span>
|
133 |
+
</div>
|
134 |
+
<!-- .FilterSetting -->
|
135 |
+
</div>
|
136 |
+
<!-- .Filter -->
|
137 |
+
|
138 |
+
<div class="Filter">
|
139 |
+
<div class="FilterName">
|
140 |
+
<p><?php _e( 'Noise', 'woocommerce-checkout-manager' ); ?></p>
|
141 |
+
</div>
|
142 |
+
<!-- .FilterName -->
|
143 |
+
|
144 |
+
<div class="FilterSetting">
|
145 |
+
<input type="range" min="0" max="100" step="1" value="0" data-filter="noise">
|
146 |
+
<span class="FilterValue">0</span>
|
147 |
+
</div>
|
148 |
+
<!-- .FilterSetting -->
|
149 |
+
</div>
|
150 |
+
<!-- .Filter -->
|
151 |
+
|
152 |
+
<div class="Filter">
|
153 |
+
<div class="FilterName">
|
154 |
+
<p><?php _e( 'Clip', 'woocommerce-checkout-manager' ); ?></p>
|
155 |
+
</div>
|
156 |
+
<!-- .FilterName -->
|
157 |
+
|
158 |
+
<div class="FilterSetting">
|
159 |
+
<input type="range" min="0" max="100" step="1" value="0" data-filter="clip">
|
160 |
+
<span class="FilterValue">0</span>
|
161 |
+
</div>
|
162 |
+
<!-- .FilterSetting -->
|
163 |
+
</div>
|
164 |
+
<!-- .Filter -->
|
165 |
+
|
166 |
+
<div class="Filter">
|
167 |
+
<div class="FilterName">
|
168 |
+
<p><?php _e( 'Sharpen', 'woocommerce-checkout-manager' ); ?></p>
|
169 |
+
</div>
|
170 |
+
<!-- .FilterName -->
|
171 |
+
|
172 |
+
<div class="FilterSetting">
|
173 |
+
<input type="range" min="0" max="100" step="1" value="0" data-filter="sharpen">
|
174 |
+
<span class="FilterValue">0</span>
|
175 |
+
</div>
|
176 |
+
<!-- .FilterSetting -->
|
177 |
+
</div>
|
178 |
+
<!-- .Filter -->
|
179 |
+
|
180 |
+
<div class="Filter">
|
181 |
+
<div class="FilterName">
|
182 |
+
<p><?php _e( 'StackBlur', 'woocommerce-checkout-manager' ); ?></p>
|
183 |
+
</div>
|
184 |
+
<!-- .FilterName -->
|
185 |
+
|
186 |
+
<div class="FilterSetting">
|
187 |
+
<input type="range" min="0" max="20" step="1" value="0" data-filter="stackBlur">
|
188 |
+
<span class="FilterValue">0</span>
|
189 |
+
</div>
|
190 |
+
<!-- .FilterSetting -->
|
191 |
+
</div>
|
192 |
+
<!-- .Filter -->
|
193 |
+
|
194 |
+
<div class="Clear"></div>
|
195 |
+
|
196 |
+
</div>
|
197 |
+
<!-- #Filters -->
|
198 |
+
|
199 |
+
<div id="PresetFilters">
|
200 |
+
<a data-preset="vintage"><?php _e( 'Vintage', 'woocommerce-checkout-manager' ); ?></a>
|
201 |
+
<a data-preset="lomo"><?php _e( 'Lomo', 'woocommerce-checkout-manager' ); ?></a>
|
202 |
+
<a data-preset="clarity"><?php _e( 'Clarity', 'woocommerce-checkout-manager' ); ?></a>
|
203 |
+
<a data-preset="sinCity"><?php _e( 'Sin City', 'woocommerce-checkout-manager' ); ?></a>
|
204 |
+
<a data-preset="sunrise"><?php _e( 'Sunrise', 'woocommerce-checkout-manager' ); ?></a>
|
205 |
+
<a data-preset="crossProcess"><?php _e( 'Cross Process', 'woocommerce-checkout-manager' ); ?></a>
|
206 |
+
<a data-preset="orangePeel"><?php _e( 'Orange Peel', 'woocommerce-checkout-manager' ); ?></a>
|
207 |
+
<a data-preset="love"><?php _e( 'Love', 'woocommerce-checkout-manager' ); ?></a>
|
208 |
+
<a data-preset="grungy"><?php _e( 'Grungy', 'woocommerce-checkout-manager' ); ?></a>
|
209 |
+
<a data-preset="jarques"><?php _e( 'Jarques', 'woocommerce-checkout-manager' ); ?></a>
|
210 |
+
<a data-preset="pinhole"><?php _e( 'Pinhole', 'woocommerce-checkout-manager' ); ?></a>
|
211 |
+
<a data-preset="oldBoot"><?php _e( 'Old Boot', 'woocommerce-checkout-manager' ); ?></a>
|
212 |
+
<a data-preset="glowingSun"><?php _e( 'Glowing Sun', 'woocommerce-checkout-manager' ); ?></a>
|
213 |
+
<a data-preset="hazyDays"><?php _e( 'Hazy Days', 'woocommerce-checkout-manager' ); ?></a>
|
214 |
+
<a data-preset="herMajesty"><?php _e( 'Her Majesty', 'woocommerce-checkout-manager' ); ?></a>
|
215 |
+
<a data-preset="nostalgia"><?php _e( 'Nostalgia', 'woocommerce-checkout-manager' ); ?></a>
|
216 |
+
<a data-preset="hemingway"><?php _e( 'Hemingway', 'woocommerce-checkout-manager' ); ?></a>
|
217 |
+
<a data-preset="concentrate"><?php _e( 'Concentrate', 'woocommerce-checkout-manager' ); ?></a>
|
218 |
+
</div>
|
219 |
+
<!-- #PresetFilters -->
|
220 |
+
|
221 |
+
</div>
|
222 |
+
<!-- .wooccmsidebar -->
|
223 |
+
|
224 |
+
<div class="wooccmimageeditor" id="wooccmimageeditorpro"></div>
|
225 |
+
|
226 |
</div>
|
227 |
+
<!-- #caman_content -->
|
228 |
|
229 |
+
<?php
|
230 |
+
|
231 |
+
}
|
232 |
+
add_action('wp_head', 'wooccm_photo_editor_content');
|
233 |
+
?>
|
includes/templates/htmlbodyadd.php
DELETED
@@ -1,168 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* WooCommerce Checkout Manager
|
4 |
-
*
|
5 |
-
*/
|
6 |
-
|
7 |
-
// Exit if accessed directly
|
8 |
-
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
-
?>
|
10 |
-
|
11 |
-
<td style="display:none;text-align:center;" class="more_toggler1c"><input name="wccs_settings[buttons][<?php echo $iz; ?>][more_content]" type="checkbox" value="1" <?php if ( !empty ($options['buttons'][$iz]['more_content'])) echo "checked='checked'"; ?> /></td>
|
12 |
-
|
13 |
-
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings[buttons][<?php echo $iz; ?>][single_p]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options['buttons'][$iz]['single_p'])) ? '' : $options['buttons'][$iz]['single_p']; ?>" /></td>
|
14 |
-
|
15 |
-
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings[buttons][<?php echo $iz; ?>][single_px]" placeholder="<?php _e('Product ID(s) e.g 1674||1233','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options['buttons'][$iz]['single_px'])) ? '' : $options['buttons'][$iz]['single_px']; ?>" /></td>
|
16 |
-
|
17 |
-
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings[buttons][<?php echo $iz; ?>][single_p_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options['buttons'][$iz]['single_p_cat'])) ? '' : $options['buttons'][$iz]['single_p_cat']; ?>" /></td>
|
18 |
-
|
19 |
-
<td style="display:none;" class="more_toggler1c"><input type="text" name="wccs_settings[buttons][<?php echo $iz; ?>][single_px_cat]" placeholder="<?php _e('Category Slug(s) e.g my-cat||my-cat2','woocommerce-checkout-manager'); ?>" value="<?php echo (empty( $options['buttons'][$iz]['single_px_cat'])) ? '' : $options['buttons'][$iz]['single_px_cat']; ?>" /></td>
|
20 |
-
|
21 |
-
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="6" name="wccs_settings[buttons][<?php echo $iz; ?>][start_hour]" value="<?php echo (empty($options['buttons'][$iz]['start_hour'])) ? '' : $options['buttons'][$iz]['start_hour']; ?>" /></td>
|
22 |
-
|
23 |
-
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="9" name="wccs_settings[buttons][<?php echo $iz; ?>][end_hour]" value="<?php echo (empty($options['buttons'][$iz]['end_hour'])) ? '' : $options['buttons'][$iz]['end_hour']; ?>" /></td>
|
24 |
-
|
25 |
-
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="15" name="wccs_settings[buttons][<?php echo $iz; ?>][interval_min]" value="<?php echo (empty($options['buttons'][$iz]['interval_min'])) ? '' : $options['buttons'][$iz]['interval_min']; ?>" /></td>
|
26 |
-
|
27 |
-
<td style="display:none;" class="hide_stuff_time"><input type="text" placeholder="0, 10, 20, 30, 40" name="wccs_settings[buttons][<?php echo $iz; ?>][manual_min]" value="<?php echo (empty($options['buttons'][$iz]['manual_min'])) ? '' : $options['buttons'][$iz]['manual_min']; ?>" /></td>
|
28 |
-
|
29 |
-
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" placeholder="dd-mm-yy" name="wccs_settings[buttons][<?php echo $iz; ?>][format_date]" value="<?php echo (empty($options['buttons'][$iz]['format_date'])) ? '' : $options['buttons'][$iz]['format_date']; ?>" /></td>
|
30 |
-
|
31 |
-
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" placeholder="+3" name="wccs_settings[buttons][<?php echo $iz; ?>][min_before]" value="<?php echo (empty($options['buttons'][$iz]['min_before'])) ? '' : $options['buttons'][$iz]['min_before']; ?>" /></td>
|
32 |
-
|
33 |
-
<td style="display:none;" class="hide_stuff_color hide_stuff_days"><input type="text" placeholder="3" name="wccs_settings[buttons][<?php echo $iz; ?>][max_after]" value="<?php echo (empty( $options['buttons'][$iz]['max_after'])) ? '' : $options['buttons'][$iz]['max_after']; ?>" /></td>
|
34 |
-
|
35 |
-
<td style="display:none;text-align:center;" class="hide_stuff_color daoo"><input name="wccs_settings[buttons][<?php echo $iz; ?>][days_disabler]" type="checkbox" value="true" <?php if ( !empty ($options['buttons'][$iz]['days_disabler'])) echo "checked='checked'"; ?> /></td>
|
36 |
-
|
37 |
-
<td style="display:none;text-align:c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|