osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 
 

Moving category links to main area

This is a discussion on Moving category links to main area within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; I've seen a number of OSC sites that have the main categories as graphical links in the body of the ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > osCommerce 2.2 Modification Help

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 05-31-2003, 04:12 AM
Lurker
 
Join Date: May 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
5tevooo
Default Moving category links to main area

I've seen a number of OSC sites that have the main categories as graphical links in the body of the front page rather than just stuck up in the top left corner as text links. I've managed to insert my category graphics onto the front page (by adding HTML to catalog/languages/english/default.php) but I don't know what PHP code I need to add in order to turn them into links to the categories.

This seems like a fairly common thing to want to do, but I haven't come across any solution to it. Anyone's assistance would be greatly appreciated.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
  #2  
Old 08-22-2003, 01:07 PM
Lurker
 
Join Date: Aug 2003
Location: Wisconsin
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jcroson
Default Did you...

Did you find a way to do this yet? I have to do it also, and would like to do it dynamically also....

JC
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 08-23-2003, 06:04 AM
New Member
 
Join Date: Jul 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
xxGeek
Default

not sure if this is what you're looking for but this is a link that should work
to call the product directly the link would be somethig like this
Code:
product_info.php?products_id=17
product_id=Your_Product_Id
and to call individual categories the link woul look like this
Code:
index.php?cPath=1
cPath=Your_Cat_Id
and to call an individual subcategory page the link would look like this
Code:
index.php?cPath=1_8
cPath=Your Main Cat Id_Your Sub Cat Id
so for example to call a page I.E a deafault setup of osc and you want to show the hardware graphics card your html code would be something like this
Code:
<a href="index.php?cPath=1_4"><img src="images/your_image_path/your_image_name.gif"></a>
that should do the trick.
Let me know if it works out for you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4  
Old 03-18-2004, 08:42 AM
zogster's Avatar
Lurker
 
Join Date: Feb 2004
Location: Oxford, UK
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
zogster
Default

Hi
Quite new at this. The above answer looks like you have to manually change the html if you update you category structure.

I edited the index.php file that creates either the front page, the category pages or the final product pages and butchered the text used to create the category page and pasted it at the bottom of the front page text. This enable the categories to be created dynamically and reduces the manual recoding. If you are interested, let me know and I'll post up the file.

I don't follow every command in php yet and therefore don't guarantee the butchering is bug free, but so far so good for me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #5  
Old 03-24-2004, 11:25 AM
New Member
 
Join Date: Mar 2004
Posts: 20
Thanks: 0
Thanked 2 Times in 1 Post
Rep Power: 0
xtech
Default Categories on Main Page

Hi Zogster,

I'd be interested in seeing what you've done. I'm new to PHP, but it looks as if a link to http://www.YOUR_DOMAIN.com/catalog/index.php?cPath=0
will list all the categories. I'm not sure yet how (if possible) to make index.php crank up automatically with a cPath=0. Sounds like you've worked around it. Where did you get the categories code? The only categories.php files I've seen seem to all be admin related. I don't see (but I'll start a concerted effort at finding) the code you're talking about.

In includes/boxes/categories.php, there's some code for displaying the categories. Is that what you're talking about? I'm going to play with it.

Thanks for the inspiration...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #6  
Old 03-24-2004, 02:42 PM
zogster's Avatar
Lurker
 
Join Date: Feb 2004
Location: Oxford, UK
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
zogster
Default

Hi Xtech

I edited the index.php file in the main catalog root folder. This file either displays the welcome page, the category list or the product list depending upon where you are. All the actual contents are pulled in from other files but this is the file that puts it all together and slaps it on the screen.

The file is built up like so:

Code:
Header
Left Column
   Either
        Categories List or
        Product List or
        Welcome page
Right Column
Footer
This main question in the middle of the file is controlled using an if ... elseif... else statement and looks at the 'breadcrumb trail' to tell the program where in the structure the customer is right now.

I therefore copied a chunk of the code that is used in the category list section and inserted it at the bottom of the Welcome page section. A little bit of tweaking was required. I don't currently have any real understanding of PHP but a reasonable grasp of HTML and basic programming in the past helped to show the way for this tweaking and I ended up with the following code:

Code:
<?php
    $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");
    $category = tep_db_fetch_array($category_query);
?>
	<tr>
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
<?php
      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
    $number_of_categories = tep_db_num_rows($categories_query);

    $rows = 0;
    while ($categories = tep_db_fetch_array($categories_query)) {
      $rows++;
      $cPath_new = tep_get_path($categories['categories_id']);
      $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
      echo '                <td align="center" width="' . $width . '" valign="bottom"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a></td>' . "\n";
      if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
        echo '              </tr>' . "\n";
        echo '              <tr>' . "\n";
      }
    }

