<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>multimixer &#187; buttons</title>
	<atom:link href="http://multimixer.gr/tag/buttons/feed/" rel="self" type="application/rss+xml" />
	<link>http://multimixer.gr</link>
	<description>lets talk about osCommerce</description>
	<lastBuildDate>Fri, 19 Nov 2021 08:23:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Make all your buttons primary</title>
		<link>http://multimixer.gr/02/11/2012/make-all-your-buttons-primary/</link>
		<comments>http://multimixer.gr/02/11/2012/make-all-your-buttons-primary/#comments</comments>
		<pubDate>Fri, 02 Nov 2012 09:59:29 +0000</pubDate>
		<dc:creator>multimixer</dc:creator>
				<category><![CDATA[learn]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://multimixer.gr/?p=1267</guid>
		<description><![CDATA[An in-depth explanation to help you understand the primary/secondary buttons appearance in osCommerce and a quick tip to make them all look same]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">osCommerce use 2 types of buttons regarding display: &#8220;Primary buttons and secondary buttons&#8221;. The difference is, that primary buttons appear &#8220;stronger&#8221; on the screen, while secondary are like faded out</p>
<p style="text-align: justify;">This has a good reason, the main action use a &#8220;primary&#8221; button, while any others use a &#8220;secondary&#8221; one. For example, on the product information page you can see that the &#8220;add to cart&#8221; button is a primary one &#8211; this is the main and most important button on that page &#8211; while the reviews button is a secondary one</p>
<div style="border-bottom: 1px solid #d0d0d0; padding-bottom: 5px; margin-bottom: 5px;"><a href="http://multimixer.gr/wp-content/uploads/2012/11/default_1.jpg"><img class="aligncenter size-large wp-image-1269" title="Primary secondary button on default template" src="http://multimixer.gr/wp-content/uploads/2012/11/default_1-540x68.jpg" alt="Primary secondary button on default template" width="540" height="68" /></a></div>
<div style="border-bottom: 1px solid #d0d0d0; padding-bottom: 5px; margin-bottom: 5px;"><a href="http://multimixer.gr/wp-content/uploads/2012/11/default_2.jpg"><img class="aligncenter size-large wp-image-1270" title="primary secondary buttons on MTS template with ui lightness theme" src="http://multimixer.gr/wp-content/uploads/2012/11/default_2-540x92.jpg" alt="primary secondary buttons on MTS template with ui lightness them" width="540" height="92" /></a></div>
<div><a href="http://multimixer.gr/wp-content/uploads/2012/11/default_3.jpg"><img class="aligncenter size-large wp-image-1271" title="primary secondary buttons on MTS template with flickr theme" src="http://multimixer.gr/wp-content/uploads/2012/11/default_3-540x108.jpg" alt="primary secondary buttons on MTS template with flickr theme" width="540" height="108" /></a></div>
<p style="text-align: justify;">How it comes that there are 2 types of buttons? A short explanation:</p>
<h3>a) The file</h3>
<p style="text-align: justify;">Each button is created in the file it has to appear, so, in this example, we can see in file catalog/product_info.php</p>
<p style="text-align: justify;">The &#8220;add to cart&#8221; button</p>
<pre class="brush:xml">tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary');</pre>
<p>The &#8220;reviews&#8221; button</p>
<pre class="brush:xml">tep_draw_button(IMAGE_BUTTON_REVIEWS . (($reviews['count'] &gt; 0) ? ' (' . $reviews['count'] . ')' : ''), 'comment', tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()));</pre>
<p style="text-align: justify;">Beside any other difference, that are not part of this topic, you can see that the &#8220;add to cart&#8221; button has the parameter &#8220;primary&#8221; while the &#8220;reviews&#8221; button, don&#8217;t have any parameter regarding this</p>
<p style="text-align: justify;">Here is an other button example that appear as a secondary button on the website, maybe more clear, because of less other parameters</p>
<p>A primary button</p>
<pre class="brush:xml">tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&amp;products_id=' . $product['id'] ) , 'primary')</pre>
<p>A secondary button</p>
<pre class="brush:xml">tep_draw_button(IMAGE_BUTTON_DETAILS, 'info', tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product['id']))</pre>
<p style="text-align: justify;">That are the &#8220;details&#8221; and &#8220;buy now&#8221; buttons that appear like this on a website</p>
<p style="text-align: justify;"><a href="http://multimixer.gr/wp-content/uploads/2012/11/default_4.jpg"><img class="aligncenter size-large wp-image-1283" title="Buttons of mini template system's front page module" src="http://multimixer.gr/wp-content/uploads/2012/11/default_4-540x177.jpg" alt="Buttons of mini template system's front page module" width="540" height="177" /></a>You can see that again, the &#8220;buy now&#8221; button has the parameter &#8220;primary&#8221; while the &#8220;details&#8221; has no parameter in this direction at all</p>
<p style="text-align: justify;">Where do this parameters go to, and how do they affect the display?</p>
<h3>b) the function</h3>
<p style="text-align: justify;">All buttons are created using the function &#8220;tep_draw_button(parameters)&#8221; This function is in file catalog/includes/functions/html_output.php</p>
<pre class="brush:xml">  function tep_draw_button($title = null, $icon = null, $link = null, $priority = null, $params = null) {</pre>
<p style="text-align: justify;">You can see that the 4th parameter the function accept is $priority, this is where the &#8220;primary&#8221; parameter of the above buttons goes to</p>
<p>The function handles this parameter as follows</p>
<pre class="brush:xml">    if (!isset($priority)) {
      $priority = 'secondary';
    }</pre>
<p style="text-align: justify;">What does this mean? It say &#8221; if there is no $priority set, then set $priority to be secondary&#8221;</p>
<p style="text-align: justify;">So, you see why buttons with no priority parameter set appear as secondary buttons.</p>
<p style="text-align: justify;">In a next step, the function adds the $priority to the button html</p>
<p style="text-align: justify;">
<pre class="brush:xml">    $button .= ').addClass("ui-priority-' . $priority . '").parent().removeClass("tdbLink");&lt;/script&gt;';</pre>
<p style="text-align: justify;">In simple words, it add the class &#8220;ui-priority-primary or ui-priority-secondary to the jQuery function that goes with each button, depending on how $priority was defined before. In our html the button appear then having one of the two priorities</p>
<p>Next thing that happen is plain and simple css</p>
<h3>c) the css</h3>
<p>In the css file of each UI theme, there are rules regarding the priority, that look like this</p>
<pre class="brush:css">.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }</pre>
<p>The above example is from jQueryUI version 1.8.22, but there are no big differences (if any) to the other versions</p>
<p>This rules say plain and simple that anything with priority &#8220;primary&#8221; has to have bold fonts, while anything with priority &#8220;secondary&#8221; has to have normal fonts and a opacity of 0.7</p>
<p>That&#8217;s all that happen with the buttons, there is no mystery, in case you suspected any :)</p>
<h2>How to change the buttons</h2>
<p>Now, after we know this all, what can we do if we want all of our buttons to look the same?</p>
<p><strong><span style="color: #000000;">Not good options are:</span></strong></p>
<p>- Modify all osCommerce files that have a button and add a priority of &#8220;primary&#8221; to each button. A huge task that will cause the same amount of work if you want to change anything</p>
<p>- Modify the tep_draw_button() function to set a priority of &#8220;primary&#8221; by default, instead of &#8220;secondary&#8221; as it does now. Not good, because you&#8217;ll loose the flexibility you have now, your change will not affect any buttons that have a priority of secondary set explicit and finally you&#8217;ll modify a core osCommerce file, this is never a very good idea</p>
<p>- modify manually the css file of your jQueryUI theme and change the rules for the 2 cases</p>
<p>Unfortunately  the above options (and some other) are often suggested in the forum, anyway.</p>
<p style="text-align: justify;"><strong><span style="color: #000000;">The good option is</span></strong> to do everything in css by adding new rules to your stylesheet.css file. This is very simple to do</p>
<p style="text-align: justify;">- open your file catalog/stylesheet.css</p>
<p style="text-align: justify;">- copy paste the original jQueryUI css rules into it</p>
<pre class="brush:css">.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }</pre>
<p style="text-align: justify;">- change them to anything you want. For example if you want both buttons to be same, you can use he rules as follows</p>
<pre class="brush:applescript">.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: normal; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: 1; filter:Alpha(Opacity=100); }</pre>
<blockquote>
<p style="text-align: center;">Mini Template System users, please use file <strong><span style="color: #ff0000;">catalog/mts/themes/your_theme/style_custom.css</span></strong> to add that and leave the default stylesheet.css and any other css file in peace</p>
</blockquote>
<p>That&#8217;s all people, enjoy</p>
<p style="text-align: justify;">
]]></content:encoded>
			<wfw:commentRss>http://multimixer.gr/02/11/2012/make-all-your-buttons-primary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add more buttons to your osCommerce header</title>
		<link>http://multimixer.gr/19/06/2012/add-more-buttons-to-your-oscommerce-header/</link>
		<comments>http://multimixer.gr/19/06/2012/add-more-buttons-to-your-oscommerce-header/#comments</comments>
		<pubDate>Tue, 19 Jun 2012 13:15:05 +0000</pubDate>
		<dc:creator>multimixer</dc:creator>
				<category><![CDATA[learn]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[osCommerce v2.3]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://multimixer.gr/?p=1220</guid>
		<description><![CDATA[Read here how to add more buttons to your stores header, just beside the existing "cart", "checkout" and "my account" buttons. It's very easy to do, try it out]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">
<p style="text-align: justify;">Even this question has been asked &#8211; and answered &#8211; really many times in the osCommerce forum, it still seem to be a hard thing to do for many people. I recently got an email from a osCommerce user asking exactly this: How to add more buttons to my header, just beside the existing &#8220;cart&#8221;, &#8220;checkout&#8221; and &#8220;my account&#8221; buttons.</p>
<p style="text-align: justify;">This is how the section look by default</p>
<p style="text-align: justify;"><a href="http://multimixer.gr/wp-content/uploads/2012/06/contact_us_button_header0.jpg"><img class="aligncenter size-large wp-image-1238" title="The default osCommerce header with 3 buttons" src="http://multimixer.gr/wp-content/uploads/2012/06/contact_us_button_header0-540x77.jpg" alt="The default osCommerce header with 3 buttons" width="540" height="77" /></a></p>
<p style="text-align: justify;">That is really very easy to do, lets start. The file to work on is catalog/includes/header.php. Make a copy of it for backup reasons and open the file (not the copy)</p>
<h3>Step 1: Locate the existing buttons</h3>
<p>They are very easy to find, very close to the top of the file you&#8217;ll see following:</p>
<pre class="brush:php; first-line: 21">  &lt;div id="headerShortcuts"&gt;
&lt;?php
  echo tep_draw_button(HEADER_TITLE_CART_CONTENTS . ($cart-&gt;count_contents() &gt; 0 ? ' (' . $cart-&gt;count_contents() . ')' : ''), 'cart', tep_href_link(FILENAME_SHOPPING_CART)) .
       tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) .
       tep_draw_button(HEADER_TITLE_MY_ACCOUNT, 'person', tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));

  if (tep_session_is_registered('customer_id')) {
    echo tep_draw_button(HEADER_TITLE_LOGOFF, null, tep_href_link(FILENAME_LOGOFF, '', 'SSL'));
  }
?&gt;
  &lt;/div&gt;</pre>
<p style="text-align: justify;">Each of that lines is a button. Well, the term &#8220;button&#8221; is maybe to exactly correct, since they don&#8217;t submit anything. In fact <strong>they are just links looking like buttons</strong>. This happens because of the &#8220;tep_draw_button()&#8221; function of osCommerce, that take a plain link and make it look like a button</p>
<h3>Step 2: Create a new button</h3>
<p>Each button need at least following information</p>
<ul>
<li><strong>a link</strong>: To where should your button link to? It can be any page of your store, like eg &#8220;contact us&#8221;, any product, any category</li>
<li><strong>a text</strong>: There should be a text, so that people know what the button is for</li>
<li><strong>an icon</strong>: This is the small symbol on the left of your button</li>
</ul>
<p>Here is a single button</p>
<pre class="brush:php">tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'))</pre>
<p>In plain english we could say</p>
<blockquote><p><strong>tep_draw_button(button text, button icon, button link)</strong></p></blockquote>
<p style="text-align: justify;">As an example, lets create a button to the contact us page. So we want to link to &#8220;contact_us.php&#8221;, we want the button text to say &#8220;contact us&#8221; and the icon to be an envelope</p>
<h4>2.1 The button link</h4>
<p>This is this part of the button code</p>
<pre class="brush:applescript">tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')</pre>
<p style="text-align: justify;">This is the regular tep_href_link() function used all over osCommerce. For the &#8220;contact_us.php&#8221; page, the link would look like this</p>
<pre class="brush:applescript">tep_href_link(FILENAME_CONTACT_US)</pre>
<p style="text-align: justify;">We don&#8217;t need the SSL part of the link, since contact us is a regular page not SSL protected. As you can see, we did use the constant (FILENAME_CONTACT_US) instead of just typing in the filename (contact_us.php). This has no difference to the link functionality, but it&#8217;s highly recommended to keep this practice. You can find a list of all files and their constants in file catalog/includes/filenames.php</p>
<h4>2.2 The button text</h4>
<p>This is following part of the button code that we use as a reference:</p>
<p>HEADER_TITLE_CHECKOUT</p>
<p style="text-align: justify;">As you can see there is again a &#8220;constant&#8221; used, instead of just typing in the text. This way the store can be multilingual. Even you use just one language in your store right now, it&#8217;s better to keep it that way instead of typing in plain text. Additional benefits are that all text is in one file and that you can change it easily there. Finally, the same text can be reused anywhere in the store</p>
<p>We will use</p>
<p>IMAGE_BUTTON_CONTACT_US</p>
<p style="text-align: justify;">The file to define the text is catalog/includes/languages/english.php (or german.php, italian.php, swahili.php etc). Here you can add to anywhere (maybe after all other defines that are like IMAGE_BUTTON_XY)</p>
<pre class="brush:applescript">define('IMAGE_BUTTON_CONTACT_US', 'Contact us');</pre>
<p>What we did here is, to define, set, declare, that constant IMAGE_BUTTON_CONTACT_US be &#8220;contact us&#8221;in English. Same you need to do for all languages of your store and translate accordingly</p>
<h4>2.3 The button icon</h4>
<p style="text-align: justify;">Here we cant use anything we want, but need to pick an icon from the existing icon set of jQuery UI. There is a large selection available, you can see it on the <a title="Themeroller" href="http://jqueryui.com/themeroller/" target="_blank">themeroller</a> website. Going to the bottom of the site, you&#8217;ll see a listing of all available icons. Hover over each and you&#8217;ll see its name.</p>
<p>For the contact us button, where we want the envelope icon and got the text &#8220;ui-icon-mail-closed&#8221;, so the text I need for the button is &#8220;mail -closed&#8221;</p>
<h4>2.4 Putt it together</h4>
<p>Now after we have the button link, button text and button icon, lets put our new button together again. Here it is</p>
<pre class="brush:php">tep_draw_button(IMAGE_BUTTON_CONTACT_US, 'mail-closed', tep_href_link(FILENAME_CONTACT_US))</pre>
<h3>3 Place the button to the header</h3>
<p>You can place that button to anywhere you like. Now, since we said we want it in the header, lets add it to there.</p>
<pre class="brush:php">  echo tep_draw_button(HEADER_TITLE_CART_CONTENTS . ($cart-&gt;count_contents() &gt; 0 ? ' (' . $cart-&gt;count_contents() . ')' : ''), 'cart', tep_href_link(FILENAME_SHOPPING_CART)) .
       tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) .
       tep_draw_button(HEADER_TITLE_MY_ACCOUNT, 'person', tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));

  echo tep_draw_button(IMAGE_BUTTON_CONTACT_US, 'mail-closed', tep_href_link(FILENAME_CONTACT_US));

  if (tep_session_is_registered('customer_id')) {
    echo tep_draw_button(HEADER_TITLE_LOGOFF, null, tep_href_link(FILENAME_LOGOFF, '', 'SSL'));
  }</pre>
