PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

[Module] Print delivery label

46 replies to this topic
#1
Wandry

    PrestaShop Apprentice

  • Members
  • PipPip
  • 27 posts
Hello, I've developped a small module to edit delivery label straightly from the back office in PDF format.
I adapted the label size to label printer Dymo ( you can find a example here : DYMO LabelWriter 400 -USB )
Once installed, you will have a clikable link that will appear in you order panel control that will generate the pdf automatically.

feel free to share, adapt to your needs and of course comment it!

The directory contains two php files+logo+2 traduction files.
By default, it runs in english.

Attached Files



#2
Console

    PrestaShop Newbie

  • Members
  • Pip
  • 10 posts
Hello Wandry,

Can you please explain more about this one, i cant get it to work. Have installed the module, but i dont get any new link in the subcategories of Orders tab.

Actually, the question is, what am i supposed to insert in the Token field in configuration of the module?

Thanks in advance.

#3
Wandry

    PrestaShop Apprentice

  • Members
  • PipPip
  • 27 posts
Hello,
you just have to put the unzip file in your module list then in you configuration panel install it. Don't care of the token,(actually it's just a token to access the database);
the module then should appear when you go in "Orders", select one the module then should appear.

#4
Console

    PrestaShop Newbie

  • Members
  • Pip
  • 10 posts
Hmmm Wandry,

Thats the wierd thing i have ... im using Version 1.1.0.5 of prestashop, could it has something to do with that? cause i dont get any link in Orders. Kinda said :/

#5
Console

    PrestaShop Newbie

  • Members
  • Pip
  • 10 posts
Hello,

Ohh, i saw it now. Cool thanks ... i was almost searching for the same thing, but i have another ideas:

It would be cool if you could have like different "groups". 1. Firstclass letter 2. Package order 3. Cod order etc etc

Then, every firstclass orders delivery slip are stored in a PDF, like the picture i have attached.. what do you think, is it hard to do something like that?

what do you think about the attached file, do you understand how i mean?

i mean that you can bring every 1. firstclass orders delivery slip in a pdf like you have create, so you have all slips at one PDF document to print.

Attached Files



#6
Wandry

    PrestaShop Apprentice

  • Members
  • PipPip
  • 27 posts
Update:
You can choose now between 4 fonts in the config menu

New version attached.

Attached Files



#7
thpoul

    PrestaShop Newbie

  • Members
  • Pip
  • 10 posts
Wonderful idea but unfortunately due to the FDPF it won't work for Greek :(

#8
Wandry

    PrestaShop Apprentice

  • Members
  • PipPip
  • 27 posts
