Jump to content

Archived

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

bktrain

Modifying Sub Category Image & Text Links

Recommended Posts

Terry, are you talking about the pics on the right in yuour Top 10 box? If so look in catalog/includes/boxes/bestsellers.php. Thats where your problem is.

 

Hi Brian

 

Sorry for the delay in getting back to you. For some reason I'm not receiving email notifications of replies (yes I did check the box).

 

Thanks for the pointer, I did know that the problem lie in the best sellers box but despite numerous attempts I still can't get the pictures to show.

 

Here's the code:

<?php
/*
 $Id: best_sellers.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 if (isset($current_category_id) && ($current_category_id > 0)) {
   $best_sellers_query = tep_db_query("select distinct p.products_id,p.products_image, pd.products_name, pd.products_url, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
 } else {
   $best_sellers_query = tep_db_query("select distinct p.products_id,p.products_image, pd.products_name, pd.products_url, p.products_image from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
 }

 if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {
?>
<!-- best_sellers //-->
<tr>


                     <TD   background=""colSpan=3 width="179" align="center"><IMG alt=Top 10

                      src="images/TOP 10 copy.gif" ></TD></TR>
         <tr>
           <td  colSpan=3 width="135" align="right" bgcolor="091C01" align="center">
<?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_BESTSELLERS);

  // new infoBoxHeading($info_box_contents, false, false);

   $rows = 0;
   $bestsellers_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1" align="center">';
   while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
     $rows++;
     $bestsellers_list .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td>' .
     						'<td class="infoBoxContents" align="center">' .
     							'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' .   $best_sellers['products_name']  .  '</a><BR>' .
							'<a href="java script:top.addTrack(\''. $best_sellers['products_id'].'\', \''. $best_sellers['products_name'].'\', \''. (DIR_WS_IMAGES . $best_sellers['products_image']).'\',\''. ( $best_sellers['products_url'] ).'\', true);">' .
                                         					'<IMG SRC="images/release_april2008/add_and_play_music.jpg" ALT="Play Track" border="0" align="center"></a>' .
                                         					'<BR><a href="java script:top.addTrack(\''. $best_sellers['products_id'].'\', \''. $best_sellers['products_name'].'\', \''. (DIR_WS_IMAGES . $best_sellers['products_image']).'\',\''. ( $best_sellers['products_url'] ).'\', false);">'						. '<IMG SRC="images/release_april2008/add_music.jpg"  ALT="Add Track to the Play List" border="0" align="center"></a>' .      							
     						'</td></tr>';
   }
   $bestsellers_list .= '</table>';

   $info_box_contents = array();
   $info_box_contents[] = array('text' => $bestsellers_list);

   new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- best_sellers_eof //-->
<?php
 }
?>

 

If you have any suggestions it would be much appreciated.

 

Best

 

Terry

Share this post


Link to post
Share on other sites

Terry

Did you get it fixed? I don't see any broken images.

 

Brian


Remember to backup database, files and pictures.

 

I have a problem for your solution

I reject your reality and substitute my own

My mind not only wanders, it sometimes leaves completely

The problem with the gene pool is that there is no lifeguard

Everyone’s entitled to my opinion

 

Links

Security

SSL Help

Basics for design V2.3+

Share this post


Link to post
Share on other sites

Hi Brian,

 

Thank you for your solutions. I think that click and get a blank page is no good for any web page design. So is it possible to make the main category unclickable whenever there is sub-category?

 

I guess that we should work around the category loop and check if there is any products residing in that category/sub-category. I'm not good at programming but I'd like to try. Thank you in advance.

 

Regards,

Mr. Tsang

Share this post


Link to post
Share on other sites
Hi Brian,

 

Thank you for your solutions. I think that click and get a blank page is no good for any web page design. So is it possible to make the main category unclickable whenever there is sub-category?

 

I guess that we should work around the category loop and check if there is any products residing in that category/sub-category. I'm not good at programming but I'd like to try. Thank you in advance.

 

Regards,

Mr. Tsang

I don't quite understand what you're looking for. Can explain a little bit more and maybe provide a link showing what and where?


Remember to backup database, files and pictures.

 

I have a problem for your solution

I reject your reality and substitute my own

My mind not only wanders, it sometimes leaves completely

The problem with the gene pool is that there is no lifeguard

Everyone’s entitled to my opinion

 

Links

Security

SSL Help

Basics for design V2.3+

Share this post


Link to post
Share on other sites
I don't quite understand what you're looking for. Can explain a little bit more and maybe provide a link showing what and where?

 

Thank you for your reply and sorry about my poor descriptions. Let me clarify it. When we have removed sub-category text and/or image links, visitor would get a blank center column if he or she clicks the category name. So is there any way to disable these kind of buttons?

 

I agree that if the sub-category are very long, it's good to show all text and/or image links on the center column. Thank you.

 

Regards,

Mr. Tsang

Share this post


Link to post
Share on other sites
When we have removed sub-category text and/or image links, visitor would get a blank center column if he or she clicks the category name.

There should not be an empty space. Can you give a link so I can see what you have?


Remember to backup database, files and pictures.

 

I have a problem for your solution

I reject your reality and substitute my own

My mind not only wanders, it sometimes leaves completely

The problem with the gene pool is that there is no lifeguard

Everyone’s entitled to my opinion

 

Links

Security

SSL Help

Basics for design V2.3+

Share this post


Link to post
Share on other sites
There should not be an empty space. Can you give a link so I can see what you have?

 

You're right. The default installation of osCommerce comes with "New Products for Month" box in the center column so there should not be an empty space in the center column. However, as with many people, I have removed "New Products for Month" box. Should have told you about that earlier :blush:

 

I've made a fresh installation of osCommerce at www.saiwah.com/catalog and did the following quick modifications.

 

1. Sub-category image & text links removed

2. New Products of Month box removed

3. Modern Template for RC2a v1.0 installed for the good looking menu.

 

With this template installed, sub-category menu pops up whenever there is mouse over those Categories with sub-category. The problem is that the central part of the store remains empty upon clicking "Hardware" etc . So in my opinion, those buttons should be inactive.

 

Hope these clarify my concerns. Thank you

 

Regards,

Mr. Tsang

Share this post


Link to post
Share on other sites
You're right. The default installation of osCommerce comes with "New Products for Month" box in the center column so there should not be an empty space in the center column. However, as with many people, I have removed "New Products for Month" box. Should have told you about that earlier :blush:

 

I've made a fresh installation of osCommerce at www.saiwah.com/catalog and did the following quick modifications.

 

1. Sub-category image & text links removed

2. New Products of Month box removed

3. Modern Template for RC2a v1.0 installed for the good looking menu.

 

With this template installed, sub-category menu pops up whenever there is mouse over those Categories with sub-category. The problem is that the central part of the store remains empty upon clicking "Hardware" etc . So in my opinion, those buttons should be inactive.

 

Hope these clarify my concerns. Thank you

 

Regards,

Mr. Tsang

You may want to look into whatever contribution you added for the menu on the left. See if you can remove the link from the top level categories.

 

The reason why you have an empty space is because you removed everything from the center accept for the heading Categories and categories image on the right. Couple that with the length or your right and left columns you have all that empty space.


Remember to backup database, files and pictures.

 

I have a problem for your solution

I reject your reality and substitute my own

My mind not only wanders, it sometimes leaves completely

The problem with the gene pool is that there is no lifeguard

Everyone’s entitled to my opinion

 

Links

Security

SSL Help

Basics for design V2.3+

Share this post


Link to post
Share on other sites

Hi all,

this thread is very helpful,

I am having a related problem. All my sub cat images are appearing twice

 

see here http://favouriteflies.com/index.php/cPath/51

 

anyone know how I can sort this out?

 

Regards

 

Dave

What were you trying to do? Did yo make any modifications to your index page?


Remember to backup database, files and pictures.

 

I have a problem for your solution

I reject your reality and substitute my own

My mind not only wanders, it sometimes leaves completely

The problem with the gene pool is that there is no lifeguard

Everyone’s entitled to my opinion

 

Links

Security

SSL Help

Basics for design V2.3+

Share this post


Link to post
Share on other sites

I have put this tip into a contribution for osCommerce 2.3.1.

 

Install is quick and easy. All options are changed in the admin.

 

Hope you find it useful.

 

You can download it here. SubCategory Links


Remember to backup database, files and pictures.

 

I have a problem for your solution

I reject your reality and substitute my own

My mind not only wanders, it sometimes leaves completely

The problem with the gene pool is that there is no lifeguard

Everyone’s entitled to my opinion

 

Links

Security

SSL Help

Basics for design V2.3+

Share this post


Link to post
Share on other sites

Hi BkTrain,

 

Really nice contrib. Been really helpful to me.

 

I would like to ask if there is a way to create alternate category page display instead of the category links and boxes like;

 

1. Show a Large Category image or place holder script

2. list all products under a main category

 

It would be pretty nice way to have different page look and feel.

 

Any pointers?

 

Thanks

Share this post


Link to post
Share on other sites

Hi BkTrain,

 

Really nice contrib. Been really helpful to me.

 

I would like to ask if there is a way to create alternate category page display instead of the category links and boxes like;

 

1. Show a Large Category image or place holder script

2. list all products under a main category

 

It would be pretty nice way to have different page look and feel.

 

Any pointers?

 

Thanks

Not sure I follow your question.

 

What is it you're trying to do?


Remember to backup database, files and pictures.

 

I have a problem for your solution

I reject your reality and substitute my own

My mind not only wanders, it sometimes leaves completely

The problem with the gene pool is that there is no lifeguard

Everyone’s entitled to my opinion

 

Links

Security

SSL Help

Basics for design V2.3+

Share this post


Link to post
Share on other sites

Not sure I follow your question.

 

What is it you're trying to do?

 

HI Brian,

 

Many thanks for all the advice you provide to newbies like myself. I have an OSC 2.3 store witha template loaded top. I'm trying to remove the subcategory images and text but when i have followed the instructions at the beginning of the thread and altered the index.php file and set the number of categories to list per rown to zero i get about 20 lines of the following plus the images/text still show after these messages. Any ideas?

 

Warning: Division by zero in /home/xxxxxx/public_html/oscom/index.php on line 73

 

Warning: Division by zero in /home/xxxxxx/public_html/oscom/index.php on line 77

 

Warning: Division by zero in /home/xxxxxx/public_html/oscom/index.php on line 77

 

Warning: Division by zero in /home/xxxxxxx/public_html/oscom/index.php on line 73

 

Warning: Division by zero in /home/xxxxxx/public_html/oscom/index.php on line 77

 

Warning: Division by zero in /home/xxxxxx/public_html/oscom/index.php on line 77

 

Warning: Division by zero in /home/xxxxxxx/public_html/oscom/index.php on line 73

Share this post


Link to post
Share on other sites

HI Brian,

 

Many thanks for all the advice you provide to newbies like myself. I have an OSC 2.3 store witha template loaded top. I'm trying to remove the subcategory images and text but when i have followed the instructions at the beginning of the thread and altered the index.php file and set the number of categories to list per rown to zero i get about 20 lines of the following plus the images/text still show after these messages. Any ideas?

 

Warning: Division by zero in /home/xxxxxx/public_html/oscom/index.php on line 73

 

Warning: Division by zero in /home/xxxxxx/public_html/oscom/index.php on line 77

 

Warning: Division by zero in /home/xxxxxx/public_html/oscom/index.php on line 77

 

Warning: Division by zero in /home/xxxxxxx/public_html/oscom/index.php on line 73

 

Warning: Division by zero in /home/xxxxxx/public_html/oscom/index.php on line 77

 

Warning: Division by zero in /home/xxxxxx/public_html/oscom/index.php on line 77

 

Warning: Division by zero in /home/xxxxxxx/public_html/oscom/index.php on line 73

 

I have put this tip into a contribution for osCommerce 2.3.1.

 

Install is quick and easy. All options are changed in the admin.

 

Hope you find it useful.

 

You can download it here. SubCategory Links

 

See if that helps first.

 

If you're still having problems let me know.

 

Brian


Remember to backup database, files and pictures.

 

I have a problem for your solution

I reject your reality and substitute my own

My mind not only wanders, it sometimes leaves completely

The problem with the gene pool is that there is no lifeguard

Everyone’s entitled to my opinion

 

Links

Security

SSL Help

Basics for design V2.3+

Share this post


Link to post
Share on other sites

Personally i used this code to remove the broken images when there was no file specified:

echo '	 <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">';
if((file_exists(DIR_WS_IMAGES . $categories['categories_image'])) && ($categories['categories_image'] != "")) {
echo tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />';
}
echo $categories['categories_name'] . '</a></td>' . "\n";

Share this post


Link to post
Share on other sites

Is it possible to have both sub-category images/links available with products are listed in the main category?

 

This page http://essentialsoflife.net/essential-oils-catalog/index.php/personal-care-products-c-22 is a category with products in it, but there are also 7 sub-categories that don't show on the page that I want to show. The product list table is also not showing correctly here. Where do I fix that?

 

All the pages that do not have products like http://essentialsoflife.net/essential-oils-catalog/index.php/therapeutic-grade-essential-oils-c-1 show the sub-categories fine.

 

All the pages that do not have sub-categories like http://essentialsoflife.net/essential-oils-catalog/index.php/aromatherapy-massage-oil-c-3 have the table showing correctly.

 

I know, I just want it all! *smile*


Diana

Share this post


Link to post
Share on other sites

This page http://essentialsoflife.net/essential-oils-catalog/index.php/personal-care-products-c-22 is a category with products in it, but there are also 7 sub-categories that don't show on the page that I want to show. The product list table is also not showing correctly here. Where do I fix that?

 

Since you use a template I would suggest you contact the template provider about that

 

The category/products display behaviour is as it is supposed to be: A given category can have either products or subcategories, not both. In case of both, products have priority over subcategories.

 

This could be changed by modifying index.php, didn't do that my self. The default behaviour makes a good sense

 

A better solution would be, to create a couple a "new products" modules - one for each of the subcategories you have, set each to pick products from a specific subcategory only and display them all on that category page

Share this post


Link to post
Share on other sites

The category/products display behaviour is as it is supposed to be: A given category can have either products or subcategories, not both. In case of both, products have priority over subcategories.

Sorry it took so long for me to get to this. Code was added in the subcategory links module just for that purpose.

Remember to backup database, files and pictures.

 

I have a problem for your solution

I reject your reality and substitute my own

My mind not only wanders, it sometimes leaves completely

The problem with the gene pool is that there is no lifeguard

Everyone’s entitled to my opinion

 

Links

Security

SSL Help

Basics for design V2.3+

Share this post


Link to post
Share on other sites

×