Author Topic: Download Products Available Immediately  (Read 12023 times)

DaveB

  • Beginner
  • *
  • Posts: 7
Download Products Available Immediately
« on: March 22, 2005, 15:53:55 pm »
I am posting this just in case there is a better way of doing this. So, bear with me as I have only been looking at phpshop for a day or two.

I am selling download only products from mambo-phpshop and wanted the order status to go to "Confirmed" as soon as the user had paid. Also, I wanted the THANK YOU screen to show them a link to the download immediately.

I was able to do this with two changes:-

1)
I edited the function add() in ps_checkout.php and included the code as follows after  $this->email_receipt($order_id);

Code: [Select]
if ($db->f("attribute_name") =="download") {
      $d['order_status']='C';
      require_once(CLASSPATH.'ps_order.php' ); //CREATE A NEW ps_order class as this has the download function
      $ps_order=new ps_order;
      $ps_order->order_status_update($d);
}
This changes the order status to  "Confirmed" and causes the download advice email to be sent to the user.

2) I modified checkout.thankyou.php to include the code below after the "Thank You" statement was printed. I am not particularly happy with the way that I find if the product was a download ( if($downloadCounter>0)), so would welcome advice to improve it.

Code: [Select]
$dbw_2 = new ps_DB;
$q = "SELECT * FROM #__pshop_product_download WHERE";
$q .= " order_id = '" . $vars["order_id"] . "'";
$dbw_2->query($q);
$url = $mosConfig_live_site."/index.php?option=com_phpshop&page=shop.downloads";
       
$downloadCounter=0;
$message='<table border="0" width="75%"><tr>';
         
while($dbw_2->next_record()) {
                   ++$downloadCounter;
                                     
                   $message.= '<tr><td>File name : '.$dbw_2->f("file_name").'</td>'.
                             '<td>Download ID : <a href="'."$url&download_id=".$dbw_2->f("download_id").'">'.
                             $dbw_2->f("download_id").'</a></td></tr>';
                             
}
         
$message.='</table>';
         
if($downloadCounter>0) {
          echo("<p>".$PHPSHOP_LANG->_PHPSHOP_DOWNLOADS_SEND_MSG_1."</p>");
          echo("<p>".$PHPSHOP_LANG->_PHPSHOP_DOWNLOADS_SEND_MSG_2."</p>");
          echo("<p>".$message."</p>");
          echo("<p>".$PHPSHOP_LANG->_PHPSHOP_DOWNLOADS_SEND_MSG_3.": ".DOWNLOAD_MAX."</p>");
         
          $expire = ((DOWNLOAD_EXPIRE / 60) / 60) / 24;
          echo(str_replace("{expire}", $expire, $PHPSHOP_LANG->_PHPSHOP_DOWNLOADS_SEND_MSG_4));
         
         
}

I would be happy to hear of better ways to do this! But hope this helps somebody.

krbmedia

  • Beginner
  • *
  • Posts: 5
Re: Download Products Available Immediately
« Reply #1 on: May 25, 2005, 20:58:16 pm »
Any chance of me getting the edited files? I am a newbie.

DaveB

  • Beginner
  • *
  • Posts: 7
Re: Download Products Available Immediately
« Reply #2 on: May 26, 2005, 10:18:38 am »
Sure, drop me a message if you want it. HOWEVER, I have customised this module heavily and you may find that it breaks other features you are using

Dave

JoshM

  • Beginner
  • *
  • Posts: 1
    • http://www,mambosolutions.com
Re: Download Products Available Immediately
« Reply #3 on: July 27, 2005, 06:52:51 am »
anyone make any progress or have success with this idea?

jlr1001

  • Beginner
  • *
  • Posts: 3
Re: Download Products Available Immediately
« Reply #4 on: August 29, 2005, 13:01:04 pm »
Quote
anyone make any progress or have success with this idea?

I just added this hack to my Mambo-PhpShop installation and it definitely works.  However, there's one catch.  Since the url for the checkout thankyou and result pages include the order number (i.e. order=150), a knowledgable customer can, after placing an order, just enter the url for the final checkout page, add their order number to the url, and bingo . . . there's their download link.

I'm using paypal to process credit card payments, and I realized that someone could be on the Paypal site, not fill in the credit card form, decide to try what I just said above, and gain full access to their download link.

Obviously the customer would have to A) be unscrupulous , and B) know how to do this, or at least be aware of this security exploit.

Personally, I think my audience (CEO's and small business owners) are too busy to try and find a way to hack my shopping cart.  Also my items have such a low price point that most people wouldn't think twice about paying it.

So I'm not too worried.  Now, other people . . . that's  a different story.



-JLR1001

magyver

  • Beginner
  • *
  • Posts: 7
Re: Download Products Available Immediately
« Reply #5 on: August 30, 2005, 08:08:04 am »
Keep working at it. I could'nt risk the loss of the money as margines are so tight in the Computer industry.

Here's another chalange for you. I have a client that sells a downloadable product that totals 305MB .zip file. Now we can break it down to 8 separate .zip file, the largest being 50MB. If I can find a way to sell one product and the email or download page gives 8 separate links for each of the files?

wooly

  • Beginner
  • *
  • Posts: 19
Re: Download Products Available Immediately
« Reply #6 on: November 10, 2005, 10:57:22 am »
DaveB I really like your idea... I need to use something like that too..

Did you or anyone else think of a way around the order number url exploit mentioned by jlr1001 above?

thanks in advance

Wanda

wooly

  • Beginner
  • *
  • Posts: 19
Re: Download Products Available Immediately
« Reply #7 on: November 14, 2005, 00:06:29 am »
I have found another post using some of davebs code that I have updated for Virtuemart RC3

http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=11757.msg23711#msg23711

spiritware

  • Beginner
  • *
  • Posts: 13
Re: Download Products Available Immediately
« Reply #8 on: July 07, 2006, 23:05:51 pm »
Hello.  I have two small problems I would like some help with.

1)Where does the account.order_details.php go?  I have the latest version of VM and I want to install the new code you guys have come up with but I don't know where it goes.

2)Also, when my customer finally gets the download code, follows the link, and inserts the code the browser, any browser, show this nonsense.  It looks like the metatags I have embedded in the PDF.  But I get the same thing with any file I try to purchase and download including .ZIP.  Something isn't loading properly.  The PDF does NOT open properly and I get no errors.  Just metatag info in the browser window.  For the .ZIP files I get ZP$ in the upper left corner of the otherwise blank browser window.

Thank you for your help.

Jamie