Hello, actually it's possible but a bit complicated...
here is a way to add new characterw to a font : http://www.id.uzh.ch...orial/tuto7.htm
Though don't forget that your fonts directory is in tools/fpdf when using makefont.
when done, I suggest that you modify in downloadlabel.php the line 34 :
$pdf->SetFont("$police",'',12);
change $police to your new font ( but you won't be able to change fonts from the setup menu).

#9
Carlv1428

    PrestaShop Newbie

  • Members
  • Pip
  • 19 posts
Hello,


I am looking to add the logo of the web site to the label printed using you rmodule.
Nice Module by the way.


We use the label for giving the goods to deliver to UPS, so we need more information on the label
such as

Logo
and what was ordered by the customer.

Can you help me?

I tried to open the download-label.php.
But i can't get to insert the logo....

Thansk for your help...

#10
Wandry

    PrestaShop Apprentice

  • Members
  • PipPip
  • 27 posts
to Carlv1428:

If you want to modify the label, you've got to open download-label.php (printlabel.php is for the installation and the settings from your back-office)
now i'll explain my code:
-line 2 : I used FPDF (fpdf.php) wich is a free library included in your prestashop. It allows you to make scripts that creates PDF documents.
( here is useful documentation you might need about http://www.fpdf.org/?lang=en)

-from line 12 to 27 I get the different informations i need about the customer.

-from34 to 45 I create the label:
line 34 : i create a new pdf(its the constructor, specifying landscape, the unit , height and width)

To insert a logo you should use the command $pdf->Image(parameters)

hope that it can help you.

#11
Carlv1428

    PrestaShop Newbie

  • Members
  • Pip
  • 19 posts
Hi Wandry,

Thanks for your reply, I could manage to change the labels according to the informations you gave me.

I now have my beautiful logo on my labels.... Thanks to you!!!!

Maybe I can ask you some more info.... We are on the good way!!!!
What about having on this label the product bought by the buyer and also the informations of number of colis.
For example,
We sell cupboards for shoes, but some of the furniture is so big that we have sometimes 2 colis for the same furniture.

What i was thinking about

I have ordered an Product A made of 2 colis
------------------------------------------------------------------
Logo |
Customer name |
Customer adress |
Customer postcode Customer City |
Customer Country |
------------------------------------------------------------------|
Customer product name |
Customer Colis/#Colis |
------------------------------------------------------------------|

Once I have this it is easy to imagine adding the weight, the HxWxL
Etc... All that kind of things making a shipping easier!!!!
I tried to add n$Products to the $pdf->Write but i didn't get the correct information so i guess some variables must be declared previously....


What do you think of this?

#12
holle75

    PrestaShop Apprentice

  • Members
  • PipPip
  • 50 posts
Hi Wandry, nice idea. i get an error when installing the module in the backend.... but it works anyhow?! anybody else getting this error?

best

H.

#13
ImPresta

    PrestaShop Newbie

  • Members
  • Pip
  • 6 posts
Hi I really hope some one have an easy solution to this problem.

After reading about this module I hurried out and bought a Dymo 450 label writer. I did'nt assume it would be a problem, to make the characters in Danish and Swedish work (ä,ö,æ,ø,å), as they looks fine in the Invoices from Prestashop and I could se that it also uses fpdf.php. But, now I have spent two whole working days on this issue and I just can't make it fit to these characters.

Does anyone have a solution on this?

I would appreciate any help on this issue.

#14
bigstef

    PrestaShop Apprentice

  • Members
  • PipPip
  • 89 posts
I have amended this a bit to suit my labels and just have one question.
When someone fills out their address and they dont have any details in address line 2, then the label has a space where the details would be if they had entered anything.
If that makes sense, how can we make the address not show a blank line as it currently does when nothing is entered for address line 2.

hope this is clear.

#15
LukeH

    PrestaShop Apprentice

  • Members
  • PipPip
  • 63 posts
Hi,

Sorry to dig up an old thread but is there any chance someone could post sample code showing a logo inserted and/or instructions on how to do it.

I have install the printlabel module and I have modified it to suit my needs by changing the field order but I would really like to include a company logo.

Thanks, Luke.

#16
bigstef

    PrestaShop Apprentice

  • Members
  • PipPip
  • 89 posts

From 1273763969:

Hi,

Sorry to dig up an old thread but is there any chance someone could post sample code showing a logo inserted and/or instructions on how to do it.

I have install the printlabel module and I have modified it to suit my needs by changing the field order but I would really like to include a company logo.

Thanks, Luke.


To insert an image is easy.
This is what I use for my labels/pdf document for the image insertion.

$pdf->Image(_PS_IMG_DIR_.'/logo.jpg', 68, 234, 35, 35);

Put the file named logo into your print label folder. My paper is standard A4.
The 68,234 is the location of my image, I know its in a strange position but anyway, the 68 represents 68mm from the left edge of the paper, the 234 is 234mm from the top of the page. Basicaly thats the x,y coordinates of the logo.
The 35,35 is the size of the file i.e 35 x 35

Play around with the settings and see what you get.

Hope this is of help.

#17
LukeH

    PrestaShop Apprentice

  • Members
  • PipPip
  • 63 posts

From 1273770178:

From 1273763969:

Hi,

Sorry to dig up an old thread but is there any chance someone could post sample code showing a logo inserted and/or instructions on how to do it.

I have install the printlabel module and I have modified it to suit my needs by changing the field order but I would really like to include a company logo.

Thanks, Luke.


To insert an image is easy.
This is what I use for my labels/pdf document for the image insertion.

$pdf->Image(_PS_IMG_DIR_.'/logo.jpg', 68, 234, 35, 35);

Put the file named logo into your print label folder. My paper is standard A4.
The 68,234 is the location of my image, I know its in a strange position but anyway, the 68 represents 68mm from the left edge of the paper, the 234 is 234mm from the top of the page. Basicaly thats the x,y coordinates of the logo.
The 35,35 is the size of the file i.e 35 x 35

Play around with the settings and see what you get.

Hope this is of help.


Hi

Thanks for the fast reply I will give this a try today. Also, thanks to Wandry for writing the module in the first place, it is very handy.

Luke.

#18
LukeH

    PrestaShop Apprentice

  • Members
  • PipPip
  • 63 posts
Right....I have uploded my logo called logo.jpg to the "printlabel" folder within the modules section of PrestaShop.

I have added the following line of code on the line above $pdf->Output(); to the "download-label.php"

$pdf->Image(modules/printlabel.'/logo.jpg', 68, 234, 35, 27);

I get syntax errors when I generate the label. I have experimented with adding ../modules/printlabel & /printlabel/ as the image directory but nothing seems to work.

What am I doing wrong? I'm guessing that I have the image directory path wrong but I can't figure out why.

Thanks

Luke.

#19
bigstef

    PrestaShop Apprentice

  • Members
  • PipPip
  • 89 posts

From 1273815831:

Right....I have uploded my logo called logo.jpg to the "printlabel" folder within the modules section of PrestaShop.

I have added the following line of code on the line above $pdf->Output(); to the "download-label.php"

$pdf->Image(modules/printlabel.'/logo.jpg', 68, 234, 35, 27);

I get syntax errors when I generate the label. I have experimented with adding ../modules/printlabel & /printlabel/ as the image directory but nothing seems to work.

What am I doing wrong? I'm guessing that I have the image directory path wrong but I can't figure out why.

Thanks

Luke.

If you have called the image file the same as what I have above then you do not edit that image location at all.
Leave it exactly as I have written above.

#20
LukeH

    PrestaShop Apprentice

  • Members
  • PipPip
  • 63 posts

From 1273911490:

From 1273815831:

Right....I have uploded my logo called logo.jpg to the "printlabel" folder within the modules section of PrestaShop.

I have added the following line of code on the line above $pdf->Output(); to the "download-label.php"

$pdf->Image(modules/printlabel.'/logo.jpg', 68, 234, 35, 27);

I get syntax errors when I generate the label. I have experimented with adding ../modules/printlabel & /printlabel/ as the image directory but nothing seems to work.

What am I doing wrong? I'm guessing that I have the image directory path wrong but I can't figure out why.

Thanks

Luke.

If you have called the image file the same as what I have above then you do not edit that image location at all.
Leave it exactly as I have written above.


Ok I have entered the line of code exactly as you have written and I am no longer getting syntax errors however, I am now getting a blank label. If I comment out the logo line of code the label prints fine. Out of interest what line did you insert the code on? I think that this has something to do with the problem.

Thanks for your help.

Luke.