Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Categories Images Box support thread


kymation

Recommended Posts

I haven't done this, so I can't say. You would probably have to treat it like one of the on-page modules (such as the New Products module) rather than a column box. Somebody on the STS support thread should be able to tell you more than I can.

 

Regards

Jim

 

Hi Jim

 

I worked it out. For information for your other users here is the solution that worked for me with STS.

 

Need to add the following placeholder setting in sts_column_left.php situated in includes-->modules-->sts_inc

 

require(DIR_WS_MODULES . 'categories_images.php');

$sts->restart_capture ('categoryimages', 'box'); // Add ON Category Images Module

 

The place holder is then put into the template as $categoryimages but the formatting does go slightly screwy so you need to add the complete following to the template (eg sts_template.html) for it to work properly:-

 

<div align="center"> <!-- category images on main page -->

<table width="100%" ><tr><td>

$categoryimages</div>

</td></tr></table> <!-- end of category images on main page -->

 

(I centralised it as I do with most tables.)

 

Just in case of use. I think this is a great contribution.

Thx

Mark.

 

www.rdwebdesign.co.uk

Link to comment
Share on other sites

  • Replies 204
  • Created
  • Last Reply

Top Posters In This Topic

How is it possible to remove the category images box altogether? I downloaded this contribution and like design as seen on the screenshots, but didnt get a hint on removing the boxes entirely.

Admin -> Configuration -> Categories Images -> Box frame style

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Admin -> Configuration -> Categories Images -> Box frame style

 

Regards

Jim

 

 

Hello Jim,

 

thanks for the support. I installed Category Images Box 1.1 on oscommerce 2.2rc2 with STS 4.5.8_1. I have previously modified the shop a little bit, for example did I disable the new products feature. I read here in the forum that Category Images Box uses the same box as New Products. Is this the reason why any changes I make on the admin side doesnt show any effect on the shop? I uploaded the sql file, uploaded categories_images.php, compared and changed the old files manually with DIFFUSE. I can see the path you gave me at the admin side and can do the changes but the change is not showing in the shop. I restarted the computer because I thought it might be a cache problem but no. :blink:

 

Thinking about my first question (previous posting) to remove the category images box I have to say sorry, I think I didnt express myself clear enough because I dont want to modify the boxframe I want to remove the whole categories feature. Could Category Images Box 1.1 help by doing so?

 

Best greetings,

Adrian

Link to comment
Share on other sites

If you don't see the box on your Index page, it's likely you pasted the code into a location that doesn't show on that page. Check your edits again.

 

The Categories Images box uses the same box code as all other osCommerce boxes, and adds a couple of variant styles as well. If the rest of your boxes work, this one should also work.

 

I'm afraid that I don't understand what you mean by "remove the whole categories feature." Does that mean you want no categories, just products at the top level? That's a whole different can of worms.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

If you don't see the box on your Index page, it's likely you pasted the code into a location that doesn't show on that page. Check your edits again.

 

The Categories Images box uses the same box code as all other osCommerce boxes, and adds a couple of variant styles as well. If the rest of your boxes work, this one should also work.

 

I'm afraid that I don't understand what you mean by "remove the whole categories feature." Does that mean you want no categories, just products at the top level? That's a whole different can of worms.

 

Regards

Jim

 

Hello Jim,

 

thank you for the words, I think its the best when I restart again. I like the Category Images Box 1.1 contribution. Let me explain what I mean with remove the category feature. If you consider a fresh installation of osc, you will have the category menu on the left side. If you click on hardware for example you will have the subcategories with pictures in the main content appearing. In this example you will see cdrom, memory, printers and so on with picture. I dont want this output in the main content. If you click on hardware, I just want the subcategories in the category box on the left side. Thats all, nothing needed in the main content. Could Category Images Box 1.1 used to do this? Its not necessary to display the products at the top level.

 

Thank you again for your fast support and the clear instruction in Category Images Box 1.1.

Best greetings,

Adrian

Link to comment
Share on other sites

No, that's not something this Contribution was designed to do. To get rid of the subcategories on the main page, open catalog/index.php and find these lines:

	  $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
  $category_parent = tep_db_fetch_array($category_parent_query);
  if ($category_parent['total'] > 0) {
	$category_depth = 'nested'; // navigate through the categories
  } else {
	$category_depth = 'products'; // category has no products, but display the 'no products' message
  }

and change to this:

	 $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
  $category_parent = tep_db_fetch_array($category_parent_query);
