Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
woocommerce-quick-donation
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wordpress
woocommerce-quick-donation
Commits
8693c14a
Commit
8693c14a
authored
May 19, 2016
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for woocommerce-currency-switcher
parent
4bb9cc21
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
9 deletions
+26
-9
class-quick-donation-functions.php
includes/class-quick-donation-functions.php
+16
-3
class-quick-donation-process.php
includes/class-quick-donation-process.php
+8
-5
field-text.php
template/fields/field-text.php
+2
-1
No files found.
includes/class-quick-donation-functions.php
View file @
8693c14a
...
@@ -184,7 +184,7 @@ class WooCommerce_Quick_Donation_Functions {
...
@@ -184,7 +184,7 @@ class WooCommerce_Quick_Donation_Functions {
$amount
=
explode
(
'|'
,
$amount
);
$amount
=
explode
(
'|'
,
$amount
);
$c
=
get_woocommerce_currency_symbol
();
$c
=
get_woocommerce_currency_symbol
();
foreach
(
$amount
as
$amts
){
foreach
(
$amount
as
$amts
){
$pre_amt
[
$amts
]
=
$c
.
''
.
$
amts
;
$pre_amt
[
$amts
]
=
$c
.
''
.
$
this
->
get_price_in_current_currency
(
floatval
(
$amts
))
;
}
}
}
}
...
@@ -353,7 +353,20 @@ class WooCommerce_Quick_Donation_Functions {
...
@@ -353,7 +353,20 @@ class WooCommerce_Quick_Donation_Functions {
if
(
$echo
){
echo
$url
;
return
;}
if
(
$echo
){
echo
$url
;
return
;}
return
$url
;
return
$url
;
}
}
public
function
get_current_currency
()
{
global
$WOOCS
;
if
(
$this
->
currency_switcher
)
return
$WOOCS
->
current_currency
;
return
get_woocommerce_currency
();
}
public
function
get_price_in_current_currency
(
$price
)
{
global
$WOOCS
;
if
(
$this
->
currency_switcher
)
return
apply_filters
(
'woocs_exchange_value'
,
$price
);
return
$price
;
}
public
function
encryptor
(
$action
,
$string
)
{
public
function
encryptor
(
$action
,
$string
)
{
$output
=
false
;
$output
=
false
;
...
@@ -366,4 +379,4 @@ class WooCommerce_Quick_Donation_Functions {
...
@@ -366,4 +379,4 @@ class WooCommerce_Quick_Donation_Functions {
return
$output
;
return
$output
;
}
}
}
}
\ No newline at end of file
includes/class-quick-donation-process.php
View file @
8693c14a
...
@@ -114,8 +114,11 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation {
...
@@ -114,8 +114,11 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation {
$price_check
=
$this
->
check_min_max
(
$projects
,
$donate_price
);
$price_check
=
$this
->
check_min_max
(
$projects
,
$donate_price
);
if
(
!
$price_check
){
return
false
;}
if
(
!
$price_check
){
return
false
;}
global
$WOOCS
;
$woocommerce
->
session
->
donation_price
=
$donate_price
;
$currencies
=
$WOOCS
->
get_currencies
();
$value
=
$donate_price
/
$currencies
[
$WOOCS
->
current_currency
][
'rate'
];
$woocommerce
->
session
->
donation_price
=
$value
;
$woocommerce
->
session
->
projects
=
$projects
;
$woocommerce
->
session
->
projects
=
$projects
;
$woocommerce
->
session
->
is_donation_product
=
true
;
$woocommerce
->
session
->
is_donation_product
=
true
;
...
@@ -172,7 +175,7 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation {
...
@@ -172,7 +175,7 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation {
$price
=
intval
(
$price
);
$price
=
intval
(
$price
);
if
(
$min_required
){
if
(
$min_required
){
$min_required
=
intval
(
$min_required
);
$min_required
=
floatval
(
WC_QD
()
->
f
()
->
get_price_in_current_currency
(
floatval
(
$min_required
))
);
if
(
$price
<
$min_required
){
if
(
$price
<
$min_required
){
$id
=
WC_QD_DB
.
'min_rda_msg'
;
$id
=
WC_QD_DB
.
'min_rda_msg'
;
$search_replace
=
array
(
'{donation_amount}'
=>
$price
,
'{min_amount}'
=>
$min_required
);
$search_replace
=
array
(
'{donation_amount}'
=>
$price
,
'{min_amount}'
=>
$min_required
);
...
@@ -184,7 +187,7 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation {
...
@@ -184,7 +187,7 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation {
if
(
$max_required
){
if
(
$max_required
){
$max_required
=
intval
(
$max_required
);
$max_required
=
floatval
(
WC_QD
()
->
f
()
->
get_price_in_current_currency
(
floatval
(
$max_required
))
);
if
(
$price
>
$max_required
){
if
(
$price
>
$max_required
){
$id
=
WC_QD_DB
.
'max_rda_msg'
;
$id
=
WC_QD_DB
.
'max_rda_msg'
;
$search_replace
=
array
(
'{donation_amount}'
=>
$price
,
'{max_amount}'
=>
$max_required
);
$search_replace
=
array
(
'{donation_amount}'
=>
$price
,
'{max_amount}'
=>
$max_required
);
...
@@ -254,4 +257,4 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation {
...
@@ -254,4 +257,4 @@ class WooCommerce_Quick_Donation_Process extends WooCommerce_Quick_Donation {
}
}
?>
?>
\ No newline at end of file
template/fields/field-text.php
View file @
8693c14a
...
@@ -11,5 +11,6 @@
...
@@ -11,5 +11,6 @@
type=
"
<?php
echo
$field_type
;
?>
"
type=
"
<?php
echo
$field_type
;
?>
"
id=
"
<?php
echo
$id
;
?>
"
id=
"
<?php
echo
$id
;
?>
"
name=
"
<?php
echo
$name
;
?>
"
name=
"
<?php
echo
$name
;
?>
"
step=
"any"
class=
"
<?php
echo
$class
.
' '
.
$attributes
;
?>
"
class=
"
<?php
echo
$class
.
' '
.
$attributes
;
?>
"
value=
"
<?php
echo
$value
;
?>
"
/>
value=
"
<?php
echo
$value
;
?>
"
/>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment