Build Your Own Business Website header image

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

Lesson 9 – Part 6 – Customize the Shopp Category Template

Difficulty Level -

Filed Under Topics -

Listed Under Lesson Subjects -

Applies to -

Show Featured and on Sale Products

Rick: The next thing we want to do is fix this, right? If there are products on sale or if there are featured products, we want to show them but if there aren’t products on sale then we don’t want to show anything.

Lanny: If there’s featured products, we want to show them. If there’s on sale products, we want to show them. If there’s both featured and on sale products, we want to show both. But if there’s not either one, we don’t want any of those.

Rick: Right. So let’s go over to our pages for a second and look at the shortcode we’d put in that. Catalog collection slug equals on sale so what I’m trying to find here is… I’m trying to find the right… okay, this shortcode is actually very extensive and let’s get that out of there for a second. We can put the on sale one here and featured is the other one. These shortcodes show the on sale or the featured so what we need to do now is fix this category page so that it doesn’t say store here and two, if no products are found then nothing displays.

Lanny: Right.

Rick: The way to do that is open up our customization files and I believe what we’re looking for is category. Maybe it isn’t category, maybe that one calls… let’s see, catalog… includes the Shopp shortcode. Okay, must be catalog then. Well okay, that doesn’t help. It does call catalog but then it calls catalog, products. Okay, it must be this one. I’m just missing it here.

Let’s see, it’s going to produce a div class equals category. Let’s see if that actually happened there. Inspect the element, no. Format text, okay so here’s an example of it when a product is found. Oh, here it is, else. Well, I guess the first thing to do is just get rid of the breadcrumb. For the time being, what we’re going to do is comment that line out so we’re not going to get our breadcrumb and if it’s not the landing page, I think really, what we want to do is simply delete this and I think I can probably do it just like that.

Creating Product Categories

I’m still missing the if Shopp. What I really want to do then is this then use a shorthand for this I think that makes it harder to read. Now we’ve just added that to it, go ahead and save document. Let’s open this up and that’s our category PHP. If we refresh this, okay featured products sale something. On sale doesn’t show anything because there’s nothing there to see and if we go to our regular old category view, that’s still working. I think we’re going to get rid of that subcategory thing now. Is there any reason why you want that subcategory thing there?

Lanny: On the other sidebar so…

Rick: Yeah, that was what I was thinking too so I’m just going to go ahead really and delete this line. I’m just going to comment out the line first. Now it looks pretty good. I guess the only other thing I’d do is probably just get rid of the second…

Lanny: Right.

Rick: Wait a sec, inspect that element and get rid of the category name. We already have a category name as part of the headline areas, I recall, right? Yeah, we have a category name up there so here, we’ll just comment that out. Okay, let’s see if I can comment out the HTML in this as well. So that’s greater than sign, exclamation point dash dash then it is dash dash and that sign. Okay actually, I think what we’ll do is… there we go. Now we’re going to comment out both of those lines without actually deleting them. There we go.

We come back to home, let’s see how it looks on our homepage now. Now it doesn’t say featured products. That was the upside of that was it said featured products. I suppose we could use Thesis to get rid of the heading instead. Now it does show featured products and I would probably change that from h3 to an h2.

I suppose what we could do here is just to make this only exist on the front page so we could add our own PHP here, if is front page. So we’ll ask if it’s the front page and if it is then we’ll print that. Otherwise, we won’t do anything. Okay so if it’s the front page, we’ll print the category and the name. Otherwise, we won’t do anything. Now featured products just show up just right. Okay, there it is, featured products. If we go over to Golf, it’s not going to show up. Now it’s just the main heading.

Save $200 on Membership Now!

Start learning today for as little as
$0.82 PER DAY!
Subscription Options
0 Comments… add one
0 comments… add one

Leave a Comment