Gossamer Forum
Home : Products : DBMan : Customization :

Displaying Specials

Quote Reply
Displaying Specials
Hi,

I want to add the following feature.

I have a select field with options of yes or no. If an Item has the option of yes, I want to do the following.

On my webstie homepage (not DBman homepage), I want to have a link when clicked will display a list of all the items that are on special. So I need the script to look in the database and bring up all the items that have "Yes" in the field Discount, and list it.

**I saw a similar explanation in the fourum but sadly it went over my head. please remember I am a bit of a novice**

Thank You
Quote Reply
Re: [jamaicasearch41] Displaying Specials In reply to
In Reply To:
Hi,

I want to add the following feature.

I have a checkbox field with options of yes only "check or leave it unchecked". If there is a special being offered the box is checked to select "yes", I want to do the following.

On my website homepage (not DBman homepage), I want to have a link when clicked will display a list of all the items that are on special. So I need the script to look in the database and bring up all the items that have "Yes" in the field Discount, and list it.

**I saw a similar explanation in the fourum but sadly it went over my head. please remember I am a bit of a novice**

Thank You
Quote Reply
Re: [jamaicasearch41] Displaying Specials In reply to
Assuming this is the "default" database, your link would look like

$db_dir_url/db.cgi?db=default&uid=default&view_records=1&Discount=yes&sb=3


Find the $db_dir_url in your .cfg file. It will be the first line that you edited.

If your field that lists the specials is called something else, replace Discount with the correct name of the field. The field name must be exactly the same as you defined it in your .cfg file, including the case.

I added the &sb=3 in case you wanted the results sorted. If you don't care what order they come in, just leave that off. If you do want the results sorted, replace the 3 with the number of the field you want to sort by.

I understand that you want answers quickly. I check the board several times through the day, but I spend the evenings with my husband. If you have a problem late in the day, you will probably not get an answer until the next day.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.

Last edited by:

JPDeni: Apr 4, 2005, 7:10 AM
Quote Reply
Re: [JPDeni] Displaying Specials In reply to
Hi JPDeni,

Thanks very much for your response and help, It worked great. I have one more thing i would like to do.

Notice in the below in my html.pl that i hide the price so that admin alone can see it. what i would like to do is that while the "admin only price view" remains in place, It would however show the prices for items that are selected to be on special. Is this possible

..........................................................................................................................
if ($per_admin) {
print qq|<TR><TD ALIGN="Right" VALIGN="TOP" width="169"><$font_color>Price:</FONT></TD>
<TD width="430">&nbsp;<$font><b>$rec{'Price'}</b></Font></TD></TR>|;
}
else {
print qq||;
}

.......................................................................................................

Thank in advance
Everton
Quote Reply
Re: [jamaicasearch41] Displaying Specials In reply to
There are two possibilities here. One would be that any record where Discount is equal to yes, no matter what search terms were used, would show the price. Here's the code for that:

Code:
if ($per_admin or ($rec{'Discount'}=='yes')) {
print qq|<TR><TD ALIGN="Right" VALIGN="TOP" width="169"><$font_color>Price:</FONT></TD>
<TD width="430">&nbsp;<$font><b>$rec{'Price'}</b></Font></TD></TR>|;
}

If you only want to show the price when they have done a search for specials, as in when they used the link from your first page, use the following:

Code:
if ($per_admin or $in{'Discount'}) {
print qq|<TR><TD ALIGN="Right" VALIGN="TOP" width="169"><$font_color>Price:</FONT></TD>
<TD width="430">&nbsp;<$font><b>$rec{'Price'}</b></Font></TD></TR>|;
}

Either way, you can delete the lines

Code:
else {
print qq||;
}

They are lines that the Configurator includes because of the way the programming is. But you can delete them because they really don't do anything.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Displaying Specials In reply to
Hi JPDeni,

I tried both method but it still show still show still show the prices wether the item is on specail or not: *

sample:1 - shows a car on special -see "on special" in red at the bottom and FOB Price for $7000.00 above

1. http://www.seicars.com/...=3&nh=1&mh=1

sample:2 - Notice this record is not on specail yet the FOB price of $14,062.00 is still showing.

2. http://www.seicars.com/...ds&nh=1&mh=1

here is my sub html_record_long:-

if ($per_admin or ($rec{'Special'}=='Yes')) {
print qq|<TR><TD ALIGN="Right" VALIGN="TOP" width="169"><$font_color>FOB Price: </FONT></TD>
<TD width="430">&nbsp;<$font>$disp_Price</TD></TR>|;
}

Here is my default.cfg:- **the 2 accurances **

Special => [42, 'alpha', 0, 3, 0, '', 'Yes'],


# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = ( Graphic => 'Yes' );
%db_checkbox_fields = ( Special => 'Yes' );


Everton
Quote Reply
Re: [jamaicasearch41] Displaying Specials In reply to
Did it work correctly when it was just if ($per_admin) { ?

Since it's a checkbox and the options for the field are either Yes or nothing at all, you should be able to use

if ($per_admin or $rec{'Special'}) {

Give that a try.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.
Quote Reply
Re: [JPDeni] Displaying Specials In reply to
Hi JpDeni

I honestly dont know how much to say thank you for your help, It is a rear thing when someone extented themselves to such greta extent to assist others i am eternally greatfull to you


The last coding worked.!

Thank and many more thanks

**
I am from Jamaica, and if there is anything Jamaican you like I would be more happy to oblige.

Everton
jamaicasearch@hotmail.com