Jump to content

Ean sur facture (ps : 1.5 )


Recommended Posts

Bonjour,

Je voudrai ajouter un code barre comme numero de facture et aussi pur chaque produit , cela permetterai de pas trop chercher dans les bases compta les clients et les produits

 

Alors j'ai chercher un peu partout, mes pour la version 1.5 je n'est trouver , alors si quelqu'un a une petit idée ?

 

 

Merci d'avance

Link to comment
Share on other sites

  • 1 year later...

Il affichera le code EAN13 sous forme de texte. Nul ont réagi parce qu'il n'y a pas de moyen facile comment ajouter code à barres dans PrestaShop. Le module M4 PDF Extensions peut le faire dans un tag:

 

It will display EAN13 code as text. No one have responded because there is no easy way how to add barcode in PrestaShop. The M4 PDF Extensions module can do it in one tag:

 

<barcode code="{$product[products].ean13}" type="EAN13" height="0.4" class="barcode" />

Link to comment
Share on other sites

  • 3 years later...

Il affichera le code EAN13 sous forme de texte. Nul ont réagi parce qu'il n'y a pas de moyen facile comment ajouter code à barres dans PrestaShop. Le module M4 PDF Extensions peut le faire dans un tag:

 

It will display EAN13 code as text. No one have responded because there is no easy way how to add barcode in PrestaShop. The M4 PDF Extensions module can do it in one tag:

 

<barcode code="{$product[products].ean13}" type="EAN13" height="0.4" class="barcode" />

Bonjour Tuk66,

j'ai intégré ce code dans "catalogue" et cela fonctionne mais pas pour les "attributes"

Si vous avez la solution.....

merci

suis sous 1.6.0.13

 

Link to comment
Share on other sites

Essayez d'utiliser

Try to use

 

<barcode code="{$products.product_attribute[attributes].ean13}" type="EAN13" height="0.4" class="barcode" />

J'ai essayé mais ca ne fonctionne pas ou alors, je ne vois pas où le placer.

pour le moment ca donne ca: voir image EANM4P et pour le code:

 


post-302438-0-13827400-1487085372_thumb.png

<!--

    name="{l s='Catalog with attributes and features greg' mod='m4pdf'}"

    data="product"

-->

<head>

