Customizing the attach invoice

  • Posts: 79
  • Thank you received: 5
10 years 2 months ago #182752

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.5.9
-- Browser(s) name and version -- : Firefox 33.1

Hi, I want to add some information on the invoice at least on the final confirmation of an order.

I use the plugin 'Attach invoice' and need to add some information as described below :

Reference (4 digits) | Product Information | A code (10 digits) | Unit price | Quantity | Total Price
Product details
(below)

So there is the reference, the product details and the code to add.
If I create some customs fields how can I add those two columns and the detail of the product below on a second line or following the product information to the files plugins/hikashop/attachinvoice/attachinvoice/invoice.php

I know that I have to change the width of the existing columns, I saw it is set in pixels. I will manage the display by myself

Any help will be really appreciated !

Regards,

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 2 months ago #182776

Hi,

To display the value of the custom fields, you can directly use that kind of code:

echo $product->CUSTOMFIELD_NAME;

To manage the display, change the columns, you just have to use html tags like <td></td>, <tr></tr>

Please Log in or Create an account to join the conversation.

  • Posts: 79
  • Thank you received: 5
10 years 2 months ago #182925

Thanks for your reply,

I added the custom field to the attachinvoice plugin, it shows well but the cells are empty for past orders.
Is it normal ? or should I already see the changes on past orders.

Maybe I missed something, I had this kind of line

<td>
       <?php echo $product->code_ean; ?>
</td>

When I've created the custom field, I choose a 'product' type in the field "TABLE" and I called the custom field 'code_ean'
Of course I added information to the custom fields

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 2 months ago #183028

Hi,

If the products had a value for this custom field in the past orders so when sending a new email with attached pdf the value should be present.

Please Log in or Create an account to join the conversation.

  • Posts: 79
  • Thank you received: 5
10 years 2 months ago #183029

Ok, I recently add the custom fields I will see in the next order and will Tell you

Please Log in or Create an account to join the conversation.

  • Posts: 79
  • Thank you received: 5
10 years 1 month ago #184772

Hi Xavier,

Well no luck, the last two orders don't show the custom fields.

I thought that may be it's because I have set a value for the variants of the main product but not for the main product because I don't need. I just need for the variants.

Do I have to change the code in some way ? to show the custom fields of the variants.

Cheers

Please Log in or Create an account to join the conversation.

  • Posts: 83344
  • Thank you received: 13481
  • MODERATOR
10 years 1 month ago #184782

Hi,

It should not be a problem.
Please provide a screenshot of the options of the custom field (just in case), and the code of the invoice (so that we can see where and how you placed your modification).

Please Log in or Create an account to join the conversation.

  • Posts: 79
  • Thank you received: 5
10 years 1 month ago #184813

Here are the two screenshots of the custom fields option





I have modified the following line in the attached files :
to insert the name of the fields in the table => line 90-92 and line 96-98
to insert the custom fields in the table => line 120-122 and line 170-172
to set the layout of the table (colspan) => line 231, 276, 288, 297

Fichier modifié : invoice.php

Please Log in or Create an account to join the conversation.

  • Posts: 83344
  • Thank you received: 13481
  • MODERATOR
10 years 1 month ago #184819

Hi,

I cannot access the file. Could you zip it so that we can download it ?

Please Log in or Create an account to join the conversation.

  • Posts: 79
  • Thank you received: 5
10 years 1 month ago #184867

Oh sorry, I didn't test the link before submitting it

Here's a new one

Fichier modifié : invoice.php

Please Log in or Create an account to join the conversation.

  • Posts: 83344
  • Thank you received: 13481
  • MODERATOR
10 years 1 month ago #184921

Hi,

Ok, after the line:
foreach($order->products as $product){
Try to add that code:
$class = hikashop_get('class.product');
$prodData = $class->get($product->product_id);

and then, instead of the code:
<?php echo $product->code_ean; ?>
use that code:
<?php echo $prodData->code_ean; ?>

Please Log in or Create an account to join the conversation.

  • Posts: 79
  • Thank you received: 5
10 years 1 month ago #184932

Hi Nicolas,

It works really fine :woohoo:, It even shows the custom fields in the older order.

thank you very much Nicolas and happy new year and best wishes for 2015 !!

Last edit: 10 years 1 month ago by pouce. Reason: Tried to mark the post as solved
The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.081 seconds
Powered by Kunena Forum