Jump to content

[SOLVED] I can't delete my wishlist


Recommended Posts

turn on browser console (chrome: ctrl+shift+j)

then try to delete it. once you "accept" popup, do you see there some errors? (in console) ?

Hei Vekia,

I did as you suggested and that is what I received:

  1. GET https://50shades.no/modules/blockwishlist/mywishlist.php?rand=1398949267592&deleted&id_wishlist=5&_=1398939755109 404 (Not Found)
  2.  
  3. jquery-1.11.0.min.js:4
    1. n.extend.ajaxjquery-1.11.0.min.js:4
    2. WishlistDeleteajax-wishlist.js:251
    3. onclick
 
Do you have any idea what it can be?
Link to comment
Share on other sites

perhaps it's because your website is under maintenance mode,

can you try to disable it? and then - try to remove your wishlist item.

I did soo and it's still the same ..

Link to comment
Share on other sites

so can you please verify if this file exists in your prestashop filesystem:

/modules/blockwishlist/mywishlist.php 

 

if it exists, check what permissions it has. make sure that permissions are the same as other .php files in this directory.

Link to comment
Share on other sites

so can you please verify if this file exists in your prestashop filesystem:

/modules/blockwishlist/mywishlist.php 

 

if it exists, check what permissions it has. make sure that permissions are the same as other .php files in this directory.

I don't have mywishlist.php in

/modules/blockwishlist and can't find it in /themes/default-bootstrap/modules/blockwishlist

but it exist in

/themes/default-bootstrap/modules/blockwishlist/views/templates/front

and

/modules/blockwishlist/views/templates/front

 

soo what shell I do now?

Link to comment
Share on other sites

problem is probably related to the differencies between files stored in module directory (original files) and files overrided by your theme.

 

try to create mywishlist.php file in your module directory (original directory)

with contents:
 

<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

/* SSL Management */
$useSSL = true;

include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/../../header.php');
include_once(dirname(__FILE__).'/WishList.php');

$context = Context::getContext();
$errors = array();

Tools::displayFileAsDeprecated();

// Instance of module class for translations
$module = new BlockWishList();

if ($context->customer->isLogged())
{
	$add = Tools::getIsset('add');
	$add = (empty($add) === false ? 1 : 0);
	$delete = Tools::getIsset('deleted');
	$delete = (empty($delete) === false ? 1 : 0);
	$id_wishlist = Tools::getValue('id_wishlist');
	if (Tools::isSubmit('submitWishlist'))
	{
		if (Configuration::get('PS_TOKEN_ACTIVATED') == 1 AND
			strcmp(Tools::getToken(), Tools::getValue('token')))
			$errors[] = $module->l('Invalid token', 'mywishlist');
		if (!sizeof($errors))
		{
			$name = Tools::getValue('name');
			if (empty($name))
				$errors[] = $module->l('You must specify a name.', 'mywishlist');
			if (WishList::isExistsByNameForUser($name))
				$errors[] = $module->l('This name is already used by another list.', 'mywishlist');
			
			if(!sizeof($errors))
			{
				$wishlist = new WishList();
				$wishlist->name = $name;
				$wishlist->id_customer = (int)$context->customer->id;
                $wishlist->id_shop = $context->shop->id;
                $wishlist->id_shop_group = $context->shop->id_shop_group;
				list($us, $s) = explode(' ', microtime());
				srand($s * $us);
				$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$context->customer->id), 0, 16));
				$wishlist->add();
				Mail::Send($context->language->id, 'wishlink', Mail::l('Your wishlist\'s link', $context->language->id), 
					array(
					'{wishlist}' => $wishlist->name,
					'{message}' => Tools::getProtocol().htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/blockwishlist/view.php?token='.$wishlist->token),
					$context->customer->email, $context->customer->firstname.' '.$context->customer->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
			}
		}
	}
	else if ($add)
		WishList::addCardToWishlist($context->customer->id, Tools::getValue('id_wishlist'), $context->language->id);
	else if ($delete AND empty($id_wishlist) === false)
	{
		$wishlist = new WishList((int)($id_wishlist));
		if (Validate::isLoadedObject($wishlist))
			$wishlist->delete();
		else
			$errors[] = $module->l('Cannot delete this wishlist', 'mywishlist');
	}
	$context->smarty->assign('wishlists', WishList::getByIdCustomer($context->customer->id));
	$context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($context->customer->id));
}
else
{
	Tools::redirect('index.php?controller=authentication&back=modules/blockwishlist/mywishlist.php');
}

