Jump to content

Modifier la facture pdf sur un prestashop 1.4


Recommended Posts

Bonjour,

 

Je voudrais ajouter une certification sur certains de mes produits lorsque la facture est généré. Donc à côté des noms des produits je voudrais ajouter une étoile. Et ensuite dans le footer je mettrais le nom de la certification.

 

Je suis sur un Prestashop 1.4.7, j'ai été dans la classe PDF.php puis j'ai voulu ajouter un caractère dans la méthode "ProdReturnTab()" (environ à la ligne 452). Voila la méthode en question

public function ProdReturnTab()
	{
		$header = array(
			array(self::l('Description'), 'L'),
			array(self::l('Reference'), 'L'),
			array(self::l('Qty'), 'C')
		);
		$w = array(110, 25, 20);
		$this->SetFont(self::fontname(), 'B', 8);
		$this->SetFillColor(240, 240, 240);
		for ($i = 0; $i < sizeof($header); $i++)
			$this->Cell($w[$i], 5, $header[$i][0], 'T', 0, $header[$i][1], 1);
		$this->Ln();
		$this->SetFont(self::fontname(), '', 7);

		$products = OrderReturn::getOrdersReturnProducts(self::$orderReturn->id, self::$order);
		foreach ($products AS $product)
		{	
			$productCertificat = $product['product_name']."*"; // modif que j'ai fais
			$before = $this->GetY();
			$this->MultiCell($w[0], 5, Tools::iconv('utf-8', self::encoding(), $productCertificat), 'B');
			$lineSize = $this->GetY() - $before;
			$this->SetXY($this->GetX() + $w[0], $this->GetY() - $lineSize);
			$this->Cell($w[1], $lineSize, ($product['product_reference'] != '' ? Tools::iconv('utf-8', self::encoding(), $product['product_reference']) : '---'), 'B');
			$this->Cell($w[2], $lineSize, $product['product_quantity'], 'B', 0, 'C');
			$this->Ln();
		}
	}

Mais lorsque je génère une facture on en voit pas l'astérix (ou étoile) sur la facture PDF. Peut-être que je me trouve aux mauvais endroit mais je ne vois pas ou faire la modification ?

 

 

 

Link to comment
Share on other sites

Peut-être que j'ai posté au mauvais endroit mais j'ai résolus mon problème, je le partage ça peut servir pour d'autres personnes.

 

En fait dans la méthode "ProdTab" (environ ligne 800) il fallait modifier :

/**
* Product table with price, quantities...
*/
public function ProdTab($delivery = false)
{
.
.
.
. pleins de lignes de code

$productCertificat = $product['product_name']."*"; //ligne ajoutée
$this->MultiCell($w[++$i], 5, Tools::iconv('utf-8', self::encoding(), $productCertificat), 'B'); // ligne modifiée
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...