Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Search
Search


Forum Index » Templates

Post new topic   Reply to topic
Working on my first Template
View previous topic :: View next topic  
Author Message
johnwalls



Joined: 14 Dec 2005
Posts: 18

PostPosted: Wed Dec 14, 2005 3:03 pm    Post subject: Working on my first Template Reply with quote

I'm building my template to use in house, and am having a bit of trouble with xml, html is much easier.

I've managed to center everything, which was a task inits own. Smile

Now I need to add payment method, and weight. I would also like to make the text a bit larger and make the Payment total more detailed, to include. If shipping insurance was added or not, and if everything could be centered theat would be great to. Here's my current code:


Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sw="http://www.interapptive.com/shipworks" extension-element-prefixes="sw">

<!--
    Start off with the Base Template
-->
<xsl:import href="System\Base Order Template" />
 
<xsl:output method="html" encoding="utf-8" />

<sw:settings>
    <sw:general>
        <sw:type>standard</sw:type>
        <sw:context>order</sw:context>
    </sw:general>
</sw:settings>

<!--
      The following override the xsl:template's in the base to provide
      image headers for each of the sections.
-->

<xsl:template name="outputPageHeader">
   <div align="center"><img id="imgInvoice" src="http://www.johnwalls.com/header.jpg" /></div>
</xsl:template>

<xsl:template name="outputShipBillHeader">
    <div align="center"><img id="imgBillShip" src="images/billshipping.jpg" /></div>
</xsl:template>

<xsl:template name="outputOrderDetailsHeader">
    <div align="center"><img id="imgOrderInfo" src="images/orderinfo.jpg" /></div>
</xsl:template>

<xsl:template name="outputOrderDetailsFooter">
    <xsl:if test="$templateType != 'invoice'">
        <div class="divider" />
    </xsl:if>
</xsl:template>

<xsl:template name="outputOrderTotalsHeader">
    <div align="center"><img id="imgOrderTotals" src="images/ordertotals.jpg" /></div>
</xsl:template>

</xsl:stylesheet>
Back to top
View user's profile
johnwalls



Joined: 14 Dec 2005
Posts: 18

PostPosted: Wed Dec 14, 2005 3:04 pm    Post subject: Reply with quote

Ignore the insurance thing. I see thats already there.
Back to top
View user's profile
Wes
Site Admin


Joined: 07 Oct 2002
Posts: 7427

PostPosted: Wed Dec 14, 2005 4:32 pm    Post subject: Reply with quote

Hello,

You can output any information that is available in the database by making references to its associated XML element. The entire ShipWorks XML schemea is located in the Template Editing section of the help system, under Help -> Contents.

The following will output the total weight of the order:

Code:
<xsl:value-of select="sum(//Order/Item/Weight)" />


The following will output all payment detail information for the order:

Code:
<xsl:for-each select="//Order/Payment/Detail">
<xsl:value-of select="Label" />:<xsl:value-of select="Value" />
</xsl:for-each>


Please let us know if you need further assistance.

Thanks,

Wes
Interapptive, Inc.
Back to top
View user's profile Visit poster's website
johnwalls



Joined: 14 Dec 2005
Posts: 18

PostPosted: Thu Dec 15, 2005 7:45 am    Post subject: Reply with quote

Ok, got the other parts working ok. I forgot about the notes that the buyers put into special instructions.

only thing I could find was <notes>

Everything is looking ok.
Back to top
View user's profile
Wes
Site Admin


Joined: 07 Oct 2002
Posts: 7427

PostPosted: Thu Dec 15, 2005 7:52 am    Post subject: Reply with quote

Hello,

Notes can be output as follows:

Code:
<xsl:value-of select="//Order/Notes" />


Let us know if you have further questions.

Thanks,

Wes
Interapptive, Inc.
Back to top
View user's profile Visit poster's website
johnwalls



Joined: 14 Dec 2005
Posts: 18

PostPosted: Fri Dec 16, 2005 11:26 am    Post subject: Reply with quote

Ok, I'm rolling along pretty well.

Heres my current code
Code:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sw="http://www.interapptive.com/shipworks" extension-element-prefixes="sw">

<!--
    Start off with the Base Template
-->
<xsl:import href="System\Base Order Template" />
 
<xsl:output method="html" encoding="utf-8" />

<sw:settings>
    <sw:preview>
        <sw:count>4</sw:count>
    </sw:preview>
    <sw:general>
        <sw:type>standard</sw:type>
        <sw:context>order</sw:context>
    </sw:general>
</sw:settings>

<!--
      The following override the xsl:template's in the base to provide
      image headers for each of the sections.
-->

<xsl:template name="outputPageHeader">
   <div align="center"><img id="imgInvoice" src="http://www.johnwalls.com/header.jpg" /></div>
