Latest News: (loading..)
kymation

[Addon] Generic Box

273 posts in this topic

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

Mastermind2008 likes this

Share this post


Link to post
Share on other sites

That doesn't work. And only on the first categories page does my top sellers work, how can i make it show on other category pages?

 

Thanks so much!

Edited by Mastermind2008

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

To follow up on my previous postings.

 

Worked ok on development server, now running live, installed without issue.

 

Great addon. Thanks Jim.

 

 

Russ

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

This is a really good addon - what I've been looking for.

 

One prob tho (sorry)

The title on my box is: MODULE_BOXES_GENERIC_BOX_TITLE

 

and I can't see why.

 

help pleaseeeee...

Thanks

 

A

Share this post


Link to post
Share on other sites

That was a bug in older versions of this Addon. Uninstall your box and upload version 1.0.2.

 

Regards

Jim

Share this post


Link to post
Share on other sites

That was a bug in older versions of this Addon. Uninstall your box and upload version 1.0.2.

 

 

SPOT ON JIM - Thanks very much - very useful

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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. :(

Share this post


Link to post
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 <sgarin@sgarin.com> (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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Worked GREAT and the 1st time for me, no issues.

 

Another question however, is it possible to have more than 1 generic box?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now