Results 1 to 10 of 31

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Posts
    6
    Plugin Contributions
    0

    Re: Attribute File Upload

    Okay, I found a modification on the OcCommerce forums to add a link to view the file/image from the edit order function in admin

    http://forums.oscommerce.com/lofiver...p/t202695.html

    I've gotten to the point where it doesn't throw any errors, but it still doesn't display a link either.

    I added this this a file under admin/includes/extra_configures
    define('DIR_WS_CATALOG_IMAGES_UPLOADS', DIR_WS_CATALOG_IMAGES .

    'uploads/');
    define('DIR_FS_CATALOG_IMAGES_UPLOADS', DIR_FS_CATALOG_IMAGES .

    'uploads/');

    I added this to a file under admin/includes/extra_datafiles/
    define('TABLE_PRODUCTS_OPTIONS_TYPES', 'products_options_types');

    Then in the orders.php, I tried to convert it to Zencart format from instructions I found online, but I must be missing something. This is what I have

    if (isset($order->products[$i]['attributes']) && (sizeof($order->products[$i]['attributes']) > 0)) {

    for ($j = 0, $k = sizeof($order->products[$i]['attributes']); $j < $k; $j++) {

    // Customization #31101 for file_upload view begin
    $option = $order->products[$i]['attributes'][$j]['option'];
    ## Build a query to check if this option is of 'File' Type
    $file_check_sql = " select count(*) from ".TABLE_PRODUCTS_OPTIONS ." o,

    ".TABLE_PRODUCTS_OPTIONS_TYPES." ot WHERE o.products_options_type = ot.products_options_types_id AND products_options_types_name='File' AND o.products_options_name='".$option."'";

    $file_check_sql = $db->Execute($file_check_sql);
    $isFile = $file_check_sql->RecordCount();

    if($isFile == 1 &&

    @file_exists(DIR_FS_CATALOG_IMAGES_UPLOADS.$order->products[$i]['attributes'][$j]['value'])){
    $link = "<a href=". DIR_WS_CATALOG_IMAGES_UPLOADS.$order->products[$i]['attributes'][$j]['value']." target='_blank'><i>Click to View</i></a>";
    }else {
    $link = "";

    }

    echo '<br /><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);

    if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';

    if ($order->products[$i]['attributes'][$j]['product_attribute_is_free'] == '1' and $order->products[$i]['product_is_free'] == '1') echo TEXT_INFO_ATTRIBUTE_FREE;

    echo '&nbsp;'. $link.' </i></small></nobr>';
    // Customization #31101 end

    Should this be in another directory, like extra_functions rather than in the orders file? Can anyone tell why the link isn't displaying?

  2. #2
    Join Date
    Feb 2006
    Posts
    21
    Plugin Contributions
    0

    Re: Attribute File Upload

    Can any Zen superstars help on this??

    I'm certain it would be very helpful

  3. #3
    Join Date
    Feb 2005
    Posts
    283
    Plugin Contributions
    0

    Default Re: Attribute File Upload

    This is probably really bad practice (but desperate mesures were needed)- but my client required access to ftp'd up images files so I simply removed the htaccess file from the uploads folder - now they simply type the site address http://www.siteaddress.co.uk/images/...s/filename.jpg

    with the filename being specified on the customer order and they can then just get the image from the browser.

    I would not recommned doing this with any sort of senstive/private information.

  4. #4
    Join Date
    Sep 2006
    Location
    Gillette, NJ, USA
    Posts
    35
    Plugin Contributions
    0

    Default Re: Attribute File Upload

    Continuing on the bad practice described above - I have changed the .htaccess file to allow access to the uploaded images from IP address of the store owner - and created a link on the edit order page to view the file. To do this on your site:
    (using 1.3.5)
    change line 401 of admin/orders.php FROM:
    Code:
              echo '<br /><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);
    TO:
    Code:
    //          echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);
    		echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ';
    		if ($order->products[$i]['attributes'][$j]['option'] == "Logo 1" || $order->products[$i]['attributes'][$j]['option'] == "Logo 2" || $order->products[$i]['attributes'][$j]['option'] == "Logo 3" || $order->products[$i]['attributes'][$j]['option'] == "Logo 4" || $order->products[$i]['attributes'][$j]['option'] == "Logo 5") {
    		$full_logo_name  = $order->products[$i]['attributes'][$j]['value'];
    $pieces = explode(".", $full_logo_name);
    		echo nl2br($order->products[$i]['attributes'][$j]['value']) . ' <a href="/images/uploads/' . $pieces[0] . '.' . $pieces[2] . '" target="_blank">View ' . $pieces[0] . '.' . $pieces[2] . '</a>';
    		} else {
    		echo nl2br($order->products[$i]['attributes'][$j]['value']);
    		}
    Which results in something like this:
    Logo 1: 4. joomla_logo_black.jpg View 4.jpg

    The above only works because the Option Name for uploaded images is "Logo 1" through "Logo 5". If the Option Name for your uploaded file is different, then change those names. It will also fail if there is more than one "." in a filename - but I'm not sure Zen-Cart would allow it to be uploaded.

    It currently works on my site, but no guarantees. Hope this helps some people - its not a full uploaded file editor, but it will allow unskilled store admins to at least see the uploaded files referenced without typing a bunch of stuff.
    Last edited by boylan; 6 Nov 2006 at 08:45 AM.

  5. #5
    Join Date
    Jul 2008
    Location
    Paris, France
    Posts
    5
    Plugin Contributions
    0

    Default Attribute File Upload [REQUIRED]

    I'm desperately searching for a solution to my problem: My products require customers to upload files (customized merchandise).

    But Zen Cart 1.3.8 allows customers to put items in the cart without the mandatory upload. No test for the upload seems to be run, even though the attribute is "Required".

    Can anyone help, please?

    Many thanks!

  6. #6
    Join Date
    May 2008
    Location
    Pennsylvania
    Posts
    25
    Plugin Contributions
    0

    Default Re: Attribute File Upload

    Is the attribute for uploading a file only for images? I would like customers to be able to upload a text file or maybe a MS Word document. Is there a way to associate file types that are acceptable to upload (ie., .doc, pdf, .txt, etc.)?

    -Melissa

  7. #7
    Join Date
    May 2008
    Location
    Pennsylvania
    Posts
    25
    Plugin Contributions
    0

    Default Re: Attribute File Upload

    Ok, I finally found the answer to my question. I just couldn't remember where to find file types accepted to upload. It's under "Configuration", "Maximum Values" and then "Allowed Filename Extensions for uploading". I added the filename extensions I needed.

    -Melissa

  8. #8
    Join Date
    Jul 2008
    Location
    Paris, France
    Posts
    5
    Plugin Contributions
    0

    Default Re: Attribute File Upload

    Glad you found it. It's easy to set.

    But the upload function is buggy. I still haven't been able to make the upload required.

    And if a user tries to upload an unacceptable file type associated with a product, the error message displays in the cart... where the product has already been added.


    Franck
    Last edited by Franck; 24 Aug 2008 at 08:06 PM.

  9. #9
    Join Date
    Jan 2009
    Posts
    126
    Plugin Contributions
    0

    Default Re: Attribute File Upload

    Hey,

    I have used the following method to make a link in my orders page to the image, however I have 11 different upload attributes (long story) and this creates a rather unsightly bit of code which isn't very flexible.

    The code now looks as follows:

    PHP Code:
    //echo '<br /><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
                      
    echo '<br><small>&nbsp;<i> - ' $order->products[$i]['attributes'][$j]['option'] . ': ';
            if ((
    $order->products[$i]['attributes'][$j]['option'] == "1") or ($order->products[$i]['attributes'][$j]['option'] == "2") or ($order->products[$i]['attributes'][$j]['option'] == "3") or ($order->products[$i]['attributes'][$j]['option'] == "4") or ($order->products[$i]['attributes'][$j]['option'] == "5") or ($order->products[$i]['attributes'][$j]['option'] == "6") or ($order->products[$i]['attributes'][$j]['option'] == "7") or ($order->products[$i]['attributes'][$j]['option'] == "8") or ($order->products[$i]['attributes'][$j]['option'] == "9") or ($order->products[$i]['attributes'][$j]['option'] == "10") or ($order->products[$i]['attributes'][$j]['option'] == "1.")){
            
    $full_logo_name  $order->products[$i]['attributes'][$j]['value'];
    $pieces explode("."$full_logo_name);
            echo 
    ' <a href="' HTTP_SERVER DIR_WS_CATALOG '/images/uploads/' $pieces[0] . '.' $pieces[2] . '" target="_blank">' nl2br($order->products[$i]['attributes'][$j]['value']) . '</a>';
            } else { 
    Obviously this would be 1,000,000's of times better if it had one "if" statement, which checked if the product_option_type was "file" and then did the same process. Does anyone know how to modify this?

    ORIGINAL METHOD:

    Quote Originally Posted by boylan View Post
    Continuing on the bad practice described above - I have changed the .htaccess file to allow access to the uploaded images from IP address of the store owner - and created a link on the edit order page to view the file. To do this on your site:
    (using 1.3.5)
    change line 401 of admin/orders.php FROM:
    Code:
              echo '<br /><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);
    TO:
    Code:
    //          echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);
    		echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ';
    		if ($order->products[$i]['attributes'][$j]['option'] == "Logo 1" || $order->products[$i]['attributes'][$j]['option'] == "Logo 2" || $order->products[$i]['attributes'][$j]['option'] == "Logo 3" || $order->products[$i]['attributes'][$j]['option'] == "Logo 4" || $order->products[$i]['attributes'][$j]['option'] == "Logo 5") {
    		$full_logo_name  = $order->products[$i]['attributes'][$j]['value'];
    $pieces = explode(".", $full_logo_name);
    		echo nl2br($order->products[$i]['attributes'][$j]['value']) . ' <a href="/images/uploads/' . $pieces[0] . '.' . $pieces[2] . '" target="_blank">View ' . $pieces[0] . '.' . $pieces[2] . '</a>';
    		} else {
    		echo nl2br($order->products[$i]['attributes'][$j]['value']);
    		}
    Which results in something like this:
    Logo 1: 4. joomla_logo_black.jpg View 4.jpg

    The above only works because the Option Name for uploaded images is "Logo 1" through "Logo 5". If the Option Name for your uploaded file is different, then change those names. It will also fail if there is more than one "." in a filename - but I'm not sure Zen-Cart would allow it to be uploaded.

    It currently works on my site, but no guarantees. Hope this helps some people - its not a full uploaded file editor, but it will allow unskilled store admins to at least see the uploaded files referenced without typing a bunch of stuff.

  10. #10
    Join Date
    Mar 2009
    Posts
    57
    Plugin Contributions
    0

    Default Re: Attribute File Upload

    This is an old thread, but I'm having a problem with this exact problem.
    I have an attribute that is a file upload (an image that the customer supplies. I've added it to the product.
    When I do a test order, I add a file (and yes, it's an allowable filetype) and submit the order, but there is nothing that says that the file was uploaded, and the shopping cart doesn't show that a file was attached, and the /images/uploads folder is empty.
    (yes, I set the permissions to 777 and the .htaccess to allow writes)

    Any more ideas?

    Just one idea...
    In the options Name Manaager, it says option type: File, but in the Attribute Controller the Option Value is Text. I think that's correct, as text refers to the filename, but I'm not sure.

 

 

Similar Threads

  1. Thumbnail Preview of file after upload via Attribute File uploader?
    By NWFAP in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 7 Aug 2015, 03:40 AM
  2. v139h uploading artwork file (attribute) does not upload file
    By delia in forum General Questions
    Replies: 11
    Last Post: 1 Sep 2013, 08:41 PM
  3. File Upload Attribute - File Size Limit?
    By Genevieve in forum General Questions
    Replies: 2
    Last Post: 4 May 2010, 06:33 PM
  4. Attribute Upload File
    By leilanddale in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 26 Feb 2010, 06:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg