Post by hudds-phil » Wed Jul 06, 2016 5:05 am

Hi all,
Im looking for a way to use a banned/block word list for a product option input.
I make custom printed shirts, caps, cups and one of the options is the customer can input a name or phrase.

What I would like to do is stop them inputting words or phrases, this would be in the form of a list of words that is compared against the customers text input.
Is there an extension or something available.

Cheers
Phil
Last edited by hudds-phil on Sat Jul 16, 2016 6:03 pm, edited 1 time in total.

New member

Posts

Joined
Sun Dec 28, 2014 10:28 pm

Post by i2Paq » Thu Jul 07, 2016 3:03 pm

You could post a request in the Commercial Support part of this forum.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by pprmkr » Thu Jul 07, 2016 6:09 pm

Little something to start with:

Edit catalog/controller/checkout/cart.php

Search for:

Code: Select all

foreach ($product_options as $product_option) {
After that add:

Code: Select all

				if ($product_option['type'] == 'textarea') {
					$badwords = array('badword','another_badword','as_many_as_you_like');
					foreach ($badwords as $badword) {
						if (stristr($option[$product_option['product_option_id']], $badword) > '') {
							$json['error']['option'][$product_option['product_option_id']] = $product_option['name'] . ': '. $badword .  ' not allowed!';
						}
					}			
				}

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by cyclops12 » Fri Jul 08, 2016 12:24 am

pprmkr wrote:Little something to start with:

Edit catalog/controller/checkout/cart.php

Search for:

Code: Select all

foreach ($product_options as $product_option) {
After that add:

Code: Select all

				if ($product_option['type'] == 'textarea') {
					$badwords = array('badword','another_badword','as_many_as_you_like');
					foreach ($badwords as $badword) {
						if (stristr($option[$product_option['product_option_id']], $badword) > '') {
							$json['error']['option'][$product_option['product_option_id']] = $product_option['name'] . ': '. $badword .  ' not allowed!';
						}
					}			
				}
That is an excellent little snippet of code pprmkr

Expert Member

Posts

Joined
Sun Sep 27, 2015 1:10 am

Post by hudds-phil » Sun Jul 17, 2016 3:46 am

Hi pprmkr,
Sorry for the late reply.
This works perfect. Thank you very much.

Cheers
Phil

New member

Posts

Joined
Sun Dec 28, 2014 10:28 pm
Who is online

Users browsing this forum: Google [Bot] and 57 guests