IFとWHENを利用したXML/XSLTドキュメントを作成する必要があります。 XML/XSLTに慣れていないにもかかわらず、私はPHPでこの文をよく知っています(ただし/ else)。例えばXML IfとWhens?
私は製品を持って、製品は、2名の可能性があります。 1)ラミネート名刺 2)名刺
それはオプション1だ場合、私は、カスタムの値を取得する必要がありますそのためのオプションなどのようにそれをエコー:
<xsl:choose>
<xsl:when test="custom_options/option[name='Lamination Options (Your printing looks great unlaminated, if you wish you can add gloss or matt lamination below)']/value='Matt Lamination (Both sides)'">
<Extrinsic name="Laminating?">Matt Lam DS SRA3</Extrinsic>
</xsl:when>
<xsl:when test="custom_options/option[name='Lamination Options (Your printing looks great unlaminated, if you wish you can add gloss or matt lamination below)']/value='Gloss Lamination (Both sides)'">
<Extrinsic name="Laminating?">Gloss Lam DS SRA3</Extrinsic>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
だから私はそれが単語のラミネートが含まれている場合ので、もし、if文if文異なっを実行しない場合は、別のものを実行し、製品の名前を確認する必要がありますそれはPHPのようになります:
<?php $product = "Laminated Business Cards";
if(strpos($product,'Laminated')){
if(value of custom option == 'Matt Laminated'){
echo "Matt Lam";
} elseif(value of custom option == 'Gloss Laminated'){
echo "Gloss Lam";
} else echo "No Lamination";
} elseif(value of custom option == 'Matt Laminated +2days'){
echo "Matt Lam";
} elseif(value of custom option == 'Gloss Laminated +2days'){
echo "Gloss Lam";
} else
echo "No Lamination";
?>
だから私は、XSLT/XMLでそれを再現する必要があります。私はそれがちょっと面倒だと知っていますが、私はこのルートをとる以外に、ほとんど設計されていないシステムの制約の中で働いています。
乾杯。
これはMagentoとはまったく関係ありません。厳密にはXML/XSLTの質問です。 – benmarks
Magentoを追加したのは、そこに「Custom Options」という言葉があり、人々を混乱させたくないからです。 –
Magentoを混乱を防ぐために追加していますか? :-D – benmarks