Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Managing Infoboxes via Admin


aiyou

Recommended Posts

I'm working on completely redesigning my existing site, and am currently working with a (nearly) new install on localhost.

 

In reviewing some of the threads on performance improvements, I noticed a number of references to removing unwanted/unused infoboxes (languages, currencies) etc. This got me thinking, as while I don't may not need these now, there may be a need in the future. Couldn't I just toggle them on/off via Admin, and potentially minimize code changes in the future?

 

Before I go much further, could this be considered a best-practices approach? Or, am I going down a steep and slippery slope that could have catestrophic results? For a newbie like me, this looks promising, but I would certainly like to hear from the more experienced developers for any dangers or risks. While this would increase the number of initial records returned for config values, its probably better than performing a sql query each time to check and see if the item is enabled.

 

To accomplish this, I ran the following SQL to add a configuration value to the Maximum Values group:

INSERT INTO configuration 
(configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) 
VALUES ('', 'Display LANGUAGES infobox', 'DISPLAY_LANGUAGES', 'false', 'Enable display of LANGUAGES infobox', 3, 99, '2009-01-15 21:00', '2009-01-15 21:00', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),');

 

Then, in /includes/column_right.php (since I'm working with a new install), made the following change

FROM:

 if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
       include(DIR_WS_BOXES . 'languages.php');
include(DIR_WS_BOXES . 'currencies.php');

 }

 

TO:

 if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
  //BOF: Manage Infoboxes via Admin
   if (DISPLAY_LANGUAGES == 'true') {
   include(DIR_WS_BOXES . 'languages.php');
   }
 //EOF: Manange Infoboxes via Admin

//include(DIR_WS_BOXES . 'languages.php');
include(DIR_WS_BOXES . 'currencies.php');

 }

 

If this is viable, and worth pursuing, I would probably create a new config group to support these types of settings.

 

I've also done something similar, modifying one of the Center Store contribs, so that I can toggle the display from 100% to 500 px, or anything else I want. Initial testing has worked, but would like to modify the function that sets the config value to be a bit more robust - another topic for another day, depending on the feedback from this initial post.

 

Honest feedback and critique would be appreciated.

 

Thanks

-Rob

Link to comment
Share on other sites

Unless you are likely to want multiple currencies in the future why not just remove the code displaying the boxes.

 

You will be doing an unnecessary test every time a page loads.

 

It would only take minutes to add them back in later if they are every needed.

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

Unless you are likely to want multiple currencies in the future why not just remove the code displaying the boxes.

 

You will be doing an unnecessary test every time a page loads.

 

It would only take minutes to add them back in later if they are every needed.

 

 

Hi, I have ben trying to remove three info boxes from my site but I still cant figure it out. Would you be able to tell me please? I read somewhere that you have to add // in front of the box you want removed but I don't know which bit of the code I need!

Hope you can help! :blush:

Thanks

Link to comment
Share on other sites

Certainly...

 

For example, to remove the Languages infobox

 

Open the /catalog/includes/column_right.php file. Find:

include(DIR_WS_BOXES . 'languages.php');

 

And add the leading slashes

 

//  include(DIR_WS_BOXES . 'languages.php');

 

Remember...back up first!

 

--Rob

Link to comment
Share on other sites

Certainly...

 

For example, to remove the Languages infobox

 

Open the /catalog/includes/column_right.php file. Find:

include(DIR_WS_BOXES . 'languages.php');

 

And add the leading slashes

 

//  include(DIR_WS_BOXES . 'languages.php');

 

Remember...back up first!

 

--Rob

 

 

Thank You!!! :D

 

Dont suppose you could also tell me how to move a box from the left column to the right?! I would like to move the search box to the right column.

Thanks again

Link to comment
Share on other sites

Thank You!!! :D

 

Dont suppose you could also tell me how to move a box from the left column to the right?! I would like to move the search box to the right column.

Thanks again

 

 

Remove / comment the following line from your "catalog/includes/column_left.php" and add in "column_right".php

  require(DIR_WS_BOXES . 'search.php');

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...