{literal}

    <style>

        @page {

            sheet-size: A4;

            margin-top: 10mm;

            margin-bottom: 15mm;

            margin-left: 15mm;

            margin-right: 15mm;

            margin-header: 6mm;

            margin-footer: 6mm;

            background-image: url('tpl/my_backgroundcatalogue_image.jpg');

            background-repeat: no-repeat;

background-position : center center;

background-attachment: fixed;

            background-size: cover;

        }

        @page header {

            odd-header-name: html_header1;

            even-header-name: html_header1;

            odd-footer-name: html_footer1;

            even-footer-name: html_footer1;

        }

        body {

            font-size: 11px;

            font-family: sans;

            font-weight: normal;

            color: black;

            background-color: white;

        }

        h1, h2, h3, h4, h5, h6, p, div, th, td {

            vertical-align: top;

        }

        h1 {

            font-size: 16px;

            text-align: center;

            clear: both;

            margin-bottom: 4mm;

        }

        .header {

            width: 100%;

            vertical-align: top;

            font-family: sans;

            font-size: 11px;

            color: #656565;

        }

        .footer {

            width: 100%;

            vertical-align: top;

            font-family: sans;

            font-size: 11px;

            color: #656565;

        }

        .catalog {

            font-family: sans;

            font-size: 34px;

            font-weight: bold;

            color: #C6C3BE

            text-align: right;

            padding-top: 40mm;

            padding-bottom: 60mm;

        }

        .name {

            font-family: sans;

            font-size: 16px;

            font-weight: bold;

            background-color: #CED5DA;

            text-align: left;

            padding: 0.7mm;

        }

        .photo {

            margin: 4mm;

            width: 20% !important;

            max-height: 50mm !important;

        }

        .left {float: left;}

        .right {float: right;}

        .align-left {text-align: left;}

        .align-center {text-align: center;}

        .align-right {text-align: right;}

        .clear {clear: both;}

        .clear-left {clear: left;}

        .clear-right {clear: right;}

        .zero {margin: 0; padding: 0;}

        .bold {font-weight: bold;}

        .italic {font-style: italic;}

        .smaller {font-size: 80%;}

        .bigger {font-size: 120%;}

        .w5 {width: 5%;}

        .w10 {width: 10%;}

        .w20 {width: 20%;}

        .w30 {width: 30%;}

        .w40 {width: 40%;}

        .w50 {width: 50%;}

        .w60 {width: 60%;}

        .w70 {width: 70%;}

        .w80 {width: 80%;}

        .w90 {width: 90%;}

        .w100 {width: 100%;}

 

        /* For Table of Contents */

        div.mpdf_toc {

            font-size: 11px;

        }

        a.mpdf_toc_a {

            text-decoration: none;

            color: black;

        }

        div.mpdf_toc_level_0 {        /* Whole line level 0 */

            line-height: 1.5;

            margin-left: 0;

            padding-right: 2em;    /* should match e.g <dottab outdent="2em" /> 0 is default */

        }

        span.mpdf_toc_t_level_0 {    /* Title level 0 - may be inside <a> */

            font-weight: bold;

        }

        span.mpdf_toc_p_level_0 {    /* Page no. level 0 - may be inside <a> */

        }

        div.mpdf_toc_level_1 {        /* Whole line level 1 */

            margin-left: 2em;

            text-indent: -2em;

            padding-right: 2em;    /* should match <dottab outdent="2em" /> 2em is default */

        }

        span.mpdf_toc_t_level_1 {    /* Title level 1 */

            font-style: italic;

            font-weight: bold;

        }

        span.mpdf_toc_p_level_1  {    /* Page no. level 1 - may be inside <a> */

        }

        div.mpdf_toc_level_2 {        /* Whole line level 2 */

            margin-left: 4em;

            text-indent: -2em;

            padding-right: 2em;    /* should match <dottab outdent="2em" /> 2em is default */

        }

        span.mpdf_toc_t_level_2 {    /* Title level 2 */

        }

        span.mpdf_toc_p_level_2 {    /* Page no. level 2 - may be inside <a> */

        }

    </style>

{/literal}

</head>

<body>

 

{if $conf.cloud}

    {assign var="force_protocol" value="http"}

{else}

    {assign var="force_protocol" value=""}

{/if}

 

<!--mpdf

    <htmlpageheader name="header1">

    <div class="header zero">

        

    </div>        

    </htmlpageheader>

    

    <htmlpagefooter name="footer1">

        <hr />

        <div class="left w80">{$conf.shop_www}     {$conf.shop_email}     {l s='phone:' mod='m4pdf'} {$conf.shop_phone}</div>

        <div class="right align-right w10">{ldelim}PAGENO{rdelim}</div>

    </htmlpagefooter>

mpdf-->

 

 

 

<div class="right align-right">

    <h1 class="catalog">{l s='Product Catalog' mod='m4pdf'}</h1>

    <h3 class="bigger">{$conf.shop_name}</h3>

    <p>{$conf.shop_addr1}<br />

    {$conf.shop_city}</p>

    <p>{$conf.shop_www}<br />

    {$conf.shop_email}<br />

    {$conf.shop_phone}</p>

</div>

<pagebreak page-selector="header" />

 

<!--mpdf

    <sethtmlpageheader name="header1" page="O" value="on" show-this-page="1" />

    <sethtmlpagefooter name="footer1" page="O" value="on" show-this-page="1" />

mpdf-->

 

<tocpagebreak

    font="sans" font-size="10" indent="5" margin-top="55mm"

    paging="on" links="on" suppress="off" pagenumstyle="1"

    toc-preHTML="<h2>{l s='Contents' mod='m4pdf'}</h2>"

/>

 

 

<!--mpdf

    <sethtmlpageheader name="header1" page="O" value="on" show-this-page="1" />

    <sethtmlpagefooter name="footer1" page="O" value="on" show-this-page="1" />

mpdf-->

 

{section name=products loop=$product}