$context->smarty->assign(array(
	'id_customer' => (int)$context->customer->id,
	'errors' => $errors
));

if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl'))
	$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl');
elseif (Tools::file_exists_cache(dirname(__FILE__).'/views/templates/front/mywishlist.tpl'))
	$context->smarty->display(dirname(__FILE__).'/views/templates/front/mywishlist.tpl');
else
	echo $module->l('No template found', 'mywishlist');

include(dirname(__FILE__).'/../../footer.php');


or download it from http://pastebin.com/nhSDhinY

  • Like 1
Link to comment
Share on other sites

last question

what version of block wishlist module you use?

can it be something with cache files or language in front office?

I have norwegian in front office and english avalible just in back office.

I m just thinking ;)

Link to comment
Share on other sites

can it be something with cache files or language in front office?

I have norwegian in front office and english avalible just in back office.

I m just thinking ;)

 

no, it's not related to languages.

it's related to override in template files

 

what template you use? default one? or some custom solution?

Link to comment
Share on other sites

no, it's not related to languages.

it's related to override in template files

 

what template you use? default one? or some custom solution?

default-bootstrap..... soo if understand good I gone create mywhislist.php in /modules/blockwishlist is it correct?

Link to comment
Share on other sites

Hello I try to find out how can delete my saved wishlist! I tried to change the code in the WishList.php


 

public function delete()

{

Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist`');

Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist_email` WHERE `id_wishlist` = '.(int)($this->id));

Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist_product` WHERE `id_wishlist` = '.(int)($this->id));

if (isset($this->context->cookie->id_wishlist))

unset($this->context->cookie->id_wishlist);

 

return (parent::delete());

}

 

and in the ajax-wishlist.js 

 this 


function WishlistDelete(id, id_wishlist, msg)

{

var res = confirm(msg);

if (res == false)

return (false);

 

if (typeof mywishlist_url == 'undefined')

return (false);

 

$.ajax({

type: 'GET',

async: true,

url: mywishlist_url + '&rand=' + new Date().getTime(),

cache: false,

data: 'deleted&id_wishlist=' + id_wishlist,

success: function(data)

{

$('#' + id).fadeOut('slow');

}

});

}

 

to 

 


function WishlistDelete(id, id_wishlist, msg)

{

var res = confirm(msg);

if (res == false)

return (false);

 

if (typeof mywishlist_url == 'undefined')

return (false);

 

$.ajax({

type: 'GET',

async: true,

url: baseDir + 'modules/blockwishlist/WishList.php',

cache: false,

data: 'deleted&id_wishlist=' + id_wishlist,

success: function(data)

{

$('#' + id).fadeOut('slow');

}

});

}

 

but nothing! My wish list steal in the database! any suggestions??? please

I created mywishlist.php too but still nothnig!! I don't use the default theme I use a custom! thank you


Link to comment
Share on other sites

$this->id is related to class object definition, you're in module class, not wishlist class.

it means that $this->id is an id of module, not wishlist.

 

i said that you have to use $id as a function param, something like:

 

public function delete($id)
{
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist`');
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist_email` WHERE `id_wishlist` = '.(int)($id));
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist_product` WHERE `id_wishlist` = '.(int)($id));
if (isset($this->context->cookie->id_wishlist))
unset($this->context->cookie->id_wishlist);
 
return (parent::delete());
}
Link to comment
Share on other sites

If I do that the wishlist_email and the wishlist_product works but the wishlist doesn't delete from the database again! 

 

public function delete($id)
{
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist` WHERE `id_wishlist` = '.(int)($id));
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist_email` WHERE `id_wishlist` = '.(int)($id));
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'wishlist_product` WHERE `id_wishlist` = '.(int)($id));
if (isset($this->context->cookie->id_wishlist))
unset($this->context->cookie->id_wishlist);
 
return (parent::delete());
}
Link to comment
Share on other sites

this code is inside the WishList.php(the code is in 74 line) of block of wishlist and in the ajax-wishlist.js i changed the line 199 i cant upload the js file

 

function WishlistDelete(id, id_wishlist, msg)
{
var res = confirm(msg);
if (res == false)
return (false);
 
if (typeof mywishlist_url == 'undefined')
return (false);
 
$.ajax({
type: 'GET',
async: true,
url: baseDir + 'modules/blockwishlist/WishList.php',
cache: false,
data: 'deleted&id_wishlist=' + id_wishlist,
success: function(data)
{
$('#' + id).fadeOut('slow');
}
});
}

WishList.php

Link to comment
Share on other sites

  • 2 weeks later...

Hola veika

 

tengo el mismo problema que te consulta mbt (inicio de este topic)

 

hice lo que dices (crear el /mywishlist.php) pero el problema sigue igual, no deja eliminar la lista de deseos..

 

sabes que puede estar pasando??

 

tengo la v0.10 del bloque wishlist y PS 1.6.0.6

 

Gracias!!

 

 

 

 

 

Link to comment
Share on other sites

I found a way to delete the wish list! I changed the url of the "function WishlistDelete()" in the ajax-wishlist.js of the wishlist block with only " mywishlist_url " before this was " mywishlist_url + '&rand=' + new Date().getTime() " ! If anyone has better idea please answer this topic! Thank you

  • Like 1
Link to comment
Share on other sites

Hi Vekia, I did follow what you said in the previous post but it's not working, I can't delete my wishlist
Prestashop: 1.6.0.6
Wishlist Module: 0.10
Clean install - Default theme
Heres my log:
 

  1. GET http://www.tugabay.com/pt/module/blockwishlist/mywishlist&rand=1400709254376?deleted&id_wishlist=1&_=1400709198588 404 (Not Found) jquery-1.11.0.min.js:4
    1. n.extend.ajaxjquery-1.11.0.min.js:4
    2. WishlistDeleteajax-wishlist.js:254
    3. onclick mywishlist:889

 

 

Can you please help me?

 

