1

My observer $observer has the basic format:

$observer->_data['result']->_data['booked'][productid][date]

I can access this value like:

$observer->getResult()->getBooked($productid)['2014-10-30 08:00']

But I cannot set it. Is there someway in Magento set set children arrays (multi-dimensional)? I have searched but can't find how to do this. I need something like:

$observer->getResult()->setBooked(($productid)['2014-10-30 08:00'], $value)
1

I'm not sure I have all the facts. but give this a try:

$result = $observer->getResult()
$booked = $result->getBooked();
$booked[product id here][date here] = $value;
$result->setBooked($booked);

If $observer->getResult() is an object (ant it looks like it is) it will be passed by reference, so any modifications you make to it will be taken into account in other scripts that use it.
So the idea of my code is to get the booked data from the result object, modify it and attach the modified value to the result again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.