WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

Du bist nicht angemeldet.

#1 01.10.2019 02:36:06

losttrip
Mitglied

Data storage / persistence after submitting an order

I'm back!

Having an issue, and am not sure if there is something I am not doing correctly, or if it's just the way the module works.

After adding items to my wish list, sending the form and leaving the site, when I return those items are still in my wish list.  This would suggest that each visitor would have to manually regulate (delete) items from their own list.  Is this how the module is designed to function?

Is so, it is further confusing, if someone adds items to their list and then those items are removed (offline or deleted) from the page, when the visitor returns, the original items are still in their list... even though they don't appear anywhere on the page.  Which means, if you had a little store set up, and used this module, there is no way to stop visitors from sending forms about items you have taken offline.

I'm not suggesting that the module is flawed, I am just curious if this is how the module is designed to act, and if there is any for the list to be automatically adjusted to reflect sent forms or inactive items?

Thank you.

Offline

#2 01.10.2019 15:00:57

losttrip
Mitglied

Re: Data storage / persistence after submitting an order

I'll try to simplify my questions.

How long are the items stored in the visitors "local storage"?

Is there a way to remove them from their local storage after they submit their form?

Is there a way to check for items which have been removed/deleted or switched to inactive on the page, and then remove them from their local storage?

Is there a way to remove items from their local storage after a specified period of time?

Thank you for your time and effort.

Offline

#3 01.10.2019 16:51:23

florian
Administrator

Re: Data storage / persistence after submitting an order

How long are the items stored in the visitors "local storage"?

I don't know whether this data expires somewhen, but it is erased when leaving the website (e.g. change from yourwhishlistwebsite.tld to whatever.tld) and not using the back button, and it's also deleted when closing the browser tab/window.

Is there a way to remove them from their local storage after they submit their form?

Change the default success message of miniform/mpform to a custom success page. On this, you need
- a WYSIWYG section with the text to display to your customers (thank you etc.)
- a merkzettel section
- a code2 section, set to Javascript, with the following code:

mmz_merkzettel = {} ;
mmz_storage_clear();
mmz_merkzettel_close();
$('#minimerkzettel h3.mmz_selected').removeClass('mmz_selected');

Thus the wishlist is erased once the form is submitted. Maybe the last line has to be changed to your custom needs.

Is there a way to check for items which have been removed/deleted or switched to inactive on the page, and then remove them from their local storage?

Afaik: Not out of the box. There is no database which can be easily addressed, it's all Javascript, and the merkzettel does not know what is visible on the site. This would need a kind of connector, which permanently checks for example if a certain string still is in a certain wysiwyg section, or if a certain OfA element is still visible and so on... seems to me quite complicated to build, to be honest.

Is there a way to remove items from their local storage after a specified period of time?

Not build-in, the stored items would need a timestamp, which they currently do not have, so again this would need afaics reworking of the module heavily. (For general information about local storage, see answers on stackoverflow)

Edit: Please notice: I'm neither the developer nor the maintainer of the module. All above are all just my personal guesses and suggestions.

Beitrag geändert von florian (01.10.2019 17:13:46)


Code allein macht nicht glücklich. Jetzt spenden!

Offline

#4 01.10.2019 17:08:09

bernd
Developer

Re: Data storage / persistence after submitting an order

@Florian:

are you sure about this?

I don't know whether this data expires somewhen, but it is erased when leaving the website (e.g. change from yourwhishlistwebsite.tld to whatever.tld) and not using the back button, and it's also deleted when closing the browser tab/window.

You describe the behavior of the sessionstorage, but the mmz are stored in the localstorage which lasts "forever" until it's explicitly deleted either from the software or from the user.


... nein in Europa verwenden wir beim Programmieren nicht € statt $ ...

Offline

#5 01.10.2019 17:13:27

florian
Administrator

Re: Data storage / persistence after submitting an order

hm, yes, you are right. It depends on the privacy settings of the browser. By default, the data is not erased when closing the tab, only if you configure your browser settings in a very restrictive way it behaves like described.


Code allein macht nicht glücklich. Jetzt spenden!

Offline

#6 02.10.2019 00:18:35

losttrip
Mitglied

Re: Data storage / persistence after submitting an order

Florian - Thank you for your workflow to clear the items upon the Form Success Page.  That is helpful.

The more I think about it, the more I would prefer for the Wish list to be cleared when someone leaves the site... or after a specified time.  But maybe that's just my use case.

I don't have any items which are in stock long enough that having a permanent storage on a visitors device would be useful.

Offline

#7 02.10.2019 02:06:53

bernd
Developer

Re: Data storage / persistence after submitting an order

I think Chios intention to use localStorage is based in the word "Merkzettel": put some items on it and they'll be remebered at your next visit on this page. Similar to the "Remember  cart" functionality in some web-shops.

For your special usecase it would be more meanigfull to use sessionStorage instead.
Fortunately localStorage and sessionStorage use the same syntax, so I made you a version which uses sessionStorage, so the data will be deleted when you close the browser(tab).
Please try the attached frontend.js

Maybe it would be worth considering to make this configurable ...


... nein in Europa verwenden wir beim Programmieren nicht € statt $ ...

Offline

Liked by:

florian

#8 02.10.2019 02:39:12

losttrip
Mitglied

Re: Data storage / persistence after submitting an order

Thank you so much, bernd.  Changing to Session storage is helpful for my use.  I am going to try combining it with florians suggestion to see if I can get something usable.

I'm not sure of the accurate meaning of the word "Merkzettel".  Google translate says "Wish List".  But I think one of the reasons I was confused, was that Chio's demo site - https://wbce.at/tpls/unterseiten/znip-merkzettel.php - shows this text:
"Demo: Here there are great things to buy - to strike while the offer lasts! "

To me, "to strike while the offer lasts" suggests that the offer will end.  But if someone has the item on their list, it will always be there.  So, even if the offer ends, the user will be able to send a form requesting that item.  In a real world store environment, with many items/products coming in and out of stock, this persistent storage could be a nightmare for the administrator.

Again, not criticizing, just offering food for thought.

Offline

#9 02.10.2019 02:49:45

bernd
Developer

Re: Data storage / persistence after submitting an order

I see  big_smile
For a not natural german speaker this  sentence is a bit missleading.
This is a common advertising message to increase the interest of the customers tongue and doesn't describe the real functionality of this znip.


... nein in Europa verwenden wir beim Programmieren nicht € statt $ ...

Offline

Fußzeile des Forums

up