Post by BellaBella » Fri Sep 13, 2013 5:18 am

Hello! I've been getting the hang of this, but I am recently stuck on this one annoying bit. I have no idea where to find the code to change a field to being required.

I want to make "Website" required on my Affiliate Registration Form, just the same as First Name, Last Name, etc. How do I do this? Where do I go to find the code to edit? But first, is it even possible?
Image

Please help ???

Change Star Ratings to Hearts


User avatar
Newbie

Posts

Joined
Fri Mar 22, 2013 9:11 am
Location - Racine, WI

Post by BellaBella » Sat Sep 14, 2013 12:17 am

Help please?

Change Star Ratings to Hearts


User avatar
Newbie

Posts

Joined
Fri Mar 22, 2013 9:11 am
Location - Racine, WI

Post by ocmta » Sat Sep 14, 2013 2:43 am

First of all, required or not, openCart does not even save affiliate website information. You'll need a fix like the one in the attachment for that.

Then, the easier way to make it required would by editing the template and adding some javascript. Open catalog/view/theme/default/template/affiliate/register.php, find this:

Code: Select all

<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
and replace with this:

Code: Select all

<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" onsubmit="javascript:if($('input[name=\'website\']').val().length < 4){alert('Website required!');return false;}">
Also, to get a star symbol, find:

Code: Select all

<td><?php echo $entry_website; ?></td>
and replace with:

Code: Select all

<td><span class="required">*</span> <?php echo $entry_website; ?></td>
Now, this won't give you similar processing as with other required fields, similar processing would involve adding or changing a lot of code in several different files. With the code above form just won't submit without website.

Attachments

Affiliate Website Fix


Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am


Post by BellaBella » Thu Sep 26, 2013 12:22 am

ocmta wrote:First of all, required or not, openCart does not even save affiliate website information. You'll need a fix like the one in the attachment for that.

Then, the easier way to make it required would by editing the template and adding some javascript. Open catalog/view/theme/default/template/affiliate/register.php, find this:

Code: Select all

<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
and replace with this:

Code: Select all

<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" onsubmit="javascript:if($('input[name=\'website\']').val().length < 4){alert('Website required!');return false;}">
Also, to get a star symbol, find:

Code: Select all

<td><?php echo $entry_website; ?></td>
and replace with:

Code: Select all

<td><span class="required">*</span> <?php echo $entry_website; ?></td>
Now, this won't give you similar processing as with other required fields, similar processing would involve adding or changing a lot of code in several different files. With the code above form just won't submit without website.
Ocmta, by similar processing do you mean, it won't show up when I receive the form or that it won't remain in my Admin Affiliate panel? If it's the latter, I can deal with that. I would just keep an off site database of the list of affiliate/websites. I just wanted a way to be able to view the site to ensure my affiliate banners won't be placed on any websites that violate my policies (like adult sites). Thanks so much for the info!

Change Star Ratings to Hearts


User avatar
Newbie

Posts

Joined
Fri Mar 22, 2013 9:11 am
Location - Racine, WI

Post by ocmta » Thu Sep 26, 2013 12:35 am

It will show up in the form and in admin (with the fix i attached in previous message). By similar processing i just mean error processing - it if they try to submit the form with empty website, it just won't submit, while with other fields, it will submit, but will not save and will reload with error messages under input boxes.

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am


Post by BellaBella » Thu Sep 26, 2013 10:41 pm

ocmta wrote:It will show up in the form and in admin (with the fix i attached in previous message). By similar processing i just mean error processing - it if they try to submit the form with empty website, it just won't submit, while with other fields, it will submit, but will not save and will reload with error messages under input boxes.
Thank you so much ocmta! You've solved my issue! I will be purchasing your Customer & Affiliate Combined extension when we get closer to launching. You're an angel! :)

Change Star Ratings to Hearts


User avatar
Newbie

Posts

Joined
Fri Mar 22, 2013 9:11 am
Location - Racine, WI
Who is online

Users browsing this forum: Ahrefs [Bot], Majestic-12 [Bot] and 36 guests