Warning: file_put_contents() [function.file-put-contents]: Only 0 of 196 bytes written, possibly out of free disk space in /disk2/home/symphonyweb/public_html/extensions/xmlfield/fields/field.xml.php on line 63
“PagSeguro” – XSLT Utilities – Download – Symphony.
Author:
jgfraga
Version:
0.1
Release Date:
31 Mar 2011
Category:
Third-Party Integration

Description

Integration with PagSeguro API.

Use PagSeguro to receive money and sell products to your users.

Requires string-replace utility.

XSLT

View Raw
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:import href="../utilities/string-replace.xsl"/>
    <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>

    <!--
        TO USE, CALL TEMPLATE LIKE SO...

        <xsl:call-template name="pagseguro">
            <xsl:with-param name="email_cobranca" select="'seuemail@dominio.com'"/>
            <xsl:with-param name="item_id" select="ID_UNICO"/>
            <xsl:with-param name="item_descr" select="Descrição do produto"/>
            <xsl:with-param name="item_valor" select="VALOR_DO_PRODUTO"/>
        </xsl:call-template>
    -->

<xsl:template name="pagseguro">
        <xsl:param name="email_cobranca"/>
        <xsl:param name="item_id"/>
        <xsl:param name="item_descr"/>
        <xsl:param name="tipo" select="'CBR'"/>

        <xsl:param name="moeda" select="'BRL'"/>
        <xsl:param name="item_quant" select="'1'"/>
        <xsl:param name="peso" select="'0'"/>
        <xsl:param name="frete" select="'0'"/>
        <xsl:param name="item_valor" />

        <xsl:param name="valor">
            <xsl:call-template name="string-replace">
              <xsl:with-param name="haystack">
                    <xsl:call-template name="string-replace">

                      <xsl:with-param name="haystack">
                         <xsl:call-template name="string-replace">
                              <xsl:with-param name="haystack">
                                 <xsl:call-template name="string-replace">
                                      <xsl:with-param name="haystack" select="$item_valor" />
                                      <xsl:with-param name="search" select="' '" />
                                      <xsl:with-param name="replace" select="''" />
                                    </xsl:call-template>
                              </xsl:with-param>

                              <xsl:with-param name="search" select="'R$'" />
                              <xsl:with-param name="replace" select="''" />
                            </xsl:call-template>
                      </xsl:with-param>
                      <xsl:with-param name="search" select="'.'" />
                      <xsl:with-param name="replace" select="''" />
                    </xsl:call-template>
              </xsl:with-param>
              <xsl:with-param name="search" select="','" />

              <xsl:with-param name="replace" select="''" />
            </xsl:call-template>
        </xsl:param>

        <xsl:variable name="select_count" select="'0'" />

        <div class="pagseguro-form">

            <!-- INICIO FORMULARIO BOTAO PAGSEGURO -->
            <form target="pagseguro" class="pagseguro" id="pagseguro_{$item_id}" method="post" action="https://pagseguro.uol.com.br/checkout/checkout.jhtml">
              <input type="hidden" name="email_cobranca" value="{$email_cobranca}" />
              <input type="hidden" name="tipo" value="{$tipo}" />

              <input type="hidden" name="moeda" value="{$moeda}" />
              <input type="hidden" name="item_id" value="{$item_id}" />
              <input type="hidden" name="value_item_quant" class="value_item_quant" value="{$item_quant}" />
              <select name="item_quant" class="item_quant">
                <option value="1">Quantidade</option>
              </select>
              <input type="hidden" name="item_valor" value="{$valor}" />
              <input type="hidden" name="frete" value="{$frete}" />

              <input type="hidden" name="peso" value="{$peso}" />
              <input type="hidden" name="item_descr" value="{$item_descr}" maxlength="90" />
              <input type="hidden" name="encoding" value="utf-8" />
            </form>
            <!-- FINAL FORMULARIO BOTAO PAGSEGURO -->
        </div>
    </xsl:template>

</xsl:stylesheet>

Discuss this XSLT Utility

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details