Post by morktron » Tue Aug 28, 2012 3:16 pm

Hi I'm new to Opencart and I see since 16th Aug 2012 Australia Post is included as standard in Opencart 1.5.4.

I can't get it to work though, I just get

Code: Select all

Warning: Shipping method required!
I see there has been an Australia Post module around since 2010 which has loads more features but it doesn't work in 1.5.4 - not for me anyway, I get multiple errors.

I upgraded from OC 1.5.1.3 to 1.5.4 to get the checkout working (which it did, thankfully) but now I need to get Australia Post working...

Goodbye Virtuemart! Hello Opencart! :)


New member

Posts

Joined
Tue Jun 12, 2012 1:48 pm
Location - Ballina, NSW, Australia

Post by jack65 » Wed Aug 29, 2012 8:04 am

Hi, You probably have done this but just check it says enabled in the settings.



Regards
Steve.

Newbie

Posts

Joined
Wed Aug 29, 2012 7:59 am

Post by jack65 » Wed Aug 29, 2012 8:13 pm

Hi Found this in the bugs area - it should fix your problems.
Replace you aust post.php with this.

Code: Select all

<?php
        class ModelShippingAusPost extends Model {
           public function getQuote($address) {
              $this->load->language('shipping/auspost');

              $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('auspost_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
              
              if (!$this->config->get('auspost_geo_zone_id')) {
                 $status = true;
              } elseif ($query->num_rows) {
                 $status = true;
              } else {
                 $status = false;
              }
              
              $error = '';
              
              $quote_data = array();
              
              if ($status) {
                 $weight = $this->weight->convert($this->cart->getWeight(), $this->config->get('config_weight_class_id'), $this->config->get('auspost_weight_class_id'));
              
                 if ($this->config->get('auspost_standard') && $address['iso_code_2'] == 'AU') {
                    $curl = curl_init();
              
                    curl_setopt($curl, CURLOPT_URL, 'http://drc.edeliver.com.au/ratecalc.asp?pickup_postcode=' . urlencode($this->config->get('auspost_postcode')) . '&destination_postcode=' . urlencode($address['postcode']) . '&height=70&width=70&length=70&country=AU&service_type=standard&quantity=1&weight=' . urlencode($weight));
                    curl_setopt($curl, CURLOPT_HEADER, 0);
                    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                    
                    $response = curl_exec($curl);
                    
                    curl_close($curl);
                    
                    if ($response) {
                       $response_info = array();
                       
                       $parts = explode("\n", trim($response));
                       
                       foreach ($parts as $part) {
                          list($key, $value) = explode('=', $part);
                          
                          $response_info[$key] = $value;
                       }
                       
                       if ($response_info['err_msg'] != 'OK') {
                          $error = $response_info['err_msg'];
                       } else {
                          $title = $this->language->get('text_standard');
                       
                          if ($this->config->get('auspost_display_time')) {
                             $title .= ' (' . $response_info['days'] . ' ' . $this->language->get('text_eta') . ')';
                          }   
                 
                          $quote_data['standard'] = array(
                             'code'         => 'auspost.standard',
                             'title'        => $title,
                             'cost'         => $this->currency->convert($response_info['charge'], 'AUD', $this->config->get('config_currency')),
                             'tax_class_id' => $this->config->get('auspost_tax_class_id'),
                             'text'         => $this->currency->format($this->tax->calculate($this->currency->convert($response_info['charge'], 'AUD', $this->currency->getCode()), $this->config->get('auspost_tax_class_id'), $this->config->get('config_tax')), $this->currency->getCode(), 1.0000000)
                          );
                       }
                    }
                 }
           
                 if ($this->config->get('auspost_express') && $address['iso_code_2'] == 'AU') {
                    $curl = curl_init();
                    
                    curl_setopt($curl, CURLOPT_URL, 'http://drc.edeliver.com.au/ratecalc.asp?pickup_postcode=' . urlencode($this->config->get('auspost_postcode')) . '&destination_postcode=' . urlencode($address['postcode']) . '&height=70&width=70&length=70&country=AU&service_type=express&quantity=1&weight=' . urlencode($weight));
                    curl_setopt($curl, CURLOPT_HEADER, 0);
                    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                    
                    $response = curl_exec($curl);
                    
                    curl_close($curl);
                    
                    if ($response) {
                       $response_info = array();
                       
                       $parts = explode("\n", trim($response));
                       
                       foreach ($parts as $part) {
                          list($key, $value) = explode('=', $part);
                          
                          $response_info[$key] = $value;
                       }
                                
                       if ($response_info['err_msg'] != 'OK') {
                          $error = $response_info['err_msg'];
                       } else {
                          $title = $this->language->get('text_express');
                          
                          if ($this->config->get('auspost_display_time')) {
                             $title .= ' (' . $response_info['days'] . ' ' . $this->language->get('text_eta') . ')';
                          }   
              
                          $quote_data['express'] = array(
                             'code'         => 'auspost.express',
                             'title'        => $title,
                             'cost'         => $this->currency->convert($response_info['charge'], 'AUD', $this->config->get('config_currency')),
                             'tax_class_id' => $this->config->get('auspost_tax_class_id'),
                             'text'         => $this->currency->format($this->tax->calculate($this->currency->convert($response_info['charge'], 'AUD', $this->currency->getCode()), $this->config->get('auspost_tax_class_id'), $this->config->get('config_tax')), $this->currency->getCode(), 1.0000000)
                          );
                       }
                    }
                 }
              }
              
              $method_data = array();
              
              if ($quote_data) {
                 $method_data = array(
                    'code'       => 'auspost',
                    'title'      => $this->language->get('text_title'),
                    'quote'      => $quote_data,
                    'sort_order' => $this->config->get('auspost_sort_order'),
                    'error'      => $error
                 );
              }
              
              return $method_data;
           }
        }
        ?>
regards
steve
Last edited by Johnathan on Thu Feb 28, 2013 8:29 pm, edited 1 time in total.
Reason: Added [code] tags for readability

Newbie

Posts

Joined
Wed Aug 29, 2012 7:59 am

Post by morktron » Mon Sep 03, 2012 11:43 am

Awesome thanks Steve, sorry for my slow response, I had no email notification of any new posts ;)

