Shopware 6 theme isnt overriding Storefront? - html

I am trying to override the storefront using my plugin files and doesnt seem to be working. I am using Shopware 6.
I am trying to follow the example they give to set it up, overriding the logo.html.twig in the header.
My file directory is:
Installation root > custom > plugins > MY PLUGIN NAME > src > Resources > views > shopfront > layout > header > logo.html.twig
Inside my logo file I have :
{% sw_extends '#Storefront/storefront/layout/header/logo.html.twig' %}
{% block layout_header_logo_link %}
<h2>Hello world!</h2>
{% endblock %}
I have ran bin/console cache:clear as well as ./psh.phar cache and bin/console theme:compile.
Thank you.

Your directory should be src/Resources/views/storefront/layout not shopfront.
After fixing the directory, reinstall the plugin and clean the cache. by bin/console cache:warmup and bin/console http:cache:warm:up

Turned out I had pulled the master install branch and not the latest release.

Related

Set build number for conda metadata inside Azure pipeline

I am using the bash script to build the conda pakage in azure pipeline conda build . --output-folder $(Build.ArtifactStagingDirectory) And here is the issue, Conda build uses the build number in the meta.yml file(see here).
A solution of What I could think of is, first, copy all files to Build.ArtifactStagingDirectory and add the Azure pipeline's Build.BuildNumber into the meta.yml and build the package to Build.ArtifactStagingDirectory (within a sub-folder)
I am trying to avoid do it by writing shell script to manipulate the yaml file in Azure pipeline, because it might be error prone. Any one knows a better way? Would be nice to read a more elegant solution in the answers or comments.
I don't know much about Azure pipelines. But in general, if you want to control the build number without changing the contents of meta.yaml, you can use a jinja template variable within meta.yaml.
Choose a variable name, e.g. CUSTOM_BUILD_NUMBER and use it in meta.yaml:
package:
name: foo
version: 0.1
build:
number: {{ CUSTOM_BUILD_NUMBER }}
To define that variable, you have two options:
Use an environment variable:
export CUSTOM_BUILD_NUMBER=123
conda build foo-recipe
OR
Define the variable in conda_build_config.yaml (docs), as follows
echo "CUSTOM_BUILD_NUMBER:" >> foo-recipe/conda_build_config.yaml
echo " - 123" >> foo-recipe/conda_build_config.yaml
conda build foo-recipe
If you want, you can add an if statement so that the recipe still works even if CUSTOM_BUILD_NUMBER is not defined (using a default build number instead).
package:
name: foo
version: 0.1
build:
{% if CUSTOM_BUILD_NUMBER is defined %}
number: {{ CUSTOM_BUILD_NUMBER }}
{% else %}
number: 0
{% endif %}

Salt: Using salt state in jinja if-else state

I'm trying to deploy a django project with saltstack.
I wrote a sls file and It installs packages and run some commands.
It installs django, nginx, etc and I want to run manage.py collectstatic for nginx.
but when I re-apply this formula, It returns an error that /static directory is already exists.
so I modified the sls file
collect_static_files:
{% if not salt['file.exists'][BASEDIR,'myproject/static']|join('') %}
cmd.run:
- name: '~~~ collectstatic;'
- cwd: /path/to/venv/bin
{% else %}
cmd.run:
- name: echo "Static directory exists."
{% endif %}
but when I run salt '*' state.apply myformula,
It says:
minion:
Data failed to compile:
----------
Rendering SLS 'base:myproj' failed: Jinja variable 'salt.utils.templates.AliasedLoader object' has no attribute 'file.exists'
How can I solve this problem? Thank you.
I was a fool...
{% if not salt['file.directory_exists'](BASEDIR + 'myproject/static') %}
worked well.
The problem was I used the state module not execution module of salt.
Now I understand that state module describes "state" and execution modules act like a function.

Including jinja from pillar from salt-stack

