Jump to content

Archived

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

ck234

Creating a new infobox in osCommerce 2.3.1

Recommended Posts

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

 

maybe this is the issue:

function bm_search

rename it correctly


Web Developer, Firebug, and Notepad++ are powerful free tools for web design.

Share this post


Link to post
Share on other sites

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

 

That happened to me as well. I don't remember what I did. I just know that when the first one disappeared I went to my last db back-up right away, and was really careful the next time around when adding a box. Talk about a heart-stopper...I was glad I made a back-up right before I tried the new box install.


Web Developer, Firebug, and Notepad++ are powerful free tools for web design.

Share this post


Link to post
Share on other sites

Anyone wanting to know how to add an image to a box, here is an example with correct $data;

 

You do not need to add an extra div class of img. Unless that is doing something else such as centering the image or such.

 

$data = '<div class="ui-widget infoBoxContainer">' .
             '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_IMAGE_BOX_TITLE . '</div>' .
             '  <div class="ui-widget-content infoBoxContents">' . tep_image(DIR_WS_IMAGES . 'paypal.gif', 'We accept Paypal') .
             '  </div>' .
             '</div>';


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

Anyone wanting to know how to add an image to a box, here is an example with correct $data;

 

You do not need to add an extra div class of img. Unless that is doing something else such as centering the image or such.

 

$data = '<div class="ui-widget infoBoxContainer">' .
             '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_IMAGE_BOX_TITLE . '</div>' .
             '  <div class="ui-widget-content infoBoxContents">' . tep_image(DIR_WS_IMAGES . 'paypal.gif', 'We accept Paypal') .
             '  </div>' .
             '</div>';

 

Burt I decided to give yours a go and see what happened. Installed box ok. Tried several ways for the Image.

When I tried yours.

Box title and we accept paypal shows- no image and no errors

 

$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">' . tep_image(DIR_WS_IMAGES . '/xxx/images/paypal_accepted.JPG', 'We accept Paypal') .

' </div>' .

'</div>';

 

This one produces image only:

 

$data = '<div class="img"><img src="http://xxx.com/xxx/images/paypal_accepted.JPG"></div>';

 

This one I thought I would have a little fun and try one my self.

It removes footer and places it in right column.

 

$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"><img src="http://xxx.com/xxx/images/paypal_accepted.JPG"></div>';

' </div>' .

'</div>';

 

Tried all of them on this thread and only one brings up the image the rest just bring up the box title and we accept paypal. There is no red x or image or errors. I am the only one that could manage to put the footer in the right Column. LOL!!!

$data = '<div class="img"><img src="http://xxx.com/xxx/images/paypal_accepted.JPG"></div>';

 

Thanks

Share this post


Link to post
Share on other sites

