Overriding or Extending Functionalities
In order to extend Nosto, we can create a new Magento 2 module that will override the
Creating an override requires a few files to be created. Follow the guide below and simply copy-paste the content into the specified locations. This will form the scaffold of your new override.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Module/etc/module.xsd">
<module name="My_Nosto" setup_version="1.0.0" />
"description": "Custom extension for altering product data",
"files": [ "registration.php" ]
You now should have this directory structure:
│ └── My
│ └── Nosto
│ ├── composer.json
│ ├── etc
│ │ └── module.xml
│ ├── registration.php
Before the module begins to work, you will need to explicitly enable the module by running a series of commands.
bin/magento module:enable --clear-static-content My_Nosto
In order to disable the module without removing the code, you will need to run a series of commands.
bin/magento module:disable --clear-static-content My_Nosto
The changes you make will be taken into use instantly both in the shop.
Once you have overridden the associated model and customised whatever fields you may need, you should verify that it, in fact, working as expected.
A simple way to verify that the changes are working would be to log in as a customer and view any page with the Nosto debug-mode enabled. The debug mode can be enabled by adding the query parameter
nostodebug=trueto the end of any URL. This will cause a helpful debug toolbar to appear where you can view the tagged data on the page. For more information on the debug-toolbar, please refer to this guide titled Nosto Debug Toolbar in our Support Center.
NOTE: Please note that in order to verify the changes using the debug-toolbar, you must have a Nosto account for the given store.
Before using your custom module in production environment we strongly recommend that you follow the instructions how to package a Magento 2 module. If you are familiar with creating packages for composer, creating a package for M2 is a no-brainer. You can find the instructions from here