1

I try to var_dump($order) but it gives me :

object(Varien_Object)#290 (7) { ["_data":protected]=> array(0) { } ["_hasDataChanges":protected]=> bool(false) ["_origData":protected]=> NULL ["_idFieldName":protected]=> NULL ["_isDeleted":protected]=> bool(false) ["_oldFieldsMap":protected]=> array(0) { } ["_syncFieldsMap":protected]=> array(0) { } }

My class PaketId_Shipping_Block_Adminhtml_Sales_Order_Shipment_View_Shipping extends Mage_Core_Block_Template {

protected $order;

public function getOrder() {
    if (is_null($this->order)) {
        if (Mage::registry('current_order')) {
            $order = Mage::registry('current_order');
        }
        elseif (Mage::registry('order')) {
            $order = Mage::registry('order');
        }
        else {
            $order = new Varien_Object();
        }
        $this->order = $order;
    }
    return $this->order;
}

My phtml file :

<?php echo $this->getChildHtml('PaketId_Shipping');?>
<h1>Test custom block</h1>
<?php $order = $this->getOrder()?>
<?php var_dump($order);?>
<?php $shippings = Mage::getModel('paketid_shipping/result')->getCollection()->addOrderFilter($order) ?>
<?php echo "<pre>";?>
<?php var_dump($shippings);?>
<?php echo "</pre>" ;?>

My variable $order in phtml file somehow doesn't call the $order in block file, or I have been misunderstanding about this? Because, when i try to var_dump($order) in other phtml, it returns object(Mage_Sales_Model_Order)#276...

  • it gives me array(0) – may Sep 19 '16 at 3:57
  • it gives me object(Mage_Sales_Model_Quote)#390 (21) { ["_eventPrefix":protected]=> string(11) "sales_quote" ["_eventObject":protected]=> string(5) "quote" ["_cacheTag":protected]=> string(5) "quote" ["_customer":protected]=> NULL ["_addresses":protected]=> NULL ["_items":protected]=> NULL ["_payments":protected]=> NULL [...] what does this means? – may Sep 19 '16 at 4:06
  • how to determine if the result of $order = Mage::getSingleton[...] is my current order ? – may Sep 19 '16 at 4:07
  • it gives me NULL when changing into getSingleton('sales/order') – may Sep 19 '16 at 4:11
  • it gives me object(Mage_Sales_Model_Order)#291 (29) { ["_eventPrefix":protected]=> string(11) "sales_order" ["_eventObject":protected]=> string(5) "order" what does the #291 means? – may Sep 19 '16 at 4:22

Your Answer

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

Browse other questions tagged or ask your own question.