From f8a93a41512e83515c423ae08ebcc0740f60e513 Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Mon, 23 Oct 2023 10:57:39 +0530 Subject: [PATCH] feat: web view for store product --- .../doctype/store_product/store_product.json | 12 +++++++++++- .../doctype/store_product/store_product.py | 4 ++-- .../store_product/templates/store_product.html | 7 +++++++ .../store_product/templates/store_product_row.html | 4 ++++ 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 printrov_merch_store/printrov_merch_store/doctype/store_product/templates/store_product.html create mode 100644 printrov_merch_store/printrov_merch_store/doctype/store_product/templates/store_product_row.html diff --git a/printrov_merch_store/printrov_merch_store/doctype/store_product/store_product.json b/printrov_merch_store/printrov_merch_store/doctype/store_product/store_product.json index b65c8ee..b96121b 100644 --- a/printrov_merch_store/printrov_merch_store/doctype/store_product/store_product.json +++ b/printrov_merch_store/printrov_merch_store/doctype/store_product/store_product.json @@ -1,5 +1,6 @@ { "actions": [], + "allow_guest_to_view": 1, "allow_rename": 1, "autoname": "prompt", "creation": "2023-10-21 19:07:31.178460", @@ -11,6 +12,7 @@ "retail_price", "column_break_qyeb", "is_published", + "route", "printrove_product_data_section", "front_mockup_image", "front_mockup", @@ -74,11 +76,18 @@ "fieldtype": "Image", "label": "Front Mockup Image", "options": "front_mockup" + }, + { + "fieldname": "route", + "fieldtype": "Data", + "label": "Route" } ], + "has_web_view": 1, "index_web_pages_for_search": 1, + "is_published_field": "is_published", "links": [], - "modified": "2023-10-23 10:20:15.440895", + "modified": "2023-10-23 10:56:50.848320", "modified_by": "Administrator", "module": "Printrov Merch Store", "name": "Store Product", @@ -98,6 +107,7 @@ "write": 1 } ], + "route": "products", "sort_field": "modified", "sort_order": "DESC", "states": [], diff --git a/printrov_merch_store/printrov_merch_store/doctype/store_product/store_product.py b/printrov_merch_store/printrov_merch_store/doctype/store_product/store_product.py index 55c7f36..31fe31f 100644 --- a/printrov_merch_store/printrov_merch_store/doctype/store_product/store_product.py +++ b/printrov_merch_store/printrov_merch_store/doctype/store_product/store_product.py @@ -2,8 +2,8 @@ # For license information, please see license.txt # import frappe -from frappe.model.document import Document +from frappe.website.website_generator import WebsiteGenerator -class StoreProduct(Document): +class StoreProduct(WebsiteGenerator): pass diff --git a/printrov_merch_store/printrov_merch_store/doctype/store_product/templates/store_product.html b/printrov_merch_store/printrov_merch_store/doctype/store_product/templates/store_product.html new file mode 100644 index 0000000..db12309 --- /dev/null +++ b/printrov_merch_store/printrov_merch_store/doctype/store_product/templates/store_product.html @@ -0,0 +1,7 @@ +{% extends "templates/web.html" %} + +{% block page_content %} +

{{ title }}

+{% endblock %} + + \ No newline at end of file diff --git a/printrov_merch_store/printrov_merch_store/doctype/store_product/templates/store_product_row.html b/printrov_merch_store/printrov_merch_store/doctype/store_product/templates/store_product_row.html new file mode 100644 index 0000000..d7014b4 --- /dev/null +++ b/printrov_merch_store/printrov_merch_store/doctype/store_product/templates/store_product_row.html @@ -0,0 +1,4 @@ +
+ {{ doc.title or doc.name }} +
+