Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Trouble with installing "Happy Hour offer" contribution


Recommended Posts

Ha ha, yes, that's a good one. I discovered that myself also a while ago and I think, haven't checked it really because I do only very special offers on the same day, it will just show again on the next day at the start time. So every day until the end date it shows for the begin and end time you have set for the product. There is no relation between end time and end date as it seems.

So I can go around it examble if I but the start time 00.00.01 and end time 23.59.00

In that case this is not problem at all.

 

Thank you very much :D

Link to comment
Share on other sites

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

So I can go around it examble if I but the start time 00.00.01 and end time 23.59.00

In that case this is not problem at all.

 

Thank you very much :D

Guess so, yes :D Just tried a little on a local installation and it indeed shows and goes in between the time set for every day. When you have the time set for, almost, the whole day it will show continiously until the end date applies.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

Hi Wheel of Time,

 

I think the idea is great. It helps me sell stuff I need to get rid of without violating price agreements.

 

As an American, I find the 24:00 o'clock awkward. Is there any way I can change it so it reads: 12:00 PM?

 

In addition, my server is 3:00 hours ahead of my time. How can I modify the code to subtract 3:00 hours?

 

I appreciate your response, I know it takes a lot of time to respond!!! I wish my PHP was better. I can read it, just don't know how to program it!!!

 

Matt Holcomb

Email me as a support ticket on my site at www.musicbizness.com.

Link to comment
Share on other sites

  • 4 weeks later...

Hi guys

 

thx for this great mod which I would like to use.... BUT.... :lol:

 

Admin side looks OK but catalog side.... big problem... :(

 

It looks like the box doesn't call application_top.php

I suppose it because of this error:

Fatal error: Call to undefined function: tep_random_select() in c:\program files\easyphp1-8\www\catalog\includes\boxes\happy_hours_specials_basic.php on line 20

 

All functions are not recognized and they exist in my general.php...

 

I saw on the contrib download page that Sanden had the same problem...

I've searched on this thread but no response....

 

Any ideas?

;)

Edited by M@verick
Link to comment
Share on other sites

  • 3 years later...

I have now tried everyting in this post, but items on Happy Hour does not display the correct price (The price is only correct in the box). In the product list it only display regular price or specials price.

If somebody has got this modul to work, I would be very thankfull for any suggestions on how to make it work :-)

Link to comment
Share on other sites

  • 6 months later...

Just a note to anyone who wants 12 hour time format shown in the Happy Hour box:

 

Find the following in catalog/includes/boxes/happy_hours_specials_basic.php:

	$uhrzeitbis = substr($random_product['happy_hours_end_time'], '0', '5');

And add after it:

	$uhrzeitbis = DATE("h:i A", STRTOTIME($uhrzeitbis ));

 

This will display the time as: 05:06 PM

 

From the PHP Date function info, you can change the way the date looks as follows:

a - Lowercase Ante meridiem and Post meridiem - am or pm

A - Uppercase Ante meridiem and Post meridiem - AM or PM

g - 12-hour format of an hour without leading zeros - 1 through 12

G - 24-hour format of an hour without leading zeros - 0 through 23

h - 12-hour format of an hour with leading zeros - 01 through 12

H - 24-hour format of an hour with leading zeros - 00 through 23

i - Minutes with leading zeros - 00 to 59

 

I fought with this contrib for many hours before finally getting it to fully work as it is supposed to, and to change the time to 12 hour format. Good luck to anyone who tries, however if you are after this feature, it is an awesome contrib.

Link to comment
Share on other sites

Just a quick hint for anyone having trouble with this contrib. After many hours of toying and playing, I found the following code change helped fix a problem with the dates having to overlap for it to work, and even then it still wasn't right.

 

The change involved is replacing the code now() with curdate().

 

In includes/function/general.php replace the inserted code:

///Added Happy hours specials


  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'];
 } 

//  End Happy hours specials

 

With:

 

///Added Happy hours specials


  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 CURDATE() > happy_hours_beginning_date and CURDATE() < 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'];
 } 

//  End Happy hours specials

 

I hope this helps someone. :)

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