diff --git a/website_featured_products/__init__.py b/website_featured_products/__init__.py new file mode 100644 index 000000000..709b425a2 --- /dev/null +++ b/website_featured_products/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions +# 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 . +# +############################################################################## +import controllers +import models diff --git a/website_featured_products/__manifest__.py b/website_featured_products/__manifest__.py new file mode 100644 index 000000000..080ea9205 --- /dev/null +++ b/website_featured_products/__manifest__.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-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': "E-commerce Featured Products", + 'version': '10.0.1.0.0', + 'summary': """e-commerce Featured Products""", + 'description': """Odoo e-commerce Featured Products.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': "https://cybrosys.com/", + 'category': 'eCommerce', + 'depends': ['base', + 'website_sale', + 'rating', + ], + 'data': [ + 'security/ir.model.access.csv', + 'views/assets.xml', + 'views/views.xml', + 'views/template.xml', + ], + 'demo': [], + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'application': True +} diff --git a/website_featured_products/controllers/__init__.py b/website_featured_products/controllers/__init__.py new file mode 100644 index 000000000..89fdd3945 --- /dev/null +++ b/website_featured_products/controllers/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions +# 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 . +# +############################################################################## +import main diff --git a/website_featured_products/controllers/main.py b/website_featured_products/controllers/main.py new file mode 100644 index 000000000..456b634bf --- /dev/null +++ b/website_featured_products/controllers/main.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions +# 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 odoo import http +from odoo.http import request +from odoo.addons.website_sale.controllers import main + + +class WebsiteSaleExtend(main.WebsiteSale): + @http.route([ + '/shop', + '/shop/page/', + '/shop/category/', + '/shop/category//page/' + ], type='http', auth="public", website=True) + def shop(self, page=0, category=None, search='', ppg=False, **post): + """ + Overrided function to update the response with featured products objects.Here we are updating qcontext. + :param page: + :param category: + :param search: + :param ppg: + :param post: + :return: + """ + response = super(WebsiteSaleExtend, self).shop(page=0, category=None, search='', ppg=False, **post) + env = request.env + published_list_ids = env['product.featured'].sudo().search([('website_published', '=', True)]).ids + featured_products = env['product.featured.relation'].sudo().search([('featured_rel', 'in', published_list_ids)]) + response.qcontext.update({ + 'featured_products': featured_products, + }) + return response diff --git a/website_featured_products/models/__init__.py b/website_featured_products/models/__init__.py new file mode 100644 index 000000000..0018be8aa --- /dev/null +++ b/website_featured_products/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions +# 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 . +# +############################################################################## +import model diff --git a/website_featured_products/models/model.py b/website_featured_products/models/model.py new file mode 100644 index 000000000..76c1f71bc --- /dev/null +++ b/website_featured_products/models/model.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions +# 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 odoo import models, fields, _ + + +class FeaturedProducts(models.Model): + _name = 'product.featured.relation' + _description = 'Related Model for product_featured table' + + product = fields.Many2one('product.template') + featured_rel = fields.Many2one('product.featured') + + +class WebsiteProductFeatured(models.Model): + _name = 'product.featured' + _inherit = ['website.published.mixin', 'mail.thread', 'ir.needaction_mixin'] + _description = 'Basic model for featured products records' + + name = fields.Char(string="Name") + website_published = fields.Boolean(string='Available on the Website', copy=False, default=False) + featured_list = fields.One2many("product.featured.relation", "featured_rel", string="Featured List") + user_id = fields.Many2one('res.users', string="Person Responsible", track_visibility='onchange', + default=lambda self: self.env.uid) diff --git a/website_featured_products/readme.md b/website_featured_products/readme.md new file mode 100644 index 000000000..ac674584d --- /dev/null +++ b/website_featured_products/readme.md @@ -0,0 +1,35 @@ +# Ecommerce Featured Products + +Ecommerce Featured Products is an odoo e-commerse based addon, which Extends the products view by +including the featured products as an automatic slider. + + - E-commerce Featured Products + - Automatic Slider with product ratings + - Configure featured products under website admin menu + - Can be manage as different collections of featured products + - Publish or Unpublish records on website + - Adapted slick.js library for Automatic slider http://kenwheeler.github.io/slick + +### Depends +Ecommerce Featured Products addon depends on Odoo website_sale, rating +### Tech + +* [jQuery] - slick.js v1.6.0 The MIT License (MIT) Copyright (c) 2013-2016 by Ken Wheeler, http://kenwheeler.github.io/slick +* [Python] - Models, Controllers +* [XML] - Odoo website templates + +### Installation +- www.odoo.com/documentation/10.0/setup/install.html +- Install our custom addon, which also installs its depends [rating, website_sale] + +### Usage +> Goto Website Admin - select submenu Featured Products +> Configure Each collections of Featured Products and make publish. + +License +---- +GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (LGPLv3) +(http://www.gnu.org/licenses/agpl.html) + + + diff --git a/website_featured_products/security/ir.model.access.csv b/website_featured_products/security/ir.model.access.csv new file mode 100644 index 000000000..1055e1851 --- /dev/null +++ b/website_featured_products/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_product_featured_relation,Access Product Featured Relation,model_product_featured_relation,,1,1,1,0 +access_product_featured,Access Product Featured,model_product_featured,,1,1,1,0 \ No newline at end of file diff --git a/website_featured_products/static/description/backend.png b/website_featured_products/static/description/backend.png new file mode 100644 index 000000000..98ac767f2 Binary files /dev/null and b/website_featured_products/static/description/backend.png differ diff --git a/website_featured_products/static/description/banner.jpg b/website_featured_products/static/description/banner.jpg new file mode 100644 index 000000000..9542b3f7a Binary files /dev/null and b/website_featured_products/static/description/banner.jpg differ diff --git a/website_featured_products/static/description/cybro_logo.png b/website_featured_products/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/website_featured_products/static/description/cybro_logo.png differ diff --git a/website_featured_products/static/description/hover.png b/website_featured_products/static/description/hover.png new file mode 100644 index 000000000..4e0197848 Binary files /dev/null and b/website_featured_products/static/description/hover.png differ diff --git a/website_featured_products/static/description/icon.png b/website_featured_products/static/description/icon.png new file mode 100644 index 000000000..b16054562 Binary files /dev/null and b/website_featured_products/static/description/icon.png differ diff --git a/website_featured_products/static/description/index.html b/website_featured_products/static/description/index.html new file mode 100644 index 000000000..c4a0dd020 --- /dev/null +++ b/website_featured_products/static/description/index.html @@ -0,0 +1,128 @@ +
+

E-commerce Featured Products

+

Author : Cybrosys Techno Solutions , www.cybrosys.com

+
+ +
+
+

Automatic slider for featured products on E-commerce product page

+

+ Responsive and with product ratings. +

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

Need Any Help?

+ +
+ diff --git a/website_featured_products/static/description/publish.png b/website_featured_products/static/description/publish.png new file mode 100644 index 000000000..970e5afaa Binary files /dev/null and b/website_featured_products/static/description/publish.png differ diff --git a/website_featured_products/static/description/shop_preview.png b/website_featured_products/static/description/shop_preview.png new file mode 100644 index 000000000..ad7859a37 Binary files /dev/null and b/website_featured_products/static/description/shop_preview.png differ diff --git a/website_featured_products/static/description/unpublished.png b/website_featured_products/static/description/unpublished.png new file mode 100644 index 000000000..cd4158e68 Binary files /dev/null and b/website_featured_products/static/description/unpublished.png differ diff --git a/website_featured_products/static/src/css/Style.css b/website_featured_products/static/src/css/Style.css new file mode 100644 index 000000000..7a20f83f5 --- /dev/null +++ b/website_featured_products/static/src/css/Style.css @@ -0,0 +1,125 @@ +/* Slider */ +.slick-slider +{ + position: relative; + + display: block; + box-sizing: border-box; + + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + + -webkit-touch-callout: none; + -khtml-user-select: none; + -ms-touch-action: pan-y; + touch-action: pan-y; + -webkit-tap-highlight-color: transparent; +} + +.slick-list +{ + position: relative; + + display: block; + overflow: hidden; + + margin: 0; + padding: 0; +} +.slick-list:focus +{ + outline: none; +} +.slick-list.dragging +{ + cursor: pointer; + cursor: hand; +} + +.slick-slider .slick-track, +.slick-slider .slick-list +{ + -webkit-transform: translate3d(0, 0, 0); + -moz-transform: translate3d(0, 0, 0); + -ms-transform: translate3d(0, 0, 0); + -o-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); +} + +.slick-track +{ + position: relative; + top: 0; + left: 0; + + display: block; +} +.slick-track:before, +.slick-track:after +{ + display: table; + + content: ''; +} +.slick-track:after +{ + clear: both; +} +.slick-loading .slick-track +{ + visibility: hidden; +} + +.slick-slide +{ + display: none; + float: left; + + height: 100%; + min-height: 1px; +} +[dir='rtl'] .slick-slide +{ + float: right; +} +.slick-slide img +{ + display: block; + width:200px !important; + height:200px !important; +} +.slick-slide.slick-loading img +{ + display: none; +} +.slick-slide.dragging img +{ + pointer-events: none; +} +.slick-initialized .slick-slide +{ + display: block; +} +.slick-loading .slick-slide +{ + visibility: hidden; +} +.slick-vertical .slick-slide +{ + display: block; + + height: auto; + + border: 1px solid transparent; +} +.slick-arrow { + display: none; +} +.rating.hidden-sm.col-md-6 > .price-text-color.fa-star { + color: #fcc500; +} +.rating.hidden-sm.col-md-6 > .fa-star{ + color: #dddddb; +} \ No newline at end of file diff --git a/website_featured_products/static/src/js/featured_product.js b/website_featured_products/static/src/js/featured_product.js new file mode 100644 index 000000000..ba6213f79 --- /dev/null +++ b/website_featured_products/static/src/js/featured_product.js @@ -0,0 +1,12 @@ +$(document).on('ready', function() { + $(".center").slick({ + dots: false, + infinite: true, + slidesToShow: 5, + slidesToScroll: 1, + autoplay: true, + autoplaySpeed: 1000, + prevArrow: '', + nextArrow: '', + }); + }); \ No newline at end of file diff --git a/website_featured_products/views/assets.xml b/website_featured_products/views/assets.xml new file mode 100644 index 000000000..e66d0b0f4 --- /dev/null +++ b/website_featured_products/views/assets.xml @@ -0,0 +1,9 @@ + +