PS: This is a clean install, and its already bugged :( I'm very afraid do loose my time with prestashop 1.6
 

Thanks

Link to comment
Share on other sites

It doesn't need to create a new mywishlist !! It is already in the blockwishlist ! try to follow the solution i gave ! Maybe it will work!

 

 

I found a way to delete the wish list! I changed the url of the "function WishlistDelete()" in the ajax-wishlist.js of the wishlist block with only " mywishlist_url " before this was " mywishlist_url + '&rand=' + new Date().getTime() " ! If anyone has better idea please answer this topic! Thank you
  • Like 1
Link to comment
Share on other sites

It doesn't need to create a new mywishlist !! It is already in the blockwishlist ! try to follow the solution i gave ! Maybe it will work!

 

It worked, thanks for your solution and sorry for not seeing your post before,

maybe you should post this solution here: http://forge.prestashop.com/browse/PSCSX-654

there is more people trying to fix this stupid problem <_<

 

thanks again

Edited by ALMAJ (see edit history)
Link to comment
Share on other sites

Hi Vekia, I did follow what you said in the previous post but it's not working, I can't delete my wishlist

Prestashop: 1.6.0.6

Wishlist Module: 0.10

Clean install - Default theme

Heres my log:

 

  1. GET http://www.tugabay.com/pt/module/blockwishlist/mywishlist&rand=1400709254376?deleted&id_wishlist=1&_=1400709198588 404 (Not Found) jquery-1.11.0.min.js:4
    1. n.extend.ajaxjquery-1.11.0.min.js:4
    2. WishlistDeleteajax-wishlist.js:254
    3. onclick mywishlist:889

 

 

Can you please help me?

 

PS: This is a clean install, and its already bugged :( I'm very afraid do loose my time with prestashop 1.6

 

Thanks

 

construction of url is wrong in this case

it looks like:

http://www.tugabay.com/pt/module/blockwishlist/mywishlist&rand=1400709254376?deleted&id_wishlist=1&_=1400709198588 

and it should looks like:

http://www.tugabay.com/pt/module/blockwishlist/mywishlist?rand=1400709254376&deleted&id_wishlist=1&_=1400709198588 

(question mark after mywishlist)

  • Like 1
Link to comment
Share on other sites

I cannot delete wishlists. Neither can I add products to any new wishlist created. Do I just need to replace the mywhishlist.tpl with an updated one inside of my custom theme? I am using default bootstrap as the base with minor tweaks where necessary, on 1.6.06

Link to comment
Share on other sites

I cannot delete wishlists. Neither can I add products to any new wishlist created. Do I just need to replace the mywhishlist.tpl with an updated one inside of my custom theme? I am using default bootstrap as the base with minor tweaks where necessary, on 1.6.06

 

Just follow Vekia's instructions, or use this commit here: https://github.com/PrestaShop/blockwishlist/commit/690272663f8fa03b3582a57b54caedbee24b41ae

 

both solutions works!

 

Regards

Link to comment
Share on other sites

problem is probably related to the differencies between files stored in module directory (original files) and files overrided by your theme.

 

try to create mywishlist.php file in your module directory (original directory)

with contents:

 

<?php
/*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

/* SSL Management */
$useSSL = true;

include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/../../header.php');
include_once(dirname(__FILE__).'/WishList.php');

$context = Context::getContext();
$errors = array();

Tools::displayFileAsDeprecated();

// Instance of module class for translations
$module = new BlockWishList();

if ($context->customer->isLogged())
{
	$add = Tools::getIsset('add');
	$add = (empty($add) === false ? 1 : 0);
	$delete = Tools::getIsset('deleted');
	$delete = (empty($delete) === false ? 1 : 0);
	$id_wishlist = Tools::getValue('id_wishlist');
	if (Tools::isSubmit('submitWishlist'))
	{
		if (Configuration::get('PS_TOKEN_ACTIVATED') == 1 AND
			strcmp(Tools::getToken(), Tools::getValue('token')))
			$errors[] = $module->l('Invalid token', 'mywishlist');
		if (!sizeof($errors))
		{
			$name = Tools::getValue('name');
			if (empty($name))
				$errors[] = $module->l('You must specify a name.', 'mywishlist');
			if (WishList::isExistsByNameForUser($name))
				$errors[] = $module->l('This name is already used by another list.', 'mywishlist');
			
			if(!sizeof($errors))
			{
				$wishlist = new WishList();
				$wishlist->name = $name;
				$wishlist->id_customer = (int)$context->customer->id;
                $wishlist->id_shop = $context->shop->id;
                $wishlist->id_shop_group = $context->shop->id_shop_group;
				list($us, $s) = explode(' ', microtime());
				srand($s * $us);
				$wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true)._COOKIE_KEY_.$context->customer->id), 0, 16));
				$wishlist->add();
				Mail::Send($context->language->id, 'wishlink', Mail::l('Your wishlist\'s link', $context->language->id), 
					array(
					'{wishlist}' => $wishlist->name,
					'{message}' => Tools::getProtocol().htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/blockwishlist/view.php?token='.$wishlist->token),
					$context->customer->email, $context->customer->firstname.' '.$context->customer->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
			}
		}
	}
	else if ($add)
		WishList::addCardToWishlist($context->customer->id, Tools::getValue('id_wishlist'), $context->language->id);
	else if ($delete AND empty($id_wishlist) === false)
	{
		$wishlist = new WishList((int)($id_wishlist));
		if (Validate::isLoadedObject($wishlist))
			$wishlist->delete();
		else
			$errors[] = $module->l('Cannot delete this wishlist', 'mywishlist');
	}
	$context->smarty->assign('wishlists', WishList::getByIdCustomer($context->customer->id));
	$context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($context->customer->id));
}
else
{
	Tools::redirect('index.php?controller=authentication&back=modules/blockwishlist/mywishlist.php');
}

$context->smarty->assign(array(
	'id_customer' => (int)$context->customer->id,
	'errors' => $errors
));

