Home : Products : Gossamer Links : Discussions :

Products: Gossamer Links: Discussions: List links in a category, with extra info grabbed from another link?: Edit Log

Here is the list of edits for this post
List links in a category, with extra info grabbed from another link?
Hi all,

I want to take a new approach for my "buy now" link implementation (see first post here), and could really use some help in creating a global. I could also use anyone's comments on whether what I'm proposing is even an intelligent path to take...

I've created some categories and links that follow this format:

Products (cat)

- Specific Product Name (link)

Buy Now Links (cat)

- Specific Product Name (sub-cat)

- - Links to retailers that sell that specific product (links - Title = Retailer name, URL = URL of specific product page at retailer's site)

Retailers (cat)

- Country name (sub-cat)

- - Links to retailers in that country (links - Title = Retailer name, contains custom columns - campaign # and banner #)

As you can see, with the Buy Now Links category, I've created a tree that's similar to the Products category, just listing what's a link in Products as a sub-category in Buy Now Links. This was the simplest solution I could find to allow a product to have multiple links associated with it. note: My original implementation did this with one custom column in each link, containing comma-separated values and newlines (Retailer1,URL1\nRetailer2,URL2\n), which were brought out by using split() twice - once for the newlines, and a second time for the commas, to get those values out. This worked, but would not allow non-moderators (ie Retailers) to add/modify buy now links.

The Retailers category exists as a central place to store information needed for links to retailers (the retailer's country, description, campaign #, and banner #), without having it exist redundantly in all the links in Buy Now Links. Buy Now Links will contain many links of the same Title (retailer name) with different URLs (product page on retailer's site), since each retailer presumably sells lots of different products!

When a user looks at the detailed page for a Specific Product page under Products, I'd like to call a global that does the following:

1. Search the Buy Now Links category for a sub-category that contains the Specific Product Name (the Title of the current link).

2. If it finds a match, then for each of the links under that sub-category, use it's Title (Retailer name) to search the Retailers category for the Retailer (link) it refers to.

3. When it finds the retailer in the Retailers category, return the sub-category it's located in (Country name), it's description, it's campaign #, and it's banner # (at this point, we should also return the Title and URL of the link found in the Buy Now Links category (the URL of the link in Buy Now Links category will be different from the URL of the link in the Retailers category)).

I'd like to be able to access the global with something like this in the detailed template:

<%buynowlinks('<%Title%>')%>
<%loop Buy_Now_Links_Loop%>
<%title%><%country%><%description%><%campaign_num%><%banner_num%><%URL%>
<%endloop%>

Of course I'll display things differently inside the loop, but those are the variables I want to display and need for generating my buy now link code that works with AdvertPro.

What I particularly like about this approach is that I can easily allow editors (even retailers and regular visitors/volunteers!) to add/remove/modify buy now links just as easily as adding a link to the directory, and have it go through the regular validation process. I also like that the retailer's country, description, banner #, and campaign # are stored in one database entry, rather than manually inserted in every single buy now link. The only pain I foresee will be adding a new category in Buy Now Links every time I add a new product in Products (well, assuming I want to have buy now links for that new product). Perhaps that could be automated?

I hope to have around 250 products, 40 retailers, and about 10 retailers (buy now links) for any given product. When I get lots of hits in the Products category, will this global cause performance problems? It seems like a lot of database access, but I'm no expert at mySQL... Should these queries be rather quick? Is there a better way of acheiving the end result I'm looking for?

Thank you in advance for your help!!

Stephen

Last edited by:

biketrials: Jul 9, 2003, 12:36 AM

Edit Log: