ck234 Posted November 29, 2010 Share Posted November 29, 2010 I would like to create a new infobox in osCommerce 2.3.1. E.g. Add an "about us" box below the "currencies" box. In previous versions I would have created the box and added to the file "column_right.php", but I cannot do that now in the new version. If anyone could provide a simple, step-by-step guide I would be very grateful. Thanks in advance. Link to comment Share on other sites More sharing options...
Xpajun Posted November 29, 2010 Share Posted November 29, 2010 Can I ask why you need an about us box rather than an about us page? My store is currently running Phoenix 1.0.3.0 I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 ) I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary Link to comment Share on other sites More sharing options...
♥kymation Posted November 29, 2010 Share Posted November 29, 2010 The column boxes are modules in 2.3.x. Here's a quick outline of how to create a new box: Copy catalog/includes/modules/boxes/bm_information.php and give it a new name. Edit that file and change bm_information to your new box name throughout that file. Change all of the constants that include _INFORMATION_ to include your new name instead. Keep them in all caps. Change the content to what you want in your new box. If you are using links to new files, keep the same format as the links in that box. The part that generates the box is in the execute() method. Copy catalog/includes/languages/english/modules/boxes/bm_information.php and give it a the same name as you did the file in step 1. Make the same changes to the constants in this file that you made in step 3. Upload your two new files. Go to your store Admin > Modules > Boxes and install your new module. Give it a sort order that will place it where you want it. Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
ck234 Posted November 30, 2010 Author Share Posted November 30, 2010 Jim, Thanks a million for your guide. It worked perfectly. At first I could not add the new infobox from the site admin pages, then I realized this was because I had not altered all the INFORMATION constants in the file catalog/includes/modules/boxes/newfile.php, specifically in the function "install". Keep up the good work. Link to comment Share on other sites More sharing options...
blr044 Posted December 15, 2010 Share Posted December 15, 2010 Go to your store Admin > Modules > Boxes and install your new module. Give it a sort order that will place it where you want it. DUMP I made a typo mistake, all is fine. Bennett Link to comment Share on other sites More sharing options...
Guest Posted December 21, 2010 Share Posted December 21, 2010 could anyone explain how i could get it to show an image? I created a new box called bm_adbanner and i changed: $data = 'blah' and sure enough blah showed up, but when i attempt to put an img src in there; it shows up as an X-box. If you right click the image it has the proper path for the file but has extra odd characters on the end of the file name; i do not think just putting an img src in the ' ' works. can anyone help? Im sure there are lots of people who are looking to do the same thing. Link to comment Share on other sites More sharing options...
Guest Posted December 21, 2010 Share Posted December 21, 2010 sorry, solved my own problem. for those that may be dumb like me, you have to add <div class="img"> function execute() { global $oscTemplate; $data = '<div class="img"><img src="http://www.XXXXXXX.com/XXXXX/catalog/frontbanners/side_bar.jpg"></div>'; $oscTemplate->addBlock($data, $this->group); } cheers! Link to comment Share on other sites More sharing options...
cainofgroth666 Posted December 31, 2010 Share Posted December 31, 2010 I so can not even get this to work out right what so ever. I have done everything you have said and no dice. when i go to install there is no name in the list and it gives my errors out the ying yang. DO you ahve any other methods to get this done or am I just that big of noob lol. Email me back Link to comment Share on other sites More sharing options...
♥altoid Posted December 31, 2010 Share Posted December 31, 2010 sorry, solved my own problem. you have to add <div class="img"> function execute() { global $oscTemplate; $data = '<div class="img"><img src="http://www.XXXXXXX.com/XXXXX/catalog/frontbanners/side_bar.jpg"></div>'; $oscTemplate->addBlock($data, $this->group); } cheers! I took a slightly different tack on this. I wouldn't have gotten there if it weren't for ErikMM, kymation and aybc's posts. Thank you all. This code is in /catalog/includes/modules/boxes/bm_paypal_accepted.php, (the project I did was add an info box with a PayPal accepted logo inserted in the content area.) The format of the box, title etc remained the same as my other boxes. Here's the code: $data = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_PAYPAL_ACCEPTED_BOX_TITLE . '</div>' . ' <div class="ui-widget-content infoBoxContents">' . '<div class="img"><center><img src="/images/paypal/paypal_accepted.gif" alt="We accept credit cards through PayPal" border="0" width="100" height="100"></center></div>' . ' </div>' . '</div>'; The only thing not working is the alt= text, but for now the box image is what I wanted. Anyway, to get there I used kymations instructions on creating a new info box, the used aybc's tip on inserting an image. It looks like this: Thanks again to all. I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can. I remember what it was like when I first started with osC. It can be overwhelming. However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc. There are several good pros here on osCommerce. Look around, you'll figure out who they are. Link to comment Share on other sites More sharing options...
BenjaminJ.Gremillion Posted December 31, 2010 Share Posted December 31, 2010 They say a picture is worth a thousand words so... Any ideas on what I'm doing wrong? Link to comment Share on other sites More sharing options...
♥kymation Posted December 31, 2010 Share Posted December 31, 2010 It's easier to use the tep_image() function to produce image tags, and the alt/title then works. Your code would look like this: $data = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_PAYPAL_ACCEPTED_BOX_TITLE . '</div>' . ' <div class="ui-widget-content infoBoxContents">' . ' <div class="img"><center>' . tep_image( DIR_WS_IMAGES . 'paypal/paypal_accepted.gif', 'We accept credit cards through PayPal', '100', '100' ) . '</center></div>' . ' </div>' . '</div>'; Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
♥kymation Posted December 31, 2010 Share Posted December 31, 2010 <images snipped> Any ideas on what I'm doing wrong? Forgot to define the module title in the language file for that module? It's hard to tell without seeing the errors. Edit your admin/includes/application_top.php and change this line error_reporting(E_ALL & ~E_NOTICE); to this error_reporting(E_ALL); That will give you a better idea of what's going wrong. Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
BenjaminJ.Gremillion Posted December 31, 2010 Share Posted December 31, 2010 Just to clarify... Here's my code for catalog/includes/modules/boxes/bm_quick_order.php class bm_quick_order { var $code = 'bm_quick_order'; var $group = 'boxes'; var $title; var $description; var $sort_order; var $enabled = false; function bm_search() { $this->title = MODULE_BOXES_QUICK_ORDER_TITLE; $this->description = MODULE_BOXES_QUICK_ORDER_DESCRIPTION; if ( defined('MODULE_BOXES_QUICK_ORDER_STATUS') ) { $this->sort_order = MODULE_BOXES_QUICK_ORDER_SORT_ORDER; $this->enabled = (MODULE_BOXES_QUICK_ORDER_STATUS == 'True'); $this->group = ((MODULE_BOXES_QUICK_ORDER_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right'); } } function execute() { global $oscTemplate; $data = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_QUICK_ORDER_BOX_TITLE . '</div>' . ' <div class="ui-widget-content infoBoxContents">' . ' ' . tep_draw_form('quick_order', tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL', false), 'get') . ' ' . tep_draw_input_field('item', '', 'size="10" maxlength="30" style="width: 75%"') . ' ' . tep_image_submit('button_quick_order.gif', MODULE_BOXES_QUICK_ORDER_BOX_TITLE) . '<br />' . MODULE_BOXES_QUICK_ORDER_BOX_TEXT . ' </form>' . ' </div>' . '</div>'; $oscTemplate->addBlock($data, $this->group); } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_BOXES_QUICK_ORDER_STATUS'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Quick Order Module', 'MODULE_BOXES_QUICK_ORDER_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_QUICK_ORDER_CONTENT_PLACEMENT', 'Left Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_QUICK_ORDER_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_BOXES_QUICK_ORDER_STATUS', 'MODULE_BOXES_QUICK_ORDER_CONTENT_PLACEMENT', 'MODULE_BOXES_QUICK_ORDER_SORT_ORDER'); } } And here's the code for catalog\includes\languages\english\modules\boxes\bm_quick_order.php define('MODULE_BOXES_QUICK_ORDER_TITLE', 'Quick Order'); define('MODULE_BOXES_QUICK_ORDER_DESCRIPTION', 'Quick Order'); define('MODULE_BOXES_QUICK_ORDER_BOX_TITLE', 'Quick Order'); define('MODULE_BOXES_QUICK_ORDER_BOX_TEXT', ''); EDIT- Thanks, Jim. I'll give that a shot and see. Link to comment Share on other sites More sharing options...
BenjaminJ.Gremillion Posted December 31, 2010 Share Posted December 31, 2010 Not getting any error messages... just no title or sort order, and the new module won't display on my site. Link to comment Share on other sites More sharing options...
♥altoid Posted December 31, 2010 Share Posted December 31, 2010 It's easier to use the tep_image() function to produce image tags, and the alt/title then works. Your code would look like this: $data = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_PAYPAL_ACCEPTED_BOX_TITLE . '</div>' . ' <div class="ui-widget-content infoBoxContents">' . ' <div class="img"><center>' . tep_image( DIR_WS_IMAGES . 'paypal/paypal_accepted.gif', 'We accept credit cards through PayPal', '100', '100' ) . '</center></div>' . ' </div>' . '</div>'; Regards Jim Thanks you Jim, that did the trick. Much appreciated. I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can. I remember what it was like when I first started with osC. It can be overwhelming. However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc. There are several good pros here on osCommerce. Look around, you'll figure out who they are. Link to comment Share on other sites More sharing options...
BenjaminJ.Gremillion Posted December 31, 2010 Share Posted December 31, 2010 I discovered my problem. I forgot to change my function title. Stupid mistake. Thanks for the help earlier :) Much appreciated. Link to comment Share on other sites More sharing options...
blairh Posted January 5, 2011 Share Posted January 5, 2011 Iv got a big issue.. :( after following the steps my boxes strarted to uninstall themselfs.. NO JOKES!!! now i cant re add catergories or best seller these are the errors that are displayed Warning: reset() [function.reset]: Passed variable is not an array or object in /home/automodi/public_html/shop/blair1/modules.php on line 227 Warning: Variable passed to each() is not an array or object in /home/automodi/public_html/shop/blair1/modules.php on line 228 Iv even removed the newly installed boxes and the issue stays the same :'( Any help would be amazing Link to comment Share on other sites More sharing options...
♥kymation Posted January 5, 2011 Share Posted January 5, 2011 That sounds like a database problem. Try cleaning out all of the module constants in the configuration table and reinstalling. This may have been caused by an error in your new module. The most common cause is a constant declared in the install() method that is not also declared in the keys() method. Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
blairh Posted January 5, 2011 Share Posted January 5, 2011 That sounds like a database problem. Try cleaning out all of the module constants in the configuration table and reinstalling. This may have been caused by an error in your new module. The most common cause is a constant declared in the install() method that is not also declared in the keys() method. Regards Jim thanks for the response Jim this is basically my 1st Oscommerce template iv ever modified so could you maybe explain in more simple terms for me :D highly appreciated Blair Link to comment Share on other sites More sharing options...
♥kymation Posted January 5, 2011 Share Posted January 5, 2011 I can get more specific if you tell me what you don't understand. I'm not very good at shooting in the dark. Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
blairh Posted January 6, 2011 Share Posted January 6, 2011 I can get more specific if you tell me what you don't understand. I'm not very good at shooting in the dark. Regards Jim haha, ok Well if I log into the PhpAdmin and find the table where would i the constants.. and what would I replace them with do i have to find new constants or just re use the old ones? This database stuff really confuses me. Link to comment Share on other sites More sharing options...
♥kymation Posted January 6, 2011 Share Posted January 6, 2011 The constants always begin with MODULE_, so if you plug MODULE_% into the Search box next to configuration_key you should get a complete list. Then you'll need to search through that list and remove duplicates, or just remove them all. Removing all of them will uninstall all of your boxes, so that should be a last resort. You could also search for each of the constants that you used in your module and remove them individually, or remove duplicates. That may work, depending on just what the problem is with your code. Of course you need to fix that problem before you try to install it again. Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
PupStar Posted January 6, 2011 Share Posted January 6, 2011 I can get more specific if you tell me what you don't understand. I'm not very good at shooting in the dark. Regards Jim Hi Jim, I dont think blairh is having a problem with the template. I have this thread http://www.oscommerce.com/forums/topic/368597-new-231-infobox/ which details more of the problems encountered converting the 'Year Make Model' contribution to 2.3.1 If you could offer any help then I would appreciate it. Thanks Mark Link to comment Share on other sites More sharing options...
Guest Posted January 19, 2011 Share Posted January 19, 2011 I can get more specific if you tell me what you don't understand. I'm not very good at shooting in the dark. Regards Jim Jim why don't you add this to the Community Add-Ons for a paypal logo or ssl and I bet you become God over night. Link to comment Share on other sites More sharing options...
♥kymation Posted January 19, 2011 Share Posted January 19, 2011 It's not really worthy of an Addon. More like something for Tips and Tricks. I'll write it up there when I have time. And finish my series on osC 2.3.1 while I'm at it. Regards Jim See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.