Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Frontpage


nilla

Recommended Posts

In which file do I change how many items which show up on the frontpage?

 

Gunilla

 

 

you can go to admin panel and then configuration->maximum values and change search results option to your desired one

Engr. Mubashir

Link to comment
Share on other sites

you can go to admin panel and then configuration->maximum values and change search results option to your desired one

 

There is now such link in my version of OsCommerce to search option on configuration--> maximum values.

 

Gunilla

Link to comment
Share on other sites

Do you mean you don't have configuration or maximum values or both?

 

Yes, I have Configuration and Maximum value but I don´t know what to change to get more items in the middle column of the frontpage. I am not a newbee and if I know in which file the number of items on the frontpage is coded I can chage the code myself.

 

Gunilla

Link to comment
Share on other sites

Go to the same place as above and change the value for new products module.

 

I have done that, but whatever number of products I choose in the new products module, nine products show up on the fropntpage.

 

Gunilla

Link to comment
Share on other sites

It should be New Products Module in the Maximum Values in admin. If you change that and still get 9 do you get 9 when you increase it AND also decrease the number?

 

Do you have a cache contribution for your configuration table installed that might be blocking the change?

Link to comment
Share on other sites

I have done that, but whatever number of products I choose in the new products module, nine products show up on the fropntpage.

 

Gunilla

Can you post your code for catalog/includes/modules/new_products.php. Maybe something in your query string is setting this 9 products.

Link to comment
Share on other sites

Can you post your code for catalog/includes/modules/new_products.php. Maybe something in your query string is setting this 9 products.

 

Here is my new_products.php. I can´t se that there is something in the code that tell the frontpage to show only 9 products.

 

Gunilla

 

<!-- new_products //-->

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 

new contentBoxHeading($info_box_contents);

 

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

} else {

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

 

$row = 0;

$col = 0;

$info_box_contents = array();

while ($new_products = tep_db_fetch_array($new_products_query)) {

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="33%" valign="top"',

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));

 

$col ++;

if ($col > 2) {

$col = 0;

$row ++;

}

}

 

new contentBox($info_box_contents);

?>

<!-- new_products_eof //-->

Link to comment
Share on other sites

This is the part that sets a limit. Yours right now is 9.

limit " . MAX_DISPLAY_NEW_PRODUCTS);

It is defined in Admin-->Configuration-->Maximum Values-->New Products Module. Do you have more than 9 products in your db? What happens if you set the value to 2?

 

This part sets how many are in a row.

$col ++;
if ($col > 2) {
$col = 0;
$row ++;
}

The number 2 means there will be 3 products in a row. You set that value to one less than you want. This only affects the nember of products in a row.

Link to comment
Share on other sites

This is the part that sets a limit. Yours right now is 9.

limit " . MAX_DISPLAY_NEW_PRODUCTS);

It is defined in Admin-->Configuration-->Maximum Values-->New Products Module. Do you have more than 9 products in your db? What happens if you set the value to 2?

 

This part sets how many are in a row.

$col ++;
if ($col > 2) {
$col = 0;
$row ++;
}

The number 2 means there will be 3 products in a row. You set that value to one less than you want. This only affects the nember of products in a row.

 

Thak you for the answer.

 

I have at least 50 products in the db.

 

I can put any number in Admin-->Configuration -->Maximun Values --> New Products and it is still 9 products on the frontpage, even if I choose 2.

 

Gunilla

Link to comment
Share on other sites

Have you installed any cache contributions? Check in catalog/index.php, look for the following line. It should appear twice around lines 121 and 313.

			<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

Then check catalog/includes/filenames.php. Look to make you have this same exact line.

  define('FILENAME_NEW_PRODUCTS', 'new_products.php');

Link to comment
Share on other sites

Have you installed any cache contributions? Check in catalog/index.php, look for the following line. It should appear twice around lines 121 and 313.

			<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

Then check catalog/includes/filenames.php. Look to make you have this same exact line.

  define('FILENAME_NEW_PRODUCTS', 'new_products.php');

 

