Post by espc » Tue Jul 13, 2010 11:32 pm

I got this mod...it works well..unless it "always works".
it adds cod taxes, even if I choose another payment method like paypal.
How can I fix this?
this is a part of my catalog/model/total/cod_fee.php
I think the error is here:

Code: Select all

if ($this->config->get('cod_fee_status')) {

                if (isset($this->session->data['payment_method']['id']) == "cod" && $this->config->get('cod_tax') > 0) {
        			if ($this->config->get('cod_free') == 0 || ($this->config->get('cod_free') == 1 && $this->cart->getSubTotal() < $this->config->get('cod_free_value'))) {

God, give me courage to do what I can,
humility to admit what I can't,
and wisdom to know the difference.

Opencart mods (search suggestions and so on):
http://forum.opencart.com/viewtopic.php?p=71588#p71588" onclick="window.open(this.href);return false;


User avatar
Active Member

Posts

Joined
Fri Dec 04, 2009 12:40 am

Post by espc » Wed Jul 14, 2010 8:04 pm

no one?

God, give me courage to do what I can,
humility to admit what I can't,
and wisdom to know the difference.

Opencart mods (search suggestions and so on):
http://forum.opencart.com/viewtopic.php?p=71588#p71588" onclick="window.open(this.href);return false;


User avatar
Active Member

Posts

Joined
Fri Dec 04, 2009 12:40 am

Post by espc » Thu Jul 15, 2010 7:32 pm

help

God, give me courage to do what I can,
humility to admit what I can't,
and wisdom to know the difference.

Opencart mods (search suggestions and so on):
http://forum.opencart.com/viewtopic.php?p=71588#p71588" onclick="window.open(this.href);return false;


User avatar
Active Member

Posts

Joined
Fri Dec 04, 2009 12:40 am

Post by Qphoria » Thu Jul 15, 2010 10:08 pm

have you contacted the author? There is always an alternative using the PaymentTypeFee mod. I know for a fact it works correctly :)

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by espc » Fri Jul 16, 2010 8:27 pm

come on...help me

God, give me courage to do what I can,
humility to admit what I can't,
and wisdom to know the difference.

Opencart mods (search suggestions and so on):
http://forum.opencart.com/viewtopic.php?p=71588#p71588" onclick="window.open(this.href);return false;


User avatar
Active Member

Posts

Joined
Fri Dec 04, 2009 12:40 am

Post by SteveSherry » Fri Jul 16, 2010 8:59 pm

Qphoria wrote:have you contacted the author? There is always an alternative using the PaymentTypeFee mod. I know for a fact it works correctly :)
He did....

My Website ¦ Summer Madness Special Offer ¦


Active Member

Posts

Joined
Thu Apr 08, 2010 7:47 am
Location - Wirral, UK

Post by espc » Wed Jul 21, 2010 7:32 am

if I solve this issue I can share the mod with the community...
nobody can hel pme, with the code?

God, give me courage to do what I can,
humility to admit what I can't,
and wisdom to know the difference.

Opencart mods (search suggestions and so on):
http://forum.opencart.com/viewtopic.php?p=71588#p71588" onclick="window.open(this.href);return false;


User avatar
Active Member

Posts

Joined
Fri Dec 04, 2009 12:40 am

Post by albx » Wed Nov 24, 2010 2:35 pm

i changed it this way :

Code: Select all

<?php
class ModelTotalCodFee extends Model {
	public function getTotal(&$total_data, &$total, &$taxes) {
		if ($this->config->get('cod_fee_status')) {
			
			if (isset($this->session->data['payment_method'])) {
          if ($this->session->data['payment_method']['id'] == "cod" && $this->config->get('cod_fee_status') > 0) {
        			if ($this->config->get('cod_free') == 0 || ($this->config->get('cod_free') == 1 && $this->cart->getSubTotal() < $this->config->get('cod_free_value'))) {

                        $this->load->language('total/cod_fee');

                        $this->load->model('localisation/currency');

                        if ($this->config->get('cod_free_type') == 1) {
                            $cod_tax = $this->config->get('cod_tax_perc') / 100 * $this->cart->getSubTotal();
                            if ($cod_tax < $this->config->get('cod_tax')) {
                                $cod_tax = $this->config->get('cod_tax');
                            }
                        } else {
                            $cod_tax = $this->config->get('cod_tax');
                        }
                        
                        $total += $cod_tax;
                        
                        $cod_fee_tax_class_id = $this->config->get('cod_fee_tax_class_id');
                        if (!empty($cod_fee_tax_class_id)) {
                            $taxes[$cod_fee_tax_class_id['tax_class_id']]+= $cod_tax / 100 * $this->tax->getRate($this->config->get('cod_fee_tax_class_id'));
                        }
                        
                        $total_data[] = array(
                    		'title'      => $this->language->get('text_cod_fee'),
                    		'text'       => $this->currency->format($cod_tax),
                    		'value'      => $cod_tax,
            				'sort_order' => $this->config->get('cod_fee_sort_order')
            			);
                }
            }
      }
		}
	}
}
?>
regards

Newbie

Posts

Joined
Wed Nov 24, 2010 2:31 pm
Who is online

Users browsing this forum: No registered users and 12 guests