Jump to content
kymation

[Addon] Generic Box

Recommended Posts

That's not enough information for me to help you. Did you read and follow the instructions?

 

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

yes, and i do not know what i am doing wrong? what info do you need? this is what i am trying to use. <!-- GeoTrust QuickSSL [tm] Smart Icon tag. Do not edit. -->

<SCRIPT LANGUAGE=\\\\\\"Javascript\\\\\\" TYPE=\\\\\\"text/javascript\\\\\\"

SRC=\\\\\\"//smarticon.geotrust.com/si.js\\\\\\"></SCRIPT>

<!-- end GeoTrust Smart Icon tag -->

Share this post


Link to post
Share on other sites

That should work. Check that you have the Sort Order set and it is not the same as another box.

 

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

Enable Generic Module

Do you want to add the module to your shop?

 

True

 

 

Sort Order

1000

 

 

Title Link

index.php

 

 

Content Link

index.php

 

Content Placement

Should the module be loaded in the left or right column?

 

Left Column

 

 

Content Alignment

center

 

 

English Title

 

 

English Contents

<!-- GeoTrust QuickSSL [tm] Smart Icon tag. Do not edit. --><SCRIPT LANGUAGE=\\\\\\\"Javascript\\\\\\\" TYPE=\\\\\\\"text/javascript\\\\\\\" SRC=\\\\\\\"//smarticon.geotrust.com/si.js\\\\\\\"></SCRIPT><!-- end GeoTrust Smart Icon tag -->

Cancel

Edited by deiana38

Share this post


Link to post
Share on other sites

<?php

