Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Magento访问嵌套数据_Php_Magento - Fatal编程技术网

Php Magento访问嵌套数据

Php Magento访问嵌套数据,php,magento,Php,Magento,我有一个试图访问数据的对象,但似乎无法访问它 使用Mage::log($request->debug()) 我得到以下输出 Array ( [all_items] => Array ( [0 (Mage_Sales_Model_Quote_Item)] => Array ( [item_id] => 593 [quote_id] => 536

我有一个试图访问数据的对象,但似乎无法访问它

使用
Mage::log($request->debug())

我得到以下输出

Array
(
[all_items] => Array
    (
        [0 (Mage_Sales_Model_Quote_Item)] => Array
            (
                [item_id] => 593
                [quote_id] => 536
                [created_at] => 2012-07-12 11:40:17
                [updated_at] => 2012-07-12 12:10:31
                [product_id] => 37191
                [store_id] => 8
                [is_virtual] => 0
                [sku] => 30018025
                [name] => Fish Snowboard 2012
                [free_shipping] => 
                [is_qty_decimal] => 0
                [no_discount] => 0
                [weight] => 5000.0000
                [qty] => 1
                [price] => 429.12
                [base_price] => 429.12
                [discount_percent] => 0.0000
                [discount_amount] => 0.0000
                [base_discount_amount] => 0.0000
                [tax_percent] => 20
                [tax_amount] => 85.8200
                [base_tax_amount] => 85.8200
                [row_total] => 429.12
                [base_row_total] => 429.12
                [row_total_with_discount] => 0.0000
                [row_weight] => 5000
                [product_type] => simple
                [price_incl_tax] => 514.94
                [base_price_incl_tax] => 514.9400
                [row_total_incl_tax] => 514.94
                [base_row_total_incl_tax] => 514.94
                [weee_tax_disposition] => 0
                [weee_tax_row_disposition] => 0
                [base_weee_tax_disposition] => 0
                [base_weee_tax_row_disposition] => 0
                [weee_tax_applied] => a:0:{}
                [weee_tax_applied_amount] => 0
                [weee_tax_applied_row_amount] => 0
                [base_weee_tax_applied_amount] => 0
                [qty_options] => Array
                    (
                    )

                [product (OrganicInternet_SimpleConfigurableProducts_Catalog_Model_Product)] => Array
                    (
                        [entity_id] => 37191
                        [entity_type_id] => 4
                        [attribute_set_id] => 10
                        [type_id] => simple
                        [sku] => 30018025
                        [has_options] => 0
                        [required_options] => 0
                        [created_at] => 2011-06-19 17:34:46
                        [updated_at] => 2012-01-19 14:28:08
                        [name] => Fish Snowboard 2012
                        [small_image] => /f/i/fish-snowboard-2012-164.jpg
                        [thumbnail] => /f/i/fish-snowboard-2012-164.jpg
                        [url_key] => burton-fish-snowboard-2012-164cm
                        [url_path] => burton-fish-snowboard-2012-164cm
                        [msrp_enabled] => Use config
                        [msrp_display_actual_price_type] => Use config
                        [gift_message_available] => 
                        [status] => 1
                        [visibility] => 4
                        [enable_googlecheckout] => 1
                        [tax_class_id] => 2
                        [price] => 524.9400
                        [weight] => 5000.0000
                        [is_salable] => 1
                        [stock_item (Mage_CatalogInventory_Model_Stock_Item)] => Array
                            (
                                [item_id] => 35510
                                [product_id] => 37191
                                [stock_id] => 1
                                [qty] => 2.0000
                                [min_qty] => 0.0000
                                [use_config_min_qty] => 1
                                [is_qty_decimal] => 0
                                [backorders] => 0
                                [use_config_backorders] => 1
                                [min_sale_qty] => 1.0000
                                [use_config_min_sale_qty] => 1
                                [max_sale_qty] => 0.0000
                                [use_config_max_sale_qty] => 1
                                [is_in_stock] => 1
                                [notify_stock_qty] => 0.0000
                                [use_config_notify_stock_qty] => 1
                                [manage_stock] => 1
                                [use_config_manage_stock] => 1
                                [stock_status_changed_auto] => 0
                                [stock_status_changed_automatically] => 0
                                [use_config_qty_increments] => 1
                                [qty_increments] => 0.0000
                                [use_config_enable_qty_inc] => 1
                                [use_config_enable_qty_increments] => 1
                                [enable_qty_increments] => 0
                                [type_id] => simple
                                [stock_status] => 1
                                [product_name] => Fish Snowboard 2012
                                [store_id] => 8
                                [product_type_id] => simple
                                [product_status_changed] => 1
                                [ordered_items] => 1
                            )

                        [request_path] => burton-fish-snowboard-2012-164cm
                        [tier_price] => Array
                            (
                            )

                        [is_in_stock] => 1
                        [store_id] => 8
                        [customer_group_id] => 0
                    )

                [tax_class_id] => 2
                [has_error] => 
                [is_nominal] => 
                [base_original_price] => 514.9400
                [taxable_amount] => 514.94
                [base_taxable_amount] => 514.94
                [is_price_incl_tax] => 1
                [discount_calculation_price] => 429.12
                [base_discount_calculation_price] => 429.12
                [base_weee_tax_applied_row_amount] => 0
            )

    )

[dest_country_id] => GB
[dest_region_code] => 
[dest_street] => ndjn
[dest_city] => ihho
[dest_postcode] => iohih
[package_value] => 514.94
[package_value_with_discount] => 429.12
[package_weight] => 5000
[package_qty] => 1
[package_physical_value] => 429.12
[free_method_weight] => 5000
[store_id] => 8
[website_id] => 4
[free_shipping] => 0
[base_currency (Mage_Directory_Model_Currency)] => Array
    (
        [currency_code] => GBP
    )

[package_currency (Mage_Directory_Model_Currency)] => Array
    (
        [currency_code] => GBP
    )

[country_id] => GB
[region_id] => 0
[city] => 
[postcode] => 
[p_rcondition_name] => package_standard
[ignore_free_items] => 
)
我想访问
$request[all\u items][0][price]
$request[all\u items][0][product][price]

我尝试过不同的观点,但无论我做什么,我似乎都无法得到我想要的东西

我相信,一旦你知道了方法,它就很简单了:p你可以试试这个:

$items = $request->getAllItems();
$itemPrice = $items[0]->getPrice();
$productPrice = $items[0]->getProduct()->getPrice();

您将在此处找到有关Varien_对象的一些信息:

尝试深入日志语句,直到获得有趣的结果。例如:
Mage::log($request[all_items])
,然后
Mage::log($request[all_items][0])
,等等。