Author Topic: Shipping Method selection problem  (Read 11930 times)

Offline Rawinder

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Shipping Method selection problem
« on: October 21, 2020, 01:28:58 AM »
i'm developing an android app . that interact with API.
all other Post Commands are working in app except one. and i'm not getting the reason behind this

In App i'm Sending Post Command

rt= a/checkout/shipping
token= xxxxxxxxx
mode=Select
shipping_method=default_free_shipping.default_free_shipping
api_key=112233

in android this command return result set of Mode=list command.(means all the data like Shipping Method list)

when i run this Post in Postman .
on first run it Returns Result set Of Mode=List(means all the data like Shipping Method list)
on 2nd run it return its actual out put (status=1, Shipping_method Select)

checking headers and other this but couldn't able to solve this problem
plz help



Offline maxter

  • Full Member
  • ***
  • Posts: 228
  • Karma: +64/-0
    • View Profile
Re: Shipping Method selection problem
« Reply #1 on: October 21, 2020, 08:57:51 AM »
I am trying to clarify the question. Are you expecting to see the same list all the time?

What version of Abantecart do you have?

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4363
  • Karma: +301/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Shipping Method selection problem
« Reply #2 on: October 21, 2020, 09:11:39 AM »
I think this is related to the session used in the API. API and requests should be stateless and you will need to provide a full request every time.
What you experience with Android is correct behavior.

We will disable session in the API for version 1.2.17.
I have create an issue here: https://github.com/abantecart/abantecart-src/issues/1435
Feel free to add to it if you have any other suggestions.
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline Rawinder Dhillon

  • Newbie
  • *
  • Posts: 24
  • Karma: +5/-0
    • View Profile
Re: Shipping Method selection problem
« Reply #3 on: October 21, 2020, 10:38:59 AM »
I am trying to clarify the question. Are you expecting to see the same list all the time?

What version of Abantecart do you have?

no, from android app , (as i already know the shipping methods) i dont need to access list with mode =List
so i want to use "mode= Select" Command(that selects shipping Method)
but Mode=Select Command returns list of shipping Method options
its actual output must be
{
    "status": 1,
    "shipping_select": "success"
}


in postman it returns this output on when i Run this command 2nd time .




Offline Rawinder Dhillon

  • Newbie
  • *
  • Posts: 24
  • Karma: +5/-0
    • View Profile
Re: Shipping Method selection problem
« Reply #4 on: October 21, 2020, 10:39:27 AM »
I am trying to clarify the question. Are you expecting to see the same list all the time?

What version of Abantecart do you have?


im using an older version

Offline Rawinder Dhillon

  • Newbie
  • *
  • Posts: 24
  • Karma: +5/-0
    • View Profile
Re: Shipping Method selection problem
« Reply #5 on: October 21, 2020, 01:13:10 PM »
ok admin :-(

Offline Rawinder Dhillon

  • Newbie
  • *
  • Posts: 24
  • Karma: +5/-0
    • View Profile
Re: Shipping Method selection problem
« Reply #6 on: October 22, 2020, 12:06:33 PM »
if (!isset($this->session->data[ 'shipping_methods' ]) || !$this->config->get('config_shipping_session')) {
         $quote_data = array();

         $results = $this->model_checkout_extension->getExtensions('shipping');
         foreach ($results as $result) {
            $this->loadModel('extension/' . $result[ 'key' ]);

            $quote = $this->{'model_extension_' . $result[ 'key' ]}->getQuote($shipping_address);

            if ($quote) {
               $quote_data[ $result[ 'key' ] ] = array(
                  'title' => $quote[ 'title' ],
                  'quote' => $quote[ 'quote' ],
                  'sort_order' => $quote[ 'sort_order' ],
                  'error' => $quote[ 'error' ]
               );
            }
         }

         $sort_order = array();

         foreach ($quote_data as $key => $value) {
            $sort_order[ $key ] = $value[ 'sort_order' ];
         }

         array_multisort($sort_order, SORT_ASC, $quote_data);

         $this->session->data[ 'shipping_methods' ] = $quote_data;
      }


this function from API print List of shipping methods when condition is true
can someone plz explain the line below?
 
!$this->config->get('config_shipping_session'))

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4363
  • Karma: +301/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Shipping Method selection problem
« Reply #7 on: October 26, 2020, 06:57:54 AM »
config_shipping_session is used to be for optimize number of request to shipping providers and minimize re-qoute requests.
This will not be helpful in API case as session can not be used. 

 

 
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline Rawinder Dhillon

  • Newbie
  • *
  • Posts: 24
  • Karma: +5/-0
    • View Profile
Re: Shipping Method selection problem
« Reply #8 on: October 26, 2020, 12:41:09 PM »
Thx

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4363
  • Karma: +301/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Shipping Method selection problem
« Reply #9 on: October 26, 2020, 01:23:47 PM »
Rawinder,

Please feel free to provide some feedback and we would be glad to work together and improve Abantecart storefront API.

Version 1.2.17 is active in development now, we can incorporate API updates as well.
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline Rawinder Dhillon

  • Newbie
  • *
  • Posts: 24
  • Karma: +5/-0
    • View Profile
Re: Shipping Method selection problem
« Reply #10 on: October 28, 2020, 11:27:34 AM »
ok admin , i will

for above problems i drop the idea of executing shipping selection command directly. instead i executed mode =list the select command.
this solved my problem. now im able to select shipping method.

 

Powered by SMFPacks Social Login Mod