<p style="text-align: justify;">If you want to place the button between the existing &#8220;cart&#8221; and &#8220;checkout&#8221; buttons it would look like this</p>
<pre class="brush:php">  echo tep_draw_button(HEADER_TITLE_CART_CONTENTS . ($cart-&gt;count_contents() &gt; 0 ? ' (' . $cart-&gt;count_contents() . ')' : ''), 'cart', tep_href_link(FILENAME_SHOPPING_CART)) .
       tep_draw_button(HEADER_TITLE_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) .
       tep_draw_button(IMAGE_BUTTON_CONTACT_US, 'mail-closed', tep_href_link(FILENAME_CONTACT_US)) .
       tep_draw_button(HEADER_TITLE_MY_ACCOUNT, 'person', tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));

  if (tep_session_is_registered('customer_id')) {
    echo tep_draw_button(HEADER_TITLE_LOGOFF, null, tep_href_link(FILENAME_LOGOFF, '', 'SSL'));
  }</pre>
<p>This is how things look like so far</p>
<p><a href="http://multimixer.gr/wp-content/uploads/2012/06/contact_us_button_header1.jpg"><img class="aligncenter size-large wp-image-1245" title="osCommerce header with contact us button" src="http://multimixer.gr/wp-content/uploads/2012/06/contact_us_button_header1-540x76.jpg" alt="osCommerce header with contact us button" width="540" height="76" /></a></p>
<h3>4 Some more button examples</h3>
<p>A nice thing to have would be a login button in the header that would change to logoff in case the customer is already logged in</p>
<p>Here you can change this</p>
<pre class="brush:php">  if (tep_session_is_registered('customer_id')) {
    echo tep_draw_button(HEADER_TITLE_LOGOFF, null, tep_href_link(FILENAME_LOGOFF, '', 'SSL'));
  }</pre>
