Forums / Setting Up Specials and SaleMaker / Need code to check if sale is active

Need code to check if sale is active

Started by kwright on 23 Nov 2011, 8:25 PM · Views: 1,138

Results 1 to 3 of 3
23 Nov 2011, 8:25 PM
#1
kwright avatar

kwright

Zen Follower

Join Date:
Nov 2004
Posts:
355
Plugin Contributions:
0

Need code to check if sale is active

Greetings all,

I would like to display content base on if a salemaker sale is active.

Is there a function I can call that will return a T/F value I can test?

Any suggestions? :smile:

Thanks!

Experience is what you get when you don’t get what you want…

23 Nov 2011, 8:47 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Need code to check if sale is active

Is your question whether "any" sale is active?
Or is it whether a "specific" sale is active? And if so, how do you intend to identify which "specific" sale?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Nov 2011, 9:54 PM
#3
kwright avatar

kwright

Zen Follower

Join Date:
Nov 2004
Posts:
355
Plugin Contributions:
0

Re: Need code to check if sale is active

Thanks for the reply DrByte,

Since we only do a single "All Item" sale at a time, any sale detection would work.

As a test, I just wrapped my items to display around the following code. It seems to work, but makes a db call:

$sale = $db->Execute("select sale_status from " . TABLE_SALEMAKER_SALES . " where sale_status = '1' and sale_categories_all != '' and sale_date_start <= now() and sale_date_end >= now()");
	if ($sale->RecordCount() >= 1) {

echo "Stuff to Display";

}

BTW, the stuff I want to display is in the cart sidebox if that makes a difference! :clap:

Experience is what you get when you don’t get what you want…