Change %invoice_text% layout

Discussion in 'Templates customization' started by tokazama2, Oct 22, 2013.

Thread Status:
Not open for further replies.
  1. tokazama2

    tokazama2 aMember Pro Customer

    Joined:
    Feb 7, 2013
    Messages:
    51
    Some of our product descriptions are rather long. There are several reasons why we do this. It makes the format of the %invoice_text% layout (Send Payment Email) look weird. Is there a way to adjust this without changing the product descriptions?

    [​IMG]
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,669
    No, this layout is hard-coded. You can alter it only by modifying core file (amember/application/default/models/Invoice.php method render).

    I absolutely agree with you we should tackle such situation in more correct way. We implement some solution asap and include it to next release. I can see two workaround:

    1. truncate name of product and add periods e.g.
    Very Long Title of your Pr... 1x370.00 USD 370.00
    2. make product title to take several lines if necessary e.g.
    Very Long Title of your 1x370.00 USD 370.00
    Product with some additional
    description

    What do you think about it? What is option is more reasonable?

    Thank you for your contribution.
  3. tokazama2

    tokazama2 aMember Pro Customer

    Joined:
    Feb 7, 2013
    Messages:
    51
    Thank you for your reply!

    For our purposes option 2 would work best.
  4. tokazama2

    tokazama2 aMember Pro Customer

    Joined:
    Feb 7, 2013
    Messages:
    51
    Or maybe just make the dashed line longer.
  5. tokazama2

    tokazama2 aMember Pro Customer

    Joined:
    Feb 7, 2013
    Messages:
    51
    I came up with a solution that I am fairly happy with...

    I went to amember/application/default/models/Invoice.php. I made a backup copy :).

    I then searched for the word "render". I found that around line 1600-ish.

    There are several lines that say:
    Code:
    $out .= $indent . str_repeat('-', 70)
    I changed it to:
    Code:
    $out .= $indent . str_repeat('-', 100)
    It now looks like this:

    [​IMG]
  6. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,669
    Yes, it is correct approach but it is not flexible enough. In case you have new product with longer name you will need to edit code again. I think we will go ahead with multi-line solution. Also I think it is reasonable to extend default width up to 100 chars as you did. This changes will be included in next minor release.
  7. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,669
    I want to provide some update. We already implemented this feature and it will be delivered with next minor release.

    Best Regards.
  8. tokazama2

    tokazama2 aMember Pro Customer

    Joined:
    Feb 7, 2013
    Messages:
    51
    Thank you!
  9. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,669
    You are welcome!
Thread Status:
Not open for further replies.

Share This Page