Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove links to categories from homepage blocks
Marcin Gębalaaaade7e13a3c
diff --git a/saleor/core/views.py b/saleor/core/views.pyindex 64f85bdf29..5d41502503 100644--- a/saleor/core/views.py+++ b/saleor/core/views.py@@ -1,15 +1,12 @@from django.template.response import TemplateResponse-from ..product.utils import (categories_for_homepage,- products_with_availability, products_for_homepage)+from ..product.utils import (products_with_availability, products_for_homepage)def home(request):products = products_for_homepage()[:8]products = products_with_availability(products, discounts=request.discounts, local_currency=request.currency)- featured_categories = categories_for_homepage(3)return TemplateResponse(request, 'home.html',- {'products': products, 'parent': None,- 'featured_categories': featured_categories})+ {'products': products, 'parent': None})diff --git a/saleor/product/utils.py b/saleor/product/utils.pyindex cf11eec837..cf128249fe 100644--- a/saleor/product/utils.py+++ b/saleor/product/utils.py@@ -7,7 +7,7 @@ from ..cart.utils import get_cart_from_request, get_or_create_cart_from_requestfrom ..core.utils import to_local_currencyfrom .forms import get_form_class_for_productfrom .models.utils import get_attributes_display_map-from .models import Category, Product+from .models import Productdef products_visible_to_user(user):@@ -36,13 +36,6 @@ def products_for_homepage():return products-def categories_for_homepage(num):- categories = list(Category.objects.all()[:num])- while 0 < len(categories) < num:- categories.append(Category.objects.first())- return categories--def get_product_images(product):"""Returns list of product images that will be placed in product gallerydiff --git a/templates/home.html b/templates/home.htmlindex ec4034a9b7..b87067e9d1 100644--- a/templates/home.html+++ b/templates/home.html@@ -12,7 +12,7 @@<div class="home--content-inner"><h1>{% trans "Promo & Sale" %}</h1><h2>{% trans "form the Northpole" %}</h2>- <a class="btn btn-secondary home__button" href="{% if featured_categories %}{{ featured_categories.0.get_absolute_url }}{% endif %}">{% trans "Shop now" %}</a>+ <a class="btn btn-secondary home__button" href="#">{% trans "Shop now" %}</a></div></div></div>@@ -26,7 +26,7 @@<div class="home--content-wrapper"><div class="home--content-inner"><h1>{% trans "Size & Colours" %}</h1>- <a class="btn btn-secondary home__button" href="{% if featured_categories %}{{ featured_categories.1.get_absolute_url }}{% endif %}">{% trans "Shop now" %}</a>+ <a class="btn btn-secondary home__button" href="#">{% trans "Shop now" %}</a></div></div></div>@@ -38,21 +38,19 @@<div class="home--content-wrapper"><div class="home--content-inner"><h1>{% trans "Digital Downloads" %}</h1>- <a class="btn btn-secondary home__button" href="{% if featured_categories %}{{ featured_categories.2.get_absolute_url }}{% endif %}">{% trans "Shop now" %}</a>+ <a class="btn btn-secondary home__button" href="#">{% trans "Shop now" %}</a></div></div></div></div></div></div>- {% if products|length %}<div class="home__featured"><h2 class="text-center">{% trans "Featured products" %}</h2><div class="row">{% include "category/_items.html" %}</div></div>- {% endif %}</div>{% endblock %}