Parsing Shipping API Data in Magento2

Do I have a twin with permutated remainders?

What does it mean to describe someone as a butt steak?

Does a druid starting with a bow start with no arrows?

Is there a hemisphere-neutral way of specifying a season?

How to prevent "they're falling in love" trope

Why does Kotter return in Welcome Back Kotter?

How can I make my BBEG immortal short of making them a Lich or Vampire?

Theorems that impeded progress

Is it legal for company to use my work email to pretend I still work there?

What's the difference between 'rename' and 'mv'?

Could gravitational lensing be used to protect a spaceship from a laser?

Infinite Abelian subgroup of infinite non Abelian group example

How do I write bicross product symbols in latex?

Blender 2.8 I can't see vertices, edges or faces in edit mode

Has there ever been an airliner design involving reducing generator load by installing solar panels?

What is the intuition behind short exact sequences of groups; in particular, what is the intuition behind group extensions?

How to draw the figure with four pentagons?

How is it possible to have an ability score that is less than 3?

A reference to a well-known characterization of scattered compact spaces

How much of data wrangling is a data scientist's job?

Will google still index a page if I use a $_SESSION variable?

Can a virus destroy the BIOS of a modern computer?

How can I tell someone that I want to be his or her friend?

Stopping power of mountain vs road bike



Parsing Shipping API Data in Magento2







.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am implementing my own shipping API integration in magento2. I am able to get all the details finely. But all of sudden it is giving an error as follows.



Exception #0 (Exception): Notice: Undefined property: stdClass::$rate_breakup in /var/www/html/b2b/app/code/My/Shipping/Controller/Adminhtml/Order/Sendform.php on line 68


My Sendform.php is



