Post by michelk » Sun Jul 10, 2011 12:37 am

I wanted to display downloads when they were bought with the Free Checkout payment option and that option was set to Complete.

I modified catalog\model\account\download.php

Code: Select all

	public function getDownload($order_download_id) {
	
	   $q="SELECT * FROM " . DB_PREFIX . "order_download od LEFT JOIN `" . 
        DB_PREFIX . "order` o ON (od.order_id = o.order_id) WHERE o.customer_id = '" . 
        (int)$this->customer->getId(). 
        "' AND o.order_status_id > '0'  AND (o.order_status_id = '" . 
        (int)$this->config->get('config_download_status') . 
        "'  OR  o.payment_method = 'Free Checkout')  AND od.order_download_id = '" . 
        (int)$order_download_id . "' AND od.remaining > 0";
 	 
		$query = $this->db->query($q);
		 
		return $query->row;
	}

Code: Select all

	public function getDownloads($start = 0, $limit = 20) {
		if ($start < 0) {
			$start = 0;
		}
 
        $q="SELECT o.order_id, o.date_added, od.order_download_id, od.name, od.filename, od.remaining FROM " . 
            DB_PREFIX . "order_download od LEFT JOIN `" . 
            DB_PREFIX . "order` o ON (od.order_id = o.order_id) WHERE o.customer_id = '" . 
            (int)$this->customer->getId() . 
            "' AND o.order_status_id > '0' ".
            " AND (o.order_status_id = '" . 
            (int)$this->config->get('config_download_status') . 
            "' OR  o.payment_method = 'Free Checkout') ".
            "ORDER BY o.date_added DESC LIMIT " . 
            (int)$start . "," . (int)$limit;
 
        $query = $this->db->query($q); 		 
		//$query = $this->db->query("SELECT o.order_id, o.date_added, od.order_download_id, od.name, od.filename, od.remaining FROM " . DB_PREFIX . "order_download od LEFT JOIN `" . DB_PREFIX . "order` o ON (od.order_id = o.order_id) WHERE o.customer_id = '" . (int)$this->customer->getId() . "' AND o.order_status_id > '0' AND o.order_status_id = '" . (int)$this->config->get('config_download_status') . "' ORDER BY o.date_added DESC LIMIT " . (int)$start . "," . (int)$limit);     
 
		return $query->rows;
	}
May be there is a better way... I didn't find.

http://www.emediacart.com
The emediaCart solution is a plug-n-play hardware-software e-commerce solution. It features a computer the size of a matchbox (4" x 2.5" x 2") running Linux and OpenCart.

Coming soon... emediaBackpack, the only automatic, encrypted, remote service for all OpenCart installations. PM me for more info.


Newbie

Posts

Joined
Mon May 23, 2011 7:26 pm

Post by lair12 » Mon Jul 11, 2011 1:50 am

It should work without any mods. If you see my site www.ariososheetmusic.com and go to the bottom of the quartet music, there is a free test download. No mod needed as the download is available after you go through free checkout.

New member

Posts

Joined
Thu Jun 23, 2011 2:13 am

Post by Qphoria » Mon Jul 11, 2011 2:16 am

Yea, the free checkout is the same as any other checkout. When the order completes, the order status is updated to the status id you set. In this case, you'd set the free checkout to COMPLETE and when they checked out, they would see the download in their download page.

Not really sure what the point of this mod is. It is unnecessary.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by lair12 » Mon Jul 11, 2011 9:58 am

I made this language change to get completed downloads to no longer show once they are done.

http://forum.opencart.com/viewtopic.php ... 51#p170856

New member

Posts

Joined
Thu Jun 23, 2011 2:13 am
Who is online

Users browsing this forum: No registered users and 3 guests