[TYPO3-commerce] recalculate_item_sums() in basket
Peter Waechtler
piet at repiet.com
Fri Oct 19 10:02:27 CEST 2007
hello,
i am busy implementing my own global discount option based on the
code by franz koch: http://lists.netfielders.de/pipermail/typo3-
project-commerce/2007-October/001218.html
every thing is working, except the recalculation of the the sums.
when i echo $basketItem->priceGross; i get the new gross price - yet
the sums in the basket to not change - what am i doing wrong?
thanks,
piet
-------------
class tx_grn_pi2 {
function postartAddUid(&$basket,&$parent) {
$keys = array_keys($basket->basket_items);
foreach($keys as $itemId) {
$basketItem = $basket->basket_items[$itemId];
$articleObj = $basketItem->article;
//get prices of items
$arrayOfPricesUids = $articleObj->get_article_price_uid();
$prices[$itemId] = new tx_commerce_article_price
($itemId,$basketItem->lang_id);
$prices[$itemId]->load_data();
if (is_array($prices)) {
$price_id = $articleObj->get_article_price_uid();
$basketPriceNet = $basket->getArticleTypeSumNet
(NORMALArticleType);
foreach ($prices as $key => $priceObject) {
$basketItem->price_uid = $key;
$basketItem->price = $priceObject;
}
$basketItem->priceNet = $basketItem->price-
>get_price_net()*9;
$basketItem->priceGross = $basketItem->price-
>get_price_gross()*9;
//show new prices - have they been calculated?
echo $basketItem->priceGross;
$basketItem->recalculate_item_sums();
}
}
}
}
-------------
More information about the TYPO3-project-commerce
mailing list