Post by jorem » Sun Aug 05, 2018 8:04 pm

Hi!

Using OC 3.0.2.0. Freights are weight based. Commonly, customers pay right away with card. Then it's no problems. Occasionally, customers prefer Cash On Delivery. I.e. they don't pay when purchasing online but to the post office when they collect the package. That's extra fee (fixed sum regardless of weight).

But how on earth do I add this extra fee during the checkout? I don't know if I have explained well enough, so I'll exemplify.

Joe buys a thingy that cost USD 10 and weighs 1 kilo. He selects payment via credit card (via PayPal in my case). Total cost is USD 10 for the thingy and USD 5 for weight based freight. All well and ordered received.

Bill buys the same thingy for USD 10 and it still weight 1 kilo. But Bill doesn't have a credit card so he select the option for COD (Cash On Delivery). He'll pay USD 10 fpr the gadget, USD 5 for weight based freight, but also an additional USD 3 for the COD.

How do I set this up?

Active Member

Posts

Joined
Thu Oct 07, 2010 9:42 pm

Post by straightlight » Sun Aug 05, 2018 8:52 pm

The catalog/model/extension/payment/cod.php file would need to be edited.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jorem » Sun Aug 05, 2018 9:04 pm

OK. I suppose I need to change true/false in a couple of instances?

Code: Select all

<?php
class ModelExtensionPaymentCOD extends Model {
	public function getMethod($address, $total) {
		$this->load->language('extension/payment/cod');

		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('payment_cod_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('payment_cod_total') > 0 && $this->config->get('payment_cod_total') > $total) {
			$status = false;
		} elseif (!$this->cart->hasShipping()) {
			$status = false;
		} elseif (!$this->config->get('payment_cod_geo_zone_id')) {
			$status = true;
		} elseif ($query->num_rows) {
			$status = true;
		} else {
			$status = false;
		}

		$method_data = array();

		if ($status) {
			$method_data = array(
				'code'       => 'cod',
				'title'      => $this->language->get('text_title'),
				'terms'      => '',
				'sort_order' => $this->config->get('payment_cod_sort_order')
			);
		}

		return $method_data;
	}
}

Active Member

Posts

Joined
Thu Oct 07, 2010 9:42 pm

Post by straightlight » Sun Aug 05, 2018 10:06 pm

Since this is an extension module, the rest is up to you to decide.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jorem » Mon Aug 06, 2018 2:33 am

Hi,
Thanks, but I don't have a clue what to decide. ???
What I'm after is a way to show an option for customers that prefer Cash on Delivery. It should be the same weight based shipping costs as if they paid right away with credit card, only that it would add an additional handling fee.
Please help me out here..

Active Member

Posts

Joined
Thu Oct 07, 2010 9:42 pm

Post by opencartboost » Mon Aug 06, 2018 1:32 pm

may you need extension COD with Fee. Try search on opencart store

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by Johnathan » Mon Aug 06, 2018 10:06 pm

You need an Order Total extension (not a Shipping extension) that can add a fee based on payment method. If you want to code it yourself, look at the structure of Order Total extensions like the Handling Fee, and that should get you started.

If you want an extension that can do it, Simple Payment Fee can do basic flat rate or percentage fees, and Payment-Based Fee/Discount can do more complex fees, like those based on weight or quantity. Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any further questions.

Image
Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by kestas » Tue Aug 07, 2018 5:01 am

Occasionally, customers prefer Cash On Delivery. I.e. they don't pay when purchasing online but to the post office when they collect the package. That's extra fee (fixed sum regardless of weight).
Hi,

I can help you. Please read your PM.

Cheers

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am
Who is online

Users browsing this forum: No registered users and 7 guests