Doing print_r() on my array I get the following:
stdClass Object
(
[Products] => Array
(
[0] => stdClass Object
(
[Id] => 265531
[ProductTitle] => test0
[ZarfiyatSalane] => 600.000
[MizanJazbMavad] => 660.000
)
[1] => stdClass Object
(
[Id] => 265532
[ProductTitle] => test1
[ZarfiyatSalane] => 500.000
[MizanJazbMavad] => 500.000
)
)
)
How can I access a specific value in the array?
The following code does not work because of the stdClass Object
echo $array['ProductTitle'];
Related
[0] => Array
(
[id] => 1612
[phone] => 9638527410
[email] => sample#gmail.com
[entityid] => dummy entity
........
[recordtype] => contact
)
[1] => Array
(
[id] => 1812
[email] => sample0#gmail.com
[entityid] => dummy entity0
........
[recordtype] => contact
)
.........
.........
I got the result of all contacts like above. But now I want get only who is having Phone no. I tried
filters[0] = new nlobjSearchFilter('phone', null, 'noneof', '#NONE#');.
No success. What filter should use to get the my desired result?
Thanks in advance
Below should work using nlobjSearchFilter
nlapiSearchRecord('contact', null,
new nlobjSearchFilter('phone', null, 'isnotempty'));
If you are looking for filter expression:
nlapiSearchRecord('contact', null, ['phone', 'isnotempty', ''])
I just want the standard Excerpt box - not a metabox of my own creation, added to a Custom Post. The box shows up in Posts but not in Custom Posts. I've tried both of these older solutions but neither of them worked (maybe it's a WP 3.9 problem):
The custom post type name is "Scoop"
I added this to the register_post_type_scoop() $labels = array
'supports' => array('title','thumbnail','excerpt')
but it didn't work - neither did this:
add_post_type_support('Scoop', 'title');
add_post_type_support('Scoop', array('title', 'thumbnail', 'excerpt') );
Add a index value excerpt to the supports object. Below the example is:
add_action( 'init', 'create_testimonial_posttype' );
function create_testimonial_posttype(){
register_post_type( 'testimonials',
array(
'labels' => array(
'name' => __( 'Testimonials' ),
'singular_name' => __( 'Testimonial' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'clients'),
'supports' => array('title','thumbnail','editor','page-attributes','excerpt'),
)
);
}
Since Tax Code (SalesTaxItem) don't have a search interface, so that I use getAll function.
But with some users, I receive error message "That record does not exist." although [totalRecords] = 67.
My first question : So how can I avoid this error ?
This is structure of GetAllResponse Object
(
[getAllResult] => GetAllResult Object
(
[status] => Status Object
(
[statusDetail] => Array
(
[0] => StatusDetail Object
(
[code] => RCRD_DSNT_EXIST
[message] => That record does not exist.
[type] => ERROR
)
)
[isSuccess] =>
)
[totalRecords] => 67
[recordList] =>
)
)
My second question: On success, I receive SalesTaxItem list. But don't have subsidiary list. How can I get subsidiary list of each SalesTaxItem ?
[getAllResult] => GetAllResult Object
(
[status] => Status Object
(
[statusDetail] =>
[isSuccess] => 1
)
[totalRecords] => 68
[recordList] => RecordList Object
(
[record] => Array
(
[0] => SalesTaxItem Object
(
[itemId] => tax company 15
[displayName] =>
[description] =>
[rate] => 1.00%
[taxType] => RecordRef Object
(
[internalId] => -75
[externalId] =>
[type] =>
[name] => Other 25 Sales Tax
)
[taxAgency] => RecordRef Object
(
[internalId] => 1285
[externalId] =>
[type] =>
[name] => Store Tax Agency
)
[purchaseAccount] =>
[saleAccount] =>
[isInactive] =>
[effectiveFrom] =>
[validUntil] =>
[eccode] =>
[reverseCharge] =>
[parent] =>
[exempt] =>
[isDefault] =>
[excludeFromTaxReports] =>
[available] =>
[export] =>
[taxAccount] => RecordRef Object
(
[internalId] => 375
[externalId] =>
[type] =>
[name] => Sales Taxes Payable
)
[county] =>
[city] =>
[state] =>
[zip] =>
[nexusCountry] =>
[internalId] => 955
[externalId] =>
[nullFieldList] =>
)
Thank you very much.
Best regards
Problems resolved.
First question :Because data on NetSuite have errors. I removed some invalid records on NetSuite.
Second question: Before I used PHP Toolkit v2013_1_0, when use new Toolkit v2013_2_0, result has SubsidiaryList.
Thank you very much.
Now i have 2 ways to get tax code from NetSuite and these are advantage/disadvantage of each
1/ The first way:
I get all tax code from saleTaxItem list and save in database, with this way, it's easy and fast.
But we must to check, employees/vendors has permission to use it. in result, SalesTaxItem object don't have any property refer to employees/vendors and Employee/Vendor object don't have refer key to SalesTaxItem too.
So, how can i know employee/vendor has permission to use taxcode with this way?
This is structure of SalesTaxItem Object:
SalesTaxItem Object
(
[itemId] => Item Name
[displayName] =>
[description] =>
[rate] => 7.25%
[taxType] =>
[taxAgency] => RecordRef Object
(
[internalId] => -100
[externalId] =>
[type] =>
[name] => New Name
)
[purchaseAccount] =>
[saleAccount] =>
[isInactive] =>
[effectiveFrom] =>
[validUntil] =>
[eccode] =>
[reverseCharge] =>
[parent] =>
[exempt] =>
[isDefault] =>
[excludeFromTaxReports] =>
[available] =>
[export] =>
[taxAccount] => RecordRef Object
(
[internalId] => 37
[externalId] =>
[type] =>
[name] => New Name
)
[county] => Country Name
[city] =>
[state] => CA
[zip] => ,95646,96120
[nexusCountry] =>
[internalId] => -111
[externalId] =>
[nullFieldList] =>
)
2/ The second way:
I get employees list, vendors list. And foreach those lists to get taxcodes with function getSelectValueResult of NetsuiteService object.
With this way, with each employee/vendor we need call function getSelectValueResult to get taxcodes list of that employee/vendor. Althought we have 10 tax codes, but we need call function 1000 times (if we have 1000 employee/vendor).
Advantage of this way , we can save reference keys [taxcodes, employee], [taxcodes, vendor], it help check employee/vendor has permission to use tax code.
Disadvantage : slow and waste our time, and get duplicate tax code records.
This is structure of GetSelectValueResult Object when call function getSelectValueResult for each employee/vendor
[getSelectValueResult] => GetSelectValueResult Object
(
[status] => Status Object
(
[statusDetail] =>
[isSuccess] => 1
)
[totalRecords] => 2
[totalPages] => 1
[baseRefList] => BaseRefList Object
(
[baseRef] => Array
(
[0] => RecordRef Object
(
[internalId] => 25821
[externalId] =>
[type] => platformCore:RecordRef
[name] => My tax code name 1
)
[1] => RecordRef Object
(
[internalId] => 27812
[externalId] =>
[type] => platformCore:RecordRef
[name] => My tax code name 2
)
)
)
)
Which one i should to use ?
I think first way is good, but how can i check permission of employee/vendor when use taxcode?
Thank you very much.
Since Individual Tax codes does not have permission, you can get the roles of the employees separately and store it in a separate table. So you can join the roles whenever you need.
I have a Custom Post Type using the Custom Post Type UI plugin called Case Studies. I'm also using the Custom Fields to add a capability field to the Case Studies.
How can I query Case Studies where the capability is equal to some ID?
$query = array('post_type' => 'case-studies','posts_per_page' => 3);
is my query so far
It could be
$query = array(
'post_type' => 'case-studies',
'meta_key' => 'capability',
'meta_value' => 10, // some ID
'posts_per_page' => 3
);
$the_query = new WP_Query( $query );
while ( $the_query->have_posts() ) : $the_query->the_post();
// echo here
endwhile;
wp_reset_postdata();
You need to set your key to capability, and then query value by your post ID.
'meta_query' => array(
array(
'key' => 'capability',
'value' => $post->ID,
'compare' => 'example'
)
)