我试图打印产品变体的产品标签,每个变体都有变体属性,如大小和颜色。对我来说,它只为每个变体打印一个变体属性,如仅尺寸或仅颜色,任何想法如何打印multipe?
显示我的问题的图片链接
http://s1.postimg.org/oopgmal67/product_label.png
xml文件
<?xml version="1.0" encoding="ISO-8859-1"?>
<lots>
<lot-line type="fields" name="id">
<code type="field" name="code"/>
<product type="field" name="name"/>
<variant type="field" name="attribute_value_ids.name"/>
<price type="field" name="list_price"/>
<ean13 type="field" name="ean13"/>
<currency type="field" name="company_id.currency_id.name"/>
</lot-line>
</lots>
任何帮助将不胜感激
由于
答案 0 :(得分:4)
product_label.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<lots>
<lot-line type="fields" name="id">
<code type="field" name="default_code"/>
<product type="field" name="name"/>
<price type="field" name="list_price"/>
<ean13 type="field" name="ean13"/>
<company type="field" name="company_id.name"/>
<currency type="field" name="company_id.currency_id.name"/>
<attribute_value_ids type="zoom" name="attribute_value_ids">
<attribute_value_ids_name type="field" name="name"/>
</attribute_value_ids>
</lot-line>
</lots>
你还需要对product_label.xsl进行一些更改
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:variable name="initial_bottom_pos">0.1</xsl:variable>
<xsl:variable name="initial_left_pos">0.1</xsl:variable>
<xsl:variable name="height_increment">0</xsl:variable>
<xsl:variable name="width_increment">0</xsl:variable>
<xsl:variable name="frame_width">10.00cm</xsl:variable>
<xsl:variable name="frame_height">3.6cm</xsl:variable>
<xsl:variable name="number_columns">1</xsl:variable>
<xsl:variable name="max_frames">8</xsl:variable>
<xsl:template match="/">
<xsl:apply-templates select="lots"/>
</xsl:template>
<xsl:template match="lots">
<document>
<template pageSize="(10.00cm,3.60cm)" leftMargin="0.2cm" rightMargin="0.2cm" topMargin="1.5cm" bottomMargin="0.0cm" title="Address list" author="Generated by SnippetBucket.com">
<pageTemplate id="all">
<pageGraphics/>
<xsl:apply-templates select="lot-line" mode="frames "/>
</pageTemplate>
</template>
<stylesheet>
<paraStyle name="nospace" fontName="Courier" fontSize="10" spaceBefore="0" spaceAfter="0"/>
<blockTableStyle id="mytable">
<blockBackground colorName="white" start="0,0" stop="0,0"/>
<blockBackground colorName="lightgrey" start="1,0" stop="-1,0"/>
<blockAlignment value="CENTER"/>
<blockValign value="MIDDLE"/>
<blockFont name="Helvetica-BoldOblique" size="10" start="0,0" stop="-1,0"/>
<blockFont name="Helvetica" size="8" start="0,1" stop="-1,1"/>
<lineStyle kind="GRID" colorName="black" tickness="1"/>
</blockTableStyle>
</stylesheet>
<story>
<xsl:apply-templates select="lot-line" mode="story"/>
</story>
</document>
</xsl:template>
<xsl:template match="lot-line" mode="frames">
<xsl:if test="position() < $max_frames + 1">
<!-- <frame break-before="page"> -->
<frame>
<xsl:attribute name="width">
<xsl:value-of select="$frame_width"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="$frame_height"/>
</xsl:attribute>
<xsl:attribute name="x1">
<xsl:value-of select="$initial_left_pos + ((position()-1) mod $number_columns) * $width_increment"/>
<xsl:text>cm</xsl:text>
</xsl:attribute>
<xsl:attribute name="y1">
<xsl:value-of select="$initial_bottom_pos - floor((position()-1) div $number_columns) * $height_increment"/>
<xsl:text>cm</xsl:text>
</xsl:attribute>
</frame>
</xsl:if>
</xsl:template>
<xsl:param name="pmaxChars" as="xs:integer" select="80"/>
<xsl:template match="lot-line" mode="story">
<blockTable style="mytable" colWidths="7.20cm,2.2cm" >
<tr>
<td>
<para style="nospace">Code: <xsl:value-of select="code"/></para>
<para style="nospace">Price: <xsl:value-of select="price"/></para>
</td>
// u need to copy this column on your file
<td>
<para style="nospace"><xsl:value-of select="substring(product, 1, pmaxChars)"/></para><xsl:text>, </xsl:text>
<para style="nospace"><xsl:apply-templates select="attribute_value_ids"/></para>
</td>
</tr>
<tr>
<td colspan="2">
<barCode message="123456789">
<ean-13>
<xsl:value-of select="ean13" />
</ean-13>
</barCode>
<para style="nospace"><xsl:value-of select="ean13"/></para>
</td>
<td></td>
</tr>
</blockTable>
</xsl:template>
</xsl:stylesheet>