Prestashop Modules (Part II)

Prestashop Modules (Part II)

In this article we continue exploring Prestashop modules. You’ll find out more about the Module class, the most demanded modules and conflicts between extensions.

1.1   The Module class

Almost all modules are inherited from the class Module. These are the hooks which are called in a class:

  • Hook::exec(‘actionModuleInstallBefore’, array(‘object’ => $this)); //is called before installing a module
  • Hook::exec(‘actionModuleInstallAfter’, array(‘object’ => $this));  //is called after installing a module
  • Hook::exec(‘displayPayment’); //this hook is designed for payment modules.

 

1.2   The main modules

Let’s take a look at some of Prestаshоp modules. We will not describe them in details, since there are over 100 of them and with each new Prestashop version this number may change.

1modules2

Bank Wire -the module which allows your customers to pay by bank transfer.

2modules2

CMS Block – displays a block with articles.  An administrator can create blocks himself and then select the location either in the left-hand or right-hand hooks.

3modules2

This is one of the most important modules that can be considered as a hallmark of Prestаshоp. It uses the hooks Top and Header. The constant PS_BLOCK_CART_AJAX is responsible for its usage. The function of the class cart- >getPrоduсts( ); is responsible for getting products into the shopping cart.

4modules2

This module is used to pay a courier. It uses the following hooks: payment, paymentReturn

5modules2

This one uses the hooks: leftColumn, footer, header

6modules2

7modules2

The module which displays the block with a choice of currency.

8modules2

This module is provided for free, but since the version 2.1.1 it is a paid option.

9modules2

10modules2

This module allows you to add content on your homepage.

11modules2

This one adds a slider on your homepage.

12modules2

13modules2

This module displays a block with a language selection on the front-end.

14modules2

15modules2

This module outputs the block which allows users to quickly filter out products in a category.

16modules2

This allows users to leave comments to products. A website administrator can set the product evaluation criteria, enable or disable comment moderation.

$categoryProducts = $category->getProducts($this->context->language->id, 1, 100); /* 100 products max. * / – the place in the module code, which gets products from a category.

17modules2

Displays goods from the main category, to which a product is assigned, on a product page.

18modules2

The module allows you to search for items in a catalog. In the default theme it is displayed at the top of the page. It can either search for pages using аjаx or show the so-called instant search results (read our article on how Prestashop search works here).

19modules2

20modules2

The block with a horizontal menu.

21modules2

This module will help protect your unique products images from being copied. It adds a “watermark” with your store’s logo on all images.

22modules2

The block with a wishlist. It is a useful module, which for some reason is disabled by default. In general, many modules are turned off by default after the installation.

 

1.3  Conflicts between modules

Conflicts between modules are not a rare thing. Our support team is constantly customizing our modules with modules of other companies as we frequently deal with the stores which already have certain methods rewritten. The most common issue is the inability to install a module, interrupted by the error message “The method Boo in the class Foo is already overriden”. This means that your system already has a method rewritten, which has been changed in our module too. Here we have described in details the function addOverride which returns this error.

Another common problem is that modules are not compatible with the standard module layered navigation block. Sometimes you need to re-initialize the modules that use fаnсybоx or other js-libraries.



1 comment

  1. Hello,

    Have you had the oportunity to test the hook actionModuleInstallBefore , actionModuleInstallAfter

    I guess not or you would you hook these are unusable

Post a new comment

top
BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *