1

I am making new plugin for Oxid E-shop. In my metadata file, description, title, logo, works perfectly and I can see plugin in backend, but when I activate plugin, nothing in frontend is changed. Blocks aren't overwritten.

/modules/myModule/metadata.php

'blocks' => array(
    array(
        'template' => 'layout/footer.tpl', 
        'block' => 'footer_main', 
        'file' => '/views/blocks/layout/footer.tpl'
)

I have just simple example in footer for now.

/modules/myModule/views/blocks/layout/footer.tpl

[{block name="footer_main"}]
    <div class="footer-base">Schuberth test !</div>
[{/block}]

Location of template that should be overwritten: /application/views/azure/tpl/layout/footer.tpl

Ivan Vulović
  • 2,147
  • 6
  • 27
  • 43

4 Answers4

1

it should actually work, at least with versions >= 4.8
Check if your block entry was saved in database table oxtplblocks.
Sometimes OXID does not update cached metadata after you added new entries to metadata.php, in this case try to increase module version.
Also check your file names for typos.

If everything is there and correct, you should post the full code and tell us your shop version.

Marat
  • 617
  • 5
  • 12
0

Opening oxtplblocks table in database discovered me a bug, OXMODULE column has lenght 32 characters, and my module ID/directory name was longer, so rest of name was cut off.

I found on other source that module id shouldn't be longer than 20 characters.

Ivan Vulović
  • 2,147
  • 6
  • 27
  • 43
0

Sometimes it happend that you need to clear the cache (tmp). this works for me most the time.

Patrick Müssig
  • 97
  • 1
  • 1
  • 9
0

Please add .htaccess file to /source directory and copy this code.

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    RewriteRule ^graphql/?$    widget.php?cl=graphql&skipSession=1   [QSA,NC,L]

    RewriteCond %{REQUEST_URI}     config\.inc\.php [NC]
    RewriteRule ^config\.inc\.php  index\.php       [R=301,L]

    RewriteCond %{REQUEST_URI} setup   [NC]
    RewriteRule ^setup(.*)$    Setup$1 [R=301,L]

    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
    RewriteRule .* - [F]

    RewriteCond %{REQUEST_URI} oxseo\.php$
    RewriteCond %{QUERY_STRING} mod_rewrite_module_is=off
    RewriteRule oxseo\.php$ oxseo.php?mod_rewrite_module_is=on [L]

    RewriteCond %{REQUEST_URI} !(\/admin\/|\/Core\/|\/Application\/|\/export\/|\/modules\/|\/out\/|\/Setup\/|\/tmp\/|\/views\/)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule !(\.html|\/|\.jpe?g|\.css|\.pdf|\.doc|\.gif|\.png|\.js|\.htc|\.svg)$ %{REQUEST_URI}/ [NC,R=301,L]

    RewriteCond %{REQUEST_URI} !(\/admin\/|\/Core\/|\/Application\/|\/export\/|\/modules\/|\/out\/|\/Setup\/|\/tmp\/|\/views\/)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (\.html|\/)$ oxseo.php


    RewriteCond %{REQUEST_URI} (\/out\/pictures\/generated\/)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (\.jpe?g|\.gif|\.png|\.svg)$ getimg.php [NC]

    RewriteRule ^(vendor/) - [F,L,NC]
    RewriteRule ^migration - [R=403,L]
</IfModule>

# disabling log file access from outside
<FilesMatch "(EXCEPTION_LOG\.txt|\.log|\.tpl|pkg\.rev|\.ini|pkg\.info|\.pem|composer\.json|composer\.lock|test_config\.yml)$">
   <IfModule mod_authz_core.c>   
       Require all denied
   </IfModule>
   <IfModule !mod_authz_core.c>
       Order allow,deny
       Deny from all   
   </IfModule>
</FilesMatch>

# Prevent .ht* files from being sent to outside requests
<Files ~ "^\.ht">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
    </IfModule>
</Files>

Options -Indexes
DirectoryIndex index.php index.html

It should be good. I was using Oxid v6.2. And it worked for v6.4 as well.

ExpertWeblancer
  • 1,368
  • 1
  • 13
  • 28