Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Remove hyperlinks from products in product listing

Remove hyperlinks from products in product listing

Locked

Views: 2,485

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
3 Mar 2009, 6:29 PM
#1
emillarsen avatar

emillarsen

New Zenner

Join Date:
Mar 2009
Posts:
11
Plugin Contributions:
0

Remove hyperlinks from products in product listing

I have what is, probably, a very unusual question:

Is it possible to un-link products when you are looking at a product listing page?

I run a not-for-profit theatre group website and I would like to remove all the hyperlinks for each ticket (the first is "7:30pm Wednesday 17th June Disco Inferno Adult") on this page: http://www.smptheatre.co.uk/zen/index.php?main_page=index&cPath=1

For simplicity's sake, the tickets don't have descriptions and there's no point in them leaving the product listing page (it will only cause confusion as most of our customers are silver surfers).

Thanks in advance! This is the first question I've had to ask - the forums have helped enormously in customising my site. :smile:

3 Mar 2009, 6:49 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Remove hyperlinks from products in product listing

Make an override copy of includes/modules/product_listing.php and edit that new copy by changing this line (line 100 in unmodified v1.3.8 file):

          $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';

to this:

          $lc_text = '<h3 class="itemTitle">' . $listing->fields['products_name'] . '</h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
3 Mar 2009, 7:21 PM
#3
emillarsen avatar

emillarsen

New Zenner

Join Date:
Mar 2009
Posts:
11
Plugin Contributions:
0

Re: Remove hyperlinks from products in product listing

Thanks! Worked a treat. :clap:

3 Mar 2009, 7:47 PM
#4
gunnerdaddy avatar

gunnerdaddy

New Zenner

Join Date:
Jun 2007
Posts:
25
Plugin Contributions:
0

Re: Remove hyperlinks from products in product listing

Hey Bunyip, great fix on this one. Can you tell me where I can remove the link around the thumbnail as well?

3 Mar 2009, 8:20 PM
#5
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Remove hyperlinks from products in product listing

gunnerdaddy:

Hey Bunyip, great fix on this one. Can you tell me where I can remove the link around the thumbnail as well?

Oops - totally misread that: put 'breadcrumb' in place of 'thumbnail'. Better put mind in gear before engaging fingers in future.
Will post another response, as edit timeout will expire before I get done typing it

3 Mar 2009, 8:23 PM
#6
gunnerdaddy avatar

gunnerdaddy

New Zenner

Join Date:
Jun 2007
Posts:
25
Plugin Contributions:
0

Re: Remove hyperlinks from products in product listing

Thanks Bunyip. Getting rid of breadcrumbs might come in handy too, but I need to get rid of the thumbnail link that goes to the product page. Similar to the name link that you killed in your fix above.

3 Mar 2009, 8:27 PM
#7
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Remove hyperlinks from products in product listing

gunnerdaddy:

Hey Bunyip, great fix on this one. Can you tell me where I can remove the link around the thumbnail as well?

Again, this requires editing of an override copy of includes/modules/product_listing.php

Change this section of code at line 168

            $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a>';

to this

            $lc_text = zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"');
3 Mar 2009, 9:23 PM
#8
gunnerdaddy avatar

gunnerdaddy

New Zenner

Join Date:
Jun 2007
Posts:
25
Plugin Contributions:
0

Re: Remove hyperlinks from products in product listing

Outstanding results. Thanks so much Bunyip.

4 Mar 2009, 1:07 PM
#9
emillarsen avatar

emillarsen

New Zenner

Join Date:
Mar 2009
Posts:
11
Plugin Contributions:
0

Re: Remove hyperlinks from products in product listing

Along similar lines: how do you remove the hyperlinks from the shopping cart?

I was trying to find the code you removed:

<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' 

with a ```
</a>


Thanks!
4 Mar 2009, 3:24 PM
#10
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Remove hyperlinks from products in product listing

The link on the shopping cart images is compiled a little differently from the others - in fact the single link encompasses both the image and the product name. In this case, you need to edit an override copy of the template file tpl_shopping_cart_default.php

Change this line of code:

<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>

to:

<span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><a href="<?php echo $product['linkProductsName']; ?>"><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>

You'll see by comparing the two sets of code that this change isn't deleting the link, but simply moving the opening a tag so the link doesn't include the image.

11 Mar 2009, 11:20 AM
#11
emillarsen avatar

emillarsen

New Zenner

Join Date:
Mar 2009
Posts:
11
Plugin Contributions:
0

Re: Remove hyperlinks from products in product listing

Thanks, I actually went in and removed the link from the image and text. So I replaced your code with this:

<span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span>

Just in case anyone wants to do this in the future :smartalec:

26 Mar 2009, 11:30 AM
#12
scottbrown_14 avatar

scottbrown_14

New Zenner

Join Date:
Mar 2009
Location:
Huddersfield, UK
Posts:
14
Plugin Contributions:
0

Re: Remove hyperlinks from products in product listing

Hi,

Is it possible to change the image link from a link to the product info page to a larger version of the image?

I'm using the lightbox plugin so if someone can point me in the right direction on this I'd be most appreciative.

Thanks,

Scott.

30 Mar 2009, 1:58 PM
#13
emillarsen avatar

emillarsen

New Zenner

Join Date:
Mar 2009
Posts:
11
Plugin Contributions:
0

Re: Remove hyperlinks from products in product listing

I'm trying to edit the image link too, Scott. In fact, I'm trying to remove it altogether.

I think you have to edit product_listing.php (the original can be found in includes/modules but I have an override in includes/modules/YOUR_TEMPLATE).

Lines 164 - 168 control the image in the product listing, I think. The product image appears to be in a two argument IF statement, but I can't fathom why.

Here's the 164-168 line code:

          if (isset($_GET['manufacturers_id'])) {
            $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a>';
          } else {
            $lc_text = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id']) > 0 ?  zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"') . '</a>';
          }

Anyone (bunyip!) got any ideas how to remove the hyperlink?

I tried changing the code to:

if (isset($_GET['manufacturers_id'])) {
$lc_text = 'zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"');
} else {
$lc_text = 'zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"');
}

but that didn't work. I don't know php - although I have experience with other languages - so my code is probably plain wrong.