Calculate Shipping Cost Using Ubercart

Calculate Shipping Cost Using Ubercart

1. Importing zip codes information into the database
• Create a content type say “Post Codes” with type “postcodes” and create three text fields in it , each with type “text”, using the following field names , field title you can choose as you want :
• field_postcode
• field_maxofbasic
• field_maxofrate
• Open your excel for that contains the zip codes information, copy first column of it and paste it to create same column, now change the first column title to “Title”.
• Create a CSV file from the excel file that contains zip codes information.
• Install “Node Import” drupal module for drupal 6.
• Go to http:///admin page,
Here click on the “Import content” link,
Here click on the “New Import” tab,
Here click on the “Next” button,
Here select the option for “Post Codes content type” and click on the “Next” button,

Here click on the “Upload file” link, browse and upload your “.csv” file you initially created that contains the zip codes information and click on the “Next” button,

Here do not change anything just click on the “Next” button,
Here do not change anything just click on the “Next” button,
Here do not change anything just click on the “Next” button,
Here do not change anything just click on the “Next” button,
Here do not change anything just click on the “Next” button,
Here do not change anything just click on the “Start Import” button,
Here you will see that process bar with how much important has been done, wait for 100% completion

2. Installing “Ubercart” module

• Install Ubercart module.
• Ubercart optional modules “Payment” , “Reports”, “Roles” ,”shipping” and ”Shipping Quotes” should be enabled.
• Ubercart extra modules “cart links”, “Product Kit” and “stock” should be enabled.
• Ubercart fulfillment modules “Flatrate”, “U.S Postal Services”, “UPS” and “Weight Quote” should be enabled.
• Ubercart payment modules “Credit Card” , “Payment method pack” and “Test Gateway” should be enabled.

3. Edit Flat Rate Table

Now open your “phpmyadmin” and select your database, here you will see a table called “uc_flatrate_methods”. Edit the table and add new field “zipcode” in this table to store varchar(255) values.

4. Create Flat Rate Methods
• Remember to change “methods.php” file for your database credentials.
• Execute the file “methods.php” to create flat rate methods automatically.

5. Set Shipping Methods List Items

• Open http:///admin/store/settings/quotes/methods
• Here you will see five shipping methods other than “Shipping”, make “List” of those methods in “minus” , i.e. -5,-4 and so on.
• Under the heading “Default order fulfillment type for products” , select “Small Package” and click on “Save Configuration” button.

6. Create Your First Product

• Open http:///node/add/product
• Enter product information you want
• Enter weight to say “5” “Kilograms”
• Under “Shipping Settings” , you will see heading “Default product shipping type”
• Here select “Envelope” and click on the “Save” buttons
• Click on the “Add To cart” button to add the product into your cart

7. Configure “Default pickup address”

• Click on the link http:///admin/store/settings/quotes/edit
• In the form fields, enter your “Default Pickup Address”.
• Click on the “Save Configuration” button.
• Uncheck the link for “Display debug information to administrators.”
8. Configure Payment Method

• Open http:///admin/store/settings/payment/edit/methods
• Under the heading “Payment methods”, check the box for “Credit card” and select the “List” value that separates it from other payment methods. Uncheck all other checkboxes in this section.
• Under “Default gateway” select “Test Gateway”.
• Here you will see “Credit card settings” link, click on this link to configure credit card storage medium for processing of credit cards.
• Under the “Card number encryption key filepath:” heading, in text box give the path of the directory where you want credit card information to be processed. To do this, create a directory say “credit_cards” on the same level where your drupal site directory is. Give full access permissions to this directory (ready, write, etc).
• Here you will see the section for “Credit card fields” to set the fields you want to be available on the checkout page for the “Credit cards”.

The following checkboxes should be checked, don’t change any other default settings:

• Enable card owner text field on checkout form.
• Enable card start date on checkout form.
• Enable card issue number text field on checkout form.
• Enable card type selection on checkout form.

• Click on the “Save Configuration” button to save the changes.

9. Configure checkout panes
• Click on http:///admin/store/settings/checkout/edit/panes
• Here check all checkboxes under the “Enable” heading and select serial numbers for those checkboxes under the “List” heading.
• Click on the “Save Configuration” button.
• Click on the “Address fields” tab.
• Here check all checkboxes and under the “Required” heading check all checkboxes except (Phone Number, Company and Street Address2).
• Click on the “Save Configuration” button.

10. Select country list

• Open http:///admin/store/settings/countries/edit
• Here select country from list say “Australia” and click on the “Import” button.
11. Change Ubercart File

• Open file “/sites/all/modules/ubercart/shipping/uc_quote/”
• At line number 195 add the code “ ‘#default_value’ => 1,”
• Save this file

12. Access you cart

• Open “http:///cart “
• Here you will see your product added into your cart, product which you have created few time ago.
• Click on the “Checkout” button.
• Here you will see the “Billing Information” and “Delivery Information” sections.
• Under the “Billing Information” section, check the checkbox for “My billing information is the same as my delivery information.”
• Under the “Delivery Information” section, select your desired state, zip code related to that state and fill other required fields.
• Under the heading “Calculate shipping cost”, click on the “Click to calculate shipping” button to calculate shipping cost depending upon your entered zip code. After few time intervals you will see calculated shipping cost in this section and also in “Payment method” section.
• Here you will see a section “Payment method”

Here select card type to “Visa”,
Card Owner : xyz,
Card Number: 4111111111111111,
Expiration Date: (any future date),
CVV: 111
• Click on the “Review Order” button
• You will see now “http ://< yourdmain>/cart/checkout/review”, here you can see your entered information for this order.
• Click on the “Submit Order” button.
• Now you will see “http ://< yourdomain>/cart/checkout/complete”, with the message “Your order is complete! Your order number is ”.


Was this article helpful?

Related Articles