Jump to content
henri

OSC-Affiliate

Recommended Posts

Addition to my previous post,

the error is generated by the following line:

  $affiliate_query = tep_db_query("SELECT affiliate_rgt, affiliate_lft, affiliate_root  FROM (" . TABLE_AFFILIATE . ") WHERE affiliate_id = '" . $affiliate_id . "' ");

in the function, which is in file affiliate_functions.php:

 

function affiliate_delete ($affiliate_id) {
  $affiliate_query = tep_db_query("SELECT affiliate_rgt, affiliate_lft, affiliate_root  FROM (" . TABLE_AFFILIATE . ") WHERE affiliate_id = '" . $affiliate_id . "' ");
  if ($affiliate = tep_db_fetch_array($affiliate_query)) {
 if ($affiliate['affiliate_root'] == $affiliate_id) {
   // a root entry is deleted -> his childs get root
   $affiliate_child_query = tep_db_query("
				 SELECT aa1.affiliate_id, aa1.affiliate_lft, aa1.affiliate_rgt,  COUNT(*) AS level
				   FROM affiliate_affiliate AS aa1, affiliate_affiliate AS aa2
				   WHERE aa1.affiliate_root = " . $affiliate['affiliate_root'] . " 
						 AND aa2.affiliate_root = aa1.affiliate_root 
						 AND aa1.affiliate_lft BETWEEN aa2.affiliate_lft AND aa2.affiliate_rgt
						 AND aa1.affiliate_rgt BETWEEN aa2.affiliate_lft AND aa2.affiliate_rgt
				   GROUP BY aa1.affiliate_id, aa1.affiliate_lft, aa1.affiliate_rgt
				 HAVING level = 2
				   ORDER BY aa1.affiliate_id
				");
   tep_db_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE");  
   while ($affiliate_child = tep_db_fetch_array($affiliate_child_query)) {
	 tep_db_query ("UPDATE  " . TABLE_AFFILIATE . " SET affiliate_root = " . $affiliate_child['affiliate_id'] . " WHERE affiliate_root =  " . $affiliate['affiliate_root'] . "  AND affiliate_lft >= " . $affiliate_child['affiliate_lft']  . " AND affiliate_rgt <= " . $affiliate_child['affiliate_rgt']  . " "); 
	 $substract =  $affiliate_child['affiliate_lft'] -1;
	 tep_db_query ("UPDATE  " . TABLE_AFFILIATE . " SET affiliate_lft = affiliate_lft - " . $substract . " WHERE  affiliate_root = " . $affiliate_child['affiliate_id']);
	 tep_db_query ("UPDATE  " . TABLE_AFFILIATE . " SET affiliate_rgt = affiliate_rgt - " . $substract . " WHERE  affiliate_root = " . $affiliate_child['affiliate_id']);
   }
   tep_db_query("DELETE FROM " . TABLE_AFFILIATE . "  WHERE affiliate_id = " . $affiliate_id);
   tep_db_query("UNLOCK TABLES");
 } else {
   tep_db_query("LOCK TABLES " . TABLE_AFFILIATE . " WRITE");  
   tep_db_query("DELETE FROM " . TABLE_AFFILIATE . "  WHERE affiliate_id = " . $affiliate_id . " AND affiliate_root = " . $affiliate['affiliate_root'] . " ");

   tep_db_query("UPDATE " . TABLE_AFFILIATE . " 
			   SET affiliate_lft = affiliate_lft -1, affiliate_rgt=affiliate_rgt-1
				 WHERE affiliate_lft BETWEEN " . $affiliate['affiliate_lft'] . " and " . $affiliate['affiliate_rgt'] . "
				 AND affiliate_root =  " . $affiliate['affiliate_root'] . " 
			 ");
   tep_db_query("UPDATE " . TABLE_AFFILIATE . " 
				 SET affiliate_lft = affiliate_lft-2
				 WHERE affiliate_lft > " . $affiliate['affiliate_rgt'] . "
				 AND affiliate_root =  " . $affiliate['affiliate_root'] . " 
			  ");
   tep_db_query("UPDATE " . TABLE_AFFILIATE . " 
				 SET affiliate_rgt = affiliate_rgt-2
			   WHERE affiliate_rgt > " . $affiliate['affiliate_rgt'] . "
			   AND affiliate_root =  " . $affiliate['affiliate_root'] . " 
			  ");
   tep_db_query("UNLOCK TABLES");
 }
  }
}

 

Does anyone have ideas how to solve this issue?

 

Alex

 

Issue resolved.

 

Alex

Share this post


Link to post
Share on other sites

I am trying to add some code to get it to work with flash now but just got one question, what is:

case 1: and case 2: in affiliate_banners_category.php, affiliate_banners_product.php and affiliate_banners_banners.php?

It only uses case 2 all the time, why?

 

Also does the category links work with the "BUG Fixes OSC Affiliate v2.62" version?

Edited by Dennis_gull

Share this post


Link to post
Share on other sites

Hello,

 

Ive just installed the oscaffiliate, I have 2 problems if someone could please help me. When in Admin Affiliate Banner Manager, I click "browse" to upload the image, then click "insert" I get this lovely error:

 

1054 - Unknown column 'affiliate_category_id' in 'field list'

 

insert into affiliate_banners (affiliate_banners_title, affiliate_products_id, affiliate_category_id, affiliate_banners_image, affiliate_banners_group, affiliate_date_added, affiliate_status) values ('Affiliate', '0', '0', '480.GIF', '', now(), '1')

 

[TEP STOP]

 

The contribution installed just nicely until I tried to run this:

 

INSERT INTO affiliate_payment_status VALUES (0, 1, 'Pending');

INSERT INTO affiliate_payment_status VALUES (1, 1, 'Paid');

 

 

INSERT INTO configuration_group VALUES (900, 'Affiliate Program', 'Options for the Affiliate Program', 50, 1);

INSERT INTO configuration VALUES ('','E-Mail Address', 'AFFILIATE_EMAIL_ADDRESS', '<affiliate@localhost.com>', 'The E Mail Address for the Affiliate Program', 900, 1, NULL, now(), NULL, NULL);

INSERT INTO configuration VALUES ('','Affiliate Pay Per Sale Payment % Rate', 'AFFILIATE_PERCENT', '10.0000', 'Percentage Rate for the Affiliate Program', 900, 2, NULL, now(), NULL, NULL);

INSERT INTO configuration VALUES ('','Payment Threshold', 'AFFILIATE_THRESHOLD', '50.00', 'Payment Threshold for paying affiliates', 900, 3, NULL, now(), NULL, NULL);

INSERT INTO configuration VALUES ('','Cookie Lifetime', 'AFFILIATE_COOKIE_LIFETIME', '7200', 'How long does the click count (seconds) if customer comes back', 900, 4, NULL, now(), NULL, NULL);

INSERT INTO configuration VALUES ('','Billing Time', 'AFFILIATE_BILLING_TIME', '30', 'Orders billed must be at least "30" days old.<br>This is needed if a order is refunded', 900, 5, NULL, now(), NULL, NULL);

INSERT INTO configuration VALUES ('','Order Min Status', 'AFFILIATE_PAYMENT_ORDER_MIN_STATUS', '3', 'The status an order must have at least, to be billed', 900, 6, NULL, now(), NULL, NULL);

INSERT INTO configuration VALUES ('','Pay Affiliates with check', 'AFFILIATE_USE_CHECK', 'true', 'Pay Affiliates with check', 900, 7, NULL, now(), NULL,'tep_cfg_select_option(array(\'true\', \'false\'), ');

INSERT INTO configuration VALUES ('','Pay Affiliates with PayPal', 'AFFILIATE_USE_PAYPAL', 'true', 'Pay Affiliates with PayPal', 900, 8, NULL, now(), NULL,'tep_cfg_select_option(array(\'true\', \'false\'), ');

INSERT INTO configuration VALUES ('','Pay Affiliates by Bank', 'AFFILIATE_USE_BANK', 'true', 'Pay Affiliates by Bank', 900, 9, NULL, now(), NULL,'tep_cfg_select_option(array(\'true\', \'false\'), ');

INSERT INTO configuration VALUES ('','Individual Affiliate Percentage', 'AFFILATE_INDIVIDUAL_PERCENTAGE', 'true', 'Allow per Affiliate provision', 900, 10, NULL, now(), NULL,'tep_cfg_select_option(array(\'true\', \'false\'), ');

INSERT INTO configuration VALUES ('','Use Affiliate-tier' , 'AFFILATE_USE_TIER', 'false', 'Multilevel Affiliate provisions', 900, 11, NULL, now(), NULL,'tep_cfg_select_option(array(\'true\', \'false\'), ');

INSERT INTO configuration VALUES ('','Number of Tierlevels', 'AFFILIATE_TIER_LEVELS', '0', 'Number of Tierlevels', 900, 12, NULL, now(), NULL, NULL);

INSERT INTO configuration VALUES ('','Percentage Rate for the Tierlevels', 'AFFILIATE_TIER_PERCENTAGE', '8.00;5.00;1.00', 'Percent Rates for the tierlevels<br>Example: 8.00;5.00;1.00', 900, 13, NULL, now(), NULL, NULL);

INSERT INTO configuration VALUES ('','Affiliate News', 'MAX_DISPLAY_AFFILIATE_NEWS', '3', 'Maximum number of items to display on the Affiliate News page', 900, 14, NULL, now(), NULL, NULL);

ALTER TABLE `affiliate_banners` ADD `affiliate_category_id` INT DEFAULT '0' NOT NULL AFTER `affiliate_products_id` ;

 

 

I got the SQL duplicate error? Could this be the reason why Im getting the error when I try to upload a banner through the banner manager?

 

How do I get the myadmin to accept the SQL code above?

 

 

 

Thanks

Share this post


Link to post
Share on other sites

I for got to post the SQL error I got when I tried to run the above code for the first 2 lines I get this error:

 

Error

SQL query:

 

INSERT INTO affiliate_payment_status

VALUES ( 0, 1, 'Pending' ) ;

 

MySQL said:

 

#1062 - Duplicate entry '0-1' for key 1

 

For the rest of it I get this error:

 

SQL query:

 

INSERT INTO configuration_group

VALUES ( 900, 'Affiliate Program', 'Options for the Affiliate Program', 50, 1 ) ;

 

 

 

MySQL said:

 

#1062 - Duplicate entry '900' for key 1

 

I looked for the 900 value in myadmin under Configuration Group, configuration_group_id and its Affiliate Program.

Edited by Ausgirl

Share this post


Link to post
Share on other sites

Hmm I just tried my category links and they work fine..

But how can conversion be over 100%? isnt 100% max? :wacko:

 

Conversions: represents the percentage of visitors (click-throughs) completing a transaction.

 

My conversions is at the moment (on the test server) 107% wouldnt 7% be more like it?

Edited by Dennis_gull

Share this post


Link to post
Share on other sites

Searching through the forum, This seems to be a common problem with oscaffiliate. Surely those of you that have encountered this problem could be kind enough to post the FIX! Ive installed the oscaffiliatev2.6.

 

Surely someone can help me. :'(

 

when i upload the SQL file through phpadmin

This error msg pop out ..

 

 

CODE

SQL query:

 

INSERT INTO configuration_group

VALUES ( 900, 'Affiliate Program', 'Options for the Affiliate Program', 50, 1 );

 

MySQL said: Documentation

#1062 - Duplicate entry '900' for key 1

 

 

How can it duplicate when its the first time it has been installed????

 

When I click the insert banner, I get this:

 

 

CODE

1054 - Unknown column 'affiliate_category_id' in 'field list'

 

insert into affiliate_banners (affiliate_banners_title, affiliate_products_id, affiliate_category_id, affiliate_banners_image, affiliate_banners_group, affiliate_date_added, affiliate_status) values ('test', '0', '0', '480.GIF', '', now(), '1')

 

 

[TEP STOP]

Share this post


Link to post
Share on other sites

you dont have the affiliate sql information in the db so when you try to insert a new banner the site wont find the affiliate_category_id table information. I have no idea why it said "#1062 - Duplicate entry '900' for key 1" though. Look at the table in the db and see if something is wrong..

Share this post


Link to post
Share on other sites

Hi Dennis,

 

I checked the database and the 900 table ID comes up with affiliate so I dont how that happens to say duplicate given it was the first time I ever installed it.

 

I know what the 1054 error means, I dont know why its stating that its not there when I installed the SQL. (I did have touble with the Alter Tables as I stated in the above thread) I will try installing just this bit hopefully its the right bit:

 

ALTER TABLE `affiliate_banners` ADD `affiliate_category_id` INT DEFAULT '0' NOT NULL AFTER `affiliate_products_id` ;

 

Unless someone can post the bit of code I am missing would be appreciated. :)

Share this post


Link to post
Share on other sites
ALTER TABLE `affiliate_banners` ADD `affiliate_category_id` INT DEFAULT '0' NOT NULL AFTER `affiliate_products_id` ;

 

:)

 

That worked. Just added the above code to the DB. :)

Share this post


Link to post
Share on other sites

In Admin, my heading looks like this:

 

TABLE_HEADING_AFFILIATE_NEWS

 

How do I get it to look like this:

 

TABLE HEADING AFFILIATE NEWS

 

Is there something in the english file that needs editing? If so what and where, please,

 

Thanks

Share this post


Link to post
Share on other sites

It shouldnt look like TABLE HEADING AFFILIATE NEWS :)

 

