Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I've been working with the osC for a while now, but now I'm stuk. I'm not what you would call steddy PHP programmer...

 

When somebody register as a customer, I want them to become an affiliate automaticaly wihtout the need to register as an affiliate. And when they logg in as a customer they get the affiliate menu up and going, wihtout logging in as an affiliate. I would also need the affiliate menu hidden when customer is not logged in. :?

 

If anybody can help me with this I would be greatfull. :bigups:

Jan Vidar

---------------------------

The World is a Strange Place!!

Posted

They would need to agree to be an affiliate before you could make them one, so the affiliate agreement would need to be added to your sign up process.

 

Why would you do this, if I may ask?

[no external urls in signatures please, kthanks]

Posted

1) you don't want every member to be an affiliate automagically

2) you do want to make it so that they don't have to fill out all the information twice

 

I have a hack that, if the user is logged in, will pre-fill most of the affiliate form values with their member record information. PM me if you want to see it.

 

why not automgically have all members affiliates? There is information that you will need from affiliates in addition to that of members. It's easier to integrate the affiliate with prefillthan to hack the crap out of membership to get the additional information (it also allows you the chance to focus on the terms and conditions of affiliates and how it differs from members).

Posted

Two PM's is one too many. :-)

 

The only people that can see the affiliate signup are logged in members...

 

This is done by making the column_left.php or column_right.php use the following:

 

if (tep_session_is_registered('customer_id')) require(DIR_WS_BOXES . 'affiliate.php');

 

Now the only people who can see the affiliate option are those that are logged in.

 

Next, replace affiliate_signup.php with the code below. This calls the account information from the users membership record and fills in the same fields in the affiliate form (saves typing!).

 

<?php

/*

 $Id: affiliate_signup.php,v 1.10 2003/02/19 11:55:03 simarilius Exp $



 OSC-Affiliate



 Contribution based on:



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2002 - 2003 osCommerce



 Released under the GNU General Public License

*/





 require('includes/application_top.php');





 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_AFFILIATE_SIGNUP);