if (Tools::file_exists_cache(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl'))
	$context->smarty->display(_PS_THEME_DIR_.'modules/blockwishlist/mywishlist.tpl');
elseif (Tools::file_exists_cache(dirname(__FILE__).'/views/templates/front/mywishlist.tpl'))
	$context->smarty->display(dirname(__FILE__).'/views/templates/front/mywishlist.tpl');
else
	echo $module->l('No template found', 'mywishlist');

include(dirname(__FILE__).'/../../footer.php');


or download it from http://pastebin.com/nhSDhinY

This is deposited into the prestashop module directory and not into my theme module directory correct?

Link to comment
Share on other sites

Just follow Vekia's instructions, or use this commit here: https://github.com/PrestaShop/blockwishlist/commit/690272663f8fa03b3582a57b54caedbee24b41ae

 

both solutions works!

 

Regards

I used this js commit by making the changes in the root module directory. I deleted the necessary lines and added the new ones. I still get the same results. When I use the delete icon, an alert lets me know I am deleting, however, the list does not get deleted when I use the OK button.

Link to comment
Share on other sites

I used this js commit by making the changes in the root module directory. I deleted the necessary lines and added the new ones. I still get the same results. When I use the delete icon, an alert lets me know I am deleting, however, the list does not get deleted when I use the OK button.

what kind of html editor you use? 

The best way to modifying/editing your files is to download by a FTP program (Filezilla) and open the files with an html editor like Dreamweaver, then upload the file by FTP again.

Edited by ALMAJ (see edit history)
Link to comment
Share on other sites

BlueToastMedia If you have istalled the 1.6.0.6 version you do not need to create new mywishlist.php!! Please try to install this module clear without changes!!! Then go to the root category of your site and find the wishilist module in the modules folder of prestashop! Then finf the js/ajax-wishlist.js and change only the  

 

url: mywishlist_url + '&rand=' + new Date().getTime(),

 

to 

 

url: mywishlist_url, 

 

line 199  !! 

 

edit

 

check the permisions of the module!! (this is the last think you should do!)

Edited by system_error86 (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hello 

 

I have also problems with this module (Version 1.0). I work with new 1.6.0.8. I deleted all theme specific folders. So in fact i work with a clean wishlist-module. I can delete products. But how is it possible to add products on Wishlist number 2?

 

Will there soon be an update? It seems that many people have trouble with this module...

Link to comment
Share on other sites

Do you have set the module in front page like image? if you create two or more wishlists, every time that you want to save a product in one of your wishlists first you must select which whishlist you want to add the product! 

 

Thanks for your image. I dont have such a dropdown option. I customize my template. Where can i find the template for this dropdown menu? I want to add this on the wishlist page...

Link to comment
Share on other sites

It is not a template my friend! This is that you see when you use this module. Do you use the default theme? if you use the default module it is difficult to show up this list! You must change the code of the css and maybe the tpl files! Could you send me a link of your site please?

Link to comment
Share on other sites

It is not a template my friend! This is that you see when you use this module. Do you use the default theme? if you use the default module it is difficult to show up this list! You must change the code of the css and maybe the tpl files! Could you send me a link of your site please?

 

Thanks for your answer. For me it was a template problem, since I never show right column on my template.

 

But the way this works is useless for me. My customer can add products to wishlist only on category page. Its very annoying always to have to chose which wishlist. Should be a function under customer profil, where he can define where products should be added and then its saved until customers changes list again. 

 

But since this wishlist stuff is not very important for me. I will just remove the option to add a second wishlist :)

Link to comment
Share on other sites

  • 1 month later...

problem is probably related to the differencies between files stored in module directory (original files) and files overrided by your theme.

 

try to create mywishlist.php file in your module directory (original directory)

with contents:

 

<?php
... 
...
?>

or download it from http://pastebin.com/nhSDhinY

 

 

I vekia, I have the same problem with module v1.1.1 on PS1.6.0.9, so i tried downloading the missing file, copied it in modules/blocckwishlist folder (not in template folder), but it seem to be the same problem.

 

Maybe now I have to reinstall the module or something else?

Link to comment
Share on other sites

  • 3 months later...

 

Do you know how can I solve this problem in 1.6.0.6? 

I didn't find in any file how to correct this url! 

Link to comment
Share on other sites

×
×
  • Create New...