I have an object I'm trying to access data from but don't seem to be able to get to it.
Using Mage::log($request->debug());
I get the following output
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] =>
)
I'd like to access $request[all_items][0][price] and $request[all_items][0][product][price]
I've tried a view different ways but no matter what I do I just don't seem to be able to get the bits I want out.
I'm sure its simple once you know how :P
You can try this :
$items = $request->getAllItems();
$itemPrice = $items[0]->getPrice();
$productPrice = $items[0]->getProduct()->getPrice();
You'll find some informations about Varien_Object here : http://alanstorm.com/magento_varien_object_debugging
Related
Array
(
[0] => Array
(
[Product] => Array
(
[id] => 5
[user_id] => 5
[category_id] => 1
[name] => Suger
[weight] => 1
[measurement] => kg
[image] =>
[status] => 1
[created] => 2015-05-29 17:02:25
[updated] => 0000-00-00 00:00:00
)
[Category] => Array
(
[id] => 1
[user_id] => 1
[category_name] => Daily uses
[category_image] =>
[status] => 1
[created] => 2015-05-25 12:56:10
[updated] => 2015-06-25 10:27:40
)
[Storeproduct] => Array
(
[0] => Array
(
[id] => 23
[product_id] => 5
[store_id] => 2
[details] =>
[mrp] => 10
[selling_price] => 10
[discount] => 0
[price_difference] => 0
[is_deal] => 0
[deal_start_date] =>
[deal_end_date] =>
[status] => 1
[created] => 1435055384
[updated] => 1435055384
)
[1] => Array
(
[id] => 28
[product_id] => 5
[store_id] => 1
[details] =>
[mrp] => 10
[selling_price] => 10
[discount] => 0
[price_difference] => 0
[is_deal] => 0
[deal_start_date] =>
[deal_end_date] =>
[status] => 1
[created] => 1435062129
[updated] => 1435062129
)
)
)
[1] => Array
(
[Product] => Array
(
[id] => 6
[user_id] => 1
[category_id] => 1
[name] => Tea
[weight] => 1
[measurement] => litre
[image] =>
[status] => 1
[created] => 2015-05-29 17:02:48
[updated] => 2015-06-18 18:53:30
)
[Category] => Array
(
[id] => 1
[user_id] => 1
[category_name] => Daily uses
[category_image] =>
[status] => 1
[created] => 2015-05-25 12:56:10
[updated] => 2015-06-25 10:27:40
)
[Storeproduct] => Array
(
[0] => Array
(
[id] => 22
[product_id] => 6
[store_id] => 2
[details] =>
[mrp] => 10
[selling_price] => 10
[discount] => 0
[price_difference] => 0
[is_deal] => 0
[deal_start_date] =>
[deal_end_date] =>
[status] => 1
[created] => 1435055076
[updated] => 1435055076
)
[1] => Array
(
[id] => 25
[product_id] => 6
[store_id] => 1
[details] =>
[mrp] => 12
[selling_price] => 12
[discount] => 0
[price_difference] => 0
[is_deal] => 0
[deal_start_date] =>
[deal_end_date] =>
[status] => 1
[created] => 1435059905
[updated] => 1435059905
)
)
)
[5] => Array
(
[Product] => Array
(
[id] => 11
[user_id] => 2
[category_id] => 13
[name] => Real Mix Fruit Juice
[weight] => 200
[measurement] => litre
[image] =>
[status] => 1
[created] => 2015-06-17 12:03:19
[updated] => 2015-06-18 13:05:16
)
[Category] => Array
(
[id] => 13
[user_id] => 2
[category_name] => Soft Drink juices
[category_image] =>
[status] => 1
[created] => 2015-06-17 11:15:33
[updated] => 2015-06-18 18:46:03
)
[Storeproduct] => Array
(
[0] => Array
(
[id] => 2
[product_id] => 11
[store_id] => 2
[details] => Real Mix Fruit Juice(200 litre)
[mrp] => 20
[selling_price] => 18
[discount] => 10
[price_difference] => 2
[is_deal] => 0
[deal_start_date] =>
[deal_end_date] =>
[status] => 1
[created] => 1434613767
[updated] => 1434613767
)
[1] => Array
(
[id] => 29
[product_id] => 11
[store_id] => 1
[details] => Real Mix Fruit Juice
[mrp] => 10
[selling_price] => 10
[discount] => 0
[price_difference] => 0
[is_deal] => 0
[deal_start_date] =>
[deal_end_date] =>
[status] => 1
[created] => 1435062192
[updated] => 1435123348
)
)
)
[8] => Array
(
[Product] => Array
(
[id] => 14
[user_id] => 2
[category_id] => 13
[name] => Real Apple Juice
[weight] => 1
[measurement] => ml
[image] =>
[status] => 1
[created] => 2015-06-18 13:06:44
[updated] => 0000-00-00 00:00:00
)
[Category] => Array
(
[id] => 13
[user_id] => 2
[category_name] => Soft Drink juices
[category_image] =>
[status] => 1
[created] => 2015-06-17 11:15:33
[updated] => 2015-06-18 18:46:03
)
[Storeproduct] => Array
(
[0] => Array
(
[id] => 24
[product_id] => 14
[store_id] => 2
[details] =>
[mrp] => 10
[selling_price] => 10
[discount] => 0
[price_difference] => 0
[is_deal] => 0
[deal_start_date] =>
[deal_end_date] =>
[status] => 1
[created] => 1435055411
[updated] => 1435055411
)
)
)
)
In the above array there are two same category array .I would like merge the same category array records
I need a output like
Category => array(
//category data,
Products=>array(//product data,
Storeproducts =>array(
//Storeproducts data
)
)
)
PHP is pretty well documented and you can find all of the Array sorting methods on this page.
There are some good examples in the comments as well - all you need to do is to sort the array by category and you are done.
I've on associative array titled $group_list. When I print it using print_r($grouop_list) it prints following content:
Pages_Component_Controller_List Object
(
[data] => Array
(
[0] => Array
(
[vanity_url] =>
[page_type] => 1
[category_name] => Athletic
[profile_server_id] => 0
[profile_user_image] =>
[is_liked] => 592
[page_id] => 174
[app_id] => 0
[view_id] => 0
[type_id] => 7
[category_id] => 170
[user_id] => 244
[title] => Olympic Games
[code] =>
[unv_title] => 1398
[campus_name] => Mississippi State University, Meridian
[group_type] => close
[reg_method] => 0
[landing_page] => wall
[time_stamp] => 1423362356
[image_path] =>
[image_server_id] => 0
[total_like] => 1
[total_dislike] => 0
[total_comment] => 0
[privacy] => 0
[designer_style_id] => 0
[cover_photo_id] =>
[cover_photo_position] =>
[location_latitude] =>
[location_longitude] =>
[location_name] =>
[use_timeline] => 0
[classroom] =>
[time_class] =>
[num_weeks] =>
[country_iso] => MS
[term] =>
[year] => 2015
[profile_page_id] => 0
[user_server_id] => 0
[user_name] => profile-244
[full_name] => Campusknot .
[gender] => 0
[user_image] => 2015/02/ade52764529ccd469bbddf98aa62712c%s.jpg
[is_invisible] => 0
[user_group_id] => 7
[language_id] =>
[link] => http://54.174.50.242/group/174/
[aFeed] => Array
(
[feed_display] => mini
[comment_type_id] => pages
[privacy] => 0
[comment_privacy] => 0
[like_type_id] => pages
[feed_is_liked] => 592
[feed_is_friend] =>
[item_id] => 174
[user_id] => 244
[total_comment] => 0
[feed_total_like] => 1
[total_like] => 1
[feed_link] => http://54.174.50.242/group/174/
[feed_title] => Olympic Games
[type_id] => pages
)
)
[1] => Array
(
[vanity_url] =>
[page_type] => 1
[category_name] => Academic
[profile_server_id] => 0
[profile_user_image] =>
[is_liked] =>
[page_id] => 170
[app_id] => 0
[view_id] => 0
[type_id] => 7
[category_id] => 169
[user_id] => 244
[title] => Master of Engineering
[code] => ME
[unv_title] => 1398
[campus_name] =>
[group_type] => close
[reg_method] => 0
[landing_page] => wall
[time_stamp] => 1421152531
[image_path] =>
[image_server_id] => 0
[total_like] => 0
[total_dislike] => 0
[total_comment] => 0
[privacy] => 0
[designer_style_id] => 0
[cover_photo_id] =>
[cover_photo_position] =>
[location_latitude] =>
[location_longitude] =>
[location_name] =>
[use_timeline] => 0
[classroom] => traditional
[time_class] => 01:10 AM-04:00 AM
[num_weeks] => Mon-Sat
[country_iso] => MS
[term] => fall
[year] => 2015
[profile_page_id] => 0
[user_server_id] => 0
[user_name] => profile-244
[full_name] => Campusknot .
[gender] => 0
[user_image] => 2015/02/ade52764529ccd469bbddf98aa62712c%s.jpg
[is_invisible] => 0
[user_group_id] => 7
[language_id] =>
[link] => http://54.174.50.242/group/170/
[aFeed] => Array
(
[feed_display] => mini
[comment_type_id] => pages
[privacy] => 0
[comment_privacy] => 0
[like_type_id] => pages
[feed_is_liked] =>
[feed_is_friend] =>
[item_id] => 170
[user_id] => 244
[total_comment] => 0
[feed_total_like] => 0
[total_like] => 0
[feed_link] => http://54.174.50.242/group/170/
[feed_title] => Master of Engineering
[type_id] => pages
)
)
)
[_sModule:Phpfox_Component:private] => pages
[_sComponent:Phpfox_Component:private] => controller/list
[_sCacheVar:Phpfox_Component:private] =>
)
Actually I want all the array elements from belonging to data key only. How should I get this data?
Please help me.
Thanks.
Your $group_list is most probably not an array but indeed an object.
To access the data array you simply use the arrow operator (->):
$data = $group_list->data;
Try it:
echo $grouop_list['data'][0]->title;
echo $grouop_list['data'][0]->time_stamp;
hi this is the part of result of print_r($this->Product) :
[stock_item] => Mage_CatalogInventory_Model_Stock_Item Object
(
[_minSaleQtyCache:Mage_CatalogInventory_Model_Stock_Item:private] => Array
(
)
[_qtyIncrements:protected] =>
[_eventPrefix:protected] => cataloginventory_stock_item
[_eventObject:protected] => item
[_productInstance:protected] => Mage_Catalog_Model_Product Object
*RECURSION*
[_customerGroupId:protected] =>
[_processIndexEvents:protected] => 1
[_resourceName:protected] => cataloginventory/stock_item
[_resource:protected] =>
[_resourceCollectionName:protected] => cataloginventory/stock_item_collection
[_cacheTag:protected] =>
[_dataSaveAllowed:protected] => 1
[_isObjectNew:protected] =>
[_data:protected] => Array
(
[item_id] => 3843
[product_id] => 2573
[stock_id] => 1
[qty] => 2
[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
[low_stock_date] =>
[notify_stock_qty] =>
[use_config_notify_stock_qty] => 1
[manage_stock] => 0
[use_config_manage_stock] => 1
[stock_status_changed_auto] => 0
[use_config_qty_increments] => 1
[qty_increments] => 0.0000
[use_config_enable_qty_inc] => 1
[enable_qty_increments] => 0
[is_decimal_divided] => 0
[type_id] => grouped
[stock_status_changed_automatically] => 0
[use_config_enable_qty_increments] => 1
[product_name] => Amino 12500
[store_id] => 1
[product_type_id] => grouped
[product_status_changed] => 1
[product_changed_websites] =>
)
[_hasDataChanges:protected] => 1
[_origData:protected] => Array
(
[item_id] => 3843
[product_id] => 2573
[stock_id] => 1
[qty] => 0.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
[low_stock_date] =>
[notify_stock_qty] =>
[use_config_notify_stock_qty] => 1
[manage_stock] => 0
[use_config_manage_stock] => 1
[stock_status_changed_auto] => 0
[use_config_qty_increments] => 1
[qty_increments] => 0.0000
[use_config_enable_qty_inc] => 1
[enable_qty_increments] => 0
[is_decimal_divided] => 0
[type_id] => grouped
[stock_status_changed_automatically] => 0
[use_config_enable_qty_increments] => 1
)
[_idFieldName:protected] => item_id
[_isDeleted:protected] =>
[_oldFiel
dsMap:protected] => Array
(
[stock_status_changed_automatically] => stock_status_changed_auto
[use_config_enable_qty_increments] => use_config_enable_qty_inc
)
[_syncFieldsMap:protected] => Array
(
[stock_status_changed_automatically] => stock_status_changed_auto
[use_config_enable_qty_increments] => use_config_enable_qty_inc
[stock_status_changed_auto] => stock_status_changed_automatically
[use_config_enable_qty_inc] => use_config_enable_qty_increments
)
)
As you can see there is 2 ['qty'] values . If I type :
$this->Product['stock_item']['qty'] = 2; I can access the first ['qty']. My question is how can i access the second ['qty'] ? Thx
Magento provides magic getters and setters for anything "data", so you could do this to get and set 'qty':
$qty = $this->product->getQty();
$this->product->setQty($qty);
But you can also use these methods to get the arrays:
$dataArray = $this->product->getData();
$origDataArray = $this->product->getOrigData();
$this->product->setData($dataArray);
$this->product->setOrigData($origDataArray);
Or this to get/set a specific value:
$dataQty = $product->getData('qty');
$origDataQty = $product->getOrigData('qty');
$product->setData('qty', $dataQty);
$product->setOrigData('qty', $origDataQty);
This is the cart array in the Virtuemart 2.0.22a ..
this is stored in "$cart"
how to print [virtuemart_product_id] => 21 at 4.
$cart=
VirtueMartCart Object
(
[products] => Array
(
[21] => stdClass Object
(
[virtuemart_manufacturer_id] => Array
(
)
[slug] => stylish-shirt
[published] => 1
[virtuemart_product_price] =>
[virtuemart_product_id] => 21
[virtuemart_shoppergroup_id] =>
[product_price] => 450.00000
[override] => 0
[product_override_price] => 0.00000
[product_tax_id] => -1
[product_discount_id] => -1
[product_currency] => 68
[virtuemart_vendor_id] => 1
[product_parent_id] => 0
[product_sku] =>
[product_name] => Stylish Shirt
[product_s_desc] =>
[product_weight] =>
[product_weight_uom] => KG
[product_length] =>
[product_width] =>
[product_height] =>
[product_lwh_uom] => M
[product_in_stock] => 0
[product_ordered] => 0
[product_sales] => 0
[product_unit] => KG
[product_packaging] =>
[min_order_level] =>
[max_order_level] =>
[virtuemart_media_id] => Array
(
[0] => 21
)
[step_order_level] =>
[image] => VmImage Object
(
[media_attributes] => 0
[setRole] =>
[file_name] => 3
[file_extension] => jpg
[virtuemart_media_id] => 21
[_foldersToTest:VmMediaHandler:private] => Array
(
[0] => E:\wamp\www\ecomm\images\stories\virtuemart\product\
[1] => E:\wamp\www\ecomm\images\stories\virtuemart\product\resized\
)
[_actions:VmMediaHandler:private] => Array
(
)
[_mLocation:VmMediaHandler:private] => Array
(
)
[_hidden:VmMediaHandler:private] => Array
(
)
[theme_url] => http://localhost/ecomm/components/com_virtuemart/
[virtuemart_vendor_id] => 1
[file_title] => 3.jpg
[file_description] =>
[file_meta] =>
[file_mimetype] => image/jpeg
[file_type] => product
[file_url] => images/stories/virtuemart/product/3.jpg
[file_url_thumb] => images/stories/virtuemart/product/resized/3_90x90.jpg
[published] => 1
[file_is_downloadable] => 0
[file_is_forSale] => 0
[file_is_product_image] => 0
[shared] => 0
[file_params] =>
[file_lang] =>
[_translatable] =>
[_tablePreFix] =>
[created_on] => 2013-08-12 12:32:19
[created_by] => 572
[modified_on] => 2013-08-12 12:38:50
[modified_by] => 572
[file_url_folder] => images/stories/virtuemart/product/
[file_path_folder] => images\stories\virtuemart\product\
[file_url_folder_thumb] => images/stories/virtuemart/product/resized/
[media_role] => file_is_displayable
[file_name_thumb] => 3_90x90
)
[categories] => Array
(
[0] => 6
)
[virtuemart_category_id] => 6
[category_name] => Shirts
[link] => /ecomm/index.php/component/virtuemart/shirts/stylish-shirt-detail?Itemid=0
[packaging] =>
[quantity] => 1
)
)
[_inCheckOut] =>
[_dataValidated] =>
[_blockConfirm] =>
[_confirmDone] =>
[_redirect] =>
[_redirect_disabled] =>
[_lastError] =>
[vendorId] => 1
[lastVisitedCategoryId] => 0
[virtuemart_shipmentmethod_id] => 0
[virtuemart_paymentmethod_id] => 1
[automaticSelectedShipment] => 1
[automaticSelectedPayment] => 1
[BT] => 0
[ST] => 0
[tosAccepted] =>
[customer_comment] =>
[couponCode] =>
[order_language] =>
[cartData] => Array
(
[VatTax] => Array
(
)
[duty] => 1
[payment] => 0
[paymentName] =>
Finally i got the output.. after lot of struggles
foreach($cart->products as $cur)
{
echo $cur->virtuemart_product_id;
}
I found this peice of php which prints out an array from the vm session:
<?php print_r(unserialize($_SESSION['__vm']['vmcart'])); ?>
thiss is the array which is printed out:
stdClass Object
(
[products] => Array
(
[1] => stdClass Object
(
[virtuemart_manufacturer_id] => Array
(
)
[slug] => basic
[published] => 1
[virtuemart_product_price_id] => 1
[virtuemart_product_id] => 1
[virtuemart_shoppergroup_id] =>
[product_price] => 10.00000
[override] =>
[product_override_price] => 0.00000
[product_tax_id] => 0
[product_discount_id] => 0
[product_currency] => 52
[virtuemart_vendor_id] => 1
[product_parent_id] => 0
[product_sku] => 001
[product_name] => Basic
[product_s_desc] = d
[product_weight] => 0.0000
[product_weight_uom] => KG
[product_length] => 0.0000
[product_width] => 0.0000
[product_height] => 0.0000
[product_lwh_uom] => M
[product_in_stock] => 0
[product_ordered] => 2
[product_sales] => 0
[product_unit] => KG
[product_packaging] => 0.0000
[min_order_level] =>
[max_order_level] =>
[virtuemart_media_id] => Array
(
)
[categories] => Array
(
[0] => 1
)
[virtuemart_category_id] => 1
[category_name] => Policies
[link] => /locksure-upgrade/index.php/our-policies/policies/basic-detail
[packaging] => 0
[quantity] => 2
[amount] => 2
[url] => /locksure-upgrade/index.php/our-policies/policies/basic-detail
[customfields] =>
[cart_item_id] => 1
)
)
[vendorId] => 1
[lastVisitedCategoryId] => 0
[virtuemart_shipmentmethod_id] => 1
[virtuemart_paymentmethod_id] => 1
[automaticSelectedShipment] => 1
[automaticSelectedPayment] => 1
[order_number] =>
[BT] => Array
(
[company] =>
[email] => sean#rmspr.co.uk
[title] =>
[first_name] => lock
[middle_name] =>
[last_name] => sure
[address_1] => 20 market street
[address_2] =>
[zip] => wa141pf
[city] => altrincham
[virtuemart_country_id] => 222
[virtuemart_state_id] => 65
[phone_1] => 01619273131
[phone_2] =>
[fax] =>
)
[ST] => 0
[tosAccepted] =>
[customer_comment] =>
[couponCode] =>
[cartData] => Array
(
[duty] => 1
[payment] => 0
[paymentName] => <span class="vmpayment_name">payment</span>
[totalProduct] => 1
[DBTaxRulesBill] => Array
(
)
[taxRulesBill] => Array
(
)
[DATaxRulesBill] => Array
(
)
[shipmentName] => <span class="vmshipment_name">shipment</span>
)
[lists] => Array
(
[shipTo] =>
<input name="shipto" id="shipto1" value="1" checked="checked" type="radio">
<label for="shipto1" id="shipto1-lbl" class="radiobtn">- Default (Same as Billing)<br></label>
[billTo] => 1
)
[pricesUnformatted] => Array
(
[basePrice] => 20
[basePriceWithTax] => 0
[discountedPriceWithoutTax] => 0
[salesPrice] => 20
[taxAmount] => 0
[salesPriceWithDiscount] => 0
[discountAmount] => 0
[priceWithoutTax] => 20
[subTotalProducts] => 0
[1] => Array
(
[costPrice] => 10.00000
[basePrice] => 10
[basePriceVariant] => 10
[basePriceWithTax] => 0
[discountedPriceWithoutTax] => 0
[priceBeforeTax] => 10
[salesPrice] => 10
[taxAmount] => 0
[salesPriceWithDiscount] => 0
[salesPriceTemp] => 10
[unitPrice] => 0
[discountAmount] => 0
[priceWithoutTax] => 10
[variantModification] => 0
[DBTax] => Array
(
)
[Tax] => Array
(
)
[VatTax] => Array
(
)
[DATax] => Array
(
)
[subtotal_with_tax] => 20
[subtotal_tax_amount] => 0
[subtotal_discount] => 0
[subtotal] => 20
)
[discountBeforeTaxBill] => 0
[withTax] => 20
[discountAfterTax] => 20
[shipmentValue] => 0
[shipmentTax] => 0
[shipmentTotal] => 0
[salesPriceShipment] => 0
[shipment_calc_id] => 0
[cost] => 0
[paymentValue] => 0
[paymentTax] => 0
[paymentTotal] => 0
[salesPricePayment] => 0
[payment_calc_id] => 0
[billSub] => 20
[billDiscountAmount] => 0
[billTaxAmount] => 0
[billTotal] => 20
)
[pricesCurrency] => 52
[paymentCurrency] => 52
[_inCheckOut] => 1
[_dataValidated] =>
[_confirmDone] =>
[STsameAsBT] => 0
)
from that array how would i extract the amount of items in the cart? if its even possible?
Solved using the following code for anyone who needs it:
<?php $array = unserialize($_SESSION['__vm']['vmcart']);
$amount = $array->products[1]->amount;
if ($amount != 0){ echo $amount; } else { echo 0; } ?>