class Sendform extends MagentoBackendAppAction
{
public function execute()
$data = $this->getRequest()->getPostValue();

$result = $this->_objectManager->create('ShipyaariShippingModelSearchService')->avilable_service($data);
$result=json_decode($result);


if($result)

$status__=0;



if($result->success==1)

$status__=1;



if($status__==1)


$html= '<div style="border:1px solid #e3e3e3;border-radius:5px;padding:20px;">
<div>
<h3>List Of Available Services</h3>
<hr>
</div>
<div>
<table class="table" style="border-spacing:0px;width:100%;">
<thead>
<tr>
<th><center><strong>Sr. NO.</strong></center></th>
<th>Partner Name</th>
<th><center><strong>Image</strong></center></th>
<th><center><strong>Expected Pickup Date</strong></center></th>
<th><center><strong>Service Type</strong></center></th>
<th><center><strong>Grand Total</strong></center></th>
<th><center><strong>Base Price</strong></center></th>
<th><center><strong>Fuel Surcharge</strong></center></th>
<th><center><strong>GST</strong></center></th>
<th><center><strong>Action</strong></center></th>
</tr>
<tr><td colspan="10"><hr/></td></tr>
</thead>
<tbody>';

$i=0;
//foreach($result as $value)

//$i++;

foreach($result->couriers as $courier)
$i++;

if($result->success==1)

print_r($result);
$html .= '<tr class="success">
<th><center><strong>'.$i.'</strong></center></th>
<td><center><strong>'.$courier->name.'</strong></center></td>
<td><center><img width="100" height="100" src="'.$courier->logo_url.'"/></center></td>
<td><center>'.$courier->exp_pickup_date.'</center></td>';
foreach($courier->service_types as $service_types)
$service_type=$service_types->service_name;

$goods_services_tax=$service_types->rate_breakup->goods_services_tax;
$base_rate=$service_types->rate_breakup->base_rate;

$html .= '</tr><td></td><td></td><td></td><td></td><td><center>'.$service_types->service_name.'</center></td>
<td><center>'.$service_types->rate_breakup->total_charge.'</center></td>
<td><center>'.$base_rate.'</center></td>
<td><center>'.$service_types->rate_breakup->fuel_surcharge.'</center></td>
<th><center><strong>'.$goods_services_tax.'</strong></center></th>
<td><center>';
$html .="<button class='submit' id='".$courier->courier_id."' onclick='send_to_zepo("$courier->courier_id", "$service_types->service_id","$service_type");'>Select</button></center></td>";


$html .= '
<tr><td colspan="8"><hr style="background-color: #e3e3e3; height: 1px; border: 0;"/></td></tr>';

if($result->success!=1)

$html .= '
<tr class="danger">
<th><center>'.$i.'</center></th>
<td><center><strong>'.$courier->name.'</center></strong></td>
<td><center>-</center></td>
<td><center>-</center></td>
<td><center>-</center></td>
<td><center>-</center></td>
<td><center><strong></center></strong></td>
<td><center><button class="submit" id="disabled" style="cursor: not-allowed !important;">Select</button></center></td>
</tr>
<tr><td colspan="8"><hr style="background-color: #e3e3e3; height: 1px; border: 0;"/></td></tr>';







$html .= '</table>
</div>
</div>
</div>
<div style="margin-top:30px;float:right">
<button id="back" class="back" style="float:right;">Back</button>
</div>
<div>

<script type="text/javascript">
require(['jquery'], function($)
$(document).ready(function($)
$(".back").click(function()
$("#search_service_response_container").show();
$("#form-container").show();
);
);
);
</script>';
echo $html; die();





My json response from API is as follows.



(
[success] => 1
[code] => 200
[user_id] => 1585
[display_weight] => 0.32
[display_services] => Prepaid
[security_deposit] => 2000
[pickup_details] => stdClass Object
(
[pincode] => 500034
[city] => Hyderabad
[state] => Telangana
[country] => India
)

[delivery_details] => stdClass Object
(
[pincode] => 500049
[city] => Hyderabad
[state] => Telangana
[country] => India
)

[couriers] => Array
(
[0] => stdClass Object
(
[name] => Fedex
[courier_id] => 1
[logo_url] => https://s3-ap-southeast-1.amazonaws.com/cdntest.zepo.in/ving_images/fedex.png
[exp_pickup_date] => 05/04/2019
[expected_pickup_date] => 1554467400000
[cut_off_Time] => 18:00:00
[pickup_success_rate] => 93
[service_types] => Array
(
[0] => stdClass Object
(
[service_id] => 1
[service_name] => PRIORITY_OVERNIGHT
[display_name] => Priority Air
[volumetric_weight] => 0.27
[form_required] => 0
[expected_delivery_days] => 3
[min_delivery_days] => 1
[max_delivery_days] => 3
[rate_breakup] => stdClass Object
(
[base_rate] => 45.65
[fuel_surcharge] => 9.13
[service_tax] => 0
[goods_services_tax] => 9.86
[other_charges] => 0
[insurance_charges] => 0
[COD_charges] => 0
[sub_total] => 54.78
[service_charge] => 0
[total_charge] => 65
[courier_goods_services_tax] => 8.46
[courier_other_charges] => 0
[courier_insurance_charges] => 0
[courier_base_rate] => 39.2
[courier_fuel_surcharge] => 7.8
[courier_service_tax] => 0
[courier_COD_charges] => 0
[courier_sub_total] => 47
[courier_service_charge] => 0
[courier_total_charge] => 55
[advancement_fees] => 0
[entry_or_octroi_tax] => 0
)

)

[1] => stdClass Object
(
[service_id] => 3
[service_name] => FEDEX_EXPRESS_SAVER
[display_name] => By Surface
[volumetric_weight] => 0.3
[form_required] => 0
[expected_delivery_days] => 10
[min_delivery_days] => 3
[max_delivery_days] => 7
[rate_breakup] => stdClass Object
(
[base_rate] => 83.64
[fuel_surcharge] => 8.36
[service_tax] => 0
[goods_services_tax] => 16.56
[other_charges] => 0
[insurance_charges] => 0
[COD_charges] => 0
[sub_total] => 92
[service_charge] => 0
[total_charge] => 109
[courier_goods_services_tax] => 13.64
[courier_other_charges] => 0
[courier_insurance_charges] => 0
[courier_base_rate] => 63.2
[courier_fuel_surcharge] => 12.6
[courier_service_tax] => 0
[courier_COD_charges] => 0
[courier_sub_total] => 75.8
[courier_service_charge] => 0
[courier_total_charge] => 89
[advancement_fees] => 0
[entry_or_octroi_tax] => 0
)

)

)

[codlimit] => 20000
[cod_limit] => 20000
)

[1] => stdClass Object
(
[name] => Aramex
[courier_id] => 2
[logo_url] => https://s3-ap-southeast-1.amazonaws.com/cdntest.zepo.in/ving_images/aramex.png

[exp_pickup_date] => 05/04/2019
[expected_pickup_date] => 1554459300000
[cut_off_Time] => 15:00
[pickup_success_rate] => 80
[service_types] => Array
(
[0] => stdClass Object
(
[service_id] => 4
[service_name] => STANDARD
[display_name] => By Air
[volumetric_weight] => 0.27
[form_required] => 0
[expected_delivery_days] => 5
[min_delivery_days] => 1
[max_delivery_days] => 3
[rate_breakup] => stdClass Object
(
[base_rate] => 28.56
[fuel_surcharge] => 10.57
[service_tax] => 0
[goods_services_tax] => 7.04
[other_charges] => 0
[insurance_charges] => 0
[COD_charges] => 0
[sub_total] => 39.13
[service_charge] => 0
[total_charge] => 46
[courier_goods_services_tax] => 4.44
[courier_other_charges] => 0
[courier_insurance_charges] => 0
[courier_base_rate] => 18
[courier_fuel_surcharge] => 6.66
[courier_service_tax] => 0
[courier_COD_charges] => 0
[courier_sub_total] => 24.66
[courier_service_charge] => 0
[courier_total_charge] => 29
[advancement_fees] => 0
[entry_or_octroi_tax] => 0
)

)

)

[codlimit] => 20000
[cod_limit] => 20000
)


Can any body tell me what is wrong in this. When i print or echo rate_breakup->fuel_charge it is printing normally like 9.88









share




























    0















    I am implementing my own shipping API integration in magento2. I am able to get all the details finely. But all of sudden it is giving an error as follows.



    Exception #0 (Exception): Notice: Undefined property: stdClass::$rate_breakup in /var/www/html/b2b/app/code/My/Shipping/Controller/Adminhtml/Order/Sendform.php on line 68


    My Sendform.php is



    class Sendform extends MagentoBackendAppAction
    {
    public function execute()
    $data = $this->getRequest()->getPostValue();

    $result = $this->_objectManager->create('ShipyaariShippingModelSearchService')->avilable_service($data);
    $result=json_decode($result);


    if($result)

    $status__=0;



    if($result->success==1)

    $status__=1;



    if($status__==1)


    $html= '<div style="border:1px solid #e3e3e3;border-radius:5px;padding:20px;">
    <div>
    <h3>List Of Available Services</h3>
    <hr>
    </div>
    <div>
    <table class="table" style="border-spacing:0px;width:100%;">
    <thead>
    <tr>
    <th><center><strong>Sr. NO.</strong></center></th>
    <th>Partner Name</th>
    <th><center><strong>Image</strong></center></th>
    <th><center><strong>Expected Pickup Date</strong></center></th>
    <th><center><strong>Service Type</strong></center></th>
    <th><center><strong>Grand Total</strong></center></th>
    <th><center><strong>Base Price</strong></center></th>
    <th><center><strong>Fuel Surcharge</strong></center></th>
    <th><center><strong>GST</strong></center></th>
    <th><center><strong>Action</strong></center></th>
    </tr>
    <tr><td colspan="10"><hr/></td></tr>
    </thead>
    <tbody>';

    $i=0;
    //foreach($result as $value)

    //$i++;

    foreach($result->couriers as $courier)
    $i++;

    if($result->success==1)

    print_r($result);
    $html .= '<tr class="success">
    <th><center><strong>'.$i.'</strong></center></th>
    <td><center><strong>'.$courier->name.'</strong></center></td>
    <td><center><img width="100" height="100" src="'.$courier->logo_url.'"/></center></td>
    <td><center>'.$courier->exp_pickup_date.'</center></td>';
    foreach($courier->service_types as $service_types)
    $service_type=$service_types->service_name;

    $goods_services_tax=$service_types->rate_breakup->goods_services_tax;
    $base_rate=$service_types->rate_breakup->base_rate;

    $html .= '</tr><td></td><td></td><td></td><td></td><td><center>'.$service_types->service_name.'</center></td>
    <td><center>'.$service_types->rate_breakup->total_charge.'</center></td>
    <td><center>'.$base_rate.'</center></td>
    <td><center>'.$service_types->rate_breakup->fuel_surcharge.'</center></td>
    <th><center><strong>'.$goods_services_tax.'</strong></center></th>
    <td><center>';
    $html .="<button class='submit' id='".$courier->courier_id."' onclick='send_to_zepo("$courier->courier_id", "$service_types->service_id","$service_type");'>Select</button></center></td>";


    $html .= '
    <tr><td colspan="8"><hr style="background-color: #e3e3e3; height: 1px; border: 0;"/></td></tr>';

    if($result->success!=1)

    $html .= '
    <tr class="danger">
    <th><center>'.$i.'</center></th>
    <td><center><strong>'.$courier->name.'</center></strong></td>
    <td><center>-</center></td>
    <td><center>-</center></td>
    <td><center>-</center></td>
    <td><center>-</center></td>
    <td><center><strong></center></strong></td>
    <td><center><button class="submit" id="disabled" style="cursor: not-allowed !important;">Select</button></center></td>
    </tr>
    <tr><td colspan="8"><hr style="background-color: #e3e3e3; height: 1px; border: 0;"/></td></tr>';







    $html .= '</table>
    </div>
    </div>
    </div>
    <div style="margin-top:30px;float:right">
    <button id="back" class="back" style="float:right;">Back</button>
    </div>
    <div>

    <script type="text/javascript">
    require(['jquery'], function($)
    $(document).ready(function($)
    $(".back").click(function()
    $("#search_service_response_container").show();
    $("#form-container").show();
    );
    );
    );
    </script>';
    echo $html; die();





    My json response from API is as follows.



    (
    [success] => 1
    [code] => 200
    [user_id] => 1585
    [display_weight] => 0.32
    [display_services] => Prepaid
    [security_deposit] => 2000
    [pickup_details] => stdClass Object
    (
    [pincode] => 500034
    [city] => Hyderabad
    [state] => Telangana
    [country] => India
    )

    [delivery_details] => stdClass Object
    (
    [pincode] => 500049
    [city] => Hyderabad
    [state] => Telangana
    [country] => India
    )

    [couriers] => Array
    (
    [0] => stdClass Object
    (
    [name] => Fedex
    [courier_id] => 1
    [logo_url] => https://s3-ap-southeast-1.amazonaws.com/cdntest.zepo.in/ving_images/fedex.png
    [exp_pickup_date] => 05/04/2019
    [expected_pickup_date] => 1554467400000
    [cut_off_Time] => 18:00:00
    [pickup_success_rate] => 93
    [service_types] => Array
    (
    [0] => stdClass Object
    (
    [service_id] => 1
    [service_name] => PRIORITY_OVERNIGHT
    [display_name] => Priority Air
    [volumetric_weight] => 0.27
    [form_required] => 0
    [expected_delivery_days] => 3
    [min_delivery_days] => 1
    [max_delivery_days] => 3
    [rate_breakup] => stdClass Object
    (
    [base_rate] => 45.65
    [fuel_surcharge] => 9.13
    [service_tax] => 0
    [goods_services_tax] => 9.86
    [other_charges] => 0
    [insurance_charges] => 0
    [COD_charges] => 0
    [sub_total] => 54.78
    [service_charge] => 0
    [total_charge] => 65
    [courier_goods_services_tax] => 8.46
    [courier_other_charges] => 0
    [courier_insurance_charges] => 0
    [courier_base_rate] => 39.2
    [courier_fuel_surcharge] => 7.8
    [courier_service_tax] => 0
    [courier_COD_charges] => 0
    [courier_sub_total] => 47
    [courier_service_charge] => 0
    [courier_total_charge] => 55
    [advancement_fees] => 0
    [entry_or_octroi_tax] => 0
    )

    )

    [1] => stdClass Object
    (
    [service_id] => 3
    [service_name] => FEDEX_EXPRESS_SAVER
    [display_name] => By Surface
    [volumetric_weight] => 0.3
    [form_required] => 0
    [expected_delivery_days] => 10
    [min_delivery_days] => 3
    [max_delivery_days] => 7
    [rate_breakup] => stdClass Object
    (
    [base_rate] => 83.64
    [fuel_surcharge] => 8.36
    [service_tax] => 0
    [goods_services_tax] => 16.56
    [other_charges] => 0
    [insurance_charges] => 0
    [COD_charges] => 0
    [sub_total] => 92
    [service_charge] => 0
    [total_charge] => 109
    [courier_goods_services_tax] => 13.64
    [courier_other_charges] => 0
    [courier_insurance_charges] => 0
    [courier_base_rate] => 63.2
    [courier_fuel_surcharge] => 12.6
    [courier_service_tax] => 0
    [courier_COD_charges] => 0
    [courier_sub_total] => 75.8
    [courier_service_charge] => 0
    [courier_total_charge] => 89
    [advancement_fees] => 0
    [entry_or_octroi_tax] => 0
    )

    )

    )

    [codlimit] => 20000
    [cod_limit] => 20000
    )

    [1] => stdClass Object
    (
    [name] => Aramex
    [courier_id] => 2
    [logo_url] => https://s3-ap-southeast-1.amazonaws.com/cdntest.zepo.in/ving_images/aramex.png

    [exp_pickup_date] => 05/04/2019
    [expected_pickup_date] => 1554459300000
    [cut_off_Time] => 15:00
    [pickup_success_rate] => 80
    [service_types] => Array
    (
    [0] => stdClass Object
    (
    [service_id] => 4
    [service_name] => STANDARD
    [display_name] => By Air
    [volumetric_weight] => 0.27
    [form_required] => 0
    [expected_delivery_days] => 5
    [min_delivery_days] => 1
    [max_delivery_days] => 3
    [rate_breakup] => stdClass Object
    (
    [base_rate] => 28.56
    [fuel_surcharge] => 10.57
    [service_tax] => 0
    [goods_services_tax] => 7.04
    [other_charges] => 0
    [insurance_charges] => 0
    [COD_charges] => 0
    [sub_total] => 39.13
    [service_charge] => 0
    [total_charge] => 46
    [courier_goods_services_tax] => 4.44
    [courier_other_charges] => 0
    [courier_insurance_charges] => 0
    [courier_base_rate] => 18
    [courier_fuel_surcharge] => 6.66
    [courier_service_tax] => 0
    [courier_COD_charges] => 0
    [courier_sub_total] => 24.66
    [courier_service_charge] => 0
    [courier_total_charge] => 29
    [advancement_fees] => 0
    [entry_or_octroi_tax] => 0
    )

    )

    )

    [codlimit] => 20000
    [cod_limit] => 20000
    )


    Can any body tell me what is wrong in this. When i print or echo rate_breakup->fuel_charge it is printing normally like 9.88









    share
























      0












      0








      0








      I am implementing my own shipping API integration in magento2. I am able to get all the details finely. But all of sudden it is giving an error as follows.



      Exception #0 (Exception): Notice: Undefined property: stdClass::$rate_breakup in /var/www/html/b2b/app/code/My/Shipping/Controller/Adminhtml/Order/Sendform.php on line 68


      My Sendform.php is



      class Sendform extends MagentoBackendAppAction
      {
      public function execute()
      $data = $this->getRequest()->getPostValue();

      $result = $this->_objectManager->create('ShipyaariShippingModelSearchService')->avilable_service($data);
      $result=json_decode($result);


      if($result)

      $status__=0;



      if($result->success==1)

      $status__=1;



      if($status__==1)


      $html= '<div style="border:1px solid #e3e3e3;border-radius:5px;padding:20px;">
      <div>
      <h3>List Of Available Services</h3>
      <hr>
      </div>
      <div>
      <table class="table" style="border-spacing:0px;width:100%;">
      <thead>
      <tr>
      <th><center><strong>Sr. NO.</strong></center></th>
      <th>Partner Name</th>
      <th><center><strong>Image</strong></center></th>
      <th><center><strong>Expected Pickup Date</strong></center></th>
      <th><center><strong>Service Type</strong></center></th>
      <th><center><strong>Grand Total</strong></center></th>
      <th><center><strong>Base Price</strong></center></th>
      <th><center><strong>Fuel Surcharge</strong></center></th>
      <th><center><strong>GST</strong></center></th>
      <th><center><strong>Action</strong></center></th>
      </tr>
      <tr><td colspan="10"><hr/></td></tr>
      </thead>
      <tbody>';

      $i=0;
      //foreach($result as $value)

      //$i++;

      foreach($result->couriers as $courier)
      $i++;

      if($result->success==1)

      print_r($result);
      $html .= '<tr class="success">
      <th><center><strong>'.$i.'</strong></center></th>
      <td><center><strong>'.$courier->name.'</strong></center></td>
      <td><center><img width="100" height="100" src="'.$courier->logo_url.'"/></center></td>
      <td><center>'.$courier->exp_pickup_date.'</center></td>';
      foreach($courier->service_types as $service_types)
      $service_type=$service_types->service_name;

      $goods_services_tax=$service_types->rate_breakup->goods_services_tax;
      $base_rate=$service_types->rate_breakup->base_rate;

      $html .= '</tr><td></td><td></td><td></td><td></td><td><center>'.$service_types->service_name.'</center></td>
      <td><center>'.$service_types->rate_breakup->total_charge.'</center></td>
      <td><center>'.$base_rate.'</center></td>
      <td><center>'.$service_types->rate_breakup->fuel_surcharge.'</center></td>
      <th><center><strong>'.$goods_services_tax.'</strong></center></th>
      <td><center>';
      $html .="<button class='submit' id='".$courier->courier_id."' onclick='send_to_zepo("$courier->courier_id", "$service_types->service_id","$service_type");'>Select</button></center></td>";


      $html .= '
      <tr><td colspan="8"><hr style="background-color: #e3e3e3; height: 1px; border: 0;"/></td></tr>';

      if($result->success!=1)

      $html .= '
      <tr class="danger">
      <th><center>'.$i.'</center></th>
      <td><center><strong>'.$courier->name.'</center></strong></td>
      <td><center>-</center></td>
      <td><center>-</center></td>
      <td><center>-</center></td>
      <td><center>-</center></td>
      <td><center><strong></center></strong></td>
      <td><center><button class="submit" id="disabled" style="cursor: not-allowed !important;">Select</button></center></td>
      </tr>
      <tr><td colspan="8"><hr style="background-color: #e3e3e3; height: 1px; border: 0;"/></td></tr>';







      $html .= '</table>
      </div>
      </div>
      </div>
      <div style="margin-top:30px;float:right">
      <button id="back" class="back" style="float:right;">Back</button>
      </div>
      <div>

      <script type="text/javascript">
      require(['jquery'], function($)
      $(document).ready(function($)
      $(".back").click(function()
      $("#search_service_response_container").show();
      $("#form-container").show();
      );
      );
      );
      </script>';
      echo $html; die();





      My json response from API is as follows.



      (
      [success] => 1
      [code] => 200
      [user_id] => 1585
      [display_weight] => 0.32
      [display_services] => Prepaid
      [security_deposit] => 2000
      [pickup_details] => stdClass Object
      (
      [pincode] => 500034
      [city] => Hyderabad
      [state] => Telangana
      [country] => India
      )

      [delivery_details] => stdClass Object
      (
      [pincode] => 500049
      [city] => Hyderabad
      [state] => Telangana
      [country] => India
      )

      [couriers] => Array
      (
      [0] => stdClass Object
      (
      [name] => Fedex
      [courier_id] => 1
      [logo_url] => https://s3-ap-southeast-1.amazonaws.com/cdntest.zepo.in/ving_images/fedex.png
      [exp_pickup_date] => 05/04/2019
      [expected_pickup_date] => 1554467400000
      [cut_off_Time] => 18:00:00
      [pickup_success_rate] => 93
      [service_types] => Array
      (
      [0] => stdClass Object
      (
      [service_id] => 1
      [service_name] => PRIORITY_OVERNIGHT
      [display_name] => Priority Air
      [volumetric_weight] => 0.27
      [form_required] => 0
      [expected_delivery_days] => 3
      [min_delivery_days] => 1
      [max_delivery_days] => 3
      [rate_breakup] => stdClass Object
      (
      [base_rate] => 45.65
      [fuel_surcharge] => 9.13
      [service_tax] => 0
      [goods_services_tax] => 9.86
      [other_charges] => 0
      [insurance_charges] => 0
      [COD_charges] => 0
      [sub_total] => 54.78
      [service_charge] => 0
      [total_charge] => 65
      [courier_goods_services_tax] => 8.46
      [courier_other_charges] => 0
      [courier_insurance_charges] => 0
      [courier_base_rate] => 39.2
      [courier_fuel_surcharge] => 7.8
      [courier_service_tax] => 0
      [courier_COD_charges] => 0
      [courier_sub_total] => 47
      [courier_service_charge] => 0
      [courier_total_charge] => 55
      [advancement_fees] => 0
      [entry_or_octroi_tax] => 0
      )

      )

      [1] => stdClass Object
      (
      [service_id] => 3
      [service_name] => FEDEX_EXPRESS_SAVER
      [display_name] => By Surface
      [volumetric_weight] => 0.3
      [form_required] => 0
      [expected_delivery_days] => 10
      [min_delivery_days] => 3
      [max_delivery_days] => 7
      [rate_breakup] => stdClass Object
      (
      [base_rate] => 83.64
      [fuel_surcharge] => 8.36
      [service_tax] => 0
      [goods_services_tax] => 16.56
      [other_charges] => 0
      [insurance_charges] => 0
      [COD_charges] => 0
      [sub_total] => 92
      [service_charge] => 0
      [total_charge] => 109
      [courier_goods_services_tax] => 13.64
      [courier_other_charges] => 0
      [courier_insurance_charges] => 0
      [courier_base_rate] => 63.2
      [courier_fuel_surcharge] => 12.6
      [courier_service_tax] => 0
      [courier_COD_charges] => 0
      [courier_sub_total] => 75.8
      [courier_service_charge] => 0
      [courier_total_charge] => 89
      [advancement_fees] => 0
      [entry_or_octroi_tax] => 0
      )

      )

      )

      [codlimit] => 20000
      [cod_limit] => 20000
      )

      [1] => stdClass Object
      (
      [name] => Aramex
      [courier_id] => 2
      [logo_url] => https://s3-ap-southeast-1.amazonaws.com/cdntest.zepo.in/ving_images/aramex.png

      [exp_pickup_date] => 05/04/2019
      [expected_pickup_date] => 1554459300000
      [cut_off_Time] => 15:00
      [pickup_success_rate] => 80
      [service_types] => Array
      (
      [0] => stdClass Object
      (
      [service_id] => 4
      [service_name] => STANDARD
      [display_name] => By Air
      [volumetric_weight] => 0.27
      [form_required] => 0
      [expected_delivery_days] => 5
      [min_delivery_days] => 1
      [max_delivery_days] => 3
      [rate_breakup] => stdClass Object
      (
      [base_rate] => 28.56
      [fuel_surcharge] => 10.57
      [service_tax] => 0
      [goods_services_tax] => 7.04
      [other_charges] => 0
      [insurance_charges] => 0
      [COD_charges] => 0
      [sub_total] => 39.13
      [service_charge] => 0
      [total_charge] => 46
      [courier_goods_services_tax] => 4.44
      [courier_other_charges] => 0
      [courier_insurance_charges] => 0
      [courier_base_rate] => 18
      [courier_fuel_surcharge] => 6.66
      [courier_service_tax] => 0
      [courier_COD_charges] => 0
      [courier_sub_total] => 24.66
      [courier_service_charge] => 0
      [courier_total_charge] => 29
      [advancement_fees] => 0
      [entry_or_octroi_tax] => 0
      )

      )

      )

      [codlimit] => 20000
      [cod_limit] => 20000
      )


      Can any body tell me what is wrong in this. When i print or echo rate_breakup->fuel_charge it is printing normally like 9.88









      share














      I am implementing my own shipping API integration in magento2. I am able to get all the details finely. But all of sudden it is giving an error as follows.



      Exception #0 (Exception): Notice: Undefined property: stdClass::$rate_breakup in /var/www/html/b2b/app/code/My/Shipping/Controller/Adminhtml/Order/Sendform.php on line 68


      My Sendform.php is



      class Sendform extends MagentoBackendAppAction
      {
      public function execute()
      $data = $this->getRequest()->getPostValue();

      $result = $this->_objectManager->create('ShipyaariShippingModelSearchService')->avilable_service($data);
      $result=json_decode($result);


      if($result)

      $status__=0;



      if($result->success==1)

      $status__=1;



      if($status__==1)


      $html= '<div style="border:1px solid #e3e3e3;border-radius:5px;padding:20px;">
      <div>
      <h3>List Of Available Services</h3>
      <hr>
      </div>
      <div>
      <table class="table" style="border-spacing:0px;width:100%;">
      <thead>
      <tr>
      <th><center><strong>Sr. NO.</strong></center></th>
      <th>Partner Name</th>
      <th><center><strong>Image</strong></center></th>
      <th><center><strong>Expected Pickup Date</strong></center></th>
      <th><center><strong>Service Type</strong></center></th>
      <th><center><strong>Grand Total</strong></center></th>
      <th><center><strong>Base Price</strong></center></th>
      <th><center><strong>Fuel Surcharge</strong></center></th>
      <th><center><strong>GST</strong></center></th>
      <th><center><strong>Action</strong></center></th>
      </tr>
      <tr><td colspan="10"><hr/></td></tr>
      </thead>
      <tbody>';

      $i=0;
      //foreach($result as $value)

      //$i++;

      foreach($result->couriers as $courier)
      $i++;

      if($result->success==1)

      print_r($result);
      $html .= '<tr class="success">
      <th><center><strong>'.$i.'</strong></center></th>
      <td><center><strong>'.$courier->name.'</strong></center></td>
      <td><center><img width="100" height="100" src="'.$courier->logo_url.'"/></center></td>
      <td><center>'.$courier->exp_pickup_date.'</center></td>';
      foreach($courier->service_types as $service_types)
      $service_type=$service_types->service_name;

      $goods_services_tax=$service_types->rate_breakup->goods_services_tax;
      $base_rate=$service_types->rate_breakup->base_rate;

      $html .= '</tr><td></td><td></td><td></td><td></td><td><center>'.$service_types->service_name.'</center></td>
      <td><center>'.$service_types->rate_breakup->total_charge.'</center></td>
      <td><center>'.$base_rate.'</center></td>
      <td><center>'.$service_types->rate_breakup->fuel_surcharge.'</center></td>
      <th><center><strong>'.$goods_services_tax.'</strong></center></th>
      <td><center>';
      $html .="<button class='submit' id='".$courier->courier_id."' onclick='send_to_zepo("$courier->courier_id", "$service_types->service_id","$service_type");'>Select</button></center></td>";


      $html .= '
      <tr><td colspan="8"><hr style="background-color: #e3e3e3; height: 1px; border: 0;"/></td></tr>';

      if($result->success!=1)

      $html .= '
      <tr class="danger">
      <th><center>'.$i.'</center></th>
      <td><center><strong>'.$courier->name.'</center></strong></td>
      <td><center>-</center></td>
      <td><center>-</center></td>
      <td><center>-</center></td>
      <td><center>-</center></td>
      <td><center><strong></center></strong></td>
      <td><center><button class="submit" id="disabled" style="cursor: not-allowed !important;">Select</button></center></td>
      </tr>
      <tr><td colspan="8"><hr style="background-color: #e3e3e3; height: 1px; border: 0;"/></td></tr>';







      $html .= '</table>
      </div>
      </div>
      </div>
      <div style="margin-top:30px;float:right">
      <button id="back" class="back" style="float:right;">Back</button>
      </div>
      <div>

      <script type="text/javascript">
      require(['jquery'], function($)
      $(document).ready(function($)
      $(".back").click(function()
      $("#search_service_response_container").show();
      $("#form-container").show();
      );
      );
      );
      </script>';
      echo $html; die();





      My json response from API is as follows.



      (
      [success] => 1
      [code] => 200
      [user_id] => 1585
      [display_weight] => 0.32
      [display_services] => Prepaid
      [security_deposit] => 2000
      [pickup_details] => stdClass Object
      (
      [pincode] => 500034
      [city] => Hyderabad
      [state] => Telangana
      [country] => India
      )

      [delivery_details] => stdClass Object
      (
      [pincode] => 500049
      [city] => Hyderabad
      [state] => Telangana
      [country] => India
      )

      [couriers] => Array
      (
      [0] => stdClass Object
      (
      [name] => Fedex
      [courier_id] => 1
      [logo_url] => https://s3-ap-southeast-1.amazonaws.com/cdntest.zepo.in/ving_images/fedex.png
      [exp_pickup_date] => 05/04/2019
      [expected_pickup_date] => 1554467400000
      [cut_off_Time] => 18:00:00
      [pickup_success_rate] => 93
      [service_types] => Array
      (
      [0] => stdClass Object
      (
      [service_id] => 1
      [service_name] => PRIORITY_OVERNIGHT
      [display_name] => Priority Air
      [volumetric_weight] => 0.27
      [form_required] => 0
      [expected_delivery_days] => 3
      [min_delivery_days] => 1
      [max_delivery_days] => 3
      [rate_breakup] => stdClass Object
      (
      [base_rate] => 45.65
      [fuel_surcharge] => 9.13
      [service_tax] => 0
      [goods_services_tax] => 9.86
      [other_charges] => 0
      [insurance_charges] => 0
      [COD_charges] => 0
      [sub_total] => 54.78
      [service_charge] => 0
      [total_charge] => 65
      [courier_goods_services_tax] => 8.46
      [courier_other_charges] => 0
      [courier_insurance_charges] => 0
      [courier_base_rate] => 39.2
      [courier_fuel_surcharge] => 7.8
      [courier_service_tax] => 0
      [courier_COD_charges] => 0
      [courier_sub_total] => 47
      [courier_service_charge] => 0
      [courier_total_charge] => 55
      [advancement_fees] => 0
      [entry_or_octroi_tax] => 0
      )

      )

      [1] => stdClass Object
      (
      [service_id] => 3
      [service_name] => FEDEX_EXPRESS_SAVER
      [display_name] => By Surface
      [volumetric_weight] => 0.3
      [form_required] => 0
      [expected_delivery_days] => 10
      [min_delivery_days] => 3
      [max_delivery_days] => 7
      [rate_breakup] => stdClass Object
      (
      [base_rate] => 83.64
      [fuel_surcharge] => 8.36
      [service_tax] => 0
      [goods_services_tax] => 16.56
      [other_charges] => 0
      [insurance_charges] => 0
      [COD_charges] => 0
      [sub_total] => 92
      [service_charge] => 0
      [total_charge] => 109
      [courier_goods_services_tax] => 13.64
      [courier_other_charges] => 0
      [courier_insurance_charges] => 0
      [courier_base_rate] => 63.2
      [courier_fuel_surcharge] => 12.6
      [courier_service_tax] => 0
      [courier_COD_charges] => 0
      [courier_sub_total] => 75.8
      [courier_service_charge] => 0
      [courier_total_charge] => 89
      [advancement_fees] => 0
      [entry_or_octroi_tax] => 0
      )

      )

      )

      [codlimit] => 20000
      [cod_limit] => 20000
      )

      [1] => stdClass Object
      (
      [name] => Aramex
      [courier_id] => 2
      [logo_url] => https://s3-ap-southeast-1.amazonaws.com/cdntest.zepo.in/ving_images/aramex.png

      [exp_pickup_date] => 05/04/2019
      [expected_pickup_date] => 1554459300000
      [cut_off_Time] => 15:00
      [pickup_success_rate] => 80
      [service_types] => Array
      (
      [0] => stdClass Object
      (
      [service_id] => 4
      [service_name] => STANDARD
      [display_name] => By Air
      [volumetric_weight] => 0.27
      [form_required] => 0
      [expected_delivery_days] => 5
      [min_delivery_days] => 1
      [max_delivery_days] => 3
      [rate_breakup] => stdClass Object
      (
      [base_rate] => 28.56
      [fuel_surcharge] => 10.57
      [service_tax] => 0
      [goods_services_tax] => 7.04
      [other_charges] => 0
      [insurance_charges] => 0
      [COD_charges] => 0
      [sub_total] => 39.13
      [service_charge] => 0
      [total_charge] => 46
      [courier_goods_services_tax] => 4.44
      [courier_other_charges] => 0
      [courier_insurance_charges] => 0
      [courier_base_rate] => 18
      [courier_fuel_surcharge] => 6.66
      [courier_service_tax] => 0
      [courier_COD_charges] => 0
      [courier_sub_total] => 24.66
      [courier_service_charge] => 0
      [courier_total_charge] => 29
      [advancement_fees] => 0
      [entry_or_octroi_tax] => 0
      )

      )

      )

      [codlimit] => 20000
      [cod_limit] => 20000
      )


      Can any body tell me what is wrong in this. When i print or echo rate_breakup->fuel_charge it is printing normally like 9.88







      magento2 magento-2.1





      share












      share










      share



      share










      asked 2 mins ago









      DineshDinesh

      8511




      8511




















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268857%2fparsing-shipping-api-data-in-magento2%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268857%2fparsing-shipping-api-data-in-magento2%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Nidaros erkebispedøme

          Birsay

          Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?