aliharis2004 Posted February 14, 2004 Share Posted February 14, 2004 Never Mind I was looking at the wrong paramater ... I got it ... thanks Quote Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 18, 2004 Share Posted February 18, 2004 Hi Matt, can you please guide me ... This is in reference to the upload feature 0.7, actually I am trying to display the image thats being uploaded, I am not sure which files are involved that has to be changed and do you think this would require a lot of change in code .... since I am relatively new with PHP so I am not sure .... Â Thanks for your help .... Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted February 19, 2004 Share Posted February 19, 2004 You would make the changes in the .htaccess file in images/upload (to allow images to be viewed), the shopping_cart.php file (to display the image), and possibly includes/application_top.php (you need to save the extension so the browser knows how to display the image).  Make sure that you have the includes/classes/upload.php file set to restrict uploads to image extensions as well. Wouldn't want someone to access a PHP file that they uploaded.  Hth, Matt Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 19, 2004 Share Posted February 19, 2004 (edited) Hi Matt, I added the above line in the shoppingcart.php to view the uploaded image ... $products_name .= '<br><img src="images/uploads/' . $products[$i][$option]['products_options_values_name'] . '" border=0><br>';  this line was added after  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {    reset($products[$i]['attributes']);     while (list($option, $value) = each($products[$i]['attributes'])) {      $products_name .= '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';  but its giving me a box with the broken image ... what am I doing wrong ...  You can view the site at MosaicArtKeepsakes  Thanks  Ali Edited February 19, 2004 by aliharis2004 Quote Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 19, 2004 Share Posted February 19, 2004 Please correct me if I am wrong, in ref. to my earlier message .... is it because since the name of the image is being changed when its uploaded and its looking for the orignal name of the image .. if thats the problem, how can I work around it ..... thanks for your help .... Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted February 19, 2004 Share Posted February 19, 2004 What do the changes in includes/application_top.php look like in your store? You basically need to change the filename to match the attribute value (it is actually looking for "12. image.ext" rather than the original image.ext name). You should be able to set them to match in includes/application_top.php. The only thing that might concern me is the space between 12. and image.ext. Some filesystems can be goofy about spaces.  Hth, Matt Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 19, 2004 Share Posted February 19, 2004 Hi Matt, the application_top.php looks something like this, I didnt make any changes to what u have for the upload feature, what do I need to do to fix the problem ... thanks :  // iii 030813 added: File uploading: save uploaded files with unique file names     $real_ids = $HTTP_POST_VARS['id'];      if ($HTTP_POST_VARS['number_of_uploads'] > 0) {       require(DIR_WS_CLASSES . 'upload.php');       for ($i = 1; $i <= $HTTP_POST_VARS['number_of_uploads']; $i++) {        if (tep_not_null($_FILES['id']['tmp_name'][TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]]) and ($_FILES['id']['tmp_name'][TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]] != 'none')) {         $products_options_file = new upload('id');         $products_options_file->set_destination(DIR_FS_UPLOADS);         if ($products_options_file->parse(TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i])) {          if (tep_session_is_registered('customer_id')) {           tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name) values('" . tep_session_id() . "', '" . $customer_id . "', '" . tep_db_input($products_options_file->filename) . "')");          } else {           tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name) values('" . tep_session_id() . "', '" . tep_db_input($products_options_file->filename) . "')");          }          $insert_id = tep_db_insert_id();          $real_ids[TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;          $products_options_file->set_filename("$insert_id" . $products_options_file->filename);          if (!($products_options_file->save())) {           break 2;          }         } else {          break 2;         }        } else { // No file uploaded -- use previous value         $real_ids[TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]] = $HTTP_POST_VARS[TEXT_PREFIX . UPLOAD_PREFIX . $i];        }       }      }      $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids))+1, $real_ids); // iii 030813 end of changes.     }     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));     break; Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted February 19, 2004 Share Posted February 19, 2004 I would try changing          $products_options_file->set_filename("$insert_id" . $products_options_file->filename); to          $products_options_file->set_filename("$insert_id" . '. ' . $products_options_file->filename); If that doesn't work, try changing both          $real_ids[TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]] = $insert_id . ". " . $products_options_file->filename;          $products_options_file->set_filename("$insert_id" . $products_options_file->filename); to          $real_ids[TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i]] = "$insert_id" . '.' . $products_options_file->filename;          $products_options_file->set_filename("$insert_id" . '.' . $products_options_file->filename); Hth, Matt Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 19, 2004 Share Posted February 19, 2004 Hi Matt, the first change you recommended worked great ... thanks ... so I didint change both ... thanks again .... Quote Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 20, 2004 Share Posted February 20, 2004 (edited) Hi Matt, Right now the image that gets uploaded shows up of the same size as it is ... I was wondering is it possible to specify a certain size of the image e.g. 5x5... I tried changing the following cdfes .. Â $products_name .= '<br><img src="images/uploads/' . $products[$i][$option]['products_options_values_name'] . '" border=0><br>'; Â but it keeps giving Parsing #rror .. Edited February 20, 2004 by aliharis2004 Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted February 20, 2004 Share Posted February 20, 2004 Try $products_name .= '<br>' . tep_image($products[$i][$option]['products_options_values_name'], $products[$i][$option]['products_options_values_name'], 5, 5)  . '<br>'; Hth, Matt Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 21, 2004 Share Posted February 21, 2004 (edited) .. Edited February 21, 2004 by aliharis2004 Quote Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 21, 2004 Share Posted February 21, 2004 Hi Matt, its coming up with broken image, since its looking for the image in the  /catalog/36.%20b3.gif  rather than in  /catalog/images/uploads/36.%20b3.gif  After I changed the code to:  $products_name .= '<br><img src="images/uploads/' . tep_image($products[$i][$option]['products_options_values_name'], $products[$i][$option]['products_options_values_name'], 50, 50) . '"<br>';  the path of the image its showing is :  /catalog/images/uploads/%3Cimg%20src=  What am I doing wrong ? Thanks ....... Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted February 22, 2004 Share Posted February 22, 2004 What am I doing wrong ? Thanks .......Following my instructions apparently... $products_name .= '<br>' . tep_image(DIR_WS_UPLOADS . $products[$i][$option]['products_options_values_name'], $products[$i][$option]['products_options_values_name'], 5, 5)  . '<br>'; I remember thinking that it would need DIR_WS_UPLOADS there, but apparently I forgot to actually write it that way.  Sorry, Matt Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
generate Posted February 23, 2004 Share Posted February 23, 2004 Hi,  I started today installing the Contribution on OSC 2.2MS2 but I have some trouble importing the sql-file 'option_type_feature.sql' via PHPMyAdmin. While importing this line  INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( 169, 'Product option type Select', 'PRODUCTS_OPTIONS_TYPE_SELECT', '0', 'The number representing the Select type of product option.', 0, NULL , now( ) , now( ) , NULL , NULL )  and the follwing two lines I'm getting the error  "Duplicate entry '169' for key 1"  I don't know what to do to solve the problem, anyone knows a solution?  Thanks a lot for help, Karsten Quote Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 24, 2004 Share Posted February 24, 2004 Works great Matt ... thanks a lot ... It looks nice ... Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted February 24, 2004 Share Posted February 24, 2004 Karsten,  Try INSERT INTO `configuration` ( `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( 'Product option type Select', 'PRODUCTS_OPTIONS_TYPE_SELECT', '0', 'The number representing the Select type of product option.', 0, NULL , now( ) , now( ) , NULL , NULL ) instead. also remove 'configuration_id' and the associated number in VALUES for the other lines as well.  Hth, Matt Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 24, 2004 Share Posted February 24, 2004 Hi Matt, I was wondering is it possible to limit the size of the image that could be uploaded, since I dont want people uploading files bigger than 5 MB .... Â THanks Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted February 24, 2004 Share Posted February 24, 2004 There is a max file size setting for PHP. The actual name is posted earlier in this thread.  Hth, Matt Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
aliharis2004 Posted February 24, 2004 Share Posted February 24, 2004 Got it ... thanks .... actually you had the codes in the upload.php, it was just commented out ... thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted March 25, 2004 Share Posted March 25, 2004 Dear Matt, Â First of all, thank you so much for this great contribution ! Â I've installed the latest version and it works great, but I've encountered a strange thing: Â When I press the 'Add to cart' button and the file is being uploaded, just after it has been uploaded I get a 'Cannot find server' error, and the url in the browser is: 'http://just4u.co.il/product_info.php?products_id=29&action=add_product&osCsid=65437da70fbe0eb77b17eebb9d39c1c7'. However, when I press reload, I can see the 'product_info.php' page properly and I can continue the checkout process. Â This problem happens most of the times, though not all the times. I remember 3 or 4 times that it went flawlessly. Â Just to mention that I'm behind a NAPT router, I don't know if it has something to do with it, but who knows.. Â Your help will be really appreciated. If you are trying to access my site, please use test:test ad user:pass. Â Thanks in advance for your help.. Â Best Wishes, Eyal Moshe Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted March 25, 2004 Share Posted March 25, 2004 Eyal,  I tried three different times and it worked for me every time. Have you tried any other browsers or internet connections? Not sure what would cause that.  Hth, Matt Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
Guest Posted March 25, 2004 Share Posted March 25, 2004 Matt, Â I'll try it from other internet connections and I'll see. If none of the contribution's users has encountered this problem, I guess it has to do something with my provider. Â Thanks, Eyal Quote Link to comment Share on other sites More sharing options...
♥ecartz Posted April 6, 2004 Share Posted April 6, 2004 i like to have the filesize-check as a part of the upload-class. so if a user wants to uplaod a too big file a messages_stack "error: file too big" occurs..In product_info.php     <td class="main"><input type="file" name="id[<?php echo TEXT_PREFIX . $products_options_name['products_options_id']; ?>]"><br><?php echo $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . tep_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']) . tep_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']]); ?></td> change to     <td class="main">      <?php echo if ($number_of_uploads == 1) tep_draw_hidden_field('MAX_FILE_SIZE', UPLOAD_MAX_FILE_SIZE); ?>      <input type="file" name="id[<?php echo TEXT_PREFIX . $products_options_name['products_options_id']; ?>]"><br>      <?php echo $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .          tep_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']) .          tep_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']]); ?>     </td> You still won't get the message stack error, but it should give an error prior to upload.  Hth, Matt Quote Always back up before making changes. Link to comment Share on other sites More sharing options...
Guest Posted April 12, 2004 Share Posted April 12, 2004 Hi All, Â Although not directly related to this contribution, I was just curious if someone has resolved the 32 bytes limit of the products_text attribute option. I would like to have a text box and get from my customers much longer texts (300-400 bytes) so if someone has already done that, I'll be happy to hear how.. Â Thanks in advance, Eyal Moshe Quote Link to comment Share on other sites More sharing options...
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.