In your language folder inside the affiliate_news.php you add:

define('TABLE_HEADING_AFFILIATE_NEWS', 'Affiliate News');

Share this post


Link to post
Share on other sites

Im not quite understanding how the "Payment" side of it works, if someone could please explain? I signed up as an affiliate, bought some products ect... I then went into the "Payment" Section on the Admin side, but none of this information is there so how do I start billing in order to pay? Affiliate Payment (excl.) Payment (incl.) Date Billed Status Action.

 

I assume the start billing is so I can pay the affiliates. Where do I find the payment options? Paid by Paypal, Bank deposit ect...

Share this post


Link to post
Share on other sites

Hi all! :)

 

Firstly I am a windows / asp user and this is my first foray into linux / php so please be kind to me :rolleyes:

 

I have installed oscommerce but not in the root dir, but a dir called oscommerce so to get to osCommerce the url is http://www.mysite.com/osCommerce

 

The little affiliate box shows on the front page of the shopping site, so I got that right!!!!

 

But, if I click on any of those links FAQs, Information, Login, I get errors like this:

 

Warning: main(includes/languages/english/affiliate_affiliate.php): failed to open stream: No such file or directory in /home/content/l/i/n/lintangbuana/html/oscommerce/catalog/affiliate_affiliate.php on line 45

 

