Post by letxobnav » Fri Apr 26, 2019 8:03 pm

can you show me the code you are using now?

It should at least write a timestamp to the log even if the data is empty and I do not see that.

these are from the post data (the first log write) basically stating which shipping method you selected so that is fine.

2019-04-25 8:47:11 - flat.flat
2019-04-25 8:49:43 - total_based.total_based_0
2019-04-25 8:51:41 - free.free

but I see nothing from
$this->log->write(print_r($this->session->data['shipping_methods'],true));

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by straightlight » Fri Apr 26, 2019 9:12 pm

so add some error_logs (or use echo) in there to see what is (not) happening.
In JSON headers … ? :ponder:

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by PatrickG » Fri Apr 26, 2019 10:57 pm

letxobnav wrote:
Fri Apr 26, 2019 8:03 pm
can you show me the code you are using now?

It should at least write a timestamp to the log even if the data is empty and I do not see that.

these are from the post data (the first log write) basically stating which shipping method you selected so that is fine.

2019-04-25 8:47:11 - flat.flat
2019-04-25 8:49:43 - total_based.total_based_0
2019-04-25 8:51:41 - free.free

but I see nothing from
$this->log->write(print_r($this->session->data['shipping_methods'],true));
This the code from controller/checkout/shipping_method.php:

$this->log->write(print_r($this->request->post['shipping_method'], true));
if (!isset($this->request->post['shipping_method'])) {
$json['error']['warning'] = $this->language->get('error_shipping');
} else {
$shipping = explode('.', $this->request->post['shipping_method']);
$this->log->write(print_r($this->request->post['shipping_method'], true));
if (!isset($shipping[0]) || !isset($shipping[1]) || !isset($this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
$json['error']['warning'] = $this->language->get('error_shipping');
}
}

New member

Posts

Joined
Wed Mar 18, 2015 10:32 pm

Post by straightlight » Sat Apr 27, 2019 12:34 am

Replace:

Code: Select all

$this->log->write(print_r($this->request->post['shipping_method'], true));
if (!isset($this->request->post['shipping_method'])) {
$json['error']['warning'] = $this->language->get('error_shipping');
} else {
$shipping = explode('.', $this->request->post['shipping_method']);
$this->log->write(print_r($this->request->post['shipping_method'], true));
if (!isset($shipping[0]) || !isset($shipping[1]) || !isset($this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
$json['error']['warning'] = $this->language->get('error_shipping');
}
}
with:

Code: Select all

if (!isset($this->request->post['shipping_method'])) {
    $json['error']['warning'] = $this->language->get('error_shipping');
} else {
    $shipping = explode('.', trim($this->request->post['shipping_method']));    
    
    if (!isset($shipping[0]) || !isset($shipping[1]) || !isset($this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
        $json['error']['warning'] = $this->language->get('error_shipping');
        
        $this->log->write(print_r($this->request->post['shipping_method'], true));
    }
}

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by PatrickG » Sat Apr 27, 2019 1:01 am

straightlight wrote:
Sat Apr 27, 2019 12:34 am
Replace:

Code: Select all

$this->log->write(print_r($this->request->post['shipping_method'], true));
if (!isset($this->request->post['shipping_method'])) {
$json['error']['warning'] = $this->language->get('error_shipping');
} else {
$shipping = explode('.', $this->request->post['shipping_method']);
$this->log->write(print_r($this->request->post['shipping_method'], true));
if (!isset($shipping[0]) || !isset($shipping[1]) || !isset($this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
$json['error']['warning'] = $this->language->get('error_shipping');
}
}
with:

Code: Select all

if (!isset($this->request->post['shipping_method'])) {
    $json['error']['warning'] = $this->language->get('error_shipping');
} else {
    $shipping = explode('.', trim($this->request->post['shipping_method']));    
    
    if (!isset($shipping[0]) || !isset($shipping[1]) || !isset($this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {
        $json['error']['warning'] = $this->language->get('error_shipping');
        
        $this->log->write(print_r($this->request->post['shipping_method'], true));
    }
}
That's done the job, I can now progress through the checkout without any errors! Thank you so much for your help guys ;D

New member

Posts

Joined
Wed Mar 18, 2015 10:32 pm

Post by straightlight » Sat Apr 27, 2019 2:51 am

If you want the errors to be completely gone during this process, from the latest codes above, simply remove this line:

Code: Select all

$this->log->write(print_r($this->request->post['shipping_method'], true));

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by PatrickG » Sun Apr 28, 2019 12:55 am

Great, thanks very much for your help, much appreciated!

New member

Posts

Joined
Wed Mar 18, 2015 10:32 pm
Who is online

Users browsing this forum: Semrush [Bot] and 33 guests