Added fields and emails

Discussion in 'Customization & add-ons' started by dandare2020, Aug 18, 2011.

  1. dandare2020

    dandare2020 New Member

    Joined:
    Jul 24, 2011
    Messages:
    26
    Hi all i think i'm going crazy. I'm sure i had this working before but it's seems to have stopped now.

    Basically i added a new productfield call boxno which seems to show up the the amember_payment. I have added a text box in member_add_renew with the value {$payment.boxno} and then in the pending email template i have added the line box no: {$payment.boxno}

    This doesn't seem to work anymore i have checked the sql file and it doesn't seem to be adding the data but there is some data in some of the old subscriptions.

    Any ideas where i'm going wrong

    Many Thanks

    Dan
  2. dandare2020

    dandare2020 New Member

    Joined:
    Jul 24, 2011
    Messages:
    26
    just to add to that i added the field via the site.inc file like

    <?php
    add_product_field('Boxno', 'Box Number', 'text', "Your Box Number");
    ?>

    Many Thanks
  3. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    Dan,
    1. If you want to add field to payment profile you should use add_payment_field and not add_product_field.
    2. Correct variable to access this field is: {$payment.data.Boxno}
  4. dandare2020

    dandare2020 New Member

    Joined:
    Jul 24, 2011
    Messages:
    26
    hi that works great and shows in the emails and on the users payment page but it doesn't seem to add it in the database in the amember_payments boxno column how would i go about doing this

    many thanks

    dan
  5. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    Dan,
    Custom fields for payments are stored in amember_payments.data column. (serialized array)
    From php you can access it this way:
    $payment = $db->get_payment($payment_id);
    $payment['data']['fieldname'];
  6. dandare2020

    dandare2020 New Member

    Joined:
    Jul 24, 2011
    Messages:
    26
    hi that doesn't seem to work. I'm trying to add it as a column in the payment history page at the end of the other columns

    Many Thanks

    Dan
  7. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    Can you attach code that you have and that does not work?
  8. dandare2020

    dandare2020 New Member

    Joined:
    Jul 24, 2011
    Messages:
    26
    hi im trying to put the code in you gave me

    $payment = $db->get_payment($payment_id);
    $payment['data']['boxno'];

    ive tried various options like just

    $payment.data.boxno

    still with no luck

    Many Thanks

    Dan
  9. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,274
    Dan,
    exact code will depends on exact place where you want to put it.
    I believe you need to do this in payment_history table? If so you need to use this variable: {$p.data.Boxno} or {$p.data.boxno}

Share This Page