//	  if ($category_parent['total'] > 0) 
//		 $category_depth = 'nested'; // navigate through the categories
//	  } else {
	$category_depth = 'products'; // category has no products, but display the 'no products' message
//	  }

That should now show only products. If a category has no products, the page will be empty. I hope that's what you want.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

No, that's not something this Contribution was designed to do. To get rid of the subcategories on the main page, open catalog/index.php and find these lines:
	  $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
  $category_parent = tep_db_fetch_array($category_parent_query);
  if ($category_parent['total'] > 0) {
	$category_depth = 'nested'; // navigate through the categories
  } else {
	$category_depth = 'products'; // category has no products, but display the 'no products' message
  }

and change to this:

	 $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
  $category_parent = tep_db_fetch_array($category_parent_query);
//	  if ($category_parent['total'] > 0) 
//		 $category_depth = 'nested'; // navigate through the categories
//	  } else {
	$category_depth = 'products'; // category has no products, but display the 'no products' message
//	  }

That should now show only products. If a category has no products, the page will be empty. I hope that's what you want.

 

Regards

Jim

 

Hello Jim,

 

thank you so much. That is exactly what I wanted to do. :D I knew that there would be an easy way to cut this off.

With your help, I found out that the information "no products in this category" can be removed too by changing in catalog/index.php

	 $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
  $category_parent = tep_db_fetch_array($category_parent_query);
//	  if ($category_parent['total'] > 0) 
//		 $category_depth = 'nested'; // navigate through the categories
//	  } else {
	$category_depth = 'products'; // category has no products, but display the 'no products' message
//	  }

 

to

	 $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
  $category_parent = tep_db_fetch_array($category_parent_query);
//	  if ($category_parent['total'] > 0) 
//		 $category_depth = 'nested'; // navigate through the categories
//	  } else {
//		$category_depth = 'products'; // category has no products, but display the 'no products' message
//	  }

 

Thank you again for the support,

Adrian

Link to comment
Share on other sites

  • 3 weeks later...

I've added a floating categories box option. This is similar to the Grid arrangement, except here the number of columns is automatically sized to fit the width of the browser window. The categories each have an optional border that changes color on mouseover. This option is in addition to the options in the previous version.

 

A live demo is included in the distribution to show how this looks.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hello.

 

i,ve installed your modul. Thank's/ But I have sach problem, when i try to choose "Box frame style" as plain, i get error

Fatal error: Class 'borderlessBox' not found in C:\WWWROOT\shop\includes\modules\categories_images.php on line 205

 

I find borderlessBox in categories_images.php

 

// Output the box in the selected style

switch (CATEGORIES_IMAGES_BOX_FRAME_STYLE) {

case 'Plain':

new borderlessBox ($info_box_contents);

break;

case 'Simple':

new productListingBox ($info_box_contents);

break;

case 'Stock':

default:

new contentBoxHeading ($info_box_heading, false, false);

new contentBox ($info_box_contents);

break;

}

 

and i don't understand, why it does'n work?

can you hepl me?

 

and one more question, where can i change image

Edited by shan15
Link to comment
Share on other sites

There's a file missing from the current distribution. Add the following code to the bottom of catalog/includes/classes/boxes.php, just before the final ?>

// Start Categories Images Box
 class borderlessBox extends tableBox {
function borderlessBox ($contents) {
  $this->table_parameters = 'class="main"';
  $this->tableBox ($contents, true);
}
 }
// End Categories Images Box

You set up your images in Admin -> Catalog -> Categories/Products. Select your category and click Edit.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

hi! I just installed it BUT i can not see the description of each category in the main index page! Checked and double checked everything BUT i can not see it! I see you wrote that something is missing for the current upped package! Is the only thing that is missing what you write above? Also i can not see float as an option in the style in admin section! I recovered everything from my backups and i will wait for your complete contrib! Thanks for the excelent work! Can i also see the same way the subcategories like the main categories?

 

Thanks for your time

Link to comment
Share on other sites

The box works in my test store. Did you add description text for your categories?

 

I'll put the revised version up in a minute.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I've uploaded the latest version. This fixes a couple of bugs, including those reported in this thread. Thanks to everyone who posts bug reports and fixes.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hell and thanks for this nice contrib!

I've updated to the last version and it works very well! :rolleyes:

 

Now i've got a question: How i can center the categories boxes in categories_images.php when i select box style float in admin settings?

Even better would be if i can select e.g. 3 categories boxes per row and then center the boxes in the categories_images box because i've got not so many categories and it looks not so great when e.g. 3 categories appear in the first row and then only 1 category in the next row on the left side.

 

