Prestashop1.6 Change Default Product thickbox with watermark - prestashop

In product.tpl i managed to change the default size of thickbox by editing this code
href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox_default')|escape:'html':'UTF-8'}"
to
href="{$link->getImageLink($product->link_rewrite, $imageIds, '')|escape:'html':'UTF-8'}"
now the problem is the watermark is not working, Note that i used prestashops default watermark module.

prestashop provides a feature called image types where we can created custom image type with providing width, height and the image type is used for (category, product,manufacture etc..) and we can use this image type in tpl or php codes wherever required.
Watermark module draws the watermark for all image types except original image. So for your case we can create a new image type called custom_default and we can use this in your tpl file
getImageLink($name, $ids, $type = null)
getimagelink method accepts 3 parameters and the 3rd param is for image type and not required and is null by default. So if we pass the 3rd param the image with the provided type will be returned otherwise original image will be returned. So just modify your tpl code by passing our new image type as the value for 3rd param
href="{$link->getImageLink($product->link_rewrite, $imageIds, 'custom_default')|escape:'html':'UTF-8'}"

Related

Drupal 7 - Print PDF and Panelizer

Hi guys ,
I'm currently working on a Drupal project which use the Panelizer module by overriding the default node display. The panel for this content type is made width a lot of rules and specifications in order to display some specific content (like views) according some fields.
Now I need to print in PDF the same content that is displayed by the panelizer module but in another display (in one column ), so I cloned the display I use and rearranged it to display what I want.Then I want to use this display width the print module but I didn't managed to do that.
Any idea how can I do that ?
I just can't use the default node render, because I would miss some informations dues to the specifications used in the panel, and I can't print the panelized content because it's not the same display.
I read this thread but how can I say to the print module to use the "print" display I cloned instead of the default one ?
Any suggestions or ideas will be appreciated or if you have another idea for doing that you're welcome :)
Thank you !
In your print pdf template you can load the node then create a view with the display and finally render it : drupal_render(node_view(node_load($node->nid), "name of your display")) ;
Another way is to alter node entity info, telling that 'print' view can be panelized, i.e.
/**
* Implements hook_entity_info_alter().
*/
function mymodule_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['print']['custom settings'] = TRUE;
...
}
After that, you go to panelizer settings of your content type(s), and set whatever you want for the print view mode

Is It Possible To Use Embedded Resource Images For ObjectListView SubItems

I can't seem to find any information on this, but does anyone know if it is possible to use an embedded image from my.resources within an ObjectListView SubItem?
I am currently using images stored in an ImageList control, but I find for some reason, those images get corrupted and start displaying imperfections. I don't have the problem if I pull them from the embedded resources as I previously have with the normal listview control.
I am using the ImageGetter routine to return a key reference the ImageList, however, ultimately I would like to pull these from embedded resources. I would like to also do this for animated GIF references as well.
If anyone knows a way, could you please assist. Sample code would be appreciated.
Thanks
You can return three different types from the ImageGetter
int - the int value will be used as an index into the image list
String - the string value will be used as a key into the image list
Image - the Image will be drawn directly (only in OwnerDrawn mode)
So option number 3 could be what you want. Note that you have to set objectListView1.OwnerDraw = true.
If that does not work, an alternative could be to load the images into the ImageList at runtime. There is an example here.
this.mainColumn.ImageGetter = delegate(object row) {
String key = this.GetImageKey(row);
if (!this.listView.LargeImageList.Images.ContainsKey(key)) {
Image smallImage = this.GetSmallImageFromStorage(key);
Image largeImage = this.GetLargeImageFromStorage(key);
this.listView.SmallImageList.Images.Add(key, smallImage);
this.listView.LargeImageList.Images.Add(key, largeImage);
}
return key;
};
This dynamically fetches the images if they haven’t been already fetched. You will need to write the GetImageKey(), GetSmallImageFromStorage() and GetLargeImageFromStorage() methods. Their names will probably be different, depending on exactly how you are deciding which image is shown against which model object.

How to change header template in extjs 4 grid panel

I want to change default header template of grid. I do not know what config or property to set. I tried "renderTpl" , "tpl" , "metaRowTpl" but these property related to row in grid, where i want to change header.
Any example or link would be great.
Like above image, I want extra header/row/column-header in between where text will come from database (and basically it is filter information).
You change the header text with the following command
yourGrid.getView().getHeaderAtIndex(columnIndex).setText('Header Text');
http://jsfiddle.net/alexrom7/YNTuN/3/

How to add an image to a SAP Adobe Form from the MIME repository?

