4 replies [Last post]
Anand yrh's picture
Offline
Joined: 03/06/2009
Juice: 316
Was this information Helpful?

What changes should i make in this code to add image for Add to cart button insted of default button?

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' =>  variable_get('uc_product_add_to_cart_text', t('Add to cart')),
    '#id' => 'edit-submit-'. $node->nid,
    '#attributes' => array(
      'class' => 'node-add-to-cart',
    ),
  );
  return $form;
}
Anand yrh's picture
Offline
Joined: 03/06/2009
Juice: 316
Fixed

Problem is solved by adding this in to css

.add_to_cart .form-submit, #category-grid-products .form-submit {
       background:transparent url(images/add-to-cart.gif) no-repeat scroll 0% 50%;
       border:medium none;
       cursor:pointer;
       text-indent:5000px;
       width:113px;
       height:21px;
}
goldy736's picture
Offline
Joined: 08/17/2009
Juice: 4
submit button to image

hi anand,

u did well to solve your problem , i got some hope that i can solve my problem also on seeing your answer for it , but my try was ends in vain ...
i have following submit button in php

$form['submit'] = array('#type' => 'submit', '#value' => t('Create new account'), '#weight' => 40);

please help me out . thank you !!!!

Sborsody's picture
Offline
Joined: 07/06/2009
Juice: 123
Re: submit button to image

You use CSS to do this, not editing the php code.

goldy736's picture
Offline
Joined: 08/17/2009
Juice: 4
Tried using CSS

hi,
delighted to see a reply for my post , thank you ....i tried with CSS also as following :

.form-submit {
       background:transparent url(images/submit_up.gif) no-repeat scroll 0% 50%;
       border:medium none;
       cursor:pointer;
       text-indent:5000px;
       width:113px;
       height:21px;
}

after using it all the buttons in different pages were modified with the image embedded above the button but not the required " Create New Account" button in registration page. ;(
please guide me .
Thank you !!