osCmax v2.5 User Manual
Results 1 to 10 of 10

BTS and Image in the Template Folder

This is a discussion on BTS and Image in the Template Folder within the osCmax v2 Customization/Mods forums, part of the osCmax v2.0 Forums category; All, I have been trying to make a start on documenting BTS for the Wiki. However, I was wondering if ...

      
  1. #1
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Default BTS and Image in the Template Folder

    All,

    I have been trying to make a start on documenting BTS for the Wiki.

    However, I was wondering if people think that the buttons should be stored in template folder? At the moment you can only have one set of buttons per language which must be stored in /includes/languages/english/images/buttons.

    I have had a bit of browse around the BTS forums and found this and was wondering if we should make the switch?

    Basically an edit to html_output.php that will look for the button in the template folder ... if it doesn't find it in <your template> it looks in the fallback template folder.

    I have cut and paste the info here ... credit to Alex Zuyev

    Find in shop/includes/functions/html_output.php

    Code:
    // The HTML form submit button wrapper function
    // Outputs a button in the selected language  function 
    
    tep_image_submit($image, $alt = '', $parameters = '') 
    {        global $language;        
    $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';      
    
      if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';      
      if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;        $image_submit .= '>';     
       return $image_submit;  }
    
    ////// Output a function button in the selected language  function
     tep_image_button($image, $alt = '', $parameters = '') {  
          global $language;      
      return tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image, $alt, '', '', $parameters);  }////
    Replace with:

    Code:
    // The HTML form submit button wrapper function
    // Outputs a button in the selected language  function tep_image_submit($image, $alt = '', $parameters = '') {    
                   if (is_file(DIR_WS_TEMPLATES . 'images/' . $image)) {  
                            $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_TEMPLATES . 'images/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';          
     } else {      
       $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_TEMPLATES_FALLBACK . 'images/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';           }     
                    if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';   
         if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;                $image_submit .= '>';         
           return $image_submit;  }
    
    ////// Output a function button in the selected languagefunction tep_image_button($image, $alt = '', $parameters = '') {   
           if (is_file(DIR_WS_TEMPLATES . 'images/' . $image)) {   
         return tep_image(DIR_WS_TEMPLATES . 'images/' . $image, $alt, '', '', $parameters);                        
       } else {      
      return tep_image(DIR_WS_TEMPLATES_FALLBACK . 'images/' . $image, $alt, '', '', $parameters);            
         }}////
    Any thoughts on if this should be implemented - I haven't installed yet - but will try later on today ... can anyone think of any problems in doing this?

    Regards,
    pgmarshall
    _______________________________

  2. #2
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: BTS and Image in the Template Folder

    Okay,

    I have instalelled the changes to html_output on my live store and it would appear to work.

    I have changed a bit so that the code looks in <your template>/images/buttons/ because I thought this would keep things neater and the same as the original folder structure.

    Reading through the code - I can not see how the multi-language bit will work?

    I will update when I get a bit further.

    Regards,
    pgmarshall
    _______________________________

  3. #3
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: BTS and Image in the Template Folder

    I have now got the default osCMax images in the fallback/images/buttons/ folder and I have my store's buttons in my own template.

    And it does work! All I need to do now is test the multi-language functionality ...

    I think this would go along way to cleaning up the templates so that all the required files for a template are actually in the template folder!

    Regards,
    Last edited by pgmarshall; 10-30-2009 at 02:54 AM.
    pgmarshall
    _______________________________

  4. #4
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: BTS and Image in the Template Folder

    Right,

    This is what I have now for my code which appears to work ... This should now do multi-language buttons within <your template>/images/buttons/<your language>/

    (Of course if you do not have the language in your template or the fallback then you will get a broken image.)

    Code:
    // Outputs a button in the selected language
      function tep_image_submit($image, $alt = '', $parameters = '') {
                global $language;
                       if (is_file(DIR_WS_TEMPLATES . 'images/buttons/' . $language . '/' . $image)) {   
    
                           $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_TEMPLATES . 'images/buttons/' . $language . '/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';         
    
                       } else {
    
                           $image_submit = '<input type="image" src="' . tep_output_string(DIR_WS_TEMPLATES_FALLBACK . 'images/buttons/' . $language . '/' . $image) . '" border="0" alt="' . tep_output_string($alt) . '"';          
    		   }
    
    
                       if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';        
                       if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;
    
                                  $image_submit .= '>';
                                  return $image_submit;  
    }
    
    
    ////// Output a function button in the selected language
    function tep_image_button($image, $alt = '', $parameters = '') { 
                  global $language;
                       if (is_file(DIR_WS_TEMPLATES . 'images/buttons/' . $language . '/' .  $image)) {  
     
                       return tep_image(DIR_WS_TEMPLATES . 'images/buttons/' . $language . '/'  . $image, $alt, '', '', $parameters);
    
                              } else {        
    
                       return tep_image(DIR_WS_TEMPLATES_FALLBACK . 'images/buttons/' . $language . '/' . $image, $alt, '', '', $parameters);  
                       }
    }
    
    ////
    Regards,
    pgmarshall
    _______________________________

  5. #5
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Smile Re: BTS and Image in the Template Folder

    Sorry about all the posts ...

    I am conscious that by changing the html_output.php file - this would cause some compatibility issues for some people ... using old templates ... and the ones purchased through this site ...

    If this approach of storing the buttons in the template folder is adopted - perhaps we should have a configuration option allowing the user to switch between the traditional position (inculdes/languages/english/images/buttons) and this one (<your template>/images/buttons/english/)

    Any thoughts? Do people think these images should be in the template folder at all?

    Regards,
    pgmarshall
    _______________________________

  6. #6
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,014
    Rep Power
    36


    Thumbs up Re: BTS and Image in the Template Folder

    To add my tuppence worth:
    What you are doing is sterling work IMO.
    There are a few 'anomalies', where it's necessary to configure global options that really should form part of the template as a whole.

    Consider a Xmas promotion, for example. You may wish to change all the buttons to have a festive look, to match in with a seasonal template. It makes much more sense to maintain these alongside the rest of the template structure.

    Well done!
    You get my vote.

    Hosting plans with installation, configuration, contributions, support and maintenance.

  7. #7
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default Re: BTS and Image in the Template Folder

    Sorry so late to the party, but this is already implemented in svn as of R157 back in June this year (per template buttons):

    r157 - oscmax2 - Project Hosting on Google Code

    Although it is a great effort, you should check the change log before duplicating work!
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  8. #8
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,014
    Rep Power
    36


    Default Re: BTS and Image in the Template Folder

    Poor, poor PGM.



    Now go get dynamic thumbnails working.
    Hosting plans with installation, configuration, contributions, support and maintenance.

  9. #9
    osCMax Developer

    michael_s's Avatar
    Join Date
    Jul 2002
    Location
    Phoenix, AZ
    Posts
    19,907
    Rep Power
    568


    Default Re: BTS and Image in the Template Folder

    Its never enough with you EJ
    Michael Sasek
    osCMax Developer


    osCmax Installation Service
    - Have our professionals install osCmax on your server - same day service!
    osCmax 2.5 User Manual - the must have beginners guide to osCmax v2.5

    Stay Up To Date with everything osCMax:
    Free osCmax Newsletters - Security notices, New Releases, osCMax News
    osCmax on Twitter - Up to the minute info as it happens. Know it first.

    osCmax Documentation

  10. #10
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,014
    Rep Power
    36


    Talking Re: BTS and Image in the Template Folder



    But I did notice the huge effort on the Wiki!
    Hosting plans with installation, configuration, contributions, support and maintenance.

Similar Threads

  1. content folder in aabox template
    By rickarooni in forum osCmax v2 Customization/Mods
    Replies: 2
    Last Post: 07-04-2008, 11:53 AM
  2. Create image box in a pre-made template?
    By Foax_19 in forum osCommerce 2.2 Modification Help
    Replies: 5
    Last Post: 12-27-2006, 01:48 PM
  3. MoPics image folder
    By DerekJ in forum osCmax v1.7 Discussion
    Replies: 4
    Last Post: 01-26-2005, 10:40 AM
  4. I want to move create_account.php to another folder
    By vandiike in forum osCmax v1.7 Discussion
    Replies: 3
    Last Post: 04-15-2004, 06:31 AM
  5. what to upload on https folder
    By knullhund in forum osCMax v1.7 Installation
    Replies: 0
    Last Post: 02-15-2004, 02:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •