PS 1.7 ps_linklist and custom hook - prestashop

I created a custom hook on PS 1.7. I also created a link list in the ps_linklist addon but I can't find the hook I created in the list. Can anyone help me?
I don't understand the logic with which hooks are displayed in the drop down menu

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.

Prestashop 1.7 disable cart poup

I am using prestashop 1.7 and want to disable the popup and instead call a custom javascript function that toggles my shopping cart visible.
I found various instructions, however I don't have a file called ps_shoppingcart.js. The only one I have is the ps_shoppinccart.tpl which contains the HTML template.
Can someone help me to find where I can do the toggle?
If you take a look at the code of the master file of the module (ps_shoppingcart.php), you will see in the hookHeader() that the ps_shoppingcart.js is skipped when the option "Ajax cart" is turned off, so, you can remove these validation to keep the JS file loaded and in the file every time and now you can add your custom code, the code which show the popup is this:
if (resp.modal) {
showModal(resp.modal);
}
Hope this help you!

Prestashop missing hooks listed in the doc

I use "Prestashop 1.7.2.3".
If I look in the doc of Prestashop 1.7 in the hook section.
It lists those hooks:
'displayCheckoutSubtotalDetails' and 'displayCheckoutSummaryTop'.
Now if I do a search for "Hook::exec('displayCheckout" in [Prestashop project]/classes or [Prestashop project]/controllers, it does not find '"Hook::exec('displayCheckoutSubtotalDetails')" and "Hook::exec('displayCheckoutSummaryTop')".
I am confused, why are those hooks listed if they don't exist?
Actually it's executed by the theme itself and not in PHP as indicated in the table.
For example native modules/ps_legalcompliance/ps_legalcompliance.php executes hookDisplayCheckoutSummaryTop($param).

i am adding custom html free version in my prestashop 1.7

I have added one module custom html box in PrestaShop 1.7 . Module is installed but you can use it only once .can i create multiple list of htmlbox?
This depend on the module, but if you are using htmlbox module, yes, the free version is programmed to only be used 1 time in 1 place.
But there are two options to do this without any developed module.
1st option:
You have the option to include these html code directly in the tpl of the activated theme.
In prestashop 1.7 version we have a new feature that, if you are in mode developer ("Advanced parameter" -> "Performance"), in the html you can see in what template is located any element.
For example, to add a code above the slider of the home page, if you inspect the element you can see this:
In the "begin" tag you have the template that you need to modify.
2nd option:
You can create a new module and use the display hooks correctly.
Here you have all that you need to know about the creation of modules.
http://developers.prestashop.com/module/05-CreatingAPrestaShop17Module/

Display a form in 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.