shopware


Use different template for my contact us form in shopware5


I need to use a different design template for my Shopware5 contact us page.
Currently this form is loaded from the “Form” controller and view is “frontend/form/index.tpl” if I can create a custom template under “frontend/form/” directory I can solve this issue.
My question is how can I tell my controller to use new template when the url or some id is “contact-us2” or something for example.
There are two different ways to do so.
1. Switch in the view:
You would be able to get the Url segment in the view. So, a very dirty way: Just decide which sub template will be included in Smarty depending on the given Url. But as I already told, this is not the way you should ever do! Even though it's a way...
2. Switch via event subscriber:
Just create a Shopware plugin, listen to the Enlight_Controller_Action_PostDispatch_Frontend_Form event. Then check whatever is necessary to decide which view should be loaded - maybe the current Shops locale or whatever. Just do
$this->View()->loadTemplate('frontend/path/to/your/file.tpl');
and the controller should load the template you specified.
Kind regards

Related Links

shopware sample website is not redirecting to checkout page
Product Variants - Frontend
Call Order Controller after Backend Login Shopware
Changing the frontend language & multiple countries support in Shopware
Extends Shopware Models
Custom search result page in shopware5
TypeError: jQuery.subscribe is not a function on shopware5
Working with Forms in Shopware
Use different template for my contact us form in shopware5
Shopware 5 accessing controller variables (Template Variables) on frontend
Shopware 5 Responsive theme inheritance
Deactivate HTTP cache in Shopware 5 in a plugin
Any risk in using numeric item numbers in Shopware?

Categories

HOME
ms-access
jdo
omnet++
isabelle
smarty
appx
octobercms
gitpitch
cloudkit
google-translate
kentor-authservices
imacros
gz
msp430
fatal-error
samoa
web-sql
tibco-mdm
fish
react-css-modules
nhapi
c++-amp
semantic-versioning
subset-sum
form-data
hexo
jmonkeyengine
bitbucket-pipelines
qwerty
squib
arena-simulation
acoustics
sas-jmp
apple-news
jsch
theming
rdfs
mplayer
drupal-6
nsarray
r-forge
ifs
namecoin
python-cryptography
memory-alignment
dynamics-sl
angular-strap
nested-sets
jquery-filter
setuptools
nxt
log4c
url-masking
mathematica-frontend
autorest
master-slave
php-parse-error
intel-fortran
thredds
wyam
sframe
riak-cs
tableau-online
generic-programming
remobjects
device-orientation
directoryservices
kineticjs
geonetwork
tween
terminfo
poller
rtmfp
concurrent-collections
fmod
c18
blending
quartz-graphics
rabl
spring-validator
robotics-studio
reddot
postgresql-performance
code-cleanup
bigcouch
nsobject
zend-translate
suppress
filtered-index
microsoft-virtualization
backcolor
zune

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App