bsmither Posted September 19, 2013 Share Posted September 19, 2013 This is for CubeCart 5.2.2 -- the edits should be the same, but maybe with nearby line numbers, for other versions. When the store owner administratively creates an order for a customer, and a digital product is added to that order, CubeCart does not attempt to also enable the ability for that customer to download that product. After performing the following edits: * When the admin moves the order from Pending to Processing (then, if this is a digital-only order, Cubecart moves it to Complete), CubeCart will email this message: Your Purchased Downloads with a viable link to the digital product. * The link will also appear in the customer's Account page, Digital Downloads section. I have not tested various permutations, such as, when adding a second digital product to a Completed order. Will emails be sent? What might happen to the existing digital product record in the CC_downloads table? Note: If you find that downloads are expiring immediately or in the past, make sure you have the following settings: * Store Settings, Stock tab, "Download expiry time (in seconds)" is blank or a number. * Store Settings, Advanced tab, correctly chosen the timezone you want your business to be operating in. Also, you may not need to enter anything here, but the "UTC Offset" is the number of seconds between where the server hosting your site is located and the time where your business is located: earlier (positive) or later (negative) than you. To get a good idea of what you need to put in this field, immediately after you log-in as an admin, got to the Staff Access Log. Calculate the number of hours you need to add or subtract from the time shown to get the time desired and multiply that by 3600. In the file, admin/sources/orders.index.inc.php: Near line 67: $GLOBALS['db']->update('CubeCart_order_inventory', $data, array('cart_order_id' => $order_id, 'id' => (int)$data['id'])); Add AFTER: // Updating a download not necessary (I hope) Near line 61: unset($record); } } // Update Products Add BEFORE: // Also insert a download if(isset($record['digital']) && $record['digital']) { $record['customer_id'] = (isset($_POST['customer']['customer_id']) && !empty($_POST['customer']['customer_id'])) ? (int)$_POST['customer']['customer_id'] : 0; $record['accesskey'] = md5($order_id.(int)$data['product_id'].date('cZ@u').mt_rand()); $record['expire'] = ($GLOBALS['config']->get('config', 'download_expire')>0) ? time() + $GLOBALS['config']->get('config', 'download_expire') : 0; $GLOBALS['db']->insert('CubeCart_downloads', $record); } Near line 60: $GLOBALS['db']->insert('CubeCart_order_inventory', $record); Change to: $record['order_inv_id'] = $GLOBALS['db']->insert('CubeCart_order_inventory', $record); // Capture inserted record id Near line 40: $GLOBALS['db']->delete('CubeCart_order_inventory', array('cart_order_id' => $order_id, 'id' => (int)$value)); Add AFTER: // Also remove from downloads $GLOBALS['db']->delete('CubeCart_downloads', array('cart_order_id' => $order_id, 'order_inv_id' => (int)$value)); Quote Link to comment Share on other sites More sharing options...
Iona Posted October 14, 2013 Share Posted October 14, 2013 Thank you for this. Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted October 23, 2013 Share Posted October 23, 2013 Al Can you confirm whether this fix will be ported into core and if so which version please ? For some people this is quite important and you have a ready made solution ! Thanks Ian Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted October 24, 2013 Share Posted October 24, 2013 Thanks for the post Brian. I find the instructions a little ambiguous. Any chance the patched file can be attached to this post so I can do a file comparison and merge? I don't understand why there is instructions to add a comment "// Updating a download not necessary (I hope)" after the update on line 67? The rest seems ok but I need to be sure before potentially releasing this in the wild. Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted November 8, 2013 Share Posted November 8, 2013 Al Did you manage to get to the bottom of this and is it likely to be part of 5.2.5 ? Quite a few clients have asked for the changes to be added but are also interested to know if it will be included in the next release so changes wont have to be re-done. Thanks Ian Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted November 8, 2013 Share Posted November 8, 2013 I'm sorry I haven't. I don't understand the instructions. Quote Link to comment Share on other sites More sharing options...
Mec4D Posted November 19, 2013 Share Posted November 19, 2013 Al ..This is the major bug for me since Cubecart 5.0 and should be added to the core as the way it is now it just don't works for digital orders created manually by the admin as no download link are send by e-mail or showing up in the download account section . I bothered Brian with this problem since I upgraded to cc5 , so thanks for the fix mate there is still problem with resetting digital orders made previously using cc version 4 + and after upgrade to cc5 there is no way to reset them at all and I am doing it manually with more than 3K customers on a daily basic Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 19, 2013 Author Share Posted November 19, 2013 Mec4D, if you haven't already, would you start a new conversation regarding your inability to reset a digital order that was originally created in CC4? Quote Link to comment Share on other sites More sharing options...
svrabel Posted June 3, 2014 Share Posted June 3, 2014 Brian, I don't see part of this in the code on my site. Do you know if it been updated in the latest release? Thanks for all your hard work on this. Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 3, 2014 Author Share Posted June 3, 2014 I will double-check to see if it still applies to CC5211. Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 4, 2014 Author Share Posted June 4, 2014 This can still be applied to CC5211 -- the line numbers have changed by just a few. Quote Link to comment Share on other sites More sharing options...
svrabel Posted June 3, 2015 Share Posted June 3, 2015 Just updated to 6.0.4 a few days ago, and this does not appear to be in the source code. Any ideas if this will still work or if it can be added to the 6.1.0 milestone? Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 3, 2015 Author Share Posted June 3, 2015 CC6 should have this feature (to be honest, I haven't checked). Quote Link to comment Share on other sites More sharing options...
svrabel Posted June 3, 2015 Share Posted June 3, 2015 I just created an order to test it. The digital download does not appear in the Digital Downloads section, and an email is not sent with download links. I'll head over to GitHub and add a feature request. Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 3, 2015 Author Share Posted June 3, 2015 Well, darn! I was led to believe this was a done deal.I'll get some instructions written up for CC605. Quote Link to comment Share on other sites More sharing options...
bsmither Posted June 3, 2015 Author Share Posted June 3, 2015 The instructions should apply to CC605, but the line numbers have changed.In the file, admin/sources/orders.index.inc.php:Near line 88, find: $GLOBALS['db']->update('CubeCart_order_inventory', $data, array('cart_order_id' => $order_id, 'id' => (int)$data['id'])); Add AFTER: // Updating a download not necessary (I hope) Near line 79, find: unset($record); } } // Update Products Add BEFORE: // Also insert a download if(isset($record['digital']) && $record['digital']) { $record['customer_id'] = (isset($_POST['customer']['customer_id']) && !empty($_POST['customer']['customer_id'])) ? (int)$_POST['customer']['customer_id'] : 0; $record['accesskey'] = md5($order_id.(int)$data['product_id'].date('cZ@u').mt_rand()); $record['expire'] = ($GLOBALS['config']->get('config', 'download_expire')>0) ? time() + $GLOBALS['config']->get('config', 'download_expire') : 0; $GLOBALS['db']->insert('CubeCart_downloads', $record); } Near line 78, find: $GLOBALS['db']->insert('CubeCart_order_inventory', $record); Change to: $record['order_inv_id'] = $GLOBALS['db']->insert('CubeCart_order_inventory', $record); // Capture inserted record id Near line 55, find: $GLOBALS['db']->delete('CubeCart_order_inventory', array('cart_order_id' => $order_id, 'id' => (int)$value)); Add AFTER: // Also remove from downloads $GLOBALS['db']->delete('CubeCart_downloads', array('cart_order_id' => $order_id, 'order_inv_id' => (int)$value)); Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted June 4, 2015 Share Posted June 4, 2015 Brian, if this was added as a github issue, can you add your solution to that issue and then hopefully it will get added to core in a future releaseIan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.