Jump to content
henri

OSC-Affiliate

Recommended Posts

ahhhh,

 

I didn't install oscommerce and thus not kidding. I know it means you have to install a new table in the database. The question is how?

 

Mic

Share this post


Link to post
Share on other sites
ahhhh,

 

I didn't install oscommerce and thus not kidding.  I know it means you have to install a new table in the database.  The question is how?

 

Mic

Use whatever MYSQL Admin DB tool you are most comfortable using ... MySQL CC, PhpMyAdmin, .....

 

/Fred

Share this post


Link to post
Share on other sites

I suggested earlier that we change AFFILIATE_PAYMENT_ORDER_MIN_STATUS not to be a single order status but a comma separeted list of order status. Just status in the comma separated list would generate commission for an affiliate. In order to change that I have identified 6 files to be changed to accomplish that, see below. The changes are minor I think.

 

I have not had a chance to look at the admin configuration part yet but I guess that is the easy part.

 

Please let me know what you think of this.

 

/Fred

 

 

affiliate_sales.php:
old:
   while ($affiliate_sales = tep_db_fetch_array($affiliate_sales_values)) {
     $number_of_sales++;
     if ($affiliate_sales['orders_status_id'] >= AFFILIATE_PAYMENT_ORDER_MIN_STATUS) $sum_of_earnings += $affiliate_sales['affiliate_payment'];
     if (($number_of_sales / 2) == floor($number_of_sales / 2)) {
       echo '          <tr class="productListing-even">';
     } else {
       echo '          <tr class="productListing-odd">';
     }
new:
   $accept_table = split("[,]" , AFFILIATE_PAYMENT_ORDER_MIN_STATUS);
   $order_status = $affiliate_sales['orders_status_id']
   while ($affiliate_sales = tep_db_fetch_array($affiliate_sales_values)) {
     $number_of_sales++;
     if (in_array($order_status, $accept_table)) $sum_of_earnings += $affiliate_sales['affiliate_payment'];
     if (($number_of_sales / 2) == floor($number_of_sales / 2)) {
       echo '          <tr class="productListing-even">';
     } else {
       echo '          <tr class="productListing-odd">';
     }


---

affiliate_summary.php:
old:
 $affiliate_sales_raw = "
	 select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a 
	 left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id=o.orders_id) 
	 where a.affiliate_id = '" . $affiliate_id . "' and o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " 
	 ";
new:
 $affiliate_sales_raw = "
	 select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a 
	 left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id=o.orders_id) 
	 where a.affiliate_id = '" . $affiliate_id . "' and o.orders_status in (" . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . ") 
	 ";

---

admin/affiliate_affiliates.php:
old:
   default:
     if (is_object($aInfo)) {
       $heading[] = array('text' => '<b>' . $aInfo->affiliate_firstname . ' ' . $aInfo->affiliate_lastname . '</b>');

       $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $aInfo->affiliate_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $aInfo->affiliate_id . '&action=confirm') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_AFFILIATE_CONTACT, 'selected_box=affiliate&affiliate=' . $aInfo->affiliate_email_address) . '">' . tep_image_button('button_email.gif', IMAGE_EMAIL) . '</a>');

       $affiliate_sales_raw = "select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id=o.orders_id) where o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " and  affiliate_id = '" . $aInfo->affiliate_id . "'";
       $affiliate_sales_values = tep_db_query($affiliate_sales_raw);
       $affiliate_sales = tep_db_fetch_array($affiliate_sales_values);
new:
   default:
     if (is_object($aInfo)) {
       $heading[] = array('text' => '<b>' . $aInfo->affiliate_firstname . ' ' . $aInfo->affiliate_lastname . '</b>');

       $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $aInfo->affiliate_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_AFFILIATE, tep_get_all_get_params(array('acID', 'action')) . 'acID=' . $aInfo->affiliate_id . '&action=confirm') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_AFFILIATE_CONTACT, 'selected_box=affiliate&affiliate=' . $aInfo->affiliate_email_address) . '">' . tep_image_button('button_email.gif', IMAGE_EMAIL) . '</a>');

       $affiliate_sales_raw = "select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id=o.orders_id) where o.orders_status in (" . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . ") and  affiliate_id = '" . $aInfo->affiliate_id . "'";
       $affiliate_sales_values = tep_db_query($affiliate_sales_raw);
       $affiliate_sales = tep_db_fetch_array($affiliate_sales_values);

---