That has indeed fixed the issue! phew! thanks very much, I am very grateful for your kind assistance :)

Goodbye Virtuemart! Hello Opencart! :)


New member

Posts

Joined
Tue Jun 12, 2012 1:48 pm
Location - Ballina, NSW, Australia

Post by totalyrecycled » Fri Oct 05, 2012 6:43 pm

Hi I am also having the problem but when i replaced code posted here my Australia post module would not load now i have put the original code back i am getting a different error when i use the checkout .I am using version Version 1.5.4 here is the error .

Notice: Undefined offset: 1 in /home/myco7140/public_html/catalog/model/shipping/auspost.php on line 39Notice: Undefined offset: 1 in /home/myco7140/public_html/catalog/model/shipping/auspost.php on line 79


Posts

Joined
Fri Oct 05, 2012 6:36 pm

Post by trueblue » Thu Dec 06, 2012 1:35 pm

Thanks Steve. I also had the same problem.

Newbie

Posts

Joined
Thu Dec 06, 2012 10:14 am

Post by mousie_meow » Thu Feb 07, 2013 7:25 am

Great Steve! That worked a treat :)

Newbie

Posts

Joined
Wed Feb 06, 2013 8:43 pm

Post by CoffeeAsia » Tue Feb 26, 2013 4:53 pm

jack65 wrote:Hi Found this in the bugs area - it should fix your problems.
Replace you aust post.php with this.

(code deleted)

regards
steve
Hi, I am new to Open Cart and this forum, also having trouble with Australia Post.

Thank you for this code fix. There are four auspost.php files. Can you clarify which one the code fix applies to, or should I use it in all four?

/admin/language/english/shipping/auspost.php
/admin/controller/shipping/auspost.php
/catalog/language/english/shipping/auspost.php
/catalog/model/shipping/auspost.php

regards,
Steve

EDIT: I have found the solution.

Newbie

Posts

Joined
Tue Feb 26, 2013 4:37 pm

Post by surilox » Sun Apr 14, 2013 9:37 pm

>:( The Auspost extension from @Superjuice 1511u4 (now incorporated into OC 1.5.4+) gives incorrect values compared to current rates at auspost.com.au/apps/domestic-parcel.html
I suspect that Australia Post is pushing users to register & use their API to access the data, whilst maintaining the website at drc.auspost.com.au for some unknown functional reasons.
Domestic parcel rates vary from OC shown values by more than 100%

I'm surprised this has not surfaced before ( at least as far as I can find out).
I have tried it it 1.5.4 and 1.5.5.1

User avatar
Newbie

Posts

Joined
Sun Nov 20, 2011 8:52 am

Post by lakesentrance » Thu May 16, 2013 4:58 pm

I'm using 1.5.4.1 and auspost option wouldn't come up when estimating postage.

so I had to copy and paste the above code ... now Aus Post comes up as a shipping option.

1,000 gram postpak comes in at $12.75 standard, as opposed to auspost.com.au calculator that says a 1kg postpak is $14.05.

Newbie

Posts

Joined
Thu May 16, 2013 4:30 pm
Who is online

Users browsing this forum: No registered users and 46 guests