Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Displaying a single product on the main page


SagarJ

Recommended Posts

Posted

Hi Gurus,

 

I am very new to OSC and have a lot to learn. I have also just started understanding CSS and HTML, so please bear with me.

 

I need to tweak the layout of the OSC v2.3.1 default layout to display just 1 product on the main page. I want my customers to navigate through the menus to view other products.

 

Also, I need to single product to fill up the entire main page display area, rather than use the default thumbnail size picture and description.

 

Please help. Any guidance will be most appreciated.

 

Regards,

Sagar

Posted

Sagar,

 

You can use the Featured Products contribution to do this, then you will have to edit the image parameters and box size to suit your specific needs.

 

 

 

 

Chris

Posted

This should do it. Backup first!!!!

 

Please note...I have no idea if this is the "best" way to do this. It looked like fun and I decided to take a stab at it and it worked for me.

 

Copy the contents of /catalog/product_info.php to a new file, name it whatever...one_product_info.php is what I named it. You can close product_info.php now too.

 

First, you'll want to comment out most of the require functions. You are already loading them in index.php so no need to do it again.

 

Here is what I commented out, except DIR_WS_LANGUAGES. You need that.

 

//require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); - you need to keep this.

//require(DIR_WS_INCLUDES . 'template_top.php');

//require(DIR_WS_INCLUDES . 'template_bottom.php');

//require(DIR_WS_INCLUDES . 'application_bottom.php');

 

That should leave you with a </form> tag at the end of the file (if stock OSC file).

 

Now you'll want to do a search for this:

 

" . (int)$HTTP_GET_VARS['products_id'] . "

 

Then replace every occurance of it with the product_id of the item you want to show here.

 

Make it look like so:

 

p.products_id = 'X'

 

Instead of:

 

p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'

 

Put the product_id of the product you want to display where X is.

You can find the product_id by looking at the url of the product in admin.

 

Now load up /catalog/index.php and scroll down to the bottom.

 

 

Find:

 

<h1><?php echo HEADING_TITLE; ?></h1>

 

<div class="contentContainer">

<div class="contentText">

<?php echo tep_customer_greeting(); ?>

</div>

 

<?php

if (tep_not_null(TEXT_MAIN)) {

?>

 

<div class="contentText">

<?php echo TEXT_MAIN; ?>

</div>

 

<?php

}

 

include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);

include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);

?>

 

Comment it out, like so:

 

/*

<div class="contentText">

<?php echo tep_customer_greeting(); ?>

</div>

 

<?php

if (tep_not_null(TEXT_MAIN)) {

?>

 

<div class="contentText">

<?php echo TEXT_MAIN; ?>

</div>

 

<?php

}

 

include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);

include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);

?>

*/

 

Now put this just under it:

 

<?php

require('one_product_info.php');

?>

 

Save and upload both index.php and your new one_product_info.php to your server.

 

You should now have the product for the product_id you entered above displaying in the main content are of the front page.

 

Hope this helps!

 

Peace,

Chris

Archived

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

×
×
  • Create New...