// needed for the new products module shown below
/*    $new_products_category_id = $current_category_id;*/
?>

      </tr>
        </table>
</table>
Remember I didn't write this just copied it from earlier in the file and tweaked it (in most cases deleted bits no longer needed).

Like I say, I put this under the main text on my 'Welcome' page and it works for me. I have four main categories and no subcategories. I have removed the text for each category heading and inserted nice icons/buttons instead, using the category image field in the admin.

The hardest bit was sorting out the <table>...</table> html coding as you have to follow it all the way through the whole file (or you can cheat and trial and error it) but i got there in the end anyway.

To see the finished result try http://www.jollyfungus.com/shop
The store is not live yet, but feel free to comment anyway

Remember I'm a nOOb too so this may not be the only way to achieve this. If I can help any more please let me know, only too happy to help.

Zogster
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #7  
Old 03-25-2004, 08:05 AM
New Member
 
Join Date: Mar 2004
Posts: 20
Thanks: 0
Thanked 2 Times in 1 Post
Rep Power: 0
xtech
Default

Hi again Zogster,

I tried what you mentioned, but I think I'm being stupid. I'm going to play with it again because that feature will come in handy. I solved my problem - thanks in good part to your direction to index.php. I was helping somone who wanted their existing products page to be the shopping cart, but they wanted absolutely no functionality other than to list their products and be able to buy them. Basically "Don't change our site look at all (even though it is hideous, IMO) but we want to add "Buy Now" capability to our "Products" page - which is just a list of products." The way they've structured things, what that really means is "Display a list of all product categories".

My solution wound up being to add the following line to the top of index.php

$cPath = '0';

As it states in index.php, the cPath values are coming from application_top.php. I just overrode that value first thing, which makes all categories display instead of mainpage. This wouldn't work for what you were doing, because you still wanted the welcome message. These peeps didn't want the welcome message or anything - just the categories. They'll link to the cart from their "Products" page.

I didn't understand how that worked, so I was going to try doing as you suggested and then remove all welcome stuff. My stupidity wound up saving me some time, as the one line change is perfect for what they wanted.

Still, I want to play with your code paste for future reference.

Thanks again for being so helpful!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #8  
Old 08-01-2005, 05:50 AM
Member
 
Join Date: May 2005
Location: Berkshire, UK
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
beahawk
Default

remember to test your links to ensure the session id is being carried over with your new links - this may depend on if you force cookies or not.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Sponsored Links
Advertisement
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
how to change color/size of links within main page joanstead osCMax v2 Customization/Mods 3 02-09-2006 01:19 PM
Help with Main Category Display azimpact osCommerce 2.2 Modification Help 0 11-30-2005 01:10 PM
Product links in define main page not working developer_x osCommerce 2.2 Modification Help 1 02-24-2005 11:17 AM
HELP! How do I change the Category html links?? acreativepage osCommerce 2.2 Modification Help 3 05-09-2004 02:44 AM
category Icons with links on the main page CMWM osCMax v1.7 General Mods Discussion 1 04-06-2004 07:02 AM


All times are GMT -8. The time now is 05:32 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax