Ronny Posted March 15, 2007 Posted March 15, 2007 Hello. I just installed the Super Download Shop contrib. Two problems so far: 1) I get the following message when trying to access product attributes in my admin panel: Parse error: syntax error, unexpected T_CASE in /hsphere/local/home/webtask/eterya.com/admin/products_attributes.php on line 90 Here´s the modification from line 90: // BOF Super Download Shop v1.0 mod case 'add_filegroups': $filegroup_id = tep_db_prepare_input($HTTP_POST_VARS['filegroup_id']); $file_group_array = $HTTP_POST_VARS['file_group_name']; // check if any name given $name_check = 0; for ($i=0, $n=sizeof($languages); $i<$n; $i ++) { if (!empty($file_group_array[$languages[$i]['id']])) $name_check = 1; } if (is_numeric($filegroup_id) && $name_check == 1) { for ($i=0, $n=sizeof($languages); $i<$n; $i ++) { $file_group_name = tep_db_prepare_input($file_group_array[$languages[$i]['id']]); tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS . " (download_group_id, download_group_name, language_id) values ('" . (int)$filegroup_id . "', '" . tep_db_input($file_group_name) . "', '" . (int)$languages[$i]['id'] . "')"); } } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'add_group_file': $filegroup_id = tep_db_prepare_input($HTTP_POST_VARS['filegroup_id']); $file_desc_array = $HTTP_POST_VARS['file_desc']; $file_name = ''; if (isset($HTTP_POST_VARS['input_filename']) && !empty($HTTP_POST_VARS['input_filename'])) { $file_name = tep_db_prepare_input($HTTP_POST_VARS['input_filename']); } if (tep_not_null($file_name) && file_exists(DIR_FS_CATALOG_DOWNLOAD . $file_name)) { // check existing file and descriptions $file_query = tep_db_query("select download_groups_file_id from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_filename = '" . $file_name . "'"); if (tep_db_num_rows($file_query) > 0) { $file_array = tep_db_fetch_array($file_query); tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " (download_groups_file_id, download_group_id, download_group_filename) values ('" . (int)$file_array['download_groups_file_id'] . "', '" . (int)$filegroup_id . "', '" . tep_db_input($file_name) . "')"); } else { tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " (download_group_id, download_group_filename) values ('" . (int)$filegroup_id . "', '" . tep_db_input($file_name) . "')"); $download_groups_file_id = tep_db_insert_id(); for ($i=0, $n=sizeof($languages); $i<$n; $i ++) { $file_desc = tep_db_prepare_input($file_desc_array[$languages[$i]['id']]); if (empty($file_desc)) $file_desc = tep_db_prepare_input(TEXT_TEMP_DESC . ' ' . $download_groups_file_id); tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " (download_groups_file_id, language_id, download_group_file_description) values ('" . (int)$download_groups_file_id . "', '" . (int)$languages[$i]['id'] . "', '" . tep_db_input($file_desc) . "')"); } } } else { if (!tep_not_null($file_name)) $messageStack->add(ERROR_NO_FILENAME, 'error'); else $messageStack->add(sprintf(ERROR_FILE_DOES_NOT_EXIST, $file_name), 'error'); } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'add_mass_files': $filegroup_id = tep_db_prepare_input($HTTP_POST_VARS['filegroup_id']); $file_selected = $HTTP_POST_VARS['file_selected']; foreach($file_selected as $k => $file_name) { if (tep_not_null($file_name)) { $file_name = tep_db_prepare_input($file_name); // check if file already in group $file_check_query = tep_db_query("select * from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_id = '" . (int)$filegroup_id . "' and download_group_filename = '" . $file_name . "'"); if (tep_db_num_rows($file_check_query) == 0) { // check existing file and descriptions $file_query = tep_db_query("select download_groups_file_id from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_filename = '" . $file_name . "'"); if (tep_db_num_rows($file_query) > 0) { $file_array = tep_db_fetch_array($file_query); tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " (download_groups_file_id, download_group_id, download_group_filename) values ('" . (int)$file_array['download_groups_file_id'] . "', '" . (int)$filegroup_id . "', '" . tep_db_input($file_name) . "')"); } else { tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " (download_group_id, download_group_filename) values ('" . (int)$filegroup_id . "', '" . tep_db_input($file_name) . "')"); $download_groups_file_id = tep_db_insert_id(); for ($i=0, $n=sizeof($languages); $i<$n; $i ++) { $file_desc = tep_db_prepare_input(TEXT_TEMP_DESC . ' ' . $download_groups_file_id); tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " (download_groups_file_id, language_id, download_group_file_description) values ('" . (int)$download_groups_file_id . "', '" . (int)$languages[$i]['id'] . "', '" . tep_db_input($file_desc) . "')"); } } } } } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'update_filegroup_name': $file_group_name_array = $HTTP_POST_VARS['file_group_name']; $filegroup_id = tep_db_prepare_input($HTTP_POST_VARS['filegroup_id']); for ($i=0, $n=sizeof($languages); $i<$n; $i ++) { $file_group_name = tep_db_prepare_input($file_group_name_array[$languages[$i]['id']]); tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS . " set download_group_name = '" . tep_db_input($file_group_name) . "' where download_group_id = '" . (int)$filegroup_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'"); } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'update_file_desc': $file_desc_array = $HTTP_POST_VARS['file_desc']; $file_id = tep_db_prepare_input($HTTP_POST_VARS['file_id']); for ($i=0, $n=sizeof($languages); $i<$n; $i ++) { $file_desc = tep_db_prepare_input($file_desc_array[$languages[$i]['id']]); tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " set download_group_file_description = '" . tep_db_input($file_desc) . "' where download_groups_file_id = '" . (int)$file_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'"); } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'delete_download_group': $filegroup_id = tep_db_prepare_input($HTTP_GET_VARS['filegroup_id']); tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS . " where download_group_id = '" . (int)$filegroup_id . "'"); // check files in other group $files_query = tep_db_query("select download_groups_file_id from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_id = '" . (int)$filegroup_id . "'"); while ($file_array = tep_db_fetch_array($files_query)) { $file_check = tep_db_query("select download_groups_file_id from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_id != '" . (int)$filegroup_id . "' and download_groups_file_id = '" . $file_array['download_groups_file_id'] . "'"); if (tep_db_num_rows($file_check) === 0) { tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " where download_groups_file_id = '" . $file_array['download_groups_file_id'] . "'"); } } tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_id = '" . (int)$filegroup_id . "'"); tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'delete_file_from_group': $filegroup_id = tep_db_prepare_input($HTTP_GET_VARS['filegroup_id']); $file_id = tep_db_prepare_input($HTTP_GET_VARS['group_file_id']); tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_id = '" . (int)$filegroup_id . "' and download_groups_file_id = '" . (int)$file_id . "'"); // check files in other group $file_check = tep_db_query("select download_groups_file_id from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_id != '" . (int)$filegroup_id . "' and download_groups_file_id = '" . (int)$file_id . "'"); if (tep_db_num_rows($file_check) === 0) { tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " where download_groups_file_id = '" . (int)$file_id . "'"); } tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; case 'delete_file_all_groups': $file_id = tep_db_prepare_input($HTTP_GET_VARS['group_file_id']); tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_groups_file_id = '" . (int)$file_id . "'"); tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " where download_groups_file_id = '" . (int)$file_id . "'"); tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info)); break; // EOF Super Download Shop v1.0 mod 2) I´m supposed to access catalog/admin/filegroup_db_setup.php to create the initial file group entry in my database for each language. When doing so this file opens: /admin/forbiden.php Anyone who can help me? PS: My site is in the root folder and not catalog. Quote May life be good to you... Sincerely, Ronny
AlexStudio Posted March 16, 2007 Posted March 16, 2007 First of all, please install Super Download Shop v1.1. You're using v1.0. 2nd, the code you posted here didn't show the actual problem. Line 90 of the admin/products_attributes.php in both v1.0 and v1.1 packages is: break; Most likely there is something wrong prior to line 90. 3rd, since your osCommerce is under your http root, all paths stated in the install guide which started with catalog/ should be treated as your http root. The file filegroup_db_setup.php should be installed in your /admin/ folder, and you need to run that script by http://yourdomain.com/admin/filegroup_db_setup.php 4th, you posted the full path of your admin folder without .htacess protecting it. Please password protect your admin folder immediately!! Quote Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.
Ronny Posted March 16, 2007 Author Posted March 16, 2007 Thanks for your reply. I will install the version 1.1. Do I nead to run the SQL files again or are these unchanged? All the files are uploaded to their respective folders. I treat the root as catalog. The problem here is if the files contain paths in the code with the catalog included. Is this the case. My admin is password protected with an alternativ login contrib. By the way: I managed to get the"Downloads Controller Update Status Value" , "Downloads Controller Download on hold message" and "Downloads Controller Order Status Value" to show twice in the Configuration/Download in admin panel. Any idea how to remove one of them? Quote May life be good to you... Sincerely, Ronny
AlexStudio Posted March 16, 2007 Posted March 16, 2007 Normally you don't need to run the sql scripts when upgrading from v1.0 to v1.1. However, you have duplicated configuration keys in admin pannel, which means that you have run the sql scripts twice, probably by accident. To remove the duplicated configuration keys, you need to manually remove them by seaching in you databse configuration table. Quote Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.
Ronny Posted March 17, 2007 Author Posted March 17, 2007 Thank you. I installed the 1.1 version and it works great :thumbsup: However, is there a simple way to change the language of the message telling the costumer that download is not available? I´d like it to show in english and norwegian. Quote May life be good to you... Sincerely, Ronny
AlexStudio Posted March 17, 2007 Posted March 17, 2007 The Downloads Controller Download On Hold Message defined in admin is currently not multi-language supported. If you want to show it in different languages, you need to define a new constant such as DOWNLOAD_ON_HOLD_MESSAGE in each language file i.e. includes/languages/english.php, then modify includes/modules/downloads.php and replace the DOWNLOADS_CONTROLLER_ON_HOLD_MSG with the new one. Quote Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.
Ronny Posted March 18, 2007 Author Posted March 18, 2007 Ok. I´ll try that. Thanks. Quote May life be good to you... Sincerely, Ronny
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.