diff --git a/website_sale_advanced_search/README.rst b/website_sale_advanced_search/README.rst new file mode 100644 index 000000000..ec94577cf --- /dev/null +++ b/website_sale_advanced_search/README.rst @@ -0,0 +1,47 @@ +E-commerce Advanced Search v11 +============================== + +* E-commerce product search +* Can Select Category +* New drop down with product website categories +* Find all products related to searching content according to category selected +* Display results as drop down +* Selection of results redirects to product description page + +Depends +======= +[website] addon Odoo +[website_sale] addon Odoo + +Tech +==== +* [jQuery] - Search AutoComplete +* [Python] - Controllers +* [XML] - Odoo website templates + +Installation +============ +- www.odoo.com/documentation/11.0/setup/install.html +- Install our custom addon + + +Bug Tracker +=========== +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Credits +======= +* Cybrosys Techno Solutions + +Author +------ + +Developer: Hilar AK @ cybrosys, odoo@cybrosys.com +Developer: v11 Milind @ cybrosys + +Maintainer +---------- + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit https://www.cybrosys.com. diff --git a/website_sale_advanced_search/__init__.py b/website_sale_advanced_search/__init__.py new file mode 100644 index 000000000..e0412eff6 --- /dev/null +++ b/website_sale_advanced_search/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Hilar AK() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from . import controllers + diff --git a/website_sale_advanced_search/__manifest__.py b/website_sale_advanced_search/__manifest__.py new file mode 100644 index 000000000..df0076d46 --- /dev/null +++ b/website_sale_advanced_search/__manifest__.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2019-TODAY Cybrosys Technologies(). +# Author: Hilar AK() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +{ + 'name': "Advanced Search in E-commerce ", + 'version': '11.0.1.0.0', + 'summary': """E-commerce Advanced Search.""", + 'description': """ + Odoo e-commerce advanced search. Autocomplete search product with category and display name + """, + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'category': 'eCommerce', + 'depends': ['base', + 'website', + 'website_sale', + ], + 'data': [ + 'views/assets.xml', + 'views/template.xml' + ], + 'demo': [], + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, +} diff --git a/website_sale_advanced_search/controllers/__init__.py b/website_sale_advanced_search/controllers/__init__.py new file mode 100644 index 000000000..65a8c1201 --- /dev/null +++ b/website_sale_advanced_search/controllers/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import main diff --git a/website_sale_advanced_search/controllers/main.py b/website_sale_advanced_search/controllers/main.py new file mode 100644 index 000000000..28378489d --- /dev/null +++ b/website_sale_advanced_search/controllers/main.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +import json +from odoo import http +from odoo.http import request + + +class WebsiteSearch(http.Controller): + + @http.route('/shop/search', csrf=False, type="http", methods=['POST', 'GET'], auth="public", website=True) + def search_contents(self, **kw): + """ + Searches products according to the category selected on front, + :param kw: dict contains the category and search key + :return: Dict with params as name, res_id, value + """ + strings = '%' + kw.get('name') + '%' + category = int(kw.get('category')) if not kw.get('category') == 'all' else '' + try: + domain = [('public_categ_ids', 'child_of', [category])] if category else [] + domain.append(('website_published','=', True)) + product_as_category = request.env['product.template'].search(domain) + sql = """select id as res_id, name as name, name as value from product_template where name ILIKE %s""" + extra_query = '' + if product_as_category: + extra_query = " and id in %s" + limit = " limit 15" + request.cr.execute(sql+extra_query+limit,\ + (tuple([strings]), tuple(product_as_category and product_as_category.ids))) + name = request.cr.dictfetchall() + except: + name = {'name': 'None', 'value': 'None'} + return json.dumps(name) diff --git a/website_sale_advanced_search/doc/RELEASE_NOTES.md b/website_sale_advanced_search/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..7c46144a0 --- /dev/null +++ b/website_sale_advanced_search/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 09.05.2019 +#### Version 11.0.1.0.0 +##### ADD +- Initial Commit for E-commerce Advanced Search diff --git a/website_sale_advanced_search/static/description/advanced-search-in-ecommerce1.png b/website_sale_advanced_search/static/description/advanced-search-in-ecommerce1.png new file mode 100644 index 000000000..7aaad0594 Binary files /dev/null and b/website_sale_advanced_search/static/description/advanced-search-in-ecommerce1.png differ diff --git a/website_sale_advanced_search/static/description/advanced-search-in-ecommerce2.png b/website_sale_advanced_search/static/description/advanced-search-in-ecommerce2.png new file mode 100644 index 000000000..c9f8f1e27 Binary files /dev/null and b/website_sale_advanced_search/static/description/advanced-search-in-ecommerce2.png differ diff --git a/website_sale_advanced_search/static/description/advanced-search-in-ecommerce3.png b/website_sale_advanced_search/static/description/advanced-search-in-ecommerce3.png new file mode 100644 index 000000000..a79f2de7d Binary files /dev/null and b/website_sale_advanced_search/static/description/advanced-search-in-ecommerce3.png differ diff --git a/website_sale_advanced_search/static/description/banner.jpg b/website_sale_advanced_search/static/description/banner.jpg new file mode 100644 index 000000000..ec8264c0b Binary files /dev/null and b/website_sale_advanced_search/static/description/banner.jpg differ diff --git a/website_sale_advanced_search/static/description/cybro_logo.png b/website_sale_advanced_search/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/website_sale_advanced_search/static/description/cybro_logo.png differ diff --git a/website_sale_advanced_search/static/description/icon.png b/website_sale_advanced_search/static/description/icon.png new file mode 100644 index 000000000..ec2597cd4 Binary files /dev/null and b/website_sale_advanced_search/static/description/icon.png differ diff --git a/website_sale_advanced_search/static/description/index.html b/website_sale_advanced_search/static/description/index.html new file mode 100644 index 000000000..f6c946b56 --- /dev/null +++ b/website_sale_advanced_search/static/description/index.html @@ -0,0 +1,365 @@ +
+
+

