Forums / All Other Contributions/Addons / Edit orders add on not adding download links.

Edit orders add on not adding download links.

Locked

Views: 813

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
2 Jan 2010, 12:59 AM
#1
thysm00 avatar

thysm00

New Zenner

Join Date:
May 2009
Posts:
30
Plugin Contributions:
0

Edit orders add on not adding download links.

Hi,
I wanted to use the edit orders to be able to add products to some of my orders and it works well for everything except for the download links.
And unfortunately, i work almost only with download links. I think i came up with a solution that seems to be working, at least for now, it generates the download links in the order details. I did not add a lot to the code, and i'm not a great php coder so i may have missed some stuff (for example, i know that the table names should not be hardcoded...).

If somebody is interested, here is the code i added (please don't just tell me that my code isn't clean, i already know that :) and maybe if you think so, then correct me :) ).

I just edited the edit_orders.php file,
i added this at line 478 just outside the for loop

$result11a=mysql_query("SELECT products_attributes_filename,products_attributes_maxdays,products_attributes_maxcount FROM products_attributes_download, products_attributes 
WHERE products_attributes.products_id= '$add_product_products_id' 
AND products_attributes_download.products_attributes_id = products_attributes.products_attributes_id
ORDER BY products_attributes_filename ")
				or die("Failed to connect database: ");
				$i = 1;
				while($row11a=mysql_fetch_array($result11a, MYSQL_NUM)) {
					$downloadnames[$i]=$row11a[0]; 
					$downloaddays[$i]=$row11a[1]; 
					$downloadcount[$i]=$row11a[2]; 
					$i++;
					}

and then this at line 550 in the for loop:

$Query2 = "insert into orders_products_download set
				orders_id = $oID,
				orders_products_id = $new_product_id,
				download_maxdays = '" . $downloaddays[$i] . "',
				download_count = '" . $downloadcount[$i] . "',
				orders_products_filename = '" . $downloadnames[$i] . "';";
			$db -> Execute($Query2);

I know this isn't deleting any download links when you remove a product, but it seems that by default when you delete an order, it does not remove the links from the download table either...

Maybe a coding master could correct my mistakes or this could even be usefull to someone, and even maybe added to the add on, who knows :)

Arno

2 Jan 2010, 5:33 AM
#2
srturner47 avatar

srturner47

Zen Follower

Join Date:
Oct 2007
Posts:
385
Plugin Contributions:
0

Re: Edit orders add on not adding download links.

thysm00-

I think I fixed this with v2.0. See the link in my signature to download it. Should take care of all issues with downloads when adding and deleting products from an order. If that doesn't work, let me know.

2 Jan 2010, 10:20 AM
#3
thysm00 avatar

thysm00

New Zenner

Join Date:
May 2009
Posts:
30
Plugin Contributions:
0

Re: Edit orders add on not adding download links.

..... :)
I hope you did not fix that before me... otherwise i spent a few hours yesterday evening for nothing...
I'll try it and tell you.

thanks for the reply!

2 Jan 2010, 10:32 AM
#4
thysm00 avatar

thysm00

New Zenner

Join Date:
May 2009
Posts:
30
Plugin Contributions:
0

Re: Edit orders add on not adding download links.

Well.... i just tried it and.... it's working :) And i'm sure it's way better than what i did...
Thank you for that, and you know what's worse? I actually tried it before the v1.53 that is available in the add ons section, but i guess i did something wrong...

2 Jan 2010, 10:45 AM
#5
thysm00 avatar

thysm00

New Zenner

Join Date:
May 2009
Posts:
30
Plugin Contributions:
0

Re: Edit orders add on not adding download links.

...and you've got a donation!