<table autosize="1" class="w100" style="page-break-inside:avoid">    

    <tr>

        <td colspan=2 class="w100 name">

            {$product[products].name|escape:'htmlall':'UTF-8'}<tocentry content="{$product[products].name|escape:'htmlall':'UTF-8'}" level="0" />

        </td>

    </tr>

    <tr>

        <td width="20%">

            {assign var="id_product_id_image" value="`$product[products].id_product`-`$product[products].image.id_image`"}

            <img class="photo" src="{if $product[products].image.id_image}{imageLink name=$product[products].link_rewrite ids=$id_product_id_image force_protocol=$force_protocol}{else}{$conf.img_prod_dir}{$conf.pdf_iso_lang}.jpg{/if}" />

        </td>

        <td>

        <br />

        <div class="w100">{l s='Reference (Si autres conditionnements voir ci-dessous):' mod='m4pdf'} {$product[products].reference}</div>

        <br />

        <div><barcode code="{$product[products].ean13}" type="EAN13" height="0.4" class="barcode" /></div>

        <br />

            <div>{$product[products].description_short}</div>

            <br />

            <div>{$product[products].description}</div>

            

            

            {* start product attributes *}

            {assign var="changed_product_attribute" value=0}

            {if $product[products].product_attribute}

                <br />

                <table autosize="1" class="w100" style="page-break-inside:avoid">

                {section name=attributes loop=$product[products].product_attribute}

                    {* end of the row - other than last iterations, use $saved *}

                    {if $changed_product_attribute != $product[products].product_attribute[attributes].id_product_attribute && !$smarty.section.attributes.first}

                            {if $saved.reference}

                                <span>{l s='Reference:' mod='m4pdf'} {$saved.reference}</span>,

                        {/if}

                            

                        </td>

                    </tr>

                    {/if}

                    

                    {* start of the row *}

                    {if $changed_product_attribute != $product[products].product_attribute[attributes].id_product_attribute}

                    <tr>

                        <td style="padding-top: 1mm">

                    {/if}

                    

                    {if $changed_product_attribute != $product[products].product_attribute[attributes].id_product_attribute}

                        {assign var="changed_product_attribute" value=$product[products].product_attribute[attributes].id_product_attribute}

                    {/if}

                    

                    {* attributes and groups *}

                    <span>{$product[products].product_attribute[attributes].attribute_group.name}: {$product[products].product_attribute[attributes].attribute.name}</span>,

                    {assign var="saved" value=$product[products].product_attribute[attributes]}

                    

                    {* end of the row - last iteration *}

                    {if $smarty.section.attributes.last}

                            {if $product[products].product_attribute[attributes].reference}

                                <span>{l s='Reference:' mod='m4pdf'} {$product[products].product_attribute[attributes].reference}</span>,

                            {/if}

                            {if $product[products].product_attribute[attributes].ean13}

                                <span>{l s='Ean:' mod='m4pdf'} {$product[products].product_attribute[attributes].ean13}</span>,

                            {/if}

                            <barcode code="{$products.product_attribute[attributes].ean13}" type="EAN13" height="0.4" class="barcode" />

                        </td>

                    </tr>

                    {/if}

                {/section}

                </table>

            {/if}

            {* end product attributes *}

            

            {* start product features *}

            {if $product[products].product_feature}

                <br />

                <table autosize="1" class="w100" style="page-break-inside:avoid">

                {section name=features loop=$product[products].product_feature}

                    <tr>

                        <td style="padding-right: 8mm"><strong>{$product[products].product_feature[features].name|escape:'htmlall':'UTF-8'}:</strong></td>

                        <td>{$product[products].product_feature[features].value|escape:'htmlall':'UTF-8'}</td>

                    </tr>

                {/section}

                </table>

            {/if}

            {* end product features *}

            

        </td>

    </tr>

   

</table>

{sectionelse}

    <p>

        {l s='no products' mod='m4pdf'}

    </p>    

{/section}

 

    

</body>

 

Edited by equide-store (see edit history)
Link to comment
Share on other sites

Je voudrais le changer pour:

I would change it to:

{if $product[products].product_attribute[attributes].ean13}
    <span>{l s='Ean:' mod='m4pdf'} {$product[products].product_attribute[attributes].ean13}</span>,
    <barcode code="{$products.product_attribute[attributes].ean13}" type="EAN13" height="0.4" class="barcode" />
{/if}

...

{if $saved.reference}
    <span>{l s='Reference:' mod='m4pdf'} {$saved.reference}</span>,
    <barcode code="{$saved.ean13}" type="EAN13" height="0.4" class="barcode" />
{/if}
Link to comment
Share on other sites

 

Je voudrais le changer pour:

I would change it to:

{if $product[products].product_attribute[attributes].ean13}
    <span>{l s='Ean:' mod='m4pdf'} {$product[products].product_attribute[attributes].ean13}</span>,
    <barcode code="{$products.product_attribute[attributes].ean13}" type="EAN13" height="0.4" class="barcode" />
{/if}

...

{if $saved.reference}
    <span>{l s='Reference:' mod='m4pdf'} {$saved.reference}</span>,
    <barcode code="{$saved.ean13}" type="EAN13" height="0.4" class="barcode" />
{/if}

Ca avance mais il ne prend pas toutesles declinaisons (attribute) en jaune

post-302438-0-52072300-1487087537_thumb.png

Link to comment
Share on other sites

Le code à barres doit être à côté de toutes les occurrences de "reference", puis remplacer "reference" par "ean13".

 

The barcode must be beside all occurrences of "reference", and then replace "reference" with "ean13".

Avec ca il manque n'affiche toujours pas les 2 autres attributes:

                    {* end of the row - last iteration *}

                    {if $smarty.section.attributes.last}

                            {if $product[products].product_attribute[attributes].reference}

                                <span>{l s='Reference:' mod='m4pdf'} {$product[products].product_attribute[attributes].reference}</span>,

                            {/if}

                            {if $saved.ean13}

    <span>{l s='EAN:' mod='m4pdf'} {$saved.ean13}</span>,

    <barcode code="{$saved.ean13}" type="EAN13" height="0.4" class="barcode" />

{/if}

                        </td>

                    </tr>

                    {/if}

post-302438-0-15636600-1487090301_thumb.png

Link to comment
Share on other sites

Voila ca fonctionne avec ce code:
<!--
    name="{l s='Catalog with attributes and features greg' mod='m4pdf'}"
    data="product"