Yes, those code rows appears exactly as above in the two files, twice in the index file.

 

Gunilla

Link to comment
Share on other sites

What about the first part of that question?

 

Have you installed any cache contributions?

 

Sorry, I didn´t answer the first question. My answer is: I don´t know.

 

Last autumn I installed and translated the last version of OsCommerce. I have not installed any separate modules.

 

Gunilla

Link to comment
Share on other sites

Well this is odd. Default osc does not cache the new products module so if you did not install anything like that then that is not the problem.

 

Lets try and hard code a value in to see if it takes.

 

First make a backup copy of catalog/includes/modules/new_products.php. Then if the 2 query strings of that same file find

limit " . MAX_DISPLAY_NEW_PRODUCTS

Change both to

limit " . 2

See if that works. If it does work we will have find out why MAX_DISPLAY_NEW_PRODUCTS is not. If it doesn't, well back to the drawing board.

Link to comment
Share on other sites

Well this is odd. Default osc does not cache the new products module so if you did not install anything like that then that is not the problem.

 

Lets try and hard code a value in to see if it takes.

 

First make a backup copy of catalog/includes/modules/new_products.php. Then if the 2 query strings of that same file find

limit " . MAX_DISPLAY_NEW_PRODUCTS

Change both to

limit " . 2

See if that works. If it does work we will have find out why MAX_DISPLAY_NEW_PRODUCTS is not. If it doesn't, well back to the drawing board.

 

Yes, it did work! Only two products show up on the frontpage.

 

Gunilla

Link to comment
Share on other sites

Yes, it did work! Only two products show up on the frontpage.

 

Gunilla

 

I have changed from 2 to 12 and got 12 products on the frontpage - exactly what I wanted. Now another question appears. How do I choose which 12 products to show on the frontpage. I know that they show up in the order they have been added. But I want another order and many products are added the same day so it does not work to change the dates when they were added.

 

Gunilla

Link to comment
Share on other sites

Well glad that works but it still does not answer tthe question as to why it is not changing when you make the change in the admin section.

 

As to wanting to set which products are displayed, try this contribution.

Featured Products

 

As to the original problem, this has to be defined somewhere else that is overriding the database. If you want to look it would be in one of 3 files. Look for

define('MAX_DISPLAY_NEW_PRODUCTS', '9');

First in catalog/index.php

then in catalog/includes/languages/your_language_file_here.php

then in catalog/includes/languages/your_language_folder_here/index.php

 

If you find it in any of those files remove it. Then change your query strings back to the way they were and change your setting in the admin and see if it works. If it doesn't then I'm fresh out of ideas and you can go to the way it is working now.

Link to comment
Share on other sites

Well glad that works but it still does not answer tthe question as to why it is not changing when you make the change in the admin section.

 

As to wanting to set which products are displayed, try this contribution.

Featured Products

 

As to the original problem, this has to be defined somewhere else that is overriding the database. If you want to look it would be in one of 3 files. Look for

define('MAX_DISPLAY_NEW_PRODUCTS', '9');

First in catalog/index.php

then in catalog/includes/languages/your_language_file_here.php

then in catalog/includes/languages/your_language_folder_here/index.php

 

If you find it in any of those files remove it. Then change your query strings back to the way they were and change your setting in the admin and see if it works. If it doesn't then I'm fresh out of ideas and you can go to the way it is working now.

 

Sorry, but I can´t find this code row in any of the three files. Anyway,I now realize that if I choose 12 products I can´t in some easy way choose which items which show up and then its now idea to have 12 products.

 

Thank your for your patience with my problem.

 

Gunilla

Link to comment
Share on other sites

Then I am stumped. Put the query strings basck to 12 instead of MAX_DISPLAY_NEW_PRODUCTS. That will atleast put 12 products up.

 

If you want to control which products are displayed then try that contribution I linked to above called featured products. That will let you control which products to display.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...