My periodic auctions (quarterly, maybe) would be opening and closing at specific dates/times, so the products (about 1000) would be all available for bidding or none at all.
You can set the opening/closing dates in the auction settings. These would be the default opening and closing dates for all products that you add. You are also able to batch updates if you need to set the date for all products at once, using the "Update Set" command (admin only).
I'd also need the ability to send mass-mail to the winning bidders, one for each of them, listing all the stuff they have won. But this will be a further problem.
The auction already does send an email to the winner of each auction. The only key difference between the way that this works and the way you describe your mass email function is that one email per product is sent, rather than one email per winner. I.e. if a person wins 3 items, he'll receive 3 emails.
If you want to change how this works you may want to create a custom action.
Another important note is that if you have a lot of items all closing at the same time, you will want to make a change to how the auction works. Currently it checks for newly closed auctions on every page request and sends out the necessary emails. This is a problem if there are a thousand emails that need to go out at once.
The correction is fairly simple (and I've been meaning to add it to the distibution for a while).
Add the following to the include/functions.inc.php file:
- Code: Select all
/**
* Obtain a mutex (to make sure we aren't running multiple instances
* of this script concurrently.
*
* This function will return true if it succeeded in obtaining the mutex
* (i.e. no other instance of this script is running. And false otherwise.
* @param string $name The name of the mutex to acquire.
*/
function mutex($name){
global $mutex;
$path = dirname(__FILE__).'/../templates_c/'.$name.'.mutex';
$mutex = fopen($path, 'w');
if ( flock($mutex, LOCK_EX | LOCK_NB) ){
register_shutdown_function('clear_mutex');
return true;
} else {
return false;
}
}
/**
* Clears the most recently acquired mutex.
*/
function clear_mutex(){
global $mutex;
if ( $mutex ){
fclose($mutex);
}
}
Then in the conf/ApplicationDelegate.php file, in the getPreferences() method, find a line:
- Code: Select all
closeAuctions();
Change it to:
- Code: Select all
if (mutex('closeAuctions')){
closeAuctions();
}
This will ensure that if multiple requests come in at the same time, they won't both try to close the auctions.
My solution for the next distribution to solve this problem will be more complete, but this will handle it for now.
I've read How to write an import filter but don't know how to specify/send/transfer/write the product images. What should I do? Where should I write the import method (delegate classes)?
An import filter isn't that hard to write, but if you have it as a spreadsheet you could easily just import it using PHPMyadmin or another standard mysql administration tool.
As for the images, all images are stored in the tables/products/product_image directory. The name of the image is stored in the products table. So you can just copy the bunch of images into the correct directory and make sure their names are in your spreadsheet for import.
There are other fancier solutions you could come up with like importing a zip file that contains a spreadsheet and images.
Or you could base64encode your images in your spreadsheet.
Lots...
-Steve