</xsl:template>



<xsl:template name="outputShipBillHeader">
    <div align="center"><img id="imgBillShip" src="images/billshipping.jpg" /></div>
    <br></br><font size="5"><b>Order Notes:</b></font><br /><xsl:value-of select="//Order/Notes" /><br><br></br></br>
    <font size="5">Shipping Method: </font><strong><xsl:value-of select="//Order/RequestedShipping" /></strong>
   
</xsl:template>

<xsl:template name="outputOrderDetailsHeader">
        <div align="center"><img id="imgOrderInfo" src="images/orderinfo.jpg" /></div>
</xsl:template>

<xsl:template name="outputOrderDetailsFooter">
  <strong>Weight:</strong><br></br> <xsl:value-of select="sum(//Order/Item/Weight)" /> Pounds<br></br><br></br>
  <stong>Payment Details:</stong><br></br>
<xsl:for-each select="//Order/Payment/Detail"> <br></br>
<xsl:value-of select="Label" />:<xsl:value-of select="Value" />
</xsl:for-each>

<xsl:if test="$templateType != 'invoice'">
        <div class="divider" />
    </xsl:if>
</xsl:template>

<xsl:template name="outputOrderTotalsHeader">
    <div align="center"><img id="imgOrderTotals" src="images/ordertotals.jpg" /></div>
</xsl:template>


</xsl:stylesheet>


My question is, If i want this to print twice, how do I put in a page break so I can copy the same code and place it again slightly modified, I'm try to print 2 copies, ever so slightly different at the same time. (I dont have alot of free time to print two different templates)
Back to top
View user's profile
johnwalls



Joined: 14 Dec 2005
Posts: 18

PostPosted: Thu Dec 29, 2005 9:13 am    Post subject: Reply with quote

Bump
Exclamation
Also I want to add the phone number and email to the Billto and shipto info on my invoice printout.
Back to top
View user's profile
Wes
Site Admin


Joined: 07 Oct 2002
Posts: 7427

PostPosted: Thu Dec 29, 2005 9:26 am    Post subject: Reply with quote

Hello,

For the page break, you could try using the following CSS code at the end of the content for the first template section.

Code:
<div style="page-break-after:always;" />


You could then follow this by the second portion of the content (the second page/template to be printed).

You can modify the following section of the System\Common template to include BillTo/ShipTo phone/email information as follows:


Code:
<!--                                                            -->
<!-- Outputs a table with the standard Ship To \ Bill To info   -->
<!--                                                            -->
<xsl:template name="outputShipToBillTo">
    <xsl:param name="order" />
   
        <xsl:variable name="showAddress" select="//StoreType != 'eBay' or $order/eBay/CheckoutComplete = 'true'" />
      
        <table id="addressInfo" cellspacing="0">
       
        <tr>
         <td style="width: 47.5%;">
           
            <table id="shipaddress" style="width: 100%;" cellspacing="0">
               <tr>
                  <td class="header">
                     Ship To
                  </td>
               </tr>
               
               <tr>
                  <td>
                       <xsl:if test="$showAddress">
                                <xsl:call-template name="formatAddress">
                                    <xsl:with-param name="address" select="$order/Address[@type='ship']" />
                                </xsl:call-template>
                       </xsl:if>
<xsl:value-of select="$order/Address[@type='ship']/Phone" /><br />
<xsl:value-of select="$order/Address[@type='ship']/Email" /><br />
                           
                       <xsl:if test="not($showAddress)">
                          <font color="#FF0000"><b>Checkout incomplete.</b></font><br />
                          Winning Buyer: <xsl:value-of select="$order/eBay/BuyerID" />
                       </xsl:if>
                        </td>
               </tr>
            </table>
                                                
         </td>
         
         
         <td style="width: 5%; border:0"> </td>
         
         <td id="billaddress" style="width: 47.5%;">
            <table style="width: 100%;" cellspacing="0">
               <tr>
                  <td class="header">
                     Bill To
                  </td>
               </tr>
               
               <tr>
                  <td>
                       <xsl:if test="$showAddress">
                                <xsl:call-template name="formatAddress">
                                    <xsl:with-param name="address" select="$order/Address[@type='bill']" />
                                </xsl:call-template>
                       </xsl:if>

<xsl:value-of select="$order/Address[@type='bill']/Phone" /><br />
<xsl:value-of select="$order/Address[@type='bill']/Email" /><br />


                        </td>
                    </tr>
            </table>
         </td>
      </tr>
   </table>
           
</xsl:template>



Please let us know if you have further questions.

Thanks,

Wes
Interapptive, Inc.
Back to top
View user's profile Visit poster's website
johnwalls



Joined: 14 Dec 2005
Posts: 18

