$object = new Varien_Object(array('amount' => 20.50)); $amount = $object->getAmount(); // returns 20.50
class Order extends Varien_Object { public function getInvoiceAmount() { return $this->getAmount('invoice_amount'); } } $order = new Order(array('invoice_amount' => 100.00)); $amount = $order->getInvoiceAmount(); // returns 100.00In this example, we extend the Varien_Object class to create a custom Order class. The Order class includes a new getInvoiceAmount() method that calls the getAmount() method on a specific key ('invoice_amount') within the instance. A new $order variable is instantiated, passing in an argument of the array with an 'invoice_amount' key with a value of 100.00. The getInvoiceAmount() method is then called on the $order instance, which returns 100.00. The Varien_Object class is a part of the Magento Framework package library. It provides the base model for most of the models in Magento and is crucial for the functioning of the core system.