0

I am having difficulties getting a specific piece of information from a very LARGE array (so large I can't even paste into here, but here is a link to the array data -> ARRAY DATA )

The code that I am using to get the is the var dump in this code. The get Bookings works fine and gets me the data that I need, but the getShootingTime does not work.

<div class="box-right">
<!--Web702 Module Placeholder - Booking Information -->
  <div class="entry-edit">
     <div class="entry-edit-head">
         <h4 class="icon-head head-bookings"><?php echo Mage::helper('sales')->__('Booking Information') ?></h4>
     </div>
     <fieldset>
        <?php echo $_order->getBookings() ?>
        <?php echo $_order->getShootingTime() ?>
        <?php echo var_dump($_order) ?>
     </fieldset>
  </div>
</div>

My module config file

<?xml version="1.0"?>
<config>
<modules>
    <Web702_Bookings>
     <version>0.1.0</version>
  </Web702_Bookings>
</modules>

<global>
    <models>
        <bookings>
            <class>Web702_Bookings_Model</class>
        </bookings>

        <checkout>
            <rewrite>
                <type_onepage>Web702_Bookings_Model_Type_Onepage</type_onepage>
            </rewrite>
        </checkout>   

        <web702adminthemecontroller>
             <class>Web702_Bookings_Controller</class>
        </web702adminthemecontroller>            

    </models>

    <helpers>
        <bookings>
            <class>Web702_Bookings_Helper</class>
        </bookings>
    </helpers>

    <blocks>        
        <checkout>
            <rewrite>
                <onepage>Web702_Bookings_Block_Onepage</onepage>
            </rewrite>
        </checkout>        

        <bookings>
            <class>Web702_Bookings_Block</class>
        </bookings>  

        <bookingsonepage>
            <class>Web702_Bookings_Block_Onepage</class>
        </bookingsonepage>                                
    </blocks>

    <rewrite>
      <web702_bookings_onepage>
        <from><![CDATA[#^/checkout/onepage/#]]></from>
        <to>/bookings/onepage/</to>
      </web702_bookings_onepage>
    </rewrite>


    <resources>
        <bookings_setup>
            <setup>
               <module>Web702_Bookings</module>
                <class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
            </setup>
            <connection>
               <use>core_setup</use>
            </connection>
        </bookings_setup>
    </resources>

    <events>
        <!-- START Adds the Admin theme switcher, enables to avoid modify admin themes -->
          <adminhtml_controller_action_predispatch_start>
            <observers>
              <web702_themeoverride_observer>
                <type>singleton</type>
                <!-- web702adminthemecontroller/observer  -->
                <class>Web702_Bookings_Controller_Observer</class>
                <method>overrideTheme</method>
              </web702_themeoverride_observer>
            </observers>
          </adminhtml_controller_action_predispatch_start>
          <!-- END Adds the Admin theme switcher, enables to avoid modify admin themes -->          
    </events>


</global>

<frontend>

    <routers>
        <web702_bookings>
        <use>standard</use>
            <args>
                <module>Web702_Bookings</module>
                <frontName>bookings</frontName>
            </args>
        </web702_bookings>  

    </routers>    

  <events>
    <!-- START Custom added by Branko Ajzele: Hooks into order save event -->
    <checkout_onepage_controller_success_action>
        <observers>
            <hooksystem_order_success>
                <type>singleton</type>
                <class>bookings/observer</class>
                <method>hookToOrderSaveEvent</method>
            </hooksystem_order_success>
        </observers>
    </checkout_onepage_controller_success_action>
    <!-- END Custom added by Branko Ajzele: Hooks into order save event -->




  </events>

  <layout>
    <updates>
        <bookings>
            <file>bookings.xml</file>
        </bookings>
    </updates>
 </layout>      

I have also tried:

$_order->shootingTime, $this->getOrder->shootingTime, $this->getOrder->getShootingTime 

and a few various other options.

I am running Magento 1.7.0.2.

My specific question is Will you please take a look at the array data and tell me how to retrieve the data that I want which is the shootingTime.

Thank you in advanced

4

2 回答 2

0

只需使用$order->getData(),否则$order->debug()您只会得到有趣的东西。

如果您想从订单对象中获得该变量,则需要使用$order->getData('shootingTime').

如果您没有将变量添加到订单对象,从产品到报价再到订单(通过 config.xml 字段集定义),或者直接通过$order->setData('shootingTime', "VALUE")它的缺失。

不要忘记在表中添加一列以sales_order_flat保留该数据!

于 2013-08-08T20:40:44.793 回答
0

Magento 使用魔术 getter 和 setter ,这意味着它getShootingTime()正在尝试在Mage_Sales_Model_Order名为 的对象上加载一个属性shooting_time。很有可能,订单上根本没有定义此属性,或者由于未设置该属性而返回 null。

于 2013-08-08T19:15:00.833 回答