VP-ASP :: Shopping Cart Software

Shopping Cart Software Solutions for anywhere in the World

US/Canada(Toll Free): +1 888 587 2278
Europe/UK: +44 (020) 7193 9408
Australia/New Zealand: +61 3 9016 4497

VP-ASP Shopping Cart Customer Forum

Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VPCart Forum
 Customization
 IF/THEN statement using pother2 field
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

talltexan
Starting Member

USA
6 Posts

Posted - March 15 2005 :  19:25:47  Show Profile  Reply with Quote
VPASP 5.5

I'm working on a lingerie site and need to incorporate a link in my tmp_product.htm file which will display a sizing chart if the pother2 product field meets a certain criteria. I'm using the pother2 field in certain products to flag that product as having a sizing chart link.

How do I refer to the pother2 field in the IF/THEN statement?

For example:

IF ??pother2?? = "sizingchart" THEN
<a href> tag
END IF



------------------------
It takes a big man to cry, but it takes a bigger man to laugh at that man - Jack Handey

devshb
Senior Member

United Kingdom
1898 Posts

Posted - March 16 2005 :  03:22:37  Show Profile  Visit devshb's Homepage  Reply with Quote
You can't add any "if" logic to the templates as they won't accept any vbscript directly.

If doing something like this you'd need to create new template fields/functions, either directly in shopfileio.asp, or through something like our extra-template-fields addon:

http://bigyellowzone.com/shopexd.asp?id=42

(that comes with quite a few examples, including one with an if statement, and one with a category query, so you could simply change the examples if you wanted and rename them, or you could create new ones based on an example)

The only exception to not being able to use if logic directly in the templates is that you can use $ at the front of the line if all you want to do is check if the value is not null.

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
Web Design, Online Marketing and VPASP addons

Edited by - devshb on March 16 2005 03:47:13

Edited by - devshb on March 16 2005 03:47:53
Go to Top of Page

atari
Starting Member

30 Posts

Posted - March 17 2005 :  11:59:07  Show Profile  Reply with Quote
Ok to do this you have to take a look at the file template, and how the tags work... this is what I mean.

In your file template, you'll see this:
[formatcurrency cprice]

to make your own ones of these you must edit 2 files:
first file. shopproductformat_template.asp
go to line 70 and you'll see a select case statement. add your own case to it. I added:

Case "FORMATLOCKLINKS"
FormatLockLinks
Now when you add
[formatlocklinks] to the template file it will find this and direct it to the sub "FormatLockLinks"

that sub should be added to shopproductformat.asp
I suggest after the sub "FormatDescription" around line 114.

Make sure you comment the hell out of this so you, or future webmasters will know that this is not native code.

Add all logic you need to here.

for an example of this go to my page www.rackattack.com. Look at the products. You'll see that some have "Buy Locks" or "Instructions" links in the display, and some don't. I used this subroutine system to do this. Basically it searches my instruction folder, if it finds a .pdf instruction for that item, it adds a link, if no istructions are there it doesn't... fun hey?

so I think this is exactly what you want to do.

you're welcome


Go to Top of Page

devshb
Senior Member

United Kingdom
1898 Posts

Posted - March 17 2005 :  12:34:50  Show Profile  Visit devshb's Homepage  Reply with Quote
I might be wrong, but I think those files are only relevant to the summary pages and/or summary pages which don't use templates.

shopfileio.asp is the key file that'd need the new fields/functions added; that's what our template-fields addon applies the changes to (via includes).

shopfileio.asp processes 2 different types of fields; one with arguments, and one without (and the ones without arguments are further split down into formatting functions or implicit raw database values/columns). they work in totally different ways to each other and the logic they use is pretty convoluted and hard to follow. hence why we spent ages trying to create a simple/central way of being able to add/maintain your own template-fields in separate files including lots of examples and detailed step-by-step how-to-documentation, and where you can also call those functions as vbscript functions and not just restricted to templates.

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
Web Design, Online Marketing and VPASP addons

Edited by - devshb on March 17 2005 12:50:39
Go to Top of Page

atari
Starting Member

30 Posts

Posted - March 17 2005 :  15:07:53  Show Profile  Reply with Quote
The files I talked about contain the exact code I've talked about.

go to my site and take a look at the links, or in the EXD pages the link to Thule spare parts.

all of these things are added in the way I have written. It's the way the other VPASP tags are handled as well.

I figure it's easyest to add only
[customTag] to the template, and have it work.

but that's just me.
-s

Go to Top of Page

talltexan
Starting Member

USA
6 Posts

Posted - March 19 2005 :  01:13:51  Show Profile  Reply with Quote
Thank you all for your responses. I've managed to work this out in a fairly simple way, using the pother2 and pother3 fields.

For products needing a sizing chart, the pother2 field containsthe text for the link to the chart page, i.e. View Sizing Chart. The pother3 field contains the filename of the chart to be displayed, e.g. xsizechart.htm.

I added the following code to my tmp_product.htm file:

<a href="javascript:PopWin('[pother3]','','470','471');"><b>[pother2]</b></a>

This opens a pop-up window with the particular sizing chart specified in the pother3 field. It seems to be working well.

------------------------
It takes a big man to cry, but it takes a bigger man to laugh at that man - Jack Handey

Edited by - talltexan on March 19 2005 01:15:03
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000