Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / re; Category Page Layout V 1.39h

re; Category Page Layout V 1.39h

Views: 1,726

Results 1 to 11 of 11
13 Feb 2013, 9:32 AM
#1
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

re; Category Page Layout V 1.39h

re; Category Page Layout V 1.39h

I've noticed that the default page layout lists my category title first, the category description and then it lists my product listing.

Is it possible to have part of the category description displayed before the product listing and another more detailed category description showing after the product listing ?

It's just that if my category description is too long, my product listings get scrolled off the page view and the only way to see there is a product listing is the scroll down. This means customers won't see my product images unless they scroll further down.

I would prefer the customer saw the product listing on page load with a brief category description above and a more detailed category description below the product listing. This would help me get a more detailed category description without it all pushing down the product listing off the page view, when the category page first loads.

13 Feb 2013, 12:06 PM
#2
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: re; Category Page Layout V 1.39h

I achived this once by splitting description using php explode.

lots of examples about on the web.

Your category description would be some thing like:

This is a nice category, please broswe our products.%%You are now at the bottom of our page you can click to the next page to see more from this category.

notice how you seperate by a unique identifier in this case - %%

then you replace the part that outputs your category description like this:

create a template override file here:
includes/templates/YOUR_TEMPLATE/templates/tpl_index_categories.php

replace this:

<?php
  // categories_description
        if ($current_categories_description != '') {
    ?>
    <div id="categoryDescription" class="catDescContent"><?php echo $current_categories_description;  ?></div>
    <?php } // categories_description ?>
    

with this:

<?php
  // categories_description
        if ($current_categories_description != '') {
//added to split description
$splitthis  = $current_categories_description;
$pieces = explode("%%", $splitthis);
    ?>
    <div id="categoryDescription" class="catDescContent"><?php echo echo $pieces[0];  ?></div>
    <?php } // categories_description ?>
    

and then towards the bottom where you want the secon part simply put this:

<?php
  // categories_description second part
        if ($current_categories_description != '') {
    ?>
    <div id="categoryDescription" class="catDescContent"><?php echo echo $pieces[1];  ?></div>
    <?php } // categories_description ?>

heres what we are doing:
$splitthis = the category description variable
$pieces = explode("%%", $splitthis); - This is splitting the data into the sections.
echo $pieces[0]; // piece1 - this is where we echo out the piece 1
echo $pieces[1]; // piece2 - this is where we echo out the peice 2

%% would be placed between section 1 of your descriton and section 2 of your description.

you can split the data and spread it around the page where ever you like.

hope this helps.

13 Feb 2013, 1:09 PM
#3
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: re; Category Page Layout V 1.39h

Thanks Philip, much appreciated. I will follow up in due course. One of my concerns was not having enough category details, as it's become evident to me that Google crawls these category pages and ranks them. That said I did not want to push down my product images and descriptions list further, as I was concerned it could impact sales. i.e. the immediate visual experience that contributes to some sales.

13 Feb 2013, 1:26 PM
#4
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: re; Category Page Layout V 1.39h

that should do what you need then. so you could either move the standard code to the bottom of the page, or the method above to have some description above and some description below.

Good luck :)

13 Feb 2013, 4:44 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: re; Category Page Layout V 1.39h

This is a nice clean method for the task - thanks for sharing! There is a mod called Short Description for Categories intended to accomplish the same thing, but I haven't looked at it to know how it works.

One thing it does is to add a "...more info" link to the first description section. You could add a function like this by checking to see if pieces[1] is set and outputting the link tag after the first section if it is.

One point: the second description section should not have the same id as the first. Call it id="categoryDescription2" or something.

13 Feb 2013, 4:52 PM
#6
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: re; Category Page Layout V 1.39h

One thing it does is to add a "...more info" link to the first description section. You could add a function like this by checking to see if pieces[1] is set and outputting the link tag after the first section if it is.
great idea! :o) should be easily done with a check for the pieces[1] is there and id so add $currenturl . '#moredescription' and when outputting the bottom description make sure the hash tag is outpuuted too! :o)

One point: the second description section should not have the same id as the first. Call it id="categoryDescription2" or something.
good point, will fail validation otherwise won't it! good spot! :o) might be worth checking if you template has any styling applied to categoryDescription and iff so add categoryDescription2 to it also.

:)

13 Feb 2013, 4:54 PM
#7
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: re; Category Page Layout V 1.39h

gjh42:

This is a nice clean method for the task - thanks for sharing! There is a mod called Short Description for Categories intended to accomplish the same thing, but I haven't looked at it to know how it works.
i think when i came up with this i looked at using that mod myself but decided not to as it changed files in the admin and extra db entries i think. I'm a bit of a minimalist!! hehe

13 Feb 2013, 5:11 PM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: re; Category Page Layout V 1.39h

Yes, a whole new table or table field if not absolutely necessary doesn't make sense to me either. Of course there are people who can't or won't remember to add %% dividers, but just want to enter the two description sections in separate text boxes.

13 Feb 2013, 5:25 PM
#9
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: re; Category Page Layout V 1.39h

Very true! Oh well a solution for everyone :P

6 Jul 2014, 3:00 AM
#10
heyits007 avatar

heyits007

Zen Follower

Join Date:
Sep 2010
Posts:
270
Plugin Contributions:
0

Re: re; Category Page Layout V 1.39h

gjh42:

This is a nice clean method for the task - thanks for sharing! There is a mod called Short Description for Categories intended to accomplish the same thing, but I haven't looked at it to know how it works.

I just tried to get this v 1.51 mod working for V 1.39 but failed.

"Warning: require(index_filters/default_filter.php) [function.require]: failed to open stream: No such file or directory in {my shopping site}/includes/modules/pages/index/main_template_vars.php on line 191"

The mod was updated for v1.51, so not sure if that means it won't work for versions under 1.50, but the instructions suggest that you are on your own for prior versions. i.e.. "We offer no advice for ZenCart versions prior to that."

Anyone out there with ZenCart v1.39 had any success with this mod? I might try one of the lower versions. Perhaps the 1.37 mod.

6 Jul 2014, 3:41 AM
#11
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: re; Category Page Layout V 1.39h

If you want to use the mod from Plugins, I would find out which version of it was released just after your ZC version, or follow the "compatible with" tags on the mod download page.

I think the mod posted here is fully functional for any version of ZC, and will be cleanest to install and maintain through upgrades.