Full Code of frappe/webshop for AI

develop 3afd734a495d cached
178 files
478.3 KB
136.8k tokens
442 symbols
1 requests
Download .txt
Showing preview only (527K chars total). Download the full file or copy to clipboard to get everything.
Repository: frappe/webshop
Branch: develop
Commit: 3afd734a495d
Files: 178
Total size: 478.3 KB

Directory structure:
gitextract_ql1pgvwn/

├── .github/
│   └── workflows/
│       ├── ci.yml
│       └── semgroup-rules.yml
├── .gitignore
├── LICENSE
├── README.md
├── pyproject.toml
└── webshop/
    ├── __init__.py
    ├── config/
    │   └── __init__.py
    ├── hooks.py
    ├── modules.txt
    ├── patches/
    │   ├── __init__.py
    │   ├── add_homepage_field.py
    │   ├── clear_cache_for_item_group_route.py
    │   ├── convert_to_website_item_in_item_card_group_template.py
    │   ├── copy_custom_field_filters_to_website_item.py
    │   ├── create_website_items.py
    │   ├── enable_allow_to_guest_view_for_item_group.py
    │   ├── fetch_thumbnail_in_website_items.py
    │   ├── make_homepage_products_website_items.py
    │   ├── populate_e_commerce_settings.py
    │   └── shopping_cart_to_ecommerce.py
    ├── patches.txt
    ├── public/
    │   ├── .gitkeep
    │   ├── js/
    │   │   ├── customer_reviews.js
    │   │   ├── init.js
    │   │   ├── override/
    │   │   │   ├── homepage.js
    │   │   │   └── item.js
    │   │   ├── product_ui/
    │   │   │   ├── grid.js
    │   │   │   ├── list.js
    │   │   │   ├── search.js
    │   │   │   └── views.js
    │   │   ├── shopping_cart.js
    │   │   └── wishlist.js
    │   ├── scss/
    │   │   ├── webshop-web.bundle.scss
    │   │   └── webshop_cart.scss
    │   └── web.bundle.js
    ├── setup/
    │   └── install.py
    ├── templates/
    │   ├── __init__.py
    │   ├── generators/
    │   │   ├── item/
    │   │   │   ├── item.html
    │   │   │   ├── item_add_to_cart.html
    │   │   │   ├── item_configure.html
    │   │   │   ├── item_configure.js
    │   │   │   ├── item_details.html
    │   │   │   ├── item_image.html
    │   │   │   ├── item_inquiry.html
    │   │   │   ├── item_inquiry.js
    │   │   │   ├── item_reviews.html
    │   │   │   └── item_specifications.html
    │   │   └── item_group.html
    │   ├── includes/
    │   │   ├── cart/
    │   │   │   ├── address_card.html
    │   │   │   ├── address_picker_card.html
    │   │   │   ├── cart_address.html
    │   │   │   ├── cart_address_picker.html
    │   │   │   ├── cart_dropdown.html
    │   │   │   ├── cart_items.html
    │   │   │   ├── cart_items_dropdown.html
    │   │   │   ├── cart_items_total.html
    │   │   │   ├── cart_macros.html
    │   │   │   ├── cart_payment_summary.html
    │   │   │   ├── coupon_code.html
    │   │   │   └── place_order.html
    │   │   ├── macros.html
    │   │   ├── navbar/
    │   │   │   └── navbar_items.html
    │   │   ├── order/
    │   │   │   ├── order_macros.html
    │   │   │   └── order_taxes.html
    │   │   └── product_page.js
    │   └── pages/
    │       ├── __init__.py
    │       ├── cart.html
    │       ├── cart.js
    │       ├── cart.py
    │       ├── customer_reviews.html
    │       ├── customer_reviews.py
    │       ├── order.html
    │       ├── order.js
    │       ├── order.py
    │       ├── product_search.html
    │       ├── product_search.py
    │       ├── wishlist.html
    │       └── wishlist.py
    ├── webshop/
    │   ├── __init__.py
    │   ├── api.py
    │   ├── crud_events/
    │   │   ├── __init__.py
    │   │   ├── item/
    │   │   │   ├── __init__.py
    │   │   │   ├── invalidate_item_variants_cache.py
    │   │   │   ├── update_website_item.py
    │   │   │   └── validate_duplicate_website_item.py
    │   │   ├── price_list/
    │   │   │   ├── __init__.py
    │   │   │   └── check_impact_on_cart.py
    │   │   ├── quotation/
    │   │   │   ├── __init__.py
    │   │   │   └── validate_shopping_cart_items.py
    │   │   └── tax_rule/
    │   │       ├── __init__.py
    │   │       └── validate_use_for_cart.py
    │   ├── doctype/
    │   │   ├── __init__.py
    │   │   ├── homepage_featured_product/
    │   │   │   ├── __init__.py
    │   │   │   ├── homepage_featured_product.json
    │   │   │   └── homepage_featured_product.py
    │   │   ├── item_review/
    │   │   │   ├── __init__.py
    │   │   │   ├── item_review.js
    │   │   │   ├── item_review.json
    │   │   │   ├── item_review.py
    │   │   │   └── test_item_review.py
    │   │   ├── override_doctype/
    │   │   │   ├── __init__.py
    │   │   │   ├── item.py
    │   │   │   ├── item_group.py
    │   │   │   └── payment_request.py
    │   │   ├── recommended_items/
    │   │   │   ├── __init__.py
    │   │   │   ├── recommended_items.json
    │   │   │   └── recommended_items.py
    │   │   ├── webshop_settings/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_webshop_settings.py
    │   │   │   ├── webshop_settings.js
    │   │   │   ├── webshop_settings.json
    │   │   │   └── webshop_settings.py
    │   │   ├── website_item/
    │   │   │   ├── __init__.py
    │   │   │   ├── templates/
    │   │   │   │   ├── website_item.html
    │   │   │   │   └── website_item_row.html
    │   │   │   ├── test_website_item.py
    │   │   │   ├── website_item.js
    │   │   │   ├── website_item.json
    │   │   │   ├── website_item.py
    │   │   │   └── website_item_list.js
    │   │   ├── website_item_tabbed_section/
    │   │   │   ├── __init__.py
    │   │   │   ├── website_item_tabbed_section.json
    │   │   │   └── website_item_tabbed_section.py
    │   │   ├── website_offer/
    │   │   │   ├── __init__.py
    │   │   │   ├── website_offer.json
    │   │   │   └── website_offer.py
    │   │   ├── wishlist/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_wishlist.py
    │   │   │   ├── wishlist.js
    │   │   │   ├── wishlist.json
    │   │   │   └── wishlist.py
    │   │   └── wishlist_item/
    │   │       ├── __init__.py
    │   │       ├── wishlist_item.json
    │   │       └── wishlist_item.py
    │   ├── legacy_search.py
    │   ├── product_data_engine/
    │   │   ├── filters.py
    │   │   ├── query.py
    │   │   ├── test_item_group_product_data_engine.py
    │   │   └── test_product_data_engine.py
    │   ├── redisearch_utils.py
    │   ├── shopping_cart/
    │   │   ├── __init__.py
    │   │   ├── cart.py
    │   │   ├── product_info.py
    │   │   ├── test_shopping_cart.py
    │   │   └── utils.py
    │   ├── utils/
    │   │   ├── __init__.py
    │   │   ├── portal.py
    │   │   ├── product.py
    │   │   └── setup.py
    │   ├── variant_selector/
    │   │   ├── __init__.py
    │   │   ├── item_variants_cache.py
    │   │   ├── test_variant_selector.py
    │   │   └── utils.py
    │   └── web_template/
    │       ├── __init__.py
    │       ├── hero_slider/
    │       │   ├── __init__.py
    │       │   ├── hero_slider.html
    │       │   └── hero_slider.json
    │       ├── item_card_group/
    │       │   ├── __init__.py
    │       │   ├── item_card_group.html
    │       │   └── item_card_group.json
    │       ├── product_card/
    │       │   ├── __init__.py
    │       │   ├── product_card.html
    │       │   └── product_card.json
    │       └── product_category_cards/
    │           ├── __init__.py
    │           ├── product_category_cards.html
    │           └── product_category_cards.json
    └── www/
        ├── __init__.py
        ├── all-products/
        │   ├── __init__.py
        │   ├── index.html
        │   ├── index.js
        │   ├── index.py
        │   └── not_found.html
        └── shop-by-category/
            ├── __init__.py
            ├── category_card_section.html
            ├── index.html
            ├── index.js
            └── index.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/workflows/ci.yml
================================================
name: CI

on:
  pull_request:
    paths-ignore:
      - "**.css"
      - "**.js"
      - "**.md"
      - "**.html"
      - "**.csv"
  schedule:
    # Run everday at midnight UTC / 5:30 IST
    - cron: "0 0 * * *"

env:
  WEBSHOP_BRANCH: ${{ github.base_ref || github.ref_name }}

concurrency:
  group: develop-webshop-${{ github.event.number }}
  cancel-in-progress: true

jobs:
  tests:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
    name: Server
    
    services:
      redis-cache:
        image: redis:alpine
        ports:
          - 13000:6379
      redis-queue:
        image: redis:alpine
        ports:
          - 11000:6379
      mariadb:
        image: mariadb:10.6
        env:
          MYSQL_ROOT_PASSWORD: root
        ports:
          - 3306:3306
        options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3
    
    steps:
      - name: Clone
        uses: actions/checkout@v3
      
      - name: Find tests
        run: |
          echo "Finding tests"
          grep -rn "def test" > /dev/null
      
      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'
      
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 18
          check-latest: true
      
      - name: Cache pip
        uses: actions/cache@v4
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml', '**/setup.py', '**/setup.cfg') }}
          restore-keys: |
            ${{ runner.os }}-pip-
            ${{ runner.os }}-
      
      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: 'echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT'
      
      - uses: actions/cache@v4
        id: yarn-cache
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-
      
      - name: Install MariaDB Client
        run: sudo apt update && sudo apt-get install mariadb-client
      
      - name: Setup
        run: |
          pip install frappe-bench
          bench init --frappe-branch $WEBSHOP_BRANCH --skip-redis-config-generation --skip-assets --python "$(which python)" ~/frappe-bench
          mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL character_set_server = 'utf8mb4'"
          mariadb --host 127.0.0.1 --port 3306 -u root -proot -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'"
      
      - name: Install
        working-directory: /home/runner/frappe-bench
        run: |
          bench setup requirements --dev
          bench get-app erpnext --branch $WEBSHOP_BRANCH
          bench get-app payments --branch $WEBSHOP_BRANCH
          bench get-app $GITHUB_WORKSPACE
          bench new-site --db-root-password root --admin-password admin test_site
          bench --site test_site install-app erpnext
          bench --site test_site install-app webshop
          bench build
        env:
          CI: 'Yes'
      
      - name: Run Tests
        working-directory: /home/runner/frappe-bench
        run: |
          bench --site test_site set-config allow_tests true
          bench --site test_site run-tests --app webshop
        env:
          TYPE: server

================================================
FILE: .github/workflows/semgroup-rules.yml
================================================
name: Linters

on:
  pull_request: { }

jobs:
  linters:
    name: Frappe Linter
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: Download Semgrep rules
        run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules

      - name: Download semgrep
        run: pip install semgrep

      - name: Run Semgrep rules
        run: semgrep ci --config ./frappe-semgrep-rules/rules


================================================
FILE: .gitignore
================================================
**/__pycache__
*.egg-info
*.pyc
*.py~
*.swo
*.swp
*~
.DS_Store
.backportrc.json
.idea/
.vscode/
.wnf-lang-status
__pycache__
conf.py
dist/
webshop/docs/current
webshop/public/dist
latest_updates.json
locale
node_modules/
tags


================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.



