SOFT
SPRINT

softsprint.net
Shop

PrestaShop configuration and Apache Settings

As a matter of course, PrestaShop is designed to give a protected and stable climate to both the shop director and the clients.

As a designer, there are a few changes that you could and ought to bring to the default establishment to help you code better, spot bugs quicker, and for the most part make an extraordinary PrestaShop item.

Crippling the store and driving Smarty compilation

At the point when your improvement affects the front office, regardless of whether you are building a subject or just a module which shows data to the client, you should drive the layout record gathering and incapacitate the store, in order to consistently see the consequence of your progressions straightforwardly.

Go to the “Execution” page under the “Progressed boundaries” menu to change the accompanying Smarty settings:

  • Layout store: change it to “Power aggregation”
  • Store: debilitate it

Constraining the assemblage of Smarty will in every case hinder the stacking season of the page. Ensure that your creation store is set to just recompile formats if there are refreshed records, and that its reserve is empowered.

Showing messages of errors

PrestaShop‘s default settings forestall the client to perceive any worker mistake message or any troubleshooting code.

You, then again, need this data to address any expected misstep in your code. With that in mind, open the /config/defines.inc.php document, and alter it to set _PS_MODE_DEV_ to true:

<?php
/* Debug only */
define('_PS_MODE_DEV_', true);

You can likewise empower engineer mode straightforwardly from your back-office, go to the “Execution” page under the “Progressed boundaries” menu and change the accompanying setting: “Debug mode” to “Yes”. Remember to handicap designer mode when you’ve done investigating your code.

Utilizing the dump() function work

PrestaShop used to have custom investigate capacities accessible for engineers: p($variable) and d($variable). They were utilized to show the substance of a variable, and were actually a covering around the notable print_r() technique. What’s more, PrestaShop had the ppp() and ddd() capacities, which were individually the false names of p() and d(); and the different fd(), epr() and dieObject() capacities.

The entirety of this has changed with PrestaShop 1.7: we presently depend exclusively on Symfony VarDumper’s dump() work: https://symfony.com/doc/current/components/var_dumper.html#the-dump-function. You would now be able to depend on a solitary capacity as opposed to having various investigate capacities. The landfill() work is exceptionally incredible, and is consistently accessible on yield (even without die()). In addition, you can utilize it in your reassure contents since this capacity additionally has a formatter in CLI mode.

The dump() work isn’t actuated naturally. To initiate it, you should empower the Debug mode, by setting _PS_MODE_DEV_ to true (see above).

Empowering the multistore mode

Since variant 1.5, PrestaShop can have more than one store inside a solitary establishment of the product. Many shop chairmen decide to empower this element, and it can altogether affect the manner in which PrestaShop works. You ought to in this way ensure that anything you code for PrestaShop works in both single and multistore mode.

Empowering the multistore mode is simple: go to the overall inclinations page, and put the “Empower Multistore” choice to “Yes”.

You can switch to and fro between single store and multistore mode. In single store mode, just the fundamental store is utilized.

You can peruse more about the multistore mode in PrestaShop 1.7 User Guide: https://doc.prestashop.com/display/PS17/Managing+Multiple+Shops

About the configuration file records

There are four fundamental design documents, three situated in the /config organizer:

  • config.inc.php
  • defines.inc.php
  • smarty.config.inc.php

and one located in the /app/config folder items:

  • parameters.php

config.inc.php

It is the fundamental design record for PrestaShop. You ought not need to contact anything in there.

defines.inc.php

This record contains PrestaShop steady qualities.

It likewise contains the area of the multitude of records and envelopes. In the event that you need to change their area, remember to keep the first way close by, for example in a PHP remark, in the event that you need to return to it later on.

When being developed/test mode, you should ensure that all the mistake messages are shown:

  • Set define(‘_PS_MODE_DEV_’, false); to true meaning.

Actually, when underway mode, you should shroud blunder messages however much as could reasonably be expected!

  • Ensure define(‘_PS_MODE_DEV_’, false); to false meaning.

You can abrogate consistent qualities from this record by setting them in /config/defines_custom.inc.php. This is likewise an extraordinary spot to put your custom constants which should be accessible all around the world in the framework.

smarty.config.inc.php

This document contains all the Smarty-related settings.

The Smarty reserve framework ought to consistently be impaired, as it isn’t viable with PrestaShop: keep $smarty->caching = false; for what it’s worth.

$smarty->compile_check ought to be left to false being developed mode.

$smarty->debugging offers admittance to Smarty investigate data while showing a page. That setting is all the more handily changed in the “Execution” page of the high level boundaries menu : the “Troubleshoot reassure” choice empowers you to pick between never showing Smarty’s investigate data, continually showing it, or possibly showing it when you add ?SMARTY_DEBUG to the URL of the page you need to test, which can be extremely helpful.

When underway mode, $smarty->force_compile should be set to false, as it will give a 30% lift to your page load time.

Then again, when altering a .tpl document, you should erase the /var/cache/(dev|prod)/smarty/compile envelope (with the exception of the index.php record) to see your progressions applied or clear reserve straightforwardly from Back-Office.

Note that this setting can be made straightforwardly from the back office, in the “Execution” page under the “Progressed boundaries” menu.

parameters.php

This document contains some of significant settings, for example, information base association subtleties and reserving instrument. In the event that you change something in this record, try to erase reserve documents physically from /var/store/(dev|prod) envelope.

Handicap the Back-Office token insurance

Back-Office pages require the utilization of a token. If necessary, this assurance can be incapacitated utilizing a climate variable:

Apache with mod_headers

SetEnv _TOKEN_ disabled

Nginx with ngx_http_headers_module

add_header _TOKEN_ disabled;
CONTACT US
Cookies | Privacy Policy | Terms and ConditionsSoftSprint ©