Post by yukicyan » Mon Aug 08, 2016 3:37 pm

How can I set the handling fee to percentage? I would like to have a certain % charges for the total amount of product purchased.

Thanks

Newbie

Posts

Joined
Mon Aug 08, 2016 3:31 pm

Post by knowband.plugins » Thu Aug 11, 2016 2:37 pm

It can be done easily by modifying following file.

/catalog/model/total/handling.php

Could you plese tell us which version of Opencart are you using so that we can help you.

Regards,
Knowband Plugins Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by yukicyan » Fri Aug 12, 2016 9:13 am

I'm using opencart 2.2.0.0

Newbie

Posts

Joined
Mon Aug 08, 2016 3:31 pm

Post by knowband.plugins » Fri Aug 12, 2016 3:27 pm

Edit below file

/catalog/model/total/phandling.php

and make changes as shown below

Code: Select all

<?php
class ModelTotalHandling extends Model {
	public function getTotal($total) {
		if (($this->cart->getSubTotal() > $this->config->get('handling_total')) && ($this->cart->getSubTotal() > 0)) {
			$this->load->language('total/handling');
                        $handlingfee=($this->config->get('handling_fee')/100)*$this->cart->getTotal();
			$total['totals'][] = array(
				'code'       => 'handling',
				'title'      => $this->language->get('text_handling'),
				'value'      => $handlingfee,
				'sort_order' => $this->config->get('handling_sort_order')
			);

			if ($this->config->get('handling_tax_class_id')) {
				$tax_rates = $this->tax->getRates($handlingfee, $this->config->get('handling_tax_class_id'));

				foreach ($tax_rates as $tax_rate) {
					if (!isset($total['taxes'][$tax_rate['tax_rate_id']])) {
						$total['taxes'][$tax_rate['tax_rate_id']] = $tax_rate['amount'];
					} else {
						$total['taxes'][$tax_rate['tax_rate_id']] += $tax_rate['amount'];
					}
				}
			}

			$total['total'] += $handlingfee;
		}
	}
}

Regards,
Knowband Plugins Team

Opencart Plugins: Knowband Store
Email: support@knowband.com


User avatar
Active Member

Posts

Joined
Thu Aug 04, 2016 2:56 pm


Post by yukicyan » Fri Aug 12, 2016 3:52 pm

Well done. Thanks a lot.

Newbie

Posts

Joined
Mon Aug 08, 2016 3:31 pm
Who is online

Users browsing this forum: No registered users and 8 guests