+ Advanced Search in ECommerce +

+

+ Gives search results as dropdown while typing on e-commerce search bar. +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies +
+
+
+
+ +
+
+

+ Overview +

+

+ This module makes searching of products in e-commerce easier by providing + results as drop down while typing on search bar. +

+

+ Configuration +

+

+ No additional configuration required. +

+
+
+ +
+
+

+ Features +

+

+ + E-commerce product search. +

+

+ + Can Select Category +

+

+ + New drop down with product website categories. +

+

+ + Find all products related to searching content according to the category selected. +

+

+ + Display results as dropdown. +

+

+ + Selection of results redirects to the product description page. +

+
+
+ +
+
+

+ Screenshots +

+

+ + Lists all categories as drop down. +

+
+ +
+

+ + Listing of results for category 'All' as a drop down. +

+
+ +
+

+ + Product page preview. +

+
+ +
+ +
+
+
+
+ cybrosys technologies +
+
+
+
+

+ Our Services +

+
+ + + +
+ +
+ + + +
+

+ + Odoo Support +

+ +
+ +
+
+
+
+
+

+ Our Industries +

+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+
+ +
+ + diff --git a/website_sale_advanced_search/static/js/product_search.js b/website_sale_advanced_search/static/js/product_search.js new file mode 100644 index 000000000..c50b8c067 --- /dev/null +++ b/website_sale_advanced_search/static/js/product_search.js @@ -0,0 +1,45 @@ +odoo.define('website_sale_advanced_search.product_search', function (require) { +"use strict"; +var ajax = require('web.ajax'); +var core = require('web.core'); +var session = require('web.session'); +var base = require('web_editor.base'); +var _t = core._t; +base.url_translations = '/website/translations'; +var _t = core._t; +$(function() { + $('.search-panel .dropdown-menu').find('a').click(function(e) { + e.preventDefault(); + var param = $(this).attr("href").replace("#",""); + var concept = $(this).text(); + $('.search-panel span#search_concept').text(concept); + $('.input-group #search_param').val(param); + }); + $(".oe_search_box").autocomplete({ + source: function(request, response) { + $.ajax({ + url: "/shop/search", + method: "POST", + dataType: "json", + data: { name: request.term, category: $('.input-group #search_param').val()}, + success: function( data ) { + response( $.map( data, function( item ) { + return { + label: item.name, + value: item.name, + id: item.res_id, + } + })); + }, + error: function (error) { + alert('error: ' + error); + } + }); + }, + select:function(suggestion,term,item){ + window.location.href= "/shop/product/"+term.item.id + }, + minLength: 1 + }); +}); +}); \ No newline at end of file diff --git a/website_sale_advanced_search/views/assets.xml b/website_sale_advanced_search/views/assets.xml new file mode 100644 index 000000000..05c5a3747 --- /dev/null +++ b/website_sale_advanced_search/views/assets.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/website_sale_advanced_search/views/template.xml b/website_sale_advanced_search/views/template.xml new file mode 100644 index 000000000..a1b7237aa --- /dev/null +++ b/website_sale_advanced_search/views/template.xml @@ -0,0 +1,32 @@ + + + + + + \ No newline at end of file