Skip to content

Instantly share code, notes, and snippets.

@isaactzab
Last active January 18, 2023 22:49
Show Gist options
  • Save isaactzab/b19e742db6e04185b4f6984594b17925 to your computer and use it in GitHub Desktop.
Save isaactzab/b19e742db6e04185b4f6984594b17925 to your computer and use it in GitHub Desktop.
Prestashop tips and tricks

Optimizations and enhancements for prestashop 1.6

Sometimes, prestashop turns very slow due to ads, and module recomendations. Here are some modifications to version 1.6 removing these things and speed up the admin panels. Enjoy and share your tricks about how optimize prestashop.

Modify Tools class

[https://github.com/PrestaShop/PrestaShop/blob/1.6.1.x/classes/Tools.php#L3351-L3356] Find the file /public/classes/Tools.php and modify as next:

public static function addonsRequest($request, $params = array())
	{
		return false; /*<==== ADD THIS LINE */
		if (!self::$is_addons_up)
			return false;

		$postData = http_build_query(...

Remove xml files

Go to ./public/config/xml/ and remove or rename the files:\

  • must_have_modules_list.xml
  • default_country_modules_list.xml Don't touch trusted modules or native addons files.

Disable addons AJAX Request

[https://github.com/PrestaShop/PrestaShop/blob/develop/controllers/admin/AdminThemesController.php#L201-L211] Go to file ./public/controllers/admin/AdminThemesController.php and modify:

	public function ajaxProcessGetAddonsThemes()
	{
		die();// <=== ADD THIS LINE
		$parent_domain = Tools::getHttpHost(true)...

Disable toolbar module list button

[https://github.com/PrestaShop/PrestaShop/blob/develop/classes/controller/AdminController.php#L2142-L2152] Go to ./public/classes/controller/AdminController.php and then comment the lines as next:

protected function addPageHeaderToolBarModulesListButton()
   {
   	$this->filterTabModuleList();
   	// Start the comment from here
   	// if (is_array($this->tab_modules_list['slider_list']) && count($this->tab_modules_list['slider_list']))
   	// 	$this->page_header_toolbar_btn['modules-list'] = array(
   	// 		'href' => '#',
   	// 		'desc' => $this->l('Recommended Modules')
   	// 	);
   // to here...
   }

Remove new panel from dashboard

[https://github.com/PrestaShop/PrestaShop/blob/develop/admin-dev/themes/default/template/controllers/dashboard/helpers/view/view.tpl#L99-L103]

file ./public/admin/themes/default/template/controllers/dashboards/helpers/views/view.tpl and comment the block:

</div>
<div class="col-md-12 col-lg-2">
  <!-- <section class="dash_news panel">
  	<h3><i class="icon-rss"></i> PrestaShop News</h3>
  	<div class="dash_news_content"></div>
  	<div class="text-center"><h4><a href="http://www.prestashop.com/blog/" onclick="return !window.open(this.href);">{l s='Find more news'}</a></h4></div>
  </section> -->
<section id="dash_version" class="visible-lg">

Prestashop Development Tricks

Moving your prestashop environments (production->local->production)

Always make a backups

###Issue: When you try open your page redirects to another place Maybe you found this place while you trying to move your working environment to another place. To me was hard, so here are some tips that was usefully to me.

  1. Change your domain variable in your config table. Use the next sql script to discover and change your domain settings
# Standard shop domain
UPDATE `<YOUR-DATABASE>`.`<YOUR-DB-PREFIX>_configuration` 
SET value = '<YOUR-DOMAIN-AFTER-HTTP(S)://>' WHERE name = "PS_SHOP_DOMAIN";
# SSL shop domain
UPDATE `<YOUR-DATABASE>`.`<YOUR-DB-PREFIX>_configuration` 
SET value = '<YOUR-DOMAIN-AFTER-HTTP(S)://>' WHERE name = "PS_SHOP_DOMAIN_SSL";
  1. Change your shop url. Shop url lets to prestashop known where are your resources. Use this sql script
#First look for your shop entries
SELECT * FROM UPDATE `<YOUR-DATABASE>`.`<YOUR-DB-PREFIX>_shop_url`;

#Then, with your ID update the database
UPDATE 
  `<YOUR-DATABASE>`.`<YOUR-DB-PREFIX>_shop_url`
SET
  domain='<YOUR-DOMAIN-AFTER-HTTP(S)://>',
  domain_ssl='<YOUR-DOMAIN-AFTER-HTTP(S)://>' 
WHERE id_shop_url = <ID-SHOP>;
  1. If your prestashop installation is within directory add the next to your script:
UPDATE 
  `<YOUR-DATABASE>`.`<YOUR-DB-PREFIX>_shop_url`
SET
  domain='<YOUR-DOMAIN-AFTER-HTTP(S)://>',
  domain_ssl='<YOUR-DOMAIN-AFTER-HTTP(S)://>',
  physical_uri='<YOUR-PS-DIRECTORY-INSTALLATION>'
WHERE id_shop_url = <ID-SHOP>;

Changing your password manually

First of all, get your secret key from config/settings.inc.php (for PS 1.6<) or app/config/parameters.php (PS 1.7+)

UPDATE 
  `<YOUR-DATABASE>`.`<YOUR-DB-PREFIX>_shop_url`
SET
  email = '<OPTIONAL:YOUR-NEW-EMAIL>', 
  passwd = MD5('<YOUR-SECRET-KEY><YOUR-NEW-PASSWORD>') WHERE id_employee=1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment