chore: Patches for Website Item

- Patch to make website item from item
- Patch to move Products and Shopping Cart Settings into E Commerce Settings
- Patch to move products in Homepage from Item to Website Item
- Minor cleanup, replacing/removing references to Item website fields (obsolete)
This commit is contained in:
marination
2021-02-23 14:06:38 +05:30
parent f1ce418bdc
commit 37a246e738
11 changed files with 142 additions and 13 deletions

View File

@@ -16,12 +16,14 @@ class Homepage(Document):
delete_page_cache('home')
def setup_items(self):
for d in frappe.get_all('Item', fields=['name', 'item_name', 'description', 'image'],
filters={'published_in_website': 1}, limit=3):
for d in frappe.get_all('Website Item', fields=['name', 'item_name', 'description', 'image', 'route'],
filters={'published': 1}, limit=3):
doc = frappe.get_doc('Item', d.name)
doc = frappe.get_doc('Website Item', d.name)
if not doc.route:
# set missing route
doc.save()
self.append('products', dict(item_code=d.name,
item_name=d.item_name, description=d.description, image=d.image))
item_name=d.item_name, description=d.description,
image=d.image, route=d.route))