The Official Website of AgoraCart and Agora.cgi
AgoraCart.com Demos Download AgoraCart User Manuals & Wiki Gold Members Forum Go Gold Now! Gold Version Memberships

AgoraCart.com

About
Features
Download
Payment Gateways
Send a Donation
Founders Club
BLOG: News & Updates

Showcases & Demos

AgoraCart Demos
Shop Live Stores

Downloads & Add-ons

Gold Version Downloads
DBwizz Database Mgr.
AgoraCart.com Store

Help & Support

User Manuals
Gold Version Users Forum
Gold Version Chat
Tech Support
Certified Agora Pros
Certified Designers
Hire a Freelancer

Gold Version Members

Member Benefits
Join Today!
Gold Members Home
Gold Version Users Forum
Gold Version Chat Rooms
Gold Version Downloads

For Store Owners

Merchant Accounts
Cool Resources
Advertise Here
"Powered by" Logos
Web Hosting Search

Misc.

Contact Us
MEET's Talking Guide
The Ancient Greek Agora






AgoraCart Free User Forums

This is the official FAQ and Cool Tips guide For the AgoraCart shopping Cart software


Official Sponsors of the AgoraCart Project:

       


RegisterSearchFAQLog in
Reply to topic Page 1 of 1
Generation of Different 'Display' Links in the search page
Author Message
Reply with quote
Post Generation of Different 'Display' Links in the search page 
I've been adding a small amount of custom code to my productPage-search.inc page to allow for the inclusion of two
different 'Display' links based on the %%CategoryID%% token.

The code is shown below:

<TD COLSPAN=2 align=right>

<!--agorascript-pre
&capture_STDOUT;

# Conditional Link Printing - we need to display two different page layouts, one for BAC libraries
# and the other for Nylon Filters/Pools and Superpools

my $product_name = "%%CategoryID%%";

if($product_name eq 'Nylon_Filters' || $product_name eq 'Pools_and_Superpools')
{

print"<A HREF=\"%%scripturl%%?cart_id=&p_id=%%ProductID%%&xm=on&ppinc=1a1\">";

}
elsif($product_name eq 'BAC_Library')
{

print"<A HREF=\"%%scripturl%%?cart_id=&p_id=%%ProductID%%&xm=on&ppinc=1a\">";

}
# End conditional html printing

&uncapture_STDOUT;

-->

<FONT FACE=ARIAL>Display</FONT></A>
</TD>

The trouble is that no links are printed, obviously because the 'if' statements are not returning true. However, they should be. Printing out
the variable $product_name when debugging correctly returns one of the three product categories we have in our store: Nylon_Filters, Pools_and_Superpools, and BAC_Library. Since these are the only three possibilities, and they are covered by my if statement, I don't understand why the links are not being conditionally displayed in my browser.

Is it the way agora.cgi is handling the code, or have I just been staring at the page for too long and can't see the glaring error that is looming there?

Thanks once again for your help Surprised


_________________
I could set the building on fire..
http://www.punchcard-pcs.com/gaming_graveyard
View user's profile Send private message Visit poster's website
Reply with quote
Post  
you need to encapsulate your tests:

if ( (test1) || (Test2) ) {

}


_________________
a common man built the Arc,
Modern Engineers built the Titanic.
View user's profile Send private message Visit poster's website Yahoo Messenger
Reply with quote
Post Order of precedence 
The order of precedence is 'eq' before 'or', and in any case trying that change did not resolve the issue. Thank you though for the suggestion.

Can anyone else offer a solution?

Thanks again,


_________________
I could set the building on fire..
http://www.punchcard-pcs.com/gaming_graveyard
View user's profile Send private message Visit poster's website
Reply with quote
Post  
hell-o
instead of %%CategoryID%% and %%ProductID%% just try %%product%%. this will return the category name.
regards,
dan

Reply with quote
Post I tried %%product%% 
I tried %%product%%, but that value doesn't return anything to the variable when I try to assign it to my $product_name variable.

I've tried pattern matching expressions in this code as well to see if maybe there was some sort of hidden formatting or something else I was missing, and it just is not working. I'm scratching my head over this one.

If you want to check it out, here is the store URL:

http://www.genomex.com/cgi-bin/library_store/agora.cgi

Run a search on something like 'deer', and you'll see it doesn't come
up with any 'Display' links, but I am having it print the value of $product_name in its place.

Thanks for the ideas thus far.


_________________
I could set the building on fire..
http://www.punchcard-pcs.com/gaming_graveyard
View user's profile Send private message Visit poster's website
Reply with quote
Post  
hell-o

looking at your code again you have only 1/3 of the href link. you need to have the link name printed and the </a>:


<!--agorascript-pre
&capture_STDOUT;

# Conditional Link Printing - we need to display two different page layouts, one for BAC libraries
# and the other for Nylon Filters/Pools and Superpools

my $product_name = "%%CategoryID%%";

if($product_name eq 'Nylon_Filters' || $product_name eq 'Pools_and_Superpools')
{

print"<A HREF=\"%%scripturl%%?cart_id=&p_id=%%ProductID%%&xm=on&ppinc=1a1\"> %%ProductID%% </a>";

}
elsif($product_name eq 'BAC_Library')
{

print"<A HREF=\"%%scripturl%%?cart_id=&p_id=%%ProductID%%&xm=on&ppinc=1a\"> %%ProductID%% </a>";

}
# End conditional html printing

&uncapture_STDOUT;

-->

without the link name and the </a> you wont get anything printed on the screen though it maybe there in the source as a malformed link.

regards,
dan

Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum