Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Adding Images to the Invoice

 
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)
 
Thread Tools Search this Thread
  #11  
Old 12-21-2014, 09:29 AM
 
topspin6711 topspin6711 is offline
 

Member
  
Join Date: May 2010
Posts: 22
 

Default Re: Adding Images to the Invoice

Tony, thank you for this. It didn't work as written, I had to make two changes to image.tpl:

Code:
{* vim: set ts=2 sw=2 sts=2 et: *} {** * @ListChild (list="invoice.item", weight="5") *} <th class="item"> <widget class="\XLite\View\Image" image="{item.getImage()}" alt="{item.getName()}" maxWidth="80" maxHeight="80" centerImage="0" /> </th>

First, changed "invoice.items" to "invoice.item".

Figured this out looking at the other items.tpl files /skins/admin/en/order/invoice/parts/items/

Second, seems you have to call the image widget class as you see. I don't really understand this so if you can explain I would appreciate it. Found this looking at another tpl using the getImage function, namely item.image.tpl.

Haven't tested, but I assume everything after the alt tag is optional.
Reply With Quote

The following user thanks topspin6711 for this useful post:
tony_sologubov (12-24-2014)
  #12  
Old 12-24-2014, 05:32 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Adding Images to the Invoice

Hi topspin6711!

You are totally right about my mistakes in the code. Sorry for that and corrected my initial code.

The thing about calling <widget> is you basically saying "OK, X-Cart, you have to display an image with source passed in image param, alt from alt param and dimensions defined in height/width params". Of course, you can do the same by specifying this code in template:

<img src="{item.getImage()}" alt="item.getName()" max-width="80" max-height="80">

but X-Cart will slice an image on fly if you call it via widget, so if you call <widget> your notification will have 80x80 image, while if you call <img src>, your notification will have big image resized by mail client.

Hopefully, it helps. Let me know if it is still unclear why <widget> is used.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #13  
Old 03-08-2015, 08:10 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Adding Images to the Invoice

Here are the results that I got. I know what's wrong, but I'm not 100% sure how to fix it.

Single Item in the Cart:
http://i21.photobucket.com/albums/b298/fasterthanyours/Images%20On%20Invoice%2001%20-%20Single%20Item.jpg

Multiple Items in Cart:
http://i21.photobucket.com/albums/b298/fasterthanyours/Images%20On%20Invoice%2002%20-%20Multiple%20Items.jpg
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #14  
Old 03-10-2015, 12:04 PM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Adding Images to the Invoice

It looks like <td></td> tags are missed in the template that renders a product image. If you can send me your module, I will be able to say what is wrong exactly.

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #15  
Old 03-12-2015, 05:08 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Adding Images to the Invoice

Tony,

Here is the current package
https://www.dropbox.com/s/itzoohn09ofan0z/FasterThanYours-ImagesOnInvoice-v5_1_8.tar?dl=0
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #16  
Old 03-16-2015, 06:37 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Adding Images to the Invoice

Tony,

I figured it out. you were right about the td missing.

Now how do I got about getting it on the General Info Tab?


I suppose I need to know all of the other places that an Admin or user would be viewing an invoice or detailed order information.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #17  
Old 03-17-2015, 11:07 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Adding Images to the Invoice

Hi Michael!

I have an article that explains the whole process here:
http://kb.x-cart.com/display/XDD/Adding+product+images+to+order+notifications

Please have a look and let me know if it helps.

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #18  
Old 03-22-2015, 06:08 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Adding Images to the Invoice

Tony,

In the Admin area, how do I make the images clickable?

In the Thank you Page area, how do I make the images clickable?

Also in the Admin Area, I'd like to have the images on the General Info Tab. It's working fine on the Invoice Tab. Most likely my client's employees will only use the General Info Tab and then the Invoice as a final reference. If you're on the Invoice Tab and and you click the Name of the Product it take you to the edit product page. I would like that to be the same on the Image in the General Info Tab and the Invoice Tab.

http://i21.photobucket.com/albums/b298/fasterthanyours/General%20Info%20Tab%20-%20No%20Image.jpg
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #19  
Old 03-23-2015, 05:30 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Adding Images to the Invoice

1) Making images clickable is basically to wrap them into <a></a> tags. I believe, you already know that, so I am not sure what piece of advice I can give you here aside from just adding <a></a> tags.

2) In order to add images to Order Items section in General info tab, you need to decorate the \XLite\View\ItemsList\Model\OrderItem viewer class and add new image field to the defineColumns() method similar to how it is done here:
http://kb.x-cart.com/display/XDD/ItemsList+in+admin+area

Please, let me know if it makes sense to you.

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #20  
Old 04-03-2015, 09:43 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Adding Images to the Invoice

Tony,

Does this look right?

PHP Code:
namespace XLite\Module\FasterThanYours\ImagesOnGeneralInfoTab\View;

class 
OrderItem extends \XLite\View\ItemsList\Model\OrderItem implements \XLite\Base\IDecorator
{
    protected function 
defineRepositoryName()
    {
        return 
'\XLite\Model\Product';
    }
    
    protected function 
defineColumns()
    {
        return array(
            
'image' => array(
                static::
COLUMN_NAME     => 'Image',
                static::
COLUMN_ORDERBY  => 100,
            ),
        );
    }

__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:18 AM.

   

 
X-Cart forums © 2001-2020