/*

$Id$: modules.php $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2010 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

$set = (isset($HTTP_GET_VARS['set']) ? $HTTP_GET_VARS['set'] : '');

 

$modules = $cfgModules->getAll();

 

if (empty($set) || !$cfgModules->exists($set)) {

$set = $modules[0]['code'];

}

 

$module_type = $cfgModules->get($set, 'code');

$module_directory = $cfgModules->get($set, 'directory');

$module_language_directory = $cfgModules->get($set, 'language_directory');

$module_key = $cfgModules->get($set, 'key');;

define('HEADING_TITLE', $cfgModules->get($set, 'title'));

$template_integration = $cfgModules->get($set, 'template_integration');

 

$action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 

if (tep_not_null($action)) {

switch ($action) {

case 'save':

reset($HTTP_POST_VARS['configuration']);

while (list($key, $value) = each($HTTP_POST_VARS['configuration'])){

// Generic Box

tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . addslashes( addslashes( $value ) ) . "' where configuration_key = '" . $key . "'");}

{

// USPS START

if( is_array( $value ) ) $value = implode( ', ', $value);

// USPS END

tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'");

}

tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module']));

break;

case 'install':

case 'remove':

$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));

$class = basename($HTTP_GET_VARS['module']);

if (file_exists($module_directory . $class . $file_extension)) {

include($module_directory . $class . $file_extension);

$module = new $class;

if ($action == 'install') {

$module->install();

 

$modules_installed = explode(';', constant($module_key));

$modules_installed[] = $class . $file_extension;

tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . implode(';', $modules_installed) . "' where configuration_key = '" . $module_key . "'");

tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class));

} elseif ($action == 'remove') {

$module->remove();

 

$modules_installed = explode(';', constant($module_key));

unset($modules_installed[array_search($class . $file_extension, $modules_installed)]);

tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . implode(';', $modules_installed) . "' where configuration_key = '" . $module_key . "'");

tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set));

}

}

tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class));

break;

}

}

 

require(DIR_WS_INCLUDES . 'template_top.php');

 

$modules_installed = (defined($module_key) ? explode(';', constant($module_key)) : array());

$new_modules_counter = 0;

 

$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));

$directory_array = array();

if ($dir = @@dir($module_directory)) {

while ($file = $dir->read()) {

if (!is_dir($module_directory . $file)) {

if (substr($file, strrpos($file, '.')) == $file_extension) {

if (isset($HTTP_GET_VARS['list']) && ($HTTP_GET_VARS['list'] = 'new')) {

if (!in_array($file, $modules_installed)) {

$directory_array[] = $file;

}

} else {

if (in_array($file, $modules_installed)) {

$directory_array[] = $file;

} else {

$new_modules_counter++;

}

}

}

}

}

sort($directory_array);

$dir->close();

}

?>

 

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

<?php

if (isset($HTTP_GET_VARS['list'])) {

echo ' <td class="smallText" align="right">' . tep_draw_button(IMAGE_BACK, 'triangle-1-w', tep_href_link(FILENAME_MODULES, 'set=' . $set)) . '</td>';

} else {

echo ' <td class="smallText" align="right">' . tep_draw_button(IMAGE_MODULE_INSTALL . ' (' . $new_modules_counter . ')', 'plus', tep_href_link(FILENAME_MODULES, 'set=' . $set . '&list=new')) . '</td>';

}

?>

</tr>

</table></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_MODULES; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_SORT_ORDER; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>

</tr>

<?php

$installed_modules = array();

for ($i=0, $n=sizeof($directory_array); $i<$n; $i++) {

$file = $directory_array[$i];

 

include($module_language_directory . $language . '/modules/' . $module_type . '/' . $file);

include($module_directory . $file);

 

$class = substr($file, 0, strrpos($file, '.'));

if (tep_class_exists($class)) {

$module = new $class;

if ($module->check() > 0) {

if (($module->sort_order > 0) && !isset($installed_modules[$module->sort_order])) {

$installed_modules[$module->sort_order] = $file;

} else {

$installed_modules[] = $file;

}

}

 

if ((!isset($HTTP_GET_VARS['module']) || (isset($HTTP_GET_VARS['module']) && ($HTTP_GET_VARS['module'] == $class))) && !isset($mInfo)) {

$module_info = array('code' => $module->code,

'title' => $module->title,

'description' => $module->description,

'status' => $module->check(),

'signature' => (isset($module->signature) ? $module->signature : null),

'api_version' => (isset($module->api_version) ? $module->api_version : null));

 

$module_keys = $module->keys();

 

$keys_extra = array();

for ($j=0, $k=sizeof($module_keys); $j<$k; $j++) {

$key_value_query = tep_db_query("select configuration_title, configuration_value, configuration_description, use_function, set_function from " . TABLE_CONFIGURATION . " where configuration_key = '" . $module_keys[$j] . "'");

$key_value = tep_db_fetch_array($key_value_query);

 

$keys_extra[$module_keys[$j]]['title'] = $key_value['configuration_title'];

$keys_extra[$module_keys[$j]]['value'] = $key_value['configuration_value'];

$keys_extra[$module_keys[$j]]['description'] = $key_value['configuration_description'];

$keys_extra[$module_keys[$j]]['use_function'] = $key_value['use_function'];

$keys_extra[$module_keys[$j]]['set_function'] = $key_value['set_function'];

}

 

$module_info['keys'] = $keys_extra;

 

$mInfo = new objectInfo($module_info);

}

 

if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) {

if ($module->check() > 0) {

echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class . '&action=edit') . '\'">' . "\n";

} else {

echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">' . "\n";

}

} else {

echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_MODULES, 'set=' . $set . (isset($HTTP_GET_VARS['list']) ? '&list=new' : '') . '&module=' . $class) . '\'">' . "\n";

}

?>

<td class="dataTableContent"><?php echo $module->title; ?></td>

<td class="dataTableContent" align="right"><?php if (is_numeric($module->sort_order)) echo $module->sort_order; ?></td>

<td class="dataTableContent" align="right"><?php if (isset($mInfo) && is_object($mInfo) && ($class == $mInfo->code) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . tep_href_link(FILENAME_MODULES, 'set=' . $set . (isset($HTTP_GET_VARS['list']) ? '&list=new' : '') . '&module=' . $class) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td>

</tr>

<?php

}

}

 

if (!isset($HTTP_GET_VARS['list'])) {

ksort($installed_modules);

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = '" . $module_key . "'");

if (tep_db_num_rows($check_query)) {

$check = tep_db_fetch_array($check_query);

if ($check['configuration_value'] != implode(';', $installed_modules)) {

tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . implode(';', $installed_modules) . "', last_modified = now() where configuration_key = '" . $module_key . "'");

}

} else {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Installed Modules', '" . $module_key . "', '" . implode(';', $installed_modules) . "', 'This is automatically updated. No need to edit.', '6', '0', now())");

}

 

if ($template_integration == true) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'TEMPLATE_BLOCK_GROUPS'");

if (tep_db_num_rows($check_query)) {

$check = tep_db_fetch_array($check_query);

$tbgroups_array = explode(';', $check['configuration_value']);

if (!in_array($module_type, $tbgroups_array)) {

$tbgroups_array[] = $module_type;

sort($tbgroups_array);

tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . implode(';', $tbgroups_array) . "', last_modified = now() where configuration_key = 'TEMPLATE_BLOCK_GROUPS'");

}

} else {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Installed Template Block Groups', 'TEMPLATE_BLOCK_GROUPS', '" . $module_type . "', 'This is automatically updated. No need to edit.', '6', '0', now())");

}

}

}

?>

<tr>

<td colspan="3" class="smallText"><?php echo TEXT_MODULE_DIRECTORY . ' ' . $module_directory; ?></td>

</tr>

</table></td>

<?php

$heading = array();

$contents = array();

 

switch ($action) {

case 'edit':

$keys = '';

reset($mInfo->keys);

while (list($key, $value) = each($mInfo->keys)) {

$keys .= '<strong>' . $value['title'] . '</strong><br />' . $value['description'] . '<br />';

 

if ($value['set_function']) {

eval('$keys .= ' . $value['set_function'] . "'" . $value['value'] . "', '" . $key . "');");

} else {

$keys .= tep_draw_input_field('configuration[' . $key . ']', $value['value']);

}

$keys .= '<br /><br />';

}

$keys = substr($keys, 0, strrpos($keys, '<br /><br />'));

 

$heading[] = array('text' => '<strong>' . $mInfo->title . '</strong>');

 

$contents = array('form' => tep_draw_form('modules', FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module'] . '&action=save'));

$contents[] = array('text' => $keys);

$contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module'])));

break;

default:

$heading[] = array('text' => '<strong>' . $mInfo->title . '</strong>');

 

if ($mInfo->status == '1') {

$keys = '';

reset($mInfo->keys);

while (list(, $value) = each($mInfo->keys)) {

$keys .= '<strong>' . $value['title'] . '</strong><br />';

if ($value['use_function']) {

$use_function = $value['use_function'];

if (preg_match('/->/', $use_function)) {

$class_method = explode('->', $use_function);

if (!isset(${$class_method[0]}) || !is_object(${$class_method[0]})) {

include(DIR_WS_CLASSES . $class_method[0] . '.php');

${$class_method[0]} = new $class_method[0]();

}

$keys .= tep_call_function($class_method[1], $value['value'], ${$class_method[0]});

} else {

$keys .= tep_call_function($use_function, $value['value']);

}

} else {

$keys .= $value['value'];

}

$keys .= '<br /><br />';

}

$keys = substr($keys, 0, strrpos($keys, '<br /><br />'));

 

$contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_EDIT, 'document', tep_href_link(FILENAME_MODULES, 'set=' . $set . (isset($HTTP_GET_VARS['module']) ? '&module=' . $HTTP_GET_VARS['module'] : '') . '&action=edit')) . tep_draw_button(IMAGE_MODULE_REMOVE, 'minus', tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $mInfo->code . '&action=remove')));

 

if (isset($mInfo->signature) && (list($scode, $smodule, $sversion, $soscversion) = explode('|', $mInfo->signature))) {

$contents[] = array('text' => '<br />' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ' <strong>' . TEXT_INFO_VERSION . '</strong> ' . $sversion . ' (<a href="http://sig.oscommerce.com/' . $mInfo->signature . '" target="_blank">' . TEXT_INFO_ONLINE_STATUS . '</a>)');

}

 

if (isset($mInfo->api_version)) {

$contents[] = array('text' => tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ' <strong>' . TEXT_INFO_API_VERSION . '</strong> ' . $mInfo->api_version);

}

 

$contents[] = array('text' => '<br />' . $mInfo->description);

// USPS START

// $contents[] = array('text' => '<br />' . $keys);

$contents[] = array('text' => '<br />' . preg_replace(array('/RM/', '/TM/', '/International/', '/Envelope/'), array('®', '™', 'Int\'l', 'Env'), $keys));

// USPS END

} elseif (isset($HTTP_GET_VARS['list']) && ($HTTP_GET_VARS['list'] == 'new')) {

if (isset($mInfo)) {

$contents[] = array('align' => 'center', 'text' => tep_draw_button(IMAGE_MODULE_INSTALL, 'plus', tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $mInfo->code . '&action=install')));

 

if (isset($mInfo->signature) && (list($scode, $smodule, $sversion, $soscversion) = explode('|', $mInfo->signature))) {

$contents[] = array('text' => '<br />' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ' <strong>' . TEXT_INFO_VERSION . '</strong> ' . $sversion . ' (<a href="http://sig.oscommerce.com/' . $mInfo->signature . '" target="_blank">' . TEXT_INFO_ONLINE_STATUS . '</a>)');

}

 

if (isset($mInfo->api_version)) {

$contents[] = array('text' => tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ' <strong>' . TEXT_INFO_API_VERSION . '</strong> ' . $mInfo->api_version);

}

 

$contents[] = array('text' => '<br />' . $mInfo->description);

}

}

break;

}

 

if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {

echo ' <td width="25%" valign="top">' . "\n";

 

$box = new box;

echo $box->infoBox($heading, $contents);

 

echo ' </td>' . "\n";

}

?>

</tr>

</table></td>

</tr>

</table>

 

<?php

require(DIR_WS_INCLUDES . 'template_bottom.php');

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

Share this post


Link to post
Share on other sites

Just what I've already said.

 

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

I am a complte newbie and I was just about to try and add the generic box so I can add images to the left hand side of my page.

Opened the instruction doc and go this far

 

1.2 Software Compatibility

This software package was developed using osCommerce Version 2.3.1.

 

Do not attempt to

use this box with osCommerce 2.2x or 3.0x. It will not work

 

My Installed Version: osCommerce Online Merchant v2.3.3

 

Is this why people are having so many problems and is there an idiots guide to adding image boxes to me version ?

A lot of pages for this add on isn't there.

Cheers in advace

 

.

Share this post


Link to post
Share on other sites

This box will work just fine with all of the 2.3.x versions of osCommerce. Most of the problems people are having are caused by not reading the instructions.

 

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

Thanks Jim, I guess I had better read it properly :)

Lets see what happens ?

Share this post


Link to post
Share on other sites

i have read the read me file and so far I guess it is just a case of copy, paste and replace. It is the modified files I do not understand.

 

2.2.2 Modify Files

 

There is one file with changes needed to install this module. You can upload this file and

overwrite the existing file if you have not made any changes to it previously. If you have made

changes and need to patch your file, there is only one line to replace. The changed line is

marked with a comment: // Generic Box. I suggest using a comparison program to make

changes like this easier.

 

What file and replace with what ?

Could not find another file

 

 

2.2.3 Modified files

catalog/admin/modules.php (Replace with Line 38 in the included file)

 

Sorry I do not understand this one either. Do I open this file and find line 38 and paste in line 38 from the includes.php to replace it ?

 

Cheers again

Share this post


Link to post
Share on other sites

That's all one modification. You can just use the included copy of catalog/admin/modules.php if you haven't made any changes to yours. If you have made changes, the change introduced here is on Line 38 of an unmodified copy. Use your comparison program to check the differences between your file and the one in this distribution.

 

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

Thanks Kymation,

so do I just copy and paste all the files in the relevant directories and that is it.

My site is new and I have not modified it yet as I am so scared to cause a problem somewhere else.

I have backed up the site on a different storage device.

Sorry for the extra questions.

Share this post


Link to post
Share on other sites
2.2.1 Add New Files

Upload the files listed under New Files below to your store, keeping the directory structure the

same as the installed copy of your store.

2.2.2 Modify Files

There is one file with changes needed to install this module. You can upload this file and

overwrite the existing file if you have not made any changes to it previously.

 

I don't know how to make it any clearer than this.

 

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

Well just copied and pasted the 3 files in the relevent directories and you will never guess what...?

Why was I panicking so much, thanks to Jim and Kymation for your help.

Just keep an eye on the directories and follow them carefully !

Share this post


Link to post
Share on other sites

Sorry Guys.

I have renamed all 3 files with an added 2 and I have looked for the next step..

 

4. Change Enable Generic Module to Enable Generic Module 2 on Line 98 of the code file.

but I cannot find the file I am looking for in the modules file in the addon admin folder.

Cheers and be nice

Share this post


Link to post
Share on other sites

There is only one file in the Admin area, and you already modified that when you installed the original module. The only files you need to duplicate are the two files on the catalog side.

 

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

I renamed them bm_generic_2 as you suggested and copied the 2 files.

It says install module1 on my dashboard. When I click install there is nothing to install ?

Sorry for being a pain.

Des

Share this post


Link to post
Share on other sites

That means you did something wrong. I can't tell from here what that would be. I suggest that you go through the instructions again and check your work.

 

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

Checked everything and i did not change the code to the renamed file using the editor.

Although it says 2 modules to install , when I go to install the new modules it comes up with the 1st generic box in the list

Do I not have to add a admin file per new box, or how does it know that there are other boxes installed with new names ?

Cheers

Edited by roobear

Share this post


Link to post
Share on other sites

The admin installer looks for files in the catalog/includes/modules/boxes/ directory. If your new file is there it will list it and let you install it. This will fail if there are errors in that file.

 

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

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

×