Zen Cart Logo
Forums / All Other Contributions/Addons / Auction Product Type

Auction Product Type

Views: 176,904

Results 361 to 380 of 740
1 May 2009, 5:47 PM
#361
dovzamir avatar

dovzamir

New Zenner

Join Date:
Mar 2009
Location:
Kibbutz Beit Kama, Israel
Posts:
6
Plugin Contributions:
0

Auction Product Type

Second instalment!

Although not a really great fix, since type_handler can also be edited, but the chances of it being edited are much smaller. I translate all product type names for managers whose English is not quite what it could be.

Here's the fix so that editing the type_name from Product - Auction will not break the convert type:

in file admin/convert_type.php change line 24 from:

  $sql = "SELECT * FROM " . TABLE_PRODUCT_TYPES . " WHERE type_name = 'Product - Auction'";

to

  $sql = "SELECT * FROM " . TABLE_PRODUCT_TYPES . " WHERE type_handler = 'product_auction'";
2 May 2009, 7:23 PM
#362
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Auction Product Type

mjcrabill:

Bramnick,

I have been working for quite awhile now, trying to get a fully functioning auction for one of my customers and have been fighting problems with the email notifications. Here is what I have found so far with my testing. When you run the first auction, the winner of that auction, is then listed as the winner of all subsequent auctions, even ones they did not bid on, if the first auction winner has not processed thru the pay now. They are listed as the winner, until they have finished the pay now process. Then the winner of the next auction, is the winner of all subsequent auctions again, until they process their payment.

It's like the database is not updated or refreshed or whatever, to clear the previous winner. When you go to the site itself, the correct winner of the auction, is shown they have won and they get the pay now. But the winning email does not go to them, unless the previous winner had processed thru the pay now.

Not all people pay instantly when they win. There needs to be a way to clear them from the database winning bid, after they win, but before they pay, so they don't always appear to be the winner of all subsequent auctions.

I am using ZenCart 1.3.8 a Database patch level 1.3.8 Auction product type mod 0.99a. The email options were tested trying PHP and sendmail, currently it's set to sendmail. I have this setup as a test site, if you would like to look, I can PM you the access information.

I hope I have explained the problem, in as much detail as possible, while keeping from making it confusing. If you need more details or clarification. Feel free to contact me! I would really like to get this going. I have been working for way to long and have too much time invested, to make it profitable. I need to get it working for my customer ASAP. Any help or guidance would be appreciated.

I have at least become fairly familiar with the ZenCart and the auction mod with all the troubleshooting and testing I have done, so if anyone else needs this installed or help, I will have a fairly good idea of what to do and what not to do. That is once the email problem can be solved. Thanks again! :frusty:

Mike

The problem is in class.productAuction.php. It does not difer between the diferent products (product_id) when it pick the winner email. Because of that the winner_email goes to the highest bidder no matter of what product he is the winner of.
So if you are the highest bidder of one product where the auction is closed, you will get the winner-email for the other products too.

If you have more than one product on aution at the time and they all closes simultaniously, the winner email goes to the highest bidder on one of the products, from all the products.

Does anyone have a fix for that ?

Thanks

3 May 2009, 12:01 PM
#363
dovzamir avatar

dovzamir

New Zenner

Join Date:
Mar 2009
Location:
Kibbutz Beit Kama, Israel
Posts:
6
Plugin Contributions:
0

Re: Auction Product Type

Hi again all,

Another really serious problem with the auctrion product type:

If the auctioned product is defined to include tax, then the bidder's bid is upped by the same percent.
For example, when the product's price includes 15.5% VAT, and the bidder puts in a bid in the amount of 10 the actual bid will be 11.55 instead of 10.

This is incorrect behaviour, since the bidder certainly intended to pay 10 including tax.

I'll take a look at the logic to see if I can patch it, but will probably not have time until next weekend.

5 May 2009, 12:47 AM
#364
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Auction Product Type

