jsgastoniriartecabre Posted October 20, 2022 Share Posted October 20, 2022 hi Is there a module for a 7 days trial? or how could I do that? Link to comment Share on other sites More sharing options...
ComGrafPL Posted October 21, 2022 Share Posted October 21, 2022 7 days trial for what exactly? For store access, products? Link to comment Share on other sites More sharing options...
jsgastoniriartecabre Posted October 21, 2022 Author Share Posted October 21, 2022 6 hours ago, ComGrafPL said: 7 days trial for what exactly? For store access, products? I would like to add a 7 days trial, and an access in my account to an iframe from another page, is this possible? Link to comment Share on other sites More sharing options...
ZiedDams Posted October 21, 2022 Share Posted October 21, 2022 can you explain in more details ? Link to comment Share on other sites More sharing options...
jsgastoniriartecabre Posted October 21, 2022 Author Share Posted October 21, 2022 1 minute ago, ZiedDams said: can you explain in more details ? I've done a 7 days trial (as a product), but need now to add to my-account page an html iframe or a button with a link to another page. is that possible? Link to comment Share on other sites More sharing options...
ZiedDams Posted October 21, 2022 Share Posted October 21, 2022 Just now, jsgastoniriartecabre said: I've done a 7 days trial (as a product), but need now to add to my-account page an html iframe or a button with a link to another page. is that possible? if you want add content to 'my-account' page there are more than a way to do this . but i think the best way is to use a Hook called displayCustomerAccount register the hook in your module $this->registerHook('displayCustomerAccount') and re-install it. then create a function like this public function hookDisplayCustomerAccount() inside this function you can fetch any content to be displayed in the my-account page. , this is how to return a content return $this->context->smarty->fetch( $this->getLocalPath() . 'views/templates/hook/your_file_name.tpl' ); then create the .tpl file under modules/yourmodule/views/templates/hook inside this file you can put HTML,Buttons,Iframes .. or any think you want. and it will be displayed in 'my-account' page. I hope this helps you. 1 Link to comment Share on other sites More sharing options...
jsgastoniriartecabre Posted October 21, 2022 Author Share Posted October 21, 2022 (edited) 29 minutes ago, ZiedDams said: if you want add content to 'my-account' page there are more than a way to do this . but i think the best way is to use a Hook called displayCustomerAccount register the hook in your module $this->registerHook('displayCustomerAccount') and re-install it. then create a function like this public function hookDisplayCustomerAccount() inside this function you can fetch any content to be displayed in the my-account page. , this is how to return a content return $this->context->smarty->fetch( $this->getLocalPath() . 'views/templates/hook/your_file_name.tpl' ); then create the .tpl file under modules/yourmodule/views/templates/hook inside this file you can put HTML,Buttons,Iframes .. or any think you want. and it will be displayed in 'my-account' page. I hope this helps you. awesom! ... my first attempt to php will be difficult. Edited October 21, 2022 by jsgastoniriartecabre (see edit history) Link to comment Share on other sites More sharing options...
ZiedDams Posted October 21, 2022 Share Posted October 21, 2022 it's fine , i got you. Hooks are not components hooks in Prestashop are like places to insert you custom logic or content. you can read more about them here https://devdocs.prestashop-project.org/1.7/modules/concepts/hooks/ first you have to create a custom module i use this site generate a fast one without selecting any hooks there. https://validator.prestashop.com/generator it will give you a zip file and that is a Prestashop Module . all you code and content will be there. why ? because if you directly change in the Prestashop source code your work will be eased and lost if you upgrade to the next ps (prestashop) version. so we use module to add our custom logic,features and new functionalities, in prestashop . -> go to prestashop backoffice in module section -> module catalog page -> upload the module and install it. -> now you must have an access to your ps project folder -> go to modules directory and find your module diractory that we already install it. -> go to the main module php file (your_module_name.php) and open file (Code editor preferred) -> find install function public function install() you will find some hook are registered there, add you hook ('displayCustomerAccount') $this->registerHook('displayCustomerAccount') and reinstall your module from back-office. if you module reinstalled successfully your good to continue . please feel free to ask any think . 1 Link to comment Share on other sites More sharing options...
jsgastoniriartecabre Posted October 21, 2022 Author Share Posted October 21, 2022 (edited) 0k, thank's ... and now, how can I make the products, show this I've done, only when the subscription is active? for example, I have a product trial for 7 days, the iframe or button, should only be active while the trial is active. like a while subscription is activated ; give access to the button I've created. how can I do this? Edited October 21, 2022 by jsgastoniriartecabre (see edit history) Link to comment Share on other sites More sharing options...
ZiedDams Posted October 21, 2022 Share Posted October 21, 2022 3 hours ago, jsgastoniriartecabre said: 0k, thank's ... and now, how can I make the products, show this I've done, only when the subscription is active? for example, I have a product trial for 7 days, the iframe or button, should only be active while the trial is active. like a while subscription is activated ; give access to the button I've created. how can I do this? i did not understand clearly but i think this might help you . So previously we created the Hook function public function hookDisplayCustomerAccount() and inside we just return a content inside a template file (.tpl) like this return $this->context->smarty->fetch( $this->getLocalPath() . 'views/templates/hook/your_file_name.tpl' ); now we gonna add variable to the template file so we can do IF statement before the return.. // i don't know how you did your subsription logic // so im assuming that you will create a function to get is subsription value ( true or false ) $isActive = $this->isSubscriptionAvailable(); // now we assign the varible to the template $this->context->smarty->assign(['is_active' => $isActive]); //and now we return the template return $this->context->smarty->fetch( $this->getLocalPath() . 'views/templates/hook/your_file_name.tpl' ); and now in your template file this is how you do it {if $is_active} {* YOUR Iframe or Button *} {else} {* for ex: DISPLAY THAT is not available *} {/if} 1 Link to comment Share on other sites More sharing options...
jsgastoniriartecabre Posted October 22, 2022 Author Share Posted October 22, 2022 6 hours ago, ZiedDams said: i did not understand clearly but i think this might help you . So previously we created the Hook function public function hookDisplayCustomerAccount() and inside we just return a content inside a template file (.tpl) like this return $this->context->smarty->fetch( $this->getLocalPath() . 'views/templates/hook/your_file_name.tpl' ); now we gonna add variable to the template file so we can do IF statement before the return.. // i don't know how you did your subsription logic // so im assuming that you will create a function to get is subsription value ( true or false ) $isActive = $this->isSubscriptionAvailable(); // now we assign the varible to the template $this->context->smarty->assign(['is_active' => $isActive]); //and now we return the template return $this->context->smarty->fetch( $this->getLocalPath() . 'views/templates/hook/your_file_name.tpl' ); and now in your template file this is how you do it {if $is_active} {* YOUR Iframe or Button *} {else} {* for ex: DISPLAY THAT is not available *} {/if} in the iframe (for example), do I have to inster a complite html page? (head, body ....) Link to comment Share on other sites More sharing options...
jsgastoniriartecabre Posted October 22, 2022 Author Share Posted October 22, 2022 Hi, the function I have to create ... sounds complicated for me to do in my first 24 h of php ... can you help me with this? (please help) For the products I just whent to catalogue -> productos, I created some products -> one of them virtual product (for the password for the iframe) ->and one of them gave 7 days Link to comment Share on other sites More sharing options...
ZiedDams Posted October 24, 2022 Share Posted October 24, 2022 what you mean by " one of them virtual product (for the password for the iframe) ->and one of them gave 7 days " where you add the 7 days ? ? Link to comment Share on other sites More sharing options...
ZiedDams Posted October 24, 2022 Share Posted October 24, 2022 Just now, ZiedDams said: what you mean by " one of them virtual product (for the password for the iframe) ->and one of them gave 7 days " where you add the 7 days ? ? and also what you mean by a virtual product for the iframe password ? I didn't get your point at all. Link to comment Share on other sites More sharing options...
jsgastoniriartecabre Posted October 25, 2022 Author Share Posted October 25, 2022 (edited) On 10/24/2022 at 10:32 AM, ZiedDams said: and also what you mean by a virtual product for the iframe password ? I didn't get your point at all. I just tried to explain how I made my virtual products, it doesn't matter. I need to show a iframe or a web page when accesing to : my-account. And don't know how to create the function (don't whant to try and break the database). Also, sorry ... I would love to pay for your skills ... but just dont have $ and need help to finish this job Edited October 25, 2022 by jsgastoniriartecabre (see edit history) Link to comment Share on other sites More sharing options...
jsgastoniriartecabre Posted October 26, 2022 Author Share Posted October 26, 2022 On 10/24/2022 at 10:32 AM, ZiedDams said: and also what you mean by a virtual product for the iframe password ? I didn't get your point at all. hi, I think I havent explained correctly .... dont know much more about functions than this: public function __subscription() { } ***please help with the subscription. This is what I did to add subscriptions to the products 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