• How to modify the pricing table HTML?

    the pdf-entry-detail.php

    contains the code

    <table class='entry-products' autosize='1' cellspacing='0' width='97%'>
    									  <colgroup>
    											  <col class='entry-products-col1' />
    											  <col class='entry-products-col2' />
    											  <col class='entry-products-col3' />
    											  <col class='entry-products-col4' />
    										</colgroup>
    										<thead>
    										  <tr>
    											<th scope='col'><?php echo apply_filters('gform_product_{$form_id}', apply_filters('gform_product', __('Product', 'gravityforms'), $form_id), $form_id) ?></th>
    											<th scope='col' class='textcenter'><?php echo apply_filters('gform_product_qty_{$form_id}', apply_filters('gform_product_qty', __('Qty', 'gravityforms'), $form_id), $form_id) ?>123</th>
    											<th scope='col'><?php echo apply_filters('gform_product_unitprice_{$form_id}', apply_filters('gform_product_unitprice', __('Unit Price', 'gravityforms'), $form_id), $form_id) ?></th>
    											<th scope='col'><?php echo apply_filters('gform_product_price_{$form_id}', apply_filters('gform_product_price', __('Price', 'gravityforms'), $form_id), $form_id) ?></th>
    										  </tr>
    										</thead>
    										<tbody>

    But it does not change it in my template when I call it with {pricing_fields}. What do I have to do to change the table (http://postimg.org/image/eno0dofyt/)

    https://ww.wp.xz.cn/plugins/gravity-forms-pdf-extended/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jake Jackson

    (@blue-liquid-designs)

    Hi,

    In short, you don’t. Modifying the structure directly would involve editing a core file (which gets overridden during plugin updates).

    Instead, you should use the $form_data array and build your own table. Here’s the basic PHP uses to loop through the product data and output it.

    <?php
    /* loop through all products */
    foreach($form_data['products'] as $product) {
    ?>
        <?php echo $product['name']; ?>
        <?php echo $product['price']; ?>
        <?php echo $product['quantity']; ?>
        <?php echo $product['subtotal_formatted']; ?>
        <br>
    <?php
        /* Inner loop to loop through options field */
        foreach($product['options'] as $option) {
        ?>
            <?php echo $option['field_label']; ?>
            <?php echo $option['option_name']; ?>
            <?php echo $option['option_label']; ?>
            <?php echo $option['price_formatted']; ?>
            <br>
        <?php } /* close option loop */ ?>
    ?>
    <?php } /* close foreach loop */ ?>
    
    <?php echo $form_data['products_totals']['shipping_formatted']; ?>
    <?php echo $form_data['products_totals']['subtotal_formatted']; ?>
    <?php echo $form_data['products_totals']['total_formatted']; ?>

    Include the appropriate HTML you want.

    Thread Starter renewordpress

    (@renewordpress)

    where would I put that PHP code and where would I include the HTML? Is there any templates or examples, of someone who has done that already, I could look at?

    Plugin Author Jake Jackson

    (@blue-liquid-designs)

    Please review our custom PDF template guide for more information about generating your own templates for the plugin.

    As far as I’m aware there’s not an example template specific to your use case. Since you want to put it in a HTML table I’d review the correct table markup and integrate your PHP accordingly.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Pricing Table’ is closed to new replies.