Slideshow and featured products

How can I combine slideshow and featured products on the same website page?

It is easy to create a page that has a slideshow but how to include the featured products on the same page?
Or I could use a default homepage, which has the child table grid “Products to be shown on website homepage”.

I’m using a self hosted ERPNext v10.1.35 so it is possible to modify server-side templates if needed.

I found a template file for website homepage which has a code block to generate the features products listing.
Can I inject this somehow to a custom web page? If yes, where should I put it?

/home/frappe/frappe-bench/apps/erpnext/erpnext/templates/pages/home.html

{% if homepage.products %}
  <div class='featured-products-section' itemscope itemtype="http://schema.org/Product">
  	<h5 class='featured-product-heading'>{{ _("Featured Products") }}</h5>
  	<div class="featured-products">
  		<div id="search-list" class="row" style="margin-top:40px;">
  			{% for item in homepage.products %}
  			<a class="product-link" href="{{ item.route|abs_url }}">
  				<div class="col-sm-4 col-xs-4 product-image-wrapper">
  					<div class="product-image-img">
  						<!-- thumbnail not updated, and used as background image in item card -->
  						{{ product_image_square(item.image) }}
  					<div class="product-text" itemprop="name">{{ item.item_name }}</div>
  					</div>
  				</div>
  			</a>
  			{% endfor %}
  		</div>
  	</div>
  	<div class="text-center padding">
  		<a href="{{ homepage.products_url or "/products" }}" class="btn btn-primary all-products">
  			{{ _("View All Products") }}</a></div>
  </div>
  {% endif %}

I found the template for web page located at
/home/frappe/frappe-bench/apps/frappe/frappe/website/doctype/web_page/templates/web_page.html

But when I tried to include the code from the file mentioned in previous post I get a

Uncaught Server Exception

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 39, in render
data = render_page_by_language(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 133, in render_page_by_language
return render_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 149, in render_page
return build(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 156, in build
return build_page(path)
File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 177, in build_page
html = frappe.get_template(context.template).render(context)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 1008, in render
return self.environment.handle_exception(exc_info, True)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File “/home/frappe/frappe-bench/apps/frappe/frappe/./website/doctype/web_page/templates/web_page.html”, line 1, in top-level template code
{% extends “templates/web.html” %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 1, in top-level template code
{% extends base_template_path %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/base.html”, line 69, in top-level template code
{% block content %}{% endblock %}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./templates/web.html”, line 47, in block “content”
{%- block page_content -%}{%- endblock -%}
File “/home/frappe/frappe-bench/apps/frappe/frappe/./website/doctype/web_page/templates/web_page.html”, line 19, in block “page_content”
{% if homepage.products %}
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/jinja2/environment.py”, line 430, in getattr
return getattr(obj, attribute)
UndefinedError: ‘homepage’ is undefined

How can I refer to an object that is in erpnext-app from frappe-app?

2 Likes

Hi, were you able to resolve?

I got the same problem. when i try to include slideshow in home.html , the code gets completely ignored. How can i use slideshow in the default homepage?
please help !!