Display a form in prestashop - prestashop

I would like to show a form in prestashop module and would like to store that value in database. How is it possible?? Is there any prestashop expert ??

You may use custom HTML block and add your form code inside that. And off course have to use a hook to show up that HTML block in the site.
There are lots of free Custom HTML block modules available.

You should take a look at all the modules available in the modules/ directory.
If you want to display a form in the back and/or the front office, you'll have to override different methods of the Module class, and you'll have to use the different hooks available..
Best regards,

Try this free module :
https://www.prestashop.com/forums/topic/391966-megablock-16-module-gratuit/
With this one you can add HTML in some hooks from back-office.
Everything is stored in database.
You should use Helpers and Tools class (Helpers show forms and Tools::getValues() does what it says...)
In MegaBlock there is also TinyMCE available. Have a look, this module is really useful ;-)

you can develop a module by using hooks based on the hooks used the form will be displayed in that position in prestashop while using hooks you need to assign a tpl file in that tpl file you can write the codings to display a form
And also you can develop a module with a separate controller and you can assign a tpl for that controller.

Related

Prestashop module development: How can we save data from product page?

I'm here for help from those who have real experience in Prestashop module development.
I got stucked while saving data from the product page where I've created the field through the module via hookDisplayAdminProductsExtra.
And I didn't get an idea to save new field data from the admin product page.
So, please help if anyone has a solution for this.
Thank You.
Add a form in your hook returned TPL,
so that you can retrieve and save your custom data in DB by registering and triggering "actionProductUpdate" in the module (this hook is called when a product is saved) by using Tools::getValue() inside the hook on your POST data.
Other solution would be to save data in AJAX with a dedicated AdminController - You can insert a custom button in your TPL + an additional JS file (you can include it with hookBackofficeHeader) to trigger the AJAX call.
You can see more about AdminController in official devdocs.

How add custom handlebars helper in Stencil

The documentation indicates you can add a custom Handlebars Helper
https://developer.bigcommerce.com/stencil-docs/handlebars-syntax-and-helpers/handlebars-overview#handlebars_custom
That conflicts with the code https://github.com/bigcommerce/paper-handlebars/blob/master/index.js#L69 that only loads helpers from the paper-handlebars module.
Is it even possible to define a custom Handlebars Helper, or should the documentation be updated?
Looks like we need to tighten up the phrasing in the documentation to make that a little more clear (we've put a ticket in with the docs team). Thanks for the heads up.
It is true that you can add a custom Handlebars helper, but the caveat is that it has to be brought into the paper-handlebars module, where it would be available as part of Stencil. The process to add a new custom helper would be to submit a pull request to this repo:
https://github.com/bigcommerce/paper
Ideally, new helpers that we add to Stencil should be generic enough to apply to a lot of use cases.
Alternatively, we also pull in helpers from this library and whitelist certain helpers for Stencil:
https://github.com/helpers/handlebars-helpers
If you're working on a Helper that you think would benefit the wider Handlebars community, you can submit it to the handlebars-helpers repo and ask us to whitelist it in Stencil.

How to change meta title in prestashop module?

I'm using prestashop 1.6 and one module is not editable in SEO&URL, to change is meta.
Actually, i have the default pretashop meta title.
How can i add a custom header.tpl for this module ?
Thank you for your help
Tony
Assuming you are talking about a module with a controller,
you can add in the base file /modules/mymodule/mymodule.php,
inside the method __construct(),
a object like this $this->controllers = array('controller_file_name');, where the controller_file_name is the file which generate the page in the front office.
Once made this, you will need to re-install the module and this added object will generate a new page in the SEO&URL where you could change all the metas (title, description and keywords).
You can see some examples of this modules in the bankwire, cheque and blocknewsletter.

how to add autocomplete function to a column in oracle apex tabular form report

i want to add an autocomplete function to work in one of my column suppose name.It is easy to do using items.but how can i do it in the report.
Since a report doesn't contain Apex items, you can't do this with the built in features. Ignoring any possible plugins that may already be available, you can do this with jQuery UI, specifically the Autocomplete widget. Apex already includes some of the jQuery UI suite, but you may need to download the Autocomplete widget from the jQuery website.
This will need some custom work on your end. This really isn't that hard if you know how to use jQuery.
Download the jQuery UI Autocomplete widget and include it on your page. You can put just the .js file for that in your Application Shared Items. I have the whole jQuery UI library in a separate place on the webserver because I use different parts for different projects.
Source in that widget in the page properties.
You'll need to create text items with apex_item.text in your report.
You'll need an On Page Load dynamic action to attach the Autocomplete widget to your text items.
For the autocomplete source, if it's short, you can just use a Javascript variable that you put on the Apex page. If it's longer or you need to find the list at run time, you can use a function that calls apex.server.process.
If your report has Partial Page Refresh turned on, make sure the DA in step 4 has Dynamic scope, not Static.

How can I display Joomla modules within a component?

I have a component with several categories of games and I want to display a different banner depending on the category. I need the banner (and link) to be customizable so it's not simply a case of showing categoryX.jpg or whatever.
I saw this Joomla help page on another question, but it only seems to display a module type, not one specific module. I'd like to use various mod_custom modules and display the one appropriate to the category (I can store each module's ID if necessary).
Any ideas?
This can be done in a 2 step process:
Use the "Load module into article" plugin to allow yourself to access the module using a plugin call like:
{module [*mod_id*]} // where *mod_id* is the module id
Now that you can call a plugin to put your module anywhere, you now need to go to the view code of your/a component you wish to add the module to and add this code:
echo JHTML::_('content.prepare', '{module [*mod_id*]}');
Please see this link - http://www.alltogetherasawhole.org/group/developers/forum/topics/running-joomla-content-plugins - regarding point number 2. I was trying to do the same thing and I found it didn't work, and the reason for this was a comment you can find on the page link above:
"I noticed that some plugin actually expect option=com_content for them to process onPrepareContent properly, so you might actually want to "fool" them by callin JRequet::setVar and restoring the correct values after the trigger."
If you would like to show module within PHP code then use this code, it's worked for me :
<?php echo JHTML::_('content.prepare', '{loadposition position-2}'); ?>
If you want to show module inside html content then just put this code where you want to show module.
{loadposition position-2}
It loads all modules which are assigned to position-2.
You can also use the Joomla Module Renderer
$doc = JFactory::getDocument();
$renderer = $doc->loadRenderer('modules');
$position = 'custom_position_name';
$options = array('style' => 'raw');
echo $renderer->render($position, $options, null);
Just a heads up, Along with being assigned the module position, that module also has to be set to "Display on All pages".
Joomla has this functionality built in. You can use the {loadposition XX} command within your content items. You can specify custom module positions that do not appear in your template to insure that you have the correct module in the correct article.
http://docs.joomla.org/How_do_you_put_a_module_inside_an_article%3F
You could create a new module?
If each category appears in the querystring (catid=X) then you could take a similar approach to https://support.pillwax.com/open-source/doku.php?id=joomla:header_image.
Alternatively, that link might actually do it for you.