-->
<head>
{literal}
    <style>
        @page {
            sheet-size: A4;
            margin-top: 10mm;
            margin-bottom: 15mm;
            margin-left: 15mm;
            margin-right: 15mm;
            margin-header: 6mm;
            margin-footer: 6mm;
            background-image: url('tpl/my_backgroundcatalogue_image.jpg');
            background-repeat: no-repeat;
background-position : center center;
background-attachment: fixed;
            background-size: cover;
        }
        @page header {
            odd-header-name: html_header1;
            even-header-name: html_header1;
            odd-footer-name: html_footer1;
            even-footer-name: html_footer1;
        }
        body {
            font-size: 11px;
            font-family: sans;
            font-weight: normal;
            color: black;
            background-color: white;
        }
        h1, h2, h3, h4, h5, h6, p, div, th, td {
            vertical-align: top;
        }
        h1 {
            font-size: 16px;
            text-align: center;
            clear: both;
            margin-bottom: 4mm;
        }
        .header {
            width: 100%;
            vertical-align: top;
            font-family: sans;
            font-size: 11px;
            color: #656565;
        }
        .footer {
            width: 100%;
            vertical-align: top;
            font-family: sans;
            font-size: 11px;
            color: #656565;
        }
        .catalog {
            font-family: sans;
            font-size: 34px;
            font-weight: bold;
            color: #C6C3BE
            text-align: right;
            padding-top: 40mm;
            padding-bottom: 60mm;
        }
        .name {
            font-family: sans;
            font-size: 16px;
            font-weight: bold;
            background-color: #CED5DA;
            text-align: left;
            padding: 0.7mm;
        }
        .photo {
            margin: 4mm;
            width: 20% !important;
            max-height: 50mm !important;
        }
        .left {float: left;}
        .right {float: right;}
        .align-left {text-align: left;}
        .align-center {text-align: center;}
        .align-right {text-align: right;}
        .clear {clear: both;}
        .clear-left {clear: left;}
        .clear-right {clear: right;}
        .zero {margin: 0; padding: 0;}
        .bold {font-weight: bold;}
        .italic {font-style: italic;}
        .smaller {font-size: 80%;}
        .bigger {font-size: 120%;}
        .w5 {width: 5%;}
        .w10 {width: 10%;}
        .w20 {width: 20%;}
        .w30 {width: 30%;}
        .w40 {width: 40%;}
        .w50 {width: 50%;}
        .w60 {width: 60%;}
        .w70 {width: 70%;}
        .w80 {width: 80%;}
        .w90 {width: 90%;}
        .w100 {width: 100%;}

        /* For Table of Contents */
        div.mpdf_toc {
            font-size: 11px;
        }
        a.mpdf_toc_a {
            text-decoration: none;
            color: black;
        }
        div.mpdf_toc_level_0 {        /* Whole line level 0 */
            line-height: 1.5;
            margin-left: 0;
            padding-right: 2em;    /* should match e.g <dottab outdent="2em" /> 0 is default */
        }
        span.mpdf_toc_t_level_0 {    /* Title level 0 - may be inside <a> */
            font-weight: bold;
        }
        span.mpdf_toc_p_level_0 {    /* Page no. level 0 - may be inside <a> */
        }
        div.mpdf_toc_level_1 {        /* Whole line level 1 */
            margin-left: 2em;
            text-indent: -2em;
            padding-right: 2em;    /* should match <dottab outdent="2em" /> 2em is default */
        }
        span.mpdf_toc_t_level_1 {    /* Title level 1 */
            font-style: italic;
            font-weight: bold;
        }
        span.mpdf_toc_p_level_1  {    /* Page no. level 1 - may be inside <a> */
        }
        div.mpdf_toc_level_2 {        /* Whole line level 2 */
            margin-left: 4em;
            text-indent: -2em;
            padding-right: 2em;    /* should match <dottab outdent="2em" /> 2em is default */
        }
        span.mpdf_toc_t_level_2 {    /* Title level 2 */
        }
        span.mpdf_toc_p_level_2 {    /* Page no. level 2 - may be inside <a> */
        }
    </style>
{/literal}
</head>
<body>

{if $conf.cloud}
    {assign var="force_protocol" value="http"}
{else}
    {assign var="force_protocol" value=""}
{/if}

<!--mpdf
    <htmlpageheader name="header1">
    <div class="header zero">
        
    </div>        
    </htmlpageheader>
    
    <htmlpagefooter name="footer1">
        <hr />
        <div class="left w80">{$conf.shop_www}     {$conf.shop_email}     {l s='phone:' mod='m4pdf'} {$conf.shop_phone}</div>
        <div class="right align-right w10">{ldelim}PAGENO{rdelim}</div>
    </htmlpagefooter>
mpdf-->



<div class="right align-right">
    <h1 class="catalog">{l s='Product Catalog' mod='m4pdf'}</h1>
    <h3 class="bigger">{$conf.shop_name}</h3>
    <p>{$conf.shop_addr1}<br />
    {$conf.shop_city}</p>
    <p>{$conf.shop_www}<br />
    {$conf.shop_email}<br />
    {$conf.shop_phone}</p>
</div>
<pagebreak page-selector="header" />

<!--mpdf
    <sethtmlpageheader name="header1" page="O" value="on" show-this-page="1" />
    <sethtmlpagefooter name="footer1" page="O" value="on" show-this-page="1" />
mpdf-->

<tocpagebreak
    font="sans" font-size="10" indent="5" margin-top="55mm"
    paging="on" links="on" suppress="off" pagenumstyle="1"
    toc-preHTML="<h2>{l s='Contents' mod='m4pdf'}</h2>"
/>


<!--mpdf
    <sethtmlpageheader name="header1" page="O" value="on" show-this-page="1" />
    <sethtmlpagefooter name="footer1" page="O" value="on" show-this-page="1" />
mpdf-->

