bosanci28 Posted August 15, 2015 Share Posted August 15, 2015 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. Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 16, 2015 Author Share Posted August 16, 2015 (edited) Like this one here: See the picture to the left... Edited August 16, 2015 by bosanci28 Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted August 16, 2015 Share Posted August 16, 2015 That's also something that has been figured out before. But I wasn't able to find the CC thread, so I don't know if I could find this one, either. Sorry. Hopefully Bsmither will be able to find the right threads. Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 16, 2015 Share Posted August 16, 2015 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). Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 16, 2015 Author Share Posted August 16, 2015 Thank you !!! Will try this right now! Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 16, 2015 Author Share Posted August 16, 2015 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: Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 16, 2015 Share Posted August 16, 2015 Crazy me... This is just the text of the URL.<div style="float:left;">{$item.image}</div>We need to make it an actual image tag. Try:<div style="float:left;"><img src="{$item.image}" /></div> Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 16, 2015 Author Share Posted August 16, 2015 Yes, that did it!.I put back to "subcategory" as the picture was way to small.But It works! Thank you so much for helping. Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 16, 2015 Share Posted August 16, 2015 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. Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 16, 2015 Author Share Posted August 16, 2015 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. Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 29, 2015 Author Share Posted August 29, 2015 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! Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 29, 2015 Share Posted August 29, 2015 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} × {$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; } Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 29, 2015 Author Share Posted August 29, 2015 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} × {$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 Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 29, 2015 Share Posted August 29, 2015 It is /admin/skins/default/templates/orders.print.php. Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 29, 2015 Author Share Posted August 29, 2015 Oh, is in /skins/foundation/templates/print.receipt.php i guess. Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 29, 2015 Share Posted August 29, 2015 That would be the printout that the customer would print from their Account, Order History page. Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 29, 2015 Author Share Posted August 29, 2015 (edited) Yes, i can print a copy from admin with picture aligned nice now... but on the buyer side:Is not showing.2 Different orders , for example but both have pictures. Edited August 29, 2015 by bosanci28 Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 30, 2015 Share Posted August 30, 2015 Yes, we can do the same for the invoice that the customers can print for themselves.Be back shortly. Quote Link to comment Share on other sites More sharing options...
bsmither Posted August 30, 2015 Share Posted August 30, 2015 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); Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 30, 2015 Author Share Posted August 30, 2015 Looks like is working really nice!Admin sideUser/Buyer side 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 wasvery use full ,when you want to see the picture and info description to what the buyer got. Really appreciate!!!!!!!!!!!! Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted August 30, 2015 Share Posted August 30, 2015 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}&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. Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 31, 2015 Author Share Posted August 31, 2015 Yes, it works well as it is...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. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted August 31, 2015 Share Posted August 31, 2015 I'll mark this thread as Resolved, but please don't hesitate to open it again if you have more questions/issues with this topic. Quote Link to comment Share on other sites More sharing options...
bosanci28 Posted August 31, 2015 Author Share Posted August 31, 2015 Thank you for all your help @bsmither and @dirtybutter! Quote Link to comment Share on other sites More sharing options...
jpayam Posted September 19, 2015 Share Posted September 19, 2015 Works fine on order print, but How we can use item image on "new order received" admin email?as image is not on Available Macros at email templates editor Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.