Jump to content

edit packing slips


angellombana

Recommended Posts

Hello, I have a traceability module, the module works well, but I want to modify a detail, the module puts information at the bottom of the batches in the delivery notes and on the invoices, but I want to eliminate it from the delivery notes, what file should I have? Modify?

Link to comment
Share on other sites

I searched for "Lotes usados" in that module.

I found two templates for 1.6 and 1.7 with this name hook/t16/displayPdf.tpl and hook/t17/displayPdf.tpl

image.thumb.png.7d374d5ad1aa51901cbb1631e3a7a148.pngimage.thumb.png.8e3fa0e70cfd707d6c9d6bbe8fdda97f.png

Then I opened the main file of module with this name lotes_caducidada.php and searched for this displayPdf and found this hook methods:

image.thumb.png.8e3fa0e70cfd707d6c9d6bbe8fdda97f.png

Link to comment
Share on other sites

This is the method that fills data into the PDF template. path: modules/lotes_caducidad/lotes_caducidad.php

public function hookdisplayPDFDeliverySlip($params)
{
    
    $lotes = array();
    if(Configuration::get('LOTES_INVOICE')){
        
        $id_lang = Configuration::get('PS_LANG_DEFAULT');
        require_once(dirname(__FILE__).'/classes/lotescaducidad.php');
        $id_order = (int)Tools::getValue('id_order');
        
        
        
        
        if($id_order == 0){
            $id_order = $params['object']->id_order;
        }
        
        
        $order = new Order($id_order);
        $pedido = $order->reference;
        $lotillos = lotescaducidad::LotesdePedido($pedido); 
        
        foreach ($lotillos as $lotillo){
            $id_producto = $lotillo['id_producto'];
            $product = new Product($id_producto);
            $nproducto = $product->name[$id_lang];
            $ref = $lotillo['ref'];
            $lote = $lotillo['lote'];
            $fecha_caducidad = $lotillo['fecha_caducidad'];
            $ref_ped_lote = $lotillo['pedidos'];
            
            $lotes[] = array(
                'id_producto' => $nproducto,
                'ref' => $ref,
                'lote' => $lote,
                'fecha_caducidad' => $fecha_caducidad,
                'ref-pedido' =>$orden,
                'ref-pedido-lote' =>$ref_ped_lote,
            
            );
            
        }
        
        
        $this->context->smarty->assign('lotes', $lotes);               
        return $this->display(__FILE__, 'views/templates/hook/t17/displaypdf.tpl');
        
        
        
    }
    
    
}

This is the path of the pdf template:

  • v1.7 -> views/templates/hook/t17/displaypdf.tpl
  • v1.6 -> views/templates/hook/t16/displaypdf.tpl

You can find those headers that you want to delete in the template

image.thumb.png.16f2bd725c9a7dad436b44f8d00ebeb8.png

Link to comment
Share on other sites

As you can see both of the displayPdfInvoice and displayPDFDeliverySlip methods use a single template. You should make a copy of the t17/displayPdf.tpl and t16/displayPdf.tpl with a new name like t17/displayPdfDeliverySlip.tpl and t16/displayPdfDeliverySlip.tpl and then remove the lines that you do not want to be there. Then at the end of this method displayPDFDeliverySlip replace this:

3 minutes ago, stifler97 said:
 $this->context->smarty->assign('lotes', $lotes);               
        return $this->display(__FILE__, 'views/templates/hook/t17/displaypdf.tpl');

with this:

 $this->context->smarty->assign('lotes', $lotes);               
        return $this->display(__FILE__, 'views/templates/hook/t17/displayPdfDeliverySlip.tpl');
Link to comment
Share on other sites

thanks, but the truth is that it's hard for me to understand the explanation, I still don't know why it doesn't work when I try to delete the line !$this->registerHook('displayPDFDeliverySlip')|| of the php file since I want to eliminate all the content of the delivery note

Link to comment
Share on other sites

Well I think I've done it, thanks for your help. In case someone helps you, we are talking about the "Módulo Trazabilidad y fecha de caducidad" module, delete all the information from displaypdf.tpl and then in the file /lotes_caducidad/lotes_caducidad.php there are 2 paragraphs that you refer to that should be changed


$this->context->smarty->assign('batches', $batches);
         return $this->display(__FILE__, 'views/templates/hook/t17/displaypdf.tpl');

the first belongs to the invoice and the second to the delivery note, so I changed the second and it worked

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

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...