News:

Looking for documentation? Take a look on our wiki

Main Menu

How to count each different item (row) in the pdf invoice ?

Started by dorex, April 09, 2013, 16:07:27 PM

Previous topic - Next topic

dorex

Hi everyone!

How can I have a colon in the pdf generated invoice (a 1st colon, prior to SKU), that should count the ordered products. Something like this:

No._______SKU_______Product Name_______......................._______Discount_______Total
1_______FLO-017_______Blue rose_______......................._______$0_______$0.5
2_______SNK-028_______red sneakers_______......................._______$0_______$16
3_______TOY-052_______Small plastic toy_______......................._______$0_______$7
                                                                            Total:................................................


I suppose I should insert a colon in this file:           /MyTemplate/html/com_virtuemart/invoice/invoice_items.php

... but what should I echo in that colon in order to output the counter from the first colon (1, 2, 3, etc.)?

I'm pretty sure my question may be considered stupid and the answer is very obvious, but I'm not familiar to php.

Thank you for your help!
PHP 5.2.17 - Joomla 2.5.8 - Virtuemart 2.0.16

K&K media production

#1
above: foreach($this->orderDetails['items'] as $item) {

add: $count = 1;

in your in your table cell add: echo $count;

above: } ?>

add: $count++;

dorex

Quote from: kkmediaproduction on April 10, 2013, 02:12:36 AM
above: foreach($this->orderDetails['items'] as $item) {

add: $count = 1;

in your in your table cell add: echo $count;

above: } ?>

add: $count++;

Great! It works. Thank you!
PHP 5.2.17 - Joomla 2.5.8 - Virtuemart 2.0.16

MihaiDumitrele

Very useful, but on bills in romania is necessary to have numbered in line with product and shipping cost.
In addition must add a new column containing units of measure (UM), which must have a fixed text (pieces) for each product
Please help me to add these two informations on my bill like:

Nr ...............product.................UM...........price.........qty...........final price
1                  product 1              pieces                   
2                  product2               pieces
3                  product 3              pieces
4                  shipping                pieces                      1             shipping cost

GJC Web Design

Sounds like u need to re-over throw the government and this time put all the tax bureaucrats in the Danube..

Never heard anything so anally retentive.. why do governments treat their citizens like children especially small businesses that are driving the economy? (but I guess that is a bit off topic)...

It will be just experimenting with that template till u get the layout correct...

then the number for shipping will be the $count after the closing brace

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation