Adding custom product fields to product page

Discussion in 'Customization & add-ons' started by baker, Nov 17, 2019.

  1. baker

    baker New Member

    Joined:
    Aug 29, 2006
    Messages:
    19
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Here is code to access field value from product object:
    PHP:
    $product->data()->get('field_name');
    But I guess you ask how to access product object.
    What is file where you want to access it?
  3. baker

    baker New Member

    Joined:
    Aug 29, 2006
    Messages:
    19
    The detail page that the cart takes you to when you click on a product.
    /amember/product/product-title
  4. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Template responsible for this page is:
    application/cart/views/blocks/product.phtml

    You can use this code within template file:
    PHP:
    <?php p($product->data()->get('field_name')) ?>
  5. baker

    baker New Member

    Joined:
    Aug 29, 2006
    Messages:
    19
    Thank you Caesar! That works wonderfully. I had not realized you could also copy the templates from the cart folder over. I thought that only worked on \application\default\views. That makes stuff much easier. Thanks again. I just purchased my updates again. I love amember!
  6. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Yes, you can copy any template to theme folder in order to customize it. Just keep same relative folder path.

    You are welcome!

Share This Page