X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Adding Images to the Invoice (https://forum.x-cart.com/showthread.php?t=70618)

topspin6711 12-21-2014 09:29 AM

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.

tony_sologubov 12-24-2014 05:32 AM

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.

minfinger 03-08-2015 08:10 AM

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

tony_sologubov 03-10-2015 12:04 PM

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.

minfinger 03-12-2015 05:08 PM

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

minfinger 03-16-2015 06:37 PM

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.

tony_sologubov 03-17-2015 11:07 AM

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.

minfinger 03-22-2015 06:08 AM

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

tony_sologubov 03-23-2015 05:30 AM

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.

minfinger 04-03-2015 09:43 AM

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,
            ),
        );
    }




All times are GMT -8. The time now is 02:13 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.