Many thanks!

 

Sorry for my awful english

Link to comment
Share on other sites

If you want to center categories images in float style:

 

find in stylesheet.css

 

float: left; /* Don't change this */

 

change to

 

float: none;

 

 

hope this helps

 

Thank you for your fast reply

 

Your suggestion woks great for IE but in firefox the images are now all in a vertical line :blink:

Link to comment
Share on other sites

Yes, there's a reason it says Don't change this. It doesn't work if you change it.

 

If you want a fixed number of categories in a row, select Grid instead of Float.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Yes, there's a reason it says Don't change this. It doesn't work if you change it.

 

If you want a fixed number of categories in a row, select Grid instead of Float.

 

Regards

Jim

 

Thank you, but i like the float view more than grid :blush:

is there really no possibility to change the float mode?

 

thank you

Link to comment
Share on other sites

You can change it to anything you want, as long as there is a way to make HTML/CSS/Javascript do what you want. You always have the option of changing the code yourself. It's Open Source, after all.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi,

 

I have installed and have it working. Looks great!

 

Problem: I don't see the description for the category image in "Box style = Grid" mode.

 

Switched to "Box style = Rows" and I can see the desc.

Is there a way to display desc in the grid mode?

 

What a great contribution!

Thank you,

Eyal

Eyal

How About an Open Source Car?

Link to comment
Share on other sites

I didn't put that in because there's not much room to show text in the Grid mode. Figures someone would want it. So, find this code in catalog/includes/modules/categories_images.php (Lines 69-71)

			  $info_box_text .= $category['name'];
		  $space_above = true;
		} //if (CATEGORIES_IMAGES_BOX_SHOW_NAME

and insert this code just after that

	  
		// Show the products description if selected in Admin
		if (CATEGORIES_IMAGES_BOX_SHOW_DESCRIPTION == 'True') {
		  if ($space_above == true) {
			$info_box_text .= '<br>';
		  } // if ($space_above
		  $info_box_text .= $category['description'];
		} //if (CATEGORIES_IMAGES_BOX_SHOW_DESCRIPTION

and you should have your description text. I'll add this to a new version as soon as I get a chance.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Installed the latest version and now get the following error when trying to access my site:

 

Fatal error: Cannot redeclare tep_set_banner_status() in /home/suppneqs/public_html/catalog/includes/functions/banner.php on line 15

 

line 15 of that file reads :

 

function tep_set_banner_status($banners_id, $status) {

 

What have I done wrong ??

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

The most common cause of this is uploading a file to the wrong location, e.g. loading catalog/index.php to catalog/includes/languages/english/index.php. Reloading the correct file will fix this.

 

You could also have an incorrect edit to catalog/includes/application_top.php, or an incorrect edit to another file that includes application_top.php.You would need to check your edits to find this.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I didn't put that in because there's not much room to show text in the Grid mode. Figures someone would want it. So, find this code in catalog/includes/modules/categories_images.php (Lines 69-71)

			  $info_box_text .= $category['name'];
		  $space_above = true;
		} //if (CATEGORIES_IMAGES_BOX_SHOW_NAME

and insert this code just after that

	  
		// Show the products description if selected in Admin
		if (CATEGORIES_IMAGES_BOX_SHOW_DESCRIPTION == 'True') {
		  if ($space_above == true) {
			$info_box_text .= '<br>';
		  } // if ($space_above
		  $info_box_text .= $category['description'];
		} //if (CATEGORIES_IMAGES_BOX_SHOW_DESCRIPTION

and you should have your description text. I'll add this to a new version as soon as I get a chance.

 

Regards

Jim

 

Great! Thank you so much Jim.

You were right, I have way to much text going on in my grid now. Time to rephrase some descs I guess...

 

I would only suggest, if you will allow me, to place the new code after the link closing tag:

 

$info_box_text .= $category['name'];
$space_above = true;
} //if (CATEGORIES_IMAGES_BOX_SHOW_NAME			

		$info_box_text .= '</a>';
// Show the products description if selected in Admin
		if (CATEGORIES_IMAGES_BOX_SHOW_DESCRIPTION == 'True') {
		  if ($space_above == true) {
			$info_box_text .= '<br>';
		  } // if ($space_above
		  $info_box_text .= $category['description'];
		} //if (CATEGORIES_IMAGES_BOX_SHOW_DESCRIPTION

 

so the description will not show as a link.

 

Thanks again,

Eyal.

Edited by eyal_barouk

Eyal

How About an Open Source Car?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...