• Hi, we are trying to customize the email template request-quote.php

    We want to change the link, now we get an edit product link, we have changed the original code

    	<tbody>
    	<?php
    	if ( ! empty( $raq_data['raq_content'] ) ) :
    		foreach ( $raq_data['raq_content'] as $item ) :
    			$_product = isset( $item['variation_id'] ) ? wc_get_product( $item['variation_id'] ) : wc_get_product( $item['product_id'] );
    			if ( ! $_product ) {
    				continue;
    			}
    
    			$product_admin_link = '';
    			$posttype_object    = get_post_type_object( get_post( $_product->get_id() )->post_type );
    			if ( ( $posttype_object ) && ( $posttype_object->_edit_link ) ) {
    				$product_admin_link = admin_url( sprintf( $posttype_object->_edit_link . '&action=edit', $_product->get_id() ) );
    			}
    			?>
    			<tr>
    				<td scope="col" style="text-align:left;"><a href="<?php echo esc_url( $product_admin_link ); ?>"><?php echo wp_kses_post( $_product->get_title() ); ?></a>
    				 <?php if ( isset( $item['variations'] ) ) : ?>
    						<small><?php echo wp_kses_post( yith_ywraq_get_product_meta( $item ) ); ?></small><?php endif ?></td>
    				<td scope="col" style="text-align:left;"><?php echo esc_html( $item['quantity'] ); ?></td>
    				<td scope="col" style="text-align:left;"><?php echo wp_kses_post( WC()->cart->get_product_subtotal( $_product, (int) $item['quantity'] ) ); ?></td>
    			</tr>
    			<?php
    		endforeach;
    	endif;
    	?>
    	</tbody>

    into

    <table cellspacing="0" cellpadding="6" style="width: 100%; margin-bottom:30px" border="0" bordercolor="#eee">
    	<thead>
    	<tr>
    		<th scope="col" style="text-align:left;"><?php esc_html_e( 'Product', 'yith-woocommerce-request-a-quote' ); ?></th>
    		<th scope="col" style="text-align:left;"><?php esc_html_e( 'Quantity', 'yith-woocommerce-request-a-quote' ); ?></th>
    		<th scope="col" style="text-align:left;"><?php esc_html_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 style="text-decoration:none; font-weight:500;" href="<?php echo $url = get_permalink( $product_id ); ?>"><?php echo wp_kses_post( $_product->get_title() ); ?></a>
    				 <?php if ( isset( $item['variations'] ) ) : ?>
    						<small><?php echo wp_kses_post( yith_ywraq_get_product_meta( $item ) ); ?></small><?php endif ?></td>
    				<td scope="col" style="text-align:left;"><?php echo esc_html( $item['quantity'] ); ?></td>
    				<td scope="col" style="text-align:left;"><?php echo wp_kses_post( WC()->cart->get_product_subtotal( $_product, $item['quantity'] ) ); ?></td>
    			</tr>
    			<?php
    		endforeach;
    	endif;
    	?>
    	</tbody>
    </table>
    

    But it does not work. Any advise is appreciated.

    PS
    We have created a folder in our childtheme with the name of the plugin and then added the emails folder with the request-quote.php file in it but it does not get picked up. Do we need to add the templates folder? Thanks

    • This topic was modified 2 years, 7 months ago by mbri.

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

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Customize email template changing edit product link to product link’ is closed to new replies.