Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to - have a switchable stylesheet?


ckyshop.co.uk

Recommended Posts

I saw it on a osc site that they had switchable stylesheet, so the customer could chose from 3 options of what colour the site was.

 

It was like the currency selection, a drop down box that added a '?col=blue' type thing to the address bar.

 

Does anyone know the site, or know a contrib that does this, as if there is contribs that do this none of them had telling titles.

 

Cheers

Thanks for any help/comments.

 

Regards,

 

Lewis Hill

Link to comment
Share on other sites

they are creating a varible with 3 different options. each one of those options has a different stylesheet link in it. You choose the color, the page loads a new style sheet. Pretty simple! Very Cool!

 

That ?col=blue thing you speak of is called the GET array, its the way a form field is passed

Link to comment
Share on other sites

pulling my hair out over this, can get it to switch the stylesheet on the index page, where the dropdown box is, but I can't get it to transfer from page to page, something to do with adding it to the session...?

 

This is what i have for my stylesheet selector box in column_rught:

 

<?php
/*
 $Id: currencies.php,v 1.16 2003/02/12 20:27:31 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

if (isset($currencies) && is_object($currencies)) {
?>
<!-- currencies //-->
         <tr>
           <td>
<?php
   // $style_selecta_array = array('1, Black/Red','2, Black/Red','2, Black/Red',);
//$style = 1;
$style_selecta_array = array (  '0' => array ( 'id' => '1', 'text' => 'Black/Red' ),
      	 '1' => array ( 'id' => '2', 'text' => 'White/Blue' ),
      	 '2' => array ( 'id' => '3', 'text' => 'White/Orange' ),
      	 );
//$style_selecta_array = array([0] => Array ( [id] => 1 [text] => Black/Red ) [1] => Array ( [id] => 2 [text] => White/Blue ) [2] => Array ( [id] => 3 [text] => White/Orange ) );
// Array ( [0] => Array ( [id] => GBP [text] => GB Pounds ) [1] => Array ( [id] => USD [text] => US Dollars ) [2] => Array ( [id] => EUR [text] => Euros ) ) 
$info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_STYLE);

   new infoBoxHeading($info_box_contents, false, false);

/*   reset($currencies->currencies);
   $currencies_array = array();
   while (list($key, $value) = each($currencies->currencies)) {
     $currencies_array[] = array('id' => $key, 'text' => $value['title']);
   }
*/
   $hidden_get_variables = '';
   reset($HTTP_GET_VARS);
   while (list($key, $value) = each($HTTP_GET_VARS)) {
     if ( ($key != 'stylesheet') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {
       $hidden_get_variables .= tep_draw_hidden_field($key, $value);
     }
   }

   $info_box_contents = array();
   $info_box_contents[] = array('form' => tep_draw_form('lewis', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'),
                                'align' => 'center',
                                'text' => tep_draw_pull_down_menu('stylesheet', $style_selecta_array, $style, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id());

   new infoBox($info_box_contents);
print_r ($style_selecta_array);
?>
           </td>
         </tr>
<!-- currencies_eof //-->
<?php
 }
?>

 

Please help a dumb coder!

Thanks for any help/comments.

 

Regards,

 

Lewis Hill

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...