Forums / Developer / Shop Donation / Comment46913

Author Topic

Claudia Kosny

Wednesday 14 February 2007 2:43:01 pm

Comment46913

Hi there

Here just my 2c:
I have given up to patch the shop files for an custom set price. Whereas it was pretty easy to pass the custom price through to the addToBasket function, I did not find a good solution for viewing the basket later on as updatePrices is always called, which fetches the price again from the contentobject. Also using a wishlist would have caused problems.
I have then written a extension which creates a donation object each time a user wants to donate something and then redirects to the shop module. The objects are reused if someone donates the same amount. This works quite well, especially since you do not have to patch any files at all.
At the end I decided that I would rather not clutter up my installation with potentially dozens of donation objects so I just offer a choice of a few preset amounts.

@dev/null
The problem I see with using a trigger is again the updateprices() function. As the post data is not there anymore when this is called, we have a problem.Maybe one could get around that by storing the custom prices somewhere permanently and adapting the functions accordingly.

@Rob Borley
Seeing what's wrong with your code is pretty hard without further explanations. In the part of code you posted I see two strange things, which do not seem to be related to the error message however.
You use $priceObj('price') which should not work, as $priceObject is an object, not a function. You can access the attribute price of the object using $priceObj ->attribute('price').
I am also wondering about where the $priceObj('integer') is coming from. Assuming you have made the same mistake as above, you want to access the 'integer' attribute of the priceobject. Afaik it does not have such an attribute at all. If $priceObj is an instance of your new datatype, this attribute might of course be there, but without more info about the datatype this is hard to say.
So if you still need some help, post a bit info about what your datatype looks like and what exactly it is supposed to do.

Claudia