Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Shipping by Rules for VirtueMart
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VirtueMart
Shipping by Rules for VirtueMart
Commits
ba590165
Commit
ba590165
authored
10 years ago
by
Reinhold Kainhofer
Browse files
Options
Downloads
Patches
Plain Diff
Add functions: contains_only, contains_none
parent
0a10823d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rules_shipping_base.php
+14
-2
14 additions, 2 deletions
rules_shipping_base.php
with
14 additions
and
2 deletions
rules_shipping_base.php
+
14
−
2
View file @
ba590165
...
@@ -923,19 +923,31 @@ class ShippingRule {
...
@@ -923,19 +923,31 @@ class ShippingRule {
// Extract the array from the args, the $args varialbe will now only contain the elements to be checked:
// Extract the array from the args, the $args varialbe will now only contain the elements to be checked:
$array
=
array_shift
(
$args
);
$array
=
array_shift
(
$args
);
switch
(
$function
)
{
switch
(
$function
)
{
case
"contains_any"
:
case
"contains_any"
:
// return true if one of the $args is in the $array
foreach
(
$args
as
$a
)
{
foreach
(
$args
as
$a
)
{
if
(
in_array
(
$a
,
$array
))
if
(
in_array
(
$a
,
$array
))
return
true
;
return
true
;
}
}
return
false
;
return
false
;
case
"contains_all"
:
case
"contains_all"
:
// return false if one of the $args is NOT in the $array
foreach
(
$args
as
$a
)
{
foreach
(
$args
as
$a
)
{
if
(
!
in_array
(
$a
,
$array
))
if
(
!
in_array
(
$a
,
$array
))
return
false
;
return
false
;
}
}
return
true
;
return
true
;
case
"contains_only"
:
// return false if one of the $array elements is NOT in $args
foreach
(
$array
as
$a
)
{
if
(
!
in_array
(
$a
,
$args
))
return
false
;
}
return
true
;
case
"contains_none"
:
// return false if one of the $args IS in the $array
foreach
(
$args
as
$a
)
{
if
(
in_array
(
$a
,
$array
))
return
false
;
}
return
true
;
default
:
default
:
JFactory
::
getApplication
()
->
enqueueMessage
(
JText
::
sprintf
(
'VMSHIPMENT_RULES_EVALUATE_LISTFUNCTION_UNKNOWN'
,
$function
,
$this
->
rulestring
),
'error'
);
JFactory
::
getApplication
()
->
enqueueMessage
(
JText
::
sprintf
(
'VMSHIPMENT_RULES_EVALUATE_LISTFUNCTION_UNKNOWN'
,
$function
,
$this
->
rulestring
),
'error'
);
return
false
;
return
false
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment