Jump to content

[Resolved] Add Picture under Part/product name, on invoice.


bosanci28

Recommended Posts

Hello,

Is there a way to add the picture of the product that a client just purchased under the product title?

I used to have that in cc4, and is really nice when you print the invoice a small thumbnail will show there too.

 

Thanks for any advice.

 

Link to comment
Share on other sites

On the Invoice (shipping packing list), the data about the item's image is not provided to the template. So, we will need to add it. In /admin/sources/orders.index.inc.php, near line 451:

Find:
foreach ($inventory as $item) {

Add after:
$item['image'] = $GLOBALS['gui']->getProductImage($item['product_id'],'subcategory');

Now that ['image'] is available to the template, in the template orders.print.php,

Find:
		{if isset($item.options)}
		<ul>
		{foreach from=$item.options item=option}
		<li>{$option}</li>
		{/foreach}
		</ul>
		{/if}

Add BEFORE:
<div style="float:left;">{$item.image}</div>

You can change 'subcategory' (105 pixels on the longest side) to 'gallery' (50 pixels) or 'tiny' (30 pixels).

Link to comment
Share on other sites

So i have added both codes.

And for this line:

$item['image'] = $GLOBALS['gui']->getProductImage($item['product_id'],'subcategory');

I have added "gallery", like this:

$item['image'] = $GLOBALS['gui']->getProductImage($item['product_id'],'gallery');

And i get this when try to print:

 

2015-08-15_18-39-45.png

Link to comment
Share on other sites

Actually, the image should be below the line item. I'm disappointed that it is on the same line as the line item.

I'm concerned because when there are more than one line items, the images will mess everything up.

I'll do some more work on this soon.

Link to comment
Share on other sites

Yes, If is like the picture in second post , that it should be fine ... title in top ,then picture under to the left and the description to the right along side the picture.

Thank you, and will wait if that can be fixed.

I need that , as when i send something out is like a little proof of the part that they order! I had many times problems that they said i sent the wrong part, but the invoice with the picture on it don't lie.

 

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Actually, the image should be below the line item. I'm disappointed that it is on the same line as the line item.

I'm concerned because when there are more than one line items, the images will mess everything up.

I'll do some more work on this soon.

Any luck with fixing the position of that image? 

Thanks!

Link to comment
Share on other sites

This is the code I would like for you to try.

Find starting with:
		{foreach from=$order.items item=item}
		<div class="product">

and ending with:
		{/foreach}
		<div id="totals">


Replace with:
		{foreach from=$order.items item=item}
		<div class="product">
		<span class="price">{$item.price}</span><div>{$item.quantity} &times; {$item.name} {if !empty($item.product_code)}({$item.product_code}){/if}</div>
		<div style="float:left;"><img src="{$item.image}" /></div>{if isset($item.options)}
		<div style="float:left;"><ul>
		{foreach from=$item.options item=option}
		<li>{$option}</li>
		{/foreach}
		</ul></div>
		{/if}
		</div>
		{/foreach}
		<div id="totals">

Then, in /admin/skins/default/styles/print.css, make this edit:

div.product {
    border-bottom: 1px dashed #e7e7e7;
    clear: both;
    overflow: auto; /* NEW! */
    padding: 5px 0;
}

 

Link to comment
Share on other sites

Trying now...back in few...

This is the code I would like for you to try.

Find starting with:
		{foreach from=$order.items item=item}
		<div class="product">

and ending with:
		{/foreach}
		<div id="totals">


Replace with:
		{foreach from=$order.items item=item}
		<div class="product">
		<span class="price">{$item.price}</span><div>{$item.quantity} &times; {$item.name} {if !empty($item.product_code)}({$item.product_code}){/if}</div>
		<div style="float:left;"><img src="{$item.image}" /></div>{if isset($item.options)}
		<div style="float:left;"><ul>
		{foreach from=$item.options item=option}
		<li>{$option}</li>
		{/foreach}
		</ul></div>
		{/if}
		</div>
		{/foreach}
		<div id="totals">

 

 

Where exactly is the file that needs to be edited? as is not in /admin/sources/orders.index.inc.php

Link to comment
Share on other sites

In the Foundation template print.receipt.php:

Find:
 <td>
    {$item.name}{if !empty($item.product_code)} ({$item.product_code}){/if}
    {if !empty($item.options)}
    <p>{foreach from=$item.options item=option}{$option}<br>{/foreach}</p>
    {/if}
 </td>

Change to:
 <td>
    <div>{$item.name}{if !empty($item.product_code)} ({$item.product_code}){/if}</div>
    <div style="float:left;margin-right:5px;"><img src="{$item.image}" /></div>
    {if !empty($item.options)}
    <div>{foreach from=$item.options item=option}{$option}<br>{/foreach}</div>
    {/if}
 </td>

In the file /classes/cubecart.class.php:

Near line 2580, find:
foreach ($products as $item) {
  $item['price_total'] = $GLOBALS['tax']->priceFormat(sprintf('%.2F', $item['price'] * $item['quantity']), true);

Change to:

foreach ($products as $item) {
  $item['image'] = $GLOBALS['gui']->getProductImage($item['product_id'],'subcategory');
  $item['price_total'] = $GLOBALS['tax']->priceFormat(sprintf('%.2F', $item['price'] * $item['quantity']), true);
						

 

Link to comment
Share on other sites

Looks like is working really nice!

Admin side

16tb3l.jpg

User/Buyer side

2ymwym9.jpg

 

Now one more favor when ever if you have time and does not take long!

Is it possible to add a "link" there to that product if i click to open other page to that specific product? i had that in v4 and it was

very use full ,when you want to see the picture and info description to what the buyer got.

2dv4kli.jpg

 

Really appreciate!!!!!!!!!!!!

 

 

Link to comment
Share on other sites

There's probably better code to do this, but I added this to orders.index.php:

            <fieldset id="items">
               <legend>{$LANG.catalogue.title_items}</legend>
	<!--MY PRODUCT LINKS --> 
               {foreach from=$PRODUCTS item=product}
               <div id="item">
{$product.quantity} x {$product.name} - <a href="?_g=products&sort[updated]=DESC&action=edit&product_id={$product.product_id}#image" target="_blank">{$product.product_code}</a> ({$product.line_formatted}) {if $product.digital}<a href="{$VAL_SELF}&amp;reset_id={$product.id}" />[{$LANG.orders.reset_download_link}]</a>{/if}<span>{$product.price_total_formatted}</span>
<p align="left">Catalog Listing for <a href="{$STORE_URL}/index.php?search[keywords]={$product.product_code}&_a=category" target="_blank">{$product.product_code}</a>
</p>
<div>
                  {if $product.options_text}
                  <br>{$product.options_text}
                  {/if}
               </div>
               {/foreach}
 <!--END MY LINKS-->

(I have a tweak in place from Bsmither that puts the main image on the product image tab where the code says #image.) But the second link I added goes to the customer's product listing, which would give you the image and description.

Link to comment
Share on other sites

Yes, it works well as it is...

212ua95.png

The top one it goes to internal picture, and the bottom one goes to main site where product is located witch is nice.

There are 2 same description title line there,but only in admin , if i print invoice all is normal , no 2 lines! only one as the above.

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...