admin/affiliate_payment.php:
old:
// Select all affiliates who earned enough money since last payment
     $sql="
       SELECT a.affiliate_id, sum(a.affiliate_payment) 
         FROM " . TABLE_AFFILIATE_SALES . " a, " . TABLE_ORDERS . " o 
         WHERE a.affiliate_billing_status != 1 and a.affiliate_orders_id = o.orders_id and o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " and a.affiliate_date <= '" . $oldday . "' 
         GROUP by a.affiliate_id 
         having sum(a.affiliate_payment) >= '" . AFFILIATE_THRESHOLD . "'
       ";
...
// Get all orders which are AFFILIATE_BILLING_TIME days old
       $sql="
       SELECT a.affiliate_orders_id 
         FROM " . TABLE_AFFILIATE_SALES . " a, " . TABLE_ORDERS . " o 
         WHERE a.affiliate_billing_status!=1 and a.affiliate_orders_id=o.orders_id and o.orders_status>=" . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " and a.affiliate_id='" . $affiliate_payment['affiliate_id'] . "' and a.affiliate_date <= '" . $oldday . "'
       ";
new:
// Select all affiliates who earned enough money since last payment
     $sql="
       SELECT a.affiliate_id, sum(a.affiliate_payment) 
         FROM " . TABLE_AFFILIATE_SALES . " a, " . TABLE_ORDERS . " o 
         WHERE a.affiliate_billing_status != 1 and a.affiliate_orders_id = o.orders_id and o.orders_status in (" . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . ") and a.affiliate_date <= '" . $oldday . "' 
         GROUP by a.affiliate_id 
         having sum(a.affiliate_payment) >= '" . AFFILIATE_THRESHOLD . "'
       ";
...
// Get all orders which are AFFILIATE_BILLING_TIME days old
       $sql="
       SELECT a.affiliate_orders_id 
         FROM " . TABLE_AFFILIATE_SALES . " a, " . TABLE_ORDERS . " o 
         WHERE a.affiliate_billing_status!=1 and a.affiliate_orders_id=o.orders_id and o.orders_status in (" . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . ") and a.affiliate_id='" . $affiliate_payment['affiliate_id'] . "' and a.affiliate_date <= '" . $oldday . "'
       ";


---

admin/affiliate_statistics.php:
old:
 $affiliate_sales_raw = "
   select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a 
   left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id=o.orders_id) 
   where a.affiliate_id = '" . $HTTP_GET_VARS['acID'] . "' and o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . "
   ";
new:
 $affiliate_sales_raw = "
   select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a 
   left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id=o.orders_id) 
   where a.affiliate_id = '" . $HTTP_GET_VARS['acID'] . "' and o.orders_status in (" . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . ")
   ";


---

admin/affiliate_summary.php:
old:
 $affiliate_sales_raw = "
           select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a 
           left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id = o.orders_id) 
           where o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " 
           ";
new:
 $affiliate_sales_raw = "
           select count(*) as count, sum(affiliate_value) as total, sum(affiliate_payment) as payment from " . TABLE_AFFILIATE_SALES . " a 
           left join " . TABLE_ORDERS . " o on (a.affiliate_orders_id = o.orders_id) 
           where o.orders_status in (" . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . ") 
           ";
---

Share this post


Link to post
Share on other sites
affiliate_sales.php:

new:

? ?$accept_table = split("[,]" , AFFILIATE_PAYMENT_ORDER_MIN_STATUS);

? ?$order_status = $affiliate_sales['orders_status_id']

