From 12c253296f11ea30c30765838b89652ef33eb6fb Mon Sep 17 00:00:00 2001 From: Kaloyan Date: Thu, 9 Apr 2026 18:24:53 +0200 Subject: [PATCH] =?UTF-8?q?Plugin=20O2W=20Facturas=20PrestaShop=20-=20Vers?= =?UTF-8?q?i=C3=B3n=20Final?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/o2wfacturas/o2wfacturas.php | 42 +++++++++ .../views/templates/hook/boton_factura.tpl | 14 +++ .../templates/customer/history.tpl | 87 +++++++++++++++++++ 3 files changed, 143 insertions(+) create mode 100644 modules/o2wfacturas/o2wfacturas.php create mode 100644 modules/o2wfacturas/views/templates/hook/boton_factura.tpl create mode 100644 themes/hummingbird/templates/customer/history.tpl diff --git a/modules/o2wfacturas/o2wfacturas.php b/modules/o2wfacturas/o2wfacturas.php new file mode 100644 index 00000000..827333d2 --- /dev/null +++ b/modules/o2wfacturas/o2wfacturas.php @@ -0,0 +1,42 @@ +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'); + } +} \ No newline at end of file diff --git a/modules/o2wfacturas/views/templates/hook/boton_factura.tpl b/modules/o2wfacturas/views/templates/hook/boton_factura.tpl new file mode 100644 index 00000000..63aef088 --- /dev/null +++ b/modules/o2wfacturas/views/templates/hook/boton_factura.tpl @@ -0,0 +1,14 @@ +
+

Factura de tu pedido

+

Tu factura ya ha sido procesada por nuestro sistema. Puedes descargarla en formato PDF aquí:

+ + {if $url_factura_erp} + + Descargar Factura O2W + + {else} +
+ La factura todavía no está disponible. +
+ {/if} +
\ No newline at end of file diff --git a/themes/hummingbird/templates/customer/history.tpl b/themes/hummingbird/templates/customer/history.tpl new file mode 100644 index 00000000..54797ac1 --- /dev/null +++ b/themes/hummingbird/templates/customer/history.tpl @@ -0,0 +1,87 @@ +{** + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + *} +{extends 'customer/page.tpl'} + +{block name='page_title'} + {l s='Order history' d='Shop.Theme.Customeraccount'} +{/block} + +{block name='page_content'} +

{l s='Here are the orders you\'ve placed since your account was created.' d='Shop.Theme.Customeraccount'}

+ + {if $orders} +
+
+
+ + {l s='Order reference' d='Shop.Theme.Checkout'} + + + {l s='Date' d='Shop.Theme.Checkout'} + + + {l s='Total price' d='Shop.Theme.Checkout'} + + + {l s='Payment' d='Shop.Theme.Checkout'} + + + {l s='Status' d='Shop.Theme.Checkout'} + + + {l s='Invoice' d='Shop.Theme.Checkout'} + + +
+ + {foreach from=$orders item=order} +
+ + {$order.details.reference} + + + {$order.details.order_date} + + + {$order.totals.total.value} + + + {$order.details.payment} + + + + {$order.history.current.ostate_name} + + + + {* AQUÍ ESTÁ NUESTRO BOTÓN ROJO MODIFICADO *} + + Descargar + + + + + + {l s='Details' d='Shop.Theme.Customeraccount'} + + + {if $order.details.reorder_url} + + + {l s='Reorder' d='Shop.Theme.Actions'} + + {/if} + +
+ {/foreach} +
+
+ {else} + + {/if} +{/block} \ No newline at end of file