Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Addon] Generic Box


kymation

Recommended Posts

You need to modify the code to restrict the box. In includes/modules/boxes/bm_generic.php, find this code:

 

     if (tep_not_null($content)) {

and replace it with:

 

     if (tep_not_null($content) && !isset($HTTP_GET_VARS['products_id'])) {

That should keep it from showing on any product or review page.

 

Regards

Jim

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

Link to comment
Share on other sites

Try replacing $HTTP_GET_VARS with $_GET in that line.

 

Regards

Jim

That works! Thanks so much. Now can you tell me how to make best sellers show on all category pages and not just the first one? OR Just make it work on all pages.

 

 

Thanks!

Edited by Mastermind2008
Link to comment
Share on other sites

I have a simple question, Not knowing what I am doing

How do I code for a image in the

English Contents

Enter the contents that you want in your box in English.

 

Also

I tried a couple of things one that resulted in php errors ect

If this happens just uninstall and reinstall in the admin panel

Thanks for the help

Dave

Link to comment
Share on other sites

You need to modify the code to restrict the box. In includes/modules/boxes/bm_generic.php, find this code:

 

     if (tep_not_null($content)) {

and replace it with:

 

     if (tep_not_null($content) && !isset($HTTP_GET_VARS['products_id'])) {

That should keep it from showing on any product or review page.

 

Regards

Jim

 

Hi Jim

 

Slightly off topic, but will this code change work to stop the New Products box from appearing on the product_info page too please?

 

:D

Link to comment
Share on other sites

That code will block the module from appearing anyplace that the Product ID is present: Product Info and Reviews pages.

 

Regards

Jim

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

Link to comment
Share on other sites

That code will block the module from appearing anyplace that the Product ID is present: Product Info and Reviews pages.

 

Regards

Jim

Thanks that is interesting to know, but just realised there isn't a bm_products_new.php :rolleyes:

Edited by warrenerjm
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi guys i need a bit of help, i just got and installed the generic box module, im a complete noob to php code and sometimes it feels like trying Learning Einsteins theory of relativity from a french man :S,

 

I wanted to implement social links with buttons into my Generic box and was wondering where and how i imput the html coding within the php file

 

 

I notice this is an old Post im just praying you still get an alert for it

Link to comment
Share on other sites

You add your HTML code in the Admin interface where you installed the module, in the box labeled <language> Contents (where <language> is your installed language). See section 3.2.1 in the manual for more information.

 

Yes, thankfully, the forum is still sending notices on this one. It will stop doing so at some unknown future time, without notice, so PM me if I don't respond in a day or so.

 

Regards

Jim

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

Link to comment
Share on other sites

Hi Jim,

 

First thank you for the module...works great.

 

The problem I'm trying to fix is related to ssl encryption. I am using this box for twitter and facebook feeds. Facebook offers the feed in encrypted format so it works perfectly at all times.

 

My twitter feed is not available in an https format

 

I have this code

 

<?php
if( $_SERVER['HTTPS'] != "on" )
{
?>
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
 version: 2,
 type: 'search',
 search: 'Corvette',
 interval: 6000,
 title: 'Corvette Tweets',
 subject: '',
 width: 'auto',
 height: 300,
 theme: {
   shell: {
     background: '#535454',
     color: '#ffffff'
   },
   tweets: {
     background: '#050505',
     color: '#f2eff2',
     links: '#1985b5'
   }
 },
 features: {
   scrollbar: true,
   loop: true,
   live: true,
   hashtags: true,
   timestamp: true,
   avatars: true,
   toptweets: true,
   behavior: 'default'
 }
}).render().start();
</script>

<?php
}
?>

 

It works as it is supposed to from my main page, but inserted into the generic box text box it doesn't turn off on https.

 

Is there somewhere else in the coding I can place this to have it show up properly? Thank you in advance. :D

Link to comment
Share on other sites

In includes/modules/boxes/bm_generic.php, find this line:

 

      if (tep_not_null($content)) {

and replace it with:

 

      if (tep_not_null($content) && $_SERVER['HTTPS'] != "on" ) {

Then put your script (without the PHP code) in the module's text box for your language. Thanks for pointing this out. I'll fix it in a future release.

 

Regards

Jim

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

Link to comment
Share on other sites

In includes/modules/boxes/bm_generic.php, find this line:

 

      if (tep_not_null($content)) {

and replace it with:

 

      if (tep_not_null($content) && $_SERVER['HTTPS'] != "on" ) {

Then put your script (without the PHP code) in the module's text box for your language. Thanks for pointing this out. I'll fix it in a future release.

 

Regards

Jim

 

Great thanks, I already got it working outside of the generic box, but this change will allow me to add another whole "Generic Box" and turn it on and off with https correct? I actually had a split between encrypted and non-encrypted content in the same box, so I added the whole code line into the template_bottom.php in an infoboxcontainer div and now it latches on the bottom of the generic box.

 

Thanks for the great add-on!

Link to comment
Share on other sites

This code disables the box on a SSL page. I intend to code a version that will switch to SSL when needed, but that's a lot more complex. This was a quick fix to solve the problem.

 

Regards

Jim

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

Link to comment
Share on other sites

  • 2 weeks later...

I got the same error, I tried the fixes you suggested still had the same error.

 

I double checked it to make sure I uploaded to the right file paths, uninstalled it, re-installed it, double checked again

and still got the same error message so I just uninstalled it. :(

Link to comment
Share on other sites

run into an error after installing module:

 

Fatal error: Cannot redeclare class language in /home1/sgptechc/public_html/discountegauges/includes/classes/language.php on line 16

 

 

here is the code from the language.php file:

 

<?php

/*

$Id$

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

 

browser language detection logic Copyright phpMyAdmin (select_lang.lib.php3 v1.24 04/19/2002)

Copyright Stephane Garin <[email protected]> (detect_language.php v0.1 04/02/2002)

*/

 

class language { (this is line 16)

 

var $languages, $catalog_languages, $browser_languages, $language;

function language($lng = '') {

$this->languages = array('ar' => 'ar([-_][[:alpha:]]{2})?|arabic',

'bg' => 'bg|bulgarian',

'br' => 'pt[-_]br|brazilian portuguese',

'ca' => 'ca|catalan',

'cs' => 'cs|czech',

'da' => 'da|danish',

'de' => 'de([-_][[:alpha:]]{2})?|german',

'el' => 'el|greek',

'en' => 'en([-_][[:alpha:]]{2})?|english',

'es' => 'es([-_][[:alpha:]]{2})?|spanish',

'et' => 'et|estonian',

'fi' => 'fi|finnish',

'fr' => 'fr([-_][[:alpha:]]{2})?|french',

'gl' => 'gl|galician',

'he' => 'he|hebrew',

'hu' => 'hu|hungarian',

'id' => 'id|indonesian',

'it' => 'it|italian',

'ja' => 'ja|japanese',

'ko' => 'ko|korean',

'ka' => 'ka|georgian',

'lt' => 'lt|lithuanian',

'lv' => 'lv|latvian',

'nl' => 'nl([-_][[:alpha:]]{2})?|dutch',

'no' => 'no|norwegian',

'pl' => 'pl|polish',

'pt' => 'pt([-_][[:alpha:]]{2})?|portuguese',

'ro' => 'ro|romanian',

'ru' => 'ru|russian',

'sk' => 'sk|slovak',

'sr' => 'sr|serbian',

'sv' => 'sv|swedish',

'th' => 'th|thai',

'tr' => 'tr|turkish',

'uk' => 'uk|ukrainian',

'tw' => 'zh[-_]tw|chinese traditional',

'zh' => 'zh|chinese simplified');

 

$this->catalog_languages = array();

$languages_query = tep_db_query("select languages_id, name, code, image, directory from " . TABLE_LANGUAGES . " order by sort_order");

while ($languages = tep_db_fetch_array($languages_query)) {

$this->catalog_languages[$languages['code']] = array('id' => $languages['languages_id'],

'name' => $languages['name'],

'image' => $languages['image'],

'directory' => $languages['directory']);

}

 

$this->browser_languages = '';

$this->language = '';

 

$this->set_language($lng);

}

 

function set_language($language) {

if ( (tep_not_null($language)) && (isset($this->catalog_languages[$language])) ) {

$this->language = $this->catalog_languages[$language];

} else {

$this->language = $this->catalog_languages[DEFAULT_LANGUAGE];

}

}

 

function get_browser_language() {

$this->browser_languages = explode(',', getenv('HTTP_ACCEPT_LANGUAGE'));

 

for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) {

reset($this->languages);

while (list($key, $value) = each($this->languages)) {

if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {

$this->language = $this->catalog_languages[$key];

break 2;

}

}

}

}

}

?>

 

the languages module is set to true: sort order doesn't conflict with other boxes. tried downloading the contribution, and re-installing, but get same result. did notice if I close the browser window, wait few minutes, start a new browser, the site comes up with no error. try another site, go back to my site and the error rears it's ugly head!

 

 

any idea on what I have messed-up?

 

Thanks,

 

Timmy C

Link to comment
Share on other sites

In includes/modules/boxes/bm_generic.php, find this line:

 

      if (tep_not_null($content)) {

and replace it with:

 

      if (tep_not_null($content) && $_SERVER['HTTPS'] != "on" ) {

Then put your script (without the PHP code) in the module's text box for your language. Thanks for pointing this out. I'll fix it in a future release.

 

Regards

Jim

Wouldn't it be better to use this:

 

      if (tep_not_null($content) && $request_type != 'SSL' ) {

The other test isn't valid on all servers.

 

If you use the global variable $request_type set in /includes/application_top.php then the contribution will work, provided of course SSL works at all in the shop.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

I've heard of this error before, but I've never been able to duplicate it. Whatever the problem is, it's nothing to do with what the error message says. I would have to try to track it down with whatever debugging tricks I can manage. Without having the error in the code on my server to do this, it's just not happening. Sorry.

 

Regards

Jim

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

Link to comment
Share on other sites

Another blind attempt at a bug fix. Would somebody who is getting the Fatal error: Cannot redeclare class language.... error message please try this and report back whether it works or not. In catalog/includes/application_top.php, find the following code:

 

    include(DIR_WS_CLASSES . 'language.php');

and change it to

 

    include_once(DIR_WS_CLASSES . 'language.php');

Regards

Jim

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...