Filter large PHP array - php

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

Related

Convert WSDL to array

I have a WSDL that is mapped to a variable
$client = new SoapClient($wsdl, array("connection_timeout"=>10));
It returns an array like:
stdClass Object
(
[getProductsReturn] => Array
(
[0] => stdClass Object
(
[barCode] => 5060285475448
[brandId] => 0
[childProductIds] => stdClass Object
(
)
[childProductIdsAsIntArray] => stdClass Object
(
)
[childProductIdsList] =>
[fullProductPaths] => Candles->Amber And Lavender Scented Sachet
[fullProductPathsArray] => stdClass Object
(
)
[id] => 5883
[image] =>
[imageId] => 0
[itemCount] => 1
[longDescription] =>
[masterProductId] => 5883
[message] =>
[messagePrice] => 0
[messageType] => 0
[optionId] => 0
[optionName] => null
[optionSetId] => 0
[optionSetName] => null
[orderType] => 5050
[parentProductCode] =>
[parentProductId] => 8088
[price] => 2.99
[productCode] => AA2485
[productId] => 0
[productType] => 1010
[quantity] => 0
[quantityPrice] => 0
[rrp] => 2.99
[shortDescription] => Amber And Lavender Scented Sachet
[variation] =>
[vatCodeDomainId] => 0
[wrappingPrice] => 0
[wrappingType] => 0
)
[1] => stdClass Object
(
[barCode] => 5060285475547
[brandId] => 0
[childProductIds] => stdClass Object
(
)
[childProductIdsAsIntArray] => stdClass Object
(
)
[childProductIdsList] =>
[fullProductPaths] => Candles->Lavender And Bergamot Scented Sachet
[fullProductPathsArray] => stdClass Object
(
)
[id] => 5881
[image] =>
[imageId] => 0
[itemCount] => 1
[longDescription] =>
[masterProductId] => 5881
[message] =>
[messagePrice] => 0
[messageType] => 0
[optionId] => 0
[optionName] => null
[optionSetId] => 0
[optionSetName] => null
[orderType] => 5050
[parentProductCode] =>
[parentProductId] => 8088
[price] => 2.99
[productCode] => AA2484
[productId] => 0
[productType] => 1010
[quantity] => 0
[quantityPrice] => 0
[rrp] => 2.99
[shortDescription] => Lavender And Bergamot Scented Sachet
[variation] =>
[vatCodeDomainId] => 0
[wrappingPrice] => 0
[wrappingType] => 0
)
I want to show this in a HTML and this is what I had given in the for loop:
<pre>
foreach ($product as $products) {
$currentStockQuantity = $product->barCode($products);
echo $currentStockQuantity;
echo $products->barCode;
echo $products[$i]->shortDescription;
echo $products[$i]->barCode;
$i++;
}
But it is not showing all the products, there are about 100 products but only one is showing at the moment
Assuming you stored the result array from your WSDL in a $products variable, you could try:
foreach ($products as $product) {
echo $product->shortDescription;
echo $product->barCode;
// ... and whatever you want
}
More information about foreach: http://php.net/manual/en/control-structures.foreach.php

How do i get specific value from first array and second array

How i can get value of latitude in first array and second array using php? I hope you can teach me how to do it.. Thanks in advance
Here the array
Array
(
[0] => Array
(
[unit_id] => 2
[added_when] => 2014-01-10 09:57:05
[latitude] => 11.6994922
[longitude] => 122.36759245
[speed] => 0
[head] =>
[valid] => 1
[bearing] => 0
[accuracy] => 141
[altitude] => 0
[distance] => 18
[id] => 2014-01-10
[start_datetime] => 2014-01-10 09:53:48
[stop_time] => 18:38:05
[client_id] => 2
[imei] => 865687015810821
[name] => cm flare
[group_id] => 1
[status] => 1
)
[1] => Array
(
[unit_id] => 2
[added_when] => 2014-01-09 10:48:06
[latitude] => 11.6994922
[longitude] => 122.36759245
[speed] => 0
[head] =>
[valid] => 1
[bearing] => 0
[accuracy] => 141
[altitude] => 0
[distance] => 0
[id] => 2014-01-09
[start_datetime] => 2014-01-09 10:45:46
[stop_time] => 17:27:07
[client_id] => 2
[imei] => 865687015810821
[name] => cm flare
[group_id] => 1
[status] => 1
)
)
If you has a dynamic array
$first = $array[0]['latitude'];
$last = $array[count($array)-1]['latitude'];
For you example you can just use this code
$first = $array[0]['latitude'];
$last = $array[1]['latitude'];
if you want a general and reusable way define this function:
function array_pluck ($toPluck, $arr) {
return array_map(function ($item) use ($toPluck) {
return $item[$toPluck];
}, $arr);
}
then
$latitudes = array_pluck("latitude", $myarrays);
Use a foreach loop.
foreach($arrays as $array) {
echo $array['latitude'];
echo $array['longitude'];
}

merge two different array and then display them php using foreach

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

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