Hook not visible and modules issue - prestashop

Goodmorning everyone. I'm going crazy behind a very simple new hook.
I just wanted to add the share buttons in the blog articles, I added the hook in theme.yml as shown in the image, I reset the theme and the module but nothing to do, I don't see the hook if I try to insert the module.
Moreover from this insertion onwards I am no longer able to reset or uninstall the module, it returns me the error you see in the image. What am I doing wrong?
img01
img02

Check if your hook exists in the ps_hooks tables if not add it there.

You need to register it in the ps_hooks database,maybe the ideal can be to create a module, and in the installation register the hook and assign a template that shows what you need in the hook.
Prestashop documentation

Related

Refresh button in React-admin

I'm trying to access the refresh button in react-admin project. I tried using getElementsbyClassName it returns HTMLComponents Object but it isn't accessible i.e I can see the component on printing it to console but isn't accessible by code. Is there a way for me to disable this refresh button wherever I want?
I'm not sure the exact use case here, but you can create your own custom AppBar that renders essentially whatever you want: https://marmelab.com/react-admin/Theming.html#replacing-the-appbar.
also see this GitHub issue that mentions removing it entirely: https://github.com/marmelab/react-admin/issues/3383
Within your custom AppBar you could have some logic checks within your custom AppBar if you know ahead of time when you'll want it disabled (like on a certain page/component).
If you need it to be more dyanimcally disabled, you could probably have a very high-level context/state to control that as well..
**NOTE: I have built a custom AppBar before, but I haven't done any selective rendering or disabling within it. So, I can't guarantee that this is exactly correct, but it fits with other custom components I've built.

The new <SaveContextProvider>, deprecated-message of React-Admin

I have this message in the Chrome console since I updated react-admin to version 3.10.0, I tried to dig into the document but can't find any information or example. Anyone encounter this, or luckily any members of react-admin seeing this, please help!
Edit or Create child components must be used inside a <SaveContextProvider>. Relying on props rather than context to get persistence related data and callbacks is deprecated and won't be supported in the next major version of react-admin.
I have a form component, using <SimpleForm>, that is used in <Edit> and <Create> components. There is no warnings when app is running.
But I have the same issue when unit tests are running on the form component. I tried to wrap it inside a <SaveContextProvider> without success... if someone have solution ! đź‘‹
So if you encounter the issue during runtime you should verify that your form component is well wrapped as mentioned in the warning.

VueJs - Call an event when scrollbar of inner div reach its bottom position of page

Currently i am working in a project which is already developed in v-DataTable of vuejs which is all new to me. In this project, i need to call an event when the scrollbar reach its bottom.
Any API can also be used.
Please help me out.
If project is built with Vuetify (guessing because you've mentioned v-data-table) - take a look at https://vuetifyjs.com/en/directives/intersect/
Otherwise you can check out Interesection Observer API or third party libraries like Tornis

Custom Hooks in Prestashop 1.7

I try to create a custom Hook for Prestashop 1.7.0.3 for the slider module. I insert:
displaySlider:
- ps_imageslider
on theme.yml file on block “hooks”.
Then insert:
{if $page.page_name == 'index'}
{hook h='displaySlider'}
{/if}
on theme/templates/layouts/layout-both-columns.tpl file between header and section id=”wrapper” tags. According to this article: Custom Hooks in Prestashop 1.7 everything will work ok but the hook is not shown on available hooks when i try to change slider module position from the backend.
I was working today on the same issue.
And i succeed to make it appear, it is probably not the good way and i hope it is not the good way because it is weird.
In your theme.yml you have to set your hook like this :
global_settings:
hooks:
custom_hooks:
- name: displayFooterBefore
title: displayFooterBefore
description: Add a widget area above the footer
And if you wanna see your hook in the position page, you have to switch to a other template and back to your one. (Kind of refresh)
You can also check the incomplete doc from Prestashop :
http://developers.prestashop.com/themes/hooks/index.html
I hope there is a another way to refresh hooks in this page...
So just to be clear. To add a new hook in Prestashop.
In \themes\yourTheme\config\theme.yml you add
custom_hooks:
- name: displayYourCustomHook
- title: displayYourCustomHook
- description: This is a Custom hook
In the same file, in the section modules_to_hook:
displayYourCustomHook:
- ps_moduleIwantoHook
- ps_anotherModuleIwantToHook
Wherever in your .tpl files you want to add your hook:
...
{hook h='displayYourCustomHook'}
...
Finally, from you backoffice, you change from your current theme to a differente one, and then save. After that, you change to the previous theme (the theme you actually want to use), save again and your hook should be visible. This is done with the aim of "refreshing" the hooks that your Prestashop site recognasizes.
This is working in Prestashop 1.7.7
I spent a lot of time looking for why my custom hook did not appear on the front, thanks for the tip.
In order to improve the process, you can use the reset button in appearance > themes & logo.
This avoids having to activate another theme.
I see I voted myself for the accepted solution 2 years ago, but now came up with a much better solution.
According to Prestashop 1.7 hooks doc all you have to do is to register your hook as any other normal and it will be automatically created. So paste something like:
$this->registerHook('displayAtSpecificPlace');
in your module install() and reinstall the module.

Joomla question about custom module

I'm very new to Joomla. I have a question about components/modules.
I'm doing the development of a site for a firm and they provided me with custom news releases component that's supposed to show on the home page. From what I've seen, I can call modules to a page with "" based on their position.
Do I do the same sort of thing to get this component to display? Can anyone help me out please. Let me know if I'm not being clear.
EDIT: I figured out that I have to add this as a menu item, but this makes it into it's own page. I want this just as a module on the right of the home page. What do I need to do to achieve this?
Thank you
if this is a component than you won't be able to display it in a module position. You will have to write a new module to do that or use some modules which wrap around other types of content. See here, maybe this plugin will fit.
If this is a component you can also use the Component Loader extension to load the component output in a module position.
http://extensions.joomla.org/extensions/core-enhancements/embed-a-include/10721