Contributions
Happy Hours Specials Basic
The offer of the hour - Das Angebot der Stunde
See here: http://www.cooleshops.de/happy_hours/
In the Admin under catalog - "offer of the hour" can specify daily for each hour the offers to each
operator of a Shop.
Im Admin unter Katalog - "Angebot der Stunde" kann jeder Shopbetreiber täglich für jede Stunde die Angebote festlegen.
Owing to on Loïc Richard alias Gyakutsuki for the suggestion
| 5 Feb 2008 |
Hi!
This is bug fix ver.2
This is only one file (catalog)/includes/boxes/happy_hours_specials_basic.php
I modify query and add two variables.
This is work propertly!
| 5 Feb 2008 |
Hello!
Bug fix in db query
Please replace in (catalog)/includes/boxes/happy_hours_specials_basic.php
line 20:
if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, hhs.specials_price_happy_hours, hhs.status_happy_hours, hhs.happy_hours_beginning_date, hhs.happy_hours_end_date, hhs.happy_hours_beginning_time, hhs.happy_hours_end_time, hhs.specials_date_added from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_HAPPY_HOURS_SPECIALS_BASIC . " hhs where p.products_status = '1' and p.products_id = hhs.products_id and pd.products_id = hhs.products_id and pd.language_id = '" . (int)$languages_id . "' and hhs.status_happy_hours = '1' and '" . $uhrzeit . "' BETWEEN hhs.happy_hours_beginning_time and hhs.happy_hours_end_time and now() > hhs.happy_hours_beginning_date and now() < hhs.happy_hours_end_date order by hhs.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
on good code:
if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, hhs.specials_price_happy_hours, hhs.status_happy_hours, hhs.happy_hours_beginning_date, hhs.happy_hours_end_date, hhs.happy_hours_beginning_time, hhs.happy_hours_end_time, hhs.specials_date_added from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_HAPPY_HOURS_SPECIALS_BASIC . " hhs where p.products_status = '1' and p.products_id = hhs.products_id and pd.products_id = hhs.products_id and pd.language_id = '" . (int)$languages_id . "' and hhs.status_happy_hours = '1' and '" . $time . "' BETWEEN hhs.happy_hours_beginning_time and hhs.happy_hours_end_time and hhs.happy_hours_beginning_date <= now() and now() <= hhs.happy_hours_end_date order by hhs.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
This package is not include file. This is only instruction to repair db query. This is work.
| 18 Nov 2006 |
For a new installation see the install.txt.
For an update see the install2.txt
A screenshot is included.
This is the full package.
Have fun.
| 22 Jan 2006 |
happy hours completely working with scrolling
| 5 Nov 2005 |
There is 2 errors in the code I uploaded earlier:
One is a leftover from espacio which made the pictures not turn up anymore and two because of a change I had to make for my own shop and forgot to remove before uploading. I also changed it a little bit more so no box will show up when you have zero Happy Hours offers defined in your admin.
Replace the code in your (catalog)/includes/boxes/happy_hours_special_basic.php with:
<?php
/*
$Id: specials.php,v 1.31 2003/06/09 22:21:03 hpdl Exp $
by by Infobroker, Germany
$Id: happy_hours_specials_basic.php,v 2.02 2005/09/25 ep Exp $
Erich Paeper - info@cooleshops.de
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
$uhrzeit = date ("H:i:s");
if ($random_product = tep_random_select("select p.products_id,
pd.products_name, p.products_price, p.products_tax_class_id,
p.products_image, hhs.specials_price_happy_hours, hhs.status_happy_hours,
hhs.happy_hours_beginning_date, hhs.happy_hours_end_date,
hhs.happy_hours_beginning_time, hhs.happy_hours_end_time,
hhs.specials_date_added from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_HAPPY_HOURS_SPECIALS_BASIC . "
hhs where p.products_status = '1' and p.products_id = hhs.products_id and
pd.products_id = hhs.products_id and pd.language_id = '" .
(int)$languages_id . "' and hhs.status_happy_hours = '1' and '" . $uhrzeit .
"' BETWEEN hhs.happy_hours_beginning_time and hhs.happy_hours_end_time and
now() >= hhs.happy_hours_beginning_date and now() <=
hhs.happy_hours_end_date order by hhs.specials_date_added desc limit " .
MAX_RANDOM_SELECT_SPECIALS)) {
?>
<tr><td>
<?php
$uhrzeitbis = substr($random_product['happy_hours_end_time'],'', 5);
$info_box_contents = array();
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
'text' => BOX_TEXT_HAPPY_HOURS1 . $random_product['happy_hours_end_time'] .
BOX_TEXT_HAPPY_HOURS2 . '<br><br><a href="' .
tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' .
$random_product["products_id"]) . '">' . tep_image(DIR_WS_IMAGES .
$random_product['products_image'], $random_product['products_name'],
SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' .
tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' .
$random_product['products_id']) . '">' . $random_product['products_name'] .
'</a><br><s>' .
$currencies->display_price($random_product['p
roducts_price'], tep_get_tax_rate($random_product['products_tax_class_id']))
. '</s><br><span class="productSpecialPrice">' .
$currencies->display_price($random_product['s
pecials_price_happy_hours'],
tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>');
new infoBox($info_box_contents);
?>
</td></tr>
<?php
} else {
?>
<tr><td>
<?php
$uhrzeit = date ("H:i:s");
if ($random_product = tep_random_select("select p.products_id,
pd.products_name, p.products_price, p.products_tax_class_id,
p.products_image, hhs.specials_price_happy_hours, hhs.status_happy_hours,
hhs.happy_hours_beginning_date, hhs.happy_hours_end_date,
hhs.happy_hours_beginning_time, hhs.happy_hours_end_time,
hhs.specials_date_added from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_HAPPY_HOURS_SPECIALS_BASIC . "
hhs where p.products_status = '1' and p.products_id = hhs.products_id and
pd.products_id = hhs.products_id and pd.language_id = '" .
(int)$languages_id . "' and hhs.status_happy_hours = '1' and now() <=
hhs.happy_hours_beginning_date order by hhs.happy_hours_beginning_date and
hhs.happy_hours_beginning_time desc limit 1")) {
$info_box_contents = array();
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
'text' => BOX_TEXT_HAPPY_HOURS_INACTIVE . '<b>' .
$random_product['happy_hours_beginning_time'] . '</b><br>(' .
tep_date_long($random_product['happy_hours_beginning_date']) . ')');
new infoBox($info_box_contents);
}
?> </td></tr>
<?php
}
?>
The attached file is the same as for Happy Hours Specials Basic 2
| 5 Nov 2005 |
Sorry, this is error in my catalog
Fatal error: Call to undefined function: tep_random_select() in /web/htdocs/www.mysite.com/home/includes/boxes/happy_hours_specials_basic.php on line 19
| 5 Nov 2005 |
This whole contrib will not work if you set your offers of the hour on todays date ! The date comparison should not be SMALLER or GREATER but SMALLER OR EQUAL and GREATER OR EQUAL. This change is reflected in the below code which also keeps the offer of the hour infobox multilanguage and shows the time for the next hour dynamic and not hardcoded.
1) Add to your (catalog)/includes/languages/english.php (and other main language files)
define('BOX_TEXT_HAPPY_HOURS_INACTIVE', 'The next offer of the hour will be starting on ');
2) Replace your (catalog)/includes/boxes/happy_hours_special_basic.php
with
<?php
/*
$Id: specials.php,v 1.31 2003/06/09 22:21:03 hpdl Exp $
by by Infobroker, Germany
$Id: happy_hours_specials_basic.php,v 2.02 2005/09/25 ep Exp $
Erich Paeper - info@cooleshops.de
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
$uhrzeit = date ("H:i:s");
if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, hhs.specials_price_happy_hours, hhs.status_happy_hours, hhs.happy_hours_beginning_date, hhs.happy_hours_end_date, hhs.happy_hours_beginning_time, hhs.happy_hours_end_time, hhs.specials_date_added from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_HAPPY_HOURS_SPECIALS_BASIC . " hhs where p.products_status = '1' and p.products_id = hhs.products_id and pd.products_id = hhs.products_id and pd.language_id = '" . (int)$languages_id . "' and hhs.status_happy_hours = '1' and '" . $uhrzeit . "' BETWEEN hhs.happy_hours_beginning_time and hhs.happy_hours_end_time and now() >= hhs.happy_hours_beginning_date and now() <= hhs.happy_hours_end_date order by hhs.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
?>
<tr><td>
<?php
$uhrzeitbis = substr($random_product['happy_hours_end_time'],'', 5);
$info_box_contents = array();
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
'text' => BOX_TEXT_HAPPY_HOURS1 . $random_product['happy_hours_end_time'] . BOX_TEXT_HAPPY_HOURS2 . '<br><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . tep_image(DIR_WS_UNCUT_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br><s>' . $currencies->display_price($random_product['products_id'],$random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['products_id'],$random_product['specials_price_happy_hours'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>');
new infoBox($info_box_contents);
?>
</td></tr>
<?php
} else {
?>
<tr><td>
<?php
$uhrzeit = date ("H:i:s");
$random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, hhs.specials_price_happy_hours, hhs.status_happy_hours, hhs.happy_hours_beginning_date, hhs.happy_hours_end_date, hhs.happy_hours_beginning_time, hhs.happy_hours_end_time, hhs.specials_date_added from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_HAPPY_HOURS_SPECIALS_BASIC . " hhs where p.products_status = '1' and p.products_id = hhs.products_id and pd.products_id = hhs.products_id and pd.language_id = '" . (int)$languages_id . "' and hhs.status_happy_hours = '1' and '" . $uhrzeit . "' < hhs.happy_hours_beginning_time and now() <= hhs.happy_hours_beginning_date order by hhs.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS);
$info_box_contents = array();
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
'text' => BOX_TEXT_HAPPY_HOURS_INACTIVE . $random_product['happy_hours_beginning_time']);
new infoBox($info_box_contents);
?> </td></tr>
<?php
}
?>
To solve the 'today' bug you also have to change in
(catalog)/includes/functions/general.php the
function tep_get_products_special_price($product_id) {
$product_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status = '1'");
$product = tep_db_fetch_array($product_query);
// next check is Happy hours specials check,if specials_hour exist and valid it will return the special_hour price
$happy_time = date ("H:i:s");
$product_query2 = tep_db_query("select specials_price_happy_hours from " . TABLE_HAPPY_HOURS_SPECIALS_BASIC . " where products_id = '" . (int)$product_id . "' and status_happy_hours='1' and '" .$happy_time. "'
BETWEEN happy_hours_beginning_time and happy_hours_end_time and now() > happy_hours_beginning_date and now() < happy_hours_end_date");
$product2 = tep_db_fetch_array($product_query2);
if ($product2){$product['specials_new_products_price'] = $product2['specials_price_happy_hours'];}
return $product['specials_new_products_price'];
}
to
function tep_get_products_special_price($product_id) {
$product_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status = '1'");
$product = tep_db_fetch_array($product_query);
// next check is Happy hours specials check,if specials_hour exist and valid it will return the special_hour price
$happy_time = date ("H:i:s");
$product_query2 = tep_db_query("select specials_price_happy_hours from " . TABLE_HAPPY_HOURS_SPECIALS_BASIC . " where products_id = '" . (int)$product_id . "' and status_happy_hours='1' and '" .$happy_time. "'
BETWEEN happy_hours_beginning_time and happy_hours_end_time and now() >= happy_hours_beginning_date and now() <= happy_hours_end_date");
$product2 = tep_db_fetch_array($product_query2);
if ($product2){$product['specials_new_products_price'] = $product2['specials_price_happy_hours'];}
return $product['specials_new_products_price'];
}
No file included. All credits for this cool contrib go to infobroker with the request if you pretty please will op en a support thread for this !
| 4 Nov 2005 |
Damit das Interesse der Kunden geweckt wird, soll die Box auch dann angezeigt werden wenn kein Produkt eingefügt wurde. Den Text "Nächstes Angebot startet... Könnt Ihr so ersetzen wie Ihr wollt!
Ersetzt die /boxes/happy_hours_special_basic.php hier mit:
<?php
/*
$Id: specials.php,v 1.31 2003/06/09 22:21:03 hpdl Exp $
by by Infobroker, Germany
$Id: happy_hours_specials_basic.php,v 2.02 2005/09/25 ep Exp $
Erich Paeper - info@cooleshops.de
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
$uhrzeit = date ("H:i:s");
if ($random_product = tep_random_select("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, hhs.specials_price_happy_hours, hhs.status_happy_hours, hhs.happy_hours_beginning_date, hhs.happy_hours_end_date, hhs.happy_hours_beginning_time, hhs.happy_hours_end_time, hhs.specials_date_added from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_HAPPY_HOURS_SPECIALS_BASIC . " hhs where p.products_status = '1' and p.products_id = hhs.products_id and pd.products_id = hhs.products_id and pd.language_id = '" . (int)$languages_id . "' and hhs.status_happy_hours = '1' and '" . $uhrzeit . "' BETWEEN hhs.happy_hours_beginning_time and hhs.happy_hours_end_time and now() > hhs.happy_hours_beginning_date and now() < hhs.happy_hours_end_date order by hhs.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
?>
<tr><td>
<?php
$uhrzeitbis = substr($random_product['happy_hours_end_time'],'', 5);
$info_box_contents = array();
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
'text' => BOX_TEXT_HAPPY_HOURS1 . $random_product['happy_hours_end_time'] . BOX_TEXT_HAPPY_HOURS2 . '<br><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . tep_image(DIR_WS_UNCUT_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_price_happy_hours'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>');
new infoBox($info_box_contents);
?>
</td></tr>
<?php
} else {
?>
<tr><td>
<?php
$uhrzeitbis = substr($random_product['happy_hours_end_time'],'', 5);
$info_box_contents = array();
$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
'text' => 'Das nächste Angebot startet um 22.00 Uhr ');
new infoBox($info_box_contents);
?> </td></tr>
<?php
}
?>
| 26 Sep 2005 |
New Feature: Seperate Beginning Happy Hour Date,End Date Happy Hour and Start Time Happy Hours, End Time Happy Hour
| 24 Sep 2005 |
fix in admin/happy_hours_specials_basic.php
| 21 Sep 2005 |
with a new happy_hours_specials_basic_new.sql
| 21 Sep 2005 |
The offer of the hour - Das Angebot der Stunde
See here: http://www.cooleshops.de/happy_hours/
In the Admin under catalog - "offer of the hour" can specify daily for each hour the offers to each
operator of a Shop.
Im Admin unter Katalog - "Angebot der Stunde" kann jeder Shopbetreiber täglich für jede Stunde die Angebote festlegen.
Owing to on Loïc Richard alias Gyakutsuki for the suggestion
Note: Contributions are used at own risk.
