Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need information on tep_draw_button


Psytanium

Recommended Posts

Posted

Hello,

 

I appreciate if i can have some explanations on this string of code:

<?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM_COUPON, 'star', null, 'primary'); ?>

 

How can i give this button a name, id, value, class etc... ?

How can i give it a OnClcik ?

Its a submit button because of 'null', is it possible to attach to this button a form action ?

 

Thank you.

Posted

Look at the function that creates the button... /includes/functions/html_output.php

If you then need more help, post again.

Posted

I have 2 submit buttons in 1 page, im trying to give each button a different form action.

 

can i tell tep_draw_button which action url ? maybe something like this ?

<?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM_COUPON, 'star', null, 'primary', action="action.php"); ?>

Thank you, it seems you help a lot here, +karma for you :)

Posted

exactly, how do i convert

<input type="button" onclick="submitForm('page1.php')" value="submit 1" />

to tep_draw_button

 

especially the onclick.

Posted

i found this somewhere

<?php echo tep_draw_button(IMAGE_BUTTON_ADD_TO_WISHLIST, 'heart', null, null, array ( params=>'name="wishlist_x" action=add_product') ); ?>

something similar ?

Posted

@@burt i think i'm too close

 

<script>
function submitForm(action)
{
 document.getElementById('checkout_confirmation').action = action;
 document.getElementById('checkout_confirmation').submit();
}
</script>

 

<?php
$form_action_url_1 = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); //link to the 1st form
$form_action_url_2 = tep_href_link(FILENAME_CHECKOUT_CONFIRMATION_COUPON, '', 'SSL'); //link to the 2nd form

echo tep_draw_form('checkout_confirmation', $form_action_url_1, 'post'); //form function, what should i put here
?>

 

<?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM_COUPON, 'star', null, 'primary', array ( params=>'onclick="submitForm('. $form_action_url_1 . ')"')); ?>
<?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM, 'star', null, 'primary', array ( params=>'onclick="submitForm('. $form_action_url_2 . ')"')); ?>

 

I appreciate some corrections in tep_draw_form and tep_draw_button.

Posted

Look in catalog/includes/html_functions.php about line 350 for:

 function tep_draw_button($title = null, $icon = null, $link = null, $priority = null, $params = null) {

this the first line of how the function tep_draw_button is defined. Take a close look at the $params variable in that line. Lower down you will see that quite a few lines are devoted to defining $params, and this is where the code inserts things like classes, ids, etc.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Posted

The approach, that you are taking, should work well. Though a few people keep javascript disabled. This tester

 

<?php
if (isset ($_POST["site"])){
$query = '?box=' . $_POST["box"];
header ("Location: [url="http://www"]http://www[/url]." . $_POST["site"] . $query);
exit;
}
?>
<html>
<head></head>
<body>
<form action="tester.php" method="post">
<input type="radio" name="site" value="lloydslist.com">Lloyds List<br />
<input type="radio" name="site" value="joc.com">Journal of Commerce<br /><br />
<input type="text" name="box"><br /><br />
<input type="submit" value="Submit">
</form>
</body>
</html>

 

which must as written be called 'tester.php', illustrates using the $_POST array to find out which choice was made. FILENAME_CHECKOUT_PROCESS and FILENAME_CHECKOUT_CONFIRMATION_COUPON might need to be slightly rewritten, to accept a query string.

Posted

i have tested the java somehow, all parts are working fine but the

echo tep_draw_form('checkout_confirmation', $form_action_url_1, 'post'); //form function

have a defined action variable ($form_action_url_1), how can i pass java function to tep_draw_form ?

Posted

No javascripts or complications needed, here it is

<?php echo tep_draw_button(IMAGE_BUTTON_CONFIRM_COUPON, 'star', null, 'primary', array('params' => 'onclick=\'this.form.action="checkout_confirmation_coupon.php";this.form.submit();\'')); ?>

 

Thx @@burt :) minus Karma for you

Archived

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

×
×
  • Create New...