[TYPO3-commerce] recalculate_item_sums() in basket
Peter Waechtler
piet at repiet.com
Fri Oct 19 11:09:40 CEST 2007
hi franz!
oh my goodness - that was it - it is working! thanks a lot for you help,
kind regards,
peter
On 19 Oct 2007, at 11:04 AM, Franz Koch wrote:
> Hi Peter,
>
> you have to use references:
>
> --- wrong -------------
>> 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;
> -----------------------
>
> --- correct -----------
> 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;
> -----------------------
>
> note the little '&' signs in the last two lines. Without those you
> create a copy of the basket item and not a reference to it. In fact -
> you could also just drop those two lines and always use the full
> path to
> the object. But as I'm lazy in typing I like having 'shortcuts' for
> often used objects and thus used those two references.
>
> --
> Greetings,
> Franz Koch
> _______________________________________________
> TYPO3-project-commerce mailing list
> TYPO3-project-commerce at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-
> commerce
>
More information about the TYPO3-project-commerce
mailing list