Toft:

The problem is in class.productAuction.php. It does not difer between the diferent products (product_id) when it pick the winner email. Because of that the winner_email goes to the highest bidder no matter of what product he is the winner of.
So if you are the highest bidder of one product where the auction is closed, you will get the winner-email for the other products too.

If you have more than one product on aution at the time and they all closes simultaniously, the winner email goes to the highest bidder on one of the products, from all the products.

Does anyone have a fix for that ?

Thanks

Disregard this question. I have modified the class.productAuction so the correct winner-email goes to the correct winner even when several auctions ends at the same time.
All seems to be working well now

Thanks

5 May 2009, 1:47 AM
#365
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Auction Product Type

Hi
I am also working on a few other modifications:

1.) Include the bids in the customers controll panel, so they can see what products they have bids on.

2.) Modify the "new products" on front page, so auction products show days, hours and minutes left until the auction ends.

3.) Modify admin, so admin can see who bidded on which product.

4.) Show in admin which auctions ends without winner or didnt reach the reserve price.

5.) Posibility for admin to reset auctions that didnt reach reserve price or where the winner dint buy the product.

If anyone already made any of this modifications, please let me know ......... would be nice to save some work :smile:

Thanks

5 May 2009, 4:35 AM
#366
davewest avatar

davewest

Totally Zenned

Join Date:
Dec 2007
Location:
Payson, AZ
Posts:
1,075
Plugin Contributions:
7

Re: Auction Product Type

Toft:

Hi
I am also working on a few other modifications:

1.) Include the bids in the customers controll panel, so they can see what products they have bids on.

2.) Modify the "new products" on front page, so auction products show days, hours and minutes left until the auction ends.

3.) Modify admin, so admin can see who bidded on which product.

4.) Show in admin which auctions ends without winner or didnt reach the reserve price.

5.) Posibility for admin to reset auctions that didnt reach reserve price or where the winner dint buy the product.

If anyone already made any of this modifications, please let me know ......... would be nice to save some work :smile:

Thanks
items 2 - 5 are done in the next release.

5 May 2009, 3:21 PM
#367
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Auction Product Type

davewest:

items 2 - 5 are done in the next release.

Hi
Thanks.
When will it be released.

Here is how i fixed the winner email from line 1 to line 70 so it sort the right winner for the right product.

<?php
/**
 * Zen Auction
 * 
 * @package general
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: 
 */
/**
 * This Class is part of an automated aucton system for Zen Cart
 *
 */
 
