Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Jquery Buttons from .gif Images


surrfman

Recommended Posts

Posted

Have a 2.2 contribution, that uses .gif images for the buttons. contribution has been rewrote for 2.3.1, but rewritter left .gif's instead of drawing jquery buttons. How does one write a chunk of code to fix the issue?

 

Thanks a bunch,

 

Timmy C

Posted

@@surrfman

 

You can see the code structure using this example:

 

<div class="buttonSet">

<span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?></span>

</div>

 

 

IMAGE_BUTTON_CONTINUE - this language definition would be found in the english.php file

 

triangle-1-e - this is the little image next to the text (not needed if you don't want it)

 

tep_href_link(FILENAME_DEFAULT - this is where the button takes the customer once it is clicked

 

 

So, in that contribution where graphic buttons are used, replace the button code with something like the above, ensure you add the language definition to the appropriate file and that's it.

 

 

Chris

Posted

Can't seem to figure out how the code should be set-up to get a drawn button. Here is the code area showing the .gif type button near the bottom:

 

echo '<td class="productListing-data" align="center">' . "\n";

// show thumb image if Enabled

if (RELATED_PRODUCTS_SHOW_THUMBS == 'True') {

echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">' . "\n"

. tep_image(DIR_WS_IMAGES . $attributes_values['products_image'], $attributes_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"').'</a><br>' . "\n";

}

$caption = '';

if (RELATED_PRODUCTS_SHOW_NAME == 'True') {

$caption .= '<p>' . $products_name_slave;

if (RELATED_PRODUCTS_SHOW_MODEL == 'True') {

$caption .= sprintf(RELATED_PRODUCTS_MODEL_COMBO, $products_model_slave);

}

$caption .= '</p>' . "\n";

} elseif (RELATED_PRODUCTS_SHOW_MODEL == 'True') {

$caption .= '<p>' . $products_model_slave . '</p>' . "\n";

}

if (RELATED_PRODUCTS_SHOW_PRICE == 'True') {

$caption .= '<p>' . sprintf(RELATED_PRODUCTS_PRICE_TEXT, $products_price_slave) . '</p>' . "\n";

}

if (RELATED_PRODUCTS_SHOW_QUANTITY == 'True') {

$caption .= '<p>' . sprintf(RELATED_PRODUCTS_QUANTITY_TEXT, $products_qty_slave) . '</p>' . "\n";

}

echo '<a href="'

. tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id_slave) . '">'

. $caption . '</a>' . "\n";

if (RELATED_PRODUCTS_SHOW_BUY_NOW== 'True') {

echo '<a href="'

. tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))

. 'action=rp_buy_now&rp_products_id=' . $products_id_slave) . '">'

. tep_image_button('button_rp_buy_now.gif', IMAGE_BUTTON_RP_BUY_NOW) . '</a>';

}

echo '</td>' . "\n";

$count++;

 

Tried adding this in about 15 different variiations, none worked:

 

<div class="buttonSet">

<span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', tep_href_link(FILENAME_SHOPPING_CART)); ?></span>

</div>

 

What are I not understanding?

 

Timmy C

Posted

@@surrfman , please don't post the complete code of a file if the issue is just the button, it make it harder to focus on the relevant parts. Also much better to wrap code into code tags, that's he symbol <>

 

The old style button is this

 

'<a href="'
 . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))
 . 'action=rp_buy_now&rp_products_id=' . $products_id_slave) . '">'
 . tep_image_button('button_rp_buy_now.gif', IMAGE_BUTTON_RP_BUY_NOW) . '</a>';

 

What are the "elements" ?

 

The Link :

tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=rp_buy_now&rp_products_id=' . $products_id_slave)

 

The text:

IMAGE_BUTTON_RP_BUY_NOW

 

That are the 2 parts you need for the new button. The new button structure is as follows, you don't need all the html around

tep_draw_button(THE_TEXT, 'the symbol', The link);

 

Now it's easy to create it, since we have the elements available. The new button will look like this

tep_draw_button(IMAGE_BUTTON_RP_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=rp_buy_now&rp_products_id=' . $products_id_slave)  );

 

Instead of the icon "cart" you can use any of the available from themeroller , just hover over the symbols to see the names

Posted

@@multimixer

 

George... Thanks man! Did the trick! Posted the complete table as was not sure on the <div> placement; see it is not needed.

 

Thanks a bunch,

 

Timmy C

 

P.S. Lemons... Lemons are better than Melons!

Posted

@@multimixer

 

you being the undisputed jquery expert in the universe... would I experience any issues with upgrading my jquery from 1.8.8 to 1.9.0?

 

Timmy C

Posted

Hope I am posting this in the right thread?

 

I have installed a generic template for the holidays on my development site. The 'Cart Contents', 'Check Out', and 'My Account' buttons don't appear in the header, but the text links do. Any thoughts?

Thanks - Vid

Posted

Actually it's just a theme. It doesn't change the core structure or the database... as far as I know.

Posted

Using FireFox I found the following.

 

<link rel="stylesheet" type="text/css" href="ext/jquery/ui/christmas/jquery-ui-1.8.6.css" />

This file is in the correct path.

 

<script type="text/javascript" src="ext/jquery/jquery-1.4.2.min.js"></script>

Not in the path at all. Do I need to install this in order for the buttons to appear?

 

<script type="text/javascript" src="ext/jquery/ui/jquery-ui-1.8.6.min.js"></script>

Not in the path. Do I need to install this in order for the buttons to appear?

 

Just a shot in the dark. I am lost on this one.

 

Vid

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...