================================================
FILE: README.md
================================================
# Frappe Webshop
Frappe Webshop is an Open Source eCommerce Platform, developed primarily using Python and JavaScript. Frappe Webshop was developed as part of the Frappe framework, which is designed to help developers quickly create business applications with minimal code by offering a combination of easy to use front-end and back-end development tools. Frappe Webshop is specifically targeted to help *small to medium sized businesses* with increasing their digital presence and being able to easily create online stores for their brands. Frappe Webshop can be integrated with ERPNext, which is an enterprise resource planning system used by businesses to record all their transactions in a single system. Frappe Webshop emphasizes simplicity, customization, and clean interfaces, providing businesses with the ability to create a tailored user experience both efficently and for free. 
## Table of Contents
- [Table of Contents](https://github.com/frappe/webshop#table-of-contents)
- [Why choose Frappe Webshop?](https://github.com/frappe/webshop/#why-choose-frappe-webshop)
- [Example Frappe Webshop Interface](https://github.com/frappe/webshop/#example-frappe-webshop-interface)
- [Features](https://github.com/frappe/webshop/#features)
- [Setup](https://github.com/frappe/webshop/#setup)
    - [Installation using Docker](https://github.com/frappe/webshop/#installation-using-docker)
    - [Easy Install Script](https://github.com/frappe/webshop/#easy-install-script)
    - [Manual Installation](https://github.com/frappe/webshop/#manual-installation)
- [Usage](https://github.com/frappe/webshop/#usage)
- [Contributing](https://github.com/frappe/webshop/#contributing)
- [License](https://github.com/frappe/webshop/#license)

## Why choose Frappe Webshop?
- **Fast and Efficient**: Streamlined online sales process, offering a shopping experience that can quickly be developed to meet the needs of any business.

- **Personalized and Customizable**: Webshops are highly customizable, providing features and designs that businesses choose and allowing for effective customer engagement with the products.

- **Dynamic and Scalable**: Webshops can be easily adapted to fit business goals and to provide a seamless user experience for businesses small and large.

- **Ease of use**: Wesbhop is designed to require minimal technical knowledge for developers, making it accessible for any business looking to develop an online commerce presence.

- **Control and security**: Webshop is self-hosted, meaning that businesses have complete control over their own data and providing a secure environment for customer data.
  
- **Open source**: The Webshop platform is completely *free* to use, providing a cost-effective way for businesses to develop digital storefronts and market their brands online. Being open source also means that there are continuous improvements being made to the platform.

## Example Frappe Webshop Interface
![Frappe Webshop](webshop.png)

## Features
- **Product Management**: Add, edit, and manage products with the ability to add descriptions, images, variants, and inventory counts.
    - **Inventory Control**: Real-time stock updates to ensure that product supply can be easily tracked.
- **Multiple Payment Options**: Integration with popular payment options like Paypal or Stripe, allowing secure and convenient transactions.
- **User Accounts**: Customers can create accounts and save their information, allowing for convenient checkout and personalized experiences.
    - **Wishlist and Cart Functions**: Let customers save their favorites and revisit them later for easier purchases.
    - **Order Tracking**: Keep customers informed and provide updates on the status of their orders.
- **Advanced Search and Filters**: Advanced search tools and product filters to allow customers to quickly find products they want.
- **Customer Reviews and Ratings**: Customers can share their experiences and product ratings.
- **Integration with ERPNext**: Integration with ERPNext allows for management of inventory, billing, and order processing in one place.
- **User-friendly interface**: Frappe Webshop emphasizes ease of use, with a focus on creating simple, yet effective websites.

## Setup
1. Install [bench](https://github.com/frappe/bench).
   #### Installation using Docker
   ```sh
   $ git clone https://github.com/frappe/frappe_docker.git
   $ cd frappe_docker
   ```
   See more details here: [Containerized Installation](https://github.com/frappe/bench#containerized-installation)
   #### Easy Install Script
   ```sh
   $ wget https://raw.githubusercontent.com/frappe/bench/develop/easy-install.py
   $ python3 easy-install.py --prod --email your@email.tld
   ```
   See more details here: [Easy Install Script](https://github.com/frappe/bench#easy-install-script)
   #### Manual Installation (*recommended only for local development*)
   ```sh
   $ pip install frappe-bench
   ```
   See more details here: [Manual Installation](https://github.com/frappe/bench#manual-installation)

   ##### Bench
   More information on [usage of bench and its commands](https://github.com/frappe/bench#basic-usage).
2. Install ERPNext (only required if bench was installed using manual installation).
3. Once ERPNext is installed, add the webshop app to your bench by running

    ```sh
    $ bench get-app webshop
    ```
4. After that, you can install the webshop app on the required site by running
    ```sh
    $ bench --site sitename install-app webshop
    ```

## Usage
Once setup has been completed, eCommerce features can be set up. This [guide](https://docs.erpnext.com/docs/user/manual/en/set_up_e_commerce) explains how to begin setup of the eCommerce features in conjunction with ERPNext. Many common features and customization options are explained, providing a solid framework for users to get started with building their eCommerce platforms. Note that for best results, users should have some Items setup using ERPNext before attempting to create a store. Creating items is a simple process that can be done through the Webshop interface by accessing > Home > Stock > Items and Pricing > Item.

## Contributing
To contribute to the development of the Frappe Webshop, please make a fork of this repository and make edits within the forked repository. Once satisfied that a contribution should be deployed, create a pull request from your forked repository to this repository. Changes that are accepted will be merged into the main development branch and thus be rolled out to users. To make changes using the bench command line interface, make a clone of this repo using the following command:
```sh
$ git clone https://github.com/frappe/webshop.git
```
For more information on using the bench command line interface, please reference this [page](https://github.com/frappe/bench#development).

## License
Licensed under the GNU GENERAL PUBLIC LICENSE V3. This is an open-source project meant to help businesses create online commerce platforms. (See [LICENSE](LICENSE) for more information).


================================================
FILE: pyproject.toml
================================================
[project]
name = "webshop"
authors = [
    { name = "Frappe Technologies Pvt. Ltd.", email = "contact@frappe.io"}
]
description = "Open Source eCommerce Platform"
requires-python = ">=3.10"
readme = "README.md"
dynamic = ["version"]
dependencies = []

[build-system]
requires = ["flit_core >=3.4,<4"]
build-backend = "flit_core.buildapi"

[tool.black]
line-length = 99

[tool.isort]
line_length = 99
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
indent = "\t"


================================================
FILE: webshop/__init__.py
================================================

__version__ = '0.0.1'



================================================
FILE: webshop/config/__init__.py
================================================


================================================
FILE: webshop/hooks.py
================================================
from . import __version__ as _version

app_name = "webshop"
app_title = "Webshop"
app_publisher = "Frappe Technologies Pvt. Ltd."
app_description = "Open Source eCommerce Platform"
app_email = "contact@frappe.io"
app_license = "GNU General Public License (v3)"
app_version = _version

required_apps = ["payments", "erpnext"]

web_include_css = "webshop-web.bundle.css"

web_include_js = "web.bundle.js"

after_install = "webshop.setup.install.after_install"
on_logout = "webshop.webshop.shopping_cart.utils.clear_cart_count"
on_session_creation = [
    "webshop.webshop.utils.portal.update_debtors_account",
    "webshop.webshop.shopping_cart.utils.set_cart_count",
]
update_website_context = [
    "webshop.webshop.shopping_cart.utils.update_website_context",
]

website_generators = ["Website Item", "Item Group"]

override_doctype_class = {
    "Payment Request": "webshop.webshop.doctype.override_doctype.payment_request.PaymentRequest",
    "Item Group": "webshop.webshop.doctype.override_doctype.item_group.WebshopItemGroup",
    "Item": "webshop.webshop.doctype.override_doctype.item.WebshopItem",
}

doctype_js = {
    "Item": "public/js/override/item.js",
    "Homepage": "public/js/override/homepage.js",
}

doc_events = {
    "Item": {
        "on_update": [
            "webshop.webshop.crud_events.item.update_website_item.execute",
            "webshop.webshop.crud_events.item.invalidate_item_variants_cache.execute",
        ],
        "before_rename": [
            "webshop.webshop.crud_events.item.validate_duplicate_website_item.execute",
        ],
        "after_rename": [
            "webshop.webshop.crud_events.item.invalidate_item_variants_cache.execute",
        ],
    },
    "Sales Taxes and Charges Template": {
        "on_update": [
            "webshop.webshop.doctype.webshop_settings.webshop_settings.validate_cart_settings",
        ],
    },
    "Quotation": {
        "validate": [
            "webshop.webshop.crud_events.quotation.validate_shopping_cart_items.execute",
        ],
    },
    "Price List": {
        "validate": [
            "webshop.webshop.crud_events.price_list.check_impact_on_cart.execute"
        ],
    },
    "Tax Rule": {
        "validate": [
            "webshop.webshop.crud_events.tax_rule.validate_use_for_cart.execute",
        ],
    },
}

has_website_permission = {
    "Website Item": "webshop.webshop.doctype.website_item.website_item.has_website_permission_for_website_item",
    "Item Group": "webshop.webshop.doctype.website_item.website_item.has_website_permission_for_item_group"
}


================================================
FILE: webshop/modules.txt
================================================
Webshop

================================================
FILE: webshop/patches/__init__.py
================================================

__version__ = '0.0.1'



================================================
FILE: webshop/patches/add_homepage_field.py
================================================
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields


def execute():
	if not frappe.db.exists("DocType", "Homepage"):
		return
	if not frappe.db.exists("Custom Field", {"fieldname": "products", "dt": "Homepage"}):
		custom_fields = {
			"Homepage": [
				dict(
					fieldname="products_section_break",
					label="Products",
					fieldtype="Section Break",
					insert_after="hero_section",
				),
				dict(
					fieldname="products_url",
					label="URL for All Products",
					fieldtype="Data",
					insert_after="products_section_break",
				),
				dict(
					fieldname="products",
					label="Products",
					fieldtype="Table",
					insert_after="products_url",
					options="Homepage Featured Product",
				),
			],
		}

		create_custom_fields(custom_fields)


================================================
FILE: webshop/patches/clear_cache_for_item_group_route.py
================================================
import frappe
from frappe.website.utils import clear_cache

def execute():
	routes = frappe.get_all("Item Group", filters={"show_in_website": 1, "route": ("is", "set")}, pluck="route")
	for route in routes:
		clear_cache(route)

================================================
FILE: webshop/patches/convert_to_website_item_in_item_card_group_template.py
================================================
import json
from typing import List, Union

import frappe

from webshop.webshop.doctype.website_item.website_item import make_website_item


def execute():
	"""
	Convert all Item links to Website Item link values in
	exisitng 'Item Card Group' Web Page Block data.
	"""
	frappe.reload_doc("webshop", "web_template", "item_card_group")

	blocks = frappe.db.get_all(
		"Web Page Block",
		filters={"web_template": "Item Card Group"},
		fields=["parent", "web_template_values", "name"],
	)

	fields = generate_fields_to_edit()

	for block in blocks:
		web_template_value = json.loads(block.get("web_template_values"))

		for field in fields:
			item = web_template_value.get(field)
			if not item:
				continue

			if frappe.db.exists("Website Item", {"item_code": item}):
				website_item = frappe.db.get_value("Website Item", {"item_code": item})
			else:
				website_item = make_new_website_item(item)

			if website_item:
				web_template_value[field] = website_item

		frappe.db.set_value(
			"Web Page Block", block.name, "web_template_values", json.dumps(web_template_value)
		)


def generate_fields_to_edit() -> List:
	fields = []
	for i in range(1, 13):
		fields.append(f"card_{i}_item")  # fields like 'card_1_item', etc.

	return fields


def make_new_website_item(item: str) -> Union[str, None]:
	try:
		doc = frappe.get_doc("Item", item)
		web_item = make_website_item(doc)  # returns [website_item.name, item_name]
		return web_item[0]
	except Exception:
		doc.log_error("Website Item creation failed")
		return None

================================================
FILE: webshop/patches/copy_custom_field_filters_to_website_item.py
================================================
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_field

from webshop.webshop.utils.setup import has_ecommerce_fields

def execute():
	"Add Field Filters, that are not standard fields in Website Item, as Custom Fields."

	def move_table_multiselect_data(docfield):
		"Copy child table data (Table Multiselect) from Item to Website Item for a docfield."
		table_multiselect_data = get_table_multiselect_data(docfield)
		field = docfield.fieldname

		for row in table_multiselect_data:
			# add copied multiselect data rows in Website Item
			web_item = frappe.db.get_value("Website Item", {"item_code": row.parent})
			web_item_doc = frappe.get_doc("Website Item", web_item)

			child_doc = frappe.new_doc(docfield.options, parent_doc=web_item_doc, parentfield=field)

			for field in ["name", "creation", "modified", "idx"]:
				row[field] = None

			child_doc.update(row)

			child_doc.parenttype = "Website Item"
			child_doc.parent = web_item

			child_doc.insert()

	def get_table_multiselect_data(docfield):
		child_table = frappe.qb.DocType(docfield.options)
		item = frappe.qb.DocType("Item")

		table_multiselect_data = (  # query table data for field
			frappe.qb.from_(child_table)
			.join(item)
			.on(item.item_code == child_table.parent)
			.select(child_table.star)
			.where((child_table.parentfield == docfield.fieldname) & (item.published_in_website == 1))
		).run(as_dict=True)

		return table_multiselect_data

	settings_doctype = "E Commerce Settings" if has_ecommerce_fields() else "Webshop Settings"

	settings = frappe.get_doc(settings_doctype)

	if not (settings.enable_field_filters or settings.filter_fields):
		return

	item_meta = frappe.get_meta("Item")
	valid_item_fields = [
		df.fieldname for df in item_meta.fields if df.fieldtype in ["Link", "Table MultiSelect"]
	]

	web_item_meta = frappe.get_meta("Website Item")
	valid_web_item_fields = [
		df.fieldname for df in web_item_meta.fields if df.fieldtype in ["Link", "Table MultiSelect"]
	]

	for row in settings.filter_fields:
		# skip if illegal field
		if row.fieldname not in valid_item_fields:
			continue

		# if Item field is not in Website Item, add it as a custom field
		if row.fieldname not in valid_web_item_fields:
			df = item_meta.get_field(row.fieldname)
			create_custom_field(
				"Website Item",
				dict(
					owner="Administrator",
					fieldname=df.fieldname,
					label=df.label,
					fieldtype=df.fieldtype,
					options=df.options,
					description=df.description,
					read_only=df.read_only,
					no_copy=df.no_copy,
					insert_after="on_backorder",
				),
			)

			# map field values
			if df.fieldtype == "Table MultiSelect":
				move_table_multiselect_data(df)
			else:
				frappe.db.sql(  # nosemgrep
					"""
						UPDATE `tabWebsite Item` wi, `tabItem` i
						SET wi.{0} = i.{0}
						WHERE wi.item_code = i.item_code
					""".format(
						row.fieldname
					)
				)

================================================
FILE: webshop/patches/create_website_items.py
================================================
import frappe

from webshop.webshop.doctype.website_item.website_item import make_website_item


def execute():
	if frappe.get_all("Website Item", limit=1):
		return

	frappe.reload_doc("webshop", "doctype", "website_item")
	frappe.reload_doc("webshop", "doctype", "website_item_tabbed_section")
	frappe.reload_doc("webshop", "doctype", "website_offer")
	frappe.reload_doc("webshop", "doctype", "recommended_items")
	frappe.reload_doc("webshop", "doctype", "webshop_settings")
	frappe.reload_doc("stock", "doctype", "item")

	item_fields = [
		"item_code",
		"item_name",
		"item_group",
		"stock_uom",
		"brand",
		"has_variants",
		"variant_of",
		"description",
		"weightage",
	]
	web_fields_to_map = [
		"route",
		"slideshow",
		"website_image_alt",
		"website_warehouse",
		"web_long_description",
		"website_content",
		"website_image",
		"thumbnail",
	]

	# get all valid columns (fields) from Item master DB schema
	item_table_fields = frappe.db.sql("desc `tabItem`", as_dict=1)  # nosemgrep
	item_table_fields = [d.get("Field") for d in item_table_fields]

	# prepare fields to query from Item, check if the web field exists in Item master
	web_query_fields = []
	for web_field in web_fields_to_map:
		if web_field in item_table_fields:
			web_query_fields.append(web_field)
			item_fields.append(web_field)

	# check if the filter fields exist in Item master
	or_filters = {}
	for field in ["show_in_website", "show_variant_in_website"]:
		if field in item_table_fields:
			or_filters[field] = 1

	if not web_query_fields or not or_filters:
		# web fields to map are not present in Item master schema
		# most likely a fresh installation that doesnt need this patch
		return

	items = frappe.db.get_all("Item", fields=item_fields, or_filters=or_filters)
	total_count = len(items)

	for count, item in enumerate(items, start=1):
		if frappe.db.exists("Website Item", {"item_code": item.item_code}):
			continue

		# make new website item from item (publish item)
		website_item = make_website_item(item, save=False)
		website_item.ranking = item.get("weightage")

		for field in web_fields_to_map:
			website_item.update({field: item.get(field)})

		website_item.save()

		# move Website Item Group & Website Specification table to Website Item
		for doctype in ("Website Item Group", "Item Website Specification"):
			frappe.db.set_value(
				doctype,
				{"parenttype": "Item", "parent": item.item_code},  # filters
				{"parenttype": "Website Item", "parent": website_item.name},  # value dict
			)

		if count % 20 == 0:  # commit after every 20 items
			frappe.db.commit()

		frappe.utils.update_progress_bar("Creating Website Items", count, total_count)


================================================
FILE: webshop/patches/enable_allow_to_guest_view_for_item_group.py
================================================
import frappe
from frappe.custom.doctype.property_setter.property_setter import make_property_setter

def execute():
	frappe.reload_doc("setup", "doctype", "item_group")

	make_property_setter("Item Group", "", "has_web_view", 1, "Check", for_doctype=True, validate_fields_for_doctype=False)
	make_property_setter("Item Group", "", "allow_guest_to_view", 1, "Check", for_doctype=True, validate_fields_for_doctype=False)


================================================
FILE: webshop/patches/fetch_thumbnail_in_website_items.py
================================================
import frappe


def execute():
	if frappe.db.has_column("Item", "thumbnail"):
		website_item = frappe.qb.DocType("Website Item").as_("wi")
		item = frappe.qb.DocType("Item")

		frappe.qb.update(website_item).inner_join(item).on(website_item.item_code == item.item_code).set(
			website_item.thumbnail, item.thumbnail
		).where(website_item.website_image.notnull() & website_item.thumbnail.isnull()).run()

================================================
FILE: webshop/patches/make_homepage_products_website_items.py
================================================
import frappe


def execute():
	if not frappe.db.exists("DocType", "Homepage"):
		return
	homepage = frappe.get_doc("Homepage")

	for row in homepage.products:
		web_item = frappe.db.get_value("Website Item", {"item_code": row.item_code}, "name")
		if not web_item:
			continue

		row.item_code = web_item

	homepage.flags.ignore_mandatory = True
	homepage.save()

================================================
FILE: webshop/patches/populate_e_commerce_settings.py
================================================
import frappe
from frappe.utils import cint

from webshop.webshop.utils.setup import has_ecommerce_fields

def execute():
	frappe.reload_doc("webshop", "doctype", "webshop_settings")
	frappe.reload_doc("portal", "doctype", "website_filter_field")
	frappe.reload_doc("portal", "doctype", "website_attribute")

	products_settings_fields = [
		"hide_variants",
		"products_per_page",
		"enable_attribute_filters",
		"enable_field_filters",
	]

	shopping_cart_settings_fields = [
		"enabled",
		"show_attachments",
		"show_price",
		"show_stock_availability",
		"enable_variants",
		"show_contact_us_button",
		"show_quantity_in_website",
		"show_apply_coupon_code_in_website",
		"allow_items_not_in_stock",
		"company",
		"price_list",
		"default_customer_group",
		"quotation_series",
		"enable_checkout",
		"payment_success_url",
		"payment_gateway_account",
		"save_quotations_as_draft",
	]

	settings_doctype = "E Commerce Settings" if has_ecommerce_fields() else "Webshop Settings"

	settings = frappe.get_doc(settings_doctype)

	def map_into_e_commerce_settings(doctype, fields):
		singles = frappe.qb.DocType("Singles")
		query = (
			frappe.qb.from_(singles)
			.select(singles["field"], singles.value)
			.where((singles.doctype == doctype) & (singles["field"].isin(fields)))
		)
		data = query.run(as_dict=True)

		# {'enable_attribute_filters': '1', ...}
		mapper = {row.field: row.value for row in data}

		for key, value in mapper.items():
			value = cint(value) if (value and value.isdigit()) else value
			settings.update({key: value})

		settings.save()

	# shift data to E Commerce Settings
	map_into_e_commerce_settings("Products Settings", products_settings_fields)
	map_into_e_commerce_settings("Shopping Cart Settings", shopping_cart_settings_fields)

	# move filters and attributes tables to E Commerce Settings from Products Settings
	for doctype in ("Website Filter Field", "Website Attribute"):
		frappe.db.set_value(
			doctype,
			{"parent": "Products Settings"},
			{"parenttype": settings_doctype, "parent": settings_doctype},
			update_modified=False,
		)

================================================
FILE: webshop/patches/shopping_cart_to_ecommerce.py
================================================
import click
import frappe


def execute():

	frappe.delete_doc("DocType", "Shopping Cart Settings", ignore_missing=True)
	frappe.delete_doc("DocType", "Products Settings", ignore_missing=True)
	frappe.delete_doc("DocType", "Supplier Item Group", ignore_missing=True)


================================================
FILE: webshop/patches.txt
================================================
[pre_model_sync]

[post_model_sync]

webshop.patches.add_homepage_field #09-05-2024
webshop.patches.enable_allow_to_guest_view_for_item_group
webshop.patches.clear_cache_for_item_group_route

================================================
FILE: webshop/public/.gitkeep
================================================


================================================
FILE: webshop/public/js/customer_reviews.js
================================================
$(() => {
	class CustomerReviews {
		constructor() {
			this.bind_button_actions();
			this.start = 0;
			this.page_length = 10;
		}

		bind_button_actions() {
			this.write_review();
			this.view_more();
		}

		write_review() {
			//TODO: make dialog popup on stray page
			$('.page_content').on('click', '.btn-write-review', (e) => {
				// Bind action on write a review button
				const $btn = $(e.currentTarget);

				let d = new frappe.ui.Dialog({
					title: __("Write a Review"),
					fields: [
						{fieldname: "title", fieldtype: "Data", label: "Headline", reqd: 1},
						{fieldname: "rating", fieldtype: "Rating", label: "Overall Rating", reqd: 1},
						{fieldtype: "Section Break"},
						{fieldname: "comment", fieldtype: "Small Text", label: "Your Review"}
					],
					primary_action: function() {
						let data = d.get_values();
						frappe.call({
							method: "webshop.webshop.doctype.item_review.item_review.add_item_review",
							args: {
								web_item: $btn.attr('data-web-item'),
								title: data.title,
								rating: data.rating,
								comment: data.comment
							},
							freeze: true,
							freeze_message: __("Submitting Review ..."),
							callback: (r) => {
								if (!r.exc) {
									frappe.msgprint({
										message: __("Thank you for submitting your review"),
										title: __("Review Submitted"),
										indicator: "green"
									});
									d.hide();
									location.reload();
								}
							}
						});
					},
					primary_action_label: __("Submit")
				});
				d.show();
			});
		}

		view_more() {
			$('.page_content').on('click', '.btn-view-more', (e) => {
				// Bind action on view more button
				const $btn = $(e.currentTarget);
				$btn.prop('disabled', true);

				this.start += this.page_length;
				let me = this;

				frappe.call({
					method: "webshop.webshop.doctype.item_review.item_review.get_item_reviews",
					args: {
						web_item: $btn.attr('data-web-item'),
						start: me.start,
						end: me.page_length
					},
					callback: (result) => {
						if (result.message) {
							let res = result.message;
							me.get_user_review_html(res.reviews);

							$btn.prop('disabled', false);
							if (res.total_reviews <= (me.start + me.page_length)) {
								$btn.hide();
							}

						}
					}
				});
			});

		}

		get_user_review_html(reviews) {
			let me = this;
			let $content = $('.user-reviews');

			reviews.forEach((review) => {
				$content.append(`
					<div class="mb-3 review">
						<div class="d-flex">
							<p class="mr-4 user-review-title">
								<span>${__(review.review_title)}</span>
							</p>
							<div class="rating">
								${me.get_review_stars(review.rating)}
							</div>
						</div>

						<div class="product-description mb-4">
							<p>
								${__(review.comment)}
							</p>
						</div>
						<div class="review-signature mb-2">
							<span class="reviewer">${__(review.customer)}</span>
							<span class="indicator grey" style="--text-on-gray: var(--gray-300);"></span>
							<span class="reviewer">${__(review.published_on)}</span>
						</div>
					</div>
				`);
			});
		}

		get_review_stars(rating) {
			let stars = ``;
			for (let i = 1; i < 6; i++) {
				let fill_class = i <= rating ? 'star-click' : '';
				stars += `
					<svg class="icon icon-sm ${fill_class}">
						<use href="#icon-star"></use>
					</svg>
				`;
			}
			return stars;
		}
	}

	new CustomerReviews();
});


================================================
FILE: webshop/public/js/init.js
================================================
if (!window.webshop) window.webshop = {}
if (!frappe.boot) frappe.boot = {}


================================================
FILE: webshop/public/js/override/homepage.js
================================================
frappe.ui.form.on('Homepage', {
	setup: function(frm) {
		frm.set_query('item_code', 'products', function() {
			return {
				filters: {'published': 1}
			};
		});
	},
});

frappe.ui.form.on('Homepage Featured Product', {
	view: function(frm, cdt, cdn) {
		var child= locals[cdt][cdn];
		if (child.item_code && child.route) {
			window.open('/' + child.route, '_blank');
		}
	}
});


================================================
FILE: webshop/public/js/override/item.js
================================================
frappe.ui.form.on("Item", {
    refresh: function(frm) {
		if (!frm.doc.__islocal) {
			if (!frm.doc.published_in_website) {
				frm.add_custom_button(__("Publish in Website"), function() {
					frappe.call({
						method: "webshop.webshop.doctype.website_item.website_item.make_website_item",
						args: {
							doc: frm.doc,
						},
						freeze: true,
						freeze_message: __("Publishing Item ..."),
						callback: function(result) {
							frappe.msgprint({
								message: __("Website Item {0} has been created.",
									[repl('<a href="/app/website-item/%(item_encoded)s" class="strong">%(item)s</a>', {
										item_encoded: encodeURIComponent(result.message[0]),
										item: result.message[1]
									})]
								),
								title: __("Published"),
								indicator: "green"
							});
						}
					});
				}, __('Actions'));
			} else {
				frm.add_custom_button(__("View Website Item"), function() {
					frappe.db.get_value("Website Item", {item_code: frm.doc.name}, "name", (d) => {
						if (!d.name) frappe.throw(__("Website Item not found"));
						frappe.set_route("Form", "Website Item", d.name);
					});
				});
			}
		}
	}
});


================================================
FILE: webshop/public/js/product_ui/grid.js
================================================
webshop.ProductGrid = class {
	/* Options:
		- items: Items
		- settings: Webshop Settings
		- products_section: Products Wrapper
		- preference: If preference is not grid view, render but hide
	*/
	constructor(options) {
		Object.assign(this, options);

		if (this.preference !== "Grid View") {
			this.products_section.addClass("hidden");
		}

		this.products_section.empty();
		this.make();
	}

	make() {
		let me = this;
		let html = ``;

		this.items.forEach(item => {
			let title = item.web_item_name || item.item_name || item.item_code || "";
			title =  title.length > 90 ? title.substr(0, 90) + "..." : title;

			html += `<div class="col-sm-4 item-card"><div class="card text-left">`;
			html += me.get_image_html(item, title);
			html += me.get_card_body_html(item, title, me.settings);
			html += `</div></div>`;
		});

		let $product_wrapper = this.products_section;
		$product_wrapper.append(html);
	}

	get_image_html(item, title) {
		let image = item.website_image;

		if (image) {
			return `
				<div class="card-img-container">
					<a href="/${ item.route || '#' }" style="text-decoration: none;">
						<img itemprop="image" class="card-img" src="${ image }" alt="${ title }">
					</a>
				</div>
			`;
		} else {
			return `
				<div class="card-img-container">
					<a href="/${ item.route || '#' }" style="text-decoration: none;">
						<div class="card-img-top no-image">
							${ frappe.get_abbr(title) }
						</div>
					</a>
				</div>
			`;
		}
	}

	get_card_body_html(item, title, settings) {
		let body_html = `
			<div class="card-body text-left card-body-flex" style="width:100%">
				<div style="margin-top: 1rem; display: flex;">
		`;
		body_html += this.get_title(item, title);

		// get floating elements
		if (!item.has_variants) {
			if (settings.enable_wishlist) {
				body_html += this.get_wishlist_icon(item);
			}
			if (settings.enabled) {
				body_html += this.get_cart_indicator(item);
			}

		}

		body_html += `</div>`;
		body_html += `<div class="product-category" itemprop="name">${ item.item_group || '' }</div>`;

		if (item.formatted_price) {
			body_html += this.get_price_html(item);
		}

		body_html += this.get_stock_availability(item, settings);
		body_html += this.get_primary_button(item, settings);
		body_html += `</div>`; // close div on line 49

		return body_html;
	}

	get_title(item, title) {
		let title_html = `
			<a href="/${ item.route || '#' }">
				<div class="product-title" itemprop="name">
					${ title || '' }
				</div>
			</a>
		`;
		return title_html;
	}

	get_wishlist_icon(item) {
		let icon_class = item.wished ? "wished" : "not-wished";
		return `
			<div class="like-action ${ item.wished ? "like-action-wished" : ''}"
				data-item-code="${ item.item_code }">
				<svg class="icon sm">
					<use class="${ icon_class } wish-icon" href="#icon-heart"></use>
				</svg>
			</div>
		`;
	}

	get_cart_indicator(item) {
		return `
			<div class="cart-indicator ${item.in_cart ? '' : 'hidden'}" data-item-code="${ item.item_code }">
				1
			</div>
		`;
	}

	get_price_html(item) {
		let price_html = `
			<div class="product-price" itemprop="offers" itemscope itemtype="https://schema.org/AggregateOffer">
				${ item.formatted_price || '' }
		`;

		if (item.formatted_mrp) {
			price_html += `
				<small class="striked-price">
					<s>${ item.formatted_mrp ? item.formatted_mrp.replace(/ +/g, "") : "" }</s>
				</small>
				<small class="ml-1 product-info-green">
					${ item.discount } ${ __("OFF") }
				</small>
			`;
		}
		price_html += `</div>`;
		return price_html;
	}

	get_stock_availability(item, settings) {
		if (settings.show_stock_availability && !item.has_variants) {
			if (item.on_backorder) {
				return `
					<span class="out-of-stock mb-2 mt-1" style="color: var(--primary-color)">
						${ __("Available on backorder") }
					</span>
				`;
			} else if (!item.in_stock) {
				return `
					<span class="out-of-stock mb-2 mt-1">
						${ __("Out of stock") }
					</span>
				`;
			}
		}

		return ``;
	}

	get_primary_button(item, settings) {
		if (item.has_variants) {
			return `
				<a href="/${ item.route || '#' }">
					<div class="btn btn-sm btn-explore-variants w-100 mt-4">
						${ __("Explore") }
					</div>
				</a>
			`;
		} else if (settings.enabled && (settings.allow_items_not_in_stock || item.in_stock)) {
			return `
				<div id="${ item.name }" class="btn
					btn-sm btn-primary btn-add-to-cart-list
					w-100 mt-2 ${ item.in_cart ? 'hidden' : '' }"
					data-item-code="${ item.item_code }">
					<span class="mr-2">
						<svg class="icon icon-md">
							<use href="#icon-assets"></use>
						</svg>
					</span>
					${ settings.enable_checkout ? __("Add to Cart") :  __("Add to Quote") }
				</div>

				<a href="/cart">
					<div id="${ item.name }" class="btn
						btn-sm btn-primary btn-add-to-cart-list
						w-100 mt-4 go-to-cart-grid
						${ item.in_cart ? '' : 'hidden' }"
						data-item-code="${ item.item_code }">
						${ settings.enable_checkout ? __("Go to Cart") :  __("Go to Quote") }
					</div>
				</a>
			`;
		} else {
			return ``;
		}
	}
};


================================================
FILE: webshop/public/js/product_ui/list.js
================================================
webshop.ProductList = class {
	/* Options:
		- items: Items
		- settings: Webshop Settings
		- products_section: Products Wrapper
		- preference: If preference is not list view, render but hide
	*/
	constructor(options) {
		Object.assign(this, options);

		if (this.preference !== "List View") {
			this.products_section.addClass("hidden");
		}

		this.products_section.empty();
		this.make();
	}

	make() {
		let me = this;
		let html = `<br><br>`;

		this.items.forEach(item => {
			let title = item.web_item_name || item.item_name || item.item_code || "";
			title =  title.length > 200 ? title.substr(0, 200) + "..." : title;

			html += `<div class='row list-row w-100 mb-4'>`;
			html += me.get_image_html(item, title, me.settings);
			html += me.get_row_body_html(item, title, me.settings);
			html += `</div>`;
		});

		let $product_wrapper = this.products_section;
		$product_wrapper.append(html);
	}

	get_image_html(item, title, settings) {
		let image = item.website_image;
		let wishlist_enabled = !item.has_variants && settings.enable_wishlist;
		let image_html = ``;

		if (image) {
			image_html += `
				<div class="col-2 border text-center rounded list-image">
					<a class="product-link product-list-link" href="/${ item.route || '#' }">
						<img itemprop="image" class="website-image h-100 w-100" alt="${ title }"
							src="${ image }">
					</a>
					${ wishlist_enabled ? this.get_wishlist_icon(item): '' }
				</div>
			`;
		} else {
			image_html += `
				<div class="col-2 border text-center rounded list-image">
					<a class="product-link product-list-link" href="/${ item.route || '#' }"
						style="text-decoration: none">
						<div class="card-img-top no-image-list">
							${ frappe.get_abbr(title) }
						</div>
					</a>
					${ wishlist_enabled ? this.get_wishlist_icon(item): '' }
				</div>
			`;
		}

		return image_html;
	}

	get_row_body_html(item, title, settings) {
		let body_html = `<div class='col-10 text-left'>`;
		body_html += this.get_title_html(item, title, settings);
		body_html += this.get_item_details(item, settings);
		body_html += `</div>`;
		return body_html;
	}

	get_title_html(item, title, settings) {
		let title_html = `<div style="display: flex; margin-left: -15px;">`;
		title_html += `
			<div class="col-8" style="margin-right: -15px;">
				<a class="" href="/${ item.route || '#' }"
					style="color: var(--gray-800); font-weight: 500;">
					${ title }
				</a>
			</div>
		`;

		if (settings.enabled) {
			title_html += `<div class="col-4 cart-action-container ${item.in_cart ? 'd-flex' : ''}">`;
			title_html += this.get_primary_button(item, settings);
			title_html += `</div>`;
		}
		title_html += `</div>`;

		return title_html;
	}

	get_item_details(item, settings) {
		let details = `
			<p class="product-code">
				${ item.item_group } | ${ __('Item Code') } : ${ item.item_code }
			</p>
			<div class="mt-2" style="color: var(--gray-600) !important; font-size: 13px;">
				${ item.short_description || '' }
			</div>
			<div class="product-price" itemprop="offers" itemscope itemtype="https://schema.org/AggregateOffer">
				${ item.formatted_price || '' }
		`;

		if (item.formatted_mrp) {
			details += `
				<small class="striked-price">
					<s>${ item.formatted_mrp ? item.formatted_mrp.replace(/ +/g, "") : "" }</s>
				</small>
				<small class="ml-1 product-info-green">
					${ item.discount } ${ __("OFF") }
				</small>
			`;
		}

		details += this.get_stock_availability(item, settings);
		details += `</div>`;

		return details;
	}

	get_stock_availability(item, settings) {
		if (settings.show_stock_availability && !item.has_variants) {
			if (item.on_backorder) {
				return `
					<br>
					<span class="out-of-stock mt-2" style="color: var(--primary-color)">
						${ __("Available on backorder") }
					</span>
				`;
			} else if (!item.in_stock) {
				return `
					<br>
					<span class="out-of-stock mt-2">${ __("Out of stock") }</span>
				`;
			} else if (item.is_stock) {
				return `
					<br>
					<span class="in-stock in-green has-stock mt-2"
						style="font-size: 14px;">${ __("In stock") }</span>
				`;
			}
		}
		return ``;
	}

	get_wishlist_icon(item) {
		let icon_class = item.wished ? "wished" : "not-wished";

		return `
			<div class="like-action-list ${ item.wished ? "like-action-wished" : ''}"
				data-item-code="${ item.item_code }">
				<svg class="icon sm">
					<use class="${ icon_class } wish-icon" href="#icon-heart"></use>
				</svg>
			</div>
		`;
	}

	get_primary_button(item, settings) {
		if (item.has_variants) {
			return `
				<a href="/${ item.route || '#' }">
					<div class="btn btn-sm btn-explore-variants btn mb-0 mt-0">
						${ __("Explore") }
					</div>
				</a>
			`;
		} else if (settings.enabled && (settings.allow_items_not_in_stock || item.in_stock)) {
			return `
				<div id="${ item.name }" class="btn
					btn-sm btn-primary btn-add-to-cart-list mb-0
					${ item.in_cart ? 'hidden' : '' }"
					data-item-code="${ item.item_code }"
					style="margin-top: 0px !important; max-height: 30px; float: right;
						padding: 0.25rem 1rem; min-width: 135px;">
					<span class="mr-2">
						<svg class="icon icon-md">
							<use href="#icon-assets"></use>
						</svg>
					</span>
					${ settings.enable_checkout ? __("Add to Cart") :  __("Add to Quote") }
				</div>

				<div class="cart-indicator list-indicator ${item.in_cart ? '' : 'hidden'}">
					1
				</div>

				<a href="/cart">
					<div id="${ item.name }" class="btn
						btn-sm btn-primary btn-add-to-cart-list
						ml-4 go-to-cart mb-0 mt-0
						${ item.in_cart ? '' : 'hidden' }"
						data-item-code="${ item.item_code }"
						style="padding: 0.25rem 1rem; min-width: 135px;">
						${ settings.enable_checkout ? __("Go to Cart") :  __("Go to Quote") }
					</div>
				</a>
			`;
		} else {
			return ``;
		}
	}

};


================================================
FILE: webshop/public/js/product_ui/search.js
================================================
webshop.ProductSearch = class {
	constructor(opts) {
		/* Options: search_box_id (for custom search box) */
		$.extend(this, opts);
		this.MAX_RECENT_SEARCHES = 4;
		this.search_box_id = this.search_box_id || "#search-box";
		this.searchBox = $(this.search_box_id);

		this.setupSearchDropDown();
		this.bindSearchAction();
	}

	setupSearchDropDown() {
		this.search_area = $("#dropdownMenuSearch");
		this.setupSearchResultContainer();
		this.populateRecentSearches();
	}

	bindSearchAction() {
		let me = this;

		// Show Search dropdown
		this.searchBox.on("focus", () => {
			this.search_dropdown.removeClass("hidden");
		});

		// If click occurs outside search input/results, hide results.
		// Click can happen anywhere on the page
		$("body").on("click", (e) => {
			let searchEvent = $(e.target).closest(this.search_box_id).length;
			let resultsEvent = $(e.target).closest('#search-results-container').length;
			let isResultHidden = this.search_dropdown.hasClass("hidden");

			if (!searchEvent && !resultsEvent && !isResultHidden) {
				this.search_dropdown.addClass("hidden");
			}
		});

		// Process search input
		this.searchBox.on("input", (e) => {
			let query = e.target.value;

			if (query.length == 0) {
				me.populateResults(null);
				me.populateCategoriesList(null);
			}

			if (query.length < 3 || !query.length) return;

			frappe.call({
				method: "webshop.templates.pages.product_search.search",
				args: {
					query: query
				},
				callback: (data) => {
					let product_results = null, category_results = null;

					// Populate product results
					product_results = data.message ? data.message.product_results : null;
					me.populateResults(product_results);

					// Populate categories
					if (me.category_container) {
						category_results = data.message ? data.message.category_results : null;
						me.populateCategoriesList(category_results);
					}

					// Populate recent search chips only on successful queries
					if (!$.isEmptyObject(product_results) || !$.isEmptyObject(category_results)) {
						me.setRecentSearches(query);
					}
				}
			});

			this.search_dropdown.removeClass("hidden");
		});
	}

	setupSearchResultContainer() {
		this.search_dropdown = this.search_area.append(`
			<div class="overflow-hidden shadow dropdown-menu w-100 hidden"
				id="search-results-container"
				aria-labelledby="dropdownMenuSearch"
				style="display: flex; flex-direction: column;">
			</div>
		`).find("#search-results-container");

		this.setupCategoryContainer();
		this.setupProductsContainer();
		this.setupRecentsContainer();
	}

	setupProductsContainer() {
		this.products_container = this.search_dropdown.append(`
			<div id="product-results mt-2">
				<div id="product-scroll" style="overflow: scroll; max-height: 300px">
				</div>
			</div>
		`).find("#product-scroll");
	}

	setupCategoryContainer() {
		this.category_container = this.search_dropdown.append(`
			<div class="category-container mt-2 mb-1">
				<div class="category-chips">
				</div>
			</div>
		`).find(".category-chips");
	}

	setupRecentsContainer() {
		let $recents_section = this.search_dropdown.append(`
			<div class="mb-2 mt-2 recent-searches">
				<div>
					<b>${ __("Recent") }</b>
				</div>
			</div>
		`).find(".recent-searches");

		this.recents_container = $recents_section.append(`
			<div id="recents" style="padding: .25rem 0 1rem 0;">
			</div>
		`).find("#recents");
	}

	getRecentSearches() {
		return JSON.parse(localStorage.getItem("recent_searches") || "[]");
	}

	attachEventListenersToChips() {
		let me  = this;
		const chips = $(".recent-search");
		window.chips = chips;

		for (let chip of chips) {
			chip.addEventListener("click", () => {
				me.searchBox[0].value = chip.innerText.trim();

				// Start search with `recent query`
				me.searchBox.trigger("input");
				me.searchBox.focus();
			});
		}
	}

	setRecentSearches(query) {
		let recents = this.getRecentSearches();
		if (recents.length >= this.MAX_RECENT_SEARCHES) {
			// Remove the `first` query
			recents.splice(0, 1);
		}

		if (recents.indexOf(query) >= 0) {
			return;
		}

		recents.push(query);
		localStorage.setItem("recent_searches", JSON.stringify(recents));

		this.populateRecentSearches();
	}

	populateRecentSearches() {
		let recents = this.getRecentSearches();

		if (!recents.length) {
			this.recents_container.html(`<span class=""text-muted">${ __("No searches yet.") }</span>`);
			return;
		}

		let html = "";
		recents.forEach((key) => {
			html += `
				<div class="recent-search mr-1" style="font-size: 13px">
					<span class="mr-2">
						<svg width="20" height="20" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
							<path d="M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14Z" stroke="var(--gray-500)"" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
							<path d="M8.00027 5.20947V8.00017L10 10" stroke="var(--gray-500)" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
						</svg>
					</span>
					${ key }
				</div>
			`;
		});

		this.recents_container.html(html);
		this.attachEventListenersToChips();
	}

	populateResults(product_results) {
		if (!product_results || product_results.length === 0) {
			let empty_html = ``;
			this.products_container.html(empty_html);
			return;
		}

		let html = "";

		product_results.forEach((res) => {
			let thumbnail = res.thumbnail || '/assets/webshop/images/cart-empty-state.png';
			html += `
				<div class="dropdown-item" style="display: flex;">
					<img class="item-thumb col-2" src=${encodeURI(thumbnail)} />
					<div class="col-9" style="white-space: normal;">
						<a href="/${res.route}">${res.web_item_name}</a><br>
						<span class="brand-line">${res.brand ? "by " + res.brand : ""}</span>
					</div>
				</div>
			`;
		});

		this.products_container.html(html);
	}

	populateCategoriesList(category_results) {
		if (!category_results || category_results.length === 0) {
			let empty_html = `
				<div class="category-container mt-2">
					<div class="category-chips">
					</div>
				</div>
			`;
			this.category_container.html(empty_html);
			return;
		}

		let html = `
			<div class="mb-2">
				<b>${ __("Categories") }</b>
			</div>
		`;

		category_results.forEach((category) => {
			html += `
				<a href="/${category.route}" class="btn btn-sm category-chip mr-2 mb-2"
					style="font-size: 13px" role="button">
				${ category.name }
				</button>
			`;
		});

		this.category_container.html(html);
	}
};


================================================
FILE: webshop/public/js/product_ui/views.js
================================================
webshop.ProductView =  class {
	/* Options:
		- View Type
		- Products Section Wrapper,
		- Item Group: If its an Item Group page
	*/
	constructor(options) {
		Object.assign(this, options);
		this.preference = this.view_type;
		this.make();
	}

	make(from_filters=false) {
		this.products_section.empty();
		this.prepare_toolbar();
		this.get_item_filter_data(from_filters);
	}

	prepare_toolbar() {
		this.products_section.append(`
			<div class="toolbar d-flex">
			</div>
		`);
		this.prepare_search();
		this.prepare_view_toggler();

		new webshop.ProductSearch();
	}

	prepare_view_toggler() {

		if (!$("#list").length || !$("#image-view").length) {
			this.render_view_toggler();
			this.bind_view_toggler_actions();
			this.set_view_state();
		}
	}

	get_item_filter_data(from_filters=false) {
		// Get and render all Product related views
		let me = this;
		this.from_filters = from_filters;
		let args = this.get_query_filters();

		this.disable_view_toggler(true);

		frappe.call({
			method: "webshop.webshop.api.get_product_filter_data",
			args: {
				query_args: args
			},
			callback: function(result) {
				if (!result || result.exc || !result.message || result.message.exc) {
					me.render_no_products_section(true);
				} else {
					// Sub Category results are independent of Items
					if (me.item_group && result.message["sub_categories"].length) {
						me.render_item_sub_categories(result.message["sub_categories"]);
					}

					if (!result.message["items"].length) {
						// if result has no items or result is empty
						me.render_no_products_section();
					} else {
						// Add discount filters
						me.re_render_discount_filters(result.message["filters"].discount_filters);

						// Render views
						me.render_list_view(result.message["items"], result.message["settings"]);
						me.render_grid_view(result.message["items"], result.message["settings"]);

						me.products = result.message["items"];
						me.product_count = result.message["items_count"];
					}

					// Bind filter actions
					if (!from_filters) {
						// If `get_product_filter_data` was triggered after checking a filter,
						// don't touch filters unnecessarily, only data must change
						// filter persistence is handle on filter change event
						me.bind_filters();
						me.restore_filters_state();
					}

					// Bottom paging
					me.add_paging_section(result.message["settings"]);
				}

				me.disable_view_toggler(false);
			}
		});
	}

	disable_view_toggler(disable=false) {
		$('#list').prop('disabled', disable);
		$('#image-view').prop('disabled', disable);
	}

	render_grid_view(items, settings) {
		// loop over data and add grid html to it
		let me = this;
		this.prepare_product_area_wrapper("grid");

		new webshop.ProductGrid({
			items: items,
			products_section: $("#products-grid-area"),
			settings: settings,
			preference: me.preference
		});
	}

	render_list_view(items, settings) {
		let me = this;
		this.prepare_product_area_wrapper("list");

		new webshop.ProductList({
			items: items,
			products_section: $("#products-list-area"),
			settings: settings,
			preference: me.preference
		});
	}

	prepare_product_area_wrapper(view) {
		let left_margin = view == "list" ? "ml-2" : "";
		let top_margin = view == "list" ? "mt-6" : "mt-minus-1";
		return this.products_section.append(`
			<br>
			<div id="products-${view}-area" class="row products-list ${ top_margin } ${ left_margin }" itemscope itemtype="https://schema.org/Product"></div>
		`);
	}

	get_query_filters() {
		const filters = frappe.utils.get_query_params();
		let {field_filters, attribute_filters} = filters;

		field_filters = field_filters ? JSON.parse(field_filters) : {};
		attribute_filters = attribute_filters ? JSON.parse(attribute_filters) : {};

		return {
			field_filters: field_filters,
			attribute_filters: attribute_filters,
			item_group: this.item_group,
			start: filters.start || null,
			from_filters: this.from_filters || false
		};
	}

	add_paging_section(settings) {
		$(".product-paging-area").remove();

		if (this.products) {
			let paging_html = `
				<div class="row product-paging-area mt-5">
					<div class="col-3">
					</div>
					<div class="col-9 text-right">
			`;
			let query_params = frappe.utils.get_query_params();
			let start = query_params.start ? cint(JSON.parse(query_params.start)) : 0;
			let page_length = settings.products_per_page || 0;

			let prev_disable = start > 0 ? "" : "disabled";
			let next_disable = (this.product_count > page_length) ? "" : "disabled";

			paging_html += `
				<button class="btn btn-default btn-prev" data-start="${ start - page_length }"
					style="float: left" ${prev_disable}>
					${ __("Prev") }
				</button>`;

			paging_html += `
				<button class="btn btn-default btn-next" data-start="${ start + page_length }"
					${next_disable}>
					${ __("Next") }
				</button>
			`;

			paging_html += `</div></div>`;

			$(".page_content").append(paging_html);
			this.bind_paging_action();
		}
	}

	prepare_search() {
		$(".toolbar").append(`
			<div class="input-group col-8 p-0">
				<div class="dropdown w-100" id="dropdownMenuSearch">
					<input type="search" name="query" id="search-box" class="form-control font-md"
						placeholder="${__("Search for Products")}"
						aria-label="Product" aria-describedby="button-addon2">
					<div class="search-icon">
						<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"
							fill="none"
							stroke="currentColor" stroke-width="2" stroke-linecap="round"
							stroke-linejoin="round"
							class="feather feather-search">
							<circle cx="11" cy="11" r="8"></circle>
							<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
						</svg>
					</div>
					<!-- Results dropdown rendered in product_search.js -->
				</div>
			</div>
		`);
	}

	render_view_toggler() {
		$(".toolbar").append(`<div class="toggle-container col-4 p-0"></div>`);

		["btn-list-view", "btn-grid-view"].forEach(view => {
			let icon = view === "btn-list-view" ? "list" : "image-view";
			$(".toggle-container").append(`
				<div class="form-group mb-0" id="toggle-view">
					<button id="${ icon }" class="btn ${ view } mr-2">
						<span>
							<svg class="icon icon-md">
								<use href="#icon-${ icon }"></use>
							</svg>
						</span>
					</button>
				</div>
			`);
		});
	}

	bind_view_toggler_actions() {
		$("#list").click(function() {
			let $btn = $(this);
			$btn.removeClass('btn-primary');
			$btn.addClass('btn-primary');
			$(".btn-grid-view").removeClass('btn-primary');

			$("#products-grid-area").addClass("hidden");
			$("#products-list-area").removeClass("hidden");
			localStorage.setItem("product_view", "List View");
		});

		$("#image-view").click(function() {
			let $btn = $(this);
			$btn.removeClass('btn-primary');
			$btn.addClass('btn-primary');
			$(".btn-list-view").removeClass('btn-primary');

			$("#products-list-area").addClass("hidden");
			$("#products-grid-area").removeClass("hidden");
			localStorage.setItem("product_view", "Grid View");
		});
	}

	set_view_state() {
		if (this.preference === "List View") {
			$("#list").addClass('btn-primary');
			$("#image-view").removeClass('btn-primary');
		} else {
			$("#image-view").addClass('btn-primary');
			$("#list").removeClass('btn-primary');
		}
	}

	bind_paging_action() {
		let me = this;
		$('.btn-prev, .btn-next').click((e) => {
			const $btn = $(e.target);
			me.from_filters = false;

			$btn.prop('disabled', true);
			const start = $btn.data('start');

			let query_params = frappe.utils.get_query_params();
			query_params.start = start;
			let path = window.location.pathname + '?' + frappe.utils.get_url_from_dict(query_params);
			window.location.href = path;
		});
	}

	re_render_discount_filters(filter_data) {
		this.get_discount_filter_html(filter_data);
		if (this.from_filters) {
			// Bind filter action if triggered via filters
			// if not from filter action, page load will bind actions
			this.bind_discount_filter_action();
		}
		// discount filters are rendered with Items (later)
		// unlike the other filters
		this.restore_discount_filter();
	}

	get_discount_filter_html(filter_data) {
		$("#discount-filters").remove();
		if (filter_data) {
			$("#product-filters").append(`
				<div id="discount-filters" class="mb-4 filter-block pb-5">
					<div class="filter-label mb-3">${ __("Discounts") }</div>
				</div>
			`);

			let html = `<div class="filter-options">`;
			filter_data.forEach(filter => {
				html += `
					<div class="checkbox">
						<label data-value="${ filter[0] }">
							<input type="radio"
								class="product-filter discount-filter"
								name="discount" id="${ filter[0] }"
								data-filter-name="discount"
								data-filter-value="${ filter[0] }"
								style="width: 14px !important"
							>
								<span class="label-area" for="${ filter[0] }">
									${ filter[1] }
								</span>
						</label>
					</div>
				`;
			});
			html += `</div>`;

			$("#discount-filters").append(html);
		}
	}

	restore_discount_filter() {
		const filters = frappe.utils.get_query_params();
		let field_filters = filters.field_filters;
		if (!field_filters) return;

		field_filters = JSON.parse(field_filters);

		if (field_filters && field_filters["discount"]) {
			const values = field_filters["discount"];
			const selector = values.map(value => {
				return `input[data-filter-name="discount"][data-filter-value="${value}"]`;
			}).join(',');
			$(selector).prop('checked', true);
			this.field_filters = field_filters;
		}
	}

	bind_discount_filter_action() {
		let me = this;
		$('.discount-filter').on('change', (e) => {
			const $checkbox = $(e.target);
			const is_checked = $checkbox.is(':checked');

			const {
				filterValue: filter_value
			} = $checkbox.data();

			delete this.field_filters["discount"];

			if (is_checked) {
				this.field_filters["discount"] = [];
				this.field_filters["discount"].push(filter_value);
			}

			if (this.field_filters["discount"].length === 0) {
				delete this.field_filters["discount"];
			}

			me.change_route_with_filters();
		});
	}

	bind_filters() {
		let me = this;
		this.field_filters = {};
		this.attribute_filters = {};

		$('.product-filter').on('change', (e) => {
			me.from_filters = true;

			const $checkbox = $(e.target);
			const is_checked = $checkbox.is(':checked');

			if ($checkbox.is('.attribute-filter')) {
				const {
					attributeName: attribute_name,
					attributeValue: attribute_value
				} = $checkbox.data();

				if (is_checked) {
					this.attribute_filters[attribute_name] = this.attribute_filters[attribute_name] || [];
					this.attribute_filters[attribute_name].push(attribute_value);
				} else {
					this.attribute_filters[attribute_name] = this.attribute_filters[attribute_name] || [];
					this.attribute_filters[attribute_name] = this.attribute_filters[attribute_name].filter(v => v !== attribute_value);
				}

				if (this.attribute_filters[attribute_name].length === 0) {
					delete this.attribute_filters[attribute_name];
				}
			} else if ($checkbox.is('.field-filter') || $checkbox.is('.discount-filter')) {
				const {
					filterName: filter_name,
					filterValue: filter_value
				} = $checkbox.data();

				if ($checkbox.is('.discount-filter')) {
					// clear previous discount filter to accomodate new
					delete this.field_filters["discount"];
				}
				if (is_checked) {
					this.field_filters[filter_name] = this.field_filters[filter_name] || [];
					if (!in_list(this.field_filters[filter_name], filter_value)) {
						this.field_filters[filter_name].push(filter_value);
					}
				} else {
					this.field_filters[filter_name] = this.field_filters[filter_name] || [];
					this.field_filters[filter_name] = this.field_filters[filter_name].filter(v => v !== filter_value);
				}

				if (this.field_filters[filter_name].length === 0) {
					delete this.field_filters[filter_name];
				}
			}

			me.change_route_with_filters();
		});

		// bind filter lookup input box
		$('.filter-lookup-input').on('keydown', frappe.utils.debounce((e) => {
			const $input = $(e.target);
			const keyword = ($input.val() || '').toLowerCase();
			const $filter_options = $input.next('.filter-options');

			$filter_options.find('.filter-lookup-wrapper').show();
			$filter_options.find('.filter-lookup-wrapper').each((i, el) => {
				const $el = $(el);
				const value = $el.data('value').toLowerCase();
				if (!value.includes(keyword)) {
					$el.hide();
				}
			});
		}, 300));
	}

	change_route_with_filters() {
		let route_params = frappe.utils.get_query_params();

		let start = this.if_key_exists(route_params.start) || 0;
		if (this.from_filters) {
			start = 0; // show items from first page if new filters are triggered
		}

		const query_string = this.get_query_string({
			start: start,
			field_filters: JSON.stringify(this.if_key_exists(this.field_filters)),
			attribute_filters: JSON.stringify(this.if_key_exists(this.attribute_filters)),
		});
		window.history.pushState('filters', '', `${location.pathname}?` + query_string);

		$('.page_content input').prop('disabled', true);

		this.make(true);
		$('.page_content input').prop('disabled', false);
	}

	restore_filters_state() {
		const filters = frappe.utils.get_query_params();
		let {field_filters, attribute_filters} = filters;

		if (field_filters) {
			field_filters = JSON.parse(field_filters);
			for (let fieldname in field_filters) {
				const values = field_filters[fieldname];
				const selector = values.map(value => {
					return `input[data-filter-name="${fieldname}"][data-filter-value="${value}"]`;
				}).join(',');
				$(selector).prop('checked', true);
			}
			this.field_filters = field_filters;
		}
		if (attribute_filters) {
			attribute_filters = JSON.parse(attribute_filters);
			for (let attribute in attribute_filters) {
				const values = attribute_filters[attribute];
				const selector = values.map(value => {
					return `input[data-attribute-name="${attribute}"][data-attribute-value="${value}"]`;
				}).join(',');
				$(selector).prop('checked', true);
			}
			this.attribute_filters = attribute_filters;
		}
	}

	render_no_products_section(error=false) {
		let error_section = `
			<div class="mt-4 w-100 alert alert-error font-md">
				${ __("Something went wrong. Please refresh or contact us.") }
			</div>
		`;
		let no_results_section = `
			<div class="cart-empty frappe-card mt-4">
				<div class="cart-empty-state">
					<img src="/assets/webshop/images/cart-empty-state.png" alt="Empty Cart">
				</div>
				<div class="cart-empty-message mt-4">${ __("No products found") }</p>
			</div>
		`;

		this.products_section.append(error ? error_section : no_results_section);
	}

	render_item_sub_categories(categories) {
		if (categories && categories.length) {
			let sub_group_html = `
				<div class="sub-category-container scroll-categories">
			`;

			categories.forEach(category => {
				sub_group_html += `
					<a href="/${ category.route || '#' }" style="text-decoration: none;">
						<div class="category-pill">
							${ category.name }
						</div>
					</a>
				`;
			});
			sub_group_html += `</div>`;

			$("#product-listing").prepend(sub_group_html);
		}
	}

	get_query_string(object) {
		const url = new URLSearchParams();
		for (let key in object) {
			const value = object[key];
			if (value) {
				url.append(key, value);
			}
		}
		return url.toString();
	}

	if_key_exists(obj) {
		let exists = false;
		for (let key in obj) {
			if (Object.prototype.hasOwnProperty.call(obj, key) && obj[key]) {
				exists = true;
				break;
			}
		}
		return exists ? obj : undefined;
	}
};


================================================
FILE: webshop/public/js/shopping_cart.js
================================================
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

// shopping cart
frappe.provide("webshop.webshop.shopping_cart");
var shopping_cart = webshop.webshop.shopping_cart;

var getParams = function (url) {
	var params = [];
	var parser = document.createElement('a');
	parser.href = url;
	var query = parser.search.substring(1);
	var vars = query.split('&');
	for (var i = 0; i < vars.length; i++) {
		var pair = vars[i].split('=');
		params[pair[0]] = decodeURIComponent(pair[1]);
	}
	return params;
};

frappe.ready(function() {
	var full_name = frappe.session && frappe.session.user_fullname;
	// update user
	if(full_name) {
		$('.navbar li[data-label="User"] a')
			.html('<i class="fa fa-fixed-width fa fa-user"></i> ' + full_name);
	}
	// set coupon code and sales partner code

	var url_args = getParams(window.location.href);

	var referral_coupon_code = url_args['cc'];
	var referral_sales_partner = url_args['sp'];

	var d = new Date();
	// expires within 30 minutes
	d.setTime(d.getTime() + (0.02 * 24 * 60 * 60 * 1000));
	var expires = "expires="+d.toUTCString();
	if (referral_coupon_code) {
		document.cookie = "referral_coupon_code=" + referral_coupon_code + ";" + expires + ";path=/";
	}
	if (referral_sales_partner) {
		document.cookie = "referral_sales_partner=" + referral_sales_partner + ";" + expires + ";path=/";
	}
	referral_coupon_code=frappe.get_cookie("referral_coupon_code");
	referral_sales_partner=frappe.get_cookie("referral_sales_partner");

	if (referral_coupon_code && $(".tot_quotation_discount").val()==undefined ) {
		$(".txtcoupon").val(referral_coupon_code);
	}
	if (referral_sales_partner) {
		$(".txtreferral_sales_partner").val(referral_sales_partner);
	}

	// update login
	shopping_cart.show_shoppingcart_dropdown();
	shopping_cart.set_cart_count();
	shopping_cart.show_cart_navbar();
});

$.extend(shopping_cart, {
	show_shoppingcart_dropdown: function() {
		$(".shopping-cart").on('shown.bs.dropdown', function() {
			if (!$('.shopping-cart-menu .cart-container').length) {
				return frappe.call({
					method: 'webshop.webshop.shopping_cart.cart.get_shopping_cart_menu',
					callback: function(r) {
						if (r.message) {
							$('.shopping-cart-menu').html(r.message);
						}
					}
				});
			}
		});
	},

	update_cart: function(opts) {
		if (frappe.session.user==="Guest") {
			if (localStorage) {
				localStorage.setItem("last_visited", window.location.pathname);
			}
			frappe.call('webshop.webshop.api.get_guest_redirect_on_action').then((res) => {
				window.location.href = res.message || "/login";
			});
		} else {
			shopping_cart.freeze();
			return frappe.call({
				type: "POST",
				method: "webshop.webshop.shopping_cart.cart.update_cart",
				args: {
					item_code: opts.item_code,
					qty: opts.qty,
					additional_notes: opts.additional_notes !== undefined ? opts.additional_notes : undefined,
					with_items: opts.with_items || 0
				},
				btn: opts.btn,
				callback: function(r) {
					shopping_cart.unfreeze();
					shopping_cart.set_cart_count(true);
					if(opts.callback)
						opts.callback(r);
				}
			});
		}
	},

	set_cart_count: function(animate=false) {
		$(".intermediate-empty-cart").remove();

		var cart_count = frappe.get_cookie("cart_count");
		if(frappe.session.user==="Guest") {
			cart_count = 0;
		}

		if(cart_count) {
			$(".shopping-cart").toggleClass('hidden', false);
		}

		var $cart = $('.cart-icon');
		var $badge = $cart.find("#cart-count");

		if(parseInt(cart_count) === 0 || cart_count === undefined) {
			$cart.css("display", "none");
			$(".cart-tax-items").hide();
			$(".btn-place-order").hide();
			$(".cart-payment-addresses").hide();

			let intermediate_empty_cart_msg = `
				<div class="text-center w-100 intermediate-empty-cart mt-4 mb-4 text-muted">
					${ __("Cart is Empty") }
				</div>
			`;
			$(".cart-table").after(intermediate_empty_cart_msg);
		}
		else {
			$cart.css("display", "inline");
			$("#cart-count").text(cart_count);
		}

		if(cart_count) {
			$badge.html(cart_count);

			if (animate) {
				$cart.addClass("cart-animate");
				setTimeout(() => {
					$cart.removeClass("cart-animate");
				}, 500);
			}
		} else {
			$badge.remove();
		}
	},

	shopping_cart_update: function({item_code, qty, cart_dropdown, additional_notes}) {
		shopping_cart.update_cart({
			item_code,
			qty,
			additional_notes,
			with_items: 1,
			btn: this,
			callback: function(r) {
				if(!r.exc) {
					$(".cart-items").html(r.message.items);
					$(".cart-tax-items").html(r.message.total);
					$(".payment-summary").html(r.message.taxes_and_totals);
					shopping_cart.set_cart_count();

					if (cart_dropdown != true) {
						$(".cart-icon").hide();
					}
				}
			},
		});
	},

	show_cart_navbar: function () {
		frappe.call({
			method: "webshop.webshop.doctype.webshop_settings.webshop_settings.is_cart_enabled",
			callback: function(r) {
				$(".shopping-cart").toggleClass('hidden', r.message ? false : true);
			}
		});
	},

	toggle_button_class(button, remove, add) {
		button.removeClass(remove);
		button.addClass(add);
	},

	bind_add_to_cart_action() {
		$('.page_content').on('click', '.btn-add-to-cart-list', (e) => {
			const $btn = $(e.currentTarget);
			$btn.prop('disabled', true);

			if (frappe.session.user==="Guest") {
				if (localStorage) {
					localStorage.setItem("last_visited", window.location.pathname);
				}
				frappe.call('webshop.webshop.api.get_guest_redirect_on_action').then((res) => {
					window.location.href = res.message || "/login";
				});
				return;
			}

			$btn.addClass('hidden');
			$btn.closest('.cart-action-container').addClass('d-flex');
			$btn.parent().find('.go-to-cart').removeClass('hidden');
			$btn.parent().find('.go-to-cart-grid').removeClass('hidden');
			$btn.parent().find('.cart-indicator').removeClass('hidden');

			const item_code = $btn.data('item-code');
			webshop.webshop.shopping_cart.update_cart({
				item_code,
				qty: 1
			});

		});
	},

	freeze() {
		if (window.location.pathname !== "/cart") return;

		if (!$('#freeze').length) {
			let freeze = $('<div id="freeze" class="modal-backdrop fade"></div>')
				.appendTo("body");

			setTimeout(function() {
				freeze.addClass("show");
			}, 1);
		} else {
			$("#freeze").addClass("show");
		}
	},

	unfreeze() {
		if ($('#freeze').length) {
			let freeze = $('#freeze').removeClass("show");
			setTimeout(function() {
				freeze.remove();
			}, 1);
		}
	}
});


================================================
FILE: webshop/public/js/wishlist.js
================================================
frappe.provide("webshop.webshop.wishlist");
var wishlist = webshop.webshop.wishlist;

frappe.provide("webshop.webshop.shopping_cart");
var shopping_cart = webshop.webshop.shopping_cart;

$.extend(wishlist, {
	set_wishlist_count: function(animate=false) {
		// set badge count for wishlist icon
		var wish_count = frappe.get_cookie("wish_count");
		if (frappe.session.user==="Guest") {
			wish_count = 0;
		}

		if (wish_count) {
			$(".wishlist").toggleClass('hidden', false);
		}

		var $wishlist = $('.wishlist-icon');
		var $badge = $wishlist.find("#wish-count");

		if (parseInt(wish_count) === 0 || wish_count === undefined) {
			$wishlist.css("display", "none");
		} else {
			$wishlist.css("display", "inline");
		}
		if (wish_count) {
			$badge.html(wish_count);
			if (animate) {
				$wishlist.addClass('cart-animate');
				setTimeout(() => {
					$wishlist.removeClass('cart-animate');
				}, 500);
			}
		} else {
			$badge.remove();
		}
	},

	bind_move_to_cart_action: function() {
		// move item to cart from wishlist
		$('.page_content').on("click", ".btn-add-to-cart", (e) => {
			const $move_to_cart_btn = $(e.currentTarget);
			let item_code = $move_to_cart_btn.data("item-code");

			shopping_cart.shopping_cart_update({
				item_code,
				qty: 1,
				cart_dropdown: true
			});

			let success_action = function() {
				const $card_wrapper = $move_to_cart_btn.closest(".wishlist-card");
				$card_wrapper.addClass("wish-removed");
			};
			let args = { item_code: item_code };
			this.add_remove_from_wishlist("remove", args, success_action, null, true);
		});
	},

	bind_remove_action: function() {
		// remove item from wishlist
		let me = this;

		$('.page_content').on("click", ".remove-wish", (e) => {
			const $remove_wish_btn = $(e.currentTarget);
			let item_code = $remove_wish_btn.data("item-code");

			let success_action = function() {
				const $card_wrapper = $remove_wish_btn.closest(".wishlist-card");
				$card_wrapper.addClass("wish-removed");
				if (frappe.get_cookie("wish_count") == 0) {
					$(".page_content").empty();
					me.render_empty_state();
				}
			};
			let args = { item_code: item_code };
			this.add_remove_from_wishlist("remove", args, success_action);
		});
	},

	bind_wishlist_action() {
		// 'wish'('like') or 'unwish' item in product listing
		$('.page_content').on('click', '.like-action, .like-action-list', (e) => {
			const $btn = $(e.currentTarget);
			this.wishlist_action($btn);
		});
	},

	wishlist_action(btn) {
		const $wish_icon = btn.find('.wish-icon');
		let me = this;

		if (frappe.session.user==="Guest") {
			if (localStorage) {
				localStorage.setItem("last_visited", window.location.pathname);
			}
			this.redirect_guest();
			return;
		}

		let success_action = function() {
			webshop.webshop.wishlist.set_wishlist_count(true);
		};

		if ($wish_icon.hasClass('wished')) {
			// un-wish item
			btn.removeClass("like-animate");
			btn.addClass("like-action-wished");
			this.toggle_button_class($wish_icon, 'wished', 'not-wished');

			let args = { item_code: btn.data('item-code') };
			let failure_action = function() {
				me.toggle_button_class($wish_icon, 'not-wished', 'wished');
			};
			this.add_remove_from_wishlist("remove", args, success_action, failure_action);
		} else {
			// wish item
			btn.addClass("like-animate");
			btn.addClass("like-action-wished");
			this.toggle_button_class($wish_icon, 'not-wished', 'wished');

			let args = {item_code: btn.data('item-code')};
			let failure_action = function() {
				me.toggle_button_class($wish_icon, 'wished', 'not-wished');
			};
			this.add_remove_from_wishlist("add", args, success_action, failure_action);
		}
	},

	toggle_button_class(button, remove, add) {
		button.removeClass(remove);
		button.addClass(add);
	},

	add_remove_from_wishlist(action, args, success_action, failure_action, async=false) {
		/*	AJAX call to add or remove Item from Wishlist
			action: "add" or "remove"
			args: args for method (item_code, price, formatted_price),
			success_action: method to execute on successs,
			failure_action: method to execute on failure,
			async: make call asynchronously (true/false).	*/
		if (frappe.session.user==="Guest") {
			if (localStorage) {
				localStorage.setItem("last_visited", window.location.pathname);
			}
			this.redirect_guest();
		} else {
			let method = "webshop.webshop.doctype.wishlist.wishlist.add_to_wishlist";
			if (action === "remove") {
				method = "webshop.webshop.doctype.wishlist.wishlist.remove_from_wishlist";
			}

			frappe.call({
				async: async,
				type: "POST",
				method: method,
				args: args,
				callback: function (r) {
					if (r.exc) {
						if (failure_action && (typeof failure_action === 'function')) {
							failure_action();
						}
						frappe.msgprint({
							message: __("Sorry, something went wrong. Please refresh."),
							indicator: "red", title: __("Note")
						});
					} else if (success_action && (typeof success_action === 'function')) {
						success_action();
					}
				}
			});
		}
	},

	redirect_guest() {
		frappe.call('webshop.webshop.api.get_guest_redirect_on_action').then((res) => {
			window.location.href = res.message || "/login";
		});
	},

	render_empty_state() {
		$(".page_content").append(`
			<div class="cart-empty frappe-card">
				<div class="cart-empty-state">
					<img src="/assets/webshop/images/cart-empty-state.png" alt="Empty Cart">
				</div>
				<div class="cart-empty-message mt-4">${ __('Wishlist is empty !') }</p>
			</div>
		`);
	}

});

frappe.ready(function() {
	if (window.location.pathname !== "/wishlist") {
		$(".wishlist").toggleClass('hidden', true);
		wishlist.set_wishlist_count();
	} else {
		wishlist.bind_move_to_cart_action();
		wishlist.bind_remove_action();
	}

});


================================================
FILE: webshop/public/scss/webshop-web.bundle.scss
================================================
@import "./webshop_cart";

================================================
FILE: webshop/public/scss/webshop_cart.scss
================================================
@import "frappe/public/scss/common/mixins";

:root {
	--green-info: #38A160;
	--product-bg-color: white;
	--body-bg-color:  var(--gray-50);
}

body.product-page {
	background: var(--body-bg-color);
}

.item-breadcrumbs {
	.breadcrumb-container {
		a {
			color: var(--gray-900);
		}
	}
}

.carousel-control {
	height: 42px;
	width: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: white;
	box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.08), 0px 1px 2px 1px rgba(0, 0, 0, 0.06);
	border-radius: 100px;
}

.carousel-control-prev,
.carousel-control-next {
	opacity: 1;
	width: 8%;

	@media (max-width: 1200px) {
		width: 10%;
	}
	@media (max-width: 768px) {
		width: 15%;
	}
}

.carousel-body {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}

.carousel-content {
	max-width: 400px;
	margin-left: 5rem;
	margin-right: 5rem;
}

.card {
	border: none;
}

.product-category-section {
	.card:hover {
		box-shadow: 0px 16px 45px 6px rgba(0, 0, 0, 0.08), 0px 8px 10px -10px rgba(0, 0, 0, 0.04);
	}

	.card-grid {
		display: grid;
		grid-gap: 15px;
		grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	}
}

.no-image-item {
	height: 340px;
	width: 340px;
	background: var(--gray-100);
	border-radius: var(--border-radius);
	font-size: 2rem;
	color: var(--gray-500);
	display: flex;
	align-items: center;
	justify-content: center;
}

.item-card-group-section {
	.card {
		height: 100%;
		align-items: center;
		justify-content: center;

		&:hover {
			box-shadow: 0px 16px 60px rgba(0, 0, 0, 0.08), 0px 8px 30px -20px rgba(0, 0, 0, 0.04);
			transition: box-shadow 400ms;
		}
	}

	.card:hover, .card:focus-within {
		.btn-add-to-cart-list {
			visibility: visible;
		}
		.like-action {
			visibility: visible;
		}
		.btn-explore-variants {
			visibility: visible;
		}
	}


	.card-img-container {
		height: 210px;
		width: 100%;
	}

	.card-img {
		max-height: 210px;
		object-fit: contain;
		margin-top: 1.25rem;
	}

	.no-image {
		@include flex(flex, center, center, null);
		height: 220px;
		background: var(--gray-100);
		width: 100%;
		border-radius: var(--border-radius) var(--border-radius) 0 0;
		font-size: 2rem;
		color: var(--gray-500);
	}

	.no-image-list {
		@include flex(flex, center, center, null);
		height: 150px;
		background: var(--gray-100);
		border-radius: var(--border-radius);
		font-size: 2rem;
		color: var(--gray-500);
		margin-top: 15px;
		margin-bottom: 15px;
	}

	.card-body-flex {
		display: flex;
		flex-direction: column;
	}

	.product-title {
		font-size: 14px;
		color: var(--gray-800);
		font-weight: 500;
	}

	.product-description {
		font-size: 12px;
		color: var(--text-color);
		margin: 20px 0;
		display: -webkit-box;
		-webkit-line-clamp: 6;
		-webkit-box-orient: vertical;

		p {
			margin-bottom: 0.5rem;
		}
	}

	.product-category {
		font-size: 13px;
		color: var(--text-muted);
		margin: var(--margin-sm) 0;
	}

	.product-price {
		font-size: 18px;
		font-weight: 600;
		color: var(--text-color);
		margin: var(--margin-sm) 0;
		margin-bottom: auto !important;

		.striked-price {
			font-weight: 500;
			font-size: 15px;
			color: var(--gray-500);
		}
	}

	.product-info-green {
		color: var(--green-info);
		font-weight: 600;
	}

	.item-card {
		padding: var(--padding-sm);
		min-width: 300px;
	}

	.wishlist-card {
		padding: var(--padding-sm);
		min-width: 260px;
		.card-body-flex {
			display: flex;
			flex-direction: column;
		}
	}
}

#products-list-area, #products-grid-area {
	padding: 0 5px;
}

.list-row {
	background-color: white;
	padding-bottom: 1rem;
	padding-top: 1.5rem !important;
	border-radius: 8px;
	border-bottom: 1px solid var(--gray-50);

	&:hover, &:focus-within {
		box-shadow: 0px 16px 60px rgba(0, 0, 0, 0.08), 0px 8px 30px -20px rgba(0, 0, 0, 0.04);
		transition: box-shadow 400ms;

		.btn-add-to-cart-list {
			visibility: visible;
		}
		.like-action-list {
			visibility: visible;
		}
		.btn-explore-variants {
			visibility: visible;
		}
	}

	.product-code {
		padding-top: 0 !important;
	}

	.btn-explore-variants {
		min-width: 135px;
		max-height: 30px;
		float: right;
		padding: 0.25rem 1rem;
	}
}

[data-doctype="Item Group"],
#page-index {
	.page-header {
		font-size: 20px;
		font-weight: 700;
		color: var(--text-color);
	}

	.filters-section {
		.title-section {
			border-bottom: 1px solid var(--table-border-color);
		}

		.filter-title {
			font-weight: 500;
		}

		.clear-filters {
			font-size: 13px;
		}

		.filter-lookup-input {
			background-color: white;
			border: 1px solid var(--gray-300);

			&:focus {
				border: 1px solid var(--primary);
			}
		}

		.filter-label {
			font-size: 11px;
			font-weight: 600;
			color: var(--gray-700);
			text-transform: uppercase;
		}

		.filter-block {
			border-bottom: 1px solid var(--table-border-color);
		}

		.checkbox {
			.label-area {
				font-size: 13px;
				color: var(--gray-800);
			}
		}
	}
}

.product-filter {
	width: 14px !important;
	height: 14px !important;
}

.discount-filter {
	&:before {
		width: 14px !important;
		height: 14px !important;
	}
}

.list-image {
	border: none !important;
	overflow: hidden;
	max-height: 200px;
	background-color: white;
}

.product-container {
	@include card($padding: var(--padding-md));
	background-color: var(--product-bg-color) !important;
	min-height: fit-content;

	.product-details {
		max-width: 50%;

		.btn-add-to-cart {
			font-size: 14px;
		}
	}

	&.item-main {
		.product-image {
			width: 100%;
		}
	}

	.expand {
		max-width: 100% !important; // expand in absence of slideshow
	}

	@media (max-width: 789px) {
		.product-details {
			max-width: 90% !important;

			.btn-add-to-cart {
				font-size: 14px;
			}
		}
	}

	.btn-add-to-wishlist {
		svg use {
			--icon-stroke: #F47A7A;
		}
	}

	.btn-view-in-wishlist {
		svg use {
			fill: #F47A7A;
			--icon-stroke: none;
		}
	}

	.product-title {
		font-size: 16px;
		font-weight: 600;
		color: var(--text-color);
		padding: 0 !important;
	}

	.product-description {
		font-size: 13px;
		color: var(--gray-800);
	}

	.product-image {
		border-color: var(--table-border-color) !important;
		padding: 15px;

		@media (max-width: var(--md-width)) {
			height: 300px;
			width: 300px;
		}

		@media (min-width: var(--lg-width)) {
			height: 350px;
			width: 350px;
		}

	 	img {
			object-fit: contain;
		}
	}

	.item-slideshow {

		@media (max-width: var(--md-width)) {
			max-height: 320px;
		}

		@media (min-width: var(--lg-width)) {
			max-height: 430px;
		}

		overflow: auto;
	}

	.item-slideshow-image {
		height: 4rem;
		width: 6rem;
		object-fit: contain;
		padding: 0.5rem;
		border: 1px solid var(--table-border-color);
		border-radius: 4px;
		cursor: pointer;

		&:hover, &.active {
			border-color: var(--primary);
		}
	}

	.item-cart {
		.product-price {
			font-size: 22px;
			color: var(--text-color);
			font-weight: 600;

			.formatted-price {
				color: var(--text-muted);
				font-size: 14px;
			}
		}

		.no-stock {
			font-size: var(--text-base);
		}

		.offers-heading {
			font-size: 16px !important;
			color: var(--text-color);
			.tag-icon {
				--icon-stroke: var(--gray-500);
			}
		}

		.w-30-40 {
			width: 30%;

			@media (max-width: 992px) {
				width: 40%;
			}
		}
	}

	.tab-content {
		font-size: 14px;
	}
}

// Item Recommendations
.recommended-item-section {
	padding-right: 0;

	.recommendation-header {
		font-size: 16px;
		font-weight: 500
	}

	.recommendation-container {
		padding: .5rem;
		min-height: 0px;

		.r-item-image {
			min-height: 100px;
			width: 40%;

			.r-product-image {
				padding: 2px 15px;
			}

			.no-image-r-item {
				display: flex; justify-content: center;
				background-color: var(--gray-200);
				align-items: center;
				color: var(--gray-400);
				margin-top: .15rem;
				border-radius: 6px;
				height: 100%;
				font-size: 24px;
			}
		}

		.r-item-info {
			font-size: 14px;
			padding-right: 0;
			padding-left: 10px;
			width: 60%;

			a {
				color: var(--gray-800);
				font-weight: 400;
			}

			.item-price {
				font-size: 15px;
				font-weight: 600;
				color: var(--text-color);
			}

			.striked-item-price {
				font-weight: 500;
				color: var(--gray-500);
			}
		}
	}
}

.product-code {
	padding: .5rem 0;
	color: var(--text-muted);
	font-size: 14px;
	.product-item-group {
		padding-right: .25rem;
		border-right: solid 1px var(--text-muted);
	}

	.product-item-code {
		padding-left: .5rem;
	}
}

.item-configurator-dialog {
	.modal-body {
		padding-bottom: var(--padding-xl);

		.status-area {
			.alert {
				padding: var(--padding-xs) var(--padding-sm);
				font-size: var(--text-sm);
			}
		}

		.form-layout {
			max-height: 50vh;
			overflow-y: auto;
		}

		.section-body {
			.form-column {
				.form-group {
					.control-label {
						font-size: var(--text-md);
						color: var(--gray-700);
					}

					.help-box {
						margin-top: 2px;
						font-size: var(--text-sm);
					}
				}
			}
		}
	}
}

.item-group-slideshow {

	.carousel-inner.rounded-carousel {
		border-radius: var(--card-border-radius);
	}
}

.sub-category-container {
	padding-bottom: .5rem;
	margin-bottom: 1.25rem;
	border-bottom: 1px solid var(--table-border-color);

	.heading {
		color: var(--gray-500);
	}
}

.scroll-categories {
	.category-pill {
		display: inline-block;
		width: fit-content;
		padding: 6px 12px;
		margin-bottom: 8px;
		background-color: #ecf5fe;
		font-size: 14px;
		border-radius: 18px;
		color: var(--blue-500);
	}
}


.shopping-badge {
	position: relative;
	top: -10px;
	left: -12px;
	background: var(--red-600);
	align-items: center;
	height: 16px;
	font-size: 10px;
	border-radius: 50%;
}


.cart-animate {
	animation: wiggle 0.5s linear;
}
@keyframes wiggle {
	8%,
	41% {
		transform: translateX(-10px);
	}
	25%,
	58% {
		transform: translate(10px);
	}
	75% {
		transform: translate(-5px);
	}
	92% {
		transform: translate(5px);
	}
	0%,
	100% {
		transform: translate(0);
	}
}

.total-discount {
	font-size: 14px;
	color: var(--primary-color) !important;
}

#page-cart {
	.shopping-cart-header {
		font-weight: bold;
	}

	.cart-container {
		color: var(--text-color);

		.frappe-card {
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			height: fit-content;
		}

		.cart-items-header {
			font-weight: 600;
		}

		.cart-table {
			tr {
				margin-bottom: 1rem;
			}

			th, tr, td {
				border-color: var(--border-color);
				border-width: 1px;
			}

			th {
				font-weight: normal;
				font-size: 13px;
				color: var(--text-muted);
				padding: var(--padding-sm) 0;
			}

			td {
				padding: var(--padding-sm) 0;
				color: var(--text-color);
			}

			.cart-item-image {
				width: 20%;
				min-width: 100px;
				img {
					max-height: 112px;
				}
			}

			.cart-items {
				.item-title {
					width: 80%;
					font-size: 14px;
					font-weight: 500;
					color: var(--text-color);
				}

				.item-subtitle {
					color: var(--text-muted);
					font-size: 13px;
				}

				.item-subtotal {
					font-size: 14px;
					font-weight: 500;
				}

				.sm-item-subtotal {
					font-size: 14px;
					font-weight: 500;
					display: none;

					@media (max-width: 992px) {
						display: unset !important;
					}
				}

				.item-rate {
					font-size: 13px;
					color: var(--text-muted);
				}

				.free-tag {
					padding: 4px 8px;
					border-radius: 4px;
					background-color: var(--dark-green-50);
				}

				textarea {
					width: 70%;
					height: 30px;
					font-size: 14px;
				}

			}

			.cart-tax-items {
				.item-grand-total {
					font-size: 16px;
					font-weight: 700;
					color: var(--text-color);
				}
			}

			.column-sm-view {
				@media (max-width: 992px) {
					display: none !important;
				}
			}

			.item-column {
				width: 50%;
				@media (max-width: 992px) {
					width: 70%;
				}
			}

			.remove-cart-item {
				border-radius: 6px;
				border: 1px solid var(--gray-100);
				width: 28px;
				height: 28px;
				font-weight: 300;
				color: var(--gray-700);
				background-color: var(--gray-100);
				float: right;
				cursor: pointer;
				margin-top: .25rem;
				justify-content: center;
			}

			.remove-cart-item-logo {
				margin-top: 2px;
				margin-left: 2.2px;
				fill: var(--gray-700) !important;
			}
		}

		.cart-payment-addresses {
			hr {
				border-color: var(--border-color);
			}
		}

		.payment-summary {
			h6 {
				padding-bottom: 1rem;
				border-bottom: solid 1px var(--gray-200);
			}

			table {
				font-size: 14px;
				td {
					padding: 0;
					padding-top: 0.35rem !important;
					border: none !important;
				}

				&.grand-total {
					border-top: solid 1px var(--gray-200);
				}
			}

			.bill-label {
				color: var(--gray-600);
			}

			.bill-content {
				font-weight: 500;
				&.net-total {
					font-size: 16px;
					font-weight: 600;
				}
			}

			.btn-coupon-code {
				font-size: 14px;
				border: dashed 1px var(--gray-400);
				box-shadow: none;
			}
		}

		.number-spinner {
			width: 75%;
			min-width: 105px;
			.cart-btn {
				border: none;
				background: var(--gray-100);
				box-shadow: none;
				width: 24px;
				height: 28px;
				align-items: center;
				justify-content: center;
				display: flex;
				font-size: 20px;
				font-weight: 300;
				color: var(--gray-700);
			}

			.cart-qty {
				height: 28px;
				font-size: 13px;
				&:disabled {
					background: var(--gray-100);
					opacity: 0.65;
				}
			}
		}

		.place-order-container {
			.btn-place-order {
				float: right;
			}
		}
	}

	.t-and-c-container {
		padding: 1.5rem;
	}

	.t-and-c-terms {
		font-size: 14px;
	}
}

.no-image-cart-item {
	max-height: 112px;
	display: flex; justify-content: center;
	background-color: var(--gray-200);
	align-items: center;
	color: var(--gray-400);
	margin-top: .15rem;
	border-radius: 6px;
	height: 100%;
	font-size: 24px;
}

.cart-empty.frappe-card {
	min-height: 76vh;
	@include flex(flex, center, center, column);

	.cart-empty-message {
		font-size: 18px;
		color: var(--text-color);
		font-weight: bold;
	}
}

.address-card {
	.card-title {
		font-size: 14px;
		font-weight: 500;
	}

	.card-body {
		max-width: 80%;
	}

	.card-text {
		font-size: 13px;
		color: var(--gray-700);
	}

	.card-link {
		font-size: 13px;

		svg use {
			stroke: var(--primary-color);
		}
	}

	.btn-change-address {
		border: 1px solid var(--primary-color);
		color: var(--primary-color);
		box-shadow: none;
	}
}

.address-header {
	margin-top: .15rem;padding: 0;
}

.btn-new-address {
	float: right;
	font-size: 15px !important;
	color: var(--primary-color) !important;
}

.btn-new-address:hover, .btn-change-address:hover {
	color: var(--primary-color) !important;
}

.modal .address-card {
	.card-body {
		padding: var(--padding-sm);
		border-radius: var(--border-radius);
		border: 1px solid var(--dark-border-color);
	}
}

.cart-indicator {
	position: absolute;
	text-align: center;
	width: 22px;
	height: 22px;
	left: calc(100% - 40px);
	top: 22px;

	border-radius: 66px;
	box-shadow: 0px 2px 6px rgba(17, 43, 66, 0.08), 0px 1px 4px rgba(17, 43, 66, 0.1);
	background: white;
	color: var(--primary-color);
	font-size: 14px;

	&.list-indicator {
		position: unset;
		margin-left: auto;
	}
}


.like-action {
	visibility: hidden;
	text-align: center;
	position: absolute;
	cursor: pointer;
	width: 28px;
	height: 28px;
	left: 20px;
	top: 20px;

	/* White */
	background: white;
	box-shadow: 0px 2px 6px rgba(17, 43, 66, 0.08), 0px 1px 4px rgba(17, 43, 66, 0.1);
	border-radius: 66px;

	&.like-action-wished {
		visibility: visible !important;
	}

	@media (max-width: 992px) {
		visibility: visible !important;
	}
}

.like-action-list {
	visibility: hidden;
	text-align: center;
	position: absolute;
	cursor: pointer;
	width: 28px;
	height: 28px;
	left: 20px;
	top: 0;

	/* White */
	background: white;
	box-shadow: 0px 2px 6px rgba(17, 43, 66, 0.08), 0px 1px 4px rgba(17, 43, 66, 0.1);
	border-radius: 66px;

	&.like-action-wished {
		visibility: visible !important;
	}

	@media (max-width: 992px) {
		visibility: visible !important;
	}
}

.like-action-item-fp {
	visibility: visible !important;
	position: unset;
	float: right;
}

.like-animate {
	animation: expand cubic-bezier(0.04, 0.4, 0.5, 0.95) 1.6s forwards 1;
}

@keyframes expand {
	30% {
	  transform: scale(1.3);
	}
	50% {
	  transform: scale(0.8);
	}
	70% {
		transform: scale(1.1);
	}
	100% {
	  transform: scale(1);
	}
  }

.not-wished {
	cursor: pointer;
	--icon-stroke: #F47A7A !important;

	&:hover {
		fill: #F47A7A;
	}
}

.wished {
	--icon-stroke: none;
	fill: #F47A7A !important;
}

.list-row-checkbox {
	&:before {
		display: none;
	}

	&:checked:before {
		display: block;
		z-index: 1;
	}
}

#pay-for-order {
	padding: .5rem 1rem; // Pay button in SO
}

.btn-explore-variants {
	visibility: hidden;
	box-shadow: none;
	margin: var(--margin-sm) 0;
	width: 90px;
	max-height: 50px; // to avoid resizing on window resize
	flex: none;
	transition: 0.3s ease;

	color: white;
	background-color: var(--orange-500);
	border: 1px solid var(--orange-500);
	font-size: 13px;

	&:hover {
		color: white;
	}
}

.btn-add-to-cart-list{
	visibility: hidden;
	box-shadow: none;
	margin: var(--margin-sm) 0;
	// margin-top: auto !important;
	max-height: 50px; // to avoid resizing on window resize
	flex: none;
	transition: 0.3s ease;

	font-size: 13px;

	&:hover {
		color: white;
	}

	@media (max-width: 992px) {
		visibility: visible !important;
	}
}

.go-to-cart-grid {
	max-height: 30px;
	margin-top: 1rem !important;
}

.go-to-cart {
	max-height: 30px;
	float: right;
}

.remove-wish {
	background-color: white;
	position: absolute;
	cursor: pointer;
	top:10px;
	right: 20px;
	width: 32px;
	height: 32px;

	border-radius: 50%;
	border: 1px solid var(--gray-100);
	box-shadow: 0px 2px 6px rgba(17, 43, 66, 0.08), 0px 1px 4px rgba(17, 43, 66, 0.1);
}

.wish-removed {
	display: none;
}

.item-website-specification {
	font-size: .875rem;
	.product-title {
		font-size: 18px;
	}

	.table {
		width: 70%;
	}

	td {
		border: none !important;
	}

	.spec-label {
		color: var(--gray-600);
	}

	.spec-content {
		color: var(--gray-800);
	}
}

.reviews-full-page {
	padding: 1rem 2rem;
}

.ratings-reviews-section {
	border-top: 1px solid #E2E6E9;
	padding: .5rem 1rem;
}

.reviews-header {
	font-size: 20px;
	font-weight: 600;
	color: var(--gray-800);
	display: flex;
	align-items: center;
	padding: 0;
}

.btn-write-review {
	float: right;
	padding: .5rem 1rem;
	font-size: 14px;
	font-weight: 400;
	border: none !important;
	box-shadow: none;

	color: var(--gray-900);
	background-color: var(--gray-100);

	&:hover {
		box-shadow: var(--btn-shadow);
	}
}

.btn-view-more {
	font-size: 14px;
}

.rating-summary-section {
	display: flex;
}

.rating-summary-title {
	margin-top: 0.15rem;
	font-size: 18px;
}

.rating-summary-numbers {
	display: flex;
	flex-direction: column;
	align-items: center;

	border-right: solid 1px var(--gray-100);
}

.user-review-title {
	margin-top: 0.15rem;
	font-size: 15px;
	font-weight: 600;
}

.rating {
	--star-fill: var(--gray-300);
	.star-hover {
		--star-fill: var(--yellow-100);
	}
	.star-click {
		--star-fill: var(--yellow-300);
	}
}

.ratings-pill {
	background-color: var(--gray-100);
	padding: .5rem 1rem;
	border-radius: 66px;
}

.review {
	max-width: 80%;
	line-height: 1.6;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid #E2E6E9;
}

.review-signature {
	display: flex;
	font-size: 13px;
	color: var(--gray-500);
	font-weight: 400;

	.reviewer {
		padding-right: 8px;
		color: var(--gray-600);
	}
}

.rating-progress-bar-section {
	padding-bottom: 2rem;

	.rating-bar-title {
		margin-left: -15px;
	}

	.rating-progress-bar {
		margin-bottom: 4px;
		height: 7px;
		margin-top: 6px;

		.progress-bar-cosmetic {
			background-color: var(--gray-600);
			border-radius: var(--border-radius);
		}
	}
}

.offer-container {
	font-size: 14px;
}

#search-results-container {
	border: 1px solid var(--gray-200);
	padding: .25rem 1rem;

	.category-chip {
		background-color: var(--gray-100);
		border: none !important;
		box-shadow: none;
	}

	.recent-search {
		padding: .5rem .5rem;
		border-radius: var(--border-radius);

		&:hover {
			background-color: var(--gray-100);
		}
	}
}

#search-box {
	background-color: white;
	height: 100%;
	padding-left: 2.5rem;
	border: 1px solid var(--gray-200);
}

.search-icon {
	position: absolute;
	left: 0;
	top: 0;
	width: 2.5rem;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	padding-bottom: 1px;
}

#toggle-view {
	float: right;

	.btn-primary {
		background-color: var(--gray-600);
		box-shadow: 0 0 0 0.2rem var(--gray-400);
	}
}

.placeholder-div {
	height:80%;
	width: -webkit-fill-available;
	padding: 50px;
	text-align: center;
	background-color: #F9FAFA;
	border-top-left-radius: calc(0.75rem - 1px);
	border-top-right-radius: calc(0.75rem - 1px);
}
.placeholder {
	font-size: 72px;
}

[data-path="cart"] {
	.modal-backdrop {
		background-color: var(--gray-50); // lighter backdrop only on cart freeze
	}
}

.item-thumb {
	height: 50px;
	max-width: 80px;
	min-width: 80px;
	object-fit: cover;
}

.brand-line {
	color: gray;
}

.btn-next, .btn-prev {
	font-size: 14px;
}

.alert-error {
	color: #e27a84;
	background-color: #fff6f7;
	border-color: #f5c6cb;
}

.font-md {
	font-size: 14px !important;
}

.in-green {
	color: var(--green-info) !important;
	font-weight: 500;
}

.has-stock {
	font-weight: 400 !important;
}

.out-of-stock {
	font-weight: 400;
	font-size: 14px;
	line-height: 20px;
	color: #F47A7A;
}

.mt-minus-2 {
	margin-top: -2rem;
}

.mt-minus-1 {
	margin-top: -1rem;
}

.tooltip-content {
	position: absolute;
	bottom: 100%;
	left: 0;
	z-index: 9999;
	padding: 2px 6px;
	border-radius: var(--border-radius-sm);
	background-color: var(--bg-dark-gray);
	color: var(--text-dark);
	font-size: var(--text-xs);
	opacity: 0;
	cursor: copy;
	transition: opacity 0.3s, transform 3s;
	pointer-events: none;
}

.show-tooltip .frappe-control:hover .tooltip-content {
	opacity: 1;
	transform: translate3d(0, 0, 0);
	pointer-events: auto;
}

.w-fit {
	width: fit-content !important;
}

================================================
FILE: webshop/public/web.bundle.js
================================================
import './js/init'

import './js/customer_reviews'
import './js/product_ui/grid'
import './js/product_ui/list'
import './js/product_ui/search'
import './js/product_ui/views'
import './js/shopping_cart'
import './js/wishlist'


================================================
FILE: webshop/setup/install.py
================================================
import click
import frappe

from frappe import _
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields

from webshop.webshop.utils.setup import has_ecommerce_fields

def after_install():
	run_patches()
	copy_from_ecommerce_settings()
	drop_ecommerce_settings()
	remove_ecommerce_settings_doctype()
	add_custom_fields()
	navbar_add_products_link()
	say_thanks()


def copy_from_ecommerce_settings():
	if not has_ecommerce_fields():
		return

	frappe.reload_doc("webshop", "doctype", "webshop_settings")

	qb = frappe.qb
	table = frappe.qb.Table("tabSingles")
	old_doctype = "E Commerce Settings"
	new_doctype = "Webshop Settings"

	entries = (
		qb.from_(table)
		.select(table.field, table.value)
		.where((table.doctype == old_doctype) & (table.field != "name"))
		.run(as_dict=True)
	)

	for e in entries:
		qb.into(table).insert(new_doctype, e.field, e.value).run()

	for doctype in ["Website Filter Field", "Website Attribute"]:
		table = qb.DocType(doctype)
		query = (
			qb.update(table)
			.set(table.parent, new_doctype)
			.set(table.parenttype, new_doctype)
			.where(table.parent == old_doctype)
		)

		query.run()

def drop_ecommerce_settings():
	frappe.delete_doc_if_exists("DocType", "E Commerce Settings", force=True)


def remove_ecommerce_settings_doctype():
	if not has_ecommerce_fields():
		return

	table = frappe.qb.Table("tabSingles")
	old_doctype = "E Commerce Settings"

	frappe.qb.from_(table).delete().where(table.doctype == old_doctype).run()


def add_custom_fields():
	custom_fields = {
		"Item": [
			{
				"default": 0,
				"depends_on": "published_in_website",
				"fieldname": "published_in_website",
				"fieldtype": "Check",
				"ignore_user_permissions": 1,
				"insert_after": "default_manufacturer_part_no",
				"label": "Published In Website",
				"read_only": 1,
				"no_copy": 1,
			}
		],
		"Item Group": [
			{
				"fieldname": "custom_website_settings",
				"fieldtype": "Section Break",
				"label": "Website Settings",
				"insert_after": "taxes",
			},
			{
				"default": "0",
				"description": "Make Item Group visible in website",
				"fieldname": "show_in_website",
				"fieldtype": "Check",
				"label": "Show in Website",
				"insert_after": "custom_website_settings",
			},
			{
				"depends_on": "show_in_website",
				"fieldname": "route",
				"fieldtype": "Data",
				"label": "Route",
				"no_copy": 1,
				"unique": 1,
				"insert_after": "show_in_website",
			},
			{
				"depends_on": "show_in_website",
				"fieldname": "website_title",
				"fieldtype": "Data",
				"label": "Title",
				"insert_after": "route",
			},
			{
				"depends_on": "show_in_website",
				"description": "HTML / Banner that will show on the top of product list.",
				"fieldname": "description",
				"fieldtype": "Text Editor",
				"label": "Description",
				"insert_after": "website_title",
			},
			{
				"default": "0",
				"depends_on": "show_in_website",
				"description": "Include Website Items belonging to child Item Groups",
				"fieldname": "include_descendants",
				"fieldtype": "Check",
				"label": "Include Descendants",
				"insert_after": "website_title",
			},
			{
				"fieldname": "column_break_16",
				"fieldtype": "Column Break",
				"insert_after": "include_descendants",
			},
			{
				"depends_on": "show_in_website",
				"fieldname": "weightage",
				"fieldtype": "Int",
				"label": "Weightage",
				"insert_after": "column_break_16",
			},
			{
				"depends_on": "show_in_website",
				"description": "Show this slideshow at the top of the page",
				"fieldname": "slideshow",
				"fieldtype": "Link",
				"label": "Slideshow",
				"options": "Website Slideshow",
				"insert_after": "weightage",
			},
			{
				"depends_on": "show_in_website",
				"fieldname": "website_specifications",
				"fieldtype": "Table",
				"label": "Website Specifications",
				"options": "Item Website Specification",
				"insert_after": "description",
			},
			{
				"collapsible": 1,
				"depends_on": "show_in_website",
				"fieldname": "website_filters_section",
				"fieldtype": "Section Break",
				"label": "Website Filters",
				"insert_after": "website_specifications",
			},
			{
				"fieldname": "filter_fields",
				"fieldtype": "Table",
				"label": "Item Fields",
				"options": "Website Filter Field",
				"insert_after": "website_filters_section",
			},
			{
				"fieldname": "filter_attributes",
				"fieldtype": "Table",
				"label": "Attributes",
				"options": "Website Attribute",
				"insert_after": "filter_fields",
			},
		]
	}

	frappe.make_property_setter(
		{
			"doctype": "Item Group",
			"doctype_or_field": "DocType",
			"fieldname": "allow_guest_to_view",
			"property": "allow_guest_to_view",
			"value": 1,
			"property_type": "Check"
		},
		is_system_generated=True,
	)

	return create_custom_fields(custom_fields)

def navbar_add_products_link():
	website_settings = frappe.get_doc("Website Settings")
	if website_settings.top_bar_items:
		return

	website_settings.append(
		"top_bar_items",
		{
			"label": _("Products"),
			"url": "/all-products",
			"right": False,
		},
	)

	website_settings.save()


def say_thanks():
	click.secho("Thank you for installing Frappe Webshop!", color="green")


patches = [
	"create_website_items",
	"populate_e_commerce_settings",
	"add_homepage_field",
	"make_homepage_products_website_items",
	"fetch_thumbnail_in_website_items",
	"convert_to_website_item_in_item_card_group_template",
	"shopping_cart_to_ecommerce",
	"copy_custom_field_filters_to_website_item",
]

def run_patches():
	# Customers migrating from v13 to v15 directly need to run all below patches

	frappe.flags.in_patch = True

	try:
		for patch in patches:
			frappe.get_attr(f"webshop.patches.{patch}.execute")()

	finally:
		frappe.flags.in_patch = False




================================================
FILE: webshop/templates/__init__.py
================================================


================================================
FILE: webshop/templates/generators/item/item.html
================================================
{% extends "templates/web.html" %}
{% from "webshop/templates/includes/macros.html" import recommended_item_row %}

{% block title %} {{ title }} {% endblock %}

{% block breadcrumbs %}
<div class="item-breadcrumbs small text-muted">
	{% include "templates/includes/breadcrumbs.html" %}
</div>
{% endblock %}

{% block page_content %}
<div class="product-container item-main">
	{% from "webshop/templates/includes/macros.html" import product_image %}
	<div class="item-content">
		<div class="product-page-content" itemscope itemtype="http://schema.org/Product">
			<!-- Image, Description, Add to Cart -->
			<div class="row mb-5">
				{% include "templates/generators/item/item_image.html" %}
				{% include "templates/generators/item/item_details.html" %}
			</div>
		</div>
	</div>
</div>

<!-- Additional Info/Reviews, Recommendations -->
<div class="d-flex">
	{% set show_recommended_items = recommended_items and shopping_cart.cart_settings.enable_recommendations %}
	{% set info_col = 'col-9' if show_recommended_items else 'col-12' %}

	{% set padding_top = 'pt-0' if (show_tabs and tabs) else '' %}

	<div class="product-container mt-4 {{ padding_top }} {{ info_col }}">
		<div class="item-content {{ 'mt-minus-2' if (show_tabs and tabs) else '' }}">
			<div class="product-page-content" itemscope itemtype="http://schema.org/Product">
				<!-- Product Specifications Table Section -->
				{% if show_tabs and tabs %}
					<div class="category-tabs">
						<!-- tabs -->
							{{ web_block("Section with Tabs", values=tabs, add_container=0,
								add_top_padding=0, add_bottom_padding=0)
							}}
					</div>
				{% elif website_specifications %}
					{% include "templates/generators/item/item_specifications.html"%}
				{% endif %}

				<!-- Advanced Custom Website Content -->
				{{ doc.website_content or '' }}

				<!-- Reviews and Comments -->
				{% if shopping_cart.cart_settings.enable_reviews and not doc.has_variants %}
					{% include "templates/generators/item/item_reviews.html"%}
				{% endif %}
			</div>
		</div>
	</div>

	<!-- Recommended Items -->
	{% if show_recommended_items %}
		<div class="mt-4 col-3 recommended-item-section">
			<span class="recommendation-header">{{ _("Recommended") }}</span>
			<div class="product-container mt-2 recommendation-container">
				{% for item in recommended_items %}
					{{ recommended_item_row(item) }}
				{% endfor %}
			</div>
		</div>
	{% endif %}

</div>
{% endblock %}

{% block base_scripts %}
<!-- js should be loaded in body! -->
<script type="text/javascript" src="/assets/frappe/js/lib/jquery/jquery.min.js"></script>
{{ include_script("frappe-web.bundle.js") }}
{{ include_script("controls.bundle.js") }}
{{ include_script("dialog.bundle.js") }}
{% endblock %}


================================================
FILE: webshop/templates/generators/item/item_add_to_cart.html
================================================
{% if shopping_cart and shopping_cart.cart_settings.enabled %}

{% set cart_settings = shopping_cart.cart_settings %}
{% set product_info = shopping_cart.product_info %}

<div class="item-cart row mt-2" data-variant-item-code="{{ item_code }}">
	<div class="col-md-12">
		<!-- Price and Availability -->
		{% if cart_settings.show_price and product_info.price %}
			{% set price_info = product_info.price %}

			<div class="product-price" itemprop="offers" itemscope itemtype="https://schema.org/AggregateOffer">
				<!-- Final Price -->
				{% if price_info.formatted_mrp %}
					<span itemprop="lowPrice" content="{{ price_info.formatted_price_sales_uom }}">{{ price_info.formatted_price_sales_uom }}</span>
				{% else %}
					<span itemprop="highPrice" content="{{ price_info.formatted_price_sales_uom }}">{{ price_info.formatted_price_sales_uom }}</span>
				{% endif %}

				<!-- Striked Price and Discount  -->
				{% if price_info.formatted_mrp %}
					<small itemprop="highPrice" class="formatted-price">
						<s>MRP {{ price_info.formatted_mrp }}</s>
					</small>
					<small class="ml-1 formatted-price in-green">
						-{{ price_info.get("formatted_discount_percent") or price_info.get("formatted_discount_rate")}}
					</small>
				{% endif %}

				<!-- Price per UOM -->
				<small class="formatted-price ml-2">
					({{ price_info.formatted_price }} / {{ product_info.uom }})
				</small>
			</div>
		{% else %}
			{{ _("UOM") }} : {{ product_info.uom }}
		{% endif %}

		{% if cart_settings.show_stock_availability %}
		<div class="mt-2">
			{% if product_info.get("on_backorder") %}
				<span class="no-stock out-of-stock" style="color: var(--primary-color);">
					{{ _('Available on backorder') }}
				</span>
			{% elif product_info.in_stock == 0 %}
				<span class="no-stock out-of-stock">
					{{ _('Out of stock') }}
				</span>
			{% elif product_info.in_stock == 1 %}
				<span class="in-green has-stock">
					{{ _('In stock') }}
					{% if product_info.show_stock_qty and product_info.stock_qty %}
						({{ product_info.stock_qty }})
					{% endif %}
				</span>
			{% endif %}
		</div>
		{% endif %}

		<!-- Offers -->
		{% if doc.offers %}
			<br>
			<div class="offers-heading mb-4">
				<span class="mr-1 tag-icon">
					<svg class="icon icon-lg"><use href="#icon-tag"></use></svg>
				</span>
				<b>Available Offers</b>
			</div>
			<div class="offer-container">
				{% for offer in doc.offers %}
				<div class="mt-2 d-flex">
					<div class="mr-2" >
						<svg width="24" height="24" viewBox="0 0 24 24" stroke="var(--yellow-500)" fill="none" xmlns="http://www.w3.org/2000/svg">
							<path d="M19 15.6213C19 15.2235 19.158 14.842 19.4393 14.5607L20.9393 13.0607C21.5251 12.4749 21.5251 11.5251 20.9393 10.9393L19.4393 9.43934C19.158 9.15804 19 8.7765 19 8.37868V6.5C19 5.67157 18.3284 5 17.5 5H15.6213C15.2235 5 14.842 4.84196 14.5607 4.56066L13.0607 3.06066C12.4749 2.47487 11.5251 2.47487 10.9393 3.06066L9.43934 4.56066C9.15804 4.84196 8.7765 5 8.37868 5H6.5C5.67157 5 5 5.67157 5 6.5V8.37868C5 8.7765 4.84196 9.15804 4.56066 9.43934L3.06066 10.9393C2.47487 11.5251 2.47487 12.4749 3.06066 13.0607L4.56066 14.5607C4.84196 14.842 5 15.2235 5 15.6213V17.5C5 18.3284 5.67157 19 6.5 19H8.37868C8.7765 19 9.15804 19.158 9.43934 19.4393L10.9393 20.9393C11.5251 21.5251 12.4749 21.5251 13.0607 20.9393L14.5607 19.4393C14.842 19.158 15.2235 19 15.6213 19H17.5C18.3284 19 19 18.3284 19 17.5V15.6213Z" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
							<path d="M15 9L9 15" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
							<path d="M10.5 9.5C10.5 10.0523 10.0523 10.5 9.5 10.5C8.94772 10.5 8.5 10.0523 8.5 9.5C8.5 8.94772 8.94772 8.5 9.5 8.5C10.0523 8.5 10.5 8.94772 10.5 9.5Z" fill="white" stroke-linecap="round" stroke-linejoin="round"/>
							<path d="M15.5 14.5C15.5 15.0523 15.0523 15.5 14.5 15.5C13.9477 15.5 13.5 15.0523 13.5 14.5C13.5 13.9477 13.9477 13.5 14.5 13.5C15.0523 13.5 15.5 13.9477 15.5 14.5Z" fill="white" stroke-linecap="round" stroke-linejoin="round"/>
						</svg>
					</div>
					<p class="mr-1 mb-1">
						{{ _(offer.offer_title) }}:
						{{ _(offer.offer_subtitle) if offer.offer_subtitle else '' }}
						<a class="offer-details" href="#"
							data-offer-title="{{ offer.offer_title }}" data-offer-id="{{ offer.name }}"
							role="button">
							{{ _("More") }}
						</a>
					</p>
				</div>
				{% endfor %}
			</div>
		{% endif %}

		<!-- Add to Cart / View in Cart, Contact Us -->
		<div class="mt-6 mb-5">
			<div class="mb-4 d-flex">
				<!-- Add to Cart -->
				{% if product_info.price and (cart_settings.allow_items_not_in_stock or product_info.get("in_stock")) %}
					<a href="/cart" class="btn btn-light btn-view-in-cart hidden mr-2 font-md"
						role="button">
						{{  _("View in Cart") if cart_settings.enable_checkout else _("View in Quote") }}
					</a>
					<button
						data-item-code="{{item_code}}"
						class="btn btn-primary btn-add-to-cart mr-2 w-30-40"
					>
						<span class="mr-2">
							<svg class="icon icon-md">
								<use href="#icon-assets"></use>
							</svg>
						</span>
						{{ _("Add to Cart") if cart_settings.enable_checkout else  _("Add to Quote") }}
					</button>
				{% endif %}

				<!-- Contact Us -->
				{% if cart_settings.show_contact_us_button %}
					{% include "templates/generators/item/item_inquiry.html" %}
				{% endif %}
			</div>
		</div>
	</div>
</div>

<script>
	frappe.ready(() => {
		$('.page_content').on('click', '.btn-add-to-cart', (e) => {
			// Bind action on add to cart button
			const $btn = $(e.currentTarget);
			$btn.prop('disabled', true);
			const item_code = $btn.data('item-code');
			webshop.webshop.shopping_cart.update_cart({
				item_code,
				qty: 1,
				callback(r) {
					$btn.prop('disabled', false);
					if (r.message) {
						$('.btn-add-to-cart, .btn-view-in-cart').toggleClass('hidden');
					}
				}
			});
		});

		$('.page_content').on('click', '.offer-details', (e) => {
			// Bind action on More link in Offers
			const $btn = $(e.currentTarget);
			$btn.prop('disabled', true);

			var d = new frappe.ui.Dialog({
				title: __($btn.data('offer-title')),
				fields: [
					{
						fieldname: 'offer_details',
						fieldtype: 'HTML'
					},
					{
						fieldname: 'section_break',
						fieldtype: 'Section Break'
					}
				]
			});

			frappe.call({
				method: 'webshop.webshop.doctype.website_offer.website_offer.get_offer_details',
				args: {
					offer_id: $btn.data('offer-id')
				},
				callback: (value) => {
					d.set_value("offer_details", value.message);
					d.show();
					$btn.prop('disabled', false);
				}
			})

		});
	});


</script>

{% endif %}


================================================
FILE: webshop/templates/generators/item/item_configure.html
================================================
{% if shopping_cart and shopping_cart.cart_settings.enabled %}
{% set cart_settings = shopping_cart.cart_settings %}

<div class="mt-5 mb-6">
	{% if cart_settings.enable_variants | int %}
	<button class="btn btn-primary-light btn-configure font-md mr-2"
		data-item-code="{{ doc.item_code }}"
		data-item-name="{{ doc.web_item_name }}"
	>
		{{ _('Select Variant') }}
	</button>
	{% endif %}
	{% if cart_settings.show_contact_us_button %}
		{% include "templates/generators/item/item_inquiry.html" %}
	{% endif %}
</div>
<script>
{% include "templates/generators/item/item_configure.js" %}
</script>
{% endif %}


================================================
FILE: webshop/templates/generators/item/item_configure.js
================================================
class ItemConfigure {
	constructor(item_code, item_name) {
		this.item_code = item_code;
		this.item_name = item_name;

		this.get_attributes_and_values()
			.then(attribute_data => {
				this.attribute_data = attribute_data;
				this.show_configure_dialog();
			});
	}

	show_configure_dialog() {
		const fields = this.attribute_data.map(a => {
			return {
				fieldtype: 'Select',
				label: a.attribute,
				fieldname: a.attribute,
				options: a.values.map(v => {
					return {
						label: v,
						value: v
					};
				}),
				change: (e) => {
					this.on_attribute_selection(e);
				}
			};
		});

		this.dialog = new frappe.ui.Dialog({
			title: __('Select Variant for {0}', [this.item_name]),
			fields,
			on_hide: () => {
				set_continue_configuration();
			}
		});

		this.attribute_data.forEach(a => {
			const field = this.dialog.get_field(a.attribute);
			const $a = $(`<a href>${__("Clear")}</a>`);
			$a.on('click', (e) => {
				e.preventDefault();
				this.dialog.set_value(a.attribute, '');
			});
			field.$wrapper.find('.help-box').append($a);
		});

		this.append_status_area();
		this.dialog.show();

		this.dialog.set_values(JSON.parse(localStorage.getItem(this.get_cache_key())));

		$('.btn-configure').prop('disabled', false);
	}

	on_attribute_selection(e) {
		if (e) {
			const changed_fieldname = $(e.target).data('fieldname');
			this.show_range_input_if_applicable(changed_fieldname);
		} else {
			this.show_range_input_for_all_fields();
		}

		const values = this.dialog.get_values();
		if (Object.keys(values).length === 0) {
			this.clear_status();
			localStorage.removeItem(this.get_cache_key());
			return;
		}

		// save state
		localStorage.setItem(this.get_cache_key(), JSON.stringify(values));

		// show
		this.set_loading_status();

		this.get_next_attribute_and_values(values)
			.then(data => {
				const {
					valid_options_for_attributes,
				} = data;

				this.set_item_found_status(data);

				for (let attribute in valid_options_for_attributes) {
					const valid_options = valid_options_for_attributes[attribute];
					const options = this.dialog.get_field(attribute).df.options;
					const new_options = options.map(o => {
						o.disabled = !valid_options.includes(o.value);
						return o;
					});

					this.dialog.set_df_property(attribute, 'options', new_options);
					this.dialog.get_field(attribute).set_options();
				}
			});
	}

	show_range_input_for_all_fields() {
		this.dialog.fields.forEach(f => {
			if (!["Section Break", "Coulmn Break"].includes(f.fieldtype)) {
				this.show_range_input_if_applicable(f.fieldname);
			}
		});
	}

	show_range_input_if_applicable(fieldname) {
		const changed_field = this.dialog.get_field(fieldname);
		const changed_value = changed_field.get_value();
		if (changed_value && changed_value.includes(' to ')) {
			// possible range input
			let numbers = changed_value.split(' to ');
			numbers = numbers.map(number => parseFloat(number));

			if (!numbers.some(n => isNaN(n))) {
				numbers.sort((a, b) => a - b);
				if (changed_field.$input_wrapper.find('.range-selector').length) {
					return;
				}
				const parent = $('<div class="range-selector">')
					.insertBefore(changed_field.$input_wrapper.find('.help-box'));
				const control = frappe.ui.form.make_control({
					df: {
						fieldtype: 'Int',
						label: __('Enter value betweeen {0} and {1}', [numbers[0], numbers[1]]),
						change: () => {
							const value = control.get_value();
							if (value < numbers[0] || value > numbers[1]) {
								control.$wrapper.addClass('was-validated');
								control.set_description(
									__('Value must be between {0} and {1}', [numbers[0], numbers[1]]));
								control.$input[0].setCustomValidity('error');
							} else {
								control.$wrapper.removeClass('was-validated');
								control.set_description('');
								control.$input[0].setCustomValidity('');
								this.update_range_values(fieldname, value);
							}
						}
					},
					render_input: true,
					parent
				});
				control.$wrapper.addClass('mt-3');
			}
		}
	}

	update_range_values(attribute, range_value) {
		this.range_values = this.range_values || {};
		this.range_values[attribute] = range_value;
	}

	show_remaining_optional_attributes() {
		// show all attributes if remaining
		// unselected attributes are all optional
		const unselected_attributes = this.dialog.fields.filter(df => {
			const value_selected = this.dialog.get_value(df.fieldname);
			return !value_selected;
		});
		const is_optional_attribute = df => {
			const optional_attributes = this.attribute_data
				.filter(a => a.optional).map(a => a.attribute);
			return optional_attributes.includes(df.fieldname);
		};
		if (unselected_attributes.every(is_optional_attribute)) {
			unselected_attributes.forEach(df => {
				this.dialog.fields_dict[df.fieldname].$wrapper.show();
			});
		}
	}

	set_loading_status() {
		this.dialog.$status_area.html(`
			<div class="alert alert-warning d-flex justify-content-between align-items-center" role="alert">
				${__('Loading...')}
			</div>
		`);
	}

	set_item_found_status(data) {
		const html = this.get_html_for_item_found(data);
		this.dialog.$status_area.html(html);
	}

	clear_status() {
		this.dialog.$status_area.empty();
	}

	get_html_for_item_found({ filtered_items_count, filtered_items, exact_match, product_info }) {
		const one_item = exact_match.length === 1
			? exact_match[0]
			: filtered_items_count === 1
				? filtered_items[0]
				: '';

		const item_add_to_cart = one_item ? `
			<button data-item-code="${one_item}"
				class="btn btn-primary btn-add-to-cart w-100"
				data-action="btn_add_to_cart"
			>
				<span class="mr-2">
					${frappe.utils.icon('assets', 'md')}
				</span>
				${__("Add to Cart")}
			</button>
		` : '';

		const items_found = filtered_items_count === 1 ?
			__('{0} item found.', [filtered_items_count]) :
			__('{0} items found.', [filtered_items_count]);

		/* eslint-disable indent */
		const item_found_status = exact_match.length === 1
			? `<div class="alert alert-success d-flex justify-content-between align-items-center" role="alert">
				<div><div>
					${one_item}
					${product_info && product_info.price && !$.isEmptyObject(product_info.price)
						? '(' + product_info.price.formatted_price_sales_uom + ')'
						: ''
					}
				</div></div>
				<a href data-action="btn_clear_values" data-item-code="${one_item}">
					${__('Clear Values')}
				</a>
			</div>`
			: `<div class="alert alert-warning d-flex justify-content-between align-items-center" role="alert">
					<span>
						${items_found}
					</span>
					<a href data-action="btn_clear_values">
						${__('Clear values')}
					</a>
			</div>`;
		/* eslint-disable indent */

		return `
			${item_found_status}
			${item_add_to_cart}
		`;
	}

	btn_add_to_cart(e) {
		if (frappe.session.user !== 'Guest') {
			localStorage.removeItem(this.get_cache_key());
		}
		const item_code = $(e.currentTarget).data('item-code');
		const additional_notes = Object.keys(this.range_values || {}).map(attribute => {
			return `${attribute}: ${this.range_values[attribute]}`;
		}).join('\n');
		webshop.webshop.shopping_cart.update_cart({
			item_code,
			additional_notes,
			qty: 1
		});
		this.dialog.hide();
	}

	btn_clear_values() {
		this.dialog.fields_list.forEach(f => {
			if (f.df?.options) {
				f.df.options = f.df.options.map(option => {
					option.disabled = false;
					return option;
				});
			}
		});
		this.dialog.clear();
		this.on_attribute_selection();
	}

	append_status_area() {
		this.dialog.$status_area = $('<div class="status-area mt-5">');
		this.dialog.$wrapper.find('.modal-body').append(this.dialog.$status_area);
		this.dialog.$wrapper.on('click', '[data-action]', (e) => {
			e.preventDefault();
			const $target = $(e.currentTarget);
			const action = $target.data('action');
			const method = this[action];
			method.call(this, e);
		});
		this.dialog.$wrapper.addClass('item-configurator-dialog');
	}

	get_next_attribute_and_values(selected_attributes) {
		return this.call('webshop.webshop.variant_selector.utils.get_next_attribute_and_values', {
			item_code: this.item_code,
			selected_attributes
		});
	}

	get_attributes_and_values() {
		return this.call('webshop.webshop.variant_selector.utils.get_attributes_and_values', {
			item_code: this.item_code
		});
	}

	get_cache_key() {
		return `configure:${this.item_code}`;
	}

	call(method, args) {
		// promisified frappe.call
		return new Promise((resolve, reject) => {
			frappe.call(method, args)
				.then(r => resolve(r.message))
				.fail(reject);
		});
	}
}

function set_continue_configuration() {
	const $btn_configure = $('.btn-configure');
	const { itemCode } = $btn_configure.data();

	if (localStorage.getItem(`configure:${itemCode}`)) {
		$btn_configure.text(__('Continue Selection'));
	} else {
		$btn_configure.text(__('Select Variant'));
	}
}

frappe.ready(() => {
	const $btn_configure = $('.btn-configure');
	if (!$btn_configure.length) return;
	const { itemCode, itemName } = $btn_configure.data();

	set_continue_configuration();

	$btn_configure.on('click', () => {
		$btn_configure.prop('disabled', true);
		new ItemConfigure(itemCode, itemName);
	});
});


================================================
FILE: webshop/templates/generators/item/item_details.html
================================================
{% set width_class = "expand" if not slides else "" %}
{% set cart_settings = shopping_cart.cart_settings %}
{% set product_info = shopping_cart.product_info %}
{% set price_info = product_info.get('price') or {} %}

<div class="col-md-7 product-details {{ width_class }}">
	<div class="d-flex">
		<!-- title -->
		<div class="product-title col-11" itemprop="name">
			{{ _(doc.web_item_name) }}
		</div>

		<!-- Wishlist -->
		{% if cart_settings.enable_wishlist %}
			<div class="like-action-item-fp like-action {{ 'like-action-wished' if wished else ''}} ml-2"
				data-item-code="{{ doc.item_code }}">
				<svg class="icon sm">
					<use class="{{ 'wished' if wished else 'not-wished' }} wish-icon" href="#icon-heart"></use>
				</svg>
			</div>
		{% endif %}
	</div>

	<div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
	</div>

	<div itemprop="review" itemscope itemtype="https://schema.org/Review">
	</div>

	<p class="product-code">
		<span class="product-item-group">
			{{ _(doc.item_group) }}
		</span>
		<span class="product-item-code" itemprop="name">
			{{ _("Item Code") }}:
		</span>
		<span itemprop="name">{{ _(doc.item_code) }}</span>
	</p>
	{% if has_variants %}
		<!-- configure template -->
		{% include "templates/generators/item/item_configure.html" %}
	{% else %}
		<!-- add variant to cart -->
		{% include "templates/generators/item/item_add_to_cart.html" %}
	{% endif %}
	<!-- description -->
	<div class="product-description" itemprop="description">
	{% if frappe.utils.strip_html(doc.web_long_description or '') %}
		{{ _(doc.web_long_description) | safe }}
	{% elif frappe.utils.strip_html(doc.description or '')  %}
		{{ _(doc.description) | safe }}
	{% else %}
		{{ "" }}
	{% endif  %}
	</div>
</div>

{% block base_scripts %}
<!-- js should be loaded in body! -->
<script type="text/javascript" src="/assets/frappe/js/lib/jquery/jquery.min.js"></script>
{% endblock %}

<script>
	$('.page_content').on('click', '.like-action-item-fp', (e) => {
			// Bind action on wishlist button
			const $btn = $(e.currentTarget);
			webshop.webshop.wishlist.wishlist_action($btn);
		});
</script>


================================================
FILE: webshop/templates/generators/item/item_image.html
================================================
{% set column_size = 5 if slides else 4 %}
<div class="col-md-{{ column_size }} h-100 d-flex mb-4">
	{% if slides %}
		<div class="item-slideshow d-flex flex-column mr-3">
			{% for item in slides %}
			<img class="item-slideshow-image mb-2 {% if loop.first %}active{% endif %}"
					src="{{ item.image }}" alt="{{ item.heading }}">
			{% endfor %}
		</div>
		{{ product_image(slides[0].image, 'product-image') }}
		<!-- Simple image slideshow -->
		<script>
			frappe.ready(() => {
				$('.page_content').on('click', '.item-slideshow-image', (e) => {
					const $img = $(e.currentTarget);
					const link = $img.prop('src');
					const $product_image = $('.product-image');
					$product_image.find('a').prop('href', link);
					$product_image.find('img').prop('src', link);

					$('.item-slideshow-image').removeClass('active');
					$img.addClass('active');
				});
			})
		</script>
	{% else %}
		{{ product_image(doc.website_image, alt=doc.website_image_alt or doc.item_name) }}
	{% endif %}

	<!-- Simple image preview -->

	<div class="image-zoom-view" style="display: none;">
		<button type="button" class="close" aria-label="Close">
			<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"
			stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x">
				<line x1="18" y1="6" x2="6" y2="18"></line>
				<line x1="6" y1="6" x2="18" y2="18"></line>
			</svg>
		</button>
	</div>
</div>
<style>
	.website-image {
		cursor: pointer;
	}

	.image-zoom-view {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		height: 100vh;
		width: 100vw;
		display: flex;
		justify-content: center;
		align-items: center;
		background: rgba(0, 0, 0, 0.8);
		z-index: 1080;
	}

	.image-zoom-view img {
		max-height: 100%;
		max-width: 100%;
	}

	.image-zoom-view button {
		position: absolute;
		right: 3rem;
		top: 2rem;
	}

	.image-zoom-view svg {
		color: var(--white);
	}
</style>
<script>
	frappe.ready(() => {
		const $zoom_wrapper = $('.image-zoom-view');

		$('.website-image').on('click', (e) => {
			e.preventDefault();
			const $img = $(e.target);
			const src = $img.prop('src');
			if (!src) return;
			show_preview(src);
		});

		$zoom_wrapper.on('click', 'button', hide_preview);

		$(document).on('keydown', (e) => {
			if (e.key === 'Escape') {
				hide_preview();
			}
		});

		function show_preview(src) {
			$zoom_wrapper.show();
			const $img = $(`<img src="${src}">`)
			$zoom_wrapper.append($img);
		}

		function hide_preview() {
			$zoom_wrapper.find('img').remove();
			$zoom_wrapper.hide();
		}
	})
</script>


================================================
FILE: webshop/templates/generators/item/item_inquiry.html
================================================
{% if shopping_cart and shopping_cart.cart_settings.enabled %}
{% set cart_settings = shopping_cart.cart_settings %}
	{% if cart_settings.show_contact_us_button | int %}
		<button class="btn btn-inquiry font-md w-30-40" data-item-code="{{ doc.name }}">
			{{ _('Contact Us') }}
		</button>
	{% endif %}
<script>
{% include "templates/generators/item/item_inquiry.js" %}
</script>
{% endif %}


================================================
FILE: webshop/templates/generators/item/item_inquiry.js
================================================
frappe.ready(() => {
	const d = new frappe.ui.Dialog({
		title: __('Contact Us'),
		fields: [
			{
				fieldtype: 'Data',
				label: __('Full Name'),
				fieldname: 'lead_name',
				reqd: 1
			},
			{
				fieldtype: 'Data',
				label: __('Organization Name'),
				fieldname: 'company_name',
			},
			{
				fieldtype: 'Data',
				label: __('Email'),
				fieldname: 'email_id',
				options: 'Email',
				reqd: 1
			},
			{
				fieldtype: 'Data',
				label: __('Phone Number'),
				fieldname: 'phone',
				options: 'Phone',
				reqd: 1
			},
			{
				fieldtype: 'Data',
				label: __('Subject'),
				fieldname: 'subject',
				reqd: 1
			},
			{
				fieldtype: 'Text',
				label: __('Message'),
				fieldname: 'message',
				reqd: 1
			}
		],
		primary_action: send_inquiry,
		primary_action_label: __('Send')
	});

	function send_inquiry() {
		const values = d.get_values();
		const doc = Object.assign({}, values);
		delete doc.subject;
		delete doc.message;

		d.hide();

		frappe.call('webshop.webshop.shopping_cart.cart.create_lead_for_item_inquiry', {
			lead: doc,
			subject: values.subject,
			message: values.message
		}).then(r => {
			if (r.message) {
				d.clear();
			}
		});
	}

	$('.btn-inquiry').click((e) => {
		const $btn = $(e.target);
		const item_code = $btn.data('item-code');
		d.set_value('subject', 'Inquiry about ' + item_code);
		if (!['Administrator', 'Guest'].includes(frappe.session.user)) {
			d.set_value('email_id', frappe.session.user);
			d.set_value('lead_name', frappe.get_cookie('full_name'));
		}

		d.show();
	});
});


================================================
FILE: webshop/templates/generators/item/item_reviews.html
================================================
{% from "webshop/templates/includes/macros.html" import user_review, ratings_summary %}

<div class="mt-4 ratings-reviews-section">
		<!-- Title and Action -->
		<div class="w-100 mt-4 mb-2 d-flex">
			<div class="reviews-header col-9">
				{{ _("Customer Reviews") }}
			</div>

			<div class="write-a-review-btn col-3">
				<!-- Write a Review for legitimate users -->
				{% if frappe.session.user != "Guest" and user_is_customer %}
					<button class="btn btn-write-review"
						data-web-item="{{ doc.name }}">
						{{ _("Write a Review") }}
					</button>
				{% endif %}
			</div>
		</div>

		<!-- Summary -->
		{{ ratings_summary(reviews, reviews_per_rating, average_rating, average_whole_rating, for_summary=True, total_reviews=total_reviews) }}


	<!-- Reviews and Comments -->
	<div class="mt-8">
		{% if reviews %}
			{{ user_review(reviews) }}

			{% if total_reviews > 4 %}
				<div class="mt-6 mb-6"style="color: var(--primary);">
					<a href="/customer_reviews?web_item={{ doc.name }}">{{ _("View all reviews") }}</a>
				</div>
			{% endif %}

		{% else %}
			<h6 class="text-muted mt-6">
				{{ _("No Reviews") }}
			</h6>
		{% endif %}
	</div>
</div>

<script>
	frappe.ready(() => {
		$('.page_content').on('click', '.btn-write-review', (e) => {
			// Bind action on write a review button
			const $btn = $(e.currentTarget);

			let d = new frappe.ui.Dialog({
				title: __("Write a Review"),
				fields: [
					{fieldname: "title", fieldtype: "Data", label: __("Headline"), reqd: 1},
					{fieldname: "rating", fieldtype: "Rating", label: __("Overall Rating"), reqd: 1},
					{fieldtype: "Section Break"},
					{fieldname: "comment", fieldtype: "Small Text", label: __("Your Review")}
				],
				primary_action: function() {
					var data = d.get_values();
					frappe.call({
						method: "webshop.webshop.doctype.item_review.item_review.add_item_review",
						args: {
							web_item: "{{ doc.name }}",
							title: data.title,
							rating: data.rating,
							comment: data.comment
						},
						freeze: true,
						freeze_message: __("Submitting Review ..."),
						callback: function(r) {
							if(!r.exc) {
								frappe.msgprint({
									message: __("Thank you for the review"),
									title: __("Review Submitted"),
									indicator: "green"
								});
								d.hide();
								location.reload();
							}
						}
					});
				},
				primary_action_label: __("Submit")
			});
			d.show();
		});
	});
</script>


================================================
FILE: webshop/templates/generators/item/item_specifications.html
================================================
<!-- Is reused to render within tabs as well as independently -->
{% if website_specifications %}
<div class="{{ 'mt-2' if not show_tabs else 'mt-5'}} item-website-specification">
	<div class="col-md-11">
		{% if not show_tabs %}
			<div class="product-title mb-5 mt-4">
				{{ _("Product Details") }}
			</div>
		{% endif %}
		<table class="table">
		{% for d in website_specifications -%}
			<tr>
				<td class="spec-label">{{ _(d.label) }}</td>
				<td class="spec-content">{{ _(d.description) }}</td>
			</tr>
		{%- endfor %}
		</table>
	</div>
</div>
{% endif %}


================================================
FILE: webshop/templates/generators/item_group.html
================================================
{% from "webshop/templates/includes/macros.html" import field_filter_section, attribute_filter_section, discount_range_filters %}
{% extends "templates/web.html" %}

{% block header %}
<div class="mb-6">{{ _(item_group_name) }}</div>
{% endblock header %}

{% block script %}
<script type="text/javascript" src="/all-products/index.js"></script>
{% endblock %}

{% block breadcrumbs %}
<div class="item-breadcrumbs small text-muted">
	{% include "templates/includes/breadcrumbs.html" %}
</div>
{% endblock %}

{% block page_content %}
<div class="item-group-content" itemscope itemtype="http://schema.org/Product"
	data-item-group="{{ name }}">
	<div class="item-group-slideshow">
		{% if slideshow %} <!-- slideshow -->
			{{ web_block(
				"Hero Slider",
				values=slideshow,
				add_container=0,
				add_top_padding=0,
				add_bottom_padding=0,
			) }}
		{% endif %}

		{% if description %} <!-- description -->
		<div class="item-group-description text-muted mb-5" itemprop="description">{{ description or ""}}</div>
		{% endif %}
	</div>
	<div class="row">
		<div id="product-listing" class="col-12 order-2 col-md-9 order-md-2 item-card-group-section">
			<!-- Products Rendered in all-products/index.js-->
		</div>

		<div class="col-12 order-1 col-md-3 order-md-1">
			<div class="collapse d-md-block mr-4 filters-section" id="product-filters">
				<div class="d-flex justify-content-between align-items-center mb-5 title-section">
					<div class="mb-4 filters-title" > {{ _('Filters') }} </div>
					<a class="mb-4 clear-filters" href="/{{ doc.route }}">{{ _('Clear All') }}</a>
				</div>
				<!-- field filters -->
				{{ field_filter_section(field_filters) }}

				<!-- attribute filters -->
				{{ attribute_filter_section(attribute_filters) }}

			</div>

		</div>
	</div>
</div>

<script>
	frappe.ready(() => {
		$('.btn-prev, .btn-next').click((e) => {
			const $btn = $(e.target);
			$btn.prop('disabled', true);
			const start = $btn.data('start');
			let query_params = frappe.utils.get_query_params();
			query_params.start = start;
			let path = window.location.pathname + '?' + frappe.utils.get_url_from_dict(query_params);
			window.location.href = path;
		});
	});
</script>
{% endblock %}


================================================
FILE: webshop/templates/includes/cart/address_card.html
================================================
<div class="card address-card h-100">
	<div class="btn btn-sm btn-default btn-change-address font-md" style="position: absolute; right: 0; top: 0;">
		{{ _('Change') }}
	</div>
	<div class="card-body p-0">
		<div class="card-title">{{ address.title }}</div>
		<div class="card-text mb-2">
			{{ address.display }}
		</div>
		<a href="/address/{{address.name}}" class="card-link">
			<svg class="icon icon-sm">
				<use href="#icon-edit"></use>
			</svg>
			{{ _('Edit') }}
		</a>
	</div>
</div>


================================================
FILE: webshop/templates/includes/cart/address_picker_card.html
================================================
<div class="card address-card h-100">
	<div class="check" style="position: absolute; right: 15px; top: 15px;">
		<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><polyline points="20 6 9 17 4 12"></polyline></svg>
	</div>
	<div class="card-body">
		<h5 class="card-title">{{ address.title }}</h5>
		<p class="card-text text-muted">
			{{ address.display }}
		</p>
		<a href="/address/{{address.name}}" class="card-link">{{ _('Edit') }}</a>
	</div>
</div>


================================================
FILE: webshop/templates/includes/cart/cart_address.html
================================================
{% from "webshop/templates/includes/cart/cart_macros.html" import show_address %}

{% if addresses | length == 1%}
	{% set select_address = True %}
{% endif %}

<div class="mb-3 frappe-card p-5" data-section="shipping-address">
	<div class="d-flex">
		<div class="col-6 address-header"><h6>{{ _("Shipping Address") }}</h6></div>
		<div class="col-6" style="padding: 0;">
			<a class="ml-4 btn-new-address" role="button">{{ _("Add a new address") }}</a>
		</div>
	</div>

	<hr>
	{% for address in shipping_addresses %}
	{% if doc.shipping_address_name == address.name %}
	<div class="row no-gutters" data-fieldname="shipping_address_name">
		<div class="w-100 address-container" data-address-name="{{address.name}}" data-address-type="shipping" data-active>
			{% include "templates/includes/cart/address_card.html" %}
		</div>
	</div>
	{% endif %}
	{% endfor %}
</div>

<!-- Billing Address -->
<div class="checkbox ml-1 mb-2">
	<label for="input_same_billing">
		<input type="checkbox" class="product-filter" id="input_same_billing" checked style="width: 14px !important">
		<span class="label-area font-md">{{ _('Billing Address is same as Shipping Address') }}</span>
	</label>
</div>


<div class="mb-3 frappe-card p-5" data-section="billing-address">
	<div class="d-flex">
		<div class="col-6 address-header"><h6>{{ _("Billing Address") }}</h6></div>
		<div class="col-6" style="padding: 0;">
			<a class="ml-4 btn-new-address" role="button">{{ _("Add a new address") }}</a>
		</div>
	</div>

	<hr>
	{% for address in billing_addresses %}
		{% if doc.customer_address == address.name %}
		<div class="row no-gutters" data-fieldname="customer_address">
			<div class="w-100 address-container" data-address-name="{{address.name}}" data-address-type="billing" data-active>
					{% include "templates/includes/cart/address_card.html" %}
				</div>
		</div>
		{% endif %}
	{% endfor %}
</div>


<script>
frappe.ready(() => {
	$(document).on('click', '.address-card', (e) => {
		const $target = $(e.currentTarget);
		const $section = $target.closest('[data-section]');
		$section.find('.address-card').removeClass('active');
		$target.addClass('active');
	});

	$('#input_same_billing').change((e) => {
		const $check = $(e.target);
		toggle_billing_address_section(!$check.is(':checked'));
	});

	$('.btn-new-address').click(() => {
		const d = new frappe.ui.Dialog({
			title: '{{_("New Address") }}',
			fields: [
				{
					label: '{{ _("Address Title") }}',
					fieldname: 'address_title',
					fieldtype: 'Data',
					reqd: 1
				},
				{
					label: '{{ _("Address Line 1") }}',
					fieldname: 'address_line1',
					fieldtype: 'Data',
					reqd: 1
				},
				{
					label: '{{ _("Address Line 2") }}',
					fieldname: 'address_line2',
					fieldtype: 'Data'
				},
				{
					label: '{{ _("City/Town") }}',
					fieldname: 'city',
					fieldtype: 'Data',
					reqd: 1
				},
				{
					label: '{{ _("State") }}',
					fieldname: 'state',
					fieldtype: 'Data'
				},
				{
					label: '{{ _("Country") }}',
					fieldname: 'country',
					fieldtype: 'Link',
					options: 'Country',
					only_select: true,
					reqd: 1
				},
				{
					fieldname: "column_break0",
					fieldtype: "Column Break",
					width: "50%"
				},
				{
					label: '{{ _("Address Type") }}',
					fieldname: 'address_type',
					fieldtype: 'Select',
					options: [
						'Billing',
						'Shipping'
					],
					reqd: 1
				},
				{
					label: '{{ _("Postal Code") }}',
					fieldname: 'pincode',
					fieldtype: 'Data'
				},
				{
					fieldname: "phone",
					fieldtype: "Data",
					label: '{{ _("Phone") }}',
					reqd: 1
				},
			],
			primary_action_label: '{{ _("Save") }}',
			primary_action: (values) => {
				frappe.call('webshop.webshop.shopping_cart.cart.add_new_address', { doc: values })
					.then(r => {
						frappe.call({
							method: "webshop.webshop.shopping_cart.cart.update_cart_address",
							args: {
								address_type: r.message.address_type,
								address_name: r.message.name
							},
							callback: function (r) {
								d.hide();
								window.location.reload();
							}
						});
					});

			}
		})

		d.show();
	});

	function setup_state() {
		const shipping_address = $('[data-section="shipping-address"]')
			.find('[data-address-name][data-active]').attr('data-address-name');

		const billing_address = $('[data-section="billing-address"]')
			.find('[data-address-name][data-active]').attr('data-address-name');

		$('#input_same_billing').prop('checked', shipping_address === billing_address).trigger('change');

		if (!shipping_address && !billing_address) {
			$('#input_same_billing').prop('checked', true).trigger('change');
		}

		if (shipping_address) {
			$(`[data-section="shipping-address"] [data-address-name="${shipping_address}"] .address-card`).addClass('active');
		}
		if (billing_address) {
			$(`[data-section="billing-address"] [data-address-name="${billing_address}"] .address-card`).addClass('active');
		}
	}

	setup_state();

	function toggle_billing_address_section(flag) {
		$('[data-section="billing-address"]').toggle(flag);
	}
});
</script>

<script>
	frappe.ready(() => {
		function get_update_address_dialog() {
			let d = new frappe.ui.Dialog({
				title: "Select Address",
				fields: [{
					'fieldtype': 'HTML',
					'fieldname': 'address_picker',
				}],
				primary_action_label: __('Set Address'),
				primary_action: () => {
					const $card = d.$wrapper.find('.address-card.active');
					const address_type = $card.closest('[data-address-type]').attr('data-address-type');
					const address_name = $card.closest('[data-address-name]').attr('data-address-name');
					frappe.call({
						type: "POST",
						method: "webshop.webshop.shopping_cart.cart.update_cart_address",
						freeze: true,
						args: {
							address_type,
							address_name
						},
						callback: function(r) {
							d.hide();
							if (!r.exc) {
								$(".cart-tax-items").html(r.message.total);
								shopping_cart.parent.find(
									`.address-container[data-address-type="${address_type}"]`
								).html(r.message.address);
							}
						}
					});
				}
			});

			return d;
		}

		function get_address_template(type) {
			return {
				shipping: `<div class="mb-3" data-section="shipping-address">
					<div class="row no-gutters" data-fieldname="shipping_address_name">
						{% for address in shipping_addresses %}
							<div class="mr-3 mb-3 w-100" data-address-name="{{address.name}}" data-address-type="shipping"
								{% if doc.shipping_address_name == address.name %} data-active {% endif %}>
								{% include "templates/includes/cart/address_picker_card.html" %}
							</div>
						{% endfor %}
					</div>
				</div>`,
				billing: `<div class="mb-3" data-section="billing-address">
					<div class="row no-gutters" data-fieldname="customer_address">
						{% for address in billing_addresses %}
							<div class="mr-3 mb-3 w-100" data-address-name="{{address.name}}" data-address-type="billing"
								{% if doc.shipping_address_name == address.name %} data-active {% endif %}>
								{% include "templates/includes/cart/address_picker_card.html" %}
							</div>
						{% endfor %}
					</div>
				</div>`,
			}[type];
		}

		$(document).on('click', '.btn-change-address', (e) => {
			const d = get_update_address_dialog();
			const type = $(e.currentTarget).parents('.address-container').attr('data-address-type');

			$(d.get_field('address_picker').wrapper).html(
				get_address_template(type)
			);

			d.show();
		});
	});
</script>


================================================
FILE: webshop/templates/includes/cart/cart_address_picker.html
================================================
<div class="mb-3 frappe-card p-5" data-section="shipping-address">
	<h6>{{ _("Shipping Address") }}</h6>
</div>


================================================
FILE: webshop/templates/includes/cart/cart_dropdown.html
================================================
<div class="cart-dropdown-container">
	<div id="cart-error" class="alert alert-danger"
		style="display: none;"></div>
	<div class="row checkout-btn">
		<div class="col-sm-12 col-xs-12">
			<a href="/cart" class="btn btn-block btn-primary">{{ _("Checkout") }}</a>
		</div>
	</div>
	<div class="row cart-items-dropdown cart-item-header text-muted">
		<div class="col-sm-6 col-xs-6 h6 text-uppercase">
		{{ _("Item") }}
		</div>
		<div class="col-sm-6 col-xs-6 text-right h6 text-uppercase">
		{{ _("Price") }}
		</div>
	</div>

	{% if doc.items %}
	<div class="row cart-items-dropdown">
		<div class="col-sm-12 col-xs-12">
			{% include "templates/includes/cart/cart_items_dropdown.html" %}
		</div>
	</div>
	{% else %}
	<p>{{ _("Cart is Empty") }}</p>
	{% endif %}
</div>


================================================
FILE: webshop/templates/includes/cart/cart_items.html
================================================
{% from "webshop/templates/includes/macros.html" import product_image %}

{% macro item_subtotal(item) %}
	<div>
		{{ item.get_formatted('amount') }}
	</div>

	{% if item.is_free_item %}
		<div class="text-success mt-4">
			<span class="free-tag">
				{{ _('FREE') }}
			</span>
		</div>
	{% else %}
		<span class="item-rate">
			{{ _('Rate:') }} {{ item.get_formatted('rate') }}
		</span>
	{% endif %}
{% endmacro %}

{% for d in doc.items %}
	<tr data-name="{{ d.name }}">
		<td style="width: 60%;">
			<div class="d-flex">
				<div class="cart-item-image mr-4">
					{% if d.thumbnail %}
						{{ product_image(d.thumbnail, alt="d.web_item_name", no_border=True) }}
					{% else %}
						<div class = "no-image-cart-item">
							{{ frappe.utils.get_abbr(d.web_item_name) or "NA" }}
						</div>
					{% endif %}
				</div>

				<div class="d-flex w-100" style="flex-direction: column;">
					<div class="item-title mb-1 mr-3">
						{{ d.get("web_item_name") or d.item_name }}
					</div>
					<div class="item-subtitle mr-2">
						{{ d.item_code }}
					</div>
					{%- set variant_of = frappe.db.get_value('Item', d.item_code, 'variant_of') %}
					{% if variant_of %}
					<span class="item-subtitle mr-2">
						{{ _('Variant of') }}
						<a href="{{frappe.db.get_value('Website Item', {'item_code': variant_of}, 'route') or '#'}}">
							{{ variant_of }}
						</a>
					</span>
					{% endif %}

						<div class="mt-2 notes">
							<textarea data-item-code="{{d.item_code}}" class="form-control" rows="2" placeholder="{{ _('Add notes') }}">{{d.additional_notes or ''}}</textarea>
						</div>
				</div>
			</div>
		</td>

		<!-- Qty column -->
		<td class="text-right" style="width: 25%;">
			<div class="d-flex">
				{% set disabled = 'disabled' if d.is_free_item else '' %}
				<div class="input-group number-spinner mt-1 mb-4">
					<span class="input-group-prepend d-sm-inline-block">
						<button class="btn cart-btn" data-dir="dwn" {{ disabled }}>
							{{ '–' if not d.is_free_item else ''}}
						</button>
					</span>

					<input class="form-control text-center cart-qty" value="{{ d.get_formatted('qty') }}" data-item-code="{{ d.item_code }}"
						style="max-width: 70px;" {{ disabled }}>

					<span class="input-group-append d-sm-inline-block">
						<button class="btn cart-btn" data-dir="up" {{ disabled }}>
							{{ '+' if not d.is_free_item else ''}}
						</button>
					</span>
					</div>

				<div>
					{% if not d.is_free_item %}
						<div class="remove-cart-item column-sm-view d-flex" data-item-code="{{ d.item_code }}">
							<span>
								<svg class="icon sm remove-cart-item-logo"
									width="18" height="18" viewBox="0 0 18 18"
									xmlns="http://www.w3.org/2000/svg" id="icon-close">
									<path fill-rule="evenodd" clip-rule="evenodd" d="M4.146 11.217a.5.5 0 1 0 .708.708l3.182-3.182 3.181 3.182a.5.5 0 1 0 .708-.708l-3.182-3.18 3.182-3.182a.5.5 0 1 0-.708-.708l-3.18 3.181-3.183-3.182a.5.5 0 0 0-.708.708l3.182 3.182-3.182 3.181z" stroke-width="0"></path>
								</svg>
							</span>
						</div>
					{% endif %}
					</div>
			</div>


			<!-- Shown on mobile view, else hidden -->
			{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
				<div class="text-right sm-item-subtotal">
					{{ item_subtotal(d) }}
				</div>
			{% endif %}
		</td>

		<!-- Subtotal column -->
		{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
			<td class="text-right item-subtotal column-sm-view w-100">
				{{ item_subtotal(d) }}
			</td>
		{% endif %}
	</tr>
{% endfor %}


================================================
FILE: webshop/templates/includes/cart/cart_items_dropdown.html
================================================
{% from "webshop/templates/includes/order/order_macros.html" import item_name_and_description_cart %}

{% for d in doc.items %}
<div class="row cart-dropdown">
    <div class="col-sm-8 col-xs-8 col-name-description">
        {{ item_name_and_description_cart(d) }}
    </div>
    <div class="col-sm-4 col-xs-4 text-right col-amount">
        {{ d.get_formatted("amount") }}
    </div>
</div>
{% endfor %}


================================================
FILE: webshop/templates/includes/cart/cart_items_total.html
================================================
<!-- Total at the end of the cart items -->
<tr>
	<th></th>
	<th class="text-left item-grand-total" colspan="1">
		{{ _("Net Total") }}
	</th>
	<th class="text-left item-grand-total totals" colspan="3">
		{{ doc.get_formatted("total") }}
	</th>
</tr>


================================================
FILE: webshop/templates/includes/cart/cart_macros.html
================================================
{% macro show_address(address, doc, fieldname, select_address=False) %}
{% set selected=address.name==doc.get(fieldname) %}

<div class="panel panel-default">
	<div class="panel-heading">
		<div class="row">
			<div class="col-sm-10 address-title"
				data-address-name="{{ address.name }}">
                <strong>{{ address.name }}</strong></div>
			<div class="col-sm-2 text-right">
                <input type="checkbox"
                data-fieldname="{{ fieldname }}"
				data-address-name="{{ address.name}}"
                    {{ "checked" if selected else "" }}></div>
		</div>
	</div>
	<div class="panel-collapse"
        data-address-name="{{ address.name }}">
		<div class="panel-body text-muted small">{{ address.display }}</div>
	</div>
</div>
{% endmacro %}


================================================
FILE: webshop/templates/includes/cart/cart_payment_summary.html
================================================
<!-- Payment -->
{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
<h6>
	{{ _("Payment Summary") }}
</h6>
{% endif %}

<div class="card h-100">
	<div class="card-body p-0">
		{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}
			<table class="table w-100">
				<tr>
					{% set total_items = frappe.utils.cstr(frappe.utils.flt(doc.total_qty, 0)) %}
					<td class="bill-label">{{ _("Net Total (") + total_items + _(" Items)") }}</td>
					<td class="bill-content net-total text-right">{{ doc.get_formatted("net_total") }}</td>
				</tr>

				<!-- taxes -->
				{% for d in doc.taxes %}
					{% if d.tax_amount %}
						<tr>
							<td class="bill-label">
								{{ d.description }}
							</td>
							<td class="bill-content text-right">
								{{ d.get_formatted("tax_amount") }}
							</td>
						</tr>
					{% endif %}
				{% endfor %}
			</table>

			<!-- TODO: Apply Coupon Dialog-->
			<!-- {% set show_coupon_code = cart_settings.show_apply_coupon_code_in_website and cart_settings.enable_checkout %}
			{% if show_coupon_code %}
				<button class="btn btn-coupon-code w-100 text-left">
					<svg width="24" height="24" viewBox="0 0 24 24" stroke="var(--gray-600)" fill="none" xmlns="http://www.w3.org/2000/svg">
						<path d="M19 15.6213C19 15.2235 19.158 14.842 19.4393 14.5607L20.9393 13.0607C21.5251 12.4749 21.5251 11.5251 20.9393 10.9393L19.4393 9.43934C19.158 9.15804 19 8.7765 19 8.37868V6.5C19 5.67157 18.3284 5 17.5 5H15.6213C15.2235 5 14.842 4.84196 14.5607 4.56066L13.0607 3.06066C12.4749 2.47487 11.5251 2.47487 10.9393 3.06066L9.43934 4.56066C9.15804 4.84196 8.7765 5 8.37868 5H6.5C5.67157 5 5 5.67157 5 6.5V8.37868C5 8.7765 4.84196 9.15804 4.56066 9.43934L3.06066 10.9393C2.47487 11.5251 2.47487 12.4749 3.06066 13.0607L4.56066 14.5607C4.84196 14.842 5 15.2235 5 15.6213V17.5C5 18.3284 5.67157 19 6.5 19H8.37868C8.7765 19 9.15804 19.158 9.43934 19.4393L10.9393 20.9393C11.5251 21.5251 12.4749 21.5251 13.0607 20.9393L14.5607 19.4393C14.842 19.158 15.2235 19 15.6213 19H17.5C18.3284 19 19 18.3284 19 17.5V15.6213Z" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
						<path d="M15 9L9 15" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
						<path d="M10.5 9.5C10.5 10.0523 10.0523 10.5 9.5 10.5C8.94772 10.5 8.5 10.0523 8.5 9.5C8.5 8.94772 8.94772 8.5 9.5 8.5C10.0523 8.5 10.5 8.94772 10.5 9.5Z" fill="white" stroke-linecap="round" stroke-linejoin="round"/>
						<path d="M15.5 14.5C15.5 15.0523 15.0523 15.5 14.5 15.5C13.9477 15.5 13.5 15.0523 13.5 14.5C13.5 13.9477 13.9477 13.5 14.5 13.5C15.0523 13.5 15.5 13.9477 15.5 14.5Z" fill="white" stroke-linecap="round" stroke-linejoin="round"/>
					</svg>
					<span class="ml-2">Apply Coupon</span>
				</button>
			{% endif %} -->

			<table class="table w-100 grand-total mt-6">
				<tr>
					<td class="bill-content net-total">{{ _("Grand Total") }}</td>
					<td class="bill-content net-total text-right">{{ doc.get_formatted("grand_total") }}</td>
				</tr>
			</table>
		{% endif %}
	</div>
</div>

<!-- TODO: Apply Coupon Dialog-->
<!-- <script>
	frappe.ready(() => {
		$('.btn-coupon-code').click((e) => {
			const $btn = $(e.currentTarget);
			const d = new frappe.ui.Dialog({
				title: __('Coupons'),
				fields: [
					{
						fieldname: 'coupons_area',
						fieldtype: 'HTML'
					}
				]
			});
			d.show();
		});
	});
</script> -->

================================================
FILE: webshop/templates/includes/cart/coupon_code.html
================================================
{% if coupon_code %}
<p class="h6">Coupon code</p>
<div
    class="cart-coupon-code flex gap-2 align-items-center w-fit rounded mb-4"
    style="border: 2px dashed #ccc;"
>
    <div class="px-2 py-1 small"> {{ coupon_code}} </div>
    <button class="btn bt-remove-coupon-code">
        <span>
            <svg
                class="icon sm remove-cart-item-logo"
                width="18"
                height="18"
                viewBox="0 0 18 18"
                xmlns="http://www.w3.org/2000/svg"
                id="icon-close"
            >
                <path
                    fill-rule="evenodd"
                    clip-rule="evenodd"
                    d="M4.146 11.217a.5.5 0 1 0 .708.708l3.182-3.182 3.181 3.182a.5.5 0 1 0 .708-.708l-3.182-3.18 3.182-3.182a.5.5 0 1 0-.708-.708l-3.18 3.181-3.183-3.182a.5.5 0 0 0-.708.708l3.182 3.182-3.182 3.181z"
                    stroke-width="0"
                ></path>
            </svg>
        </span>
    </button>
</div>
{% endif %}


================================================
FILE: webshop/templates/includes/cart/place_order.html
================================================
<div class="card h-100">
	<div class="card-body p-0">
		{% if cart_settings.enable_checkout %}
			<button class="btn btn-primary btn-place-order font-md w-100" type="button">
				{{ _("Place Order") }}
			</button>
		{% else %}
			<button class="btn btn-primary btn-request-for-quotation font-md w-100" type="button">
				{{ _("Request for Quote") }}
			</button>
		{% endif %}
	</div>
</div>

================================================
FILE: webshop/templates/includes/macros.html
================================================
{% macro product_image_square(website_image, css_class="") %}
<div class="product-image product-image-square h-100 rounded
	{% if not website_image -%} missing-image {%- endif %} {{ css_class }}"
	{% if website_image -%}
	style="background-image: url('{{ frappe.utils.quoted(website_image) | abs_url }}');"
	{%- endif 
Download .txt
gitextract_ql1pgvwn/

├── .github/
│   └── workflows/
│       ├── ci.yml
│       └── semgroup-rules.yml
├── .gitignore
├── LICENSE
├── README.md
├── pyproject.toml
└── webshop/
    ├── __init__.py
    ├── config/
    │   └── __init__.py
    ├── hooks.py
    ├── modules.txt
    ├── patches/
    │   ├── __init__.py
    │   ├── add_homepage_field.py
    │   ├── clear_cache_for_item_group_route.py
    │   ├── convert_to_website_item_in_item_card_group_template.py
    │   ├── copy_custom_field_filters_to_website_item.py
    │   ├── create_website_items.py
    │   ├── enable_allow_to_guest_view_for_item_group.py
    │   ├── fetch_thumbnail_in_website_items.py
    │   ├── make_homepage_products_website_items.py
    │   ├── populate_e_commerce_settings.py
    │   └── shopping_cart_to_ecommerce.py
    ├── patches.txt
    ├── public/
    │   ├── .gitkeep
    │   ├── js/
    │   │   ├── customer_reviews.js
    │   │   ├── init.js
    │   │   ├── override/
    │   │   │   ├── homepage.js
    │   │   │   └── item.js
    │   │   ├── product_ui/
    │   │   │   ├── grid.js
    │   │   │   ├── list.js
    │   │   │   ├── search.js
    │   │   │   └── views.js
    │   │   ├── shopping_cart.js
    │   │   └── wishlist.js
    │   ├── scss/
    │   │   ├── webshop-web.bundle.scss
    │   │   └── webshop_cart.scss
    │   └── web.bundle.js
    ├── setup/
    │   └── install.py
    ├── templates/
    │   ├── __init__.py
    │   ├── generators/
    │   │   ├── item/
    │   │   │   ├── item.html
    │   │   │   ├── item_add_to_cart.html
    │   │   │   ├── item_configure.html
    │   │   │   ├── item_configure.js
    │   │   │   ├── item_details.html
    │   │   │   ├── item_image.html
    │   │   │   ├── item_inquiry.html
    │   │   │   ├── item_inquiry.js
    │   │   │   ├── item_reviews.html
    │   │   │   └── item_specifications.html
    │   │   └── item_group.html
    │   ├── includes/
    │   │   ├── cart/
    │   │   │   ├── address_card.html
    │   │   │   ├── address_picker_card.html
    │   │   │   ├── cart_address.html
    │   │   │   ├── cart_address_picker.html
    │   │   │   ├── cart_dropdown.html
    │   │   │   ├── cart_items.html
    │   │   │   ├── cart_items_dropdown.html
    │   │   │   ├── cart_items_total.html
    │   │   │   ├── cart_macros.html
    │   │   │   ├── cart_payment_summary.html
    │   │   │   ├── coupon_code.html
    │   │   │   └── place_order.html
    │   │   ├── macros.html
    │   │   ├── navbar/
    │   │   │   └── navbar_items.html
    │   │   ├── order/
    │   │   │   ├── order_macros.html
    │   │   │   └── order_taxes.html
    │   │   └── product_page.js
    │   └── pages/
    │       ├── __init__.py
    │       ├── cart.html
    │       ├── cart.js
    │       ├── cart.py
    │       ├── customer_reviews.html
    │       ├── customer_reviews.py
    │       ├── order.html
    │       ├── order.js
    │       ├── order.py
    │       ├── product_search.html
    │       ├── product_search.py
    │       ├── wishlist.html
    │       └── wishlist.py
    ├── webshop/
    │   ├── __init__.py
    │   ├── api.py
    │   ├── crud_events/
    │   │   ├── __init__.py
    │   │   ├── item/
    │   │   │   ├── __init__.py
    │   │   │   ├── invalidate_item_variants_cache.py
    │   │   │   ├── update_website_item.py
    │   │   │   └── validate_duplicate_website_item.py
    │   │   ├── price_list/
    │   │   │   ├── __init__.py
    │   │   │   └── check_impact_on_cart.py
    │   │   ├── quotation/
    │   │   │   ├── __init__.py
    │   │   │   └── validate_shopping_cart_items.py
    │   │   └── tax_rule/
    │   │       ├── __init__.py
    │   │       └── validate_use_for_cart.py
    │   ├── doctype/
    │   │   ├── __init__.py
    │   │   ├── homepage_featured_product/
    │   │   │   ├── __init__.py
    │   │   │   ├── homepage_featured_product.json
    │   │   │   └── homepage_featured_product.py
    │   │   ├── item_review/
    │   │   │   ├── __init__.py
    │   │   │   ├── item_review.js
    │   │   │   ├── item_review.json
    │   │   │   ├── item_review.py
    │   │   │   └── test_item_review.py
    │   │   ├── override_doctype/
    │   │   │   ├── __init__.py
    │   │   │   ├── item.py
    │   │   │   ├── item_group.py
    │   │   │   └── payment_request.py
    │   │   ├── recommended_items/
    │   │   │   ├── __init__.py
    │   │   │   ├── recommended_items.json
    │   │   │   └── recommended_items.py
    │   │   ├── webshop_settings/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_webshop_settings.py
    │   │   │   ├── webshop_settings.js
    │   │   │   ├── webshop_settings.json
    │   │   │   └── webshop_settings.py
    │   │   ├── website_item/
    │   │   │   ├── __init__.py
    │   │   │   ├── templates/
    │   │   │   │   ├── website_item.html
    │   │   │   │   └── website_item_row.html
    │   │   │   ├── test_website_item.py
    │   │   │   ├── website_item.js
    │   │   │   ├── website_item.json
    │   │   │   ├── website_item.py
    │   │   │   └── website_item_list.js
    │   │   ├── website_item_tabbed_section/
    │   │   │   ├── __init__.py
    │   │   │   ├── website_item_tabbed_section.json
    │   │   │   └── website_item_tabbed_section.py
    │   │   ├── website_offer/
    │   │   │   ├── __init__.py
    │   │   │   ├── website_offer.json
    │   │   │   └── website_offer.py
    │   │   ├── wishlist/
    │   │   │   ├── __init__.py
    │   │   │   ├── test_wishlist.py
    │   │   │   ├── wishlist.js
    │   │   │   ├── wishlist.json
    │   │   │   └── wishlist.py
    │   │   └── wishlist_item/
    │   │       ├── __init__.py
    │   │       ├── wishlist_item.json
    │   │       └── wishlist_item.py
    │   ├── legacy_search.py
    │   ├── product_data_engine/
    │   │   ├── filters.py
    │   │   ├── query.py
    │   │   ├── test_item_group_product_data_engine.py
    │   │   └── test_product_data_engine.py
    │   ├── redisearch_utils.py
    │   ├── shopping_cart/
    │   │   ├── __init__.py
    │   │   ├── cart.py
    │   │   ├── product_info.py
    │   │   ├── test_shopping_cart.py
    │   │   └── utils.py
    │   ├── utils/
    │   │   ├── __init__.py
    │   │   ├── portal.py
    │   │   ├── product.py
    │   │   └── setup.py
    │   ├── variant_selector/
    │   │   ├── __init__.py
    │   │   ├── item_variants_cache.py
    │   │   ├── test_variant_selector.py
    │   │   └── utils.py
    │   └── web_template/
    │       ├── __init__.py
    │       ├── hero_slider/
    │       │   ├── __init__.py
    │       │   ├── hero_slider.html
    │       │   └── hero_slider.json
    │       ├── item_card_group/
    │       │   ├── __init__.py
    │       │   ├── item_card_group.html
    │       │   └── item_card_group.json
    │       ├── product_card/
    │       │   ├── __init__.py
    │       │   ├── product_card.html
    │       │   └── product_card.json
    │       └── product_category_cards/
    │           ├── __init__.py
    │           ├── product_category_cards.html
    │           └── product_category_cards.json
    └── www/
        ├── __init__.py
        ├── all-products/
        │   ├── __init__.py
        │   ├── index.html
        │   ├── index.js
        │   ├── index.py
        │   └── not_found.html
        └── shop-by-category/
            ├── __init__.py
            ├── category_card_section.html
            ├── index.html
            ├── index.js
            └── index.py
Download .txt
SYMBOL INDEX (442 symbols across 70 files)

FILE: webshop/patches/add_homepage_field.py
  function execute (line 5) | def execute():

FILE: webshop/patches/clear_cache_for_item_group_route.py
  function execute (line 4) | def execute():

FILE: webshop/patches/convert_to_website_item_in_item_card_group_template.py
  function execute (line 9) | def execute():
  function generate_fields_to_edit (line 45) | def generate_fields_to_edit() -> List:
  function make_new_website_item (line 53) | def make_new_website_item(item: str) -> Union[str, None]:

FILE: webshop/patches/copy_custom_field_filters_to_website_item.py
  function execute (line 6) | def execute():

FILE: webshop/patches/create_website_items.py
  function execute (line 6) | def execute():

FILE: webshop/patches/enable_allow_to_guest_view_for_item_group.py
  function execute (line 4) | def execute():

FILE: webshop/patches/fetch_thumbnail_in_website_items.py
  function execute (line 4) | def execute():

FILE: webshop/patches/make_homepage_products_website_items.py
  function execute (line 4) | def execute():

FILE: webshop/patches/populate_e_commerce_settings.py
  function execute (line 6) | def execute():

FILE: webshop/patches/shopping_cart_to_ecommerce.py
  function execute (line 5) | def execute():

FILE: webshop/public/js/customer_reviews.js
  class CustomerReviews (line 2) | class CustomerReviews {
    method constructor (line 3) | constructor() {
    method bind_button_actions (line 9) | bind_button_actions() {
    method write_review (line 14) | write_review() {
    method view_more (line 59) | view_more() {
    method get_user_review_html (line 92) | get_user_review_html(reviews) {
    method get_review_stars (line 123) | get_review_stars(rating) {

FILE: webshop/public/js/product_ui/grid.js
  method constructor (line 8) | constructor(options) {
  method make (line 19) | make() {
  method get_image_html (line 37) | get_image_html(item, title) {
  method get_card_body_html (line 61) | get_card_body_html(item, title, settings) {
  method get_title (line 93) | get_title(item, title) {
  method get_wishlist_icon (line 104) | get_wishlist_icon(item) {
  method get_cart_indicator (line 116) | get_cart_indicator(item) {
  method get_price_html (line 124) | get_price_html(item) {
  method get_stock_availability (line 144) | get_stock_availability(item, settings) {
  method get_primary_button (line 164) | get_primary_button(item, settings) {

FILE: webshop/public/js/product_ui/list.js
  method constructor (line 8) | constructor(options) {
  method make (line 19) | make() {
  method get_image_html (line 37) | get_image_html(item, title, settings) {
  method get_row_body_html (line 69) | get_row_body_html(item, title, settings) {
  method get_title_html (line 77) | get_title_html(item, title, settings) {
  method get_item_details (line 98) | get_item_details(item, settings) {
  method get_stock_availability (line 127) | get_stock_availability(item, settings) {
  method get_wishlist_icon (line 152) | get_wishlist_icon(item) {
  method get_primary_button (line 165) | get_primary_button(item, settings) {

FILE: webshop/public/js/product_ui/search.js
  method constructor (line 2) | constructor(opts) {
  method setupSearchDropDown (line 13) | setupSearchDropDown() {
  method bindSearchAction (line 19) | bindSearchAction() {
  method setupSearchResultContainer (line 79) | setupSearchResultContainer() {
  method setupProductsContainer (line 93) | setupProductsContainer() {
  method setupCategoryContainer (line 102) | setupCategoryContainer() {
  method setupRecentsContainer (line 111) | setupRecentsContainer() {
  method getRecentSearches (line 126) | getRecentSearches() {
  method attachEventListenersToChips (line 130) | attachEventListenersToChips() {
  method setRecentSearches (line 146) | setRecentSearches(query) {
  method populateRecentSearches (line 163) | populateRecentSearches() {
  method populateResults (line 190) | populateResults(product_results) {
  method populateCategoriesList (line 215) | populateCategoriesList(category_results) {

FILE: webshop/public/js/product_ui/views.js
  method constructor (line 7) | constructor(options) {
  method make (line 13) | make(from_filters=false) {
  method prepare_toolbar (line 19) | prepare_toolbar() {
  method prepare_view_toggler (line 30) | prepare_view_toggler() {
  method get_item_filter_data (line 39) | get_item_filter_data(from_filters=false) {
  method disable_view_toggler (line 94) | disable_view_toggler(disable=false) {
  method render_grid_view (line 99) | render_grid_view(items, settings) {
  method render_list_view (line 112) | render_list_view(items, settings) {
  method prepare_product_area_wrapper (line 124) | prepare_product_area_wrapper(view) {
  method get_query_filters (line 133) | get_query_filters() {
  method add_paging_section (line 149) | add_paging_section(settings) {
  method prepare_search (line 186) | prepare_search() {
  method render_view_toggler (line 209) | render_view_toggler() {
  method bind_view_toggler_actions (line 228) | bind_view_toggler_actions() {
  method set_view_state (line 252) | set_view_state() {
  method bind_paging_action (line 262) | bind_paging_action() {
  method re_render_discount_filters (line 278) | re_render_discount_filters(filter_data) {
  method get_discount_filter_html (line 290) | get_discount_filter_html(filter_data) {
  method restore_discount_filter (line 324) | restore_discount_filter() {
  method bind_discount_filter_action (line 341) | bind_discount_filter_action() {
  method bind_filters (line 366) | bind_filters() {
  method change_route_with_filters (line 439) | change_route_with_filters() {
  method restore_filters_state (line 460) | restore_filters_state() {
  method render_no_products_section (line 488) | render_no_products_section(error=false) {
  method render_item_sub_categories (line 506) | render_item_sub_categories(categories) {
  method get_query_string (line 527) | get_query_string(object) {
  method if_key_exists (line 538) | if_key_exists(obj) {

FILE: webshop/public/js/shopping_cart.js
  method toggle_button_class (line 185) | toggle_button_class(button, remove, add) {
  method bind_add_to_cart_action (line 190) | bind_add_to_cart_action() {
  method freeze (line 220) | freeze() {
  method unfreeze (line 235) | unfreeze() {

FILE: webshop/public/js/wishlist.js
  method bind_wishlist_action (line 82) | bind_wishlist_action() {
  method wishlist_action (line 90) | wishlist_action(btn) {
  method toggle_button_class (line 131) | toggle_button_class(button, remove, add) {
  method add_remove_from_wishlist (line 136) | add_remove_from_wishlist(action, args, success_action, failure_action, a...
  method redirect_guest (line 176) | redirect_guest() {
  method render_empty_state (line 182) | render_empty_state() {

FILE: webshop/setup/install.py
  function after_install (line 9) | def after_install():
  function copy_from_ecommerce_settings (line 19) | def copy_from_ecommerce_settings():
  function drop_ecommerce_settings (line 51) | def drop_ecommerce_settings():
  function remove_ecommerce_settings_doctype (line 55) | def remove_ecommerce_settings_doctype():
  function add_custom_fields (line 65) | def add_custom_fields():
  function navbar_add_products_link (line 196) | def navbar_add_products_link():
  function say_thanks (line 213) | def say_thanks():
  function run_patches (line 228) | def run_patches():

FILE: webshop/templates/generators/item/item_configure.js
  class ItemConfigure (line 1) | class ItemConfigure {
    method constructor (line 2) | constructor(item_code, item_name) {
    method show_configure_dialog (line 13) | show_configure_dialog() {
    method on_attribute_selection (line 57) | on_attribute_selection(e) {
    method show_range_input_for_all_fields (line 100) | show_range_input_for_all_fields() {
    method show_range_input_if_applicable (line 108) | show_range_input_if_applicable(fieldname) {
    method update_range_values (line 150) | update_range_values(attribute, range_value) {
    method show_remaining_optional_attributes (line 155) | show_remaining_optional_attributes() {
    method set_loading_status (line 174) | set_loading_status() {
    method set_item_found_status (line 182) | set_item_found_status(data) {
    method clear_status (line 187) | clear_status() {
    method get_html_for_item_found (line 191) | get_html_for_item_found({ filtered_items_count, filtered_items, exact_...
    method btn_add_to_cart (line 244) | btn_add_to_cart(e) {
    method btn_clear_values (line 260) | btn_clear_values() {
    method append_status_area (line 273) | append_status_area() {
    method get_next_attribute_and_values (line 286) | get_next_attribute_and_values(selected_attributes) {
    method get_attributes_and_values (line 293) | get_attributes_and_values() {
    method get_cache_key (line 299) | get_cache_key() {
    method call (line 303) | call(method, args) {
  function set_continue_configuration (line 313) | function set_continue_configuration() {

FILE: webshop/templates/generators/item/item_inquiry.js
  function send_inquiry (line 47) | function send_inquiry() {

FILE: webshop/templates/includes/product_page.js
  function get_item_code (line 131) | function get_item_code() {
  function find_closest_match (line 164) | function find_closest_match(selected_attribute, selected_attribute_value) {
  function get_selected_attributes (line 211) | function get_selected_attributes() {

FILE: webshop/templates/pages/cart.js
  function show_terms (line 246) | function show_terms() {

FILE: webshop/templates/pages/cart.py
  function get_context (line 9) | def get_context(context):

FILE: webshop/templates/pages/customer_reviews.py
  function get_context (line 12) | def get_context(context):

FILE: webshop/templates/pages/order.js
  function apply_loyalty_points (line 12) | function apply_loyalty_points() {

FILE: webshop/templates/pages/order.py
  function get_context (line 10) | def get_context(context):
  function get_attachments (line 60) | def get_attachments(dt, dn):

FILE: webshop/templates/pages/product_search.py
  function get_context (line 22) | def get_context(context):
  function get_product_list (line 27) | def get_product_list(search=None, start=0, limit=12):
  function get_product_data (line 36) | def get_product_data(search=None, start=0, limit=12):
  function search (line 67) | def search(query):
  function product_search (line 78) | def product_search(query, limit=10, fuzzy_search=True):
  function clean_up_query (line 120) | def clean_up_query(query):
  function convert_to_dict (line 124) | def convert_to_dict(redis_search_doc):
  function get_category_suggestions (line 129) | def get_category_suggestions(query):

FILE: webshop/templates/pages/wishlist.py
  function get_context (line 13) | def get_context(context):
  function get_stock_availability (line 28) | def get_stock_availability(item_code, warehouse):
  function get_wishlist_items (line 45) | def get_wishlist_items():
  function set_stock_price_details (line 65) | def set_stock_price_details(items, settings, selling_price_list):

FILE: webshop/webshop/api.py
  function get_product_filter_data (line 16) | def get_product_filter_data(query_args=None):
  function get_guest_redirect_on_action (line 88) | def get_guest_redirect_on_action():

FILE: webshop/webshop/crud_events/item/invalidate_item_variants_cache.py
  function execute (line 7) | def execute(doc, method=None, old_name=None, new_name=None, merge=False):

FILE: webshop/webshop/crud_events/item/update_website_item.py
  function execute (line 4) | def execute(doc, method=None):

FILE: webshop/webshop/crud_events/item/validate_duplicate_website_item.py
  class DataValidationError (line 7) | class DataValidationError(frappe.ValidationError):
  function execute (line 11) | def execute(doc, method=None, old_name=None, new_name=None, merge=False):

FILE: webshop/webshop/crud_events/price_list/check_impact_on_cart.py
  function execute (line 7) | def execute(doc, method=None):

FILE: webshop/webshop/crud_events/quotation/validate_shopping_cart_items.py
  function execute (line 5) | def execute(doc, method=None):

FILE: webshop/webshop/crud_events/tax_rule/validate_use_for_cart.py
  function execute (line 6) | def execute(doc, method=None):

FILE: webshop/webshop/doctype/homepage_featured_product/homepage_featured_product.py
  class HomepageFeaturedProduct (line 8) | class HomepageFeaturedProduct(Document):

FILE: webshop/webshop/doctype/item_review/item_review.py
  class UnverifiedReviewer (line 19) | class UnverifiedReviewer(frappe.ValidationError):
  class ItemReview (line 23) | class ItemReview(Document):
    method after_insert (line 24) | def after_insert(self):
    method after_delete (line 29) | def after_delete(self):
  function get_item_reviews (line 36) | def get_item_reviews(web_item, start=0, end=10, data=None):
  function get_queried_reviews (line 60) | def get_queried_reviews(web_item, start=0, end=10, data=None):
  function set_reviews_in_cache (line 120) | def set_reviews_in_cache(web_item, reviews_dict):
  function add_item_review (line 125) | def add_item_review(web_item, title, rating, comment=None):
  function get_customer (line 148) | def get_customer(silent=False):

FILE: webshop/webshop/doctype/item_review/test_item_review.py
  class TestItemReview (line 22) | class TestItemReview(unittest.TestCase):
    method setUp (line 23) | def setUp(self):
    method tearDown (line 32) | def tearDown(self):
    method test_add_and_get_item_reviews_from_customer (line 43) | def test_add_and_get_item_reviews_from_customer(self):
    method test_add_item_review_from_non_customer (line 71) | def test_add_item_review_from_non_customer(self):
    method test_add_item_reviews_from_guest_user (line 83) | def test_add_item_reviews_from_guest_user(self):

FILE: webshop/webshop/doctype/override_doctype/item.py
  class DataValidationError (line 7) | class DataValidationError(frappe.ValidationError):
  class WebshopItem (line 10) | class WebshopItem(Item):
    method on_update (line 11) | def on_update(self):
    method before_rename (line 16) | def before_rename(self, old_name, new_name, merge=False):
    method validate_duplicate_website_item_before_merge (line 20) | def validate_duplicate_website_item_before_merge(self, old_name, new_n...
    method after_rename (line 41) | def after_rename(self, old_name, new_name, merge):
  function invalidate_cache_for_item (line 48) | def invalidate_cache_for_item(doc):

FILE: webshop/webshop/doctype/override_doctype/item_group.py
  class WebshopItemGroup (line 10) | class WebshopItemGroup(ItemGroup, WebsiteGenerator):
    method validate (line 19) | def validate(self):
    method on_update (line 24) | def on_update(self):
    method make_route (line 28) | def make_route(self):
    method on_trash (line 45) | def on_trash(self):
    method get_context (line 49) | def get_context(self, context):
    method has_website_permission (line 85) | def has_website_permission(self, ptype, user, verbose=False):
  function get_item_for_list_in_html (line 88) | def get_item_for_list_in_html(context):
  function get_parent_item_groups (line 99) | def get_parent_item_groups(item_group_name, from_item=False):
  function invalidate_cache_for (line 135) | def invalidate_cache_for(doc, item_group=None):
  function get_child_groups_for_website (line 144) | def get_child_groups_for_website(item_group_name, immediate=False, inclu...

FILE: webshop/webshop/doctype/override_doctype/payment_request.py
  class PaymentRequest (line 9) | class PaymentRequest(OriginalPaymentRequest):
    method on_payment_authorized (line 10) | def on_payment_authorized(self, status=None):
    method get_gateway_details (line 45) | def get_gateway_details(args):

FILE: webshop/webshop/doctype/recommended_items/recommended_items.py
  class RecommendedItems (line 8) | class RecommendedItems(Document):

FILE: webshop/webshop/doctype/webshop_settings/test_webshop_settings.py
  class TestWebshopSettings (line 12) | class TestWebshopSettings(unittest.TestCase):
    method tearDown (line 13) | def tearDown(self):
    method test_tax_rule_validation (line 16) | def test_tax_rule_validation(self):
    method test_invalid_filter_fields (line 27) | def test_invalid_filter_fields(self):
  function setup_webshop_settings (line 43) | def setup_webshop_settings(values_dict):

FILE: webshop/webshop/doctype/webshop_settings/webshop_settings.py
  class ShoppingCartSetupError (line 18) | class ShoppingCartSetupError(frappe.ValidationError):
  class WebshopSettings (line 22) | class WebshopSettings(Document):
    method onload (line 23) | def onload(self):
    method validate (line 29) | def validate(self):
    method after_save (line 44) | def after_save(self):
    method create_redisearch_indexes (line 47) | def create_redisearch_indexes(self):
    method validate_field_filters (line 55) | def validate_field_filters(filter_fields, enable_field_filters):
    method validate_attribute_filters (line 72) | def validate_attribute_filters(self):
    method validate_checkout (line 79) | def validate_checkout(self):
    method validate_search_index_fields (line 83) | def validate_search_index_fields(self):
    method validate_price_list_exchange_rate (line 109) | def validate_price_list_exchange_rate(self):
    method validate_tax_rule (line 137) | def validate_tax_rule(self):
    method get_tax_master (line 141) | def get_tax_master(self, billing_territory):
    method get_shipping_rules (line 147) | def get_shipping_rules(self, shipping_territory):
    method on_change (line 150) | def on_change(self):
  function validate_cart_settings (line 162) | def validate_cart_settings(doc=None, method=None):
  function get_shopping_cart_settings (line 166) | def get_shopping_cart_settings():
  function is_cart_enabled (line 171) | def is_cart_enabled():
  function show_quantity_in_website (line 175) | def show_quantity_in_website():
  function check_shopping_cart_enabled (line 179) | def check_shopping_cart_enabled():
  function show_attachments (line 184) | def show_attachments():

FILE: webshop/webshop/doctype/website_item/test_website_item.py
  class TestWebsiteItem (line 29) | class TestWebsiteItem(unittest.TestCase):
    method setUpClass (line 31) | def setUpClass(cls):
    method tearDownClass (line 42) | def tearDownClass(cls):
    method setUp (line 45) | def setUp(self):
    method test_index_creation (line 79) | def test_index_creation(self):
    method test_website_item_desk_item_sync (line 93) | def test_website_item_desk_item_sync(self):
    method test_publish_variant_and_template (line 133) | def test_publish_variant_and_template(self):
    method test_impact_on_merging_items (line 156) | def test_impact_on_merging_items(self):
    method test_website_item_breadcrumbs (line 177) | def test_website_item_breadcrumbs(self):
    method test_website_item_price_for_logged_in_user (line 213) | def test_website_item_price_for_logged_in_user(self):
    method test_website_item_price_for_guest_user (line 250) | def test_website_item_price_for_guest_user(self):
    method test_website_item_stock_when_out_of_stock (line 284) | def test_website_item_stock_when_out_of_stock(self):
    method test_website_item_stock_when_in_stock (line 331) | def test_website_item_stock_when_in_stock(self):
    method test_recommended_item (line 388) | def test_recommended_item(self):
    method test_recommended_item_for_guest_user (line 432) | def test_recommended_item_for_guest_user(self):
  function create_regular_web_item (line 480) | def create_regular_web_item(item_code=None, item_args=None, web_args=None):
  function make_web_item_price (line 496) | def make_web_item_price(**kwargs):
  function make_web_pricing_rule (line 517) | def make_web_pricing_rule(**kwargs):
  function create_user_and_customer_if_not_exists (line 547) | def create_user_and_customer_if_not_exists(email, first_name=None):

FILE: webshop/webshop/doctype/website_item/website_item.py
  class WebsiteItem (line 36) | class WebsiteItem(WebsiteGenerator):
    method autoname (line 44) | def autoname(self):
    method onload (line 52) | def onload(self):
    method validate (line 55) | def validate(self):
    method on_update (line 81) | def on_update(self):
    method on_trash (line 85) | def on_trash(self):
    method validate_duplicate_website_item (line 90) | def validate_duplicate_website_item(self):
    method publish_unpublish_desk_item (line 100) | def publish_unpublish_desk_item(self, publish=True):
    method make_route (line 108) | def make_route(self):
    method update_template_item (line 121) | def update_template_item(self):
    method validate_website_image (line 132) | def validate_website_image(self):
    method make_thumbnail (line 166) | def make_thumbnail(self):
    method get_context (line 229) | def get_context(self, context):
    method set_selected_attributes (line 273) | def set_selected_attributes(self, variants, context, attribute_values_...
    method set_attribute_values (line 294) | def set_attribute_values(self, attributes, context, attribute_values_a...
    method set_metatags (line 319) | def set_metatags(self, context):
    method set_shopping_cart_data (line 340) | def set_shopping_cart_data(self, context):
    method copy_specification_from_item_group (line 350) | def copy_specification_from_item_group(self):
    method get_product_details_section (line 362) | def get_product_details_section(self, context):
    method get_tabs (line 370) | def get_tabs(self):
    method get_recommended_items (line 387) | def get_recommended_items(self, settings):
  function invalidate_item_variants_cache_for_website (line 425) | def invalidate_item_variants_cache_for_website(doc):
  function invalidate_cache_for_web_item (line 449) | def invalidate_cache_for_web_item(doc):
  function on_doctype_update (line 477) | def on_doctype_update():
  function check_if_user_is_customer (line 482) | def check_if_user_is_customer(user=None):
  function make_website_item (line 502) | def make_website_item(doc, save=True):
  function has_website_permission_for_website_item (line 551) | def has_website_permission_for_website_item(doc, ptype, user, verbose=Fa...
  function has_website_permission_for_item_group (line 566) | def has_website_permission_for_item_group(doc, ptype, user, verbose=False):

FILE: webshop/webshop/doctype/website_item_tabbed_section/website_item_tabbed_section.py
  class WebsiteItemTabbedSection (line 9) | class WebsiteItemTabbedSection(Document):

FILE: webshop/webshop/doctype/website_offer/website_offer.py
  class WebsiteOffer (line 9) | class WebsiteOffer(Document):
  function get_offer_details (line 14) | def get_offer_details(offer_id):

FILE: webshop/webshop/doctype/wishlist/test_wishlist.py
  class TestWishlist (line 14) | class TestWishlist(unittest.TestCase):
    method setUp (line 15) | def setUp(self):
    method tearDown (line 24) | def tearDown(self):
    method test_add_remove_items_in_wishlist (line 30) | def test_add_remove_items_in_wishlist(self):
    method test_add_remove_in_wishlist_multiple_users (line 62) | def test_add_remove_in_wishlist_multiple_users(self):

FILE: webshop/webshop/doctype/wishlist/wishlist.py
  class Wishlist (line 9) | class Wishlist(Document):
  function add_to_wishlist (line 14) | def add_to_wishlist(item_code):
  function remove_from_wishlist (line 62) | def remove_from_wishlist(item_code):

FILE: webshop/webshop/doctype/wishlist_item/wishlist_item.py
  class WishlistItem (line 9) | class WishlistItem(Document):

FILE: webshop/webshop/legacy_search.py
  class ProductSearch (line 13) | class ProductSearch(FullTextSearch):
    method get_schema (line 16) | def get_schema(self):
    method get_id (line 25) | def get_id(self):
    method get_items_to_index (line 28) | def get_items_to_index(self):
    method get_document_to_index (line 39) | def get_document_to_index(self, item):
    method search (line 69) | def search(self, text, scope=None, limit=20):
    method parse_result (line 101) | def parse_result(self, result):
  function get_all_published_items (line 116) | def get_all_published_items():
  function update_index_for_path (line 122) | def update_index_for_path(path):
  function remove_document_from_index (line 127) | def remove_document_from_index(path):
  function build_index_for_all_routes (line 132) | def build_index_for_all_routes():

FILE: webshop/webshop/product_data_engine/filters.py
  class ProductFiltersBuilder (line 8) | class ProductFiltersBuilder:
    method __init__ (line 9) | def __init__(self, item_group=None):
    method get_field_filters (line 17) | def get_field_filters(self):
    method get_filtered_link_doctype_records (line 84) | def get_filtered_link_doctype_records(self, field):
    method get_link_doctype_filters (line 99) | def get_link_doctype_filters(self, meta):
    method get_attribute_filters (line 114) | def get_attribute_filters(self):
    method get_discount_filters (line 144) | def get_discount_filters(self, discounts):

FILE: webshop/webshop/product_data_engine/query.py
  class ProductQuery (line 12) | class ProductQuery:
    method __init__ (line 23) | def __init__(self):
    method query (line 46) | def query(self, attributes=None, fields=None, search_term=None, start=...
    method query_items (line 92) | def query_items(self, start=0):
    method query_items_with_attributes (line 125) | def query_items_with_attributes(self, attributes, start=0):
    method build_fields_filters (line 153) | def build_fields_filters(self, filters):
    method build_item_group_filters (line 179) | def build_item_group_filters(self, item_group):
    method build_search_filters (line 200) | def build_search_filters(self, search_term):
    method add_display_details (line 223) | def add_display_details(self, result, discount_list, cart_items):
    method get_price_discount_info (line 247) | def get_price_discount_info(self, item, price_object, discount_list):
    method get_stock_availability (line 262) | def get_stock_availability(self, item):
    method get_cart_items (line 285) | def get_cart_items(self):
    method filter_results_by_discount (line 309) | def filter_results_by_discount(self, fields, result):

FILE: webshop/webshop/product_data_engine/test_item_group_product_data_engine.py
  class TestItemGroupProductDataEngine (line 14) | class TestItemGroupProductDataEngine(unittest.TestCase):
    method setUp (line 17) | def setUp(self):
    method tearDown (line 36) | def tearDown(self):
    method test_product_listing_in_item_group (line 39) | def test_product_listing_in_item_group(self):
    method test_products_in_multiple_item_groups (line 59) | def test_products_in_multiple_item_groups(self):
    method test_item_group_with_sub_groups (line 98) | def test_item_group_with_sub_groups(self):
    method test_item_group_page_with_descendants_included (line 132) | def test_item_group_page_with_descendants_included(self):

FILE: webshop/webshop/product_data_engine/test_product_data_engine.py
  class TestProductDataEngine (line 18) | class TestProductDataEngine(unittest.TestCase):
    method setUpClass (line 22) | def setUpClass(cls):
    method tearDownClass (line 55) | def tearDownClass(cls):
    method test_product_list_ordering_and_paging (line 58) | def test_product_list_ordering_and_paging(self):
    method test_change_product_ranking (line 83) | def test_change_product_ranking(self):
    method test_product_list_field_filter_builder (line 105) | def test_product_list_field_filter_builder(self):
    method test_product_list_with_field_filter (line 134) | def test_product_list_with_field_filter(self):
    method test_product_list_attribute_filter_builder (line 153) | def test_product_list_attribute_filter_builder(self):
    method test_product_list_with_attribute_filter (line 165) | def test_product_list_with_attribute_filter(self):
    method test_product_list_discount_filter_builder (line 180) | def test_product_list_discount_filter_builder(self):
    method test_product_list_with_discount_filters (line 205) | def test_product_list_with_discount_filters(self):
    method test_product_list_with_api (line 241) | def test_product_list_with_api(self):
    method test_product_list_with_variants (line 260) | def test_product_list_with_variants(self):
    method test_custom_field_as_filter (line 280) | def test_custom_field_as_filter(self):
  function create_variant_web_item (line 329) | def create_variant_web_item():

FILE: webshop/webshop/redisearch_utils.py
  function get_indexable_web_fields (line 25) | def get_indexable_web_fields():
  function is_redisearch_enabled (line 36) | def is_redisearch_enabled():
  function is_search_module_loaded (line 42) | def is_search_module_loaded():
  function if_redisearch_enabled (line 52) | def if_redisearch_enabled(function):
  function make_key (line 64) | def make_key(key):
  function create_website_items_index (line 69) | def create_website_items_index():
  function to_search_field (line 105) | def to_search_field(field):
  function insert_item_to_index (line 113) | def insert_item_to_index(website_item_doc):
  function insert_to_name_ac (line 126) | def insert_to_name_ac(web_name, doc_name):
  function create_web_item_map (line 131) | def create_web_item_map(website_item_doc):
  function update_index_for_item (line 142) | def update_index_for_item(website_item_doc):
  function delete_item_from_index (line 149) | def delete_item_from_index(website_item_doc):
  function delete_from_ac_dict (line 163) | def delete_from_ac_dict(website_item_doc):
  function define_autocomplete_dictionary (line 170) | def define_autocomplete_dictionary():
  function create_items_autocomplete_dict (line 190) | def create_items_autocomplete_dict():
  function create_item_groups_autocomplete_dict (line 202) | def create_item_groups_autocomplete_dict():
  function reindex_all_web_items (line 226) | def reindex_all_web_items():
  function get_cache_key (line 238) | def get_cache_key(name):
  function get_fields_indexed (line 243) | def get_fields_indexed():
  function raise_redisearch_error (line 253) | def raise_redisearch_error():

FILE: webshop/webshop/shopping_cart/cart.py
  class WebsitePriceListMissingError (line 20) | class WebsitePriceListMissingError(frappe.ValidationError):
  function set_cart_count (line 24) | def set_cart_count(quotation=None):
  function get_cart_quotation (line 35) | def get_cart_quotation(doc=None):
  function get_shipping_addresses (line 58) | def get_shipping_addresses(party=None):
  function get_billing_addresses (line 74) | def get_billing_addresses(party=None):
  function place_order (line 90) | def place_order():
  function request_for_quotation (line 143) | def request_for_quotation():
  function update_cart (line 156) | def update_cart(item_code, qty, additional_notes=None, with_items=False):
  function get_shopping_cart_menu (line 220) | def get_shopping_cart_menu(context=None):
  function add_new_address (line 228) | def add_new_address(doc):
  function create_lead_for_item_inquiry (line 238) | def create_lead_for_item_inquiry(lead, subject, message):
  function get_terms_and_conditions (line 275) | def get_terms_and_conditions(terms_name):
  function update_cart_address (line 280) | def update_cart_address(address_type, address_name):
  function guess_territory (line 321) | def guess_territory():
  function decorate_quotation_doc (line 333) | def decorate_quotation_doc(doc):
  function _get_cart_quotation (line 369) | def _get_cart_quotation(party=None):
  function update_party (line 418) | def update_party(fullname, company_name=None, mobile_no=None, phone=None):
  function apply_cart_settings (line 446) | def apply_cart_settings(party=None, quotation=None):
  function set_price_list_and_rate (line 463) | def set_price_list_and_rate(quotation, cart_settings):
  function _set_price_list (line 485) | def _set_price_list(cart_settings, quotation=None):
  function set_taxes (line 508) | def set_taxes(quotation, cart_settings):
  function get_party (line 537) | def get_party(user=None):
  function get_debtors_account (line 615) | def get_debtors_account(cart_settings):
  function get_address_docs (line 654) | def get_address_docs(
  function apply_shipping_rule (line 687) | def apply_shipping_rule(shipping_rule):
  function _apply_shipping_rule (line 700) | def _apply_shipping_rule(party=None, quotation=None, cart_settings=None):
  function get_applicable_shipping_rules (line 715) | def get_applicable_shipping_rules(party=None, quotation=None):
  function get_shipping_rules (line 724) | def get_shipping_rules(quotation=None, cart_settings=None):
  function get_address_territory (line 750) | def get_address_territory(address_name):
  function show_terms (line 766) | def show_terms(doc):
  function apply_coupon_code (line 771) | def apply_coupon_code(applied_code, applied_referral_sales_partner):
  function remove_coupon_code (line 806) | def remove_coupon_code():

FILE: webshop/webshop/shopping_cart/product_info.py
  function get_product_info_for_website (line 17) | def get_product_info_for_website(item_code, skip_quotation_creation=False):
  function set_product_info_for_website (line 94) | def set_product_info_for_website(item):

FILE: webshop/webshop/shopping_cart/test_shopping_cart.py
  class TestShoppingCart (line 23) | class TestShoppingCart(unittest.TestCase):
    method setUp (line 29) | def setUp(self):
    method tearDown (line 38) | def tearDown(self):
    method tearDownClass (line 44) | def tearDownClass(cls):
    method test_get_cart_new_user (line 47) | def test_get_cart_new_user(self):
    method test_get_cart_customer (line 69) | def test_get_cart_customer(self, customer="_Test Customer 2"):
    method test_add_to_cart (line 82) | def test_add_to_cart(self):
    method test_update_cart (line 113) | def test_update_cart(self):
    method test_remove_from_cart (line 126) | def test_remove_from_cart(self):
    method test_tax_rule (line 141) | def test_tax_rule(self):
    method test_add_item_variant_without_web_item_to_cart (line 186) | def test_add_item_variant_without_web_item_to_cart(self):
    method test_cart_without_checkout_and_draft_quotation (line 214) | def test_cart_without_checkout_and_draft_quotation(self):
    method create_tax_rule (line 233) | def create_tax_rule(self):
    method create_quotation (line 240) | def create_quotation(self):
    method remove_test_quotation (line 267) | def remove_test_quotation(self, quotation):
    method enable_shopping_cart (line 272) | def enable_shopping_cart(self):
    method disable_shopping_cart (line 309) | def disable_shopping_cart(self):
    method login_as_new_user (line 315) | def login_as_new_user(self):
    method login_as_customer (line 319) | def login_as_customer(
    method clear_existing_quotations (line 325) | def clear_existing_quotations(self):
    method create_user_if_not_exists (line 336) | def create_user_if_not_exists(self, email, first_name=None):
  function create_address_and_contact (line 353) | def create_address_and_contact(**kwargs):

FILE: webshop/webshop/shopping_cart/utils.py
  function show_cart_count (line 8) | def show_cart_count():
  function set_cart_count (line 18) | def set_cart_count(login_manager):
  function clear_cart_count (line 35) | def clear_cart_count(login_manager):
  function update_website_context (line 40) | def update_website_context(context):
  function is_customer (line 45) | def is_customer():

FILE: webshop/webshop/utils/portal.py
  function update_debtors_account (line 12) | def update_debtors_account():

FILE: webshop/webshop/utils/product.py
  function get_web_item_qty_in_stock (line 8) | def get_web_item_qty_in_stock(item_code, item_warehouse_field, warehouse...
  function adjust_qty_for_expired_items (line 50) | def adjust_qty_for_expired_items(item_code, stock_qty, warehouse):
  function get_expired_batches (line 67) | def get_expired_batches(batches):
  function qty_from_all_warehouses (line 74) | def qty_from_all_warehouses(batch_info):
  function get_non_stock_item_status (line 85) | def get_non_stock_item_status(item_code, item_warehouse_field):

FILE: webshop/webshop/utils/setup.py
  function has_ecommerce_fields (line 3) | def has_ecommerce_fields() -> bool:

FILE: webshop/webshop/variant_selector/item_variants_cache.py
  class ItemVariantsCacheManager (line 4) | class ItemVariantsCacheManager:
    method __init__ (line 5) | def __init__(self, item_code):
    method get_item_variants_data (line 8) | def get_item_variants_data(self):
    method get_attribute_value_item_map (line 16) | def get_attribute_value_item_map(self):
    method get_item_attribute_value_map (line 24) | def get_item_attribute_value_map(self):
    method get_optional_attributes (line 32) | def get_optional_attributes(self):
    method get_ordered_attribute_values (line 40) | def get_ordered_attribute_values(self):
    method build_cache (line 56) | def build_cache(self):
    method clear_cache (line 100) | def clear_cache(self):
    method rebuild_cache (line 111) | def rebuild_cache(self):
  function build_cache (line 116) | def build_cache(item_code):
  function enqueue_build_cache (line 123) | def enqueue_build_cache(item_code):

FILE: webshop/webshop/variant_selector/test_variant_selector.py
  class TestVariantSelector (line 15) | class TestVariantSelector(FrappeTestCase):
    method setUpClass (line 17) | def setUpClass(cls):
    method test_item_attributes (line 45) | def test_item_attributes(self):
    method test_next_item_variant_values (line 76) | def test_next_item_variant_values(self):
    method test_exact_match_with_price (line 96) | def test_exact_match_with_price(self):

FILE: webshop/webshop/variant_selector/utils.py
  function get_item_codes_by_attributes (line 12) | def get_item_codes_by_attributes(attribute_filters, template_item_code=N...
  function get_attributes_and_values (line 74) | def get_attributes_and_values(item_code):
  function get_next_attribute_and_values (line 116) | def get_next_attribute_and_values(item_code, selected_attributes):
  function get_items_with_selected_attributes (line 215) | def get_items_with_selected_attributes(item_code, selected_attributes):
  function get_item_attributes (line 230) | def get_item_attributes(item_code):
  function get_item_variant_price_dict (line 247) | def get_item_variant_price_dict(item_code, cart_settings):

FILE: webshop/www/all-products/index.js
  class ProductListing (line 2) | class ProductListing {
    method constructor (line 3) | constructor() {
    method bind_card_actions (line 20) | bind_card_actions() {

FILE: webshop/www/all-products/index.py
  function get_context (line 9) | def get_context(context):

FILE: webshop/www/shop-by-category/index.py
  function get_context (line 7) | def get_context(context):
  function get_slideshow (line 23) | def get_slideshow(slideshow):
  function get_tabs (line 38) | def get_tabs(categories):
  function get_category_records (line 54) | def get_category_records(categories):
Condensed preview — 178 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (562K chars).
[
  {
    "path": ".github/workflows/ci.yml",
    "chars": 3429,
    "preview": "name: CI\n\non:\n  pull_request:\n    paths-ignore:\n      - \"**.css\"\n      - \"**.js\"\n      - \"**.md\"\n      - \"**.html\"\n     "
  },
  {
    "path": ".github/workflows/semgroup-rules.yml",
    "chars": 563,
    "preview": "name: Linters\n\non:\n  pull_request: { }\n\njobs:\n  linters:\n    name: Frappe Linter\n    runs-on: ubuntu-latest\n    steps:\n "
  },
  {
    "path": ".gitignore",
    "chars": 226,
    "preview": "**/__pycache__\n*.egg-info\n*.pyc\n*.py~\n*.swo\n*.swp\n*~\n.DS_Store\n.backportrc.json\n.idea/\n.vscode/\n.wnf-lang-status\n__pycac"
  },
  {
    "path": "LICENSE",
    "chars": 35150,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "README.md",
    "chars": 7038,
    "preview": "# Frappe Webshop\nFrappe Webshop is an Open Source eCommerce Platform, developed primarily using Python and JavaScript. F"
  },
  {
    "path": "pyproject.toml",
    "chars": 547,
    "preview": "[project]\nname = \"webshop\"\nauthors = [\n    { name = \"Frappe Technologies Pvt. Ltd.\", email = \"contact@frappe.io\"}\n]\ndesc"
  },
  {
    "path": "webshop/__init__.py",
    "chars": 24,
    "preview": "\n__version__ = '0.0.1'\n\n"
  },
  {
    "path": "webshop/config/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/hooks.py",
    "chars": 2564,
    "preview": "from . import __version__ as _version\n\napp_name = \"webshop\"\napp_title = \"Webshop\"\napp_publisher = \"Frappe Technologies P"
  },
  {
    "path": "webshop/modules.txt",
    "chars": 7,
    "preview": "Webshop"
  },
  {
    "path": "webshop/patches/__init__.py",
    "chars": 24,
    "preview": "\n__version__ = '0.0.1'\n\n"
  },
  {
    "path": "webshop/patches/add_homepage_field.py",
    "chars": 807,
    "preview": "import frappe\nfrom frappe.custom.doctype.custom_field.custom_field import create_custom_fields\n\n\ndef execute():\n\tif not "
  },
  {
    "path": "webshop/patches/clear_cache_for_item_group_route.py",
    "chars": 227,
    "preview": "import frappe\nfrom frappe.website.utils import clear_cache\n\ndef execute():\n\troutes = frappe.get_all(\"Item Group\", filter"
  },
  {
    "path": "webshop/patches/convert_to_website_item_in_item_card_group_template.py",
    "chars": 1528,
    "preview": "import json\nfrom typing import List, Union\n\nimport frappe\n\nfrom webshop.webshop.doctype.website_item.website_item import"
  },
  {
    "path": "webshop/patches/copy_custom_field_filters_to_website_item.py",
    "chars": 2925,
    "preview": "import frappe\nfrom frappe.custom.doctype.custom_field.custom_field import create_custom_field\n\nfrom webshop.webshop.util"
  },
  {
    "path": "webshop/patches/create_website_items.py",
    "chars": 2670,
    "preview": "import frappe\n\nfrom webshop.webshop.doctype.website_item.website_item import make_website_item\n\n\ndef execute():\n\tif frap"
  },
  {
    "path": "webshop/patches/enable_allow_to_guest_view_for_item_group.py",
    "chars": 420,
    "preview": "import frappe\nfrom frappe.custom.doctype.property_setter.property_setter import make_property_setter\n\ndef execute():\n\tfr"
  },
  {
    "path": "webshop/patches/fetch_thumbnail_in_website_items.py",
    "chars": 404,
    "preview": "import frappe\n\n\ndef execute():\n\tif frappe.db.has_column(\"Item\", \"thumbnail\"):\n\t\twebsite_item = frappe.qb.DocType(\"Websit"
  },
  {
    "path": "webshop/patches/make_homepage_products_website_items.py",
    "chars": 363,
    "preview": "import frappe\n\n\ndef execute():\n\tif not frappe.db.exists(\"DocType\", \"Homepage\"):\n\t\treturn\n\thomepage = frappe.get_doc(\"Hom"
  },
  {
    "path": "webshop/patches/populate_e_commerce_settings.py",
    "chars": 2082,
    "preview": "import frappe\nfrom frappe.utils import cint\n\nfrom webshop.webshop.utils.setup import has_ecommerce_fields\n\ndef execute()"
  },
  {
    "path": "webshop/patches/shopping_cart_to_ecommerce.py",
    "chars": 268,
    "preview": "import click\nimport frappe\n\n\ndef execute():\n\n\tfrappe.delete_doc(\"DocType\", \"Shopping Cart Settings\", ignore_missing=True"
  },
  {
    "path": "webshop/patches.txt",
    "chars": 190,
    "preview": "[pre_model_sync]\n\n[post_model_sync]\n\nwebshop.patches.add_homepage_field #09-05-2024\nwebshop.patches.enable_allow_to_gues"
  },
  {
    "path": "webshop/public/.gitkeep",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/public/js/customer_reviews.js",
    "chars": 3442,
    "preview": "$(() => {\n\tclass CustomerReviews {\n\t\tconstructor() {\n\t\t\tthis.bind_button_actions();\n\t\t\tthis.start = 0;\n\t\t\tthis.page_leng"
  },
  {
    "path": "webshop/public/js/init.js",
    "chars": 76,
    "preview": "if (!window.webshop) window.webshop = {}\nif (!frappe.boot) frappe.boot = {}\n"
  },
  {
    "path": "webshop/public/js/override/homepage.js",
    "chars": 382,
    "preview": "frappe.ui.form.on('Homepage', {\n\tsetup: function(frm) {\n\t\tfrm.set_query('item_code', 'products', function() {\n\t\t\treturn "
  },
  {
    "path": "webshop/public/js/override/item.js",
    "chars": 1162,
    "preview": "frappe.ui.form.on(\"Item\", {\n    refresh: function(frm) {\n\t\tif (!frm.doc.__islocal) {\n\t\t\tif (!frm.doc.published_in_websit"
  },
  {
    "path": "webshop/public/js/product_ui/grid.js",
    "chars": 5103,
    "preview": "webshop.ProductGrid = class {\n\t/* Options:\n\t\t- items: Items\n\t\t- settings: Webshop Settings\n\t\t- products_section: Product"
  },
  {
    "path": "webshop/public/js/product_ui/list.js",
    "chars": 5853,
    "preview": "webshop.ProductList = class {\n\t/* Options:\n\t\t- items: Items\n\t\t- settings: Webshop Settings\n\t\t- products_section: Product"
  },
  {
    "path": "webshop/public/js/product_ui/search.js",
    "chars": 6570,
    "preview": "webshop.ProductSearch = class {\n\tconstructor(opts) {\n\t\t/* Options: search_box_id (for custom search box) */\n\t\t$.extend(t"
  },
  {
    "path": "webshop/public/js/product_ui/views.js",
    "chars": 15646,
    "preview": "webshop.ProductView =  class {\n\t/* Options:\n\t\t- View Type\n\t\t- Products Section Wrapper,\n\t\t- Item Group: If its an Item G"
  },
  {
    "path": "webshop/public/js/shopping_cart.js",
    "chars": 6501,
    "preview": "// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n// License: GNU General Public License v3. See lic"
  },
  {
    "path": "webshop/public/js/wishlist.js",
    "chars": 5755,
    "preview": "frappe.provide(\"webshop.webshop.wishlist\");\nvar wishlist = webshop.webshop.wishlist;\n\nfrappe.provide(\"webshop.webshop.sh"
  },
  {
    "path": "webshop/public/scss/webshop-web.bundle.scss",
    "chars": 25,
    "preview": "@import \"./webshop_cart\";"
  },
  {
    "path": "webshop/public/scss/webshop_cart.scss",
    "chars": 21972,
    "preview": "@import \"frappe/public/scss/common/mixins\";\n\n:root {\n\t--green-info: #38A160;\n\t--product-bg-color: white;\n\t--body-bg-colo"
  },
  {
    "path": "webshop/public/web.bundle.js",
    "chars": 225,
    "preview": "import './js/init'\n\nimport './js/customer_reviews'\nimport './js/product_ui/grid'\nimport './js/product_ui/list'\nimport '."
  },
  {
    "path": "webshop/setup/install.py",
    "chars": 5780,
    "preview": "import click\nimport frappe\n\nfrom frappe import _\nfrom frappe.custom.doctype.custom_field.custom_field import create_cust"
  },
  {
    "path": "webshop/templates/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/templates/generators/item/item.html",
    "chars": 2749,
    "preview": "{% extends \"templates/web.html\" %}\n{% from \"webshop/templates/includes/macros.html\" import recommended_item_row %}\n\n{% b"
  },
  {
    "path": "webshop/templates/generators/item/item_add_to_cart.html",
    "chars": 6705,
    "preview": "{% if shopping_cart and shopping_cart.cart_settings.enabled %}\n\n{% set cart_settings = shopping_cart.cart_settings %}\n{%"
  },
  {
    "path": "webshop/templates/generators/item/item_configure.html",
    "chars": 611,
    "preview": "{% if shopping_cart and shopping_cart.cart_settings.enabled %}\n{% set cart_settings = shopping_cart.cart_settings %}\n\n<d"
  },
  {
    "path": "webshop/templates/generators/item/item_configure.js",
    "chars": 9209,
    "preview": "class ItemConfigure {\n\tconstructor(item_code, item_name) {\n\t\tthis.item_code = item_code;\n\t\tthis.item_name = item_name;\n\n"
  },
  {
    "path": "webshop/templates/generators/item/item_details.html",
    "chars": 2156,
    "preview": "{% set width_class = \"expand\" if not slides else \"\" %}\n{% set cart_settings = shopping_cart.cart_settings %}\n{% set prod"
  },
  {
    "path": "webshop/templates/generators/item/item_image.html",
    "chars": 2637,
    "preview": "{% set column_size = 5 if slides else 4 %}\n<div class=\"col-md-{{ column_size }} h-100 d-flex mb-4\">\n\t{% if slides %}\n\t\t<"
  },
  {
    "path": "webshop/templates/generators/item/item_inquiry.html",
    "chars": 392,
    "preview": "{% if shopping_cart and shopping_cart.cart_settings.enabled %}\n{% set cart_settings = shopping_cart.cart_settings %}\n\t{%"
  },
  {
    "path": "webshop/templates/generators/item/item_inquiry.js",
    "chars": 1555,
    "preview": "frappe.ready(() => {\n\tconst d = new frappe.ui.Dialog({\n\t\ttitle: __('Contact Us'),\n\t\tfields: [\n\t\t\t{\n\t\t\t\tfieldtype: 'Data'"
  },
  {
    "path": "webshop/templates/generators/item/item_reviews.html",
    "chars": 2455,
    "preview": "{% from \"webshop/templates/includes/macros.html\" import user_review, ratings_summary %}\n\n<div class=\"mt-4 ratings-review"
  },
  {
    "path": "webshop/templates/generators/item/item_specifications.html",
    "chars": 568,
    "preview": "<!-- Is reused to render within tabs as well as independently -->\n{% if website_specifications %}\n<div class=\"{{ 'mt-2' "
  },
  {
    "path": "webshop/templates/generators/item_group.html",
    "chars": 2215,
    "preview": "{% from \"webshop/templates/includes/macros.html\" import field_filter_section, attribute_filter_section, discount_range_f"
  },
  {
    "path": "webshop/templates/includes/cart/address_card.html",
    "chars": 495,
    "preview": "<div class=\"card address-card h-100\">\n\t<div class=\"btn btn-sm btn-default btn-change-address font-md\" style=\"position: a"
  },
  {
    "path": "webshop/templates/includes/cart/address_picker_card.html",
    "chars": 617,
    "preview": "<div class=\"card address-card h-100\">\n\t<div class=\"check\" style=\"position: absolute; right: 15px; top: 15px;\">\n\t\t<svg xm"
  },
  {
    "path": "webshop/templates/includes/cart/cart_address.html",
    "chars": 7533,
    "preview": "{% from \"webshop/templates/includes/cart/cart_macros.html\" import show_address %}\n\n{% if addresses | length == 1%}\n\t{% s"
  },
  {
    "path": "webshop/templates/includes/cart/cart_address_picker.html",
    "chars": 112,
    "preview": "<div class=\"mb-3 frappe-card p-5\" data-section=\"shipping-address\">\n\t<h6>{{ _(\"Shipping Address\") }}</h6>\n</div>\n"
  },
  {
    "path": "webshop/templates/includes/cart/cart_dropdown.html",
    "chars": 772,
    "preview": "<div class=\"cart-dropdown-container\">\n\t<div id=\"cart-error\" class=\"alert alert-danger\"\n\t\tstyle=\"display: none;\"></div>\n\t"
  },
  {
    "path": "webshop/templates/includes/cart/cart_items.html",
    "chars": 3586,
    "preview": "{% from \"webshop/templates/includes/macros.html\" import product_image %}\n\n{% macro item_subtotal(item) %}\n\t<div>\n\t\t{{ it"
  },
  {
    "path": "webshop/templates/includes/cart/cart_items_dropdown.html",
    "chars": 405,
    "preview": "{% from \"webshop/templates/includes/order/order_macros.html\" import item_name_and_description_cart %}\n\n{% for d in doc.i"
  },
  {
    "path": "webshop/templates/includes/cart/cart_items_total.html",
    "chars": 251,
    "preview": "<!-- Total at the end of the cart items -->\n<tr>\n\t<th></th>\n\t<th class=\"text-left item-grand-total\" colspan=\"1\">\n\t\t{{ _("
  },
  {
    "path": "webshop/templates/includes/cart/cart_macros.html",
    "chars": 775,
    "preview": "{% macro show_address(address, doc, fieldname, select_address=False) %}\n{% set selected=address.name==doc.get(fieldname)"
  },
  {
    "path": "webshop/templates/includes/cart/cart_payment_summary.html",
    "chars": 3432,
    "preview": "<!-- Payment -->\n{% if cart_settings.enable_checkout or cart_settings.show_price_in_quotation %}\n<h6>\n\t{{ _(\"Payment Sum"
  },
  {
    "path": "webshop/templates/includes/cart/coupon_code.html",
    "chars": 1001,
    "preview": "{% if coupon_code %}\n<p class=\"h6\">Coupon code</p>\n<div\n    class=\"cart-coupon-code flex gap-2 align-items-center w-fit "
  },
  {
    "path": "webshop/templates/includes/cart/place_order.html",
    "chars": 392,
    "preview": "<div class=\"card h-100\">\n\t<div class=\"card-body p-0\">\n\t\t{% if cart_settings.enable_checkout %}\n\t\t\t<button class=\"btn btn"
  },
  {
    "path": "webshop/templates/includes/macros.html",
    "chars": 13494,
    "preview": "{% macro product_image_square(website_image, css_class=\"\") %}\n<div class=\"product-image product-image-square h-100 round"
  },
  {
    "path": "webshop/templates/includes/navbar/navbar_items.html",
    "chars": 711,
    "preview": "{% extends 'frappe/templates/includes/navbar/navbar_items.html' %}\n\n{% block navbar_right_extension %}\n\t<li class=\"shopp"
  },
  {
    "path": "webshop/templates/includes/order/order_macros.html",
    "chars": 1617,
    "preview": "{% from \"webshop/templates/includes/macros.html\" import product_image %}\n\n{% macro item_name_and_description(d) %}\n\t<div"
  },
  {
    "path": "webshop/templates/includes/order/order_taxes.html",
    "chars": 3278,
    "preview": "{% if doc.taxes %}\n\t<div class=\"w-100 order-taxes mt-5\">\n\t\t<div class=\"col-4 d-flex  border-btm pb-5\">\n\t\t\t<div class=\"it"
  },
  {
    "path": "webshop/templates/includes/product_page.js",
    "chars": 6442,
    "preview": "// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n// License: GNU General Public License v3. See lic"
  },
  {
    "path": "webshop/templates/pages/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/templates/pages/cart.html",
    "chars": 4526,
    "preview": "{% extends \"templates/web.html\" %}\n\n{% block title %} {{ _(\"Shopping Cart\") }} {% endblock %}\n\n{% block header %}<h3 cla"
  },
  {
    "path": "webshop/templates/pages/cart.js",
    "chars": 6406,
    "preview": "// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n// License: GNU General Public License v3. See lic"
  },
  {
    "path": "webshop/templates/pages/cart.py",
    "chars": 311,
    "preview": "# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/templates/pages/customer_reviews.html",
    "chars": 2002,
    "preview": "{% extends \"templates/web.html\" %}\n{% from \"webshop/templates/includes/macros.html\" import user_review, ratings_summary "
  },
  {
    "path": "webshop/templates/pages/customer_reviews.py",
    "chars": 904,
    "preview": "# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/templates/pages/order.html",
    "chars": 6179,
    "preview": "{% extends \"templates/web.html\" %}\n{% from \"webshop/templates/includes/order/order_macros.html\" import item_name_and_des"
  },
  {
    "path": "webshop/templates/pages/order.js",
    "chars": 2090,
    "preview": "// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors\n// For license information, please see license.txt"
  },
  {
    "path": "webshop/templates/pages/order.py",
    "chars": 2173,
    "preview": "# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/templates/pages/product_search.html",
    "chars": 905,
    "preview": "{% extends \"templates/web.html\" %}\n\n{% block title %} {{ _(\"Product Search\") }} {% endblock %}\n\n{% block header %}<h2>{{"
  },
  {
    "path": "webshop/templates/pages/product_search.py",
    "chars": 4008,
    "preview": "# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/templates/pages/wishlist.html",
    "chars": 805,
    "preview": "{% extends \"templates/web.html\" %}\n\n{% block title %} {{ _(\"Wishlist\") }} {% endblock %}\n\n{% block header %}<h3 class=\"s"
  },
  {
    "path": "webshop/templates/pages/wishlist.py",
    "chars": 2396,
    "preview": "# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/webshop/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/api.py",
    "chars": 2545,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, "
  },
  {
    "path": "webshop/webshop/crud_events/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/crud_events/item/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/crud_events/item/invalidate_item_variants_cache.py",
    "chars": 715,
    "preview": "import frappe\nfrom webshop.webshop.variant_selector.item_variants_cache import (\n    ItemVariantsCacheManager,\n)\n\n\ndef e"
  },
  {
    "path": "webshop/webshop/crud_events/item/update_website_item.py",
    "chars": 952,
    "preview": "import frappe\n\n\ndef execute(doc, method=None):\n    \"\"\"Update Website Item if change in Item impacts it.\"\"\"\n    web_item "
  },
  {
    "path": "webshop/webshop/crud_events/item/validate_duplicate_website_item.py",
    "chars": 1030,
    "preview": "import frappe\n\nfrom frappe import _\nfrom frappe.utils import get_link_to_form\n\n\nclass DataValidationError(frappe.Validat"
  },
  {
    "path": "webshop/webshop/crud_events/price_list/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/crud_events/price_list/check_impact_on_cart.py",
    "chars": 560,
    "preview": "import frappe\nfrom webshop.webshop.doctype.webshop_settings.webshop_settings import (\n    validate_cart_settings,\n)\n\n\nde"
  },
  {
    "path": "webshop/webshop/crud_events/quotation/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/crud_events/quotation/validate_shopping_cart_items.py",
    "chars": 944,
    "preview": "import frappe\nfrom frappe import _\n\n\ndef execute(doc, method=None):\n    if doc.order_type != \"Shopping Cart\":\n        re"
  },
  {
    "path": "webshop/webshop/crud_events/tax_rule/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/crud_events/tax_rule/validate_use_for_cart.py",
    "chars": 799,
    "preview": "import frappe\nfrom frappe import _\nfrom frappe.utils import cint\n\n\ndef execute(doc, method=None):\n    \"\"\"\n    If shoppin"
  },
  {
    "path": "webshop/webshop/doctype/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/homepage_featured_product/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/homepage_featured_product/homepage_featured_product.json",
    "chars": 1883,
    "preview": "{\n \"actions\": [],\n \"allow_rename\": 1,\n \"creation\": \"2023-12-14 22:14:23.853797\",\n \"doctype\": \"DocType\",\n \"editable_grid\""
  },
  {
    "path": "webshop/webshop/doctype/homepage_featured_product/homepage_featured_product.py",
    "chars": 228,
    "preview": "# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, please see license.txt\n\n"
  },
  {
    "path": "webshop/webshop/doctype/item_review/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/item_review/item_review.js",
    "chars": 197,
    "preview": "// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n// For license information, please see license.txt"
  },
  {
    "path": "webshop/webshop/doctype/item_review/item_review.json",
    "chars": 2335,
    "preview": "{\n \"actions\": [],\n \"beta\": 1,\n \"creation\": \"2021-03-23 16:47:26.542226\",\n \"doctype\": \"DocType\",\n \"editable_grid\": 1,\n \"e"
  },
  {
    "path": "webshop/webshop/doctype/item_review/item_review.py",
    "chars": 4875,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, "
  },
  {
    "path": "webshop/webshop/doctype/item_review/test_item_review.py",
    "chars": 3344,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors\n# See license.txt\nimport un"
  },
  {
    "path": "webshop/webshop/doctype/override_doctype/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/override_doctype/item.py",
    "chars": 1919,
    "preview": "import frappe\nfrom frappe import _\nfrom frappe.utils import get_link_to_form\nfrom erpnext.stock.doctype.item.item import"
  },
  {
    "path": "webshop/webshop/doctype/override_doctype/item_group.py",
    "chars": 5332,
    "preview": "import frappe\nfrom frappe import _\nfrom urllib.parse import quote\nfrom frappe.utils import get_url, cint\nfrom frappe.web"
  },
  {
    "path": "webshop/webshop/doctype/override_doctype/payment_request.py",
    "chars": 1423,
    "preview": "import frappe\nfrom frappe.utils import get_url\n\nfrom erpnext.accounts.doctype.payment_request.payment_request import (\n "
  },
  {
    "path": "webshop/webshop/doctype/recommended_items/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/recommended_items/recommended_items.json",
    "chars": 1892,
    "preview": "{\n \"actions\": [],\n \"creation\": \"2021-07-12 20:52:12.503470\",\n \"doctype\": \"DocType\",\n \"editable_grid\": 1,\n \"engine\": \"Inn"
  },
  {
    "path": "webshop/webshop/doctype/recommended_items/recommended_items.py",
    "chars": 221,
    "preview": "# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, please see license.txt\n\n"
  },
  {
    "path": "webshop/webshop/doctype/webshop_settings/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/webshop_settings/test_webshop_settings.py",
    "chars": 1576,
    "preview": "# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors\n# See license.txt\nimport unittest\n\nimport frappe\n\nf"
  },
  {
    "path": "webshop/webshop/doctype/webshop_settings/webshop_settings.js",
    "chars": 1640,
    "preview": "// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n// For license information, please see license.txt"
  },
  {
    "path": "webshop/webshop/doctype/webshop_settings/webshop_settings.json",
    "chars": 10201,
    "preview": "{\n \"actions\": [],\n \"creation\": \"2021-02-10 17:13:39.139103\",\n \"doctype\": \"DocType\",\n \"editable_grid\": 1,\n \"engine\": \"Inn"
  },
  {
    "path": "webshop/webshop/doctype/webshop_settings/webshop_settings.py",
    "chars": 6208,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, "
  },
  {
    "path": "webshop/webshop/doctype/website_item/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/website_item/templates/website_item.html",
    "chars": 149,
    "preview": "{% extends \"templates/web.html\" %}\n\n{% block page_content %}\n<h1>{{ title }}</h1>\n{% endblock %}\n\n<!-- this is a sample "
  },
  {
    "path": "webshop/webshop/doctype/website_item/templates/website_item_row.html",
    "chars": 120,
    "preview": "<div>\n\t<a href=\"{{ doc.route }}\">{{ doc.title or doc.name }}</a>\n</div>\n<!-- this is a sample default list template -->\n"
  },
  {
    "path": "webshop/webshop/doctype/website_item/test_website_item.py",
    "chars": 19806,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors\n# See license.txt\n\nimport u"
  },
  {
    "path": "webshop/webshop/doctype/website_item/website_item.js",
    "chars": 970,
    "preview": "// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n// For license information, please see license.txt"
  },
  {
    "path": "webshop/webshop/doctype/website_item/website_item.json",
    "chars": 8979,
    "preview": "{\n \"actions\": [],\n \"allow_import\": 1,\n \"autoname\": \"naming_series\",\n \"creation\": \"2021-02-09 21:06:14.441698\",\n \"doctype"
  },
  {
    "path": "webshop/webshop/doctype/website_item/website_item.py",
    "chars": 15649,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, "
  },
  {
    "path": "webshop/webshop/doctype/website_item/website_item_list.js",
    "chars": 888,
    "preview": "frappe.listview_settings['Website Item'] = {\n\tadd_fields: [\"item_name\", \"web_item_name\", \"published\", \"website_image\", \""
  },
  {
    "path": "webshop/webshop/doctype/website_item_tabbed_section/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/website_item_tabbed_section/website_item_tabbed_section.json",
    "chars": 717,
    "preview": "{\n \"actions\": [],\n \"creation\": \"2021-03-18 20:32:15.321402\",\n \"doctype\": \"DocType\",\n \"editable_grid\": 1,\n \"engine\": \"Inn"
  },
  {
    "path": "webshop/webshop/doctype/website_item_tabbed_section/website_item_tabbed_section.py",
    "chars": 253,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, "
  },
  {
    "path": "webshop/webshop/doctype/website_offer/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/website_offer/website_offer.json",
    "chars": 855,
    "preview": "{\n \"actions\": [],\n \"creation\": \"2021-04-21 13:37:14.162162\",\n \"doctype\": \"DocType\",\n \"editable_grid\": 1,\n \"engine\": \"Inn"
  },
  {
    "path": "webshop/webshop/doctype/website_offer/website_offer.py",
    "chars": 394,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, "
  },
  {
    "path": "webshop/webshop/doctype/wishlist/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/wishlist/test_wishlist.py",
    "chars": 4033,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors\n# See license.txt\nimport un"
  },
  {
    "path": "webshop/webshop/doctype/wishlist/wishlist.js",
    "chars": 194,
    "preview": "// Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n// For license information, please see license.txt"
  },
  {
    "path": "webshop/webshop/doctype/wishlist/wishlist.json",
    "chars": 1128,
    "preview": "{\n \"actions\": [],\n \"autoname\": \"field:user\",\n \"creation\": \"2021-03-10 18:52:28.769126\",\n \"doctype\": \"DocType\",\n \"editabl"
  },
  {
    "path": "webshop/webshop/doctype/wishlist/wishlist.py",
    "chars": 2085,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, "
  },
  {
    "path": "webshop/webshop/doctype/wishlist_item/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/doctype/wishlist_item/wishlist_item.json",
    "chars": 3004,
    "preview": "{\n \"actions\": [],\n \"creation\": \"2021-03-10 19:03:00.662714\",\n \"doctype\": \"DocType\",\n \"editable_grid\": 1,\n \"engine\": \"Inn"
  },
  {
    "path": "webshop/webshop/doctype/wishlist_item/wishlist_item.py",
    "chars": 241,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, "
  },
  {
    "path": "webshop/webshop/legacy_search.py",
    "chars": 3565,
    "preview": "import frappe\nfrom frappe.search.full_text_search import FullTextSearch\nfrom frappe.utils import strip_html_tags\nfrom wh"
  },
  {
    "path": "webshop/webshop/product_data_engine/filters.py",
    "chars": 5067,
    "preview": "# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/webshop/product_data_engine/query.py",
    "chars": 10345,
    "preview": "# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/webshop/product_data_engine/test_item_group_product_data_engine.py",
    "chars": 5640,
    "preview": "# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, please see license.txt\n\n"
  },
  {
    "path": "webshop/webshop/product_data_engine/test_product_data_engine.py",
    "chars": 11901,
    "preview": "# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors\n# For license information, please see license.txt\n\n"
  },
  {
    "path": "webshop/webshop/redisearch_utils.py",
    "chars": 6976,
    "preview": "# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/webshop/shopping_cart/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/shopping_cart/cart.py",
    "chars": 21792,
    "preview": "# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/webshop/shopping_cart/product_info.py",
    "chars": 3396,
    "preview": "# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/webshop/shopping_cart/test_shopping_cart.py",
    "chars": 12209,
    "preview": "# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/webshop/shopping_cart/utils.py",
    "chars": 1492,
    "preview": "# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors\n# License: GNU General Public License v3. See licen"
  },
  {
    "path": "webshop/webshop/utils/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/utils/portal.py",
    "chars": 1539,
    "preview": "import frappe\nfrom frappe.utils.nestedset import get_root_of\n\nfrom erpnext.portal.utils import create_customer_or_suppli"
  },
  {
    "path": "webshop/webshop/utils/product.py",
    "chars": 3137,
    "preview": "import frappe\nfrom frappe.utils import getdate, nowdate\n\nfrom erpnext.stock.doctype.batch.batch import get_batch_qty\nfro"
  },
  {
    "path": "webshop/webshop/utils/setup.py",
    "chars": 264,
    "preview": "import frappe\n\ndef has_ecommerce_fields() -> bool:\n\ttable = frappe.qb.Table(\"tabSingles\")\n\tquery = (\n\t\tfrappe.qb.from_(t"
  },
  {
    "path": "webshop/webshop/variant_selector/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/variant_selector/item_variants_cache.py",
    "chars": 3930,
    "preview": "import frappe\n\n\nclass ItemVariantsCacheManager:\n\tdef __init__(self, item_code):\n\t\tself.item_code = item_code\n\n\tdef get_i"
  },
  {
    "path": "webshop/webshop/variant_selector/test_variant_selector.py",
    "chars": 4241,
    "preview": "import frappe\nfrom frappe.tests.utils import FrappeTestCase\n\nfrom erpnext.controllers.item_variant import create_variant"
  },
  {
    "path": "webshop/webshop/variant_selector/utils.py",
    "chars": 8265,
    "preview": "import frappe\nfrom frappe.utils import cint, flt\n\nfrom webshop.webshop.doctype.webshop_settings.webshop_settings import "
  },
  {
    "path": "webshop/webshop/web_template/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/web_template/hero_slider/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/web_template/hero_slider/hero_slider.html",
    "chars": 3377,
    "preview": "{%- macro slide(image, title, subtitle, action, label, index, align=\"Left\", theme=\"Dark\") -%}\n{%- set align_class = reso"
  },
  {
    "path": "webshop/webshop/web_template/hero_slider/hero_slider.json",
    "chars": 5437,
    "preview": "{\n \"__unsaved\": 1,\n \"creation\": \"2020-11-17 15:21:51.207221\",\n \"docstatus\": 0,\n \"doctype\": \"Web Template\",\n \"fields\": [\n"
  },
  {
    "path": "webshop/webshop/web_template/item_card_group/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/web_template/item_card_group/item_card_group.html",
    "chars": 1070,
    "preview": "{% from \"webshop/templates/includes/macros.html\" import item_card, item_card_body %}\n\n<div class=\"section-with-cards ite"
  },
  {
    "path": "webshop/webshop/web_template/item_card_group/item_card_group.json",
    "chars": 4920,
    "preview": "{\n \"__unsaved\": 1,\n \"creation\": \"2020-11-17 15:35:05.285322\",\n \"docstatus\": 0,\n \"doctype\": \"Web Template\",\n \"fields\": [\n"
  },
  {
    "path": "webshop/webshop/web_template/product_card/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/web_template/product_card/product_card.html",
    "chars": 434,
    "preview": "{%- from \"webshop/templates/includes/macros.html\" import item_card -%}\n\n<div class=\"section-with-cards item-card-group-s"
  },
  {
    "path": "webshop/webshop/web_template/product_card/product_card.json",
    "chars": 576,
    "preview": "{\n \"__unsaved\": 1,\n \"creation\": \"2020-11-17 15:28:47.809342\",\n \"docstatus\": 0,\n \"doctype\": \"Web Template\",\n \"fields\": [\n"
  },
  {
    "path": "webshop/webshop/web_template/product_category_cards/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/webshop/web_template/product_category_cards/product_category_cards.html",
    "chars": 1374,
    "preview": "{%- macro card(title, image, url, text_primary=False) -%}\n{%- set align_class = resolve_class({\n\t'text-right': text_prim"
  },
  {
    "path": "webshop/webshop/web_template/product_category_cards/product_category_cards.json",
    "chars": 1577,
    "preview": "{\n \"__unsaved\": 1,\n \"creation\": \"2020-11-17 15:25:50.855934\",\n \"docstatus\": 0,\n \"doctype\": \"Web Template\",\n \"fields\": [\n"
  },
  {
    "path": "webshop/www/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/www/all-products/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/www/all-products/index.html",
    "chars": 1598,
    "preview": "{% from \"webshop/templates/includes/macros.html\" import attribute_filter_section, field_filter_section, discount_range_f"
  },
  {
    "path": "webshop/www/all-products/index.js",
    "chars": 654,
    "preview": "$(() => {\n\tclass ProductListing {\n\t\tconstructor() {\n\t\t\tlet me = this;\n\t\t\tlet is_item_group_page = $(\".item-group-content"
  },
  {
    "path": "webshop/www/all-products/index.py",
    "chars": 591,
    "preview": "import frappe\nfrom frappe.utils import cint\n\nfrom webshop.webshop.product_data_engine.filters import ProductFiltersBuild"
  },
  {
    "path": "webshop/www/all-products/not_found.html",
    "chars": 93,
    "preview": "<div class=\"d-flex justify-content-center p-3 text-muted\">{{ _('No products found') }}</div>\n"
  },
  {
    "path": "webshop/www/shop-by-category/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "webshop/www/shop-by-category/category_card_section.html",
    "chars": 919,
    "preview": "{%- macro card(title, image, type, url=None, text_primary=False) -%}\n<!-- style defined at shop-by-category index -->\n<d"
  },
  {
    "path": "webshop/www/shop-by-category/index.html",
    "chars": 952,
    "preview": "{% extends \"templates/web.html\" %}\n{% block title %}{{ _('Shop by Category') }}{% endblock %}\n\n{% block head_include %}\n"
  },
  {
    "path": "webshop/www/shop-by-category/index.js",
    "chars": 359,
    "preview": "$(() => {\n\t$('.category-card').on('click', (e) => {\n\t\tlet category_type = e.currentTarget.dataset.type;\n\t\tlet category_n"
  },
  {
    "path": "webshop/www/shop-by-category/index.py",
    "chars": 3030,
    "preview": "import frappe\nfrom frappe import _\n\nsitemap = 1\n\n\ndef get_context(context):\n\tcontext.body_class = \"product-page\"\n\n\tsetti"
  }
]

About this extraction

This page contains the full source code of the frappe/webshop GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 178 files (478.3 KB), approximately 136.8k tokens, and a symbol index with 442 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!