PostPosted: Wed Jan 11, 2006 10:03 am    Post subject: Reply with quote

Ok so I went in and tried to make this work. But to no avail. Heres what I'm trying to do. I'm using the elegant template. And when I print a copy using that template I want it to print 2 copies, one with the Credit Card Number Visible and one with it secure(for shipping)


Besides the security issue with the Credit Card, the other problem is having to print multiple invoices twice (without collate). I know theres a way around this.


Heres my code that only prints one despite the pagebreak and copy:



Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sw="http://www.interapptive.com/shipworks" extension-element-prefixes="sw">

<!--
    Start off with the Base Template
-->
<xsl:import href="System\Base Order Template" />
 
<xsl:output method="html" encoding="utf-8" />

<sw:settings>
    <sw:preview>
        <sw:count>1</sw:count>
    </sw:preview>
    <sw:general>
        <sw:type>standard</sw:type>
        <sw:context>order</sw:context>
    </sw:general>
</sw:settings>

<!--
      The following override the xsl:template's in the base to provide
      image headers for each of the sections.
-->

<xsl:template name="outputPageHeader">
   <div align="center"><img id="imgInvoice" src="http://www.thenewcold.com/header.jpg" /></div>
</xsl:template>



<xsl:template name="outputShipBillHeader">
    <div align="center"><img id="imgBillShip" src="images/billshipping.jpg" /></div>
    <br></br><font size="5"><b>Order Notes:</b></font><br /><xsl:value-of select="//Order/Notes" /><br><br></br></br>
    <font size="5">Shipping Method: </font><strong><xsl:value-of select="//Order/RequestedShipping" /></strong>
   
</xsl:template>

<xsl:template name="outputOrderDetailsHeader">
        <div align="center"><img id="imgOrderInfo" src="images/orderinfo.jpg" /></div>
</xsl:template>

<xsl:template name="outputOrderDetailsFooter">
  <strong>Weight:</strong><br></br> <xsl:value-of select="sum(//Order/Item/Weight)" /> Pounds<br></br><br></br>
  <stong>Payment Details:</stong><br></br>
<xsl:for-each select="//Order/Payment/Detail"> <br></br>
<xsl:value-of select="Label" />:<xsl:value-of select="Value" />
</xsl:for-each>

<xsl:if test="$templateType != 'invoice'">
        <div class="divider" />
    </xsl:if>
</xsl:template>

<xsl:template name="outputOrderTotalsHeader">
    <div align="center"><img id="imgOrderTotals" src="images/ordertotals.jpg" /></div>
</xsl:template>

<xsl:template name="pagebreak">
<div style="page-break-after:always;" />
</xsl:template>

<xsl:template name="outputPageHeader2">
   <div align="center"><img id="imgInvoice" src="http://www.thenewcold.com/header.jpg" /></div>
</xsl:template>



<xsl:template name="outputShipBillHeader2">
    <div align="center"><img id="imgBillShip" src="images/billshipping.jpg" /></div>
    <br></br><font size="5"><b>Order Notes:</b></font><br /><xsl:value-of select="//Order/Notes" /><br><br></br></br>
    <font size="5">Shipping Method: </font><strong><xsl:value-of select="//Order/RequestedShipping" /></strong>
   
</xsl:template>

<xsl:template name="outputOrderDetailsHeader2">
        <div align="center"><img id="imgOrderInfo" src="images/orderinfo.jpg" /></div>
</xsl:template>

<xsl:template name="outputOrderDetailsFooter2">
  <strong>Weight:</strong><br></br> <xsl:value-of select="sum(//Order/Item/Weight)" /> Pounds<br></br><br></br>
  <stong>Payment Details:</stong><br></br>
<xsl:for-each select="//Order/Payment/Detail"> <br></br>
<xsl:value-of select="Label" />:<xsl:value-of select="Value" />
</xsl:for-each>

<xsl:if test="$templateType != 'invoice'">
        <div class="divider" />
    </xsl:if>
</xsl:template>

<xsl:template name="outputOrderTotalsHeader2">
    <div align="center"><img id="imgOrderTotals" src="images/ordertotals.jpg" /></div>
</xsl:template>

</xsl:stylesheet>
Back to top
View user's profile
johnwalls



Joined: 14 Dec 2005
Posts: 18

PostPosted: Mon Jan 16, 2006 2:12 pm    Post subject: Reply with quote

bump
Back to top
View user's profile
Wes
Site Admin


Joined: 07 Oct 2002
Posts: 7427

PostPosted: Mon Jan 16, 2006 2:41 pm    Post subject: Reply with quote

Hello,

