Remove Product Links from Cart Summary

Contrib type: 
Module
Status: 
Initial upload
Moderation: 
Awaiting moderation

Downloads

Latest version: 
6.x-2.0
Compatibility: 
Ubercart 2.x

This module removes the links (anchor tags) from the product image and description (title) in the cart summary table on the cart page. This prevents the user from clicking the links and drilling down into the product node.


PreviewAttachmentSize
uc_rm_productlinks.tar3 KB
sesameseed77's picture
Offline
Joined: 09/27/2009
Juice: 23
Removing product links from ubercart shopping cart

Thanks for posting this. It saved me some time! I was kicking myself I didn't think to just use form alter.

Here's my slightly altered version:

<?php
function edge_ubercart_form_alter(&$form, &$form_state, $form_id) {

  if(

$form_id == 'uc_cart_view_form') {

      unset(

$form['continue_shopping']);

    foreach(

$form['items'] as $key => $item) {

      if(!empty(

$item['desc']['#value'])) {
         
$form['items'][$key]['desc']['#value'] =  strip_tags($form['items'][$key]['title']['#value']);

        }

    }
  }
}

?>
taintmovie's picture
Offline
Joined: 12/06/2010
Juice: 12
Re: Remove Product Links from Cart Summary

Any way to do the same thing for the cart block?

richlh74's picture
Offline
Joined: 09/28/2010
Juice: 32
Attribute formatting?

Hi there. This module is perfect for my needs except for one thing. The attributes and item title are all squished together.

Instead of something like this:

Single Print Name Frame

* Choose Unframed Print or Frame Color: White Frame
* Which Illustration Would You Like?: Alligator
* Enter Name Here: Christopher

I'm getting this:

Single Print Name FrameChoose Unframed Print or Frame Color: White Frame Which Illustration Would You Like?: Alligator Enter Name Here: Christopher

How can I remove the links without killing the other formatting?

Many thanks for this module and any help that can be provided.

Rich

grannytrolly's picture
Offline
Joined: 04/12/2011
Juice: 3
Re: Remove Product Links from Cart Summary

Hi, it's a few months on, but just in case anyone else is getting the same squished output when using product attributes, you need to edit this line in the module to include allowable tags as its last parameter:

$form['items'][$key]['desc']['#value'] = strip_tags($item['desc']['#value'],"<div><ul><li>");

john.oltman's picture
Offline
Joined: 07/18/2010
Juice: 5
Drupal 7 version

This is the code for D7, basically replace #value with #markup

  if ($form_id == 'uc_cart_view_form') {
    foreach($form['items'] as $key => $item) {
      if (!empty($item['desc']['#markup'])) {
        $form['items'][$key]['desc']['#markup'] = strip_tags($item['desc']['#markup']);
      }
      if (!empty($item['image']['#markup'])) {
        $form['items'][$key]['image']['#markup'] =  strip_tags($item['image']['#markup'],'<img>');
      }
    }
  }
tonesm's picture
Offline
Joined: 10/25/2012
Juice: 10
Shopping Cart Blocks

This works great however it does not disable the cart links in the sidebar block. How would I address this?