Support » Plugin: Easy Digital Downloads - Simple eCommerce for Selling Digital Files » Change $download[‘name’]; to $file[‘name’]

  • Resolved mohammadr3z

    (@mohammadr3z)


    i want to change $download[‘name’]; to $file[‘name’] But the problem is that the first line is empty

    http://prntscr.com/nngobb

    <tr class=”edd_download_history_row”>
    <?php
    $price_id = edd_get_cart_item_price_id( $download );
    $download_files = edd_get_download_files( $download[‘id’], $price_id );
    $name = $download[‘name’];

Viewing 4 replies - 1 through 4 (of 4 total)
  • Pratik Jain

    (@pratik-jain)

    Hi @mohammadr3z

    Thanks for the screenshot. I have looked into it but it’s not clear to me.

    Can you please tell me what exactly you are trying to do and on what screen (I mean Download History, Purchase History etc) ?

    This will help me to understand your concern clearly so I can help you according to it.

    Thread Starter mohammadr3z

    (@mohammadr3z)

    Hello
    Thank you for the reply
    When i change $download[‘name’] in the code above to $file[‘name’]
    The file name column is corrupted

    Below you will see the code change before and after.

    Before: http://prntscr.com/noahe1

    After: http://prntscr.com/noai28

    Pratik Jain

    (@pratik-jain)

    Hi @mohammadr3z

    The code you are referring is I think templates/history-downloads.php

    You can not use $file[‘name’] directly. It is not accessible. It is an array so first we need to get the First file name. You can use below code after this line $name = $download['name'];

    if( $download_files ) {
    	$file_first_key = key( $download_files );
    	$name           = !empty( $download_files[ $file_first_key ]['name'] ) ? $download_files[ $file_first_key ]['name'] : $name;
    }
    Thread Starter mohammadr3z

    (@mohammadr3z)

    Thank you very much
    it worked
    You are doing great

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change $download[‘name’]; to $file[‘name’]’ is closed to new replies.