Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

auctionTastic


FWR Media

Recommended Posts

auctionTastic

 

Create multiple product auctions in osCommerce

 

Originally based on another auction contribution (credits.txt included) this is a total rewrite due to the original having unworkable code. At 27 odd files this is quite a large contribution although changes to core files has been kept to very very little.

 

Full instructions are included:

 

Package includes: -

  • Auto Installer
  • Upload folder (contains all files new to oscommerce)
  • Modified files folder (files where we are modifying oscommerce code)
  • Documentation folder (install instructions including manual file changes - new code syntax highlighted)

 

Features:-

 

  • Multiple auction products
  • Products with attributes can be auctioned
  • Products can be bought as normal even if auctioned
  • Standard product price shown above auction price (including addition of attributes value)
  • product info page refresh options in admin
  • My Auction view in My Account
  • Inform current highest bidders of new bids
  • Inform winning bidders at end of auction
  • Product added to cart of winning bidder at end of auction (Can't be removed by them)
  • Valid HTML (I hope)
  • Compatible with PHP4/5 MySQL4/5
  • Error free (error_reporting(E_ALL))
  • Compatible with .. RC2a (lower probably will work but untested)

 

Feedback and bug reports appreciated as always.

 

The files are http://addons.oscommerce.com/info/6431

 

The contribution is set so that no others can add packages this is to maintain some quality. This does not stop users from making suggestions here that could be integrated into a later release.

 

Finally I wanted to mention that this was not built by design it started off as a customer asking me to install another auctions contrib, the further I went into it the clearer it became that the previous contribution just couldn't work with the code in place, before I knew it I wasn't just changing code I was rewriting it . . the code would have been a lot better if planned from the start but it seems relatively solid.

Edited by FWR Media
Link to comment
Share on other sites

auctionTastic

 

Create multiple product auctions in osCommerce

 

Originally based on another auction contribution (credits.txt included) this is a total rewrite due to the original having unworkable code. At 27 odd files this is quite a large contribution although changes to core files has been kept to very very little.

 

Full instructions are included:

 

Package includes: -

  • Auto Installer
  • Upload folder (contains all files new to oscommerce)
  • Modified files folder (files where we are modifying oscommerce code)
  • Documentation folder (install instructions including manual file changes - new code syntax highlighted)

 

Features:-

 

  • Multiple auction products
  • Products with attributes can be auctioned
  • Products can be bought as normal even if auctioned
  • Standard product price shown above auction price (including addition of attributes value)
  • product info page refresh options in admin
  • My Auction view in My Account
  • Inform current highest bidders of new bids
  • Inform winning bidders at end of auction
  • Product added to cart of winning bidder at end of auction (Can't be removed by them)
  • Valid HTML (I hope)
  • Compatible with PHP4/5 MySQL4/5
  • Error free (error_reporting(E_ALL))
  • Compatible with .. RC2a (lower probably will work but untested)

 

Feedback and bug reports appreciated as always.

 

The files are http://addons.oscommerce.com/info/6431

 

The contribution is set so that no others can add packages this is to maintain some quality. This does not stop users from making suggestions here that could be integrated into a later release.

 

Finally I wanted to mention that this was not built by design it started off as a customer asking me to install another auctions contrib, the further I went into it the clearer it became that the previous contribution just couldn't work with the code in place, before I knew it I wasn't just changing code I was rewriting it . . the code would have been a lot better if planned from the start but it seems relatively solid.

 

Hi FWR Team,

 

It realy nice that you have redisign the code......many thank for your true effort.

 

I need your feedback, i had allready installed the previous version of Auction from Dan......tell me can this be installed above this and will this work?

 

I need your guide lines for this.......thanks in advance.......

Link to comment
Share on other sites

Hi FWR Team,

 

It realy nice that you have redisign the code......many thank for your true effort.

 

I need your feedback, i had allready installed the previous version of Auction from Dan......tell me can this be installed above this and will this work?

 

I need your guide lines for this.......thanks in advance.......

 

This is totally different code, it should be treated as a different contribution although there will be similarities e.g. database tables etc.

 

For example the auctionTastic installer will not install at all if any of the database elements are already in place.

 

The original contribution touched a lot of files in a lot of places so I can see your concern.

 

I'm afraid all I can say is that there is no upgrade path to this contibution from the old ones .. sorry.

I should also mention that this contribution is currently beta .. that means it has not had enough testing yet to be considered a good idea to add to a live shop.

 

I recommend testing it first on a fresh download of RC2a (takes about 3 minutes to install with the "Drop Over" method)

Edited by FWR Media
Link to comment
Share on other sites

Hi,

 

I tested it on fresh version it is working nice and your new look for auction is looking cool.

 

One bug so far i found is that even after time goes off(auction ended) we can bid on.......may b upto next one mint or so........this need to be modify......

 

Also one piece of information is needed , from where we can set the time so that it can be syncronise with server time because

 

say for example time expires on is mention 21st-night 11.55 but by then in real my server time is say 22-04:55, so it is showing last bid is on 4 AM, but virtualy it is not right......we simply need that no one can bid after the time on display......

 

I hope this will help you to look into........let me know if you have any feedback on the same.........

Edited by ankurdhoom
Link to comment
Share on other sites

Hi,

 

I tested it on fresh version it is working nice and your new look for auction is looking cool.

 

One bug so far i found is that even after time goes off(auction ended) we can bid on.......may b upto next one mint or so........this need to be modify......

 

I don't think that is a bug . . I think the last minute was not up yet.

 

The auction shows in days hours minutes.

 

Say the auction expires at 22:55 the auction is actually not expired until the time is no longer 22:55 and becomes 22:56 .. between which as you correctly say is 59 seconds.

 

say for example time expires on is mention 21st-night 11.55 but by then in real my server time is say 22-04:55, so it is showing last bid is on 4 AM, but virtualy it is not right......we simply need that no one can bid after the time on display......

 

Does the date() function work ok in oscommerce generally? or does it also display wrongly?

 

If you are on a decent version of PHP (5.1+) just add the following to the top of the osCauctions class ..

 

date_default_timezone_set('Europe/London');

 

Where 'Europe/London' is your timezone.

Link to comment
Share on other sites

Hi,

 

I tested it on fresh version it is working nice and your new look for auction is looking cool.

 

One bug so far i found is that even after time goes off(auction ended) we can bid on.......may b upto next one mint or so........this need to be modify......

 

I don't think that is a bug . . I think the last minute was not up yet.

 

The auction shows in days hours minutes.

 

Say the auction expires at 22:55 the auction is actually not expired until the time is no longer 22:55 and becomes 22:56 .. between which as you correctly say is 59 seconds.

 

say for example time expires on is mention 21st-night 11.55 but by then in real my server time is say 22-04:55, so it is showing last bid is on 4 AM, but virtualy it is not right......we simply need that no one can bid after the time on display......

 

Does the date() function work ok in oscommerce generally? or does it also display wrongly?

 

If you are on a decent version of PHP (5.1+) just add the following to the top of the osCauctions class ..

 

date_default_timezone_set('Europe/London');

 

Where 'Europe/London' is your timezone.

 

Another method that can be used if not on a decent version of php 5 is ..

 

putenv("TZ=US/Eastern");

 

Where US/Eastern was your timezone.

Edited by FWR Media
Link to comment
Share on other sites

Second query is work fine after adding date_default_timezone_set('Europe/London'); at TOP.

 

Still first part i doubt the time ended message is coming before acctual time is left to end..........what i mean is that even some seconds...say 59 are left then also the message is coming as the"Auction Ended" in time left area.......

 

what we can introduce is

 

time left=End Time Set in seconds-Current time in seconds.........

 

can u confirm my doubt......or solution......

Link to comment
Share on other sites

Second query is work fine after adding date_default_timezone_set('Europe/London'); at TOP.

 

Still first part i doubt the time ended message is coming before acctual time is left to end..........what i mean is that even some seconds...say 59 are left then also the message is coming as the"Auction Ended" in time left area.......

 

what we can introduce is

 

time left=End Time Set in seconds-Current time in seconds.........

 

can u confirm my doubt......or solution......

 

Yes I replicated this.

 

open includes/classes/oscAuctions.php

 

Find ..

 

if( ($days_left + $hours_left + $minutes_left) == 0 ){

 

Change to ..

if( $difference == 0 ){

Link to comment
Share on other sites

Better still .. I have re added seconds now as well .. this will be in a future release but for now ..

 

open includes/classes/oscAuctions.php

 

Find function auctionsCountdown

 

Replace the whole function with ..

 

  function auctionsCountdown($datetime) {

   $datetime = strtotime($datetime);
   // make a unix timestamp for the given date
   $the_countdown_date = mktime(date("H", $datetime), date("i", $datetime), 0, date("m", $datetime), date("d", $datetime), date("Y", $datetime), -1);
   $curr_time = time();
   if( $the_countdown_date < $curr_time ){
     $this->manageAuctionComplete();
   }
   // get current unix timestamp
   $today = time();
   $difference = $the_countdown_date - $today;
   if ($difference <= 0) $difference = 0;

   $days_left = floor($difference / (60 * 60 * 24));
   $remainder = $difference % (60 * 60 * 24);
   $hours_left = floor($remainder / (60 * 60));
   $remainder = $remainder % (60 * 60);
   $minutes_left = floor($remainder / 60);
   $seconds_left = $remainder % 60;
   if( $difference == 0 ){
     echo COUNTDOWN_COMPLETE . "\n";
     return;
   }
   //Build output string
   if( $days_left != 1 ){
     echo $days_left . ' ' . COUNTDOWN_DAYS_TEXT . ' ';
   } else {
     echo $days_left . ' ' . COUNTDOWN_DAY_TEXT . ' ';
   }
   if( $hours_left != 1 ){
     echo $hours_left . ' ' . COUNTDOWN_HOURS_TEXT . ' ';
   } else {
     echo $hours_left . ' ' . COUNTDOWN_HOUR_TEXT . ' ';
   }
   if( $minutes_left != 1 ){
     echo $minutes_left . ' ' . COUNTDOWN_MINUTES_TEXT . ' ';
   } else {
     echo $minutes_left . ' ' . COUNTDOWN_MINUTE_TEXT . ' ';
   }
   echo $seconds_left . ' ' . COUNTDOWN_SECONDS_TEXT . "\n";
}

Link to comment
Share on other sites

thanks for your new function.......its working fine..now only

 

One new thing i found.....if you have say 10 products on auction then it will divide into many pages.......u can navigate from page 1 to any but cant from say 3rd page back to 1st page.......

Link to comment
Share on other sites

Does anyone have working version of it on live or demo store or any screen shots?

 

No I could but don't see the point.

 

Download a fresh rc2a .. chuck the auctionTastic files over the top (30 secs)

 

Run the auto installer and you are off.

 

Hardly worth a demo site when it can be installed in 3 mins.

Link to comment
Share on other sites

thanks for your new function.......its working fine..now only

 

One new thing i found.....if you have say 10 products on auction then it will divide into many pages.......u can navigate from page 1 to any but cant from say 3rd page back to 1st page.......

 

Yes .. somewhere I broke that it seems. Too much code to test alone.

 

I'll take a look.

Link to comment
Share on other sites

thanks for your new function.......its working fine..now only

 

One new thing i found.....if you have say 10 products on auction then it will divide into many pages.......u can navigate from page 1 to any but cant from say 3rd page back to 1st page.......

 

Open includes/modules/auctions/auctions_show.php

 

Find AND REMOVE ...

if( $count > $oscAuctions->maxPage ){

 

Find ...

}
echo "Page:".$first . $prev . $nav . $next . $last;

 

Change to (just removed the closing brace) ...

 

echo "Page:".$first . $prev . $nav . $next . $last;

Link to comment
Share on other sites

Hi,

 

 

On product info page

 

say for some item.........

 

Auction price: $98.00

Auction expires on: 12/22/2008 18:53:55

Time Remaining: Auction Ended <-----------This value is getting over few seconds b4 acctual bid get over........

Bidding increments must be at least: $1.00

 

this value comes into display from wrong value of difference........plz have a look.........

Link to comment
Share on other sites

Hi,

 

 

On product info page

 

say for some item.........

 

Auction price: $98.00

Auction expires on: 12/22/2008 18:53:55

Time Remaining: Auction Ended <-----------This value is getting over few seconds b4 acctual bid get over........

Bidding increments must be at least: $1.00

 

this value comes into display from wrong value of difference........plz have a look.........

 

No I can't replicate this can you try to explain better how I should replicate what it is you are saying is wrong please.

Link to comment
Share on other sites

No I can't replicate this can you try to explain better how I should replicate what it is you are saying is wrong please.

 

on product info page.....there is a "Time Remaining" field which is saying auction ended but still i can bid.......time gap is between 1 to 59 seconds......between this indicator saying auction ended and real bid button geting disable.........

 

if u try to bid just after the "Time Remaining" field is showing auction ended......u can bid upto some seconds.......

Link to comment
Share on other sites

on product info page.....there is a "Time Remaining" field which is saying auction ended but still i can bid.......time gap is between 1 to 59 seconds......between this indicator saying auction ended and real bid button geting disable.........

 

if u try to bid just after the "Time Remaining" field is showing auction ended......u can bid upto some seconds.......

 

I can't seem to replicate it .. my auction ends text appears at the same time as the auction options are removed.

 

The following includes some test code and one minor change .. remove the test code once you have the info we need.

 

Find ..

if (strtotime($this->auctions['auctions'][$this->auctionKey]->expires_date)<time()) {

 

Change to ...

// BOF REMOVE ME
echo 'Expires = ' . date("d/m/Y H:i:s", strtotime($this->auctions['auctions'][$this->auctionKey]->expires_date)) . ' Current = ' . date("d/m/Y H:i:s", time()) . '<br />';
// EOF REMOVE ME  
if (strtotime($this->auctions['auctions'][$this->auctionKey]->expires_date) <= time()) {

 

the test code will give you two date times, I need to see what these are when the left is showing ended and the right is showing open.

Edited by FWR Media
Link to comment
Share on other sites

I got the reason and solution.........

 

See what is happening if you give end time bit with some seconds as well, like say after 1 mintute and 45 seconds from now........then ur below calculation fails by 45 seconds for Time Remaining field

 

$difference = $the_countdown_date - $today;

 

U can surely replicate the situation by giving end time in some seconds as well................ say 2mints 45 seconds after listing auction.......

 

the solution i used is new calculation for diffrence.......

 

$difference=$datetime-$today;

 

both are from function auctionsCountdown...........please correct me if i am wrong.......

Link to comment
Share on other sites

I got the reason and solution.........

 

See what is happening if you give end time bit with some seconds as well, like say after 1 mintute and 45 seconds from now........then ur below calculation fails by 45 seconds for Time Remaining field

 

$difference = $the_countdown_date - $today;

 

U can surely replicate the situation by giving end time in some seconds as well................ say 2mints 45 seconds after listing auction.......

 

the solution i used is new calculation for diffrence.......

 

$difference=$datetime-$today;

 

both are from function auctionsCountdown...........please correct me if i am wrong.......

 

Yes .. thanks for spotting that .. in fact I was using strtotime then reusing mktime which is totally unnecessary. I didn't notice as I'm using a newer admin file which uses SpiffyCal and a neater dropdown for hour/minute (no seconds)

 

includes/modules/auctions/classes/oscAuctions.php

 

Find function auctionsCountdown($datetime) {

 

Replace the whole function with ...

 

  function auctionsCountdown($datetime) {

   $datetime = strtotime($datetime);
   $curr_time = time();
   if( $datetime < $curr_time ){
     $this->manageAuctionComplete();
   }
   // get current unix timestamp
   $today = time();
   $difference = $datetime - $today;
   if ($difference <= 0) $difference = 0;

   $days_left = floor($difference / (60 * 60 * 24));
   $remainder = $difference % (60 * 60 * 24);
   $hours_left = floor($remainder / (60 * 60));
   $remainder = $remainder % (60 * 60);
   $minutes_left = floor($remainder / 60);
   $seconds_left = $remainder % 60;
   if( $difference == 0 ){
     echo COUNTDOWN_COMPLETE . "\n";
     return;
   }
   //Build output string
   if( $days_left != 1 ){
     echo $days_left . ' ' . COUNTDOWN_DAYS_TEXT . ' ';
   } else {
     echo $days_left . ' ' . COUNTDOWN_DAY_TEXT . ' ';
   }
   if( $hours_left != 1 ){
     echo $hours_left . ' ' . COUNTDOWN_HOURS_TEXT . ' ';
   } else {
     echo $hours_left . ' ' . COUNTDOWN_HOUR_TEXT . ' ';
   }
   if( $minutes_left != 1 ){
     echo $minutes_left . ' ' . COUNTDOWN_MINUTES_TEXT . ' ';
   } else {
     echo $minutes_left . ' ' . COUNTDOWN_MINUTE_TEXT . ' ';
   }
   echo $seconds_left . ' ' . COUNTDOWN_SECONDS_TEXT . "\n";
}

Edited by FWR Media
Link to comment
Share on other sites

thanks to you man for such lovely code.....

 

i spot one more.....its not bug but i think it need to have attention.........

 

say your bid end time is 20:20:20...........but you placed bit at last momemt.then system will recive with some time interval say 1 to 3 seconds........hence your last bid will somehow display time of last winning bid as 20:20:22 or so...........

 

the impact will be that user will see that expiry time is 20:20:20 but acctual winner bid at 20:20:22 which seems cheating or bad repotation for website..........so sollution so far i am thinking if we display time of expiry i.e. "Auction expires on" field value as

 

real time plus 3 seconds......so user will see that it is expected to end by 20:20:23 and last bid has ended at 20:20:22 which is fare enough.......

 

please give your openion on this..........

Link to comment
Share on other sites

thanks to you man for such lovely code.....

 

i spot one more.....its not bug but i think it need to have attention.........

 

say your bid end time is 20:20:20...........but you placed bit at last momemt.then system will recive with some time interval say 1 to 3 seconds........hence your last bid will somehow display time of last winning bid as 20:20:22 or so...........

 

the impact will be that user will see that expiry time is 20:20:20 but acctual winner bid at 20:20:22 which seems cheating or bad repotation for website..........so sollution so far i am thinking if we display time of expiry i.e. "Auction expires on" field value as

 

real time plus 3 seconds......so user will see that it is expected to end by 20:20:23 and last bid has ended at 20:20:22 which is fare enough.......

 

please give your openion on this..........

 

Good point but I have removed the option for setting seconds in admin in the updated version as I feel it is unnecessary and over complex.

 

I really don't see the point of an admin user setting an auction to end by the second .. minutes are fine I feel.

 

Really appreciate your assistance ankurdhoom, without valid, accurate and realistic feedback it is impossible to create a well tested contribution, your feedback so far has been great.

Edited by FWR Media
Link to comment
Share on other sites

Let me try to explain this concern again........

 

Say Admin has set a product end time 20 hours :20 mints :00 sconds------------------as no need to set end time in seconds------i agree

 

user x try to bid at 20th hours 19th mint and 59th second.........user press bid button........system will take some time to recive and process---------say 1 to 3 extra second............agree?

 

then final bidding will have time entry in our winning bid details as

 

user x----winner------last bis at----20th hour 20th mint and 2nd second.........which is more then what admin has set as end time.......

 

hence user y will doubt that user x has placed bid after end time..........we have to have some solution for this i think so.......plz have a look.......

Edited by ankurdhoom
Link to comment
Share on other sites

Let me try to explain this concern again........

 

Say Admin has set a product end time 20 hours :20 mints :00 sconds------------------as no need to set end time in seconds------i agree

 

user x try to bid at 20th hours 19th mint and 59th second.........user press bid button........system will take some time to recive and process---------say 1 to 3 extra second............agree?

 

then final bidding will have time entry in our winning bid details as

 

user x----winner------last bis at----20th hour 20th mint and 2nd second.........which is more then what admin has set as end time.......

 

hence user y will doubt that user x has placed bid after end time..........we have to have some solution for this i think so.......plz have a look.......

 

Yes another valid point.

 

Try the following: -

 

includes/modules/classes/oscAuctions.php

 

Find ..

 

		SELECT ap.products_id, ap.auction_paid AS paid, ap.auctions_max AS bid_price , ap.auctions_high_cust AS customers_id, ap.auctions_id, ap.notified, pp.products_name,

 

Replace with ..

		SELECT ap.products_id, ap.auction_paid AS paid, ap.auctions_max AS bid_price , ap.auctions_high_cust AS customers_id, ap.auctions_id, ap.notified, ap.expires_date, pp.products_name,

 

Find ..

 

			$this->auctionCompleteNotified	= $auctionsExpired['notified'];

 

Replace with ...

 

			$this->auctionCompleteNotified	= $auctionsExpired['notified'];
		$this->auctionExpiredDate		 = $auctionsExpired['expires_date'];

 

Find ..

 

	tep_db_query("UPDATE " . TABLE_AUCTIONS_BIDS . " SET bid_status = 'won' WHERE bid_price = " . (float)$this->auctionCompleteBidPrice . "
			  AND auctions_id = " . (int)$this->auctionCompleteId . "");

 

Replace with ..

 

	tep_db_query("UPDATE " . TABLE_AUCTIONS_BIDS . " SET bid_status = 'won', bid_date_added = '" . $this->auctionExpiredDate . "' WHERE bid_price = '" . (float)$this->auctionCompleteBidPrice . "'
			  AND auctions_id = '" . (int)$this->auctionCompleteId . "'");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...