Jump to content

Need help with digital downloads


CBGitty
 Share

Recommended Posts

Currently running v5.1.5, have also tested it on 5.2.7. At this point I have a single digital download product, and I cannot get the automatic download link to work. I have uploaded the PDF file via the Downloads interface in admin. I have verified that the product is set as digital (Had to go into the database to do this). In the product definition, the PDF file is selected on the Digital tab. No custom file path is set. 

 

When a customer purchases the product by itself, once paid the order goes to COmplete status and the customer gets an e-mail with the download link. When that link is clicked, they end up at a browser error indicating a redirect loop. The same thing happens if I try to set a custom file path. 

 

Also, nothing shows up in the customer's digital downloads area under their account details.

 

Is there some undocumented cubecartian errata that I have to set, or is this another non-functional feature we just have to work around.

Link to comment
Share on other sites

I have yet to trace this out, but I have a theory. The theory is based on CubeCart (not sure which version) somehow allowing a PayPal Express payment to occur without the customer first filling in the Billing and Delivery address blocks during checkout. I don't know if that is particular to the site where I saw the following error message or not:

 

No customer information detected. Order summary was not built or inserted.

 

How far ahead or after in the code, when this error message is produced, that may affect if the item shows up in the customer account's Downloads page, I have yet to determine.

 

"a browser error indicating a redirect loop"

 

Would you let us see the syntax of a link in an email of that order? It should look like:

http://www.example.com/store_path/index.php?_a=download&accesskey=hash_code

Also, please look at the contents of an .htaccess file in your site root directory, and any .htaccess file in the CubeCart sub-folder if the store is installed there. If there is a file(s), do you think any statement that may want to re-write the URL may be affecting the download?

Link to comment
Share on other sites

This is a complex issue which we will be able to resolve via support with FTP/admin access. I'm sorry that you are facing this problem but it is not a known issue.  

 

I expect that it is due to some kind of database structure or data error which we will be able to find and fix. 

Link to comment
Share on other sites

Al: I will poke around at it a bit and then maybe give a support ticket a try. Last time I tried it the tech that took it up seemed to know less about CubeCart than I did, and I ended up digging into the code and fixing the issue myself.

 

BSmither:

 

I do have SEO URLs turned on with the Apache rewrite rule enabled. .htaccess contents as follows, as shown via the admin console/store settings:

 

## File Security
<FilesMatch ".(htaccess)$">
 Order Allow,Deny
 Deny from all
</FilesMatch>
 
#### Apache directory listing rules ####
DirectoryIndex index.php index.htm index.html
IndexIgnore *
 
#### Rewrite rules for SEO functionality ####
 
<IfModule mod_rewrite.c>
  RewriteEngine On
 
  ######## START v4 SEO URL BACKWARD COMPATIBILITY ########
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule cat_([0-9]+)(.[a-z]{3,4})?(.*)$ index.php?_a=category&cat_id=$1&%1 [NC]
 
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule prod_([0-9]+)(.[a-z]{3,4})?$ index.php?_a=product&product_id=$1&%1 [NC]
 
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule info_([0-9]+)(.[a-z]{3,4})?$ index.php?_a=document&doc_id=$1&%1 [NC]
 
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule tell_([0-9]+)(.[a-z]{3,4})?$ index.php?_a=product&product_id=$1&%1 [NC]
 
  RewriteCond %{QUERY_STRING} (.*)$
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule _saleItems(.[a-z]+)?(?.*)?$ index.php?_a=saleitems&%1 [NC,L]
  ######## END v4 SEO URL BACKWARD COMPATIBILITY ########
 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*).html?$ index.php?seo_path=$1 [L,QSA]
</IfModule>
Link to comment
Share on other sites

After a little more experimenting, here is what I have found.

 

1) I have SSL enabled and forced for all pages.

2) The download link as supplied in the customer email is: http://www.cbgitty.com/cubecartdev/index.php?_a=download&accesskey=eed096047a110aaea2e18ed7330d4f61

3) When clicked, the site strips off the http:// and redirects to just www.cbgitty.com/cubecartdev/index.php?_a=download&accesskey=eed096047a110aaea2e18ed7330d4f61

3) If I add https://, the download works.

 