? ?while ($affiliate_sales = tep_db_fetch_array($affiliate_sales_values)) {

? ? ?$number_of_sales++;

? ? ?if (in_array($order_status, $accept_table)) $sum_of_earnings += $affiliate_sales['affiliate_payment'];

? ? ?if (($number_of_sales / 2) == floor($number_of_sales / 2)) {

? ? ? ?echo ' ? ? ? ? ?<tr class="productListing-even">';

? ? ?} else {

? ? ? ?echo ' ? ? ? ? ?<tr class="productListing-odd">';

? ? ?}

 

I am sorry. Of course we need to grab order status within the loop .... it should be

 

new:
  $accept_table = split("[,]" , AFFILIATE_PAYMENT_ORDER_MIN_STATUS);
  while ($affiliate_sales = tep_db_fetch_array($affiliate_sales_values)) {
    $number_of_sales++;
    $order_status = $affiliate_sales['orders_status_id']
    if (in_array($order_status, $accept_table)) $sum_of_earnings += $affiliate_sales['affiliate_payment'];
    if (($number_of_sales / 2) == floor($number_of_sales / 2)) {
      echo '          <tr class="productListing-even">';
    } else {
      echo '          <tr class="productListing-odd">';
    }

Share this post


Link to post
Share on other sites

First of all I?d like to thank Henri and Steve for their really great Affiliate-Contrib!!!! It?s simply brilliant!!!

 

After one week of hard work for somenone, who has never learned programming :D , I got the Contrib running under my mixed MS1/MS2-Shop. The forum helped me a lot! So also many thanks to all the users!

 

I will get read til Sunday with the german Language Files for the 2.02-Version.

 

Should I upload the files or better give a download adress? Please give me a suggestion via PM!

 

 

Oliver

Edited by Johnson

Share this post


Link to post
Share on other sites

Sorry! I forgot something important!

 

Farrukh asked on Page 46:

 

"Can you add a functionality regarding signing up for an Affiliate.

 

When a New Affiliate Signs up, the store owner or the email provided in the Admin Section should get an email confirming a new affiliate signup."

 

I search the forum, but I didn?t find any solutions :(

 

Does anyone have an idea?

 

Best regards

 

Oliver

Share this post


Link to post
Share on other sites

Oliver,

 

You should try to make a hack of the existing mod "Control Login" as far as I have seen, the setup of affiliate account is not much different than customer and moreover you decide to allow affiliate to be part of the programm

Share this post


Link to post
Share on other sites
"Can you add a functionality regarding signing up for an Affiliate.

 

When a New Affiliate Signs up, the store owner or the email provided in the Admin Section should get an email confirming a new affiliate signup."

go to the signupscript and send an extra email to the store owner...

one line of code.

Cu Henri

Share this post


Link to post
Share on other sites

Hi Alain,

 

thanks! Good idea! just downloaded! But tomorrow is just another day! ;)

 

Nice weekend to all

 

Oliver

Share this post


Link to post
Share on other sites

Hi guys i did a little hadd-on to improve the OSC Affiliate mod.

 

This one allow you to choose what products shoud be available for your affiliate when they are building links

 

I did this because I didn't want my affiliate to be able to build links for gift vouchers... of course if they are displaying a regular banner and the refferal choose to buy a gift vouvher it won't work but at least they cannot advertise on that...

 

you can find it at: ;)

 

http://www.oscommerce.com/community/contributions,1858

Share this post


Link to post
Share on other sites
how do you change the banner code? well actually how to you add two different types of baner codes? one for web sites and one for forum signatures?

 

<a href="http://www.arresnowboards.com/index.php?ref=1&affiliate_banner_id=2" target="_blank"><img src="http://www.arresnowboards.com/images/2848848_l.gif" border="0" alt="simple"></a>

above is the code for web sites.. but i want to have two feilds one for the above and one that looks like...

 

[url=http://www.arresnowboards.com/index.php?ref=1&affiliate_banner_id=2 target="_blank"][img=http://www.arresnowboards.com/images/2848848_l.gif][/url]

shouldnt be to hard to knock together a new banner file and edit the code to use the BB tags instead of html tags.

Share this post


Link to post
Share on other sites
I really really hope that no one has asked this before.

 

I am currently using OSCAffiliate on a live store. I have quite a few affiliates and everything is working well so far.

 

I stumbled upon the thread for the old affiliate branding contrib and I really like the concept -> I can create a storefront for my affiliates that matches the color scheme and layout of their site. There may be a different subset of products shown on each affiliate storefront. Affiliates get commission when a customer purchases from their storefront.

 

I've seen a virtual mall discussion thread (more like a wishlist) and also an active Shopping Mall contrib thread, but I'm not sure if they do what I want. Does anyone have any idea which contrib(s) I should be using?

 

Please take pity on me. I'm flooded with information and have no way to sort it all out. I have no problem with installing a clean oscommerce and putting a contrib over it, as long as i can port my customer information and products over to the clean version.

Im reviewing some code for a branded affiliate setup, that could work in a similar way to sites like art.com where you can create an affiliate interface.

 

will keep everyone posted.

 

I havent looked at CVS and am not sure how far MS3 is from release so i'll do a bit of research and see if i can schedule some time to do it.

Share this post


Link to post
Share on other sites

hello,

 

Does have anyone have a solution for this one Sorry there are so much answers in this thread, maybe its alreaddy in here):

 

I setup my shop on httpS://secure.mysite.com

the site that sells the products in the shop is located at www.mysite.com

So I setup oscommerce on a subdomain.

 

So far so good for normal oscommerce: when people want to by they are transfered to my secure site.

 

When using the great oscaffiliate I can only setip links directly to my secure site, not the the marketing department on www.mysite.com and that is what i want.

 

What should i do? Set up the shop on www.mysite and only transfer them to the secure part for checking out? How is that done?

Then the affillaite links will direct to my meanwebsite link


Keesjan

Share this post


Link to post
Share on other sites

and one more:

 

the statistics are not good: this is in this tread anywhere but its so long...

when loggid in in admin the are counted 1 from 1 on product x

also for logged in as affilaite .

Is this because I as a only client click from the same IP as the account affilaite is made on?

Anyone?

Edited by helohelo

Keesjan

Share this post


Link to post
Share on other sites

There's actually a few things missing in this contribution. BUT I'm sure they're working with it. B)

 

I'm doing a norwegian translation right now, and have found "fixes" for the things I missed in this tread....Thanks.

 

Things I've noticed:

- Pop-up-help for the page: affiliate_payment.php

- Payment-control for different languages

 

THANKS FOR A GREAT CONTRIBUTION...

Share this post


Link to post
Share on other sites

I'm trying to install osCAffiliate MAX v2.02 but I get this error

 

Fatal error: Failed opening required 'DIR_WS_TEMPLATESTEMPLATENAME_BOX' (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site41/fst/var/www/html/catalog/includes/boxes/affiliate.php on line 47

 

Does anyone know how to fix this error? Thank you.

Share this post


Link to post
Share on other sites

you may want to confirm that the file is present


If it weren't for tweakers, I would not have a job.

Share this post


Link to post
Share on other sites
I'm trying to install osCAffiliate MAX v2.02 but I get this error

 

Fatal error: Failed opening required 'DIR_WS_TEMPLATESTEMPLATENAME_BOX' (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site41/fst/var/www/html/catalog/includes/boxes/affiliate.php on line 47

 

Does anyone know how to fix this error? Thank you.

Theres a MAX version??? who did that?

Share this post


Link to post
Share on other sites

I have discovered a nasty little problem with OSC-AFfiliate and I can't believe no-one has mentioned it before (sorry if you have and I've missed it).

 

I've noticed that a lot of my products listed in search engines have one of my affiliates references in the link, e.g. MSN lists one of my products with the following link: http://.../product_info.php?ref=7&products_id=210&affiliate_banner_id=1

 

This means I've been merrily crediting affiliates for sales they haven't produced. Is there anyway of checking to see if the referrer is a search engine and then change or remove the reference before anything is credited to the wrong person?

 

Your thoughts and help would be appreciated.

Share this post


Link to post
Share on other sites

This means that the spider didn't get your page, but a page of you affiliate.

Your pages shouldn't have an affiliate ref.

Share this post


Link to post
Share on other sites

Here's an example from MSN:

msn.jpg

 

 

The top left is my site (without any affiliate id) so I guess MSN spidered that correctly.

 

The one next to it is also my site but this has an affiliate id - so I guess it was spidered from an affiliate. But the visitor isn't coming from an affiliate so I don't think the affiliate should be credited for the sale. They are not coming from an affiliate banner on an affiliate site so I don't think this is fair (and is potentially costing me a fortune).

 

I wouldn't mind if the search result had taken the visitor to the affiliate site and then the visitor decided to visit my site through a banner but this seems like cutting out the affiliate and still paying them for something they didn't do.

Edited by Cerberus

Share this post


Link to post
Share on other sites

Kevin,

 

I don't see your point!!!

 

First of all the links are not on your site but on your affiliate site... I guess you did your search by giving your domain name so it is pretty normal to see your affiliate links in this case...

 

Then, even if you did not so, your positionning on search engines is related to the links they found on your and other websites. So, what's the deal if you pay commissions for your affiliate when you have an exellent positionning... in fact, you have the best return value you will ever have cause you are paying your affiliate for sales and you are gaining on your search positionning. Some webmasters are dreaming on that...Believe me it is a pretty good deal.

 

As I said, if somebody is clicking on your affiliate links, it is kind of correct to pay for. In fact, this affiliate did his job, by being placed on the search engines...

 

whatever, if you feel to be screwed up by this method I can't do anything for you.

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

×