Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VirtueMart
Shipping by Rules for VirtueMart
Commits
b8c331ab
Commit
b8c331ab
authored
Mar 05, 2016
by
Reinhold Kainhofer
Browse files
V6.1: Attempt at per-cart-discounts...
parent
d64dd383
Changes
6
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
b8c331ab
...
...
@@ -2,7 +2,7 @@ BASE=rules_shipping
BASE_ADV
=
rules_shipping_advanced
PLUGINTYPE
=
vmshipment
ZIPBASE
=
opentools_vm
VERSION
=
6.
0
VERSION
=
6.
1
PLUGINFILES
=
$(BASE)
.php
$(BASE)
_base.php
$(BASE)
_framework_joomla.php
$(BASE)
.script.php
$(BASE)
.xml index.html
PLUGINFILES_ADV
=
$(BASE_ADV)
.php
$(BASE)
_base.php
$(BASE)
_framework_joomla.php
$(BASE_ADV)
.script.php
$(BASE_ADV)
.xml index.html
...
...
releases/plg_opentools_vm_rules_shipping_advanced_v6.1.zip
0 → 100644
View file @
b8c331ab
File added
releases/plg_opentools_vm_rules_shipping_v6.1.zip
0 → 100644
View file @
b8c331ab
File added
rules_shipping.xml
View file @
b8c331ab
<?xml version="1.0" encoding="UTF-8" ?>
<extension
version=
"2.5"
type=
"plugin"
group=
"vmshipment"
method=
"upgrade"
>
<name>
OTSHIPMENT_RULES
</name>
<creationDate>
201
4
-0
9
-1
4
</creationDate>
<creationDate>
201
6
-0
2
-1
5
</creationDate>
<author>
Reinhold Kainhofer
</author>
<authorUrl>
http://www.open-tools.net
</authorUrl>
<copyright>
Copyright (C) 2013-2014, Reinhold Kainhofer
</copyright>
<license>
GPL v3+
</license>
<version>
6.
0
</version>
<version>
6.
1
</version>
<description>
OTSHIPMENT_RULES_DESC
</description>
<files>
<filename
plugin=
"rules_shipping"
>
rules_shipping.php
</filename>
...
...
rules_shipping_advanced.xml
View file @
b8c331ab
<?xml version="1.0" encoding="UTF-8" ?>
<extension
version=
"1.5"
type=
"plugin"
group=
"vmshipment"
method=
"upgrade"
>
<name>
OTSHIPMENT_RULES_ADV
</name>
<creationDate>
201
4
-0
9
-1
4
</creationDate>
<creationDate>
201
6
-0
2
-1
5
</creationDate>
<author>
Reinhold Kainhofer
</author>
<authorUrl>
http://www.open-tools.net
</authorUrl>
<copyright>
Copyright (C) 2013-2014, Reinhold Kainhofer
</copyright>
<license>
GPL v3+
</license>
<version>
6.
0
</version>
<version>
6.
1
</version>
<description>
OTSHIPMENT_RULES_ADV_DESC
</description>
<files>
<filename
plugin=
"rules_shipping_advanced"
>
rules_shipping_advanced.php
</filename>
...
...
rules_shipping_framework_joomla.php
View file @
b8c331ab
...
...
@@ -277,6 +277,7 @@ class RulesShippingFrameworkJoomla extends RulesShippingFramework {
}
protected
function
getOrderPrices
(
$cart
,
$products
,
/*$cart_prices, */
$method
)
{
$cart_prices
=
$cart
->
cartPrices
;
$data
=
array
(
'amount'
=>
0
,
'amountwithtax'
=>
0
,
...
...
@@ -289,43 +290,36 @@ class RulesShippingFrameworkJoomla extends RulesShippingFramework {
'salespricewithdiscount'
=>
0
,
'discountamount'
=>
0
,
'pricewithouttax'
=>
0
,
// Bill-related prices: Will not be affected by scoping! Totals before and after cart-wide discounts.
'billtotal'
=>
$cart_prices
[
'billTotal'
],
'billdiscountamount'
=>
$cart_prices
[
'billDiscountAmount'
],
'billtaxamount'
=>
$cart_prices
[
'billTaxAmount'
],
'billsubtotal'
=>
$cart_prices
[
'billSub'
],
);
// if (!empty($cart_prices)) {
// // get prices for the whole cart -> simply user the cart_prices
// $data['amount'] = $cart_prices['salesPrice'];
// $data['amountwithtax'] = $cart_prices['salesPrice'];
// $data['amountwithouttax'] = $cart_prices['priceWithoutTax'];
// $data['baseprice'] = $cart_prices['basePrice'];
// $data['basepricewithtax'] = $cart_prices['basePriceWithTax'];
// $data['discountedpricewithouttax'] = $cart_prices['discountedPriceWithoutTax'];
// $data['salesprice'] = $cart_prices['salesPrice'];
// $data['taxamount'] = $cart_prices['taxAmount'];
// $data['salespricewithdiscount'] = $cart_prices['salesPriceWithDiscount'];
// $data['discountamount'] = $cart_prices['discountAmount'];
// $data['pricewithouttax'] = $cart_prices['priceWithoutTax'];
// } else {
// Calculate the prices from the individual products!
// Possible problems are discounts on the order total
foreach
(
$products
as
$product
)
{
// $prices = isset($product->allPrices)?($product->allPrices[$product->selectedPrice]):($product->prices);
$prices
=
$product
->
prices
;
$quant
=
$product
->
quantity
;
$data
[
'amount'
]
+=
$quant
*
$prices
[
'salesPrice'
];
$data
[
'amountwithtax'
]
+=
$quant
*
$prices
[
'salesPrice'
];
$data
[
'amountwithouttax'
]
+=
$quant
*
$prices
[
'priceWithoutTax'
];
$data
[
'baseprice'
]
+=
$quant
*
$prices
[
'basePrice'
];
$data
[
'basepricewithtax'
]
+=
$quant
*
$prices
[
'basePriceWithTax'
];
$data
[
'discountedpricewithouttax'
]
+=
$quant
*
$prices
[
'discountedPriceWithoutTax'
];
$data
[
'salesprice'
]
+=
$quant
*
$prices
[
'salesPrice'
];
$data
[
'taxamount'
]
+=
$quant
*
$prices
[
'taxAmount'
];
$data
[
'salespricewithdiscount'
]
+=
$quant
*
$prices
[
'salesPriceWithDiscount'
];
$data
[
'discountamount'
]
+=
$quant
*
$prices
[
'discountAmount'
];
$data
[
'pricewithouttax'
]
+=
$quant
*
$prices
[
'priceWithoutTax'
];
// JFactory::getApplication()->enqueueMessage("<pre>getOrderPrices, cart=".print_r($cart,1)."</pre>", 'error');
// Calculate the prices from the individual products!
// Possible problems are discounts on the order total
foreach
(
$products
as
$product
)
{
// $prices = isset($product->allPrices)?($product->allPrices[$product->selectedPrice]):($product->prices);
$prices
=
$product
->
prices
;
$quant
=
$product
->
quantity
;
$data
[
'amount'
]
+=
$quant
*
$prices
[
'salesPrice'
];
$data
[
'amountwithtax'
]
+=
$quant
*
$prices
[
'salesPrice'
];
$data
[
'amountwithouttax'
]
+=
$quant
*
$prices
[
'priceWithoutTax'
];
$data
[
'baseprice'
]
+=
$quant
*
$prices
[
'basePrice'
];
$data
[
'basepricewithtax'
]
+=
$quant
*
$prices
[
'basePriceWithTax'
];
$data
[
'discountedpricewithouttax'
]
+=
$quant
*
$prices
[
'discountedPriceWithoutTax'
];
$data
[
'salesprice'
]
+=
$quant
*
$prices
[
'salesPrice'
];
$data
[
'taxamount'
]
+=
$quant
*
$prices
[
'taxAmount'
];
$data
[
'salespricewithdiscount'
]
+=
$quant
*
$prices
[
'salesPriceWithDiscount'
];
$data
[
'discountamount'
]
+=
$quant
*
$prices
[
'discountAmount'
];
$data
[
'pricewithouttax'
]
+=
$quant
*
$prices
[
'priceWithoutTax'
];
// JFactory::getApplication()->enqueueMessage("<pre>prices: ".print_r($prices,1)."</pre>", 'error');
// JFactory::getApplication()->enqueueMessage("<pre>product: ".print_r($product,1)."</pre>", 'error');
}
// }
}
return
$data
;
}
...
...
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