tep_image(DIR_WS_IMAGES . '/xxx/images/paypal_accepted.JPG',

 

is wrong.

 

UNless you have the paypal_accepted.JPG image named like that, and in

 

/images//xxx/images/

 

Remove this: /xxx/images/


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

tep_image(DIR_WS_IMAGES . '/xxx/images/paypal_accepted.JPG',

 

is wrong.

 

UNless you have the paypal_accepted.JPG image named like that, and in

 

/images//xxx/images/

 

Remove this: /xxx/images/

/xxx/images/paypal_accepted.JPG' image is in /folder/images/paypal_accepted.JPG

 

Moved image to root

 

$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">' . tep_image(DIR_WS_IMAGES . 'paypal_accepted.JPG', 'We accept Paypal') .

' </div>' .

'</div>';

Share this post


Link to post
Share on other sites

/xxx/images/paypal_accepted.JPG' image is in /folder/images/paypal_accepted.JPG

 

Moved image to root

 

$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">' . tep_image(DIR_WS_IMAGES . 'paypal_accepted.JPG', 'We accept Paypal') .

' </div>' .

'</div>';

 

Found my mistake and Burt's code works just fine. Thanks Burt. Now to make the paypal image when clicked go to paypal verification page.

Thanks Bo

Share this post


Link to post
Share on other sites
<div class="ui-widget-content infoBoxContents"><a href="http://example.com">' . tep_image(DIR_WS_IMAGES . 'paypal_accepted.JPG', 'We accept Paypal') .
'</a></div>' .


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

<div class="ui-widget-content infoBoxContents"><a href="http://example.com">' . tep_image(DIR_WS_IMAGES . 'paypal_accepted.JPG', 'We accept Paypal') .
'</a></div>' .

 

Thanks Burt,

tried a hundred times before I posted. I was forgetting the <a and when I used yours I forgot to open the div with ' div but all sorted out now. thanks.

Share this post


Link to post
Share on other sites

Making a box to show SSL from Godaddy.

Follow kymation's how to build a box. Name it whatever you want the box to say.

Maybe this will help someone like me. LOL!!!

 

Add this in includes/boxes/bm_whateveryounamedbox.php

It will replace the content

$data = '<div class="ui-widget infoBoxContainer">' .

' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_whateveryounameyourbox_TITLE . '</div>' .

' <div class="ui-widget-content infoBoxContents"><span id="siteseal"><script type="text/javascript" src="https://seal.godaddy.com/getSeal?sealID=Your site seal number"></script><br/></a></span></div>' .

'</div>';

Share this post


Link to post
Share on other sites

Due to help from this thread I've managed to create a new 'box' to hold my adsense ads.

 

Thing is, I'm lost at how to insert the Google code into the bm_adsense file.

 

I think I have to 'parse' it into the $data variable. Is this correct?

 

Any help on how to do it would be great.

 

google code looks like this

 

<script type="text/javascript"><!--
google_ad_client = "pub-xxxxxxxxxxxxxxxxxx";
google_ad_slot = "xxxxxxxxxxxxxxxxxxxx";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

 

Cheers

Share this post


Link to post
Share on other sites

$data = 'paste_code_here';

Or use the Generic Box addon and just paste the code in the Admin setup for the box. Whichever is easiest for you.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Jim,

 

I thought I'd tried the $data = 'paste_code_here';

 

It gives me a blank page, but no alerts. I'm thinking though that I'm using my development apache server/localhost, and wonder if that's the problem, don't want to go live with it until I'm sure, the client has started populating the site, I would hate to lose it all! :smile:

 

I'm going trying the generic box addon, will report back.

Share this post


Link to post
Share on other sites

<blush> Oh dear... I had adblock plus running - soon as I exempted my localhost page it worked!!!

 

Thanks agan Jim.

Share this post


Link to post
Share on other sites

I never even thought of that. Good old Adblock. Glad to hear you got it running.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

That site appears to be using the Featured Products Addon. You can copy any box using the instructions provided in this thread.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

same problem. no show in the boxes admin;

 

here is my code from the two files, TECH is the box I am going for:

 

<?php

/*

$Id$

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2010 osCommerce

 

Released under the GNU General Public License

*/

 

class bm_tech {

var $code = 'bm_tech';

var $group = 'boxes';

var $title;

var $description;

var $sort_order;

var $enabled = false;

 

function bm_information() {

$this->title = MODULE_BOXES_TECH_TITLE;

$this->description = MODULE_BOXES_TECH_DESCRIPTION;

 

if ( defined('MODULE_BOXES_TECH_STATUS') ) {

$this->sort_order = MODULE_BOXES_TECH_SORT_ORDER;

$this->enabled = (MODULE_BOXES_TECH_STATUS == 'True');

 

$this->group = ((MODULE_BOXES_TECH_CONTENT_PLACEMENT == 'Right 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_TECH_BOX_TITLE . '</div>' .

' <div class="ui-widget-content infoBoxContents">' .

' <a href="' . tep_href_link(FILENAME_DOCUMENTS) . '">' . MODULE_BOXES_TECH_BOX_DOCUMENTS . '</a>' .

' </div>' .

'</div>';

 

$oscTemplate->addBlock($data, $this->group);

}

 

function isEnabled() {

return $this->enabled;

}

 

function check() {

return defined('MODULE_BOXES_TECH_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 Information Module', 'MODULE_BOXES_TECH_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_TECH_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_TECH_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_TECH_STATUS', 'MODULE_BOXES_TECH_CONTENT_PLACEMENT', 'MODULE_BOXES_TECH_SORT_ORDER');

}

}

?>

 

 

then the next file in languages:

 

<?php

/*

$Id$

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2010 osCommerce

 

Released under the GNU General Public License

*/

 

define('MODULE_BOXES_TECH_TITLE', 'Tech Stuff');

define('MODULE_BOXES_TECH_DESCRIPTION', 'Show the tech box in a column.');

 

?>

 

I can only bety ya it's something I overlooked, what can it be?

 

Thanks guys!

 

 

Timmy C

Share this post


Link to post
Share on other sites

This is great for me, I got it to work to a fashion, but i just want to add simple text to the info box, where shall i place it in the php page and how shall i start it, i dont know how to write code it,

 

id like the box to include the words Claim your discount with

 

many thanks

Share this post


Link to post
Share on other sites

The Generic Box Addon would probably work for you.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

The Generic Box Addon would probably work for you.

 

Regards

Jim

Hi Jim

 

Thanks for the great info, But i seem to have made it work, admittingly i have deleted a few lines i dont know which ones as i am a complete novice to this, more like trail and error for me, i was upset when i added the script and all my info boxes got deleted but soon uploaded them again as back ups are all ways good to make before changing that are not familiar too,

 

I will look into Generic box addon as it may be better for me

 

many thanks

Share this post


Link to post
Share on other sites

So...I am struggling with adding the social bookmarks to ALL the pages.

 

I think I know where the problem is, but don't know how to write it.

 

there are three issues:

1. getting them to show on all pages (rather than the product info pages alone)

2. simplifying so they only link to the page being viewed...whatever it is (currently it shows a specific product)

3. adding stumble upon and other sites (this part I think I can handle)

 

the issue is here (the old "includes/modules/boxes/bm_products_social_bookmarks.php" (which I changed to "social_bookmarks")

   function execute() {
     global $HTTP_GET_VARS, $language, $oscTemplate;

     if ( isset($HTTP_GET_VARS['products_id']) && defined('MODULE_SOCIAL_BOOKMARKS_INSTALLED') && tep_not_null(MODULE_SOCIAL_BOOKMARKS_INSTALLED) ) {
       $sbm_array = explode(';', MODULE_SOCIAL_BOOKMARKS_INSTALLED);

       $social_bookmarks = array();

       foreach ( $sbm_array as $sbm ) {
         $class = substr($sbm, 0, strrpos($sbm, '.'));

         if ( !class_exists($class) ) {
           include(DIR_WS_LANGUAGES . $language . '/modules/social_bookmarks/' . $sbm);
           include(DIR_WS_MODULES . 'social_bookmarks/' . $class . '.php');
         }

         $sb = new $class();

         if ( $sb->isEnabled() ) {
           $social_bookmarks[] = $sb->getOutput();
         }
       }

       if ( !empty($social_bookmarks) ) {
         $data = '<div class="ui-widget infoBoxContainer">' .
                 '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_SOCIAL_BOOKMARKS_BOX_TITLE . '</div>' .
                 '  <div class="ui-widget-content ui-corner-top ui-corner-bottom infoBoxContents" style="text-align: center;">' . implode(' ', $social_bookmarks) . '</div>' .
                 '</div>';

^this needs to be closer to the code below (with several exceptions/additions)

function execute() {
     global $oscTemplate;

     $data = '<div class="ui-widget infoBoxContainer">' .
             '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_SOCIAL_BOOKMARKS_BOX_TITLE . '</div>' .
             '  <div class="ui-widget-content ui-corner-top ui-corner-bottom infoBoxContents">' .

             '    <a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . 
MODULE_BOXES_INFORMATION_BOX_SHIPPING . '</a><br />' .
             '  </div>' .
             '</div>';

 

 

the bookmarks would go where the shipping file link is...but I think its a little more involved...

 

mainly getting it to be global, and the bookmarks to link to the current page, including a product, if they happen to be on that page...

 

I'll keep trying, but would love some help...

 

Thanks


Web Developer, Firebug, and Notepad++ are powerful free tools for web design.

Share this post


Link to post
Share on other sites

I took the lazy way out...I just made a new infobox call "addthis" per this link: http://forums.oscommerce.com/topic/367702-creating-a-new-infobox-in-oscommerce-231/page__view__findpost__p__1549064

 

It is now a box module I can move where I want.

 

I chose to eliminate the box line/outline. Here is the code (pay close attention as I removed a few words to kill the box line).

 

a few of the critical lines I used in the newly created includes/modules/boxes/bm_addthis.php

function execute() {
     global $oscTemplate;

     $data = '<div class="ui-widget infoBoxContainer">' .
             '  <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_ADDTHIS_BOX_TITLE . '</div>' .

'  <div class="infoBoxContents">' .

             ' <!-- AddThis Button BEGIN -->
<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&pubid=xa-4dafe12a467536b3"><img src="http://s7.addthis.com/static/btn/sm-share-en.gif" width="83" height="16" alt="Bookmark and Share" style="border:0"/></a>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4dafe12a467536b3"></script>
<!-- AddThis Button END --> ' .


             '  </div>' .
             '</div>';

     $oscTemplate->addBlock($data, $this->group);
   }

   function isEnabled() {
     return $this->enabled;
   }

 

I used the code at this "AddThis" link: https://www.addthis.com/get-addthis?where=website&type=bm&clickbacks=1&frm=home&analytics=0&bm=tb14

 

 

what I removed to not show the line

'  <div class="ui-widget-content ui-corner-top ui-corner-bottom infoBoxContents">' .

became

'  <div class="infoBoxContents">' .

as seen in the first/big code box above.


Web Developer, Firebug, and Notepad++ are powerful free tools for web design.

Share this post


Link to post
Share on other sites

Hello:

 

I try install the Generic Box for 2.3.x contribution... in my OsCommerce 2.3.1 shop

 

I can configure without problem... but, when I go to my shop that appears:

 

Fatal error: Cannot redeclare class language in /var/www/solohdtv/catalog/includes/classes/language.php on line 16

 

If unninstall the module, all works right again.

 

Any idea about it?

 

Thanks

 

PS. My shop work only in Spanish language and we has been put the language files in the english and espanol folders...without accents or not ascii symbols.

Share this post


Link to post
Share on other sites

×