• Hello, I have the free plugin installed, I have added a field to the elderly in the form but I am not able to show it in the email I receive to request the quote.

    My question is: How can I make the user_nicename field be seen in the email? If I buy the plugin, does this problem solve me?

    a greeting

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi @pere65 ,
    You can show this custom field, if override the email template in your theme.
    Create a empty file request-quote.php in /wp-content/themes/your_theme_folder/woocommerce/emails and put this code

    <?php
    /**
     * HTML Template Email
     *
     * @package YITH Woocommerce Request A Quote
     * @since   1.0.0
     * @author  YITH
     */
    
    ?>
    
    <?php do_action( 'woocommerce_email_header', $email_heading ); ?>
    
    <p><?php printf( __( 'You received a quote request from %s. The request is the following:', 'yith-woocommerce-request-a-quote' ), $raq_data['user_name'] ); ?></p>
    
    <?php do_action( 'yith_ywraq_email_before_raq_table', $raq_data ); ?>
    
    <h2><?php _e('Request Quote', 'yith-woocommerce-request-a-quote') ?></h2>
    
    <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
        <thead>
        <tr>
            <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Product', 'yith-woocommerce-request-a-quote' ); ?></th>
            <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Quantity', 'yith-woocommerce-request-a-quote' ); ?></th>
            <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e( 'Subtotal', 'yith-woocommerce-request-a-quote' ); ?></th>
        </tr>
        </thead>
        <tbody>
        <?php
        if( ! empty( $raq_data['raq_content'] ) ):
            foreach( $raq_data['raq_content'] as $item ):
                if( isset( $item['variation_id']) ){
                    $_product = wc_get_product( $item['variation_id'] );
                }else{
                    $_product = wc_get_product( $item['product_id'] );
                }
                ?>
                <tr>
                    <td scope="col" style="text-align:left;"><a href="<?php echo get_edit_post_link( $_product->get_id() )?>"><?php echo $_product->get_title() ?></a>
                     <?php  if( isset($item['variations'])): ?><small><?php echo yith_ywraq_get_product_meta($item); ?></small><?php endif ?></td>
                    <td scope="col" style="text-align:left;"><?php echo $item['quantity'] ?></td>
                    <td scope="col" style="text-align:left;"><?php  echo WC()->cart->get_product_subtotal( $_product, $item['quantity'] ); ?></td>
                </tr>
            <?php
            endforeach;
        endif;
        ?>
        </tbody>
    </table>
    
    <?php do_action( 'yith_ywraq_email_after_raq_table', $raq_data ); ?>
    <?php if( ! empty( $raq_data['user_message']) ): ?>
    <h2><?php _e( 'Customer message', 'yith-woocommerce-request-a-quote' ); ?></h2>
        <p><?php echo $raq_data['user_message'] ?></p>
    <?php endif ?>
    <h2><?php _e( 'Customer details', 'yith-woocommerce-request-a-quote' ); ?></h2>
    <p><strong><?php _e('Nombre', 'yith-woocommerce-request-a-quote');?></strong><?php echo isset( $_POST['rqa_nicename'] ) ?  isset( $_POST['rqa_nicename'] ) : '';?></p>
    <p><strong><?php _e( 'Name:', 'yith-woocommerce-request-a-quote' ); ?></strong> <?php echo $raq_data['user_name'] ?></p>
    <p><strong><?php _e( 'Email:', 'yith-woocommerce-request-a-quote' ); ?></strong> <a href="mailto:<?php echo $raq_data['user_email']; ?>"><?php echo $raq_data['user_email']; ?></a></p>
    
    <?php do_action( 'woocommerce_email_footer' ); ?>
    Thread Starter pere65

    (@pere65)

    Hello again. The request-quote.php file is changed only in the theme or also in the plugin.

    I changed it in both and still nothing appears.

    Thanks

    Thread Starter pere65

    (@pere65)

    Hi, I pass you the code that I have in the request-quote-form.php file. If I put the code you sent me in the other post it doesn’t show the nicename field. Could you tell me what is wrong?

    <?php
    /**
    * Form to Request a quote
    *
    * @package YITH Woocommerce Request A Quote
    * @since 1.0.0
    * @version 1.0.0
    * @author YITH
    */
    $current_user = array();
    if ( is_user_logged_in() ) {
    $current_user = get_user_by( ‘id’, get_current_user_id() );
    }
    $user_nicename = ( ! empty( $current_user ) ) ? $current_user->user_nicename : ”;
    $user_name = ( ! empty( $current_user ) ) ? $current_user->display_name : ”;
    $user_email = ( ! empty( $current_user ) ) ? $current_user->user_email : ”;
    ?>
    <div class=”yith-ywraq-mail-form-wrapper”>
    <h3><?php _e( ‘Enviar el pedido’, ‘yith-woocommerce-request-a-quote’ ) ?></h3>

    <form id=”yith-ywraq-mail-form” name=”yith-ywraq-mail-form” action=”<?php echo esc_url( YITH_Request_Quote()->get_raq_page_url() ) ?>” method=”post”>

    <p class=”form-row form-row-wide validate-required” id=”rqa_nicename_row”>
    <label for=”rqa-nicename” class=””><?php _e( ‘Name’, ‘yith-woocommerce-request-a-quote’ ) ?>
    <abbr class=”required” title=”required”>*</abbr></label>
    <input type=”text” class=”input-text ” name=”rqa_nicename” id=”rqa-nicename” placeholder=”” value=”<?php echo $user_nicename ?>” required />
    </p>

    <p class=”form-row form-row-wide validate-required” id=”rqa_name_row”>
    <label for=”rqa-name” class=””><?php _e( ‘Código’, ‘yith-woocommerce-request-a-quote’ ) ?>
    <abbr class=”required” title=”required”>*</abbr></label>
    <input type=”text” class=”input-text ” name=”rqa_name” id=”rqa-name” placeholder=”” value=”<?php echo $user_name ?>” required>
    </p>

    <p class=”form-row form-row-wide validate-required” id=”rqa_email_row”>
    <label for=”rqa-email” class=””><?php _e( ‘Email’, ‘yith-woocommerce-request-a-quote’ ) ?>
    <abbr class=”required” title=”required”>*</abbr></label>
    <input type=”email” class=”input-text ” name=”rqa_email” id=”rqa-email” placeholder=”” value=”<?php echo $user_email ?>” required>
    </p>

    <p class=”form-row” id=”rqa_message_row”>
    <label for=”rqa-message” class=””><?php _e( ‘Message’, ‘yith-woocommerce-request-a-quote’ ) ?></label>
    <textarea name=”rqa_message” class=”input-text ” id=”rqa-message” placeholder=”<?php _e( ‘Notes on your request…’, ‘yith-woocommerce-request-a-quote’ ) ?>” rows=”5″ cols=”5″></textarea>
    </p>

    <?php if( ‘yes’ == get_option(‘ywraq_add_privacy_checkbox’, ‘no’) ): ?>
    <div class=”ywraq-privacy-wrapper”>
    <p class=”form-row”
    id=”rqa_privacy_description_row”><?php echo ywraq_replace_policy_page_link_placeholders( get_option( ‘ywraq_privacy_description’ ) ) ?></p>
    <p class=”form-row” id=”rqa_privacy_row”>
    <input type=”checkbox” name=”rqa_privacy” id=”rqa_privacy” required>
    <label for=”rqa_privacy”
    class=””><?php echo ywraq_replace_policy_page_link_placeholders(get_option(‘ywraq_privacy_label’) ) ?>
    <abbr class=”required” title=”required”>*</abbr></label>

    </p>
    </div>
    <?php endif ?>

    <p class=”form-row”>
    <input type=”hidden” id=”raq-mail-wpnonce” name=”raq_mail_wpnonce” value=”<?php echo wp_create_nonce( ‘send-request-quote’ ) ?>”>
    <input class=”button raq-send-request” type=”submit” value=”<?php _e( ‘ENVIAR PEDIDO’, ‘yith-woocommerce-request-a-quote’ ) ?>”>
    </p>

    </form>
    </div>

    Thread Starter pere65

    (@pere65)

    Hi, can you help me?

    I explain, I have registered users to whom I want to show the product with prices and unregistered customers who do not want to show the price, so far so good.

    The problem is that when they choose the product and they will see the cart in both cases the price appears, how do I have to do so that only the price in the cart is seen when you are registered?

    Thank you

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

The topic ‘New field in email’ is closed to new replies.