Browse Source

[ADD] Initial Commit

pull/29/head
SHEREEF PT 8 years ago
parent
commit
4ddf920b3c
  1. 2
      website_sale_product_quick_view/__init__.py
  2. 48
      website_sale_product_quick_view/__manifest__.py
  3. 2
      website_sale_product_quick_view/controllers/__init__.py
  4. 29
      website_sale_product_quick_view/controllers/main.py
  5. 32
      website_sale_product_quick_view/readme.md
  6. BIN
      website_sale_product_quick_view/static/description/banner.jpg
  7. BIN
      website_sale_product_quick_view/static/description/cybro_logo.png
  8. BIN
      website_sale_product_quick_view/static/description/icon.png
  9. 77
      website_sale_product_quick_view/static/description/index.html
  10. BIN
      website_sale_product_quick_view/static/description/product view.png
  11. BIN
      website_sale_product_quick_view/static/description/quick view.png
  12. 9
      website_sale_product_quick_view/static/src/css/style.css
  13. 7
      website_sale_product_quick_view/views/assets.xml
  14. 109
      website_sale_product_quick_view/views/template.xml

2
website_sale_product_quick_view/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import controllers

48
website_sale_product_quick_view/__manifest__.py

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://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': "E-commerce Product Quick View",
'version': '10.0.1.0.0',
'summary': """E-commerce Product Quick View.""",
'description': """E-commerce Product Quick View.""",
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'website': "https://cybrosys.com",
'category': 'eCommerce',
'depends': ['base',
'website_sale',
'website_mail',
'rating',
],
'data': [
# 'security/ir.model.access.csv',
'views/assets.xml',
'views/template.xml',
],
'demo': [],
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'installable': True,
'application': True
}

2
website_sale_product_quick_view/controllers/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import main

