[-] MO : FavoriteProducts - now adds/removes correctly products
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
{literal}
|
{literal}
|
||||||
$('document').ready(function(){
|
$('document').ready(function(){
|
||||||
$('#favoriteproducts_block_extra').click(function(){
|
$('#favoriteproducts_block_extra_add').click(function(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
{/literal}url: "{$module_dir}favoriteproducts-ajax.php",{literal}
|
{/literal}url: "{$module_dir}favoriteproducts-ajax.php",{literal}
|
||||||
post: "POST",
|
post: "POST",
|
||||||
@@ -35,9 +35,58 @@ $('document').ready(function(){
|
|||||||
success: function(result){
|
success: function(result){
|
||||||
if (result == '0')
|
if (result == '0')
|
||||||
{
|
{
|
||||||
$('#favoriteproducts_block_extra').fadeOut("normal", function() {
|
$('#favoriteproducts_block_extra_add').slideUp(function() {
|
||||||
$('#favoriteproducts_block_extra').remove();
|
$('#favoriteproducts_block_extra_added').slideDown("slow");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#favoriteproducts_block_extra_remove').click(function(){
|
||||||
|
$.ajax({
|
||||||
|
{/literal}url: "{$module_dir}favoriteproducts-ajax.php",{literal}
|
||||||
|
post: "POST",
|
||||||
|
{/literal}data: "id_product={$smarty.get.id_product}&action=remove",{literal}
|
||||||
|
success: function(result){
|
||||||
|
if (result == '0')
|
||||||
|
{
|
||||||
|
$('#favoriteproducts_block_extra_remove').slideUp(function() {
|
||||||
|
$('#favoriteproducts_block_extra_removed').slideDown("slow");
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#favoriteproducts_block_extra_added').click(function(){
|
||||||
|
$.ajax({
|
||||||
|
{/literal}url: "{$module_dir}favoriteproducts-ajax.php",{literal}
|
||||||
|
post: "POST",
|
||||||
|
{/literal}data: "id_product={$smarty.get.id_product}&action=remove",{literal}
|
||||||
|
success: function(result){
|
||||||
|
if (result == '0')
|
||||||
|
{
|
||||||
|
$('#favoriteproducts_block_extra_added').slideUp(function() {
|
||||||
|
$('#favoriteproducts_block_extra_removed').slideDown("slow");
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#favoriteproducts_block_extra_removed').click(function(){
|
||||||
|
$.ajax({
|
||||||
|
{/literal}url: "{$module_dir}favoriteproducts-ajax.php",{literal}
|
||||||
|
post: "POST",
|
||||||
|
{/literal}data: "id_product={$smarty.get.id_product}&action=add",{literal}
|
||||||
|
success: function(result){
|
||||||
|
if (result == '0')
|
||||||
|
{
|
||||||
|
$('#favoriteproducts_block_extra_removed').slideUp(function() {
|
||||||
|
$('#favoriteproducts_block_extra_added').slideDown("slow");
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -47,11 +96,19 @@ $('document').ready(function(){
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{if !$isCustomerFavoriteProduct AND $isLogged}
|
{if !$isCustomerFavoriteProduct AND $isLogged}
|
||||||
<li id="favoriteproducts_block_extra">
|
<li id="favoriteproducts_block_extra_add" class="add">
|
||||||
{l s='Add this product to my favorites' mod='favoriteproducts'}
|
{l s='Add this product to my favorites' mod='favoriteproducts'}
|
||||||
</li>
|
</li>
|
||||||
{elseif $isCustomerFavoriteProduct AND $isLogged}
|
{/if}
|
||||||
<li id="afavoriteproducts_block_extra_added">
|
{if $isCustomerFavoriteProduct AND $isLogged}
|
||||||
{l s='This product is already one of my favorites' mod='favoriteproducts'}
|
<li id="favoriteproducts_block_extra_remove">
|
||||||
|
{l s='Remove this product from my favorites' mod='favoriteproducts'}
|
||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<li id="favoriteproducts_block_extra_added">
|
||||||
|
{l s='Remove this product from my favorites' mod='favoriteproducts'}
|
||||||
|
</li>
|
||||||
|
<li id="favoriteproducts_block_extra_removed">
|
||||||
|
{l s='Add this product to my favorites' mod='favoriteproducts'}
|
||||||
|
</li>
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
#favoriteproducts_block_extra span#add_favorites_btn {
|
|
||||||
cursor: pointer
|
|
||||||
}
|
|
||||||
|
|
||||||
#favoriteproducts_block_account .favoriteproduct {
|
#favoriteproducts_block_account .favoriteproduct {
|
||||||
position:relative;
|
position:relative;
|
||||||
margin-bottom: 14px;
|
margin-bottom: 14px;
|
||||||
@@ -41,8 +37,27 @@
|
|||||||
|
|
||||||
/* lnk fiche produit */
|
/* lnk fiche produit */
|
||||||
|
|
||||||
#usefull_link_block li#favoriteproducts_block_extra {
|
#usefull_link_block li#favoriteproducts_block_extra_add {
|
||||||
padding-left:20px;
|
padding-left:20px;
|
||||||
background:url(img/add_favorite.gif) no-repeat 0 0;
|
background:url(img/add_favorite.gif) no-repeat 0 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#usefull_link_block li#favoriteproducts_block_extra_remove {
|
||||||
|
padding-left:20px;
|
||||||
|
background:url(img/add_favorite.gif) no-repeat 0 0;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul#usefull_link_block li#favoriteproducts_block_extra_added {
|
||||||
|
padding-left:20px;
|
||||||
|
background:url(img/add_favorite.gif) no-repeat 0 0;
|
||||||
|
cursor: pointer;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
ul#usefull_link_block li#favoriteproducts_block_extra_removed {
|
||||||
|
padding-left:20px;
|
||||||
|
background:url(img/add_favorite.gif) no-repeat 0 0;
|
||||||
|
cursor: pointer;
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user