5 replies [Last post]
cybercore's picture
Offline
Joined: 10/31/2009
Juice: 8

Hello everyone,

how can i remove the links to the product page in cart?
i want to remove the product link from the picture and from the title (productname).

whats the best way to do this?

i also want to remove the collapsible fields on checkout, how can i do this? removing class with jquery works, but i want a better way.

thanks for your answer,

Andreas

cybercore's picture
Offline
Joined: 10/31/2009
Juice: 8
done
<?php
function hook_form_alter(&$form, $form_state, $form_id) {
    if(
$form_id == 'uc_cart_checkout_form' ) {
   
$form['panes']['coupon']['#collapsible'] = '0';
   
$form['panes']['delivery']['#collapsible'] = '0';
   
$form['panes']['payment']['#collapsible'] = '0';
   
$form['panes']['quotes']['#collapsible'] = '0';
   
   
$form['panes']['billing']['#collapsible'] = '0';
     
$form['panes']['billing']['copy_address']['#attributes'] = array('onclick' => 'uc_cart_copy_address(this.checked, \'delivery\', \'billing\')');
   
   
$form['panes']['legal_aspects']['#collapsible'] = '0';
   
$form['panes']['comments']['#collapsible'] = '0';
  }

}

?>
zincdesign's picture
Offline
Joined: 03/16/2010
Juice: 8
How do you implement it

I am a designer essentially but I'm getting pretty good with Drupal theming to a certain level. It's the 'hook overriding' bit I'm still trying work out - if that's what you are supposed to do!
I copied this code into my template.php and it made no difference to my checkout panes. Can somebody point me in the right direction - do I have to rename the function with my theme name like other functions?

ill3's picture
Offline
Joined: 02/01/2010
Juice: 22
Re: How do you implement it

zincdesign: the code above should be placed inside a module. It's recommended you make a small module to place your form_alter functions in to keep them separate from everything else and not conflict with updates.

You may be lost, we all have been, I still new to form_alter functions too. Let me post some examples for the sake of other newbies that may find this thread looking for help.

Create a folder for your module first. I'll use the common example of "mymodule"

Inside my \mymodule\ folder I need 2 files: the .module and .info file.
|- mymodule.info
|- mymodule.module

mymodule.info just contains basic info for the Modules page (so you can find, recognize and enable it). My sample has the following in it:

; $Id
name = My Customization Module
description = My customizations & form_alter functions
package = Other
core = 6.x

When I go to Site Building -> Modules I will see my module in the 'Other' category with the name 'My Customization Module'. With me still?

mymodule.module is where the function goes.
We will use the code posted by cybercode earlier and make a slight change. Change hook_form_alter to mymodule_form_alter as this will be part of our 'mymodule' module. You may also want to add some comments before the function so you remember what you did the next time you look at it.
The code should look like this:

<?php
/**
*  My module for Form Alter customizations
**/
function mymodule_form_alter(&$form, $form_state, $form_id) {
    if(
$form_id == 'uc_cart_checkout_form' ) {
   
$form['panes']['coupon']['#collapsible'] = '0';
   
$form['panes']['customer']['#collapsible'] = '0';
   
$form['panes']['delivery']['#collapsible'] = '0';
   
$form['panes']['payment']['#collapsible'] = '0';
   
$form['panes']['quotes']['#collapsible'] = '0';
   
   
$form['panes']['billing']['#collapsible'] = '0';
     
$form['panes']['billing']['copy_address']['#attributes'] = array('onclick' => 'uc_cart_copy_address(this.checked, \'delivery\', \'billing\')');
   
   
$form['panes']['legal_aspects']['#collapsible'] = '0';
   
$form['panes']['comments']['#collapsible'] = '0';
  }
}

?>

See the attached mymodule.zip for this files from this example. Just upload it as you would any module.

AttachmentSize
mymodule.zip 749 bytes
ill3's picture
Offline
Joined: 02/01/2010
Juice: 22
Re: Removing links on cart - Removing collapsible?

To disable the Customer Information pane from collapsing, use the following (from my post above):

$form['panes']['customer']['#collapsible'] = '0';
sselden's picture
Offline
Joined: 02/13/2010
Juice: 32
Re: Removing links on cart - Removing collapsible?

The solution in this thread didn't work for me. But this one did:
http://www.ubercart.org/forum/support/4059/how_do_you_make_it_so_you_don...

Posting here in case anyone else is hunting down an answer for this.

I'm not really a geek, I just play one on TV.