Forums / Templates, Stylesheets, Page Layout / How do I change the buy button into a text link?

How do I change the buy button into a text link?

Locked

Views: 4,905

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
4 Jun 2009, 8:20 AM
#1
joomoo79 avatar

joomoo79

New Zenner

Join Date:
Feb 2009
Posts:
33
Plugin Contributions:
0

How do I change the buy button into a text link?

Hi,

I'm trying to change the look of my "add to cart" button. Instead of an image, I want it to be a simple text link. :wink:
But so far, no luck... :lookaroun

How do I change the zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) part with a regular <a href></a> link?

<!--bof Add to Cart Box -->
<?php
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
  // do nothing
} else {
?>
            <?php
    $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
            if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
              // hide the quantity box and default to 1
              $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            } else {
              // show the quantity box
    $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            }
    $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
  ?>
  <?php if ($display_qty != '' or $display_button != '') { ?>
    <div id="cartAdd">
    <?php
      echo $display_qty;
      echo $display_button;
            ?>
          </div>
  <?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Box-->
4 Jun 2009, 11:20 AM
#2
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: How do I change the buy button into a text link?

Start with the file that generates the buttons in the first place...

/includes/languages/english/button_names.php

Edit that file and remove the button_buy_now.gif text from between the apostrophes... DON'T remove the apostrophes.

That way, the button wont display, but the define('BUTTON_BUY_NOW_ALT', 'Buy Now');

text in between those apostrophes will display instead.

4 Jun 2009, 11:30 AM
#3
joomoo79 avatar

joomoo79

New Zenner

Join Date:
Feb 2009
Posts:
33
Plugin Contributions:
0

Re: How do I change the buy button into a text link?

Thanx for your help!!! :D Unfortunately that doesn't work... It does get rid of the image button, but the alt text doesn't become a text link...

In FF, it does appear as text, but doesn't listen to any css.

In IE, it appears in a box with that red cross icon saying a picture file is missing.

In Safari, you just get the question mark icon, also saying the picture file is missing...

Any other way?

4 Jun 2009, 11:43 AM
#4
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: How do I change the buy button into a text link?

Hmmm, ok try this:

replace;
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);

with;
$the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IN_CART_ALT);

4 Jun 2009, 11:49 AM
#5
joomoo79 avatar

joomoo79

New Zenner

Join Date:
Feb 2009
Posts:
33
Plugin Contributions:
0

Re: How do I change the buy button into a text link?

That didn't do the trick either, sorry. :mellow:

In FF, I get nothing displayed
In IE, I just get the red cross icon
In Safari, I still get the question mark icon

4 Jun 2009, 12:03 PM
#6
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: How do I change the buy button into a text link?

In that case, my best solution would be to open the button image in Photoshop and redesign the actual button to something like this:

http://www.limelites.co.uk/button_add_selected_text.gif

There's probably another way to just change it to a text link, but my php just aint that good yet :-(

4 Jun 2009, 3:20 PM
#7
joomoo79 avatar

joomoo79

New Zenner

Join Date:
Feb 2009
Posts:
33
Plugin Contributions:
0

Re: How do I change the buy button into a text link?

It's ok, I appreciate you trying help very much! :D

I did try to design a button that looks like text, but it's really doesn't look as clean... There must be a (simple) solution. LOL

4 Jun 2009, 3:46 PM
#8
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: How do I change the buy button into a text link?

I'm sure you can add the regular link at the end of the line... my syntax will probably be wrong (that's always my trouble) but I'm sure you can just add it to the end of the line... You should try something like this:

$the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) <a href></a>;

If you can get the <a href></a> working in there and submitting, then you can look at removing the image properly....

This would be a simple task to the more experienced PHP'r... ... can anyone help joomoo here?

4 Jun 2009, 10:39 PM
#9
joomoo79 avatar

joomoo79

New Zenner

Join Date:
Feb 2009
Posts:
33
Plugin Contributions:
0

Re: How do I change the buy button into a text link?

I think I have found a possible workaround, not very clean or practical though... Enabling css buttons through Admin>Config>Layout Settings...

However it requires a loooot of css for something that could be pretty and simple AND quick. lol So it's far from being perfect yet.

5 Jun 2009, 8:02 PM
#10
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: How do I change the buy button into a text link?

That's not ideal. I just stumbled across something that may be of interest to you.... If you add something to cart on my site, you'll see my dynamic cart appear. This is a custom mod that I worked on with a guru some time ago, but I noticed a section of the code that does exactly what you need:

$totalsDisplay .= '<br /><a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">Buy Now</a>';

This displays a text link in PHP... You should be able to manipulate this but the syntax is there for you to see...