I wonder if it is possible to include
jinja
from a pillar from salt-stack?
thanks
Yes, you can use jinja in your pillar sls files.
https://docs.saltstack.com/en/latest/topics/pillar/
Yes. Ensure that the file starts with the following on the first line.
#!jinja|yaml|gpg
This will ensure that all the pre-processors are executed, in this case jinja, yaml, and gpg decryption.
Consider this example
vi /srv/pillar/packages.sls
{% if grains['os'] == 'RedHat' %}
apache: httpd
git: git
{% elif grains['os'] == 'Debian' %}
apache: apache2
git: git-core
{% endif %}
company: Foo Industries
The above pillar sets two key/value pairs. If a minion is running RedHat, then the apache key is set to httpd and the git key is set to the value of git. If the minion is running Debian, those values are changed to apache2 and git-core respectively. All minions that have this pillar targeting to them via a top file will have the key of company with a value of Foo Industries.
Consequently this data can be used from within modules, renderers, State SLS files, and more via the shared pillar dictionary:
apache:
pkg.installed:
- name: {{ pillar['apache'] }}
Source: https://docs.saltproject.io/en/latest/topics/pillar/

Password extension error

There's not much to describe:
I have installed the PasswordProtect extension under Bolt 5.0.5, and when I go to the page with the {{ passwordprotect() }} all I get is
http://i.share.pho.to/69d8d8bb_o.png
Is this a bug or is it me?

Django Oscar "ProgrammingError at /admin/" MySQL table

Trying to make my second Django app: a shop based on Django Oscar. I'm following the tutorial on RTFD. I have an issue with this stage http://django-oscar.readthedocs.org/en/latest/internals/getting_started.html#creating-product-classes-and-fulfillment-partners.
Every Oscar deployment needs at least one product class and one
fulfillment partner. These aren’t created automatically as they’re
highly specific to the shop you want to build. The quickest way to set
them up is to log into the Django admin interface at
localhost:8000/admin/ and create instances of both there. For a
deployment setup, we recommend creating them as data migration.
However when I try to log into the admin the error generated is:
ProgrammingError at /admin/
(1146, "Table 'winestoreoscar.django_admin_log' doesn't exist")
....
Error during template rendering
In template /home/david/.virtualenvs/winestoreoscar/local/lib/python2.7/site-packages/django/contrib/admin/templates/admin/index.html, error at line 65
1146
This template is shown in the error with this line highlighted:
<ul class="actionlist">
**65 {% for entry in admin_log %}**
66 <li class="{% if entry.is_addition %}addlink{% endif %}{% if entry.is_change %}changelink{% endif %}{% if entry.is_deletion %}deletelink{% endif %}">
So it looks like I'm missing a table. I'm using MySQL as the database. In the mysql prompt I tried the obvious..
mysql> CREATE TABLE winestoreoscar.django_admin_log;
but got the error message...
ERROR 1113 (42000): A table must have at least 1 column
I then tried removing the whole for loop in the admin template, and admin rendered successfully, but attempting to save resulted in the previous error.
Now I'm stuck. Any help very much appreciated.
Edit:
Here's the tree from the base dir (Thinks - do I need an admin.py..?):
├── manage.py
└── oscarwinestore
├── __init__.py
├── __init__.pyc
├── settings.py
├── settings.py~
├── settings.pyc
├── urls.py
├── urls.py~
├── urls.pyc
├── wsgi.py
└── wsgi.pyc
my urls.py is
from django.conf.urls import include, url
from oscar.app import application
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^i18n/', include('django.conf.urls.i18n')),
# The Django admin is not officially supported; expect breakage.
# Nonetheless, it's often useful for debugging.
url(r'^admin/', include(admin.site.urls)),
url(r'', include(application.urls)),
]
You need to create the tables with syncdb and migrate, as per the docs:
$ python manage.py syncdb --noinput
$ python manage.py migrate
Have you done that?