update to add product with attribute to cart from bestsellers
This commit is contained in:
parent
7b74de5aac
commit
985bf52e83
@ -6,7 +6,7 @@
|
||||
{foreach from=$best_sellers item=product name=myLoop}
|
||||
<li>
|
||||
<div class="hover-slide">
|
||||
<a class="add-to-cart ajax_add_to_cart_product_footer_button" rel="ajax_id_product_footer_{$product.id_product}" href="" title="{l s='Add to cart' mod='blockbestsellers'}"></a>
|
||||
<a onclick="showExpressCart(event); return false;" class="add-to-cart ajax_add_to_cart_product_footer_button" rel="{$product.id_product}" href="" title="{l s='Add to cart' mod='blockbestsellers'}"></a>
|
||||
<a class="see-product" href="{$product.link}" title="{l s='See this product' mod='blockbestsellers'}"></a>
|
||||
</div>
|
||||
<div class="product_added product_added_{$product.id_product}">
|
||||
@ -52,7 +52,7 @@
|
||||
});
|
||||
$('.slider_sales_product_footer .flex-direction-nav .flex-next').text('');
|
||||
$('.slider_sales_product_footer .flex-direction-nav .flex-prev').text('');
|
||||
$('.ajax_add_to_cart_product_footer_button').click(function(){
|
||||
/*$('.ajax_add_to_cart_product_footer_button').click(function(){
|
||||
var idProduct = $(this).attr('rel').replace('ajax_id_product_footer_', '');
|
||||
if ($(this).attr('disabled') != 'disabled'){
|
||||
$.ajax({
|
||||
@ -78,7 +78,7 @@
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});*/
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
@ -4,9 +4,9 @@
|
||||
<div class="slider_sales_product_footer">
|
||||
<ul class="slides">
|
||||
{foreach from=$best_sellers item=product name=myLoop}
|
||||
<li>
|
||||
<li class='slide-item'>
|
||||
<div class="hover-slide">
|
||||
<a class="add-to-cart ajax_add_to_cart_product_footer_button" rel="ajax_id_product_footer_{$product.id_product}" href="" title="{l s='Add to cart' mod='blockbestsellers'}"></a>
|
||||
<a onclick="showExpressCart(event); return false;" class="add-to-cart ajax_add_to_cart_product_footer_button" rel="{$product.id_product}" href="" title="{l s='Add to cart' mod='blockbestsellers'}"></a>
|
||||
<a class="see-product" href="{$product.link}" title="{l s='See this product' mod='blockbestsellers'}"></a>
|
||||
</div>
|
||||
<div class="product_added product_added_{$product.id_product}">
|
||||
@ -52,7 +52,7 @@
|
||||
});
|
||||
$('.slider_sales_product_footer .flex-direction-nav .flex-next').text('');
|
||||
$('.slider_sales_product_footer .flex-direction-nav .flex-prev').text('');
|
||||
$('.ajax_add_to_cart_product_footer_button').click(function(){
|
||||
/*$('.ajax_add_to_cart_product_footer_button').click(function(){
|
||||
var idProduct = $(this).attr('rel').replace('ajax_id_product_footer_', '');
|
||||
if ($(this).attr('disabled') != 'disabled'){
|
||||
$.ajax({
|
||||
@ -78,7 +78,7 @@
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});*/
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
@ -6,7 +6,7 @@
|
||||
{foreach from=$best_sellers item=product name=myLoop}
|
||||
<li>
|
||||
<div class="hover-slide">
|
||||
<a class="add-to-cart ajax_add_to_cart_product_footer_button" rel="ajax_id_product_footer_{$product.id_product}" href="" title="{l s='Add to cart' mod='blockbestsellers'}"></a>
|
||||
<a onclick="showExpressCart(event); return false;" class="add-to-cart ajax_add_to_cart_product_footer_button" rel="{$product.id_product}" href="" title="{l s='Add to cart' mod='blockbestsellers'}"></a>
|
||||
<a class="see-product" href="{$product.link}" title="{l s='See this product' mod='blockbestsellers'}"></a>
|
||||
</div>
|
||||
<div class="product_added product_added_{$product.id_product}">
|
||||
@ -52,7 +52,7 @@
|
||||
});
|
||||
$('.slider_sales_product_footer .flex-direction-nav .flex-next').text('');
|
||||
$('.slider_sales_product_footer .flex-direction-nav .flex-prev').text('');
|
||||
$('.ajax_add_to_cart_product_footer_button').click(function(){
|
||||
/* $('.ajax_add_to_cart_product_footer_button').click(function(){
|
||||
var idProduct = $(this).attr('rel').replace('ajax_id_product_footer_', '');
|
||||
if ($(this).attr('disabled') != 'disabled'){
|
||||
$.ajax({
|
||||
@ -78,7 +78,7 @@
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});*/
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
@ -40,6 +40,10 @@ function formatQuantityDiscounts($specificPrices, $price, $taxRate) {
|
||||
$result = '';
|
||||
|
||||
if($id_product = (int) Tools::getValue('id_product')) {
|
||||
$tpl = 'product';
|
||||
if((int) Tools::getValue('page')) {
|
||||
$tpl = 'product_footer';
|
||||
}
|
||||
$product = new Product($id_product, true, (int) $cookie->id_lang);
|
||||
if(Validate::isLoadedObject($product)) {
|
||||
$ecotax_rate = (float) Tax::getProductEcotaxRate($cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
|
||||
@ -187,7 +191,7 @@ if($id_product = (int) Tools::getValue('id_product')) {
|
||||
'packs' => Pack::getPacksTable($product->id, (int) $cookie->id_lang, TRUE, 1),
|
||||
'virtual' => ProductDownload::getIdFromIdProduct((int) $product->id),
|
||||
));
|
||||
$result = $smarty->fetch(file_exists(_PS_THEME_DIR_.'modules/expresscart/product.tpl')? '../../themes/'._THEME_NAME_.'/modules/expresscart/product.tpl': 'product.tpl', __FILE__);
|
||||
$result = $smarty->fetch(file_exists(_PS_THEME_DIR_.'modules/expresscart/'.$tpl.'.tpl')? '../../themes/'._THEME_NAME_.'/modules/expresscart/'.$tpl.'.tpl': $tpl.'.tpl', __FILE__);
|
||||
} else {
|
||||
$smarty->assign('error', 'product_missing');
|
||||
$result = $smarty->fetch(file_exists(_PS_THEME_DIR_.'modules/expresscart/error.tpl')? '../../themes/'._THEME_NAME_.'/modules/expresscart/error.tpl': 'error.tpl', __FILE__);
|
||||
|
@ -21,10 +21,16 @@ class ExpressCart extends Module {
|
||||
}
|
||||
|
||||
public function hookHeader() {
|
||||
if($id_category = Tools::getValue('id_category')) {
|
||||
global $smarty;
|
||||
$smarty->assign('id_category', $id_category);
|
||||
return $this->display(__FILE__, 'header.tpl');
|
||||
}
|
||||
global $smarty;
|
||||
$page_name = $smarty->getTemplateVars('page_name');
|
||||
|
||||
if($id_category = Tools::getValue('id_category')) {
|
||||
$smarty->assign('id_category', $id_category);
|
||||
return $this->display(__FILE__, 'header.tpl');
|
||||
}
|
||||
|
||||
if($page_name == 'product') {
|
||||
return $this->display(__FILE__, 'header2.tpl');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
62
modules/expresscart/header2.tpl
Normal file
62
modules/expresscart/header2.tpl
Normal file
@ -0,0 +1,62 @@
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
|
||||
function hideExpressCart(event){
|
||||
if(".button.expresscart.active" == $(event.target)) {
|
||||
event.data.m.removeClass('active');
|
||||
$(".expresscart_frame").slideUp();
|
||||
$("html").unbind("click", hideExpressCart);
|
||||
$('.close_popup_footer').remove();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function showExpressCart(event) {
|
||||
var m = $(event.target);
|
||||
m.toggleClass('active');
|
||||
|
||||
if($(".expresscart_frame:visible").length > 0) {
|
||||
m.removeClass('active');
|
||||
hideFooterExpressCart();
|
||||
} else {
|
||||
$(".expresscart_frame").slideDown(function() {
|
||||
if($(".expresscart_frame").children("p.loading").length > 0) {
|
||||
var id_product = m.parent().children(".ajax_add_to_cart_product_footer_button").attr("rel");
|
||||
$(".expresscart_frame").append("<iframe src=\"{/literal}{$base_dir_ssl}{literal}modules/expresscart/ajax.php?page=1&id_product=" + id_product + "\" style=\"display: none;\" border=\"0\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" onload=\"$(this).show(); $(this).parent().children('p.loading').remove();\"></iframe>");
|
||||
}
|
||||
$(".expresscart_frame").append('<a href="#" class="close_popup_footer"></a>');
|
||||
|
||||
$('a.close_popup_footer').click(function() {
|
||||
$(this).remove();
|
||||
m.removeClass('active');
|
||||
hideFooterExpressCart();
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
$("html").bind("click", {m: m}, hideExpressCart);
|
||||
return false;
|
||||
}
|
||||
|
||||
function initButtons() {
|
||||
$('.slider_sales_product_footer').after("{/literal}<div class=\"expresscart_frame\" style=\"text-align:center;\"><p class=\"loading\"><img src=\"{$img_dir|replace:'"':'"'}ajax-loader.gif\" alt=\"\" /></p></div>{literal}");
|
||||
}
|
||||
|
||||
function hideFooterExpressCart(){
|
||||
$(".expresscart_frame").slideUp();
|
||||
$(".expresscart_frame").remove();
|
||||
$("html").unbind("click", hideExpressCart);
|
||||
initButtons();
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
initButtons();
|
||||
$("#product").bind("updated", function() {
|
||||
initButtons();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
{/literal}
|
||||
</script>
|
638
modules/expresscart/product_footer.tpl
Normal file
638
modules/expresscart/product_footer.tpl
Normal file
@ -0,0 +1,638 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
|
||||
<meta name="robots" content="noindex,nofollow" />
|
||||
<script type="text/javascript">
|
||||
var baseDir = "{$base_dir_ssl}";
|
||||
var static_token = "{$static_token}";
|
||||
var token = '{$token}';
|
||||
var priceDisplayPrecision = {$priceDisplayPrecision};
|
||||
var priceDisplayMethod = {$priceDisplay};
|
||||
var roundMode = {$roundMode};
|
||||
var isoLang = "{$lang_iso}";
|
||||
var product_frame = true;
|
||||
|
||||
</script>
|
||||
<script type="text/javascript" src="{$base_dir_ssl}js/scripts.js"></script>
|
||||
<script type="text/javascript" src="{$js_dir}tools.js"></script>
|
||||
<script type="text/javascript" src="{$js_dir}product.js?v=2"></script>
|
||||
{if $cartex}
|
||||
<script type="text/javascript" src="{$base_dir_ssl}modules/blockcartex/ajax-cart.js?v=4"></script>
|
||||
{else}
|
||||
<script type="text/javascript" src="{$base_dir_ssl}modules/blockcartex/ajax-cart.js?v=4"></script>
|
||||
{/if}
|
||||
<style type="text/css">{literal}
|
||||
html {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
body {
|
||||
background: rgb(238,238,238); /* Old browsers */
|
||||
background: -moz-linear-gradient(left, rgba(238,238,238,1) 0%, rgba(238,238,238,1) 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(238,238,238,1)), color-stop(100%,rgba(238,238,238,1))); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(left, rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(left, rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(left, rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%); /* IE10+ */
|
||||
background: linear-gradient(to right, rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#eeeeee',GradientType=1 ); /* IE6-9 */
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
color: #666666;
|
||||
font-size: 12px;
|
||||
font-family: tahoma,arial,sans-serif;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
h1 {
|
||||
text-align: center;
|
||||
line-height: 1em;
|
||||
width: 500px;
|
||||
color: #1E1633;
|
||||
font-style: italic;
|
||||
font-family: Georgia, Times, "Times New Roman", serif;
|
||||
font-weight: normal;
|
||||
/* min-height: 2em; */
|
||||
font-size: 16px;
|
||||
margin: 5px 0px;
|
||||
}
|
||||
p {
|
||||
margin: 0px;
|
||||
padding: 0 15px 10px;
|
||||
}
|
||||
.center_element {
|
||||
margin : 10px 0;
|
||||
padding : 10px ;
|
||||
width : 320px;
|
||||
background : #DEA4BE;
|
||||
/* background : #fb66a9; */
|
||||
float : left;
|
||||
box-sizing: border-box;
|
||||
height: 133px;
|
||||
}
|
||||
.center_element img {
|
||||
border : 5px solid #FFFFFF;
|
||||
float : left;
|
||||
}
|
||||
.right_element {
|
||||
float : left;
|
||||
width: 220px;
|
||||
}
|
||||
#attributes{
|
||||
width: 150px;
|
||||
float: left;
|
||||
}
|
||||
#quantity_wanted_p {
|
||||
padding:0;
|
||||
}
|
||||
#quantity_wanted {
|
||||
text-align: right;
|
||||
}
|
||||
.quantity_wanted{
|
||||
float: right;
|
||||
width: 65px;
|
||||
}
|
||||
#availability_value{
|
||||
font-size: 1px;
|
||||
font-weight: 700;
|
||||
width: 100%;
|
||||
}
|
||||
input[type="text"] {
|
||||
font-size: 12px;
|
||||
color: #8B8B8B;
|
||||
padding: 4px;
|
||||
border : none;
|
||||
border-radius : 2px;
|
||||
-webkit-border-radius : 2px;
|
||||
-moz-border-radius : 2px;
|
||||
-o-border-radius : 2px;
|
||||
-ms-border-radius : 2px;
|
||||
}
|
||||
select {
|
||||
font-size: 12px;
|
||||
color: #8B8B8B;
|
||||
padding: 4px;
|
||||
background : #FFFFFF;
|
||||
width : 100%;
|
||||
border : none;
|
||||
border-radius : 2px;
|
||||
-webkit-border-radius : 2px;
|
||||
-moz-border-radius : 2px;
|
||||
-o-border-radius : 2px;
|
||||
-ms-border-radius : 2px;
|
||||
}
|
||||
select option {
|
||||
font-size: 12px;
|
||||
color: #666666;
|
||||
border: 0px;
|
||||
}
|
||||
label {
|
||||
font-size : 14px;
|
||||
color : #FFFFFF;
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
form {
|
||||
height: 200px;
|
||||
width: 500px;
|
||||
margin: 0px;
|
||||
}
|
||||
.border-separator {
|
||||
border-top : 1px solid #FFFFFF;
|
||||
height : 0px;
|
||||
margin : 1px 0;
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
#buy_block_footer {
|
||||
margin : 10px auto 0;
|
||||
}
|
||||
#prices_display {
|
||||
padding-top: 10px;
|
||||
float: right;
|
||||
width: 150px;
|
||||
height: 145px;
|
||||
position: relative;
|
||||
}
|
||||
#reduction {
|
||||
font-weight: bold;
|
||||
}
|
||||
div.price, p#old_price {
|
||||
font-size: 13px;
|
||||
padding: 0;
|
||||
color: #333;
|
||||
clear: both;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
div.price span, p#old_price span {
|
||||
font-style: italic;
|
||||
font-family: Georgia, Times, "Times New Roman", serif;
|
||||
}
|
||||
p#old_price span {
|
||||
margin-right:5px;
|
||||
}
|
||||
p#old_price span.bold {
|
||||
color: #514C8C;
|
||||
}
|
||||
p#old_price span.reduction{
|
||||
color: #4F4E9A;
|
||||
}
|
||||
p#old_price span#old_price_display {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
div.price p{
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding: 0;
|
||||
}
|
||||
div.price p.our_price_display span {
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
color: #FB69AA;
|
||||
font-size: 16px;
|
||||
}
|
||||
p.price-ecotax{
|
||||
text-align: center;
|
||||
font-size: 9px;
|
||||
}
|
||||
#availability_statut {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
#add_to_cart_product_footer input {
|
||||
background : url('arrow.png') no-repeat right 9px #514C8C;
|
||||
height: 30px;
|
||||
font-family: Georgia, Times, "Times New Roman", serif;
|
||||
font-size: 13px;
|
||||
font-style: italic;
|
||||
color: #ffffff;
|
||||
margin: 20px 0 0;
|
||||
padding: 7px 30px 6px 20px;
|
||||
-moz-border-radius: 20px;
|
||||
-webkit-border-radius: 20px;
|
||||
border-radius: 20px;
|
||||
text-decoration: none;
|
||||
border : none;
|
||||
cursor : pointer;
|
||||
display: inline-block;
|
||||
}
|
||||
#add_to_cart_product_footer {
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
bottom: 12px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.product_added_to_cart {
|
||||
display: none;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0,0,0,0.7);
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
z-index: 999;
|
||||
padding: 85px 20px;
|
||||
}
|
||||
.product_added_to_cart p{
|
||||
color: #fff;
|
||||
font-family: "georgia";
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
#jqibox {
|
||||
background-image : -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(204, 204, 204)), to(rgb(255, 255, 255)));
|
||||
background-image : -moz-linear-gradient(34% 100% 90deg,#FFFFFF, #CCCCCC);
|
||||
background-image : linear-gradient(34% 100% 90deg,#FFFFFF, #CCCCCC);
|
||||
width : 100%;
|
||||
height : 100%;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
#jqibox #jqi {
|
||||
margin-left : -124px !important;
|
||||
width: 250px !important;
|
||||
height: 430px !important;
|
||||
}
|
||||
.jqiclose {
|
||||
display: none;
|
||||
}
|
||||
.jqimessage {
|
||||
width : 100%;
|
||||
text-align: center;
|
||||
line-height: 1.4em;
|
||||
position : relative;
|
||||
}
|
||||
.jqimessage div {
|
||||
border : 1px solid #FFFFFF;
|
||||
border-color : #FFFFFF transparent;
|
||||
padding : 20px 0;
|
||||
}
|
||||
.jqimessage div:before {
|
||||
height : 1px;
|
||||
width : 100%;
|
||||
border-top : 1px solid #FFFFFF;
|
||||
content : "";
|
||||
position : absolute;
|
||||
top : 50px;
|
||||
padding : 0;
|
||||
margin : 0;
|
||||
left : 0;
|
||||
}
|
||||
.jqimessage div:after {
|
||||
height : 1px;
|
||||
width : 100%;
|
||||
border-top : 1px solid #FFFFFF;
|
||||
content : "";
|
||||
position : absolute;
|
||||
bottom : -3px;
|
||||
padding : 0;
|
||||
margin : 0;
|
||||
left : 0;
|
||||
}
|
||||
.jqimessage p {
|
||||
background : #DEA3BD;
|
||||
font-size : 18px;
|
||||
padding : 40px 20px;
|
||||
width : 210px;
|
||||
color : #FFFFFF;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
.jqimessage h1 {
|
||||
margin-top: 21px;
|
||||
}
|
||||
.jqibuttons {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jqibuttons button {
|
||||
background : #514C8C;
|
||||
height: 30px;
|
||||
font-family: Georgia, Times, "Times New Roman", serif;
|
||||
font-size: 13px;
|
||||
font-style: italic;
|
||||
color: #ffffff;
|
||||
margin: 0;
|
||||
display : block;
|
||||
padding: 7px 20px 6px 20px;
|
||||
-moz-border-radius: 20px;
|
||||
-webkit-border-radius: 20px;
|
||||
border-radius: 20px;
|
||||
text-decoration: none;
|
||||
border : none;
|
||||
margin : 30px auto 0;
|
||||
cursor : pointer;
|
||||
float : right;
|
||||
}
|
||||
.jqibuttons button.jqidefaultbutton {
|
||||
background : #E26EA2;
|
||||
height: 30px;
|
||||
font-family: Georgia, Times, "Times New Roman", serif;
|
||||
font-size: 13px;
|
||||
font-style: italic;
|
||||
color: #ffffff;
|
||||
margin: 0;
|
||||
display : block;
|
||||
padding: 7px 20px 6px 20px;
|
||||
-moz-border-radius: 20px;
|
||||
-webkit-border-radius: 20px;
|
||||
border-radius: 20px;
|
||||
text-decoration: none;
|
||||
border : none;
|
||||
margin : 30px auto 0;
|
||||
cursor : pointer;
|
||||
float : left;
|
||||
}
|
||||
{/literal}</style>
|
||||
</head>
|
||||
<body id="product" class="singleCol">
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
|
||||
// PrestaShop internal settings
|
||||
var currencySign = '{$currencySign|html_entity_decode:2:"UTF-8"}';
|
||||
var currencyRate = '{$currencyRate|floatval}';
|
||||
var currencyFormat = '{$currencyFormat|intval}';
|
||||
var currencyBlank = '{$currencyBlank|intval}';
|
||||
var taxRate = {$tax_rate|floatval};
|
||||
|
||||
//JS Hook
|
||||
var oosHookJsCodeFunctions = new Array();
|
||||
|
||||
// Parameters
|
||||
var id_product = '{$product->id|intval}';
|
||||
var productHasAttributes = {if isset($groups)}true{else}false{/if};
|
||||
var quantitiesDisplayAllowed = {if $display_qties == 1}true{else}false{/if};
|
||||
var quantityAvailable = {if $display_qties == 1 && $product->quantity}{$product->quantity}{else}0{/if};
|
||||
var allowBuyWhenOutOfStock = {if $allow_oosp == 1}true{else}false{/if};
|
||||
var availableNowValue = '{$product->available_now|escape:'quotes':'UTF-8'}';
|
||||
var availableLaterValue = '{$product->available_later|escape:'quotes':'UTF-8'}';
|
||||
var productPriceTaxExcluded = {$product->getPriceWithoutReduct(true)|default:'null'} - {$product->ecotax};
|
||||
var reduction_percent = {if $product->specificPrice AND $product->specificPrice.reduction AND $product->specificPrice.reduction_type == 'percentage'}{$product->specificPrice.reduction*100}{else}0{/if};
|
||||
var reduction_price = {if $product->specificPrice AND $product->specificPrice.reduction AND $product->specificPrice.reduction_type == 'amount'}{$product->specificPrice.reduction}{else}0{/if};
|
||||
var specific_price = {if $product->specificPrice AND $product->specificPrice.price}{$product->specificPrice.price}{else}0{/if};
|
||||
var specific_currency = {if $product->specificPrice AND $product->specificPrice.id_currency}true{else}false{/if};
|
||||
var group_reduction = '{$group_reduction}';
|
||||
var default_eco_tax = {$product->ecotax};
|
||||
var ecotaxTax_rate = {$ecotaxTax_rate};
|
||||
var currentDate = '{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}';
|
||||
var maxQuantityToAllowDisplayOfLastQuantityMessage = {$last_qties};
|
||||
var noTaxForThisProduct = {if $no_tax == 1}true{else}false{/if};
|
||||
var displayPrice = {$priceDisplay};
|
||||
var productReference = '{$product->reference|escape:'htmlall':'UTF-8'}';
|
||||
var productAvailableForOrder = {if (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE}'0'{else}'{$product->available_for_order}'{/if};
|
||||
var productShowPrice = '{if !$PS_CATALOG_MODE}{$product->show_price}{else}0{/if}';
|
||||
var productUnitPriceRatio = '{$product->unit_price_ratio}';
|
||||
var idDefaultImage = {if isset($cover.id_image_only)}{$cover.id_image_only}{else}0{/if};
|
||||
|
||||
// Customizable field
|
||||
var img_ps_dir = '{$img_ps_dir}';
|
||||
var customizationFields = new Array();
|
||||
{assign var='imgIndex' value=0}
|
||||
{assign var='textFieldIndex' value=0}
|
||||
{foreach from=$customizationFields item='field' name='customizationFields'}
|
||||
{assign var="key" value="pictures_`$product->id`_`$field.id_customization_field`"}
|
||||
customizationFields[{$smarty.foreach.customizationFields.index|intval}] = new Array();
|
||||
customizationFields[{$smarty.foreach.customizationFields.index|intval}][0] = '{if $field.type|intval == 0}img{$imgIndex++}{else}textField{$textFieldIndex++}{/if}';
|
||||
customizationFields[{$smarty.foreach.customizationFields.index|intval}][1] = {if $field.type|intval == 0 && isset($pictures.$key) && $pictures.$key}2{else}{$field.required|intval}{/if};
|
||||
{/foreach}
|
||||
|
||||
// Images
|
||||
var img_prod_dir = '{$img_prod_dir}';
|
||||
var combinationImages = new Array();
|
||||
|
||||
{if isset($combinationImages)}
|
||||
{foreach from=$combinationImages item='combination' key='combinationId' name='f_combinationImages'}
|
||||
combinationImages[{$combinationId}] = new Array();
|
||||
{foreach from=$combination item='image' name='f_combinationImage'}
|
||||
combinationImages[{$combinationId}][{$smarty.foreach.f_combinationImage.index}] = {$image.id_image|intval};
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
combinationImages[0] = new Array();
|
||||
{if isset($images)}
|
||||
{foreach from=$images item='image' name='f_defaultImages'}
|
||||
combinationImages[0][{$smarty.foreach.f_defaultImages.index}] = {$image.id_image};
|
||||
{/foreach}
|
||||
{/if}
|
||||
|
||||
// Translations
|
||||
var doesntExist = '{l s='The product does not exist in this model. Please choose another.' mod='expresscart' js=1}';
|
||||
var doesntExistNoMore = '{l s='This product is no longer in stock' mod='expresscart' js=1}';
|
||||
var doesntExistNoMoreBut = '{l s='with those attributes but is available with others' mod='expresscart' js=1}';
|
||||
var uploading_in_progress = '{l s='Uploading in progress, please wait...' mod='expresscart' js=1}';
|
||||
var fieldRequired = '{l s='Please fill in all required fields, then save the customization.' mod='expresscart' js=1}';
|
||||
|
||||
{if isset($groups)}
|
||||
// Combinations
|
||||
{foreach from=$combinations key=idCombination item=combination}
|
||||
addCombination({$idCombination|intval}, new Array({$combination.list}), {$combination.quantity}, {$combination.price}, {$combination.ecotax}, {$combination.id_image}, '{$combination.reference|addslashes}', {$combination.unit_impact}, {$combination.minimal_quantity});
|
||||
{/foreach}
|
||||
// Colors
|
||||
{if $colors|@count > 0}
|
||||
{if $product->id_color_default}var id_color_default = {$product->id_color_default|intval};{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{literal}
|
||||
$(".jqidefaultbutton").click(function(){
|
||||
alert("ok");
|
||||
});
|
||||
{/literal}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
{if isset($colors) && $colors}
|
||||
<!-- colors -->
|
||||
<div id="color_picker">
|
||||
<p>{l s='Pick a color:' mod='expresscart' js=1}</p>
|
||||
<div class="clear"></div>
|
||||
<ul id="color_to_pick_list">
|
||||
{foreach from=$colors key='id_attribute' item='color'}
|
||||
<li><a id="color_{$id_attribute|intval}" class="color_pick" style="background: {$color.value};" onclick="updateColorSelect({$id_attribute|intval});$('#wrapResetImages').show('slow');" title="{$color.name}">{if file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}<img src="{$img_col_dir}{$id_attribute}.jpg" alt="{$color.name}" width="20" height="20" />{/if}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)}
|
||||
<!-- add to cart form-->
|
||||
<form id="buy_block_footer" {if $PS_CATALOG_MODE AND !isset($groups) AND $product->quantity > 0}class="hidden"{/if} action="{$link->getPageLink('cart.php')}" method="post">
|
||||
|
||||
<!-- hidden datas -->
|
||||
<p class="hidden">
|
||||
<input type="hidden" name="token" value="{$static_token}" />
|
||||
<input type="hidden" name="id_product" value="{$product->id|intval}" id="product_page_product_id" />
|
||||
<input type="hidden" name="add" value="1" />
|
||||
<input type="hidden" name="id_product_attribute" id="idCombination" value="" />
|
||||
</p>
|
||||
<h1>{$product->name}</h1>
|
||||
<div class="border-separator"></div>
|
||||
<div class="border-separator"></div>
|
||||
<div class="center_element">
|
||||
{assign var=id_image value=Product::getCover($product->id)}
|
||||
<img src="{$link->getImageLink($product->link_rewrite, $product->id|cat:'-'|cat:$id_image.id_image, 'small')}" alt="{$product->name|escape:'htmlall':'UTF-8'}" />
|
||||
<div class="right_element">
|
||||
{if isset($groups)}
|
||||
<!-- attributes -->
|
||||
<div id="attributes">
|
||||
{foreach from=$groups key=id_attribute_group item=group}
|
||||
{if $group.attributes|@count}
|
||||
<p>
|
||||
<label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>
|
||||
{assign var="groupName" value="group_$id_attribute_group"}
|
||||
<select name="{$groupName}" id="group_{$id_attribute_group|intval}" onchange="javascript:findCombination();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{/if};">
|
||||
{foreach from=$group.attributes key=id_attribute item=group_attribute}
|
||||
<option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'htmlall':'UTF-8'}">{$group_attribute|escape:'htmlall':'UTF-8'}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</p>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="quantity_wanted">
|
||||
<!-- quantity wanted -->
|
||||
<p id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) OR $virtual OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
|
||||
<label>{l s='Quantity :' mod='expresscart'}</label>
|
||||
<input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" size="2" maxlength="3" {if $product->minimal_quantity > 1}onkeyup="checkMinimalQuantity({$product->minimal_quantity});"{/if} />
|
||||
</p>
|
||||
|
||||
<!-- minimal quantity wanted -->
|
||||
<p id="minimal_quantity_wanted_p"{if $product->minimal_quantity <= 1 OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>{l s='You must add ' mod='expresscart'} <b id="minimal_quantity_label">{$product->minimal_quantity}</b> {l s=' as a minimum quantity to buy this product.' mod='expresscart'}</p>
|
||||
{if $product->minimal_quantity > 1}
|
||||
<script type="text/javascript">
|
||||
checkMinimalQuantity();
|
||||
</script>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="prices_display">
|
||||
<!-- prices -->
|
||||
{if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
|
||||
{if !$priceDisplay || $priceDisplay == 2}
|
||||
{assign var='productPrice' value=$product->getPrice(true, $smarty.const.NULL, 2)}
|
||||
{assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(false, $smarty.const.NULL)}
|
||||
{elseif $priceDisplay == 1}
|
||||
{assign var='productPrice' value=$product->getPrice(false, $smarty.const.NULL, 2)}
|
||||
{assign var='productPriceWithoutRedution' value=$product->getPriceWithoutReduct(true, $smarty.const.NULL)}
|
||||
{/if}
|
||||
<div class="price">
|
||||
{if $priceDisplay >= 0 && $priceDisplay <= 2}
|
||||
<p class="our_price_display">
|
||||
<span class="bold" id="our_price_display">{convertPrice price=$productPrice}</span>
|
||||
</p>
|
||||
{/if}
|
||||
{if $product->specificPrice AND $product->specificPrice.reduction}
|
||||
<p id="old_price">
|
||||
<span class="bold">
|
||||
{if $priceDisplay >= 0 && $priceDisplay <= 2}
|
||||
{if $productPriceWithoutRedution > $productPrice}
|
||||
<span id="old_price_display">{convertPrice price=$productPriceWithoutRedution}</span>
|
||||
{if isset($product->specificPrice.reduction) && $product->specificPrice.reduction>0}
|
||||
{assign var='reduction' value=$product->specificPrice.reduction*100}
|
||||
<span id="reduction">{l s='(-'}{$reduction|ceil} {l s='%)'}</span>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</span>
|
||||
</p>
|
||||
{/if}
|
||||
{if $priceDisplay == 2}
|
||||
<p id="pretaxe_price"><span id="pretaxe_price_display">{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 2)}</span> {l s='tax excl.' mod='expresscart'}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{if $product->ecotax != 0}
|
||||
<p class="price-ecotax">{l s='include' mod='expresscart'} <span id="ecotax_price_display">{if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if}</span> {l s='for green tax' mod='expresscart'}
|
||||
{if $product->specificPrice AND $product->specificPrice.reduction}
|
||||
<br />{l s='(not impacted by the discount)' mod='expresscart'}
|
||||
{/if}
|
||||
</p>
|
||||
{/if}
|
||||
{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
|
||||
{math equation="pprice / punit_price" pprice=$productPrice punit_price=$product->unit_price_ratio assign=unit_price}
|
||||
<p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per' mod='expresscart'} {$product->unity|escape:'htmlall':'UTF-8'}</p>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<p id="add_to_cart_product_footer" class="button"><input type="submit" name="Submit" value="{l s='Add to cart' mod='expresscart'}" class="exclusive" /></p>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
<p id="availability_statut"{if ($product->quantity <= 0 && !$product->available_later && $allow_oosp) OR ($product->quantity > 0 && !$product->available_now) OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if}>
|
||||
<span id="availability_value"{if $product->quantity <= 0} class="warning_inline"{/if}>
|
||||
{if $product->quantity <= 0}{if $allow_oosp}{$product->available_later}{else}{l s='This product is no longer in stock' mod='expresscart'}{/if}{else}{$product->available_now}{/if}
|
||||
</span>
|
||||
</p>
|
||||
<div class="border-separator"></div>
|
||||
<div class="border-separator"></div>
|
||||
</form>
|
||||
{/if}
|
||||
<div class="product_added_to_cart">
|
||||
<p>{l s='Product added to your cart' mod='expresscart'}</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
$( document ).ready(function() {
|
||||
$('#add_to_cart_product_footer').click(function(){
|
||||
$(this).remove();
|
||||
var idProduct = $('#buy_block_footer input[name="id_product"]').val();
|
||||
var idAttribute = $('#buy_block_footer input[name="id_product_attribute"]').val();
|
||||
var quantity = $('#buy_block_footer #quantity_wanted').val();
|
||||
if ($(this).attr('disabled') != 'disabled'){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: baseDir + 'cart.php',
|
||||
async: true,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
data: 'add=1&ajax=true&qty=' + quantity +'&id_product=' + idProduct + '&ipa=' + idAttribute + '&token=' + static_token + '&ipa=',
|
||||
success: function(jsonData,textStatus,jqXHR)
|
||||
{
|
||||
window.parent.ajaxCart.updateCartInformation(jsonData, false);
|
||||
if (jsonData.hasError !== true) {
|
||||
window.parent.$('.ajax_add_to_cart_product_footer_button').removeClass('active');
|
||||
window.parent.$('a.close_popup_footer').remove();
|
||||
$('.product_added_to_cart').show();
|
||||
setTimeout(function() {
|
||||
$('.product_added_to_cart').hide();
|
||||
window.parent.hideFooterExpressCart();
|
||||
}, 2000);
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
alert("TECHNICAL ERROR: unable to add the product.\n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
</html>
|
@ -6270,6 +6270,9 @@ table#carrierTable tbody td {
|
||||
background: url('../img/cadena.png') no-repeat center;
|
||||
}
|
||||
/* Slider product footer (blockbestsellers)*/
|
||||
#product #best-sellers_block_product {
|
||||
position: relative;
|
||||
}
|
||||
#product #best-sellers_block_product h1 {
|
||||
background-size: 100% 100%;
|
||||
color: #4F4E9A;
|
||||
@ -6432,6 +6435,49 @@ table#carrierTable tbody td {
|
||||
color: #4F4E9A;
|
||||
}
|
||||
|
||||
#product .expresscart_frame {
|
||||
display: none;
|
||||
height: 215px;
|
||||
width: inherit;
|
||||
z-index: 11;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
position: absolute;
|
||||
}
|
||||
#product .expresscart_frame iframe {
|
||||
width: 100%;
|
||||
height: 215px;
|
||||
}
|
||||
#product .expresscart_frame .loading {
|
||||
background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#cccccc), to(#ffffff));
|
||||
background-image: -moz-linear-gradient(34% 100% 90deg, #ffffff, #cccccc);
|
||||
background-image: linear-gradient(34% 100% 90deg, #ffffff, #cccccc);
|
||||
width: 100%;
|
||||
height: 215px;
|
||||
}
|
||||
#product .expresscart_frame .loading img {
|
||||
margin: 8%;
|
||||
background-color: #DFDFDF;
|
||||
border-radius: 40px;
|
||||
box-shadow: 0 0 1px 1px #DDDDDD;
|
||||
}
|
||||
|
||||
#product .close_popup_footer {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
top: 10px;
|
||||
font-style: normal;
|
||||
font-size: 20px;
|
||||
color: #fff;
|
||||
background: url('../img/cross.png') no-repeat;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
z-index: 1000;
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@keyframes slideInDown {
|
||||
0% {
|
||||
-webkit-transform: translateY(-500px);
|
||||
|
@ -4,9 +4,9 @@
|
||||
<div class="slider_sales_product_footer">
|
||||
<ul class="slides">
|
||||
{foreach from=$best_sellers item=product name=myLoop}
|
||||
<li>
|
||||
<li class="slide-item">
|
||||
<div class="hover-slide">
|
||||
<a class="add-to-cart ajax_add_to_cart_product_footer_button" rel="ajax_id_product_footer_{$product.id_product}" href="" title="{l s='Add to cart' mod='blockbestsellers'}"></a>
|
||||
<a onclick="showExpressCart(event); return false;" class="add-to-cart ajax_add_to_cart_product_footer_button" rel="{$product.id_product}" href="" title="{l s='Add to cart' mod='blockbestsellers'}"></a>
|
||||
<a class="see-product" href="{$product.link}" title="{l s='See this product' mod='blockbestsellers'}"></a>
|
||||
</div>
|
||||
<div class="product_added product_added_{$product.id_product}">
|
||||
@ -52,7 +52,7 @@
|
||||
});
|
||||
$('.slider_sales_product_footer .flex-direction-nav .flex-next').text('');
|
||||
$('.slider_sales_product_footer .flex-direction-nav .flex-prev').text('');
|
||||
$('.ajax_add_to_cart_product_footer_button').click(function(){
|
||||
/*$('.ajax_add_to_cart_product_footer_button').click(function(){
|
||||
var idProduct = $(this).attr('rel').replace('ajax_id_product_footer_', '');
|
||||
if ($(this).attr('disabled') != 'disabled'){
|
||||
$.ajax({
|
||||
@ -78,7 +78,7 @@
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});*/
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user