Plugin O2W Facturas PrestaShop - Versión Final

This commit is contained in:
Kaloyan
2026-04-09 18:24:53 +02:00
commit 12c253296f
3 changed files with 143 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
class O2wFacturas extends Module
{
public function __construct()
{
$this->name = 'o2wfacturas';
$this->tab = 'billing_invoicing';
$this->version = '1.0.0';
$this->author = 'Kaloyan - O2W';
$this->bootstrap = true;
parent::__construct();
$this->displayName = $this->l('O2W Facturas ERP');
$this->description = $this->l('Añade un botón en los detalles del pedido para descargar la factura del ERP.');
}
public function install()
{
return parent::install() && $this->registerHook('displayOrderDetail');
}
public function uninstall()
{
return parent::uninstall();
}
public function hookDisplayOrderDetail($params)
{
$url_erp = 'https://demo.erp.one/public/ventas/facturas/e03bbecc-0512-4281-92ac-2d80843deed6';
$this->context->smarty->assign(array(
'url_factura_erp' => $url_erp
));
return $this->display(__FILE__, 'views/templates/hook/boton_factura.tpl');
}
}

View File

@@ -0,0 +1,14 @@
<div class="box">
<h3 class="page-subheading">Factura de tu pedido</h3>
<p>Tu factura ya ha sido procesada por nuestro sistema. Puedes descargarla en formato PDF aquí:</p>
{if $url_factura_erp}
<a href="{$url_factura_erp}" target="_blank" class="btn btn-primary" style="background-color: #e6004c; border-color: #e6004c; color: white; padding: 10px 15px; text-transform: uppercase; font-weight: bold;">
Descargar Factura O2W
</a>
{else}
<div class="alert alert-warning">
La factura todavía no está disponible.
</div>
{/if}
</div>