Jump to content

Archived

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

NodsDorf

2.3.1 Buttons: Can I get an explanation

Recommended Posts

Can somebody point me to the place, or do me the honor of explaining the tep_draw_button() to the degree of what parameters are required, what they mean / do. Additionally I would also like to draw a button but give it a specific name.

 

Example:

<?php echo tep_draw_button(IMAGE_BUTTON_SEARCH, 'search', null, 'primary'); ?></span>

This is what I understand so far:

1. We call the function to draw a button tep_draw_button()

2. First parameter (IMAGE_BUTTON_SEARCH) is the button Image

3. Second parameter ('search') is the button text

4. Third parameter (null)..... is that a link???

5. Fourth parameter (primary)..... has something to do with CSS???

 

I am also curious how I can give my button a specific name?

 

Any help, links or other is appreciated.

Share this post


Link to post
Share on other sites

The parameters are:

 

1. The text that appears on the button.

2. The icon name.

3. The link that the button goes to. If null, this is a form submit button.

4. Primary buttons are in the colors specified, secondary are faded.

5. Parameters. If you want to have a unique ID for your button, add something like 'id="myid"' here.

 

Regards

Jim

 

Edit: forgot #5.


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Thanks Jim,

 

Any idea how I can the button a name tag ?

 

I'm trying to take this 2.2 function and make it work with a 2.3.1 jquery button

<?php echo (tep_image_submit('button_search.gif', Search, 'name="runcheck"') ); ?>

Share this post


Link to post
Share on other sites

Actually, #5 in my list is wrong. That method won't work. My memory was off somewhere else.

 

After looking at the code, I think that you can use this as the fifth parameter:

 

array( 'params' => 'name="runcheck"')

I haven't tried this, so beware typos. And my faulty memory, of course.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Okay I'll give it a try,

 

What I'm after is getting a $_POST['runcheck'] out of it. I'll see if I can get anything to happen with the above code

Thanks again

Share this post


Link to post
Share on other sites

Thanks Jim

<?php echo tep_draw_button(IMAGE_BUTTON_SEARCH, 'search', null, 'primary', array('params' => 'name="runcheck"')); ?></span>

Does actually give the button the name runcheck.

Share this post


Link to post
Share on other sites

array( 'params' => 'name="runcheck"')

 

does not work if button is a link. (see poc above)

 

add in tep_draw_button function (catalog\includes\functions\html_output.php) after

   if ( ($params['type'] == 'button') && isset($link) ) {
  $button .= '<a id="tdb' . $button_counter . '" href="' . $link . '"';

these lines :

  if (isset($params['name'])) {
  $button .= ' name="' . $params['name'] . '"';
  }

 

poc with header button :

   tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), null, array( 'name' => 'checkout')) .


-------------------

Share this post


Link to post
Share on other sites

Thanks Laurent, it actually did give the name when I examined it with Firebug, but it did not post the value when clicked. Which is actually what I need.

 

The original function was is (tep_image_submit( )) Which is an input / submit function, which is what I need out of this button.

 

I don't think your suggestion will fix this issue either and maybe I'm trying to draw a button when I should be trying to do something else.???

 

All I'm trying to accomplish here is to have all the buttons on the new site look the same, and it seemed much easier to draw a jquery button then to try and make image files of them. The original function still works, I just have to use pure images as buttons.

Share this post


Link to post
Share on other sites

well...

test in catalog\includes\header.php with :

tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), null, array('params' => 'name="checkout"')) .

and check your site with firebug ...

 

good luck ! :ph34r:


-------------------

Share this post


Link to post
Share on other sites

Yep, thank you for the help. I got the button name=runcheck & the type=submit showing in firebug with both of your help, unfortunately the function that is suppose to fire when the $_POST is set isn't firing and 3 hours on a button is enough time. I'll just use the tep_img_submit() function for this particular page.

Share this post


Link to post
Share on other sites

