Post by campbellmac » Tue Apr 28, 2009 4:14 am

Version 1.2.6

When using a coupon, whether is be % or fixed amount, the coupon value is correctly being calculated however the order total is not being updated.
coupon_issue.png

coupon_issue.png (37.78 KiB) Viewed 4138 times

Where Campbell's is a 10% coupon.
I'm using a CC payment gateway also

In model/total/coupon the following line should update the total:

Code: Select all

$total -= $discount_total;
But it seems like its being ignored.

All other 'Order Total' extensions are working

Newbie

Posts

Joined
Wed Mar 11, 2009 11:29 am

Post by Daniel » Tue Apr 28, 2009 4:27 am

you seem to have posted this problem on more than one post.

I have no idea what is happening. This does not happen with any version ihave used so far.

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by campbellmac » Wed Apr 29, 2009 5:30 am

Yeah not sure what was going on either.

So Ive fixed my problem, its probably not relevant to anyone else but thought I'd note it just incase it happens to anyone.

I removed the total/total as an option and hard coded it as there is always going to be a total

I changed the sort order for this to 100 and this ensures that it always gets summed last.

Also there is a mistake on total/shipping where it references config_coupon_status, this should be config_shipping_status.

Newbie

Posts

Joined
Wed Mar 11, 2009 11:29 am

Post by Daniel » Wed Apr 29, 2009 8:47 am

thanks for that bug.

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by Antonio Montana » Wed Jun 10, 2009 4:39 pm

Hi All!
Not sure if this is a problem at all, but i've faced this once applying a checkout totals.

Each of totals has it's sort order which is adjusted in the admin panel.
But this may not affect the actual order of totals being applied to the final value.

Code: Select all

$results = $this->model_checkout_extension->getExtensions('total');
		foreach ($results as $result) {
			$this->load->model('total/' . $result['key']);

			$this->{'model_total_' . $result['key']}->getTotal($total_data, $total, $taxes);
		}

Code: Select all

class ModelCheckoutExtension extends Model {
	function getExtensions($type) {
		$query = $this->db->query("SELECT * FROM extension WHERE `type` = '" . $this->db->escape($type) . "'");
		return $query->rows;
	}
}
So the order of totals list depends not on the actual sort order, but on the way how the list of total extensions is being retrieved from the base.

My problem was that the shipping was not applied to final total, because it's extenision's ID was higher than the final's one.

So:
1) Total's ID changed to the higher value in the database
2)

Code: Select all

class ModelCheckoutExtension extends Model {
	function getExtensions($type) {
		$query = $this->db->query( "SELECT * FROM extension WHERE `type` = '" . $this->db->escape($type) . "' ORDER BY extension_id ASC" );
		return $query->rows;
	}
}
P.S. I've been fixing a store made not by me and had a little time, so I'm not sure about OC's version (some kind of 1.2.* i guess)
and not sure that something is not going wrong after my interruption.
Also this problem may be fixed already, not sure :)

THANKS!

Please be welcome to order a site :)
http://picassostyle.com



Posts

Joined
Wed Jun 10, 2009 4:24 pm
Location - London

Post by iuliantoma » Fri Jun 19, 2009 1:52 am

Daniel wrote:you seem to have posted this problem on more than one post.

I have no idea what is happening. This does not happen with any version ihave used so far.
This bug is still present for version 1.2.8
in confirm.php i did a hack like this that solves the problem but it must be solved in the core

Code: Select all

foreach ($results as $result) {
			if ($result['key'] != "total") {
				$this->load->model('total/' . $result['key']);
				$this->{'model_total_' . $result['key']}->getTotal($total_data, $total, $taxes);
			}
		}
		
		foreach ($results as $result) {
			if ($result['key'] == "total") {
				$this->load->model('total/' . $result['key']);
				$this->{'model_total_' . $result['key']}->getTotal($total_data, $total, $taxes);
			}
		}
the total is not well calculated because the toatal is not loaded last. please fix

New member

Posts

Joined
Fri Jun 19, 2009 12:38 am

Post by Daniel » Fri Jun 19, 2009 2:06 am

Antonio Montana wrote:Hi All!
Not sure if this is a problem at all, but i've faced this once applying a checkout totals.

Each of totals has it's sort order which is adjusted in the admin panel.
But this may not affect the actual order of totals being applied to the final value.

Code: Select all

$results = $this->model_checkout_extension->getExtensions('total');
		foreach ($results as $result) {
			$this->load->model('total/' . $result['key']);

			$this->{'model_total_' . $result['key']}->getTotal($total_data, $total, $taxes);
		}

Code: Select all

class ModelCheckoutExtension extends Model {
	function getExtensions($type) {
		$query = $this->db->query("SELECT * FROM extension WHERE `type` = '" . $this->db->escape($type) . "'");
		return $query->rows;
	}
}
So the order of totals list depends not on the actual sort order, but on the way how the list of total extensions is being retrieved from the base.

My problem was that the shipping was not applied to final total, because it's extenision's ID was higher than the final's one.

So:
1) Total's ID changed to the higher value in the database
2)

Code: Select all

class ModelCheckoutExtension extends Model {
	function getExtensions($type) {
		$query = $this->db->query( "SELECT * FROM extension WHERE `type` = '" . $this->db->escape($type) . "' ORDER BY extension_id ASC" );
		return $query->rows;
	}
}
P.S. I've been fixing a store made not by me and had a little time, so I'm not sure about OC's version (some kind of 1.2.* i guess)
and not sure that something is not going wrong after my interruption.
Also this problem may be fixed already, not sure :)

THANKS!
Sorting is done on the checkout confirm page!!

Code: Select all

		$results = $this->model_checkout_extension->getExtensions('total');
		
		foreach ($results as $result) {
			$this->load->model('total/' . $result['key']);

			$this->{'model_total_' . $result['key']}->getTotal($total_data, $total, $taxes);
		}
		
		$sort_order = array(); 
	  
		foreach ($total_data as $key => $value) {
      		$sort_order[$key] = $value['sort_order'];
    	}

    	array_multisort($sort_order, SORT_ASC, $total_data);

User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm
Who is online

Users browsing this forum: No registered users and 17 guests