[+] MO : Adding the favoriteproducts module - Part2
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
$('documnet').ready(function(){
|
||||
$('img[rel^=ajax_id_favoriteproduct_]').click(function(){
|
||||
|
||||
@@ -46,6 +47,7 @@ $('documnet').ready(function(){
|
||||
});
|
||||
});
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
{capture name=path}<a href="{$link->getPageLink('my-account.php', true)}">{l s='My account' mod='favoriteproducts'}</a><span class="navigation-pipe">{$navigationPipe}</span>{l s='My favorite products' mod='favoriteproducts'}{/capture}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__).'/../../config/config.inc.php');
|
||||
require_once(dirname(__FILE__).'/../../init.php');
|
||||
include(dirname(__FILE__).'/FavoriteProduct.php');
|
||||
|
||||
if (Tools::getValue('action') AND Tools::getValue('id_product') AND Context::getContext()->cookie->id_customer)
|
||||
@@ -40,7 +41,6 @@ if (Tools::getValue('action') AND Tools::getValue('id_product') AND Context::get
|
||||
if ($favoriteProduct)
|
||||
if ($favoriteProduct->delete())
|
||||
die('0');
|
||||
die('1');
|
||||
}
|
||||
elseif (Tools::getValue('action') == 'add')
|
||||
{
|
||||
@@ -54,11 +54,8 @@ if (Tools::getValue('action') AND Tools::getValue('id_product') AND Context::get
|
||||
$favoriteProduct->id_shop = (int)Context::getContext()->shop->getID();
|
||||
if ($favoriteProduct->add())
|
||||
die('0');
|
||||
die('1');
|
||||
}
|
||||
else
|
||||
die('1');
|
||||
}
|
||||
else
|
||||
die('1');
|
||||
|
||||
die('1');
|
||||
|
||||
|
||||
@@ -25,12 +25,13 @@
|
||||
*}
|
||||
|
||||
<script type="text/javascript">
|
||||
{literal}
|
||||
$('document').ready(function(){
|
||||
$('#add_favorites_btn').click(function(){
|
||||
$.ajax({
|
||||
url: "{$module_dir}favoriteproducts-ajax.php",
|
||||
{/literal}url: "{$module_dir}favoriteproducts-ajax.php",{literal}
|
||||
post: "POST",
|
||||
data: "id_product={$smarty.get.id_product}&action=add",
|
||||
{/literal}data: "id_product={$smarty.get.id_product}&action=add",{literal}
|
||||
success: function(result){
|
||||
if (result == '0')
|
||||
{
|
||||
@@ -42,6 +43,7 @@ $('document').ready(function(){
|
||||
});
|
||||
});
|
||||
})
|
||||
{/literal}
|
||||
</script>
|
||||
|
||||
{if !$isCustomerFavoriteProduct AND $isLogged}
|
||||
|
||||
Reference in New Issue
Block a user