Post by mstation » Sat Sep 13, 2014 9:26 pm

Dear members,

Since I to make things match as better as I can, I would like to add some more control over the shipping costs.

In Italy we have several areas defined by their post codes which are more difficult to reach and in those specific cases my actual courier is asking to pay an additional fee of 13 euros for poorly served areas or 1 euro for peripheral areas. (VAT excluded)

So I started adding my code to achieve this into the shipping_method.tpl and the confirm.tpl. To explain briefly I added a check which confirms if the added postcode is belonging to one of the above areas and then I change the displayed text to show a warning saying that there is an addition fee and what is the new pricing.

But when I reach the confirm.tpl, even though I am updating the SQL lines regarding the specific order in the table called Order_Status i still cannot get the right values to display on screen.

I need suggestion on where can I find the page where the calculations are made for the order so that I can add my php code there and just let the template display the correctly calculated values display.

Can anyone hint me where I should look. I have checked the respective controller pages but I don't seem to be able to understand where the order totals are calculated.

Thank you
Simone

Newbie

Posts

Joined
Sat Nov 02, 2013 5:18 am

Post by pprmkr » Sun Sep 14, 2014 3:58 am

Shipping is calculated by catalog/model/shipping/YOUR_SHIPPING.php

Example Flat rate:

- catalog/model/shipping/flat.php

Code: Select all

'cost'         => $this->config->get('flat_cost'),
You could replace by variable calculated before $quote_data['flat'] = array(

Code: Select all

if($address['postcode'] == '1234AA') {
  $costs = ($this->config->get('flat_cost') + 13);
} else {
  $costs = $this->config->get('flat_cost')
}

Code: Select all

'cost'         => $costs,

User avatar
Active Member
Online

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by mstation » Sun Sep 14, 2014 12:34 pm

ohhhhhhhhh man..

if I could build you a statue.. I would. I mean i literally spent 3 days trying to figure this out using the controllers of the checkout and the template pages but this is what i needed!

feels to embarrassing now that I know!

i am using the weigh shipment method but I managed to make it work without any issue.

thanks a lot!
Simone

Newbie

Posts

Joined
Sat Nov 02, 2013 5:18 am

Post by OSWorX » Sun Sep 14, 2014 4:20 pm

Or by simply using this module here:
Custom Shipping Methods - also per postcode

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: No registered users and 7 guests