OR

 

Fatal error: main(): Failed opening required 'includes/languages/english/affiliate_info.php' (include_path='.:/usr/local/lib/php') in /home/content/l/i/n/lintangbuana/html/oscommerce/catalog/affiliate_info.php on line 18

 

As the same kind of error comes up for each page, I know it can be easliy solved through a line in an inc file but I am not too sure which file and how to do it!

 

I have played with the line in the application_top.php file that is like this:

 

// Include OSC-AFFILIATE
 require(DIR_WS_INCLUDES . 'affiliate_application_top.php');

 

and have tried the following versions one at a time

 

 require(DIR_WS_INCLUDES . 'affiliate_application_top.php');
 require(DIR_WS_INCLUDES . 'includes/affiliate_application_top.php');
 require(DIR_WS_INCLUDES . 'affiliate_application_top.php');
 require('affiliate_application_top.php');
 require('catalog/includes/affiliate_application_top.php'); 
 require('oscommerce/catalog/includes/affiliate_application_top.php');

 

and by using the bottom one got rid of the errors, only to get the follwoing error

 

Warning: main(oscommerce/catalog/includes/application_top.php): failed to open stream: No such file or directory in /home/content/l/i/n/lintangbuana/html/oscommerce/catalog/affiliate_info.php on line 16

 

