You are here:  » Shopping List Remove All


Shopping List Remove All

Submitted by Antony on Fri, 2020-04-17 11:06 in

Hi David,

Just wanted to catch up following node/6723 on the Remove All from the shopping list.
The link is actually broken from new instalations of pricetapestry.

The fix on node/6723 works fine so the function can still be used but is it a permanent solution?

Best,

Antony

Submitted by support on Fri, 2020-04-17 11:58

Hi Antony,

It's best to set an expiry date in the past to actually clear the cookie rather than set an empty value - to fix, edit includes/tapestry.php and look for the following code at line 537:

      setcookie(tapestry_shoppingListCookieName(),"");

...and REPLACE with:

      setcookie(tapestry_shoppingListCookieName(),"",strtotime("-1 day"),"/");

(updated in distribution 18/06A)

Cheers,
David.
--
PriceTapestry.com

Submitted by Antony on Fri, 2020-04-17 20:38

Hi David,

thanks for you're response. I actualy have the following from line 537, tried to implement the above in various ways but then the link breaks.

Thanks

{code saved}

Submitted by support on Sat, 2020-04-18 06:55

Hi Antony,

It looks like you have other changes in includes/tapestry.php so rather than line specific within the tapestry_shoppingListRemove() function look for the remove @ALL section as follows (based on the previous fix)...

    if ($_GET["remove"]=="@ALL")
    {
      $shoppinglist = array();
      setcookie(tapestry_shoppingListCookieName(),serialize($shoppingList),strtotime("+90 days"),"/");
    }

...and REPLACE with:

    if ($_GET["remove"]=="@ALL")
    {
      setcookie(tapestry_shoppingListCookieName(),"",strtotime("-1 day"),"/");
    }

(immediately following is the "else" statement leading to the individual product removal code...)

Cheers,
David.
--
PriceTapestry.com

Submitted by Antony on Sat, 2020-04-18 07:28

Thanks David!