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
jdo
vbscript
debugging
proxy
deezer
tizen
fft
lodash
vmware
rsyslog
rsync
programming-languages
flyway4
django-imagekit
webrequest
basic
numeral.js
handsontable
vb.net-2010
ghc
crystal-reports-2008
scichart
dbext
intentfilter
tapestry
mustache.php
devops
autosys
angular2-aot
smb
numerical-methods
tdd
brunch
elasticsearch-net
gitignore
libssl
gsmcomm
pdb
google-sites-2016
grails-3.1
geopositioning
wallpaper
environment-modules
ios5
dosbox
space-complexity
multilingual
android-browser
splice
ibpy
isbn
arena-simulation
checkboxlist
scorm
jsch
react-scripts
blogengine.net
pebble-watch
media-player
boost-preprocessor
bind9
sonarlint-vs
smart-table
messenger
wdf
firmata
passport-google-oauth
infix-notation
slicknav
websitepanel
google-places
cakephp-3.1
pretty-print
dereference
tween
socketexception
markers
terminfo
project-planning
android-radiobutton
typeof
xsockets.net
tws
django-nonrel
yui-compressor
ember-app-kit
anonymous-methods
tridion-worldserver
errai
jquery-ui-layout
window-management
hamachi
gdlib
swing-app-framework
anti-piracy
premature-optimization
scripting-languages
misv

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App