Fatal error: main(): Failed opening required 'oscommerce/catalog/includes/application_top.php' (include_path='.:/usr/local/lib/php') in /home/content/l/i/n/lintangbuana/html/oscommerce/catalog/affiliate_info.php on line 16

 

I have checked and there is a file in the dir oscommerce/catalog/includes/application_top.php'

 

I know there is an easy way to fix this - could some kind soul let me know which files to change and how construct the paths so they can find the files?

 

Thank you for your time :D

Share this post


Link to post
Share on other sites

Could someone please explain to me what the Affiliate Tier Multilevel Affiliate provisions, is, please. Is this a referal from an affiliate? How exactly does it work? What is this % rate? Is that the % they are paid?

Share this post


Link to post
Share on other sites

I've downloaded a couple of versions and neither have intructions. Can someone tell me which version is best to use?

Share this post


Link to post
Share on other sites

They have instructions on how to install, just no instructions on how it works. Im still waiting for a reply to my last post. What is the teir level and how does it work. Im assuming its if someone signs up then they get someone else to sign up ect... Some simple instructions wouldnt go astray if someone whom already knows how this works could include them in the file or post it here. This mod is a bit tricky to understand.

 

I think this is a bit of a ghost thread :ph34r:

 

I downloaded and am using the oscaffiliate v2.6

Share this post


Link to post
Share on other sites

Affiliate Tier Levels work like this.

 

1. You decide how many Tiers you want and input that into the Affiliate Configuration settings - minimum is 2, because 1 exists before you use Tiers.

2. You have to elect to use Tiers and set that in those same settings.

3. Let's say you pay 10% at the 1st level and 5% at the 2nd level - someone comes via an existing Affiliate and sign up themselves as an affiliate. Each sale made by them costs you 15% - 10% going to the new Affiliate and 5% going to the referring Affiliate.

4. The ony way of tracking what's happening with these sales is to manually match up the payments of 5% to the original affiliate with the sales made by the new affiliate.

5. This isn't time limited e.g. the original affiliate gets the added 5% forever on sales made by the new affiliate.

 

One thing that may confuse you, as you set your percentage levels for the different affiliate Tiers, is who exactly is an affiliate Tier 1 and Tier 2 affiliate? Neither are. It's the payments that are Tier 1 and 2. The Tier 2 payment goes to the original affiliate, as a referral bonus, and Tier 1 payments go to all affiliates.

 

Finally, you cannot use the Tier system if you also elect to set Individual Percentages to each affiliate.

 

The more Tiers you use the more each sale costs you!

 

Vger

Share this post


Link to post
Share on other sites

Lol, your right, it does sound a bit confusing. Thanks for explaining that Rhea, I thought it had something to do with that but had no idea exactly how it worked. I shall copy this to my file so that I refer back to it later.

 

Thank you

 

Much Appreciated :)

Share this post


Link to post
Share on other sites

It's 2.5a, with the fixes from the 25th and 29th of May, 2005, and my fix from 3rd April, 2006. I don't trust later versions - too many people have been playing about with them.

 

Vger

Share this post


Link to post
Share on other sites
It's 2.5a, with the fixes from the 25th and 29th of May, 2005, and my fix from 3rd April, 2006. I don't trust later versions - too many people have been playing about with them.

 

Vger

 

Thank you. You've always lead me in the right direction and I appreciate it.

 

Michael

Share this post


Link to post
Share on other sites

hey chooch or Vger..do either of you know why affiliate sales are lost if paying through paypal? is there a way around this so that the affiliate sale is still tracked if PP is used for the payment method?

 

The reason i ask one of you 2 is because you seem to be the best versed with understanding this mod ;) lucky you ;)

Share this post


Link to post
Share on other sites
It's 2.5a, with the fixes from the 25th and 29th of May, 2005, and my fix from 3rd April, 2006. I don't trust later versions - too many people have been playing about with them.

 

Vger

 

Vger,

 

I finished the install using what you stated. Actually I used 2.5a from May 25 with May 29th update and your update on April 3, 2006. I did all the updates, including the sgl update, prior to trying it. The install went very smooth. I haven't tested it yet but I like what I see so far. Thank you, again, for your help.

 

Michael

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

×