merge two different array and then display them php using foreach - php

i am new here...I have two dynamic arrays..their columns are different
First Array:
Array
(
[0] => Array
(
[id] => 102
[parent_id] => 94
[dir_name] => games
[size] =>
[owner_id] => 10
[shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/games
[shared] => 0
[comment] =>
[add_date] => 07/30/2013 02:43 AM
[update_date] => 07/30/2013 02:43 AM
[path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/games
[trash_status] => 1
[password] =>
[expires_after] => 0
[allow_uploading] => 0
[share_date] =>
)
[1] => Array
(
[id] => 122
[parent_id] => 94
[dir_name] => New Folder
[size] => 777835
[owner_id] => 10
[shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/New Folder
[shared] => 0
[comment] =>
[add_date] => 08/16/2013 08:31 AM
[update_date] => 08/16/2013 08:31 AM
[path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/New Folder
[trash_status] => 1
[password] =>
[expires_after] => 0
[allow_uploading] => 0
[share_date] =>
)
[2] => Array
(
[id] => 98
[parent_id] => 94
[dir_name] => Videos
[size] =>
[owner_id] => 10
[shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/Videos/
[shared] => 0
[comment] =>
[add_date] => 07/30/2013 02:38 AM
[update_date] => 07/30/2013 02:38 AM
[path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/Videos/
[trash_status] => 1
[password] =>
[expires_after] => 0
[allow_uploading] => 0
[share_date] =>
)
[3] => Array
(
[id] => 97
[parent_id] => 94
[dir_name] => Pictures
[size] =>
[owner_id] => 10
[shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/Pictures/
[shared] => 0
[comment] =>
[add_date] => 07/30/2013 02:38 AM
[update_date] => 07/30/2013 02:38 AM
[path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/Pictures/
[trash_status] => 1
[password] =>
[expires_after] => 0
[allow_uploading] => 0
[share_date] =>
)
[4] => Array
(
[id] => 95
[parent_id] => 94
[dir_name] => Documents
[size] =>
[owner_id] => 10
[shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/Documents/
[shared] => 1
[comment] =>
[add_date] => 07/30/2013 02:38 AM
[update_date] => 07/30/2013 02:38 AM
[path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/Documents/
[trash_status] => 1
[password] => 123456
[expires_after] => 5
[allow_uploading] => 0
[share_date] => 13-09-2013
)
[5] => Array
(
[id] => 96
[parent_id] => 94
[dir_name] => Music
[size] =>
[owner_id] => 10
[shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/Music/
[shared] => 0
[comment] => dfdf
[add_date] => 07/30/2013 02:38 AM
[update_date] => 07/30/2013 02:38 AM
[path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/Music/
[trash_status] => 1
[password] =>
[expires_after] => 0
[allow_uploading] => 0
[share_date] =>
)
[6] => Array
(
[id] => 233
[parent_id] => 94
[dir_name] => test
[size] => 3945040
[owner_id] => 10
[shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home/test
[shared] => 0
[comment] =>
[add_date] => 09/06/2013 09:16 AM
[update_date] => 09/06/2013 09:16 AM
[path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/test
[trash_status] => 1
[password] =>
[expires_after] => 0
[allow_uploading] => 0
[share_date] =>
)
)
2nd array:
Array
(
[0] => Array
(
[id] => 118
[name] => Desert.jpg
[size] => 845941
[type] => image/jpeg
[ext] => jpg
[shared] => 1
[shared_link] => http://creativevisionintl.com/dev/fwingo/usersdata/saqlain/Home//Desert.jpg
[comment] =>
[owner_id] => 10
[dir_id] => 94
[path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/Home/Desert.jpg
[del_path] => /home1/creatkj8/public_html/dev/fwingo/usersdata/saqlain/HomeDesert.jpg
[dated] => 09/05/2013 07:15 AM
[trash_status] => 1
[password] =>
[expires_after] => 2
[share_date] => 06-09-2013
)
[1] => Array
(
[id] => 120
[name] => test.zip
[size] => 4096
[type] => Zip Archeive
[ext] => zip
[shared] => 0
[shared_link] => /Documentstest.zip
[comment] =>
[owner_id] => 10
[dir_id] => 94
[path] => /Documentstest.zip
[del_path] => /Documentstest.zip
[dated] => 09/06/2013 09:21 AM
[trash_status] => 1
[password] =>
[expires_after] => 0
[share_date] =>
)
)
Note: i want to merge both arrays and after that display them using foreach loop both arrays have different columns.
Thanks. plz urgent replay.

let say $a is your first array and $b is your 2nd array, then for merging them you can do it by below code.
$master = array_merge($a,$b);
then use foreach loop for getting their content like below
foreach($master as $item){
echo $item;
}

First, to merge the arrays into one :
//Merge the arrays
$arrayEnd = array(); // define an array that will contain all the rows
//iterate on the first array assuming its name is $array1
foreach($array1 as $val) {
//add the current line named $val to the resulting array
$arrayEnd[] = $val;
}
//iterate on the first array assuming its name is $array1
foreach($array1 as $val) {
//add the current line named $val to the resulting array
$arrayEnd[] = $val;
}
Then you just need to iterate through the resulting array:
//Display the resulting array
foreach($arrayEnd as $val) {
echo $val['id']." - ".$val['name'];
}

For example merge two arrays
$a = array("red","green","yellow");
$b = array("a","b","c");
$c = array_merge($a,$b);
print_r($c);
foreach ($c as $key => $value) {
echo $value."<br>";
}

Related

Array of array values

I am unable to get stores and store_id from this array. Please help me, how to get stores and store_id from this array of arrays?
Array
(
[group_data] => Uni_Banner_Model_Bannergroup Object
(
[_eventPrefix:protected] => core_abstract
[_eventObject:protected] => object
[_resourceName:protected] => banner/bannergroup
[_resource:protected] =>
[_resourceCollectionName:protected] => banner/bannergroup_collection
[_cacheTag:protected] =>
[_dataSaveAllowed:protected] => 1
[_isObjectNew:protected] =>
[_data:protected] => Array
(
[group_id] => 4
[group_name] => list banner1
[group_code] => list_banner1
[banner_width] => 320
[banner_height] => 460
[animation_type] => 1
[banner_effects] => Fade/Appear
[pre_banner_effects] =>
[banner_ids] => 1
[show_title] => 0
[show_content] => 0
[link_target] => 0
[status] => 1
[created_time] => 2015-03-04 14:47:40
[update_time] => 2015-03-04 14:47:40
)
[_hasDataChanges:protected] => 1
[_origData:protected] => Array
(
[group_id] => 4
[group_name] => list banner1
[group_code] => list_banner1
[banner_width] => 320
[banner_height] => 460
[animation_type] => 1
[banner_effects] => Fade/Appear
[pre_banner_effects] =>
[banner_ids] => 1
[show_title] => 0
[show_content] => 0
[link_target] => 0
[status] => 1
[created_time] => 2015-03-04 14:47:40
[update_time] => 2015-03-04 14:47:40
)
[_idFieldName:protected] => group_id
[_isDeleted:protected] =>
[_oldFieldsMap:protected] => Array
(
)
[_syncFieldsMap:protected] => Array
(
)
)
[banner_data] => Array
(
[0] => Uni_Banner_Model_Banner Object
(
[_eventPrefix:protected] => core_abstract
[_eventObject:protected] => object
[_resourceName:protected] => banner/banner
[_resource:protected] =>
[_resourceCollectionName:protected] => banner/banner_collection
[_cacheTag:protected] =>
[_dataSaveAllowed:protected] => 1
[_isObjectNew:protected] =>
[_data:protected] => Array
(
[banner_id] => 1
[title] => List Banner
[filename] => custom/banners/File-1440417903.jpg
[link] => http://localhost/magentonew/french/
[banner_content] =>
[stores] => 4,6
[storeviews] =>
[status] => 1
[sort_order] => 0
[banner_type] => 0
[created_time] => 2015-08-25 16:44:46
[update_time] => 2015-08-25 16:44:46
[store_id] => Array
(
[0] => 4
[1] => 6
)
)
[_hasDataChanges:protected] => 1
[_origData:protected] => Array
(
[banner_id] => 1
[title] => List Banner
[filename] => custom/banners/File-1440417903.jpg
[link] => http://localhost/magentonew/french/
[banner_content] =>
[stores] => 4,6
[storeviews] =>
[status] => 1
[sort_order] => 0
[banner_type] => 0
[created_time] => 2015-08-25 16:44:46
[update_time] => 2015-08-25 16:44:46
[store_id] => Array
(
[0] => 4
[1] => 6
)
)
[_idFieldName:protected] => banner_id
[_isDeleted:protected] =>
[_oldFieldsMap:protected] => Array
(
)
[_syncFieldsMap:protected] => Array
(
)
)
)
)
This is the code get the data for this specific array and objects. You should really use some getter methods for the objects and iterate the array(s) properly.
$arr = your array
$arr['banner_data'][0]->_data['stores'] and
$arr['banner_data'][0]->_data['store_id'][0]
$arr['banner_data'][0]->_data['store_id'][1]

how to print multiple array in joomla

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;
}

Filter large PHP array

This data is return from Flickr API. It contains 1000 arrays with photo details. The array is given below...
Array
(
[0] => Array
(
[id] => 8437769421
[owner] => 10817753#N03
[secret] => 9eccf2d244
[server] => 8056
[farm] => 9
[title] => [Group 1]-XR6A1835_XR6A1840-6 images-E.jpg
[ispublic] => 1
[isfriend] => 0
[isfamily] => 0
[description] => Array
(
[_content] => Stitched Panorama
)
[dateupload] => 1359826577
[datetaken] => 2012-12-24 10:32:04
[datetakengranularity] => 0
[ownername] => Ulf Bodin
[tags] => mist fog landscape spain ray rays andalusia andalusien spanien landskap salobreña dimma canoneos5dmarkiii canonef70200mmf28lisiiusm
[latitude] => 36.743055
[longitude] => -3.588651
[accuracy] => 16
[context] => 0
[place_id] => qvlfaYpWVbiHFTA
[woeid] => 772523
[geo_is_family] => 0
[geo_is_friend] => 0
[geo_is_contact] => 0
[geo_is_public] => 1
)
[1] => Array
(
[id] => 8437770275
[owner] => 69309429#N02
[secret] => 1805477eb0
[server] => 8078
[farm] => 9
[title] => #Newfoundlanddogs #squirellhatersclub #landseer #newfie #dogs #newfiesofinstagram #instadogs #drool #newfiesarethebestdogsever
[ispublic] => 1
[isfriend] => 0
[isfamily] => 0
[description] => Array
(
[_content] =>
)
[dateupload] => 1359826595
[datetaken] => 2013-02-02 09:36:35
[datetakengranularity] => 0
[ownername] => chefwaiterhater
[tags] => square squareformat normal iphoneography instagramapp uploaded:by=instagram
[latitude] => 0
[longitude] => 0
[accuracy] => 0
[context] => 0
)
.....
.....
.....
[999] => Array
(
[id] => 8438855962
[owner] => 23123736#N00
[secret] => ab5b4dbf4d
[server] => 8092
[farm] => 9
[title] => Dusky drama - drive home
[ispublic] => 1
[isfriend] => 0
[isfamily] => 0
[description] => Array
(
[_content] =>
)
[dateupload] => 1359826602
[datetaken] => 2013-02-02 17:36:42
[datetakengranularity] => 0
[ownername] => angee09
[tags] => square squareformat iphoneography instagramapp xproii uploaded:by=instagram
[latitude] => 0
[longitude] => 0
[accuracy] => 0
[context] => 0
)
);
I want to filter array only containing latitude for that I write this program...
function onlyLatLng($items)
{
$filters = array();
foreach ($items as $item) {
if (!in_array($item['latitude'], array('0', '', 'NULL'))) {
$filters[] = $item;
}
}
return $filters;
}
$latlngs = onlyLatLng($above_big_array);
Is this right way to do? or there is better way to filter the array? Thanks in advance.
You could use the array_filter function:
$latlngs = array_filter($items, function ($item) {
return !in_array($item['latitude'], array('0', '', 'NULL')));
});

how do i display the number of items in the cart on Joomla 2.5 virtuemart?

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; } ?>

PHP Acess multi array object of WP Shopping Cart items

I have array which gets from session, this is print_r of array
print_r($_SESSION['wpsc_cart']);
wpsc_cart Object ( [delivery_country] => AU [selected_country] => AU [delivery_region] => [selected_region] => [selected_shipping_method] => [selected_shipping_option] => [selected_shipping_amount] => [coupon] => [tax_percentage] => 0 [unique_id] => 98b4abe821cda949c0a6feedcd51487134765124 [errors] => Array ( ) [total_tax] => [base_shipping] => [total_item_shipping] => [total_shipping] => [subtotal] => 105 [total_price] => [uses_shipping] => [is_incomplete] => 1 [cart_items] => Array ( [0] => wpsc_cart_item Object ( [cart] => wpsc_cart Object *RECURSION* [product_id] => 1675 [variation_values] => [product_variations] => [variation_data] => [quantity] => 1 [provided_price] => [product_name] => Gift Card [category_list] => Array ( [0] => 30 ) [category_id_list] => Array ( [0] => 13 ) [unit_price] => 30 [total_price] => 30 [taxable_price] => 0 [tax] => 0 [weight] => 0 [shipping] => 0 [sku] => [product_url] => http://www.activefeet.com.au/products-page/30/gift-card [image_id] => [thumbnail_image] => [custom_tax_rate] => [meta] => Array ( [0] => Array ( [wpec_taxes_taxable_amount] => [external_link] => [external_link_text] => [external_link_target] => [weight] => 0 [weight_unit] => pound [dimensions] => Array ( [height] => 0 [height_unit] => in [width] => 0 [width_unit] => in [length] => 0 [length_unit] => in ) [shipping] => Array ( [local] => 5 [international] => 5 ) [no_shipping] => 1 [merchant_notes] => [engraved] => 0 [can_have_uploaded_image] => 0 [enable_comments] => [unpublish_when_none_left] => 0 [quantity_limited] => 0 [special] => 0 [display_weight_as] => pound [table_rate_price] => Array ( [quantity] => Array ( ) [table_price] => Array ( ) ) [google_prohibited] => 0 ) ) [is_donation] => 0 [apply_tax] => 1 [priceandstock_id] => 0 [custom_message] => [custom_file] => [comment] => [time_requested] => [file_data] => [is_customisable] => [stock] => [uses_shipping] => 0 [has_limited_stock] => [file_id] => [is_downloadable] => ) [1] => wpsc_cart_item Object ( [cart] => wpsc_cart Object *RECURSION* [product_id] => 1679 [variation_values] => [product_variations] => [variation_data] => [quantity] => 1 [provided_price] => [product_name] => Gift Card [category_list] => Array ( [0] => 76 ) [category_id_list] => Array ( [0] => 15 ) [unit_price] => 75 [total_price] => 75 [taxable_price] => 0 [tax] => 0 [weight] => 0 [shipping] => 0 [sku] => [product_url] => http://www.activefeet.com.au/products-page/76/gift-card-3 [image_id] => [thumbnail_image] => [custom_tax_rate] => [meta] => Array ( [0] => Array ( [wpec_taxes_taxable_amount] => [external_link] => [external_link_text] => [external_link_target] => [weight] => 0 [weight_unit] => pound [dimensions] => Array ( [height] => 0 [height_unit] => in [width] => 0 [width_unit] => in [length] => 0 [length_unit] => in ) [shipping] => Array ( [local] => 0 [international] => 0 ) [merchant_notes] => [engraved] => 0 [can_have_uploaded_image] => 0 [enable_comments] => [unpublish_when_none_left] => 0 [no_shipping] => 0 [quantity_limited] => 0 [special] => 0 [display_weight_as] => pound [table_rate_price] => Array ( [quantity] => Array ( ) [table_price] => Array ( ) ) [google_prohibited] => 0 ) ) [is_donation] => 0 [apply_tax] => 1 [priceandstock_id] => 0 [custom_message] => [custom_file] => [comment] => [time_requested] => [file_data] => [is_customisable] => [stock] => [uses_shipping] => 1 [has_limited_stock] => [file_id] => [is_downloadable] => ) ) [cart_item] => wpsc_cart_item Object ( [cart] => wpsc_cart Object *RECURSION* [product_id] => 1675 [variation_values] => [product_variations] => [variation_data] => [quantity] => 1 [provided_price] => [product_name] => Gift Card [category_list] => Array ( [0] => 30 ) [category_id_list] => Array ( [0] => 13 ) [unit_price] => 30 [total_price] => 30 [taxable_price] => 0 [tax] => 0 [weight] => 0 [shipping] => 0 [sku] => [product_url] => http://www.activefeet.com.au/products-page/30/gift-card [image_id] => [thumbnail_image] => [custom_tax_rate] => [meta] => Array ( [0] => Array ( [wpec_taxes_taxable_amount] => [external_link] => [external_link_text] => [external_link_target] => [weight] => 0 [weight_unit] => pound [dimensions] => Array ( [height] => 0 [height_unit] => in [width] => 0 [width_unit] => in [length] => 0 [length_unit] => in ) [shipping] => Array ( [local] => 5 [international] => 5 ) [no_shipping] => 1 [merchant_notes] => [engraved] => 0 [can_have_uploaded_image] => 0 [enable_comments] => [unpublish_when_none_left] => 0 [quantity_limited] => 0 [special] => 0 [display_weight_as] => pound [table_rate_price] => Array ( [quantity] => Array ( ) [table_price] => Array ( ) ) [google_prohibited] => 0 ) ) [is_donation] => 0 [apply_tax] => 1 [priceandstock_id] => 0 [custom_message] => [custom_file] => [comment] => [time_requested] => [file_data] => [is_customisable] => [stock] => [uses_shipping] => 0 [has_limited_stock] => [file_id] => [is_downloadable] => ) [cart_item_count] => 2 [current_cart_item] => -1 [in_the_loop] => [shipping_methods] => [shipping_method] => [shipping_method_count] => 1 [current_shipping_method] => -1 [in_the_method_loop] => [shipping_quotes] => [shipping_quote] => [shipping_quote_count] => 0 [current_shipping_quote] => -1 [in_the_quote_loop] => [coupons_name] => [coupons_amount] => 0 [shipping_option] => )
I need to get items from this array
[no_shipping] => 1
[no_shipping] => 0
using some foreach or.. i have no idea about this, please help me..
thank you
i directly use the object, it is easy than convert session to object
foreach($wpsc_cart->cart_items as $i => $Item) {
$cv=$Item->meta;
foreach($cv as $vc=>$it){
echo $it['no_shipping'];
}
}

Categories