Can someone help me with a file path problem I am experiencing with a custom Prestashop module 1.6 version?
The following works perfectly in a localhost environment:
return $this->display(__FILE__, '../../product-list.tpl');
however does not work on a live server. The following does work:
return $this->display(__FILE__, '../../themes/default-bootstrap/product-list.tpl');
which is not acceptable as some customers will not be using the default-bootstrap theme.
Any assistance with this problem will be appreciated.
Thanks
"$this->display" command has many dependencies on ModuleCore SO it's better to use include on custom tpl file:
return $this->display(__FILE__, 'views/templates/custom.tpl');
then on your custom.tpl :
{include file="$tpl_dir./product-list.tpl" products=$products}
Related
I have created a plugin. There is a backend listing form my plugin. so I have done this by using vue.js (https://developers.shopware.com/developers-guide/lightweight-backend-modules/)
There are no issues with the first plugin.
I have created another plugin. this plugin also has backend listing. I have created layout.tpl in my plugins _base folder.
But the problem is the 2nd plugin also loading the layout.tpl of the first plugin.
How to resolve this issue?
I have cleared the cache. But no hope.
Finally, I have fixed this issue by adding the following line of code in the backend controller.
$this->get('Template')->setTemplateDir([]);
--------Function------
public function preDispatch() {
$this->get('Template')->setTemplateDir([]);
$this->get('template')->addTemplateDir(__DIR__ . '/../../Resources/views/');
}
you should always "prefix" your views directory with an additional directory named like your plugin. Like this: Resources/views/backend/my_plugin_name/layout.tpl
With this you should not have the problem that one plugin uses the other plugins template file.
Best regards from Schöppingen
Michael Telgmann
everyone.
I started using mpdf on my website recently. Creating new pdfs is working fine, but i can't import existing ones. I get this error whenever i try to execute the import:
mPDF error: Cannot open ../folder1/folder2/folder3/folder4/folder5/thisisthepdf.pdf !
(that is not the real path)
I included the mpdf in the php. The folder and the files are on chmod 777 and the pdfs are all version 1.4
This is the way i am trying to import.
$mpdf=new mPDF();
$mpdf->SetImportUse();
$pagecount = $mpdf->SetSourceFile('../folder1/folder2/folder3/folder4/folder5/thisisthepdf.pdf');
$tplId = $mpdf->ImportPage($pagecount);
$mpdf->UseTemplate($tplId);
$mpdf->WriteHTML('Hallo World');
$mpdf->Output();
I tried various ways to import i found on stackoverflow and other sites, but nothing worked. Not even the code from the official mpdf manual i am using (the one above) is working.
Trying to solve this issue for quite a while now, but i am out of ideas. I Hope someone can help me. Thanks in advance!
This error message is raised because of a failing call of a simple fopen(). Which means that the PHP script simply cannot access the file.
So ensure that the path is valid by e.g. passing it to realpath(), as it seems to be a relative path. If this evaluates to false the path is simply wrong. Otherwise it is a permission issue.
I have the message "Controller Not Found" when i try to see an order on my Prestashop Back-office.
The strange thing is that i have this error only on one order, and the others work correctly.
Do you have any idea ?
I'm on Prestashop 1.6.
Thanks a lot!
Please check that file AdminOrdersController.php is there at the following path of your PrestaShop directory:
/controllers/admin
If there is a file there then you can also check the permission for that file, it might be a permission issue.
Try deleting any closing php tags. That fixed my issue.
Thanks. I'm having the same issue.. I put that code in a controller file. I found out the issue in case. The issue was that I love code highlighting and often put <?PHP at the top of the blade views and the Controller (logic .php file).
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class JoeSearchController extends Controller
{
public function delete($id)
{
DB::table('user')->where('userID', '=', $id)->delete();
return redirect('history deleted');
}
}
I am working on the Google + API blogger code. I have downloaded this file
https://github.com/google/google-api-php-client
I have inserted my Google Developer codes in the right places I do believe.
I am getting this error
Fatal error: Class 'Google_Service' not found in /home3/aundie/public_html/dandewebwonders.com/Blog/google-api-php-client-master/src/Google/Service/Blogger.php on line 33
Any help for a new developer in training would be most helpful. Thank you in advance
Try to include autoload.php file as the first require statement. I got the same error and this solved it for me.
require_once 'google-api-php-client/src/Google/autoload.php';
I hit the same problem as well. The solution is moving to php 5.3 or higher, as the Google API PHP client uses the newer class loading mechanism in php.
Just as the following at the beginning of the code, the same as advised by Lamiaa El-morsy
require_once 'src/Google/autoload.php';
On the GitHub page, they've explained the requirement.
So, you must install the required library first, by doing the following command if you're using composer.
$ composer require google/apiclient:^2.0
I have upgraded Prestashop from 15.6.X.X to 16.X.X.X. After the up-gradation, default-bootstrap is activated as a default theme.
When I try to active my theme, the front end page get blank page.
It showing an error, Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file .
How can I activate the old theme in upgraded version?
Please advice.
It seems that you miss a .tpl on your theme, please try to re upload it. (Or maybe your theme isn't compatible with 1.6)
There are often problems with Prestashop upgrades.
You need to completely fix all problems before using your template.
Try to option file config/defines.inc.php and change the site to dev mode
/* Debug only */
if (!defined('_PS_MODE_DEV_'))
define('_PS_MODE_DEV_', true);
All errors will show on your frontpage, try to fix all those errors and get your website totally works. Normal you will see problems with database, some tables was not successfully added new columns, then try to add those columns manually via your phpmyadmin
Good luck!
#2plus
Prestashop 1.5+ theme will not work in 1.6 there are lots of changes need. You can enable the debut mode and then you will find the error.
in 1.6 there is new tpl implement global.tpl may be that is missing.