I have loaded an image to the SAP MIME Repository:
Name: watermark100.bmp
MIME Type: Icon (Under technical information on the properties window. I didn't set this, I assume SAP defaults that in based on the file type when I upload).
Now I'm trying to display this image in a SAP adobe form:
In the Form Interface I have created a global Constant:
GV_IMG_WATERMARK TYPE STRING VALUE 'watermark100.bmp'
In the Context I have created a Graphic Node:
Name: WATERMARK
Graphic Type: GRAPHIC CONTENT
Field: GV_IMG_WATERMARK
MIME Type: 'icon' //I have also tried '.bmp'
Unfortunately, when I test the form, no image displays. Any idea what I'm doing wrong?
Additional Comments:
I can display the image by pointing to the URL & embedding it in the form, but that is not sufficient for what I'm trying to do. The image have to be loaded from MIME, and displaying the node will be conditional.
There seems to be a somewhat convoluted way where I can convert the image to an XSTRING and pass that to the form, I will probably try that next, but it seems overly complex for what I'm trying to achieve.
Ok I've solved it in the following way:
Changed the data declarations as follows: The URL just follows the tree structure in the MIME Repository
data: gv_bmp_watermark type xstring.
constants: gc_url_watermark type string
value '/BC/PUBLIC/MyImages/watermark100.bmp'.
In the interface under Code Initialization I added the following: (Note that you have to import & export the relevant variables using the interface at the top - you'll get a fairly self-explanatory compile error if you don't)
//* Read Images
data: lr_api type ref to if_mr_api.
lr_api = cl_mime_repository_api=>get_api( ).
lr_api->get( exporting i_url = gc_url_watermark
importing e_content = gv_bmp_watermark ).
The Context node only changed slightly:
Name: WATERMARK
Graphic Type: GRAPHIC CONTENT
Field: GV_BMP_WATERMARK
MIME Type: 'image/bmp'

How to generate a report for particular XHTML tag/attributes?

I wan to check whole site's <img> image's for alt text. I want to get a report of, What is written in alt text or alt is defined or not from all images being used on whole site in every page.
Is it possible to get report like this? after getting report i will put alt or if alt is already added but blank, then will write description text.
Otherwise in a big site it will take huge time to go and check each page.
Site is on Intranet and accessible with username and password.
This isn't a direct answer, but since it seems like your motivation here is just to know which img elements don't have alt attributes, I wanted to add that not all img elements need alt attributes.
The HTML5 spec mentions which img elements should have alt attributes:
What an img element represents depends on the src attribute and the alt attribute.
If the src attribute is set and the alt attribute is set to the empty string
The image is either decorative or supplemental to the rest of the content, redundant with some other information in the document.
If the image is available and the user agent is configured to display that image, then the element represents the image specified by the src attribute.
Otherwise, the element represents nothing, and may be omitted completely from the rendering. User agents may provide the user with a notification that an image is present but has been omitted from the rendering.
If the src attribute is set and the alt attribute is set to a value that isn't empty
The image is a key part of the content; the alt attribute gives a textual equivalent or replacement for the image.
If the image is available and the user agent is configured to display that image, then the element represents the image specified by the src attribute.
Otherwise, the element represents the text given by the alt attribute. User agents may provide the user with a notification that an image is present but has been omitted from the rendering.
If the src attribute is set and the alt attribute is not
The image might be a key part of the content, and there is no textual equivalent of the image available.
Note: In a conforming document, the absence of the alt attribute indicates that the image is a key part of the content but that a textual replacement for the image was not available when the image was generated.
If the image is available, the element represents the image specified by the src attribute.
If the src attribute is not set and either the alt attribute is set to the empty string or the alt attribute is not set at all
The element represents nothing.
Otherwise
The element represents the text given by the alt attribute.
If you wanted to do this with Selenium it will be something like this
Dictionary<string,string> details = new Dictionary<string,string>();
int imgcount = selenium.GetXpathCount("//img");
for (i=0;i<10;i++){
details.add(selenium.GetAttribute("//img[i]#src"),selenium.GetAttribute("//img[i]#alt"));
}
foreach (KeyValuePair<string, string> kvp in details)
{
Console.WriteLine("key " + kvp.Key);
Console.WriteLine("Value " + kvp.Value);
}
That will print the src of the image and its ALT text.
Using TestPlan I came up with this quick script:
GotoURL http://stackoverflow.com/questions/2570421/how-to-generate-a-report-for-particular-xhtml-tag-attributes
foreach %Image% in (response //img)
set %src% as combineCurrentURL (selectIn %Image% #src)
set %alt% as trim (selectIn %Image% #alt)
if numComp 0 = (length %alt%)
Notice %src% ALT IS EMPTY
else
Notice %src% : %alt%
end
end
The output looks like below (a CSV report can also be generated if desired)
00000001-00 NOTICE http://sstatic.net/so/img/logo.png : Stack Overflow
00000002-00 NOTICE http://ads.stackoverflow.com/ads/ladywhobig.jpg ALT IS EMPTY
00000003-00 NOTICE http://sstatic.net/so/img/vote-arrow-up.png : vote up
00000004-00 NOTICE http://sstatic.net/so/img/vote-arrow-down.png : vote down
This works in both the HTMLUnit and Selenium backend to TestPlan.