Is there a way to make all butotns on a page stay the same color. When I have two buttons or more, one I think is the priimary, the others I think are called secondary, the secondaries all color themselves a different color from the primary. The problem becomes, while one button looks great with a background color, the others color themselves so they don't look good with the background color. I would assume, this is all done in the jquery files.

 

Thanks,

 

Timmy C

Share this post


Link to post
Share on other sites

Two ways:

 

1. Change your theme so all of the buttons, primary and secondary, look good with the rest of the theme.

 

2. Change all of the buttons to primary.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

George... should there be brackets { } at both ends of line?

 

Thanks a bunch,

 

Timmy C

Share this post


Link to post
Share on other sites

Yep Timmy,

 

its a standard CSS just looks different since its all put together.. Dreamweaver would have it look like this:

But I do think he missed a comma.. see below

.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header, .ui-priority-secondary
{
opacity:1;
}

Share this post


Link to post
Share on other sites

No, I did not miss a comma, this is how it should be

 

 .ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary{opacity:1;}

 

You reference 3 selectors

 

.ui-priority-secondary, 
.ui-widget-content .ui-priority-secondary,
.ui-widget-header .ui-priority-secondary
{
opacity:1
}

Share this post


Link to post
Share on other sites

Hi,

 

I had search and search about the buttons until I found this one.

 

I had installed Theme Switcher and use jQuery Theme Roller to make the style.

I can change the bar, infobox header, background color without any problem.

However I got issues with buttons.

 

1, some buttons has different colors which Timmy mentioned.

will have a try with Jim and George's solution.

 

2, I had custom made the buttons, even I replaced the includes/languages/english/images/buttons

it did not apply any customs button. The only button works with my custom made was the addon "back button on product information page, which use 2.2 function which Don mentioned.

 

I am a newbie and have no idea about the codes and css at all.

Can someone please help me and point out me how I can apply the custom buttons to my website step by step?

 

Thank you very much in advance.

 

Lyn

Share this post


Link to post
Share on other sites

All buttons in version 2.3.1 are created by function tep_draw_button() This function "use" jQuery UI to create the buttons

 

In older osCommerce versions the buttons got created using tep_image_button(). This function was pulling an image from the /images/ folder of your language folder (eg includes/languages/english/images/buttons)

 

The tep_image_button() function still exist n osCommerce 2.3.1 but is not used

 

Knowing this facts, you have 2 options for a particular button

 

1) Replace the tep_draw_button() function for a particular button by tep_image_button() and place the image you want to use into the images folder of each language you use

 

2) Use css to target and style any button of your site you want

 

I would do the second, since

- I don't have to draw images

- I leave the php files alone and have all changes in a single css file that I can change again anytime

 

Here is a post that give some ideas about using css to style the buttons

Share this post


Link to post
Share on other sites

Hi George,

 

Thank you so much for your reply.

 

I actually customized bunch of buttons which match my website design.

 

I am really confused as I am not familiar with the code nor css at all.

 

the back button works fine in product information page but all the other page the buttons were just not working at all.

They appear default button style (doesn't matty i applied the themeroller), or appear as text link.

 

For example review.php

 

I can't see any place that I can modify Add to Cart, Write Review, Back....

 

Is there any article that can help me to understand how to apply the customized buttons?

I google and heaps of buttons generator comes up, which I used one of them to generate what exactly I want,

however none of those website actually go further to tell how to apply them.

 

I would love to learn and get my website looks better.

 

Thank you very much again.

 

Lyn

Share this post


Link to post
Share on other sites

for example, this code in product_review.php

 

<?php echo tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now')); ?>

 

 

how can I convert it to tep_image_button()?

Share this post


Link to post
Share on other sites

<?php echo tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now')); ?>

 

<?php echo '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now') . '">' . tep_image_button('XYZ.gif', IMAGE_BUTTON_IN_CART) . '</a>';


Help shape the future of Phoenix; join the Phoenix Club

Share this post


Link to post
Share on other sites

×