Jump to content



- - - - -

Creating a new infobox in osCommerce 2.3.1


  • Please log in to reply
97 replies to this topic

#1   ck234

ck234
  • Members
  • 2 posts
  • Real Name:Cahir P. king

Posted 29 November 2010 - 08:00 PM

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.

#2   Xpajun

Xpajun
  • Members
  • 1,297 posts
  • Real Name:Julian
  • Gender:Male
  • Location:UK

Posted 29 November 2010 - 10:30 PM

Can I ask why you need an about us box rather than an about us page?

#3 ONLINE   kymation

kymation

    Believers

  • Community Sponsor
  • 7,797 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 29 November 2010 - 11:35 PM

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
My Addons

Banners Box 2.3.x  Support Updated!
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Price in Cart Only/MAPP 2.3.x Support New!
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Superfish Categories Box 2.3x Support New!
Theme Switcher 2.3.x  Support

#4   ck234

ck234
  • Members
  • 2 posts
  • Real Name:Cahir P. king

Posted 30 November 2010 - 05:35 PM

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.

#5   blr044

blr044
  • Members
  • 1,009 posts
  • Real Name:Bennett
  • Gender:Male
  • Location:USA

Posted 15 December 2010 - 07:58 PM

View Postkymation, on 29 November 2010 - 11:35 PM, said:


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

Edited by blr044, 15 December 2010 - 08:00 PM.


#6   aybc

aybc
  • Members
  • 25 posts
  • Real Name:Aaron Kostuik

Posted 21 December 2010 - 11:05 AM

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.

#7   aybc

aybc
  • Members
  • 25 posts
  • Real Name:Aaron Kostuik

Posted 21 December 2010 - 11:09 AM

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!

#8   cainofgroth666

cainofgroth666
  • Members
  • 11 posts
  • Real Name:jacob

Posted 31 December 2010 - 08:23 AM

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

#9   altoid

altoid
  • Community Sponsor
  • 959 posts
  • Real Name:Steve
  • Gender:Male
  • Location:Hollidaysburg, Pennsylvania

Posted 31 December 2010 - 03:36 PM

View Postaybc, on 21 December 2010 - 11:09 AM, said:

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:

[img]http://doggiesports.com/images/screenshot/PayPalBox.jpg[/img]

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.

#10   BenjaminJ.Gremillion

BenjaminJ.Gremillion
  • Members
  • 14 posts
  • Real Name:Benjamin J. Gremillion
  • Gender:Male
  • Location:Baton Rouge, LA

Posted 31 December 2010 - 06:17 PM

They say a picture is worth a thousand words so...
[img]http://www.bjgrem.com/osc1.jpg[/img]
[img]http://www.bjgrem.com/osc2.jpg[/img]

Any ideas on what I'm doing wrong?

Edited by BenjaminJ.Gremillion, 31 December 2010 - 06:19 PM.


#11 ONLINE   kymation

kymation

    Believers

  • Community Sponsor
  • 7,797 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 31 December 2010 - 06:25 PM

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
My Addons

Banners Box 2.3.x  Support Updated!
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Price in Cart Only/MAPP 2.3.x Support New!
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Superfish Categories Box 2.3x Support New!
Theme Switcher 2.3.x  Support

#12 ONLINE   kymation

kymation

    Believers

  • Community Sponsor
  • 7,797 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 31 December 2010 - 06:32 PM

View PostBenjaminJ.Gremillion, on 31 December 2010 - 06:17 PM, said:

<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
My Addons

Banners Box 2.3.x  Support Updated!
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Price in Cart Only/MAPP 2.3.x Support New!
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Superfish Categories Box 2.3x Support New!
Theme Switcher 2.3.x  Support

#13   BenjaminJ.Gremillion

BenjaminJ.Gremillion
  • Members
  • 14 posts
  • Real Name:Benjamin J. Gremillion
  • Gender:Male
  • Location:Baton Rouge, LA

Posted 31 December 2010 - 06:38 PM

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%"') . '&nbsp;' . 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.

Edited by BenjaminJ.Gremillion, 31 December 2010 - 06:40 PM.


#14   BenjaminJ.Gremillion

BenjaminJ.Gremillion
  • Members
  • 14 posts
  • Real Name:Benjamin J. Gremillion
  • Gender:Male
  • Location:Baton Rouge, LA

Posted 31 December 2010 - 06:50 PM

Not getting any error messages... just no title or sort order, and the new module won't display on my site.

#15   altoid

altoid
  • Community Sponsor
  • 959 posts
  • Real Name:Steve
  • Gender:Male
  • Location:Hollidaysburg, Pennsylvania

Posted 31 December 2010 - 06:55 PM

View Postkymation, on 31 December 2010 - 06:25 PM, said:

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.

#16   BenjaminJ.Gremillion

BenjaminJ.Gremillion
  • Members
  • 14 posts
  • Real Name:Benjamin J. Gremillion
  • Gender:Male
  • Location:Baton Rouge, LA

Posted 31 December 2010 - 07:05 PM

I discovered my problem.  I forgot to change my function title. Stupid mistake.  Thanks for the help earlier :) Much appreciated.

#17   blairh

blairh
  • Members
  • 33 posts
  • Real Name:Blair

Posted 05 January 2011 - 07:37 AM

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

#18 ONLINE   kymation

kymation

    Believers

  • Community Sponsor
  • 7,797 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 05 January 2011 - 05:31 PM

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
My Addons

Banners Box 2.3.x  Support Updated!
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Price in Cart Only/MAPP 2.3.x Support New!
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Superfish Categories Box 2.3x Support New!
Theme Switcher 2.3.x  Support

#19   blairh

blairh
  • Members
  • 33 posts
  • Real Name:Blair

Posted 05 January 2011 - 06:22 PM

View Postkymation, on 05 January 2011 - 05:31 PM, said:

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

#20 ONLINE   kymation

kymation

    Believers

  • Community Sponsor
  • 7,797 posts
  • Real Name:Jim Keebaugh
  • Gender:Male
  • Location:Aberdeen WA USA

Posted 05 January 2011 - 09:39 PM

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
My Addons

Banners Box 2.3.x  Support Updated!
Categories Accordion Box 2.3.x  Support
Categories Images Box 2.2x  2.3.x  Support
Closest Shipper 2.2x  Support
Document Manager 2.2x  Support
Generic Box 2.3.x  Support
Get 1 Free 2.2x  Support
jQuery Banner Rotator 2.2x  2.3.x  Support
Price in Cart Only/MAPP 2.3.x Support New!
Modular Front Page 2.3.x  Support
Modular SEO Header Tags 2.3.x  Support
MVS 2.2x  Support
PDF Datasheet 2.3.x  Support
Price Updater 2.2x
Products Specifications 2.2x  2.3.x  Development Version  Support  Bugs/Suggestions
Request a Review 2.2x - 2.3.x  Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Superfish Categories Box 2.3x Support New!
Theme Switcher 2.3.x  Support