class productAuction {
  /**
   * This method is called within application-top.php to update auction products statuses
   * 
   * Checks for auctions that have not been closed manually (e.g. by buy now)
   * Checks the expiry date/hour and if expired updates the status and sends appropriate emails
   * to auction participants
   *
   */
  function checkAuctionStatuses() {
    global $db;
    $sql = "SELECT * FROM " . TABLE_PRODUCT_AUCTION_EXTRA . "
            WHERE auction_closed = 'N' AND (CURDATE() > bid_expire_date) or (bid_expire_hour <= " . date('H') . " and bid_expire_date = CURDATE() and auction_closed = 'N') ORDER BY products_id";

    $auction_info = $db->execute($sql);
    while (!$auction_info->EOF) {
      // the auction should be closed as it has expired
      productAuction::sendClosedEmail($auction_info);
      $sql = "UPDATE " . TABLE_PRODUCT_AUCTION_EXTRA . "
              SET auction_closed = 'Y' where products_id = " . $auction_info->fields['products_id'];
      $db->execute($sql);
      $auction_info->moveNext();

    }
  }
  /**
   * Method to send emails to participants when closing an expired auction
   * 
   * We first find the customer who has made the highest bid that is above the reserve price.  If a customer is found then they are the auction winner
   * and appropriate email is sent.<br />
   * We also then send email to those who lost the auction
   *
   * @param unknown_type $auction
   */
  function sendClosedEmail($auction) {
    global $db;
    $last_bid = $db->Execute("SELECT products_id FROM " . TABLE_PRODUCT_AUCTION_EXTRA . "
            WHERE auction_closed = 'N' AND (CURDATE() > bid_expire_date) or (bid_expire_hour <= " . date('H') . " and bid_expire_date = CURDATE() and auction_closed = 'N') ORDER BY products_id");
    $products_id = $last_bid->fields['products_id'] ;
    $sql = "SELECT customers_id FROM " . TABLE_PRODUCTS_AUCTION  . "
            WHERE customers_bid >= " . $auction->fields['bid_reserve_price'] . " AND products_id = $products_id  ORDER BY customers_bid DESC LIMIT 1";
    $customers = $db->execute($sql);
    if ($customers->recordCount() > 0) {
      productAuction::sendClosedWonEmail($auction, $customers->fields['customers_id']);
      $sql = "SELECT DISTINCT customers_id FROM " . TABLE_PRODUCTS_AUCTION  . "
              WHERE customers_bid < " . $auction->fields['bid_reserve_price'] . " 
              AND customers_id != " . $customers->fields['customers_id'] . "
              ORDER BY customers_bid DESC"; 
      $customersLost = $db->execute($sql);
      while (!$customersLost->EOF) {
        productAuction::sendClosedLostEmail($auction, $customersLost->fields['customers_id']);
        $customersLost->MoveNext();
      }
      return;
    }

I also added the if ($previous_bidders_email_address != "") { to function sendClosedLostEmail($auction, $customersID) { to as you sugested for \pages\product_auction_info\ header in an earlier post.

Have also put in a link to the product in the winner email, but that needs a little "beautifying" before i post it.

Also item 1 is done, but because of the language files, i will wait with posting until i have writen english language files for it. Now for testing i have put the wordings right into the php files, but it works.

Thanks

5 May 2009, 3:39 PM
#368
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Auction Product Type

Toft:

Hi
Thanks.
When will it be released.

Here is how i fixed the winner email from line 1 to line 70 so it sort the right winner for the right product.

<?php /** * Zen Auction * * @package general * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: */ /** * This Class is part of an automated aucton system for Zen Cart * */ class productAuction { /** * This method is called within application-top.php to update auction products statuses * * Checks for auctions that have not been closed manually (e.g. by buy now) * Checks the expiry date/hour and if expired updates the status and sends appropriate emails * to auction participants * */ function checkAuctionStatuses() { global $db; $sql = "SELECT * FROM " . TABLE_PRODUCT_AUCTION_EXTRA . " WHERE auction_closed = 'N' AND (CURDATE() > bid_expire_date) or (bid_expire_hour <= " . date('H') . " and bid_expire_date = CURDATE() and auction_closed = 'N') ORDER BY products_id"; $auction_info = $db->execute($sql); while (!$auction_info->EOF) { // the auction should be closed as it has expired productAuction::sendClosedEmail($auction_info); $sql = "UPDATE " . TABLE_PRODUCT_AUCTION_EXTRA . " SET auction_closed = 'Y' where products_id = " . $auction_info->fields['products_id']; $db->execute($sql); $auction_info->moveNext(); } } /** * Method to send emails to participants when closing an expired auction * * We first find the customer who has made the highest bid that is above the reserve price. If a customer is found then they are the auction winner * and appropriate email is sent.<br /> * We also then send email to those who lost the auction * * @param unknown_type $auction */ function sendClosedEmail($auction) { global $db; $last_bid = $db->Execute("SELECT products_id FROM " . TABLE_PRODUCT_AUCTION_EXTRA . " WHERE auction_closed = 'N' AND (CURDATE() > bid_expire_date) or (bid_expire_hour <= " . date('H') . " and bid_expire_date = CURDATE() and auction_closed = 'N') ORDER BY products_id"); $products_id = $last_bid->fields['products_id'] ; $sql = "SELECT customers_id FROM " . TABLE_PRODUCTS_AUCTION . " WHERE customers_bid >= " . $auction->fields['bid_reserve_price'] . " AND products_id = $products_id ORDER BY customers_bid DESC LIMIT 1"; $customers = $db->execute($sql); if ($customers->recordCount() > 0) { productAuction::sendClosedWonEmail($auction, $customers->fields['customers_id']); $sql = "SELECT DISTINCT customers_id FROM " . TABLE_PRODUCTS_AUCTION . " WHERE customers_bid < " . $auction->fields['bid_reserve_price'] . " AND customers_id != " . $customers->fields['customers_id'] . " ORDER BY customers_bid DESC"; $customersLost = $db->execute($sql); while (!$customersLost->EOF) { productAuction::sendClosedLostEmail($auction, $customersLost->fields['customers_id']); $customersLost->MoveNext(); } return; } ``` > > I also added the if ($previous_bidders_email_address != "") { to function sendClosedLostEmail($auction, $customersID) { to as you sugested for \pages\product_auction_info\ header in an earlier post. > > Have also put in a link to the product in the winner email, but that needs a little "beautifying" before i post it. > > Also item 1 is done, but because of the language files, i will wait with posting until i have writen english language files for it. Now for testing i have put the wordings right into the php files, but it works. > > Thanks The modification in pervious post is of cause for the include/clases/class.productauction.php
5 May 2009, 3:54 PM
#369
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Auction Product Type

By the way ......... I also made a version of no 2 (include days, hours and minutes until auction expires ) in new products.

I did it this way with diferent buttons for sales, auctions and auctions waiting for winner to pay,
You can see it here:
http://www.tvangsauksjon.no

But this is is a site for a customer of mine and the site is going live now, so please dont bid.

11 May 2009, 12:35 AM
#370
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Auction Product Type

dovzamir:

Hi again all,

Another really serious problem with the auctrion product type:

If the auctioned product is defined to include tax, then the bidder's bid is upped by the same percent.
For example, when the product's price includes 15.5% VAT, and the bidder puts in a bid in the amount of 10 the actual bid will be 11.55 instead of 10.

This is incorrect behaviour, since the bidder certainly intended to pay 10 including tax.

I'll take a look at the logic to see if I can patch it, but will probably not have time until next weekend.

Hi

Go to /includes/modules/pages/product_auction_info/header_php.php
In about line 24 to 31, find:

require(DIR_WS_MODULES . 'require_languages.php');
$process = false;
if (isset($_POST['action']) && ($_POST['action'] == 'place_bid')) {
  $process = true;
  $auction_bid = zen_db_prepare_input($_POST['auction_bid_amount']);
  $auction_bid = zen_round($auction_bid,  $currencies->currencies[$_SESSION['currency']]['decimal_places']);
  $auction_price  = zen_db_prepare_input($_POST['auction_price']);
  $auction_current_bid  = zen_db_prepare_input($_POST['auction_current_bid']);
  $auction_current_bid = ($auction_current_bid > 0) ? $auction_current_bid : 0.01;
  $products_id = zen_db_prepare_input($_GET['products_id']);

Change it to:

require(DIR_WS_MODULES . 'require_languages.php');
$process = false;
$site_tax = zen_get_tax_rate($product_info->fields['products_tax_class_id']);
if (isset($_POST['action']) && ($_POST['action'] == 'place_bid')) {
  $process = true;
  $auction_bid = zen_db_prepare_input($_POST['auction_bid_amount']);
  $auction_bid = zen_round($auction_bid,  $currencies->currencies[$_SESSION['currency']]['decimal_places']);
  $auction_price  = zen_db_prepare_input($_POST['auction_price']);
  $auction_current_bid  = zen_db_prepare_input($_POST['auction_current_bid']);
  $auction_current_bid = ($auction_current_bid > 0) ? $auction_current_bid : 0.01;
  $products_id = zen_db_prepare_input($_GET['products_id']);
  $auction_bid = $auction_bid * "100" / sprintf("1".$site_tax);

That will exclude the tax from the customers bid and update the tables corectly.

If you also want minimum bid to show on the page exclude tax, you need to modify /admin/product_auction.php so it show gross and net. (I have done that)
You can probably also do it in main_template_vars.php by coment out the first querry for zen_get_tax_rate (think that should work but havent tried it)

This auction is kinda easy to modyfy, but if you need the mod for /admin/product_auction.php , give me a message

11 May 2009, 2:42 AM
#371
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Auction Product Type

Correction to the abowe.
I have a mod in an other file, so the abowe correction will probably not work for you. Sorry ....

So use this in stead. It should work wheather you have the product with or without tax.

In includes/modules/pages/product_auction_info/header_php.php
fine about between lines 20 and 25

require(DIR_WS_MODULES . 'require_languages.php');
$process = false;
if (isset($_POST['action']) && ($_POST['action'] == 'place_bid')) {
  $process = true;
  $auction_bid = zen_db_prepare_input($_POST['auction_bid_amount']);
  $auction_bid = zen_round($auction_bid,  $currencies->currencies[$_SESSION['currency']]['decimal_places']);
  $auction_price  = zen_db_prepare_input($_POST['auction_price']);
  $auction_current_bid  = zen_db_prepare_input($_POST['auction_current_bid']);
  $auction_current_bid = ($auction_current_bid > 0) ? $auction_current_bid : 0.01;
  $products_id = zen_db_prepare_input($_GET['products_id']);

Change to:

require(DIR_WS_MODULES . 'require_languages.php');
$process = false;

    $sql = "select p.products_id,
                  p.products_tax_class_id
           from   " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_AUCTION_EXTRA . " pae
           where  p.products_status = '1'
           and    p.products_id = '" . (int)$_GET['products_id'] . "'
           and    pd.products_id = p.products_id and p.products_id = pae.products_id
           and    pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";

    $product_info = $db->Execute($sql);
$site_tax = zen_get_tax_rate($product_info->fields['products_tax_class_id']);

if (isset($_POST['action']) && ($_POST['action'] == 'place_bid')) {
  $process = true;
  $auction_bid = zen_db_prepare_input($_POST['auction_bid_amount']);
  $auction_bid = zen_round($auction_bid,  $currencies->currencies[$_SESSION['currency']]['decimal_places']);
  $auction_price  = zen_db_prepare_input($_POST['auction_price']);
  $auction_current_bid  = zen_db_prepare_input($_POST['auction_current_bid']);
  $auction_current_bid = ($auction_current_bid > 0) ? $auction_current_bid : 0.01;
  $products_id = zen_db_prepare_input($_GET['products_id']);
   if ($site_tax > 0) {
  $auction_bid = $auction_bid * "100" / sprintf("1".$site_tax);
   }
18 May 2009, 12:30 PM
#372
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Auction Product Type

davewest:

items 2 - 5 are done in the next release.
Originally Posted by Toft
Hi
I am also working on a few other modifications:

1.) Include the bids in the customers controll panel, so they can see what products they have bids on.

2.) Modify the "new products" on front page, so auction products show days, hours and minutes left until the auction ends.

3.) Modify admin, so admin can see who bidded on which product.

4.) Show in admin which auctions ends without winner or didnt reach the reserve price.

5.) Posibility for admin to reset auctions that didnt reach reserve price or where the winner dint buy the product.

If anyone already made any of this modifications, please let me know ......... would be nice to save some work

Thanks

:smile: Did not get any answer about "next release" and I could not wait.
So I have done them all and more .......
I might post them on my own blog, but need to write english language files first. Have not altered the database.

26 May 2009, 7:16 AM
#373
netchaos avatar

netchaos

New Zenner

Join Date:
Feb 2009
Posts:
20
Plugin Contributions:
0

Re: Auction Product Type

@ Toft

I would like to have the modifications that you have done to the mod, could you please upload the file or post a link to it ?

Thank You

27 May 2009, 5:45 AM
#374
mjcrabill avatar

mjcrabill

New Zenner

Join Date:
Feb 2008
Location:
Flint, MI
Posts:
15
Plugin Contributions:
0

Re: Auction Product Type

:cheers: Toft

I would also like to get the mods you created, to improve the auction mod. If it would be possible to get a copy of the mods, it would be greatly appreciated.

Thanks!
mjcrabill

29 May 2009, 3:24 AM
#375
toft avatar

toft

New Zenner

Join Date:
Dec 2008
Posts:
23
Plugin Contributions:
0

Re: Auction Product Type

Hi, both of you.
I havent got the time to do the language files. Have just echoed the language right into the files.
Been to buissy 7/24 with a booking system for hotells to write languagefiles for this.
I might pm them to you two so you can test them. It could be that the languages are "self explained" even if it is not english.

  • In admin, there is 4 new files that does not overwrite anything.
  • product_auction.php is modified.
    Have also modded Index.pgp so it gives a overwiev over the auctions, customers bids, ongoing auctions, auctions ended without winner, auctions waiting for winner to buy out, all with link to a listing of customers and bids if you want to contact them, and link to each customers.
    Customers.php is also modded so the "box" on the right side in the list over customers, list the auctions that they are involved in, their bids and so on.
    Categories are modded so each auction products show reserve price, highest bid and date for auction end with links to check out more.
    On the front-end there is a few new files so customers, in their account, can see their bids and the products they have bidded on.
    Most of the other "auction files" are modded so they work better and give more information and also so admin gets emails with winners and auctions ended with or without winners.
    New products are modded and have a alternative button for auctions and tell the time until auctions ends
    So there is a lot of language to remove from the scripts and put into language files. I also modded some other things in zencart admin that have to do with normal shopping overvview, invoices and so on, so i have to sit down and sort out the files that only goes for auction products as soon as i get time and also specify what i have done to each files in case somone already modified some of these files.
    I will come back to it as soon as i get my "head over the water" workwise .........
    The customer i did this for now also want a posibility for his customers, for a fee, to put up their own items for auction, so i have to go back to it auction program anyway ..........

Best regards
Ole
I will do my best as soon as i get the time. Right now i have a few unpatient customers waiting for a advanced booking script and a long list of functions and wishes.

1 Jun 2009, 8:53 PM
#376
netchaos avatar

netchaos

New Zenner

Join Date:
Feb 2009
Posts:
20
Plugin Contributions:
0

Re: Auction Product Type

@ Toft

Thank you very much for replying. Will wait until you finish the language files. Best of luck on your "advanced booking script" project. :smile:

16 Jun 2009, 9:40 AM
#377
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Re: Auction Product Type

I have installed this module. I have tried for 10 minutes and dont know how to add a product as an auction. can someone tell me.:blush:

16 Jun 2009, 6:47 PM
#378
netchaos avatar

netchaos

New Zenner

Join Date:
Feb 2009
Posts:
20
Plugin Contributions:
0

Re: Auction Product Type

@vandiermen
For new products, while creating a new product select the product type as auction from the drop down menu. (default will be Product - General).
For existing products, you can use the convert option in Tools (if my memory is correct) to change existing products to Auction product type.

Thank You

16 Jun 2009, 7:14 PM
#379
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Re: Auction Product Type

Oh, you select the 'product type' from the drop down before clicking the add product button, I was looking for it when you are in the actual listing page.

Thanks.

16 Jun 2009, 11:03 PM
#380
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Re: Auction Product Type

Is there a way to have a link to display all your auction items across the site?
display products = only auction