-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commited last changed, separated the initial module into two modules(…
…runex_apps_3_0 & runex_add_to_cart_view), dropodown cartview and modal product view improved.
- Loading branch information
Showing
11 changed files
with
450 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
### Runex Add to CartView ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# coding: utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Odoo, Open Source Management Solution | ||
# Copyright (C) 2016-TODAY Linserv Aktiebolag, Sweden (<http://www.linserv.se>). | ||
# | ||
# | ||
############################################################################## | ||
{ | ||
'name': 'Runex Add to CartView', | ||
'version': '1.0', | ||
'author': 'Linserv AB', | ||
'category': "Web", | ||
'website': 'www.linserv.se', | ||
'description': """Custom runex website views modifications to add quick view of a productTitle wihtout leave shop page and add dropdown view of cart""", | ||
'depends': ['website', 'website_sale'], | ||
'data': [ | ||
'views/templates.xml', | ||
'views/views_updates.xml', | ||
], | ||
'installable': True, | ||
'auto_install': False, | ||
} | ||
|
||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.prod_layer{ | ||
position: absolute; | ||
background: rgba(100, 100, 100, 0.3); | ||
width: 100%; | ||
height: 100%; | ||
z-index: 5; | ||
display: none; | ||
} | ||
.oe_product .oe_product_image{ | ||
left: 0px; | ||
right: 0px; | ||
top: 0px; | ||
bottom: 65px; | ||
} | ||
.btn_quickview{ | ||
position: relative; | ||
top: 38%; | ||
} | ||
|
||
#prodDescription{ | ||
|
||
color: #808183; | ||
font-size: 0.95em; | ||
font-style: italic; | ||
margin-top: 25px; | ||
} | ||
|
||
.dropdown_cart { | ||
display: none; | ||
position: absolute; | ||
background-color: #f1f1f1; | ||
color: black; | ||
width: 300%; | ||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); | ||
z-index: 1; | ||
} | ||
|
||
.dropdown_cart a { | ||
color: black; | ||
padding: 12px 16px; | ||
text-decoration: none; | ||
display: block; | ||
} | ||
|
||
|
||
#btn_cart:hover .dropdown_cart{ | ||
display: block; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// odoo.define('shop_quickview', function (require) { | ||
// "use strict"; | ||
|
||
// var ajax = require('web.ajax'); | ||
// var Model = require('web.Model'); | ||
$(document).ready(function () { | ||
|
||
$('.btn_quickview').click(function(e){ | ||
e.preventDefault() | ||
// var id = $(this).parents('.oe_product_image').find('span[itemprop="image"]').data('oe-id') | ||
var link = $(this).parents('.oe_product_cart').find('h5 a').attr('href') | ||
var product_id = $(this).parents('.product_price').find('input[name="product_id"]').attr('value') | ||
|
||
openerp.jsonRpc("/shop/get_product_data", "call", { | ||
'product_id' : parseInt(product_id) | ||
}).then(function (data){ | ||
// console.log(data); | ||
// var img = data.image | ||
var prodname = data.name | ||
// var product_id = String(data.id) | ||
$('#prodDetail').find('.img').attr('src','/website/image/product.product/' + product_id + '/image') | ||
// $('#prodDetail').find('.img').attr('src','/web/image/product.template/'+id+'/image/300x300') | ||
$('#product_id').val(data.variant_id) | ||
$('#productTitle').text(prodname) | ||
$('#productprice').text(data.price) | ||
$('#cart_products > tbody > tr > td.text-center > div > input').val(1); | ||
// $('#product-detail').attr('href',link) | ||
// $('#prodDescription').text(data.description_sale) | ||
if(data.number_of_variant > 1){ | ||
$('#product-detail').show() | ||
$('#add-cart-form').hide() | ||
}else{ | ||
$('#product-detail').hide() | ||
$('#add-cart-form').show() | ||
} | ||
$('#prodDetail').modal('show') | ||
}) | ||
}) | ||
|
||
$('.oe_product_image').on('mouseover',function(e){ | ||
$(this).find('.prod_layer').stop().slideDown('fast') | ||
|
||
}) | ||
|
||
$('.oe_product_image').on('mouseout',function(e){ | ||
$(this).find('.prod_layer').stop().slideUp() | ||
}) | ||
|
||
$('#add-cart-form').submit(function(e) { | ||
e.preventDefault(); | ||
var product_id = $(this).find('input[name="product_id"]').attr('value'); | ||
var add_qty = $(this).find('input[name="add_qty"]').attr('value'); | ||
$.post( '/shop/cart/update_main', | ||
{ product_id: parseInt(product_id), add_qty : parseFloat(add_qty)}, | ||
function(returnedData){ | ||
var cart_qty = ''; | ||
var slide; | ||
for (var i = 0; i < 20; i++) { | ||
slide = returnedData.charAt(i); | ||
if (!(isNaN(slide))) { | ||
cart_qty = cart_qty + slide; | ||
}else{ | ||
break; | ||
} | ||
} | ||
if (cart_qty){ | ||
returnedData = returnedData.slice(i + 1); | ||
} | ||
|
||
$('#cart_link > sup').html("<span>" + cart_qty + "</span>"); | ||
if ($('.dropdown_cart').length){ | ||
$('.dropdown_cart').replaceWith(returnedData); | ||
}else{ | ||
$("#cart_link").after(returnedData); // add a cart with item | ||
} | ||
|
||
$('#btn_cart').removeClass("hidden"); | ||
} | ||
|
||
); | ||
$('#prodDetail').modal('hide'); | ||
$('#cart_products > tbody > tr > td.text-center > div > input').val(1); | ||
}); | ||
}); | ||
// }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
<!-- Layout and common templates --> | ||
<template id="assets_frontend" inherit_id="website.assets_frontend" name="Shop"> | ||
<xpath expr="." position="inside"> | ||
<script type="text/javascript" src="/runex_add_to_cart_view/static/src/js/shop_quickview.js"></script> | ||
<link rel='stylesheet' href='/runex_add_to_cart_view/static/src/css/shop_quickview.css' /> | ||
</xpath> | ||
</template> | ||
|
||
<template id="products_item_quickview_modal" inherit_id="website_sale.products" customize_show="True" active="True" name="Modal quickview website sale product "> | ||
<xpath expr="//div[@class='js_sale']" position="after"> | ||
<div class="modal fade" id="prodDetail" tabindex="-1" role="dialog" aria-labelledby="prodDetailLabel"> | ||
<div class="modal-dialog" role="document" style="width: 50%;"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | ||
<span aria-hidden="true"> | ||
<i class="fa fa-close"/> | ||
</span> | ||
</button> | ||
<h4 class="modal-title" id="prodDetailLabel">Add to cart</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<div id="wrap"> | ||
<div class="container oe_website_sale"> | ||
<ul class="wizard pull-right"> | ||
<br/> | ||
<br/> | ||
<br/> | ||
<br/> | ||
</ul> | ||
|
||
<div class="col-md-8 col-sm-9 oe_cart" style="width: 80%;"> | ||
<form action="/shop/cart/update_main" id="add-cart-form" method="post"> | ||
<table class="table table-striped table-condensed" id="cart_products"> | ||
<thead> | ||
<tr> | ||
<th colspan="2" width="100">Product</th> | ||
<th width="100" class="decimal_precision">Price</th> | ||
<th width="120">Quantity</th> | ||
</tr> | ||
</thead> | ||
<td style="width: 20%; height: 40%"> | ||
|
||
<img class="img img-responsive" src="" alt="" /> | ||
|
||
</td> | ||
<td id="productTitle"> | ||
</td> | ||
<td> | ||
<b id="productprice"></b> <b><t t-esc="user_id.partner_id.property_product_pricelist.currency_id.symbol"/></b> | ||
</td> | ||
<td class="text-center"> | ||
<div class="input-group oe_website_spinner"> | ||
<span class="input-group-addon"> | ||
<a t-attf-href="#" class="mb8 js_add_cart_json" data-no-instant=""> | ||
<i class="fa fa-minus"/> | ||
</a> | ||
</span> | ||
<input type="text" class="js_quantity form-control" value="1" name="add_qty"/> | ||
<span class="input-group-addon"> | ||
<a t-attf-href="#" class="mb8 float_left js_add_cart_json" data-no-instant=""> | ||
<i class="fa fa-plus"/> | ||
</a> | ||
</span> | ||
</div> | ||
</td> | ||
</table> | ||
|
||
<div class="col-sm-9 oe_cart" style="width: 100%; padding-right: 0px;"> | ||
<input type="hidden" name="product_id" id="product_id" /> | ||
<button type="submit" class="btn btn-primary pull-right" id="add_submit"> <i class="fa fa-shopping-cart"></i> Add to cart </button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</xpath> | ||
</template> | ||
</data> | ||
</openerp> |
Oops, something went wrong.