Develop a Custom Shipping Method in OpenCart: Component Two

In this set, we are discussing the execution of a custom transport process module in OpenCart. In the very first part, we empowered and configured our custom transport process using the settings type in the backend. Now, we will execute the files which OpenCart requires so that it may find the custom transport process and list it along with the other empowered transport procedures during checkout.! 

I am hoping that you just have created all of the files from the very first part of the show. I 'd support you to go through that before continuing farther, for those who have not gone through the first part yet. Additionally, I presume that you simply are using the most recent version of OpenCart.

You need to see the $address argument is passed in the getQuote system, which is the transport address of the customer during checkout, also it permits US to determine if the present transport process is appropriate for the geo zone. The subsequent code determined it's.

As you are able to see, we are using the $this->config->get system to load the values for the settings variants like "custom_price", "custom_tax_group_id" and "custom_kind_sequence". Remember the very first section, in which we configured these worth utilizing the custom settings form! !

Additionally, an important snippet to see is the value of the text key in the $quotation_information array. It formats and computes the whole sum that will probably be charged for our custom transport process. Especially, it checks if any additional tax ought to be added to the "price" of the transport process. Remember the Tax Class setting we supplied in our setup type, in which we picked Taxable Goods. So, it will add another tax to the entire quantity of the transportation process!

It is recorded with the name "Custom Transportation Rate - $14.00". You may be taken by surprise that although we configured the Price parameter to 10, it is revealing 14 in the list. As I mentioned before, we configured Taxable Goods in the Tax Class field in the setup form in the backend.

Browse to Localization > Taxes > Tax Classes, and edit Taxable Goods. You will see that 20% VAT as well as a flat 2$ Eco Tax are configured for this particular tax type. So, it adds the price of the transportation process and an additional $4! Obviously, should you place Tax Class to None, tax will not be used at all!

I am hoping that you just have appreciated this two-part show and you have learned something useful. Do not forget to check out what we have available for sale on the marketplace in the event you are trying to find more OpenCart programs. Do not forget queries using the feed and to share your reviews!

Posted on January 28, 2016 at 08:00 PM