Creating links that pull from specific categories

5 posts by 2 authors in: Forums > CMS Builder
Last Post: October 9, 2008   (RSS)

Hi, Team:

We finally got the Soul site up at www.SoultheSalon.com. Now, we would like to add a products section to the site with minimal effort. Here's what we're trying to accomplish:

+ We have a number of different product lines
+ Within each product line are a number of different product types

For example, the system has a product line called Davines. Davines makes a number of product types: shampoos, conditioners, style aids, oils, etc.

I have set up the product listing so that each product includes the product_line and product_type associated with the description, title, price, sku, etc.

We have multiple product lines, some that have just one product, and others that have 25 products. These are all of various types.

On the Product Listing page, we would like to show:
1. The different product lines with a description of each
2. A list of the different product types offered by the salon in that line.
3. A link for each product type so that when the user clicks on the product type, the system automatically generates a page that lists just the product types in that product line (i.e. Just "Davines shampoos")

Can CMS Builder handle this without our creating a separate PHP page for each product line? I'm not a coder, but I tried a couple of options, and nothing worked.

As an added note, each product line would also have a link to pull up All the products in that line.

Is it possible? Thanks in advance, T

Re: [tsuluwerks] Creating links that pull from specific categories

By Kenny - October 9, 2008

Let's split up the information.


For this you could do the following:

1. Create a NEW section called "Product Line" (product_line)

2. Set up the field in this section labeled "title" as a textfield and "content" as a textbox or WYSIWYG (this is default)

3. Enter in your Product Lines in that section.


Next, for your Products section:

1. Edit the field "Product Line" that you originally created to be a textfield and make it a list

2. Under LIST OPTIONS select "Get options from a database (advanced)

3. Section tablename = product_line

4. Use this field for option values = title

5. Use this field for option labels = title

6. Save - Now when you try to enter in a new product, a drop down list will appear with your list of Product Lines you put in your new section.


On your product pages, use the section code to creat a page that list your product lines with a decription.


Now you can create a special link that only lists specific records. Example: http://www.yourdomain.com/products.php?product_line=davines

Your coded link would look like this: http://www.yourdomain.com/products.php?product_line=<?php echo $record['title'] ?>




These instructions require you to know a little bit about some other common tasks to get this to work, but this is the basic premise. Post back if you get stuck somewhere.


Kenny

Re: [sagentic] Creating links that pull from specific categories

Thanks, Kenny! I was halfway there. I already had the two sections: I didn't know how to link them up and create the link. It took five minutes to link them up.

I'm about to test it.

[:)]

Re: [tsuluwerks] Creating links that pull from specific categories

By Kenny - October 9, 2008 - edited: October 9, 2008

You can hard code the link as

/product-line.php?product_line=Davines&product_type=shampoo

but I am not sure how to do it where it would be auto-generated. Maybe Dave can help with that one.


To use fields in the metadata, you would need to use the Detail Page code instead of OR in addition to List Page code.

One of the differences (besides the top of page code) is that the echo statements define exactly what table to pull from like this:

<?php echo $product-lineRecord['product_line'] ?>

You can put these almost anywhere on the page, even in the metadata.


On a List Viewer page, it would look like this:

<?php foreach ($product-lineRecords as $record): ?>
<?php echo $record['product_line'] ?>
<?php endforeach; ?>


These will only show up between the "foreach" and "endforeach" statements.

Let me know if that doesn't work.


Kenny