29
website_sale_product_quick_view/controllers/main.py

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
from odoo import http
from odoo.addons.website_sale.controllers import main
class WebsiteSaleExtend(main.WebsiteSale):
@http.route([
'/shop',
'/shop/page/<int:page>',
'/shop/category/<model("product.public.category"):category>',
'/shop/category/<model("product.public.category"):category>/page/<int: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 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)
response.qcontext.update({
'get_attribute_value_ids': self.get_attribute_value_ids,
'rating_status': response.qcontext.get('rating_product'),
})
return response

32
website_sale_product_quick_view/readme.md

@ -0,0 +1,32 @@
# Ecommerce Product Quick View
Ecommerce Product Quick View is an odoo e-commerse based addon, which Extends the products view by
including the wizard which shows the quick informations about the products.
- E-commerce Product Quick View.
- Button to open the quick view.
- Click the quick view button on product form to open wizard.
- product rating on quick view.
- Alternative Products on Quick View page.
### Depends
Ecommerce Product Quick View addon depends on Odoo website_sale, rating
### Tech
* [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 Shop page -> click on quick view button
License
----
GNU LESSER GENERAL PUBLIC LICENSE, Version 3 (LGPLv3)
(http://www.gnu.org/licenses/agpl.html)

BIN
website_sale_product_quick_view/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

BIN
website_sale_product_quick_view/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
website_sale_product_quick_view/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

77
website_sale_product_quick_view/static/description/index.html

@ -0,0 +1,77 @@
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">E-commerce Product Quick View</h2>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a></h4>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan" style="color:#875A7B;">Product Quick View button E-commerce product page</h2>
<h3 class="oe_slogan">
Responsive and with product ratings.
</h3>
</div>
<div class="oe_container oe_dark">
<div class="row mt32 o_animate o_animate_in_children o_animate_offset_min"
style="animation-name: none; visibility: hidden; animation-play-state: paused;">
<div class="col-md-5 col-md-offset-1" style="transition-delay: 0ms;">
<h2 class=" mt32 mb16"><b>Quick View Button on product page.</b></h2>
</div>
<div class="col-md-6" style="transition-delay: 500ms;">
<div class=" oe_demo oe_picture oe_screenshot">
<img style="max-width: 100%;-moz-transform: scale(1.2);-webkit-transform: scale(1.2); -o-transform: scale(1.2); -ms-transform: scale(1.2); transform: scale(1.2);"
src="product view.png">
</div>
</div>
</div>
</div>
<div class="oe_container">
<div class="row mt32 o_animate o_animate_in_children o_animate_offset_min"
style="animation-name: none; visibility: hidden; animation-play-state: paused;">
<div class="col-md-5 col-md-offset-1" style="transition-delay: 0ms;">
<h2 class=" mt32 mb16"><b>Quick View Wizard with product information, Including Alternative Products.</b></h2>
</div>
<div class="col-md-6" style="transition-delay: 500ms;">
<div class=" oe_demo oe_picture oe_screenshot">
<img style="max-width: 100%;-moz-transform: scale(1.2);-webkit-transform: scale(1.2); -o-transform: scale(1.2); -ms-transform: scale(1.2); transform: scale(1.2);"
src="quick view.png">
</div>
</div>
</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;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://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="https://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="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
website_sale_product_quick_view/static/description/product view.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

BIN
website_sale_product_quick_view/static/description/quick view.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

9
website_sale_product_quick_view/static/src/css/style.css

@ -0,0 +1,9 @@
.product_view .modal-dialog{max-width: 800px; width: 100%;}
.pre-cost{text-decoration: line-through; color: #a5a5a5;}
.space-ten{padding: 10px 0;}
.rating.hidden-sm.rating_ext > .price-text-color.fa-star {
color: #fcc500;
}
.rating.hidden-sm.rating_ext > .fa-star{
color: #dddddb;
}

7
website_sale_product_quick_view/views/assets.xml

@ -0,0 +1,7 @@
<odoo>
<template id="assets_frontend" inherit_id="website.assets_frontend" name="Assets For Products Quick View">
<xpath expr="." position="inside">
<link href="/website_sale_product_quick_view/static/src/css/style.css" rel="stylesheet" type="text/css"/>
</xpath>
</template>
</odoo>

109
website_sale_product_quick_view/views/template.xml

@ -0,0 +1,109 @@
<odoo>
<template id="product_extended_view" inherit_id="website_sale.products">
<xpath expr="//t[@t-call='website.layout']" position="inside">
<t t-foreach="products" t-as="product">
<div class="modal fade product_view" t-att-id="'product_view'+str(product.id)">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<a href="#" data-dismiss="modal" class="class pull-right"><span class="fa fa-close"></span></a>
<h3 class="modal-title"><span t-field="product.name"/></h3>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6 product_img">
<img t-att-src="'data:image/png;base64,'+product.image if product.image else ''"
class="img-responsive" />
</div>
<div class="col-md-6 product_content">
<div class="col-sm-12 col-lg-12" id="product_details">
<h4>Product Id: <span t-esc="product.default_code"></span></h4><br/>
<div class="rating hidden-sm rating_ext">
<t t-set="rating" t-value="0"/>
<t t-set="count" t-value="0"/>
<t t-foreach="request.env['rating.rating'].sudo().search([('res_id', '=', product.id)])" t-as="r">
<t t-set="rating" t-value="rating + r.rating"/>
<t t-set="count" t-value="count + 1"/>
</t>
<i t-att-class="'fa fa-star' + ' price-text-color' if rating and rating/count > 0 else 'fa fa-star'"/>
<i t-att-class="'fa fa-star' + ' price-text-color' if rating and rating/count > 1 else 'fa fa-star'"/>
<i t-att-class="'fa fa-star' + ' price-text-color' if rating and rating/count > 2 else 'fa fa-star'"/>
<i t-att-class="'fa fa-star' + ' price-text-color' if rating and rating/count > 3 else 'fa fa-star'"/>
<i t-att-class="'fa fa-star' + ' price-text-color' if rating and rating/count > 4 else 'fa fa-star'"/>
</div>
<h3 itemprop="name" t-field="product.name">Product Name</h3>
<span itemprop="url" style="display:none;" t-esc="'/shop/product/%s' % slug(product)" />
<t t-call="website_sale.product_price" />
<p t-if="len(product.product_variant_ids) &gt; 1" class="css_not_available_msg bg-danger" style="padding: 15px;">Product not available</p>
<a id="add_to_cart" class="btn btn-primary btn-lg mt8 js_check_product a-submit" t-att-href="'/shop/product/%s' % (slug(product))">Add to Cart</a>
<div t-if="product.availability == 'in_stock'" class="alert alert-success">
<span class="fa fa-check" />
<span>In Stock</span>
</div>
<div t-if="product.availability == 'warning'" class="alert alert-warning">
<span class="fa fa-warning" />
<span t-field="product.availability_warning" />
</div>
<hr t-if="product.description_sale" />
<div>
<p t-field="product.description_sale" class="text-muted" />
</div>
<hr />
<p class="text-muted">
30-day money-back guarantee<br />
Free Shipping in U.S.<br />
Buy now, get in 2 days
</p>
</div>
</div>
</div>
<div class="container mt32" t-if="product.alternative_product_ids">
<h3>Alternative Products:</h3>
<div class="row mt16" style="">
<t t-foreach="product.alternative_product_ids" t-as="alt_product">
<div class="col-md-2 thumbnail" style="width: 170px; height:130px; float:left; display:inline; margin-right: 10px; overflow:hidden;">
<div class="mt16 text-center" style="height: 100%;">
<div t-field="alt_product.image_small" t-options="{'widget': 'image', 'class': 'img-rounded shadow o_alternative_product' }" />
<h5>
<a t-attf-href="/shop/product/#{ slug(alt_product) }" style="display: block">
<span t-att-title="alt_product.name" t-field="alt_product.name" style="display: block;" />
</a>
</h5>
</div>
</div>
</t>
</div>
</div>
<t t-set="head">
<!-- Facebook and linkedin sharing data -->
<meta property="og:type" content="website" />
<meta property="og:url" t-att-content="request.httprequest.url" />
<meta property="og:image" t-attf-content="#{request.httprequest.url_root}web/image/product.template/#{product.id}/image" />
<meta property="og:description" t-att-content="product.description_sale" />
<!-- Twitter sharing data -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" t-attf-content="@#{res_company.name}" />
<meta name="twitter:title" t-att-content="product.name" />
<meta name="twitter:description" t-att-content="product.description_sale" />
<meta name="twitter:image" t-attf-content="#{request.httprequest.url_root}web/image/product.template/#{product.id}/image" />
</t>
</div>
</div>
</div>
</div>
</t>
</xpath>
</template>
<template id="products_item_extended" inherit_id="website_sale.products_item">
<xpath expr="//div[@class='product_price']" position="inside">
<button type="button" class="btn btn-xs"
data-toggle="modal"
style="background: transparent;"
t-att-data-target="'#product_view'+str(product.id)">
<i class="fa fa-search-plus" style="color: #337ab7;"/>
</button>
</xpath>
</template>
</odoo>
Loading…
Cancel
Save