I'm receiving the following:
(
[0] => stdClass Object
(
[adm_big_picture] =>
[adm_group] =>
[adm_group_message] =>
[adm_large_icon] =>
[adm_small_icon] =>
[adm_sound] =>
[amazon_background_data] =>
[android_accent_color] =>
[android_group] =>
[android_group_message] =>
[android_led_color] =>
[android_sound] =>
[android_visibility] =>
[app_id] => xxx
[big_picture] =>
[buttons] =>
[canceled] =>
[chrome_big_picture] =>
[chrome_icon] =>
[chrome_web_icon] =>
[chrome_web_image] =>
[content_available] =>
[contents] => stdClass Object
(
[en] => English Message
)
[converted] => 0
[data] => stdClass Object
(
[foo] => bar
)
[delayed_option] =>
[delivery_time_of_day] =>
[errored] => 0
[excluded_segments] => Array
(
)
[failed] => 0
[firefox_icon] =>
[headings] => stdClass Object
(
)
[id] => xxx
[include_player_ids] =>
[included_segments] => Array
(
[0] => All
)
[ios_badgeCount] =>
[ios_badgeType] =>
[ios_category] =>
[ios_sound] =>
[isAdm] =>
[isAndroid] =>
[isChrome] =>
[isChromeWeb] => 1
[isFirefox] => 1
[isIos] =>
[isSafari] => 1
[isWP] =>
[isWP_WNS] =>
[large_icon] =>
[priority] =>
[queued_at] => 1492795180
[remaining] => 0
[send_after] => 1492795180
[small_icon] =>
[successful] => 5
[tags] =>
[filters] =>
[template_id] =>
[ttl] =>
[url] =>
[web_buttons] =>
[wp_sound] =>
[wp_wns_sound] =>
)
)
which is set as an array in $notifications.
I manage to get the field id by using the following:
for ($i = 0; $i < count($notifications); $i++) {
$notId = $notifications[$i]->id;
$title = $notifications[$i]->content->en;
echo '<p>'.$notId.' - '.$title.'</p>';
}
I am trying to obtain contents->en now, but not managing. Can someone point me the right direction please?
Related
I'm trying to access the second array (contacts) in this decoded json to grab the ID next to first_name (the two ID keys could be different), but the second array doesn't seem to be an object so I can't find a loop which can acces it:
stdClass Object (
[data] => Array (
[0] => stdClass Object (
[account_key] => jvg7qgtw2btrlmpigrq2zpco48eegxvv
[is_owner] => 1
[id] => 1
[name] => test test
[display_name] => test test
[balance] => 0
[paid_to_date] => 0
[updated_at] => 1578494555
[archived_at] =>
[address1] => Street
[address2] =>
[city] => Town
[state] => State
[postal_code] => Code
[country_id] => 0
[work_phone] => Number
[private_notes] =>
[public_notes] =>
[last_login] =>
[website] =>
[industry_id] => 0
[size_id] => 0
[is_deleted] =>
[payment_terms] => 30
[vat_number] =>
[id_number] =>
[language_id] => 0
[currency_id] => 0
[custom_value1] =>
[custom_value2] =>
[invoice_number_counter] => 1
[quote_number_counter] => 1
[task_rate] => 0
[shipping_address1] =>
[shipping_address2] =>
[shipping_city] =>
[shipping_state] =>
[shipping_postal_code] =>
[shipping_country_id] => 0
[show_tasks_in_portal] => 1
[send_reminders] => 1
[credit_number_counter] => 1
[custom_messages] => {}
[contacts] => Array (
[0] => stdClass Object (
[account_key] => jvg7qgtw2btrlmpigrq2zpco48eegxvv
[is_owner] => 1
[id] => 1
[first_name] => test
[last_name] => test
[email] => myemail#me.com
[contact_key] => mq1dzpkqznfgtqwhdwt9nte1ohmvsju1
[updated_at] => 1578494555
[archived_at] =>
[is_primary] => 1
[phone] => 07919446174
[last_login] =>
[send_invoice] => 1
[custom_value1] =>
[custom_value2] =>
)
)
)
)
[meta] => stdClass Object (
[pagination] => stdClass Object (
[total] => 1
[count] => 1
[per_page] => 15
[current_page] => 1
[total_pages] => 1
[links] => Array ( )
)
)
)
This is what I've tried, but it doesn't find anything:
$person = getclient($itemid);
$person_data = json_decode($person);
foreach ($person_data->contacts as $key => $item)
{
$itemid = $item->id . "<br />";
}
$person_data contains the data property, which is an array of objects.
foreach ($person_data->data as $person) {
foreach ($person->contacts as $contact) {
echo $contact->id . '<br>';
}
}
I am using SOAP API for DocuSign. It is demo account.
So, I have created my code based on sendatemplate.php and I use the templatereference class to create my FieldData and this is the result in array
Array ( [0] => TemplateReference Object ( [TemplateLocation] => Server
[Template] => 2ade4fe1-9b7b-49eb-af2e-xxxxxxxxx [Document] =>
[RoleAssignments] => Array ( [0] => TemplateReferenceRoleAssignment Object (
[RoleName] => Signer1 [RecipientID] => 1 ) ) [FieldData] =>
TemplateReferenceFieldData Object ( [DataValues] => Array ( [0] =>
TemplateReferenceFieldDataDataValue Object ( [TabLabel] => Company [Value]
=> Otto ) ) ) [AdditionalTabs] => [Sequence] => [TemplateAttachments] => ) )
I then use the RequestStatusResponse and this is my result:
RequestStatusResponse Object
(
[RequestStatusResult] => EnvelopeStatus Object
(
[RecipientStatuses] => stdClass Object
(
[RecipientStatus] => Array
(
[0] => RecipientStatus Object
(
[Type] => Signer
[Email] => xxxxxx#yahoo.com
[UserName] => xxxxx
[RoutingOrder] => 1
[Sent] => 2015-12-02T22:56:01.317
[Delivered] => 2015-12-02T22:56:13.567
[Signed] =>
[Declined] =>
[DeclineReason] =>
[Status] => Delivered
[RecipientIPAddress] => xxxxxxxx
[ClientUserId] => 1
[AutoNavigation] =>
[IDCheckInformation] =>
[RecipientAuthenticationStatus] =>
[CustomFields] => stdClass Object
(
)
[TabStatuses] => stdClass Object
(
[TabStatus] => Array
(
[0] => TabStatus Object
(
[TabType] => SignHere
[Status] => Active
[XPosition] => 1333
[YPosition] => 964
[Signed] =>
[TabLabel] => Signature 1
[TabName] => Signature
[TabValue] =>
[DocumentID] =>
[PageNumber] =>
[OriginalValue] =>
[ValidationPattern] =>
[RoleName] =>
[ListValues] =>
[ListSelectedValue] =>
[ScaleValue] =>
[CustomTabType] =>
)
[1] => TabStatus Object
(
[TabType] => Custom
[Status] => Active
[XPosition] => 989
[YPosition] => 916
[Signed] =>
[TabLabel] => Address
[TabName] => Address
[TabValue] =>
[DocumentID] =>
[PageNumber] =>
[OriginalValue] =>
[ValidationPattern] =>
[RoleName] =>
[ListValues] =>
[ListSelectedValue] =>
[ScaleValue] =>
[CustomTabType] =>
)
[2] => TabStatus Object
(
[TabType] => FullName
[Status] => Active
[XPosition] => 989
[YPosition] => 872
[Signed] =>
[TabLabel] => Name 1
[TabName] => Name
[TabValue] =>
[DocumentID] =>
[PageNumber] =>
[OriginalValue] =>
[ValidationPattern] =>
[RoleName] =>
[ListValues] =>
[ListSelectedValue] =>
[ScaleValue] =>
[CustomTabType] =>
)
[3] => TabStatus Object
(
[TabType] => Company
[Status] => Active
[XPosition] => 683
[YPosition] => 252
[Signed] =>
[TabLabel] => Company
[TabName] => Company
[TabValue] =>
[DocumentID] =>
[PageNumber] =>
[OriginalValue] =>
[ValidationPattern] =>
[RoleName] =>
[ListValues] =>
[ListSelectedValue] =>
[ScaleValue] =>
[CustomTabType] =>
)
)
)
[RecipientAttachment] =>
[AccountStatus] =>
[EsignAgreementInformation] =>
[FormData] =>
[RecipientId] =>
)
)
)
I don't see my Company values are populated.
Please help!!!
I am using PHP code to do this.
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 have an array $arr.
when I print this it shows the results as follows.
Array
(
[0] => Array
(
[name] => homeandgarden-Control Type
[1] => Array
(
[0] => product
)
)
[1] => Array
(
[name] => homeandgarden-Depth
[1] => Array
(
[0] => product
)
)
[2] => Array
(
[name] => homeandgarden-Height
[1] => Array
(
[0] => product
)
)
[3] => Array
(
[name] => homeandgarden-Load Type
[1] => Array
(
[0] => product
)
)
[4] => Array
(
[name] => homeandgarden-Machine Type
[1] => Array
(
[0] => product
)
)
[5] => Array
(
[name] => homeandgarden-Type
[1] => Array
(
[0] => product
)
)
[6] => Array
(
[name] => homeandgarden-Width
[1] => Array
(
[0] => product
)
)
[7] => Array
(
[name] => computer & ele
[label] =>
[singular_label] =>
[hierarchical] => 1
[show_ui] => 1
[query_var] => 1
[rewrite] => 1
[rewrite_slug] =>
[0] => Array
(
[search_items] =>
[popular_items] =>
[all_items] =>
[parent_item] =>
[parent_item_colon] =>
[edit_item] =>
[update_item] =>
[add_new_item] =>
[new_item_name] =>
[separate_items_with_commas] =>
[add_or_remove_items] =>
[choose_from_most_used] =>
)
[1] => Array
(
[0] => product
)
)
[8] => Array
(
[name] => computer
[label] =>
[singular_label] =>
[hierarchical] => 1
[show_ui] => 1
[query_var] => 1
[rewrite] => 1
[rewrite_slug] =>
[0] => Array
(
[search_items] =>
[popular_items] =>
[all_items] =>
[parent_item] =>
[parent_item_colon] =>
[edit_item] =>
[update_item] =>
[add_new_item] =>
[new_item_name] =>
[separate_items_with_commas] =>
[add_or_remove_items] =>
[choose_from_most_used] =>
)
[1] => Array
(
[0] => product
)
)
[9] => Array
(
[name] => homeandgardenairconditioner-Type
[label] =>
[singular_label] =>
[hierarchical] => 1
[show_ui] => 1
[query_var] => 1
[rewrite] => 1
[rewrite_slug] =>
[0] => Array
(
[search_items] =>
[popular_items] =>
[all_items] =>
[parent_item] =>
[parent_item_colon] =>
[edit_item] =>
[update_item] =>
[add_new_item] =>
[new_item_name] =>
[separate_items_with_commas] =>
[add_or_remove_items] =>
[choose_from_most_used] =>
)
[1] => Array
(
[0] => product
)
)
[10] => Array
(
[name] => homeandgardendishwasher-Control Type
[label] =>
[singular_label] =>
[hierarchical] => 1
[show_ui] => 1
[query_var] => 1
[rewrite] => 1
[rewrite_slug] =>
[0] => Array
(
[search_items] =>
[popular_items] =>
[all_items] =>
[parent_item] =>
[parent_item_colon] =>
[edit_item] =>
[update_item] =>
[add_new_item] =>
[new_item_name] =>
[separate_items_with_commas] =>
[add_or_remove_items] =>
[choose_from_most_used] =>
)
[1] => Array
(
[0] => product
)
)
)
and I have a variable $categ.For example $categ = "homeandgardenairconditioner-Type"
then I want to know the index of the parent array whose "name" is "homeandgardenairconditioner-Type"
i.e --- o/p should be 9
how to get this index. Please help me
Thanks
I think you are looking for this:
function getIndex($name, $array){
foreach($array as $key => $value){
if(is_array($value) && $value['name'] == $name)
return $key;
}
return null;
}
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'];
}
}