{section name=products loop=$product}
<table autosize="1" class="w100" style="page-break-inside:avoid">    
    <tr>
        <td colspan=2 class="w100 name">
            {$product[products].name|escape:'htmlall':'UTF-8'}<tocentry content="{$product[products].name|escape:'htmlall':'UTF-8'}" level="0" />
        </td>
    </tr>
    <tr>
        <td width="20%">
            {assign var="id_product_id_image" value="`$product[products].id_product`-`$product[products].image.id_image`"}
            <img class="photo" src="{if $product[products].image.id_image}{imageLink name=$product[products].link_rewrite ids=$id_product_id_image force_protocol=$force_protocol}{else}{$conf.img_prod_dir}{$conf.pdf_iso_lang}.jpg{/if}" />
        </td>
        <td>
        <br />
        <div class="w100">{l s='Reference (Si autres conditionnements voir ci-dessous):' mod='m4pdf'} {$product[products].reference}</div>
        <br />
        <div><barcode code="{$product[products].ean13}" type="EAN13" height="0.4" class="barcode" /></div>
        
        <br />
            <div>{$product[products].description_short}</div>
            <br />
            <div>{$product[products].description}</div>
            
            
            {* start product attributes *}
            {assign var="changed_product_attribute" value=0}
            {if $product[products].product_attribute}
                <br />
                <table autosize="1" class="w100" style="page-break-inside:avoid">
                {section name=attributes loop=$product[products].product_attribute}
                    {* end of the row - other than last iterations, use $saved *}
                    {if $changed_product_attribute != $product[products].product_attribute[attributes].id_product_attribute && !$smarty.section.attributes.first}
                            {if $saved.reference}
                                <span>{l s='Reference:' mod='m4pdf'} {$saved.reference}</span>,
                        {/if}
                            {if $saved.ean13}
    <span>{l s='EAN:' mod='m4pdf'} {$saved.ean13}</span>,
    <barcode code="{$saved.ean13}" type="EAN13" height="0.4" class="barcode" />
{/if}
                        </td>
                    </tr>
                    {/if}
                    
                    {* start of the row *}
                    {if $changed_product_attribute != $product[products].product_attribute[attributes].id_product_attribute}
                    <tr>
                        <td style="padding-top: 1mm">
                    {/if}
                    
                    {if $changed_product_attribute != $product[products].product_attribute[attributes].id_product_attribute}
                        {assign var="changed_product_attribute" value=$product[products].product_attribute[attributes].id_product_attribute}
                    {/if}
                    
                    {* attributes and groups *}
                    <span>{$product[products].product_attribute[attributes].attribute_group.name}: {$product[products].product_attribute[attributes].attribute.name}</span>,
                    {assign var="saved" value=$product[products].product_attribute[attributes]}
                    
                    {* end of the row - last iteration *}
                    {if $smarty.section.attributes.last}
                            {if $product[products].product_attribute[attributes].reference}
                                <span>{l s='Reference:' mod='m4pdf'} {$product[products].product_attribute[attributes].reference}</span>,
                            {/if}
                            {if $saved.ean13}
    <span>{l s='EAN:' mod='m4pdf'} {$saved.ean13}</span>,
    <barcode code="{$saved.ean13}" type="EAN13" height="0.4" class="barcode" />
{/if}
                        </td>
                    </tr>
                    {/if}
                {/section}
                </table>
            {/if}
            {* end product attributes *}
            
            {* start product features *}
            {if $product[products].product_feature}
                <br />
                <table autosize="1" class="w100" style="page-break-inside:avoid">
                {section name=features loop=$product[products].product_feature}
                    <tr>
                        <td style="padding-right: 8mm"><strong>{$product[products].product_feature[features].name|escape:'htmlall':'UTF-8'}:</strong></td>
                        <td>{$product[products].product_feature[features].value|escape:'htmlall':'UTF-8'}</td>
                    </tr>
                {/section}
                </table>
            {/if}
            {* end product features *}
            
        </td>
    </tr>
   
</table>
{sectionelse}
    <p>
        {l s='no products' mod='m4pdf'}
    </p>    
{/section}

    
</body>
 

 

100000000000000000000000 merci!!!!!!!!!!
Il s'agit du fichier catalogue dans M4pdf

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...