@ -0,0 +1,46 @@ |
|||||
|
E-commerce Advanced Search v10 |
||||
|
============================== |
||||
|
|
||||
|
* 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/10.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 <https://www.cybrosys.com> |
||||
|
|
||||
|
Author |
||||
|
------ |
||||
|
|
||||
|
Developer: Hilar AK @ cybrosys, hilar@cybrosys.in |
||||
|
|
||||
|
Maintainer |
||||
|
---------- |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit https://www.cybrosys.com. |
@ -0,0 +1,25 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Hilar AK(<hilar@cybrosys.in>) |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
from . import controllers |
||||
|
|
@ -0,0 +1,48 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Hilar AK(<hilar@cybrosys.in>) |
||||
|
# 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 <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
|
||||
|
{ |
||||
|
'name': "Advanced Search in ECommerce ", |
||||
|
'version': '10.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, |
||||
|
} |
@ -0,0 +1,3 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
|
||||
|
from . import main |
@ -0,0 +1,32 @@ |
|||||
|
# -*- 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 [] |
||||
|
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) |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 275 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,101 @@ |
|||||
|
<section class="oe_container oe_dark"> |
||||
|
<h2 class="oe_slogan" style="margin-top:20px;" >E-commerce Search Advanced</h2> |
||||
|
</section> |
||||
|
|
||||
|
<div class="oe_container"> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-12"> |
||||
|
<div class="carousel slide" id="carousel-71641"> |
||||
|
<ol class="carousel-indicators"> |
||||
|
<li data-slide-to="0" data-target="#carousel-71641" style="border: 1px solid #ff1313 !important;"> |
||||
|
</li> |
||||
|
<li data-slide-to="1" data-target="#carousel-71641" class="active" style="border: 1px solid #ff1313 !important;"> |
||||
|
</li> |
||||
|
<li data-slide-to="2" data-target="#carousel-71641" style="border: 1px solid #ff1313 !important;"> |
||||
|
</li> |
||||
|
<li data-slide-to="3" data-target="#carousel-71641" style="border: 1px solid #ff1313 !important;"> |
||||
|
</li> |
||||
|
</ol> |
||||
|
<div class="carousel-inner"> |
||||
|
<div class="item"> |
||||
|
<img alt="Carousel Bootstrap First" src="categories.png"> |
||||
|
<div class="carousel-caption"> |
||||
|
<h4 style="color:red"> |
||||
|
Product Categories On Search |
||||
|
</h4> |
||||
|
<p style="color:red"> |
||||
|
Lists all categories as a dropdown |
||||
|
|
||||
|
</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="item active"> |
||||
|
<img alt="Carousel Bootstrap Second" src="search_occurance.png"> |
||||
|
<div class="carousel-caption"> |
||||
|
<h4 style="color:red"> |
||||
|
Listing of results while searching by category |
||||
|
</h4> |
||||
|
<p style="color:red"> |
||||
|
Enabled auto complete on e-commerce search, fetches all related products according to the name and selected categories. |
||||
|
</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<img alt="Carousel Bootstrap Third" src="screen2.png"> |
||||
|
<div class="carousel-caption"> |
||||
|
<h4 style="color:red"> |
||||
|
Listing of results for category 'All' |
||||
|
</h4> |
||||
|
<p style="color:red"> |
||||
|
Enabled auto complete on e-commerce search, fetches all related products according to the name and selected categories. |
||||
|
</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<img alt="Carousel Bootstrap Fourth" src="screen3.png"> |
||||
|
<div class="carousel-caption"> |
||||
|
<h4 style="color:red"> |
||||
|
Product page preview. |
||||
|
</h4> |
||||
|
<p style="color:red"> |
||||
|
Preview after clicking on the occurences. |
||||
|
</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> <a style="padding-top: 250px;color: red;" class="left carousel-control" href="#carousel-71641" data-slide="prev"><span class="fa fa-chevron-left" aria-hidden="true"></span></a> <a style="padding-top: 250px;color: red;" class="right carousel-control" href="#carousel-71641" data-slide="next"><span class="fa fa-chevron-right" aria-hidden="true"></span></a> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<section class="oe_container"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<h2 class="oe_slogan">E-commerce Advanced Search</h2> |
||||
|
<h3 class="oe_slogan">Gives search results as dropdown while typing on search bar.</h3> |
||||
|
<div> |
||||
|
<h4><p>Features:</p></h4> |
||||
|
<ul> |
||||
|
<li>E-commerce product search</li> |
||||
|
<li>Can Select Category</li> |
||||
|
<li>New dropdown with product website categories</li> |
||||
|
<li>Find all products related to searching content according to category selected</li> |
||||
|
<li>Display results as dropdown</li> |
||||
|
<li>Selection of results redirects to product description page</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
<section class="oe_container oe_dark"> |
||||
|
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
||||
|
<div class="oe_slogan" style="margin-top:10px !important;"> |
||||
|
<a class="btn btn-primary btn-lg mt8" |
||||
|
style="color: #FFFFFF !important;border-radius: 0;" href="http://www.cybrosys.com"><i |
||||
|
class="fa fa-envelope"></i> Email </a> <a |
||||
|
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
||||
|
href="http://www.cybrosys.com/contact/"><i |
||||
|
class="fa fa-phone"></i> Contact Us </a> <a |
||||
|
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
||||
|
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i |
||||
|
class="fa fa-check-square"></i> Request Customization </a> |
||||
|
</div> |
||||
|
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
||||
|
</section> |
After Width: | Height: | Size: 241 KiB |
After Width: | Height: | Size: 233 KiB |
After Width: | Height: | Size: 234 KiB |
@ -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 |
||||
|
}); |
||||
|
}); |
||||
|
}); |
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
|
||||
|
<template id="website_sale_advanced_search.assets_frontend" inherit_id="website.assets_frontend" name="Product Search"> |
||||
|
<xpath expr="." position="inside"> |
||||
|
<script type="text/javascript" src="/website_sale_advanced_search/static/js/product_search.js"></script> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,32 @@ |
|||||
|
<odoo> |
||||
|
|
||||
|
<template id="website_advanced_search" name="Ecommerce Advanced Search"> |
||||
|
<div class="input-group"> |
||||
|
<div class="input-group-btn search-panel"> |
||||
|
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> |
||||
|
<span id="search_concept">Filter by</span> <span class="caret"></span> |
||||
|
</button> |
||||
|
<ul class="dropdown-menu" role="menu"> |
||||
|
<t t-foreach="categories" t-as="c_ids"> |
||||
|
<li><a t-att-href="'#'+str(c_ids.id)"><span t-esc="c_ids.name"/></a></li> |
||||
|
</t> |
||||
|
<li class="divider"></li> |
||||
|
<li><a href="#all">All</a></li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
<input type="hidden" name="search_param" value="all" id="search_param"/> |
||||
|
<div class="oe_search"> |
||||
|
<input type="text" name="search" class="search-query form-control oe_search_box" placeholder="Search..." t-att-value="search" /> |
||||
|
</div> |
||||
|
<span class="input-group-btn"> |
||||
|
<button type="submit" class="btn btn-default oe_search_button"><i class="fa fa-search"/></button> |
||||
|
</span> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<template id="website_sale_custom_search" inherit_id="website_sale.search"> |
||||
|
<xpath position="replace" expr="//t[@t-call='website.website_search_box']"> |
||||
|
<t t-call="website_sale_advanced_search.website_advanced_search"/> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
</odoo> |