Shopware 5: Plugin does not overwrite template view
Plugin has to overwrite the search template in Theme but it does not. It contains following files:
PrOlgaStartup/PrOlgaStartup.php
<?php
namespace PrOlgaStartup;
use ShopwareComponentsPlugin;
class PrOlgaStartup extends Plugin
{
public static function getSubscribedEvents()
{
return [
'Enlight_Controller_Action_PostDispatchSecure_Frontend' => 'extendsFrontend'
];
}
public function extendsFrontend(Enlight_Controller_ActionEventArgs $args)
{
/** @var Enlight_Controller_Action $controller */
// Breadrcrumbs must dissapear
$subject = $args->getSubject();
$subject->View()->addTemplateDir(__DIR__ . '/Resources/views');
}
}
PrOlgaStartup/Resources/views/frontend/index/search.tpl
{extends file="parent:frontend/index/search.tpl"}
{block name="frontend_index_search_container"}
Hello World!
{/block}
Some Notes
- Tested in vagrant and bitnami
- Theme is extended by
protected $injectBeforePlugins = true;
- Theme does not contain custom search.tpl
- Cache has been cleared
- This solution does not work as well
Thank you very much in advance!!! :-)
php shopware
add a comment |
Plugin has to overwrite the search template in Theme but it does not. It contains following files:
PrOlgaStartup/PrOlgaStartup.php
<?php
namespace PrOlgaStartup;
use ShopwareComponentsPlugin;
class PrOlgaStartup extends Plugin
{
public static function getSubscribedEvents()
{
return [
'Enlight_Controller_Action_PostDispatchSecure_Frontend' => 'extendsFrontend'
];
}
public function extendsFrontend(Enlight_Controller_ActionEventArgs $args)
{
/** @var Enlight_Controller_Action $controller */
// Breadrcrumbs must dissapear
$subject = $args->getSubject();
$subject->View()->addTemplateDir(__DIR__ . '/Resources/views');
}
}
PrOlgaStartup/Resources/views/frontend/index/search.tpl
{extends file="parent:frontend/index/search.tpl"}
{block name="frontend_index_search_container"}
Hello World!
{/block}
Some Notes
- Tested in vagrant and bitnami
- Theme is extended by
protected $injectBeforePlugins = true;
- Theme does not contain custom search.tpl
- Cache has been cleared
- This solution does not work as well
Thank you very much in advance!!! :-)
php shopware
add a comment |
Plugin has to overwrite the search template in Theme but it does not. It contains following files:
PrOlgaStartup/PrOlgaStartup.php
<?php
namespace PrOlgaStartup;
use ShopwareComponentsPlugin;
class PrOlgaStartup extends Plugin
{
public static function getSubscribedEvents()
{
return [
'Enlight_Controller_Action_PostDispatchSecure_Frontend' => 'extendsFrontend'
];
}
public function extendsFrontend(Enlight_Controller_ActionEventArgs $args)
{
/** @var Enlight_Controller_Action $controller */
// Breadrcrumbs must dissapear
$subject = $args->getSubject();
$subject->View()->addTemplateDir(__DIR__ . '/Resources/views');
}
}
PrOlgaStartup/Resources/views/frontend/index/search.tpl
{extends file="parent:frontend/index/search.tpl"}
{block name="frontend_index_search_container"}
Hello World!
{/block}
Some Notes
- Tested in vagrant and bitnami
- Theme is extended by
protected $injectBeforePlugins = true;
- Theme does not contain custom search.tpl
- Cache has been cleared
- This solution does not work as well
Thank you very much in advance!!! :-)
php shopware
Plugin has to overwrite the search template in Theme but it does not. It contains following files:
PrOlgaStartup/PrOlgaStartup.php
<?php
namespace PrOlgaStartup;
use ShopwareComponentsPlugin;
class PrOlgaStartup extends Plugin
{
public static function getSubscribedEvents()
{
return [
'Enlight_Controller_Action_PostDispatchSecure_Frontend' => 'extendsFrontend'
];
}
public function extendsFrontend(Enlight_Controller_ActionEventArgs $args)
{
/** @var Enlight_Controller_Action $controller */
// Breadrcrumbs must dissapear
$subject = $args->getSubject();
$subject->View()->addTemplateDir(__DIR__ . '/Resources/views');
}
}
PrOlgaStartup/Resources/views/frontend/index/search.tpl
{extends file="parent:frontend/index/search.tpl"}
{block name="frontend_index_search_container"}
Hello World!
{/block}
Some Notes
- Tested in vagrant and bitnami
- Theme is extended by
protected $injectBeforePlugins = true;
- Theme does not contain custom search.tpl
- Cache has been cleared
- This solution does not work as well
Thank you very much in advance!!! :-)
php shopware
php shopware
asked Nov 21 '18 at 16:53
pr-olga
162
162
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try to use the "new" way to register a template:
public function extendsFrontend(Enlight_Event_EventArgs $args)
{
$this->container->get('Template')->addTemplateDir(
$this->getPath() . '/Resources/views/'
);
}
Hi Rotfuchs, thank you for the answer! Unfortunately, it has no effect... I mean am I only person who has this problem!?
– pr-olga
Nov 23 '18 at 14:17
I mean I do everything like here (begin at 7:00) (modulo PreDispatch), it does not work...
– pr-olga
Nov 23 '18 at 14:25
What exactly do you wan't to overwrite? The ajax-search has another template than the search-result page. Perhaps a Screenshot will help. You should consider the hint with "injectbeforeplugins" too, because an overwrite via plugin is only possible, when there is no theme with injectbeforeplugins = false overwriting the same block.
– Rotfuchs
Nov 28 '18 at 6:28
Thank you, Rotfuchs, for the answer! I have already found the solution: see the answer below :-)
– pr-olga
Nov 29 '18 at 8:13
add a comment |
The only way to make it work (i.e. include plugin templates) is:
- Put the development environment into vagrant (I work on Windows OS)
- Put variable
protected $injectBeforePlugins = true;
into Theme.php
The injection of this variable does not make any effect in bitnami at all, and the combination above seems to be missed in my tests. Why this is the case, it is not clear to me (now). Presumably, the only answer of the day is this, i.e. it depends on your OS and/or on your virtual machine.
Consider marking this as the best answer, if this solved your problem.
– mbrandau
Dec 27 '18 at 10:45
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416998%2fshopware-5-plugin-does-not-overwrite-template-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try to use the "new" way to register a template:
public function extendsFrontend(Enlight_Event_EventArgs $args)
{
$this->container->get('Template')->addTemplateDir(
$this->getPath() . '/Resources/views/'
);
}
Hi Rotfuchs, thank you for the answer! Unfortunately, it has no effect... I mean am I only person who has this problem!?
– pr-olga
Nov 23 '18 at 14:17
I mean I do everything like here (begin at 7:00) (modulo PreDispatch), it does not work...
– pr-olga
Nov 23 '18 at 14:25
What exactly do you wan't to overwrite? The ajax-search has another template than the search-result page. Perhaps a Screenshot will help. You should consider the hint with "injectbeforeplugins" too, because an overwrite via plugin is only possible, when there is no theme with injectbeforeplugins = false overwriting the same block.
– Rotfuchs
Nov 28 '18 at 6:28
Thank you, Rotfuchs, for the answer! I have already found the solution: see the answer below :-)
– pr-olga
Nov 29 '18 at 8:13
add a comment |
Try to use the "new" way to register a template:
public function extendsFrontend(Enlight_Event_EventArgs $args)
{
$this->container->get('Template')->addTemplateDir(
$this->getPath() . '/Resources/views/'
);
}
Hi Rotfuchs, thank you for the answer! Unfortunately, it has no effect... I mean am I only person who has this problem!?
– pr-olga
Nov 23 '18 at 14:17
I mean I do everything like here (begin at 7:00) (modulo PreDispatch), it does not work...
– pr-olga
Nov 23 '18 at 14:25
What exactly do you wan't to overwrite? The ajax-search has another template than the search-result page. Perhaps a Screenshot will help. You should consider the hint with "injectbeforeplugins" too, because an overwrite via plugin is only possible, when there is no theme with injectbeforeplugins = false overwriting the same block.
– Rotfuchs
Nov 28 '18 at 6:28
Thank you, Rotfuchs, for the answer! I have already found the solution: see the answer below :-)
– pr-olga
Nov 29 '18 at 8:13
add a comment |
Try to use the "new" way to register a template:
public function extendsFrontend(Enlight_Event_EventArgs $args)
{
$this->container->get('Template')->addTemplateDir(
$this->getPath() . '/Resources/views/'
);
}
Try to use the "new" way to register a template:
public function extendsFrontend(Enlight_Event_EventArgs $args)
{
$this->container->get('Template')->addTemplateDir(
$this->getPath() . '/Resources/views/'
);
}
answered Nov 22 '18 at 5:53
Rotfuchs
51318
51318
Hi Rotfuchs, thank you for the answer! Unfortunately, it has no effect... I mean am I only person who has this problem!?
– pr-olga
Nov 23 '18 at 14:17
I mean I do everything like here (begin at 7:00) (modulo PreDispatch), it does not work...
– pr-olga
Nov 23 '18 at 14:25
What exactly do you wan't to overwrite? The ajax-search has another template than the search-result page. Perhaps a Screenshot will help. You should consider the hint with "injectbeforeplugins" too, because an overwrite via plugin is only possible, when there is no theme with injectbeforeplugins = false overwriting the same block.
– Rotfuchs
Nov 28 '18 at 6:28
Thank you, Rotfuchs, for the answer! I have already found the solution: see the answer below :-)
– pr-olga
Nov 29 '18 at 8:13
add a comment |
Hi Rotfuchs, thank you for the answer! Unfortunately, it has no effect... I mean am I only person who has this problem!?
– pr-olga
Nov 23 '18 at 14:17
I mean I do everything like here (begin at 7:00) (modulo PreDispatch), it does not work...
– pr-olga
Nov 23 '18 at 14:25
What exactly do you wan't to overwrite? The ajax-search has another template than the search-result page. Perhaps a Screenshot will help. You should consider the hint with "injectbeforeplugins" too, because an overwrite via plugin is only possible, when there is no theme with injectbeforeplugins = false overwriting the same block.
– Rotfuchs
Nov 28 '18 at 6:28
Thank you, Rotfuchs, for the answer! I have already found the solution: see the answer below :-)
– pr-olga
Nov 29 '18 at 8:13
Hi Rotfuchs, thank you for the answer! Unfortunately, it has no effect... I mean am I only person who has this problem!?
– pr-olga
Nov 23 '18 at 14:17
Hi Rotfuchs, thank you for the answer! Unfortunately, it has no effect... I mean am I only person who has this problem!?
– pr-olga
Nov 23 '18 at 14:17
I mean I do everything like here (begin at 7:00) (modulo PreDispatch), it does not work...
– pr-olga
Nov 23 '18 at 14:25
I mean I do everything like here (begin at 7:00) (modulo PreDispatch), it does not work...
– pr-olga
Nov 23 '18 at 14:25
What exactly do you wan't to overwrite? The ajax-search has another template than the search-result page. Perhaps a Screenshot will help. You should consider the hint with "injectbeforeplugins" too, because an overwrite via plugin is only possible, when there is no theme with injectbeforeplugins = false overwriting the same block.
– Rotfuchs
Nov 28 '18 at 6:28
What exactly do you wan't to overwrite? The ajax-search has another template than the search-result page. Perhaps a Screenshot will help. You should consider the hint with "injectbeforeplugins" too, because an overwrite via plugin is only possible, when there is no theme with injectbeforeplugins = false overwriting the same block.
– Rotfuchs
Nov 28 '18 at 6:28
Thank you, Rotfuchs, for the answer! I have already found the solution: see the answer below :-)
– pr-olga
Nov 29 '18 at 8:13
Thank you, Rotfuchs, for the answer! I have already found the solution: see the answer below :-)
– pr-olga
Nov 29 '18 at 8:13
add a comment |
The only way to make it work (i.e. include plugin templates) is:
- Put the development environment into vagrant (I work on Windows OS)
- Put variable
protected $injectBeforePlugins = true;
into Theme.php
The injection of this variable does not make any effect in bitnami at all, and the combination above seems to be missed in my tests. Why this is the case, it is not clear to me (now). Presumably, the only answer of the day is this, i.e. it depends on your OS and/or on your virtual machine.
Consider marking this as the best answer, if this solved your problem.
– mbrandau
Dec 27 '18 at 10:45
add a comment |
The only way to make it work (i.e. include plugin templates) is:
- Put the development environment into vagrant (I work on Windows OS)
- Put variable
protected $injectBeforePlugins = true;
into Theme.php
The injection of this variable does not make any effect in bitnami at all, and the combination above seems to be missed in my tests. Why this is the case, it is not clear to me (now). Presumably, the only answer of the day is this, i.e. it depends on your OS and/or on your virtual machine.
Consider marking this as the best answer, if this solved your problem.
– mbrandau
Dec 27 '18 at 10:45
add a comment |
The only way to make it work (i.e. include plugin templates) is:
- Put the development environment into vagrant (I work on Windows OS)
- Put variable
protected $injectBeforePlugins = true;
into Theme.php
The injection of this variable does not make any effect in bitnami at all, and the combination above seems to be missed in my tests. Why this is the case, it is not clear to me (now). Presumably, the only answer of the day is this, i.e. it depends on your OS and/or on your virtual machine.
The only way to make it work (i.e. include plugin templates) is:
- Put the development environment into vagrant (I work on Windows OS)
- Put variable
protected $injectBeforePlugins = true;
into Theme.php
The injection of this variable does not make any effect in bitnami at all, and the combination above seems to be missed in my tests. Why this is the case, it is not clear to me (now). Presumably, the only answer of the day is this, i.e. it depends on your OS and/or on your virtual machine.
answered Nov 24 '18 at 14:27
pr-olga
162
162
Consider marking this as the best answer, if this solved your problem.
– mbrandau
Dec 27 '18 at 10:45
add a comment |
Consider marking this as the best answer, if this solved your problem.
– mbrandau
Dec 27 '18 at 10:45
Consider marking this as the best answer, if this solved your problem.
– mbrandau
Dec 27 '18 at 10:45
Consider marking this as the best answer, if this solved your problem.
– mbrandau
Dec 27 '18 at 10:45
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416998%2fshopware-5-plugin-does-not-overwrite-template-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown