Child pages
  • Posiciones de los módulos en el Front-Office

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

La página "Posiciones de los módulos" le muestra todos los hooks disponibles, así como los módulos correspondientes que están conectados a ellos. Muchos están vacíos por defecto, pero la mayoría utilizan  fácilmente una docena de módulos (el hook displayHeader, perteneciente a la cabecera de la tienda, tiene 33 módulos de forma predeterminada).

At the top of the page, a drop-down menu enables you to only display the hook in which you are interested.
By default, this page only displays the hooks on which you can position functions. Checking the "Display non-positionable hooks" box below displays all the hooks, even those where you cannot position something.

The header of the table for each hook displays the hook's name, its technical name (and for some, a quick description), and its number of attached modules. The table lists the modules that are attached to that hook.

The modules are displayed in the order in which they appear in the hook.

Moving a module within a hook

You have two ways of changing a module's position within a hook:

  • Click the up or down arrow. The page will reload and display the new order.
  • Drag and drop the module's row itself:
    1. Place the mouse cursor on the position number to have it change into a "move item" cursor.
    2. Click and hold while moving the cursor over the row/position where you want the module to be: the module's row changes position accordingly.
    3. Release the mouse button: the current position for the module is saved.

For most modules, transplantation can easily be done directly via the back-office. Some modules require you to alter their code in order to transplant them.

Attaching a module to a hook: Transplanting

In PrestaShop, "transplanting" is the action of attaching a module to a hook. You can add a module to more than one hook.

Two things to know before transplanting a module:

  • Some modules are written to only be attached to a given set of hooks.
  • Some hooks are written to not accept some specific kinds of modules.

Therefore, be aware that you cannot always transplant any module to any hook.

Info

Make sure to disable the cache when testing the effect of a new module on the front-end. You can do this in the "Preferences" page, under the "Advanced parameters" menu.

The transplanting process has its own interface:

  1. Go to the "Modules" menu, and its "Positions" page.
  2. Click the "Transplant a module" button at the top right. The transplanting interface appears.
  3. In the "Module" drop-down list, select the module you want to transplant.
  4. In the "Hook into" drop-down list, select where you want to transplant the module to. There are many available hooks. You can change your setting later if needed.
  5. In the "Exceptions" field, type the name of the file(s) of the pages in which you do not want the module to appear.
    You can perform a multiple selection simply by clicking on the file names while keeping the Ctrl key pressed. You can deselect files in the same manner: Ctrl+click.
  6. Do not forget to save your changes.

Image Removed

The "Hook into" drop-down menu gives you a good idea where module can be placedEn la parte superior de la página, un menú desplegable le permite mostrar sólo el hook en el que esté interesado.
De forma predeterminada, la lista sólo muestra los hooks en los cuales puede posicionar módulos. Al marcar la casilla "Mostrar hooks invisibles" se mostrarán todos los hooks, incluso aquellos en donde no puede colocar nada.

La cabecera de la tabla para cada hook muestra el nombre del hook, su nombre técnico (para algunos de ellos, una rápida descripción), y su número de módulos conectados. La tabla muestra los módulos que están conectados a ese hook.

Los módulos son mostrados en el orden en el que aparecen en el hook.

Mover un módulo dentro de un hook

Tienes dos maneras de cambiar la posición de un módulo dentro de un hook:

  • Haciendo clic en las flechas arriba o abajo. La página se actualizará y mostrará el nuevo orden.
  • Arrastrando y soltando el módulo a la posición deseada:
    1. Coloque el cursor del ratón entre las flechas de movimiento y el nombre del módulo para que este cambie a un cursor de "movimiento de elementos". Lo reconocerá porque el cursor se convierte en una cruz.
    2. Haga clic con el botón derecho del ratón y manténgalo presionado, mientras mueve el cursor del ratón a la fila / posición deseada: el módulo pasará a ocupar la fila / posición correspondiente.
    3. Suelte el botón derecho del ratón: para guardar la nueva posición del módulo.

Para la mayoría de los módulos, el trasplante se puede hacer fácilmente a través del back-office. Algunos módulos requieren una modificación en su código para poder trasplantarlos.

Insertar un módulo en un hook: Trasplantar

En PrestaShop, "trasplantar" es la acción de insertar un módulo en un hook. Puede añadir un módulo a más de un hook.

Hay dos cosas que debe conocer antes de trasplantar un módulo:

  • Algunos módulos están escritos para sólo poder conectarlos a un conjunto de hooks específicos.
  • Algunos hooks han sido desarrollados para no aceptar ciertos tipos de módulos.

Por lo tanto, sea consciente de que no siempre puede trasplantar cualquier módulo a cualquier hook.

Info

Asegúrese de desactivar la caché cuando añada un nuevo módulo a un hook, o lo cambie de posición , ya que no podrá ver el cambio producido en el front-office. Puede hacer esto en la página "Rendimiento", bajo el menú "Parámetros avanzados".

El proceso de trasplante tiene su propia interfaz:

  1. Diríjase a la página "Posiciones de los módulos", disponible en el menú "Módulos".
  2. Haga clic en el botón "Insertar un hook" situado en la parte superior derecha. La interfaz de trasplante de módulos, aparecerá en pantalla.
  3. En la lista desplegable "Módulo", seleccione el módulo que desea trasplantar.
  4. En la lista desplegable "Insertar hook en", seleccione el lugar donde quiere trasplantar el módulo. Hay muchos hooks disponibles. Puede cambiar su decisión más tarde si es necesario.
  5. En el campo "Excepciones", escriba el nombre del archivo(s) correspondiente(s) a las páginas en las que no desea que el módulo aparezca.
    Puede realizar una selección múltiple, haciendo clic en los nombres de archivo mientras mantiene pulsada la tecla Ctrl. Puede anular la selección de los archivos de la misma manera: Ctrl + clic.
  6. No olvide guardar sus cambios.

Image Added

El menú desplegable "Insertar hook en" le ofrece información sobre dónde puede colocar el módulo.

Even though the "Hook into" drop-down list gives a comprehensive overview of the available hooks, it might not always be clear which is the one to which you want to attach your module. Do not hesitate to try another hook if the result of your selection if not what you expect.
The list gives some detail: some hook have a description after the hook's name, for instance "Add fields to the form 'attribute value'" for displayAttributeForm. Peruse them all in order to choose your hook correctly.

...