Jump to content

Recommended Posts

PrestaShop module for blocking user access by asking to provide their age.

It uses prestashop timezone for checking age via Ajax call, uses a cookie to hold the information.

Display a form to request user age verification.

The front-office will display a modal where user can put his own age, if the age is below threshold the access will be allowed.

frontend italianfrontend english

Configurable age threshold

The required age can be configured to meet your requirements

backend configuration

Compatibility

Tested with PrestaShop 1.6.x

 

https://github.com/yuxblank/only18plus

Edited by yuxblank (see edit history)

Share this post


Link to post
Share on other sites

Hi. Thank you for your work.

I have modified the introduction of the Castilian language in the code and the loading of the module works but I have an error:

Accepting the date generates an error by not redirecting to https.

age18a.thumb.jpg.ebabda223b1a3273fe0b340e34d2010c.jpg

 

In the page inspection if the -- <div class="ac-overlay and <div class="ac-container -- corresponding to the module popup is deleted, the web can be accessed normally.

Is it possible to lock the scroll or leave the background in black?

age18b.jpg.104ffae9ba2f2767c3ac0f7d74b4bbc7.jpg

Thanks for everything.

Edited by freiserk (see edit history)

Share this post


Link to post
Share on other sites

The fix for SSL should be easy, maybe by checking if https is enabled and the pass the baseUrl from 

public function hookHeader()

To the template.

Yes the second one can be done of course. Perhaps will be better to check each page refresh by looking for the cookie and the recreate the div container if it's not set.

I'll give a check in spare time.

Edited by yuxblank (see edit history)
  • Thanks 1

Share this post


Link to post
Share on other sites
  • 2 weeks later...

Hello, I would like to know if there is the possibility to match the module "only if a user wants to view a specific category.
Let me explain: in my market I have categories of electronics and categories prohibited to minors. My problem is to block only the access of the "forbidden" section. Thank you

Ermanno Girardi - teknashop

Share this post


Link to post
Share on other sites
  • 2 weeks later...
  • 2 weeks later...
1 hour ago, Soyons zen said:

Hi my friend, Thank you for this sharing that works ps 1.6 ! Does not work on version 1.7.5.1 ?

$this->version = 1.0.0   ??  The activate button does not work
 

 

Umh.. I forgot to change the version number maybe you have to uninstall the older before?.. I tested it with 1.7.5.0

 

here: 

https://github.com/yuxblank/only18plus/blob/dfcfaa2a0afdace242207d2076a1128caf6cb206/only18plus.php#L25

try to set 1.0.1 or whatever 😂

Edited by yuxblank (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

On 1.7.5.1 with php 7.2

 

(1/1) ContextErrorException

Notice: Undefined index: base_dir

in 7a2ce137dfc5bf120088d91e844a37f11b5f7819_2.file.only18plus.modal.tpl.php line 28
at content_5c729a0660e2e0_25061443(object(SmartyDevTemplate))in smarty_template_resource_base.php line 123
at Smarty_Template_Resource_Base->getRenderedTemplateCode(object(SmartyDevTemplate))in smarty_template_compiled.php line 114

Share this post


Link to post
Share on other sites
Justo ahora, Soyons zen dijo:

Hi, yes even on https problem only on version 1.7.5.1
 

Hi.

Yes, I have https, but in 1.6.1.23 it does not work with https either. Does not recognize the date

Share this post


Link to post
Share on other sites
3 hours ago, Soyons zen said:

Hi friend, works fine on 1.6, On version 1.7.5.1 it works now except that the popup comes back

Hi. Thank you. 

I can't reproduce the issue in 1.7.5. Did you can try again by clearing up all the cookies on the browser? The module uses a cookie to hold the information of the approval.

Share this post


Link to post
Share on other sites
12 hours ago, yuxblank said:

Hi. Thank you. 

I can't reproduce the issue in 1.7.5. Did you can try again by clearing up all the cookies on the browser? The module uses a cookie to hold the information of the approval.

Hello, yes, it works now I have to clean the cache

Edited by Soyons zen (see edit history)

Share this post


Link to post
Share on other sites
5 hours ago, Soyons zen said:

Hello, possible that it works with another prestashop theme ?
 

It should work with any template, it has it's own style and scripting and does not depends on any prestashop library (excluding jQuery)

Share this post


Link to post
Share on other sites
On 3/2/2019 at 3:12 PM, Soyons zen said:

Hello, it does not work on the theme that I have, but against the default it works

Can you print the console output of the browser?

Share this post


Link to post
Share on other sites

I check the version and it still says RC1.. upgrade says it works but it doesn't change.. I give up :(

Over one month now I try to find a simple working age plugin. It's never going to happen. So frustrated.

 

Edited by CBDwire (see edit history)

Share this post


Link to post
Share on other sites
hace 5 horas, yuxblank dijo:

Make sure to regenerate smarty cache. 

I clean the smarty cache even manually but nothing.
I continue to generate the error in the ajaxCalls.php file:

Access to XMLHttpRequest at 'httpss: // myhost.com/modules/only18plus/ajaxCalls.php' from origin 'https://myhost.com' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http , data, chrome, chrome-extension, https.
send @ v_50_5b52e8de040a187037133dc20f3c3722.js: 4

If you look at the beginning of the error address it is httpss: //

Thanks.

Share this post


Link to post
Share on other sites
31 minutes ago, freiserk said:

I clean the smarty cache even manually but nothing.
I continue to generate the error in the ajaxCalls.php file:

Access to XMLHttpRequest at 'httpss: // myhost.com/modules/only18plus/ajaxCalls.php' from origin 'https://myhost.com' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http , data, chrome, chrome-extension, https.
send @ v_50_5b52e8de040a187037133dc20f3c3722.js: 4

If you look at the beginning of the error address it is httpss: //

Thanks.

Thank you i'll address the issue.

 

 

Try to replace this:

https://github.com/yuxblank/only18plus/blob/ce129a5f566db9e8a8333f5e7b6fe930ec7be0bb/only18plus.php#L353

 

with:

return _PS_BASE_URL_SSL_;

 

Edited by yuxblank
quick fix (see edit history)

Share this post


Link to post
Share on other sites
  • 3 weeks later...

I used this for a while but then mobile users started complaining they could not get past the verification? Any fix for this?

Really struggling to find a plugin like this that fully works with desktop and mobile.

Thanks for your work.

Share this post


Link to post
Share on other sites
  • 1 year later...
En 5/11/2020 a las 6:32 PM, yuxblank dijo:

Hi all,

i have released a version 1.1 that fixes the issue with url generation with HTTPS

Many thanks, working.

But...

After doing the upgrade it always appears again, it does not update the version in the list of modules.

image.thumb.png.83ee216381ba435c4732bfd0388b894a.png

Thabks.

Share this post


Link to post
Share on other sites
5 minutes ago, freiserk said:

Many thanks, working.

But...

After doing the upgrade it always appears again, it does not update the version in the list of modules.

image.thumb.png.83ee216381ba435c4732bfd0388b894a.png

Thabks.

Thanks for pointing that out. I forgot that PS modules need to handle some tasks manually like updating the version in the actual file. ;) 

  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More