Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing default "detail" linking


anderiv

Recommended Posts

Posted

By default, when a user clicks on the picture of a product, they are brought to the "detail" view of the product. Is there any way to change this behavior? I would like to put a "product" into my store that we are not able to sell through osCommerce. When users click on that product, I would like to shoot them off to a web site external to our osCommerce installation.

 

I know that you can fill in the "Product URL" field and that will create a link to go to the product webpage, but I would rather allow the users just to click on the product's picture.

 

Any ideas?

 

Thanks!

-Erik Anderson

Posted

I have three products that I need to do this for (out of 6 or 7 total). Those three would be linked out to the same page.

Posted

Here is a solution working on the basis that you place the url in the "Product URL" field.

 

You will need to change 2 files:

 

catalogdefault.php

catalogincludesmodulesproduct_listing.php

 

Before you start make backups of these two files!

 

default.php

 

search for

 

p.products_tax_class_id, IF(s.status,

 

and replace with

 

p.products_tax_class_id, pd.products_url, IF(s.status,

 

There should be 4 instances of this! I would just do a search and replace!

 

Thats all for the default.php file. :)

 

 

product_listing.php

 

Replace on or around line 112

 

case 'PRODUCT_LIST_NAME':

           if ($HTTP_GET_VARS['manufacturers_id']) {

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . $listing_values['products_name'] . '</a>';

           } else {

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . $listing_values['products_name'] . '</a> ';

           }

           break;

 

with.....

 

case 'PRODUCT_LIST_NAME':

           if ($HTTP_GET_VARS['manufacturers_id']) {

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . $listing_values['products_name'] . '</a>';

    } else {

             if ($listing_values['products_url'] == '') {

    $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . $listing_values['products_name'] . '</a> ';

    } else {

    $lc_text = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($listing_values['products_url']), 'NONSSL', true, false) . '">' . $listing_values['products_name'] . '</a>';

    }     

           }

           break;

 

and then on or around line 138 replace;

 

case 'PRODUCT_LIST_IMAGE':

           $lc_align = 'center';

           if ($HTTP_GET_VARS['manufacturers_id']) {

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

           } else {

             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

           }

           break;

 

with..........

 

case 'PRODUCT_LIST_IMAGE':

           $lc_align = 'center';

           if ($HTTP_GET_VARS['manufacturers_id']) {

             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

           } else {

             if ($listing_values['products_url'] == '') {

    $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing_values['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

    } else {

    $lc_text = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($listing_values['products_url']), 'NONSSL', true, false) . '">' . tep_image(DIR_WS_IMAGES . $listing_values['products_image'], $listing_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';

    }

           }

           break;

 

And that should be it!!!! :D

 

Let me know how it goes on.

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Posted

I forgot to mention, remember this will only change the links in the category pages, you will also need to make mods to other files which produce direct links to product detail pages, such as

 

catalogincludesboxeswhats_new.php

catalogincludesmodulesproduct_new.php

catalogproduct_new.php

catalogadvanced_search_result.php

 

etc etc

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Posted

here is another (different suggestion)

 

download and install the catagories discription mod.

 

once installed you can make a new catagory

in the discriptions area for the catigory you can paist in any html scripting you want. You can paist it in as to "look like" a products listing page with photo links, and now you have control what these links are.

What your plans are for getting paid for these products, I'm kinda wondering but guessing your offering them up for free. (or are a part of an affilites program)

 

doing it this way keeps your store better intact for upgrades.

 

I personally try to keep all my changes in the includes folder

 

Have fun

 

:lol:

Archived

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

×
×
  • Create New...