Would using an action that prints two copies or even two separate template be an option for you? You can setup an action in ShipWorks to complete a task after an event has occured, such as a shipment being processed, or an order being downloaded. There is a task available for printing your specified template, as well as how many copies you would like printed.

Thanks,

Wes
Interapptive, Inc.
Back to top
View user's profile Visit poster's website
johnwalls



Joined: 14 Dec 2005
Posts: 18

PostPosted: Tue Jan 17, 2006 7:18 am    Post subject: Reply with quote

Like the new web design, nice.

I took a look at the actions, it doesnt look like that would work for us, since alot is printed on demand.
Back to top
View user's profile
johnwalls



Joined: 14 Dec 2005
Posts: 18

PostPosted: Thu Jan 26, 2006 2:07 pm    Post subject: Reply with quote

Bump
Back to top
View user's profile
Wes
Site Admin


Joined: 07 Oct 2002
Posts: 7427

PostPosted: Fri Jan 27, 2006 8:18 am    Post subject: Reply with quote

Hello,

To achieve your desired results, you may need to make your template all-inclusive. That is, design/code it as an all-in-one template, without referencing other templates. I have included a VERY basic example below of how page-breaks can work for you, and how some data on certain pages can be different than on others.

Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sw="http://www.interapptive.com/shipworks" extension-element-prefixes="sw">
<xsl:import href="System\Common" />

<xsl:output method="html" encoding="utf-8" />

<sw:settings>
</sw:settings>

<xsl:template match="/">
<html>

<head>
    <title>Interapptive ShipWorks Template</title>
   
    <!-- CSS -->
    <style>
        body {font-family: Tahoma; font-size: 10pt;}
        span.example {color: blue; font-weight: bold;}
    </style>
</head>

<body>
    <!-- first page -->
    <table>
    <tr><td>Template With Page Break</td></tr>
    <tr><td><xsl:value-of select="//Order/Number" /></td></tr>
    <tr><td>
   
    <xsl:for-each select="//Order/Item">
        Item: <xsl:value-of select="Name" /><br />
        Quantity: <xsl:value-of select="Quantity" /><br />
    </xsl:for-each>
   
    </td></tr>
    </table>
   
    <div style="page-break-after:always" />
   
    <!-- second page -->
    <table>
    <tr><td>Template With Page Break</td></tr>
    <tr><td><xsl:value-of select="//Order/Number" /></td></tr>
    <tr><td>
   
    <xsl:for-each select="//Order/Item">
        Item: <xsl:value-of select="Name" /><br />
        Quantity: <xsl:value-of select="Quantity" /><br />
    </xsl:for-each>
   
    <tr><td>Demo of items showing only on the second page.</td></tr>
   
    </td></tr>
    </table>
</body>

</html>

</xsl:template>
</xsl:stylesheet>


If you would like us to work on your custom template for you, you can purchase a custom template through your My Account page on our website.

Please let us know if you have further questions.

Thanks,

Wes
Interapptive, Inc.
Back to top
View user's profile Visit poster's website
webrabb



Joined: 05 Oct 2004
Posts: 20

PostPosted: Wed Feb 22, 2006 7:43 am    Post subject: two page template - inv/pack slips combined Reply with quote

I didn't understand the last response.

In simple terms, I would like to have my invoice print two pages, the second without the cc info or pricing. Currently I print them separately one invoice and one packing slip.
Back to top
View user's profile Visit poster's website
johnwalls



Joined: 14 Dec 2005
Posts: 18

PostPosted: Wed Feb 22, 2006 8:16 am    Post subject: Reply with quote

I succesfully have this setup webrabb, drop me and email and ill zip you up some folders.
Bio@thenewcold.com
Back to top
View user's profile
Brandon



Joined: 14 Nov 2005
Posts: 1122

PostPosted: Wed Feb 22, 2006 4:46 pm    Post subject: Re: two page template - inv/pack slips combined Reply with quote

[quote="webrabb"]I didn't understand the last response.

In simple terms, I would like to have my invoice print two pages, the second without the cc info or pricing. Currently I print them separately one invoice and one packing slip.[/quote]

If you look at Wes' code he posted, he has a line in there

[code]<div style="page-break-after:always" /> [/code]

That is the HTML (or XSL) equivelant to a "page break", so anything after that will be on start a new page. I hope that answers your question[/code]
Back to top
View user's profile
Brian
ShipWorks Staff


Joined: 30 Jul 2004
Posts: 3608

PostPosted: Wed Feb 22, 2006 7:22 pm    Post subject: Reply with quote

Just to clarify, the <div /> tag, which is shorthand for <div></div>, is an HTML tag.

The style="page-break-after:always" attribute on it is CSS (Cascading Style Sheets).

Brian
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic     Forum Index » Templates All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  

Powered by phpBB © 2001, 2002 phpBB Group