I am working on wordpress site and using woocommerce extension http://www.woothemes.com/products/fedex-shipping-module/
I am Passing the values Signature value to adults. But it is not working
Please correct me where i am wrong
$request['RequestedShipment']['RateRequestTypes'] = $this->request_type;
$request['RequestedShipment']['PackageDetail'] = 'INDIVIDUAL_PACKAGES';
$request['RequestedShipment']['SpecialServicesRequested'][] = array(
'SpecialServiceTypes' => 'SIGNATURE_OPTION',
'SignatureOptionDetail' => array(
'OptionType' => 'ADULT'
)
);
`
Do i need to change something from the from the RateService_v13.wsdl file
Please suggest
Thanks
I resolved this issue
For further user having the same issue can resolve this by below code
$item['SpecialServicesRequested'] = array(
'SpecialServiceTypes' => 'SIGNATURE_OPTION',
'SignatureOptionDetail' => array(
'OptionType' => 'ADULT'
)
);
$request['RequestedShipment']['RequestedPackageLineItems'][] = $item;
If Suppose anyone is using Fedex Integration with Laravel you may use below code.
In place of _DIRECT you may use _ADULT or any other option.
$packageLineItem1 = new FedexShipServiceCT\RequestedPackageLineItem();
$packageLineItem1
->setSequenceNumber(1)
->setItemDescription('Product')
->setSpecialServicesRequested(new FedexShipServiceCT\PackageSpecialServicesRequested(array(
'SignatureOptionDetail' => new FedexShipServiceCT\SignatureOptionDetail(array(
'OptionType' => FedexShipServiceST\SignatureOptionType::_DIRECT
))
)))
->setDimensions(new FedexShipServiceCT\Dimensions(array(
'Width' => 1,
'Height' => 1,
'Length' => 1,
'Units' => FedexShipServiceST\LinearUnits::_IN
)))
->setWeight(new FedexShipServiceCT\Weight(array(
'Value' => 1,
'Units' => FedexShipServiceST\WeightUnits::_LB
)));
Thanks
Related
I'm using the code autogenerated by facebook to try and connect to the marketing API to get campaign stats. In doing so, I'm getting:
Uncaught FacebookAds\Http\Exception\AuthorizationException: (#100) results, actions:like, video_play_actions:video_view, video_avg_time_watched_actions:video_view, unique_actions:link_click are not valid for fields param.
$fields = array(
'results',
'reach',
'actions:like',
'video_play_actions:video_view',
'video_avg_time_watched_actions:video_view',
'unique_actions:link_click',
);
var_dump($fields);
$params = array(
'level' => 'campaign',
'filtering' => array(array('field' => 'campaign.delivery_info','operator' => 'IN','value' => array('active'))),
'breakdowns' => array(),
'time_range' => array('since' => '2017-05-19','until' => '2019-05-19'),
);
echo json_encode((new AdAccount($ad_account_id))->getInsights(
$fields,
$params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);
Above I used campaign.delivery_info per this answer. I've also tried (per the auto-generated code):
'filtering' => array(array('field' => 'delivery_info','operator' => 'IN','value' => array('active')))
Seems you are asking for old values field, try this:
$fields = array(
'reach',
'actions',
'video_play_actions',
'video_avg_time_watched_actions',
'outbound_clicks',
);
Hope this help
NB: results field is not available
Fedex seems to have very intuitive documentation and no code samples (besides the downloaded modules). I want to change the currency for the rates from fedex. In documentation/XML file I have found something like preferredCurrency. Similar to other attributes I'm trying to set it like this:
if($var == 'preferredcurrency') Return 'HUF';
but this is totally ignored (I tried also PreferredCurrency) and the returned rate is always $USD. Anyone is familiar with FEDEX API and can help?
UPDATE:
It's basically about requesting and receiving response. I have some function where I set parameters like:
function getProperty($var){
if($var == 'shipper') Return array(
'Contact' => array(
'PersonName' => 'Sender Name',
'CompanyName' => 'Sender Company Name',
'PhoneNumber' => '1234567890'
),
'Address' => array(
'StreetLines' => array('Address Line 1'),
'City' => 'SomeCity',
'StateOrProvinceCode' => 'SomeState',
'PostalCode' => '3434343',
'CountryCode' => 'US',
'Residential' => 1
)
);
}
and then in another file a request to fedex is made, like :
$request['RequestedShipment']['Shipper'] = array(
'Address'=>getProperty('address1')
);
All of this values are defined in an XML file, I'm trying to get rate including CurrencyExchangeRate like this:
$request['CurrencyExchangeRate'] = array(
'FromCurrency' => array('USD'),
'IntoCurrency' => array('HUF'),
'Rate' => array(1.0)
);
But this request is ignored and I don't know why.
Maybe you just have a misssing Element. The Docs are here: Shipment Docs.
$request['RequestedShipment']['PreferredCurrency'] = 'HUF' and
$request['RequestedShipment']['RateRequestTypes'] = 'PREFERRED'
Need some help. Have this code in PaymentModule.php in Prestashop:
$params = array(
'{voucher_amount}' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
'{voucher_num}' => $voucher->code,
'{firstname}' => $this->context->customer->firstname,
'{lastname}' => $this->context->customer->lastname,
'{id_order}' => $order->reference,
'{order_name}' => $order->getUniqReference()
);
I use $params['firstname'] for showing customer firstname and get nothing. I insert $params['firstname'] in /modules/bankwire/bankwire.php
Please tell me where I make a mistake?
Thanks
In your array you have a {firstname} key, but no firstname key.
If you want to get value, you should use: $params['{firstname}']
Try
$params = array(
'voucher_amount' => Tools::displayPrice($voucher->reduction_amount, $this->context->currency, false),
'voucher_num' => $voucher->code,
'firstname' => $this->context->customer->firstname,
'lastname' => $this->context->customer->lastname,
'id_order' => $order->reference,
'order_name' => $order->getUniqReference()
);
or in the case that volkerk is right, try
$params['{firstname}']
there is variables for email template, it's just assoc array, for access use
$params['{voucher_amount}']
Can anyone explain how to use the AWS PHP SDK to log the metric in the style like the above screen.
I use the following PHP code but the select menu is showing "ELB: AvaliabiltyZone", how to make it show "Aggregated by AvaliabiltyZone"? What is the logic used here?
$response = $cw->put_metric_data("ELB", array(
array(
"MetricName" => "Latency",
"Dimensions" => array(
array("Name" => "AvaliabiltyZone" , "Value" => "us-east-1c")
),
"Timestamp" => "now",
"Value" => 1,
"Unit" => "None"
),
));
AvaliabiltyZone
You misspelled "AvailabilityZone"
This maybe won't answer the question, but it might fix some things...
$cw = new AmazonCloudWatch();
$cw->set_region('monitoring.'.$region.'amazonaws.com');
$res1 = $CW->put_metric_data('Sys/RDS' ,
array(array('MetricName' => 'Uptime' ,
'Dimensions' => array(array('Name' => 'AvaliabiltyZone',
'Value' => 'us-east-1c')),
'Value' => $Uptime,
'Unit' => 'Seconds')));
Click Here
It feels like I've tried everything so I now come to you.
I am trying to order my data but it isn't going so well, kinda new to Cake.
This is my code:
$this->set('threads', $this->paginate('Thread', array(
'Thread.hidden' => 0,
'Thread.forum_category_id' => $id,
'order' => array(
'Thread.created' => 'desc'
)
)));
It generates an SQL error and this is the last and interesting part:
AND `Thread`.`forum_category_id` = 12 AND order = ('desc') ORDER BY `Thread`.`created` ASC LIMIT 25
How can I fix this? The field created obviously exists in the database. :/
You need to pass in the conditions key when using multiple filters (i.e. order, limit...). If you just specify conditions, you can pass it as second parameter directly.
This should do it:
$this->set('threads', $this->paginate('Thread', array(
'conditions' => array(
'Thread.hidden' => 0,
'Thread.forum_category_id' => $id
),
'order' => array(
'Thread.created' => 'desc'
)
)));
or perhaps a little clearer:
$this->paginate['order'] = array('Thread.created' => 'desc');
$this->paginate['conditions'] = array('Thread.hidden' => 0, ...);
$this->paginate['limit'] = 10;
$this->set('threads', $this->paginate());
if you get an error, add public $paginate; to the top of your controller.
Try
$this->set('threads', $this->paginate('Thread', array(
'Thread.hidden' => 0,
'Thread.forum_category_id' => $id
),
array(
'Thread.created' => 'desc'
)
));
I'm not a Cake master, just a guess.
EDIT. Yes, thats right. Cake manual excerpt:
Control which fields used for ordering
...
$this->paginate('Post', array(), array('title', 'slug'));
So order is the third argument.
try
$all_threads = $this->Threads->find('all',
array(
'order' => 'Threads.created'
)
);
$saida = $this->paginate($all_threads,[
'conditions' => ['Threads.hidden' => 0]
]);
There are a few things to take note of in paginate with order. For Cake 3.x, you need :
1) Ensure you have included the fields in 'sortWhitelist'
$this->paginate = [
'sortWhitelist' => [
'hidden', 'forum_category_id',
],
];
2) for 'order', if you put it under $this->paginate, you will not be able to sort that field in the view. So it is better to put the 'order' in the query (sadly this wasn't stated in the docs)
$query = $this->Thread->find()
->where( ['Thread.hidden' => 0, 'Thread.forum_category_id' => $id, ] )
->order( ['Thread.created' => 'desc'] );
$this->set('threads', $this->paginate($query)