Forums / Setting Up Categories, Products, Attributes / Overide Number of Products per page for different categories.

Overide Number of Products per page for different categories.

Views: 881

Results 1 to 8 of 8
13 Dec 2014, 5:05 PM
#1
fourpaws avatar

fourpaws

New Zenner

Join Date:
Apr 2013
Location:
Johannesburg, South Africa
Posts:
13
Plugin Contributions:
0

Overide Number of Products per page for different categories.

I know where to set the number of products per page in the Admin>Maximum Values.

How do I setup, say 5 products on the page for category 1 and say 8 products for category 2?

What I am trying to achieve is:
In one of my categories I would like to have no products listed but when landing on the page have an image with clickable areas which would then take the customer to the product associated with that area.

14 Dec 2014, 2:00 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Overide Number of Products per page for different categories.

Sounds like you're talking about 2 completely different things.

  1. Different number-of-items-per-page per category.
    That's not a built-in feature. You could write custom code to do that.

But I don't see how that provides you anything related to your 2nd topic:

  1. Category needs a navigation image map.
    In this case, put the HTML for the image-map into the category description.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Dec 2014, 3:36 AM
#3
fourpaws avatar

fourpaws

New Zenner

Join Date:
Apr 2013
Location:
Johannesburg, South Africa
Posts:
13
Plugin Contributions:
0

Re: Overide Number of Products per page for different categories.

I am asking how to do your number (1)

I am not asking how to do your number (2).
I still need to create the image, map it and put the HTML code in the product description but there is no point if I can't get the one category to show "zero" products

14 Dec 2014, 7:28 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Overide Number of Products per page for different categories.

There's still something important missing from this discussion:

If the code is altered so that the category is treated as having 0 products, then how exactly do you intend to have its actual products get displayed?

ie: what category are your actual products really in?
If they're in the same category, how do you intend to make your "map" cause the actual products to appear?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Dec 2014, 9:11 PM
#5
fourpaws avatar

fourpaws

New Zenner

Join Date:
Apr 2013
Location:
Johannesburg, South Africa
Posts:
13
Plugin Contributions:
0

Re: Overide Number of Products per page for different categories.

Firstly let me answer your questions:

The category still has products, its just the landing page of one particular category that I would like no products displayed - just the mapped image. I would then embed each products URL into different areas of the image to get to each product.

The actual products are in the category.

The image will have the various URL's "mapped"

Maybe I misunderstand Zencart. Are you saying that if I enter a value of "0" in the "Configuration>Maximum values>Products Listing-Number per page" I will never be able to get to the products in that category not even by entering their URL in my browser?

My understanding is that I will not be able to see them on the Category page, but they will still exist and if I enter their exact URL I will be able to get to them.
If my understanding is incorrect - my idea will not work.

I hope that I have made sense here Dr Byte.

14 Dec 2014, 10:59 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Overide Number of Products per page for different categories.

Is this for just one category, or will you want to do this with several different categories?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Dec 2014, 11:07 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Overide Number of Products per page for different categories.

The following won't account for any filters by manufacturer etc. Just straight browsing to a certain cPath.

  1. /includes/modules/pages/index/main_template_vars.php
    around line 195 you'll see code that looks like the following. Add the line in red, substituting '21,55' with a list of categories to treat this way
    (ie: 21 would work for cPath=21 and also for 75_31_2_21 since 21 is the current category regardless of parents):
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  $tpl_page_body = 'tpl_index_product_list.php';
  if (in_array($current_category_id, array(21,55))) $tpl_page_body = 'tpl_index_product_list_hideproducts.php';
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////
} else {
  1. Then create the tpl_index_product_list_hideproducts.php file in your includes/templates/your_template/templates folder. It's basically an abbreviated clone of tpl_index_product_list.php:
<div class="centerColumn" id="indexProductList">

<h1 id="productListHeading"><?php echo $breadcrumb->last(); ?></h1>

<?php
if (PRODUCT_LIST_CATEGORIES_IMAGE_STATUS == 'true') {
// categories_image
  if ($categories_image = zen_get_categories_image($current_category_id)) {
?>
<div id="categoryImgListing" class="categoryImg"><?php echo zen_image(DIR_WS_IMAGES . $categories_image, '', CATEGORY_ICON_IMAGE_WIDTH, CATEGORY_ICON_IMAGE_HEIGHT); ?></div>
<?php
  }
} // categories_image
?>


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


<!-- you could put custom HTML here (affects all special categories) if you don't put it into the category description (for individual categories) -->

</div>

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

15 Dec 2014, 4:08 AM
#8
fourpaws avatar

fourpaws

New Zenner

Join Date:
Apr 2013
Location:
Johannesburg, South Africa
Posts:
13
Plugin Contributions:
0

Re: Overide Number of Products per page for different categories.

Works perfectly DrByte - Thanks you very much

For anyone else that wants this, I had to add one line so it read:
Otherwise the image showed up between the Category name and the Product category image

<div class="centerColumn" id="indexProductList">

<h1 id="productListHeading"><?php echo $breadcrumb->last(); ?></h1>

<?php
if (PRODUCT_LIST_CATEGORIES_IMAGE_STATUS == 'true') {
// categories_image
  if ($categories_image = zen_get_categories_image($current_category_id)) {
?>
<div id="categoryImgListing" class="categoryImg"><?php echo zen_image(DIR_WS_IMAGES . $categories_image, '', CATEGORY_ICON_IMAGE_WIDTH, CATEGORY_ICON_IMAGE_HEIGHT); ?></div>
<?php
  }
} // categories_image
?>
<div class="clearBoth"></div>

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


<!-- you could put custom HTML here (affects all special categories) if you don't put it into the category description (for individual categories) -->

</div>

EDIT:
Winmerge found the above for me (not me)