if (!tep_session_is_registered('customer_id')) {

   $navigation->set_snapshot();

   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

 }

 if (isset($HTTP_POST_VARS['action'])) {

   $a_gender = tep_db_prepare_input($HTTP_POST_VARS['a_gender']);

   $a_firstname = tep_db_prepare_input($HTTP_POST_VARS['a_firstname']);

   $a_lastname = tep_db_prepare_input($HTTP_POST_VARS['a_lastname']);

   $a_dob = tep_db_prepare_input($HTTP_POST_VARS['a_dob']);

   $a_email_address = tep_db_prepare_input($HTTP_POST_VARS['a_email_address']);

   $a_company = tep_db_prepare_input($HTTP_POST_VARS['a_company']);

   $a_company_taxid = tep_db_prepare_input($HTTP_POST_VARS['a_company_taxid']);

   $a_payment_check = tep_db_prepare_input($HTTP_POST_VARS['a_payment_check']);

   $a_payment_paypal = tep_db_prepare_input($HTTP_POST_VARS['a_payment_paypal']

);

   $a_payment_bank_name = tep_db_prepare_input($HTTP_POST_VARS['a_payment_bank_

name']);

   $a_payment_bank_branch_number = tep_db_prepare_input($HTTP_POST_VARS['a_paym

ent_bank_branch_number']);

   $a_payment_bank_swift_code = tep_db_prepare_input($HTTP_POST_VARS['a_payment

_bank_swift_code']);

   $a_payment_bank_account_name = tep_db_prepare_input($HTTP_POST_VARS['a_payme

nt_bank_account_name']);

   $a_payment_bank_account_number = tep_db_prepare_input($HTTP_POST_VARS['a_pay

ment_bank_account_number']);

   $a_street_address = tep_db_prepare_input($HTTP_POST_VARS['a_street_address']

);

   $a_suburb = tep_db_prepare_input($HTTP_POST_VARS['a_suburb']);

   $a_postcode = tep_db_prepare_input($HTTP_POST_VARS['a_postcode']);

   $a_city = tep_db_prepare_input($HTTP_POST_VARS['a_city']);

   $a_country=tep_db_prepare_input($HTTP_POST_VARS['a_country']);

   $a_zone_id = tep_db_prepare_input($HTTP_POST_VARS['a_zone_id']);

   $a_state = tep_db_prepare_input($HTTP_POST_VARS['a_state']);

   $a_telephone = tep_db_prepare_input($HTTP_POST_VARS['a_telephone']);

   $a_fax = tep_db_prepare_input($HTTP_POST_VARS['a_fax']);

   $a_homepage = tep_db_prepare_input($HTTP_POST_VARS['a_homepage']);

   $a_password = tep_db_prepare_input($HTTP_POST_VARS['a_password']);



   $error = false; // reset error flag



   if (ACCOUNT_GENDER == 'true') {

     if (($a_gender == 'm') || ($a_gender == 'f')) {

       $entry_gender_error = false;

     } else {

       $error = true;

       $entry_gender_error = true;

     }

   }



   if (strlen($a_firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {

     $error = true;

     $entry_firstname_error = true;

   } else {

     $entry_firstname_error = false;

   }



   if (strlen($a_lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {

     $error = true;

     $entry_lastname_error = true;

   } else {

     $entry_lastname_error = false;

   }



   if (ACCOUNT_DOB == 'true') {

     if (checkdate(substr(tep_date_raw($a_dob), 4, 2), substr(tep_date_raw($a_d

ob), 6, 2), substr(tep_date_raw($a_dob), 0, 4))) {

       $entry_date_of_birth_error = false;

     } else {

       $error = true;

       $entry_date_of_birth_error = true;

     }

   }

 

   if (strlen($a_email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {

     $error = true;

     $entry_email_address_error = true;

   } else {

     $entry_email_address_error = false;

   }



   if (!tep_validate_email($a_email_address)) {

     $error = true;

     $entry_email_address_check_error = true;

   } else {

     $entry_email_address_check_error = false;

   }



   if (strlen($a_street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {

     $error = true;

     $entry_street_address_error = true;

   } else {

     $entry_street_address_error = false;

   }

 

   if (strlen($a_postcode) < ENTRY_POSTCODE_MIN_LENGTH) {

     $error = true;

     $entry_post_code_error = true;

   } else {

     $entry_post_code_error = false;

   } 



   if (strlen($a_city) < ENTRY_CITY_MIN_LENGTH) {

     $error = true;

     $entry_city_error = true;

   } else {

     $entry_city_error = false;

   }



   if (!$a_country) {

     $error = true;

     $entry_country_error = true;

   } else {

     $entry_country_error = false;

   }



   if (ACCOUNT_STATE == 'true') {

     if ($entry_country_error) {

       $entry_state_error = true;

     } else {

       $a_zone_id = 0;

       $entry_state_error = false;

       $check_query = tep_db_query("select count(*) as total from " . TABLE_ZON

ES . " where zone_country_id = '" . tep_db_input($a_country) . "'");

       $check_value = tep_db_fetch_array($check_query);

       $entry_state_has_zones = ($check_value['total'] > 0);

       if ($entry_state_has_zones) {

         $zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " wh

ere zone_country_id = '" . tep_db_input($a_country) . "' and zone_name = '" . te

p_db_input($a_state) . "'");

         if (tep_db_num_rows($zone_query) == 1) {

           $zone_values = tep_db_fetch_array($zone_query);

           $a_zone_id = $zone_values['zone_id'];

         } else {

           $zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " 

where zone_country_id = '" . tep_db_input($a_country) . "' and zone_code = '" . 

tep_db_input($a_state) . "'");

           if (tep_db_num_rows($zone_query) == 1) {

             $zone_values = tep_db_fetch_array($zone_query);

             $a_zone_id = $zone_values['zone_id'];

           } else {

             $error = true;

             $entry_state_error = true;

           }

         }

       } else {

         if (!$a_state) {

           $error = true;

           $entry_state_error = true;

         }

       }

     }

   }



   if (strlen($a_telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {

     $error = true;

     $entry_telephone_error = true;

   } else {

     $entry_telephone_error = false;

   }



   $passlen = strlen($a_password);

   if ($passlen < ENTRY_PASSWORD_MIN_LENGTH) {

     $error = true;

     $entry_password_error = true;

   } else {

     $entry_password_error = false;

   }



   if ($a_password != $a_confirmation) {

     $error = true;

     $entry_password_error = true;

   }



   $check_email = tep_db_query("select affiliate_email_address from " . TABLE_A

FFILIATE . " where affiliate_email_address = '" . tep_db_input($a_email_address)

. "'");

   if (tep_db_num_rows($check_email)) {

     $error = true;

     $entry_email_address_exists = true;

   } else {

     $entry_email_address_exists = false;

   }



   // Check Suburb

   $entry_suburb_error = false;



   // Check Fax

   $entry_fax_error = false;



   if (!affiliate_check_url($a_homepage)) {

     $error = true;

     $entry_homepage_error = true;

   } else {

     $entry_homepage_error = false;

   }



   if (!$a_agb) {

         $error=true;

         $entry_agb_error=true;

   }



   // Check Company 

   $entry_company_error = false;

   $entry_company_taxid_error = false;



   // Check Payment

   $entry_payment_check_error = false;

   $entry_payment_paypal_error = false;

   $entry_payment_bank_name_error = false;

   $entry_payment_bank_branch_number_error = false;

   $entry_payment_bank_swift_code_error = false;

   $entry_payment_bank_account_name_error = false;

   $entry_payment_bank_account_number_error = false;



   if (!$error) {



     $sql_data_array = array('affiliate_firstname' => $a_firstname,

                             'affiliate_lastname' => $a_lastname,

                             'affiliate_email_address' => $a_email_address,

                             'affiliate_payment_check' => $a_payment_check,

                             'affiliate_payment_paypal' => $a_payment_paypal,

                             'affiliate_payment_bank_name' => $a_payment_bank_n

ame,

                             'affiliate_payment_bank_branch_number' => $a_payme

nt_bank_branch_number,

                             'affiliate_payment_bank_swift_code' => $a_payment_

bank_swift_code,

                             'affiliate_payment_bank_account_name' => $a_paymen

t_bank_account_name,

                             'affiliate_payment_bank_account_number' => $a_paym

ent_bank_account_number,

                             'affiliate_street_address' => $a_street_address,

                             'affiliate_postcode' => $a_postcode,

                             'affiliate_city' => $a_city,

                             'affiliate_country_id' => $a_country,

                             'affiliate_telephone' => $a_telephone,

                             'affiliate_fax' => $a_fax,

                             'affiliate_homepage' => $a_homepage,

                             'affiliate_password' => tep_encrypt_password($a_pa

ssword),

                             'affiliate_agb' => '1');



     if (ACCOUNT_GENDER == 'true') $sql_data_array['affiliate_gender'] = $a_gen

der;

     if (ACCOUNT_DOB == 'true') $sql_data_array['affiliate_dob'] = tep_date_raw

($a_dob);

     if (ACCOUNT_COMPANY == 'true') {

       $sql_data_array['affiliate_company'] = $a_company;

       $sql_data_array['affiliate_company_taxid'] = $a_company_taxid;

     }

     if (ACCOUNT_SUBURB == 'true') $sql_data_array['affiliate_suburb'] = $a_sub

urb;

     if (ACCOUNT_STATE == 'true') {

       if ($a_zone_id > 0) {

         $sql_data_array['affiliate_zone_id'] = $a_zone_id;

         $sql_data_array['affiliate_state'] = '';

       } else {

         $sql_data_array['affiliate_zone_id'] = '0';

         $sql_data_array['affiliate_state'] = $a_state;

       }

     }



     $sql_data_array['affiliate_date_account_created'] = 'now()';

     $sql_data_array['member_id'] = $customer_id;



     tep_db_perform(TABLE_AFFILIATE, $sql_data_array);



     $affiliate_id = tep_db_insert_id();



     $aemailbody = MAIL_AFFILIATE_HEADER . "n"

                 . MAIL_AFFILIATE_ID . $affiliate_id . "n"

                 . MAIL_AFFILIATE_USERNAME . $a_email_address . "n"

                 . MAIL_AFFILIATE_PASSWORD . $a_password . "nn"

                 . MAIL_AFFILIATE_LINK

                 . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE . "nn"

                 . MAIL_AFFILIATE_FOOTER;

     tep_mail($a_firstname . ' ' . $a_lastname, $a_email_address, MAIL_AFFILIAT

E_SUBJECT, nl2br($aemailbody), STORE_OWNER, AFFILIATE_EMAIL_ADDRESS);

   

     tep_session_register('affiliate_id');

     $affiliate_email = $a_email_address;

     $affiliate_name = $a_firstname . ' ' . $a_lastname;

     tep_session_register('affiliate_email');

     tep_session_register('affiliate_name');

     tep_redirect(tep_href_link(FILENAME_AFFILIATE_SIGNUP_OK, '', 'SSL'));

   }

 }



 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_AFFILIATE_SIGNUP, '', 'S

SL'));





 $account_query = tep_db_query("select c.customers_gender, c.customers_firstnam

e, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_com

pany, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.

entry_zone_id, a.entry_state, a.entry_country_id, c.customers_telephone, c.custo

mers_fax, c.customers_newsletter from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRE

SS_BOOK . " a where c.customers_id = '" . $customer_id . "' and a.customers_id =

c.customers_id and a.address_book_id = '" . $customer_default_address_id . "'")
;

 $account = tep_db_fetch_array($account_query);



if (isset($account['customers_lastname'])) {

   $a_gender = tep_db_prepare_input($account['customers_gender']);

   $a_firstname = tep_db_prepare_input($account['customers_firstname']);

   $a_lastname = tep_db_prepare_input($account['customers_lastname']);

   $a_dob = tep_db_prepare_input($account['customers_dob']);

   $a_email_address = tep_db_prepare_input($account['customers_email_address'])
;

   $a_company = tep_db_prepare_input($account['entry_company']);

   $a_street_address = tep_db_prepare_input($account['entry_street_address']);

   $a_suburb = tep_db_prepare_input($account['entry_suburb']);

   $a_postcode = tep_db_prepare_input($account['entry_postcode']);

   $a_city = tep_db_prepare_input($account['entry_city']);

   $a_country=tep_db_prepare_input($account['entry_country_id']);

   $a_zone_id = tep_db_prepare_input($account['entry_zone_id']);

   $a_state = tep_db_prepare_input($account['entry_state']);

   $a_telephone = tep_db_prepare_input($account['customers_telephone']);

   $a_fax = tep_db_prepare_input($account['customers_fax']);

}





?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; 

?>">

<title><?php echo TITLE ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) .

DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin

="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->



<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

 <tr>

   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<

?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

   </table></td>

<!-- body_text //-->

   <td width="100%" valign="top"><?php echo tep_draw_form('affiliate_signup',  

tep_href_link(FILENAME_AFFILIATE_SIGNUP, '', 'SSL'), 'post', 'onSubmit="return c

heck_form();"') . tep_draw_hidden_field('action', 'process'); ?><table border="0

" width="100%" cellspacing="0" cellpadding="0">

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

         <tr>

           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IM

AGES . 'table_background_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADI

NG_IMAGE_HEIGHT); ?></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></

td>

     </tr>

     <tr>

       <td>

<?php

 if (isset($HTTP_GET_VARS['affiliate_email_address'])) $a_email_address = tep_d

b_prepare_input($HTTP_GET_VARS['affiliate_email_address']);

 $affiliate['affiliate_country_id'] = STORE_COUNTRY;



 require(DIR_WS_MODULES . 'affiliate_account_details.php');

?>

       </td>

     </tr>

     <tr>

       <td align="right" class="main"><br><?php echo tep_image_submit('button_c

ontinue.gif', IMAGE_BUTTON_CONTINUE); ?></td>

     </tr>

   </table></form></td>

<!-- body_text_eof //-->

   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<

?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

   </table></td>

 </tr>

</table>

<!-- body_eof //-->



<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Now me, I'm just the kind of nutcase that doesn't like to give my profits away (and considering that 10 days after opening Education 4 Kids store I was on page 1 of google for all pertinant searches, it's not like I *need* to give up my rather slim margins for traffic). So, rather than giving payout options I am working on a piece that will generate the payout in gift voucher format (so they spend it on the store and I get some of my profits back). That means that I also have to disallow the associate from getting associate fees when purchasing from their own account (and disallow associate fees on the purchase of gift vouchers as well).

 

Now for those looking to pir off the system, there is still a way. The member can create a second member account with a different e-mail and then e-mail the GV to the other account and spend it after coming in via the associate link on the first account... I'm still trying to figure out a way to set it up so that GV earned as a associate can not be transferred...

  • 1 month later...
Posted

If every member is an affiliate, we're half way to giving them Reward Points for use in the shop.

 

I am after a contrib or the knowledge how to set up my store so that when someone makes a purchase, they get Reward Cash (% based) added to their account. Then I need to be able to allow the person to use their reward cash towards future purchases.

 

Would additionly think it would rock to give people reward cash to drive users to the site. Would help for advertising.. and people would get something back, encouraging them to pass the word around about your site.

Posted

Rewards programs and affiliate programs are very different and operate in different ways. You don't want to use one for the other. There are some threads that discuss points programs or cash incentives. A better thing to do is use the Gift Voucher/Discount Coupon contrib and try to modify that.

 

I'm sure eventually someone will actually come up with a points/reward contribution. They actually only *really* work when they can earn points or rewards at more than one store, like a group of your own stores or a co-op of stores.

 

An example of an organization that awards points for many stores is http://club-mom.com They don't have thier own store. Also eBay has launched a points/rewards program also.

[no external urls in signatures please, kthanks]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...