An Adobe Commerce Developer wishes to add an action to a pre-existing route, but does not wish to interfere with the functionality of the actions from the original route.
What must the developer do to ensure that their action works without any side effects in the original module?
Correct Answer:
C
In Magento 2, to add a new action to a pre-existing route without interfering with the existing functionality, the new action should be placed in the same directory structure under the new module??s controller namespace. Magento's autoloading mechanism will automatically detect and include it alongside the original module's actions. Here's how you can achieve this:
✑ Directory Structure: Ensure that your new module's controller directory structure
mirrors that of the original module.
✑ Controller Action: Define the new action within the appropriate directory.
For example, if you want to add a new action to thecatalogroute inMagento_Catalog:
✑ Create a directory structureapp/code/My/Module/Controller/Catalog/.
✑ Add your new action class in this directory, for example: namespace My\Module\Controller\Catalog;
use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context;
class NewAction extends Action
{
public function construct(Context $context)
{
parent:: construct($context);
}
public function execute()
{
// Your custom logic here
}
}
Router Configuration: Magento automatically includes this action when the route matches. By following this method, you ensure that your new action is added seamlessly without modifying the original module or causing conflicts. Magento's router will include and recognize your action based on the directory and namespace conventions.
Sources:
✑ Fundamentals of Magento 2 Development documents .
✑ Magento 2 official developer documentation.
How can a custom CMS Page be set as a store home page?
Correct Answer:
C
To set a custom CMS Page as a store home page, the developer or merchant should follow these steps:
✑ In the Admin panel, go to Content > Pages and create or edit a CMS Page that will
be used as a home page.
✑ In the Admin panel, go to Stores > Configuration > General > Web > Default Pages.
✑ In the CMS Home Page field, select the CMS Page that was created or edited in step 1.
✑ Save the configuration.
There is no ??Home Page?? column in the CMS Page admin grid or ??Default Home Page?? value in the CMS Page admin form.
Verified References: [Adobe Commerce User Guide - Set up your home page]
In Adobe Commerce, to set a custom CMS page as the store's homepage, you need to go to the store configuration. Specifically, navigate to Content > Design > Configuration, select the relevant store view, and then under the "Default Pages" tab, set the "CMS Home Page"
option to your custom CMS page. Options A and B do not exist in the Adobe Commerce admin panel for setting a home page.
What database engine is part of the infrastructure of Adobe Commerce Cloud projects?
Correct Answer:
B
The database engine that is part of the infrastructure of Adobe Commerce Cloud projects is MariaDB. MariaDB is a fork of MySQL that offers improved performance, scalability, and security features.
The database engine that is part of the infrastructure of Adobe Commerce Cloud projects is MariaDB. Adobe Commerce Cloud is configured to use MariaDB, which is a binary drop-in replacement for MySQL and is chosen for its performance, reliability, and feature set.
What is one way a developer can upgrade the ECE-Tools package on an Adobe Commerce Cloud project?
Correct Answer:
C
According to the Adobe Commerce Developer Documentation, one way a developer can upgrade the ECE-Tools package on an Adobe Commerce Cloud project is by using Composer, which is a dependency management tool for PHP projects. The ECE- Tools package contains scripts and tools that help manage and deploy Adobe Commerce Cloud projects on the cloud infrastructure. To upgrade the ECE-Tools package using Composer, the developer needs to run the following command in the project root directory: composer update magento/ece-tools --with-dependencies
On an Adobe Commerce Cloud project, the recommended way to upgrade the ECE-Tools package is through Composer, a dependency manager for PHP. Composer is used to manage the dependencies of the project, including ECE-Tools, and it provides the necessary commands to update packages to their latest versions or to specific versions as required.
Which characteristic is associated with a persistent cart?
Correct Answer:
C
A persistent cart is a cookie that is stored on the customer's computer. This cookie allows the customer to continue shopping even if they close their browser. If the customer is logged in, the persistent cookie will remain active even if the session cookie expires.
Associated with a persistent cart in Adobe Commerce is the characteristic that while the customer is logged in, if the session cookie expires, the persistent cookie will remain active. This ensures that the customer's shopping cart is preserved even if they have been inactive and the session has expired. The persistent cookie allows the cart to be restored when the customer returns to the store.