albertalbert Posted October 9, 2012 Share Posted October 9, 2012 Hi, I want to set up a store that sells virtual products. Ideally, when a user buys Product A, he is actually purchasing a code, so he should be able to download a pdf file that has a unique code in it. This codes are pre-generated, I don't need them to be generated on the fly. I see that in Prestashop you can define a product as virtual and asign a file to download. However, in my case this wouldn't work like that since each file (pdf in this case) should have a unique code, it wouldn't be always the exact same pdf file for every Product A purchase. An alternative that might be easier to implement would be that the pdf was always the same, and then the user would receive also an email with the code. Again, each product (Product A,m Product B, etc) would have its own set of pre-generated codes, so if a user buys Product A, he can download the pdf and received the code by email, and then that come would be deleted from the stack of codes. My problem is that I don't know how to do that last part about the codes. I've been looking at the add-ons section but I couldn't find anything that seemed to help. Any ideas? Link to comment Share on other sites More sharing options...
bellini13 Posted October 13, 2012 Share Posted October 13, 2012 I think you could create a module that hooks the PDF invoice. So that whenever the invoice is generated, you can insert the key on the bottom of the invoice. The module would have to be smart enough to assign the code the first time, save it with the order details, and display it on the invoice. Then any subsequent attempts to view the invoice, it would recognize the license was already assigned, and just display it. If you are not a developer and need a solution, send me a PM and we can discuss those details. 1 Link to comment Share on other sites More sharing options...
albertalbert Posted October 17, 2012 Author Share Posted October 17, 2012 I think you could create a module that hooks the PDF invoice. So that whenever the invoice is generated, you can insert the key on the bottom of the invoice. The module would have to be smart enough to assign the code the first time, save it with the order details, and display it on the invoice. Then any subsequent attempts to view the invoice, it would recognize the license was already assigned, and just display it. If you are not a developer and need a solution, send me a PM and we can discuss those details. Thank you very much for you reply. I created a module to do this, hooking it to the order confirmation, and it works perfectly. Link to comment Share on other sites More sharing options...
bellini13 Posted October 18, 2012 Share Posted October 18, 2012 great, glad to hear the concept worked for you. If you can edit the original topic subject, and enter SOLVED this way others know there is a valid solution. Liking my response would be nice also Link to comment Share on other sites More sharing options...
albertalbert Posted October 18, 2012 Author Share Posted October 18, 2012 (edited) great, glad to hear the concept worked for you. If you can edit the original topic subject, and enter SOLVED this way others know there is a valid solution. Liking my response would be nice also There you have the like . Also, I can't find the way edit the post topic, how do I do that? I have another question that maybe you could help me with. I'm trying to set a tab in the admin area to show information about this module I implemented. I already have the tab in place, and I made a controller for this (located in the module's folder, in /controllers/admin/), that so far has this code: AdminSendCodeController.php <?php class AdminSendCodeController extends AdminController { public function __construct() { $this->className = 'SendCode'; $this->lang = false; parent::__construct(); } } You can see it's almost empty, but first I want to create some basic stuff to see if it works and then I'll continue from there. The thing is that when I click the tab for this module, the contents are empty by now. I know the controller is working because if I remove it, then I get an error. What I don't know how to do is to actually show the contents I want in that tab. What function/functions do I have to use? With what templates? The front-end part of the module is simple, I know that the "hook" functions will be called when I want, so I start from there and use the template that I want. But with the admin area, I don't know what function I have to start from or where to put the tempalte I want to use for that tab. If you could point me in the right direction that would be awesome! Thanks again! Edited October 18, 2012 by albertalbert (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted October 19, 2012 Share Posted October 19, 2012 I assume you are using v1.5, since I am not familiar with the style of override you are using with that controller. Sorry, but I have not yet educated myself on the ways v1.5 work with back office admin tabs. The v1.4 way, would be to copy the entire admintab class into a module directory, customize it to your liking, and then revise the admintab setting from the back office to point to your module version. Perhaps another community member can guide you on the v1.5 way Link to comment Share on other sites More sharing options...
albertalbert Posted October 19, 2012 Author Share Posted October 19, 2012 I assume you are using v1.5, since I am not familiar with the style of override you are using with that controller. Sorry, but I have not yet educated myself on the ways v1.5 work with back office admin tabs. The v1.4 way, would be to copy the entire admintab class into a module directory, customize it to your liking, and then revise the admintab setting from the back office to point to your module version. Perhaps another community member can guide you on the v1.5 way Well, what I've done is to create a custom template and put it in the admin/themes/default/template folder, and then in the controller, $this->template = custom_template.tlp I know it's not the best way to do it, but until I figure out the correct wau to do this I'll do it this way, at least works. Thank you very much anyways for your help! Link to comment Share on other sites More sharing options...
rolandsblujus Posted July 20, 2015 Share Posted July 20, 2015 Is there any solution to Prestashop 1.6? I am ready to buy a working module. I want to sell PDF files with a unique code. After user have bought that code, i need to manage sold codes (used or not). We are selling products from our partner stores. So we are actually selling Coupon codes, and clients can use this coupon code at our partners store to get ar product. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now