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
9eaf6261
Commit
9eaf6261
authored
11 years ago
by
Reinhold Kainhofer
Browse files
Options
Downloads
Patches
Plain Diff
Implement country/state variables
parent
f1a36c32
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
rules_shipping.xml
+1
-1
1 addition, 1 deletion
rules_shipping.xml
rules_shipping_base.php
+30
-3
30 additions, 3 deletions
rules_shipping_base.php
with
32 additions
and
5 deletions
Makefile
+
1
−
1
View file @
9eaf6261
...
...
@@ -2,7 +2,7 @@ BASE=rules_shipping
BASE_ADV
=
rules_shipping_advanced
PLUGINTYPE
=
vmshipment
ZIPBASE
=
opentools_vm2
VERSION
=
3.
0.2
VERSION
=
3.
1
PLUGINFILES
=
$(
BASE
)
.php
$(
BASE
)
_base.php
$(
BASE
)
.script.php
$(
BASE
)
.xml index.html
PLUGINFILES_ADV
=
$(
BASE_ADV
)
.php
$(
BASE
)
_base.php
$(
BASE_ADV
)
.script.php
$(
BASE_ADV
)
.xml index.html
...
...
This diff is collapsed.
Click to expand it.
rules_shipping.xml
+
1
−
1
View file @
9eaf6261
...
...
@@ -6,7 +6,7 @@
<authorUrl>
http://www.open-tools.net
</authorUrl>
<copyright>
Copyright (C) 2013, Reinhold Kainhofer
</copyright>
<license>
GPL v3+
</license>
<version>
3.
0.2
</version>
<version>
3.
1
</version>
<description>
VMSHIPMENT_RULES_DESC
</description>
<files>
<filename
plugin=
"rules_shipping"
>
rules_shipping.php
</filename>
...
...
This diff is collapsed.
Click to expand it.
rules_shipping_base.php
+
30
−
3
View file @
9eaf6261
...
...
@@ -415,6 +415,33 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin {
return
$dimensions
;
}
function
getOrderCountryState
(
VirtueMartCart
$cart
,
$address
)
{
$data
=
array
();
$countriesModel
=
VmModel
::
getModel
(
'country'
);
if
(
isset
(
$address
[
'virtuemart_country_id'
]))
{
$countriesModel
->
setId
(
$address
[
'virtuemart_country_id'
]);
$country
=
$countriesModel
->
getData
();
$data
[
'countryid'
]
=
$country
->
virtuemart_country_id
;
$data
[
'country'
]
=
$country
->
country_name
;
$data
[
'country2'
]
=
$country
->
country_2_code
;
$data
[
'country3'
]
=
$country
->
country_3_code
;
}
$statesModel
=
VmModel
::
getModel
(
'state'
);
if
(
isset
(
$address
[
'virtuemart_country_id'
]))
{
$statesModel
->
setId
(
$address
[
'virtuemart_state_id'
]);
$state
=
$statesModel
->
getData
();
$data
[
'stateid'
]
=
$state
->
virtuemart_state_id
;
$data
[
'state'
]
=
$state
->
state_name
;
$data
[
'state2'
]
=
$state
->
state_2_code
;
$data
[
'state3'
]
=
$state
->
state_3_code
;
}
return
$data
;
}
/** Allow child classes to add additional variables for the rules
*/
protected
function
addCustomCartValues
(
VirtueMartCart
$cart
,
$cart_prices
,
&
$values
)
{
...
...
@@ -444,15 +471,15 @@ class plgVmShipmentRules_Shipping_Base extends vmPSPlugin {
'discountamount'
=>
$cart_prices
[
'discountAmount'
],
'pricewithouttax'
=>
$cart_prices
[
'priceWithoutTax'
],
// 'discountbeforetaxbill'=>$cart_prices['discountBeforeTaxBill'],
'country'
=>
$address
[
'virtuemart_country_id'
],
);
$cartvals
=
array_merge
(
$cartvals
,
$this
->
getOrderCountryState
(
$cart
,
$address
));
$cartvals
=
array_merge
(
$cartvals
,
$this
->
getOrderWeights
(
$cart
,
$method
->
weight_unit
));
$cartvals
=
array_merge
(
$cartvals
,
$this
->
getOrderDimensions
(
$cart
,
$method
->
length_unit
));
// Let child classes update the $cartvals array, or add new variables
$this
->
addCustomCartValues
(
$cart
,
$cart_prices
,
$cartvals
);
// JFactory::getApplication()->enqueueMessage("<pre>cart prices: ".print_r($cart_prices,1)."</pre>", 'error');
// JFactory::getApplication()->enqueueMessage("<pre>cart: ".print_r($cart,1)."</pre>", 'error');
return
$cartvals
;
}
...
...
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