<p>to this</p>
<pre class="brush:php">  if (tep_session_is_registered('customer_id')) {
    echo tep_draw_button(HEADER_TITLE_LOGOFF, null, tep_href_link(FILENAME_LOGOFF, '', 'SSL'));
  } else {
    echo tep_draw_button(IMAGE_BUTTON_LOGIN, 'key', tep_href_link(FILENAME_LOGIN, '', 'SSL'));
  }</pre>
<p>and it will to exactly this</p>
<p style="text-align: justify;">An other thing you can do, is to add a link to an external website, for example your blog. Here we don&#8217;t need to use the tep_href_link() function to create the link since the session will be lost anyway. What we want here is, to make the link target open in a new browser window and to be &#8220;stronger&#8221; than the others</p>
<p style="text-align: justify;">Here is the button:</p>
<p style="text-align: justify;">
<pre class="brush:applescript"> echo tep_draw_button('My blog', 'person', 'http://multimixer.gr', 'primary', array('newwindow'=&gt;'newwindow'));</pre>
<p>You can check the parameters that the tep_draw_button() function accept in file catalog/includes/functions/html_output.php</p>
<p>Here is how our header look now with all that buttons</p>
<p><a href="http://multimixer.gr/wp-content/uploads/2012/06/contact_us_button_header3.jpg"><img class="aligncenter size-large wp-image-1240" title="osCommerce header with many buttons" src="http://multimixer.gr/wp-content/uploads/2012/06/contact_us_button_header3-540x77.jpg" alt="osCommerce header with many buttons" width="540" height="77" /></a></p>
<p style="text-align: justify;">While you are doing in the header section, you could take a look about other things you can do to make it look nicer<a title="Nice header for osCommerce store" href="http://multimixer.gr/25/11/2010/make-a-nice-header-for-your-store-in-oscommerce-version-2-3-1/">: Make a nice header for your osCommerce store</a></p>
<p style="text-align: justify;">Mini template system users: Please don&#8217;t do anything of all this, it&#8217;s not necessary. You can use <a title="Create new links in osCommerce" href="http://minitemplatesystem.com/usage/link-manager-oscommerce/#b" target="_blank">link manager</a> to create links and add them to any <a title="Link manager osCommerce" href="http://minitemplatesystem.com/usage/link-manager-oscommerce/#gb" target="_blank">link groups</a> and <a title="Create menu osCommerce" href="http://minitemplatesystem.com/usage/menu-maker-horizontal-drop-down-navigation-menu/" target="_blank">menu maker</a> to place them either to your main navigation or to your link boxes. There is no need to modify any file</p>
]]></content:encoded>
			<wfw:commentRss>http://multimixer.gr/19/06/2012/add-more-buttons-to-your-oscommerce-header/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
