Support » Plugin: WP e-Commerce Style Email » How to style product list for admin emails?

  • Resolved chavo

    (@chavo)



    Hi. First at all: great plugin!

    I’m customizing the css style of the emails that the costumer receives and everything goes ok. I’m really glad of the ability of the plugin to customize the product list so it matches my transaction results page.

    Anyway, I created a wpsc-email_style_purchase_report.php file so I can style the “Transaction report” email sent to the store’s admin, but… I noticed that product list isn’t customized. The content looks just like the content that outputs purchase-log-notification.class.php (into folder wpsc-includes of WP E-commerce plugin).

    I took a look at the others threads and found that wpsc-email_style_purchase_report.php template is only a wrapper template but only consumer content templates are available. The plugin still works at this way (no admin emails content customizing available) or I’m missing something?

    Thanks in advance!

    http://wordpress.org/plugins/wp-e-commerce-style-email/

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

    (@mightyturtle)

    Hi,

    Thanks for using my plugin – and thanks for looking through the other threads!

    You are correct, the plugin currently only provides for consumer content templating. Wrapper templates can be different for all email types though.

    Cheers,

    Jacob

    🙁

    Hi Jacob. Thanks for your reply!

    I’m trying to figure out how to get that the product list in admin emails matches with the aesthetics of checkout/transaction report pages. It’s a hard goal because of the plain html that outputs purchase-log-notification.class.php. Also I’m taking a look if based in your plugin I can developt my own function making sql queries but I’m not a code master, just a graphic / web designer with intermediate programming skills.

    It will be really useful if you can add admin emails content templating in a next release. Anyway, once again: great job!

    Plugin Author Jacob Schwartz

    (@mightyturtle)

    It’s definitely on my list for the next release – but I’m a little over-committed for the near future so I can’t promise a timeline.

    Cheers,

    Jacob

    Well, I figured out how to make my custom admin products report list with css style. Here is my custom code for those who want to take a look (somo words are in spanish but nothing difficult).

    Use it in your wpsc-email_style_purchase_report.php template:

    <?php
    $purchaseID = ECSE_purchase::get_the_purchase_ID(); 
    
    global $wpdb;
    
    $cartsql = $wpdb->prepare( "SELECT * FROM <code>" . WPSC_TABLE_CART_CONTENTS . "</code> WHERE <code>purchaseid</code>=". $purchaseID . "", $purchase['id']);
    $cart_log = $wpdb->get_results( $cartsql, ARRAY_A );
    $j = 0;
    // /*
    if ( $cart_log != null ) { ?>
    <table width="700" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <th colspan="2" scope="col" align="left" valign="top" style=" padding: 10px 0; color:#004796; font-family:Arial, Helvetica, sans-serif; font-size:13px; line-height:13px; border-bottom: solid 1px #CCC;">Producto</th>
        <th width="120" scope="col" align="center" valign="top" style="padding: 10px; color:#004796; font-family:Arial, Helvetica, sans-serif; font-size:13px; line-height:13px; border-bottom: solid 1px #CCC;">Código</th>
        <th width="60" scope="col" align="center" valign="top" style="padding: 10px 0; color:#004796; font-family:Arial, Helvetica, sans-serif; font-size:13px; line-height:13px; border-bottom: solid 1px #CCC;">Cant.</th>
        <th width="90" scope="col" align="right" valign="top" style="padding: 10px 0 10px 10px; color:#004796; font-family:Arial, Helvetica, sans-serif; font-size:13px; line-height:13px; border-bottom: solid 1px #CCC;">Precio</th>
        <th width="90" scope="col" align="right" valign="top" style="padding: 10px; color:#004796; font-family:Arial, Helvetica, sans-serif; font-size:13px; line-height:13px; border-bottom: solid 1px #CCC;">Total</th>
      </tr>
    <?php
    
    $gsttotal = false;
    $endtotal = $total_shipping = 0;
    foreach ( (array)$cart_log as $cart_row ) {
    	$alternate = "";
    	$j++;
    	if ( ($j % 2) != 0 )
    	$alternate = "alt";
    	$variation_list = '';
    
    	$billing_country = !empty($country_data[0]['value']) ? $country_data[0]['value'] : '';
    	$shipping_country = !empty($country_data[0]['value']) ? $country_data[0]['value'] : '';
    
    	$shipping = $cart_row['pnp'];
    	$total_shipping += $shipping;
    
    	$prodID = $cart_row['prodid'];
    ?>
      <tr>
        <?php // PRODUCTO ?>
        <td width="50" align="left" valign="top" style="padding: 10px 0; border-bottom: dotted 1px #CCC;">
    <?php
    // levanto la imagen
    $item_img = '<img class="product_image" title="'.$cart_row['name'].'" alt="'.$cart_row['name'].'" src="'.get_template_directory_uri().'/timthumb/timthumb.php?src='.wpsc_the_product_image('','', $prodID).'&w=48&h=48&zc=2" style="border:solid 1px #ccc">';
    echo $item_img;
    ?>
    </td>
        <td width="290" align="left" valign="top" style="padding: 10px 0 10px 10px; color:#004796; font-family:Arial, Helvetica, sans-serif; font-size: 12px; line-height: 15px; border-bottom: dotted 1px #CCC;">
    <?php
    // nombre de producto
    echo apply_filters( 'the_title', $cart_row['name'] );
    echo $variation_list;
    ?>
    </td>
    <?php // CÓDIGO DE PRODUCTO ?>
        <td width="120" align="center" valign="top" style="padding: 10px; color:#666; font-family:Arial, Helvetica, sans-serif; font-size: 12px; line-height: 15px; border-bottom: dotted 1px #CCC;">
    <?php
    $sku = get_post_meta($prodID, '_wpsc_sku' , true);
    echo $sku;
    ?>
    </td>
    <?php // CANTIDAD ?>
        <td width="60" align="center" valign="top" style="padding: 10px 0; color:#666; font-family:Arial, Helvetica, sans-serif; font-size: 12px; line-height: 15px; border-bottom: dotted 1px #CCC;">
    <?php
    echo $cart_row['quantity'];
    ?>
    </td>
    <?php // PRECIO UNITARIO ?>
        <td width="90" align="right" valign="top" style="padding: 10px 0 10px 10px; color:#666; font-family:Arial, Helvetica, sans-serif; font-size: 12px; line-height: 15px; border-bottom: dotted 1px #CCC;">
    <?php
    $price = $cart_row['price'] * $cart_row['quantity'];
    echo wpsc_currency_display( $price );
    ?>
    </td>
    <?php // PRECIO ITEM TOTAL ?>
        <td width="90" align="right" valign="top" style="padding: 10px; color:#666; font-family:Arial, Helvetica, sans-serif; font-size: 12px; line-height: 15px; border-bottom: dotted 1px #CCC;">
    <?php
    $endtotal += $price;
    echo wpsc_currency_display( ($price ), array('display_as_html' => false)  );
    ?>
    </td>
      </tr>
    <?php } ?>
    </table>
    <?php // TOTAL  ?>
    <table width="700" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="360" align="left" style="color:#004796; font-family:Arial, Helvetica, sans-serif; font-size: 14px; line-height:14px; font-weight: bold; border-bottom: dotted 1px #CCC;">TOTAL <small style="color:#666; font-family:Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal;">(no incluye impuestos)</small></td>
    <td width="340" align="right" style="padding: 10px; color:#666; font-family:Arial, Helvetica, sans-serif; font-size: 14px; line-height:14px; border-bottom: dotted 1px #CCC; font-weight: bold;">
    <?php
    $endtotal += $purchase['wpec_taxes_total'];
    echo wpsc_currency_display( $endtotal , array('display_as_html' => false) );
    ?>
    </td>
    </tr>
    </table>
    <?php } ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to style product list for admin emails?’ is closed to new replies.