So it seems like this could be resolved by changing the link generation code to check for SSL being enabled, or changing how SSL redirection is handled so that it redirects to https instead of just stripping the http. 

Link to comment
Share on other sites

Ok so the issue you are facing is an old bug which was fixed a long time ago. I expect your old code base could be to blame for Amazon Checkout not working too. 

 

You *should* have the following block of code in your classes/order.class.php file.

$storeURL = (CC_SSL) ? $GLOBALS['config']->get('config', 'standard_url') : $GLOBALS['storeURL'];
					foreach ($dkeys as $dkey) {
						$download['url'] 	= $storeURL.'/index.php?_a=download&accesskey='.$dkey['accesskey'];
Link to comment
Share on other sites

Looks like line 632 of order.class.php might have the clauses reversed:

 

I changed it from:

 

$storeURL = (CC_SSL) ? $GLOBALS['config']->get('config', 'standard_url') : $GLOBALS['storeURL'];

 

to:

 

$storeURL = (CC_SSL) ? $GLOBALS['storeURL'] : $GLOBALS['config']->get('config', 'standard_url');
 
and now it is adding the https://

Al, I am testing this on the dev install I freshly updated to version 5.2.7... not sure how old bugs fixed long ago would still be lingering there?

Link to comment
Share on other sites

Thanks for the update and apologies for assuming you were still on an older code base. That code is indeed the wrong way around! However if SSL is not enabled then 'standard_url' may not have a value. A better fix would be... 

$storeURL = (CC_SSL) ? $GLOBALS['config']->get('config', 'ssl_url') : $GLOBALS['storeURL'];

I have updated this in version control for the next release. 

 

I was surprised this bug hasn't been spotted until now but then I realised that in the majority of cases the email will be generated under SSL automatically on checkout. If this order was set to complete from the admin side manually without SSL then the protocol in the email will indeed be wrong. I think this may be how its slipped through the net. 

 

I hope this is sorted now and I am terribly sorry for any inconvenience caused. We will be more than happy to do all we can with the Amazon Checkout issue too. 

Link to comment
Share on other sites

I will use your version of the line, thanks.

 

One more question on the topic of downloads... it has always (as far as I know) been the case that if a customer buys a digital download along with other tangible products in a single order, then the download link doesn't get sent until the order is marked complete (ie, when it is shipped) which may not occur for several days if over a weekend. Customers expect that "instant download" links will be sent as soon as the order is paid. It seems like this could be achieved by moving the "$this->_digitalDelivery($order_id, $this->_order_summary['email']);" line from the ORDER_COMPLETE case to the ORDER_PROCESS case in the orderStatus function. Do you see any reason why this wouldn't work?

Link to comment
Share on other sites

I can't see any problem with that at all actually. :) My head is now spinning trying to figure out why we put it in the complete status section. It does seem to make sense to put it at processing!! I would fear changing this in the OOTB code without rigorous testing. 

 

Maybe you can be so kind as to let us know the outcome. 

Link to comment
Share on other sites

I moved it and tested with both a digital-only order and a mixed order, and it seems to work fine, sending the mails when the order changes to Processing. Adding it as an admin setting might be a nice feature, to let store admins specify when digital download mails should be sent.

 

Also, in the original post I had mentioned that nothing was showing up on the user's downloads page in account settings. Turns out this was due to a typo'd variable name in the cintoxblue theme template. So all of the issues in this thread are now resolved.

Link to comment
Share on other sites

GREAT! I have to say that I'm not a fan of settings. If you can make an ecommerce solution that works out the box with no settings I'd push for that. Since moving from Windows to Mac this is one thing that I've particularly noticed on OS X which is a great influence. 

 

For the sake of legacy functionality this probably does need a setting however. I will raise a GitHub issue for this to be investigated deeper. 

Link to comment
Share on other sites

My head is now spinning trying to figure out why we put it in the complete status section. It does seem to make sense to put it at processing!!

Hi Al

I think in V4 it was also at Completed status BUT if an order only contained digital products then an orderwent straight from Pending to Completed. I think the reason is what happens if you have a mix of digital and physical goods in the same order - the order has to go to Processing although there is no reason to not send digital downloads at Processing.

Thanks

Ian

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...