Need help finding a specific Magento Javascript file - magento

I'm hoping that someone in this forum can help with finding a specific JavaScript file in a Magento shopping cart.
I'm working on fixing SSL non secure items messages and I've found and fixed all of them except for one.
The image I'm looking for is called "pager_arrow_right.gif" and it's on a customer account page generated from:
app\design\frontend\default\our_theme\template\sales\order\history.phtml
The image src code is not in this file though, it looks like the image src is in a JavaScript file generated from that history.phtml file:
<script type="text/javascript">decorateTable('my-orders-table')</script>
Does anyone have any idea where the JavaScript file for the above code is located?
I just can't seem to find it..
Thank You !!
Janet

The function decorateTable is in js/varien/js.js but it only applies some class names. Normally that image is used in pagers for collections. The line following your javascript is:
<?php echo $this->getPagerHtml(); ?>
...which seems more relevant. Look at the file template/page/html/pager.phtml instead.

Related

Joomla alters the path of the images included in an article

I'm new to joomla and doing some changes to an existing website designed using Joomla.
Given below is a line that I've inserted to an existing article
<img SRC="images/myimages/demo/IM-0002-0025.jpg" class="highlighted" data-value="image_value"/>
but it does not display the image when I view it on website. When I view the source of the image in the webpage it shows below
<img src="http://xxxxxxx.cloudfront.net/images/myimages/demo/IM-0002-0025.jpg" class="highlighted mTSThumb" data-value="image_value">
My JPATH_BASE is http://localhost/mywebsitename/
but still it appends "http://xxxxxxx.cloudfront.net/" to the image path
I've even enabled the URL rewrite as mentioned in the joomla prepends to 'path'
But still it didn't change anything. Please help
It's been a while since I've used joomla but I'm sure you have to begin the line with a forward slash to before images.
<img src="/images/"
This makes it relational to the site.
I'm not sure whether this is a hack or not. but I've managed to fix the issue by specifying the image path followed by a ./
So now the image path looks like this and it works fine.
<img SRC="./images/myimages/demo/IM-0002-0025.jpg" class="highlighted" data-value="image_value"/>
Yes that looks right. Mark your answer as complete

magento 2 custom phtml page

Having just got myself acquainted (enough) with Magento 1.9, and able to make the customisations required, I've been told that once it's out, we're moving to Magento v2.0.
Having found the differences in the file structure, I believe I can see where to place my code for the custom pages we use, but how can I add this page from my project to a static block for later use?
Previously, the method used was as follows (I realise this may not follow the best practise, but it worked):
Create element folder within theme or core templates directory.
eg. /app/design/frontend/<theme>/default/template/myelement/mypage.phtml
Add this page/element to a static block using the following in the content editor:
{{block type="<theme>/default" template="myelement/mypage.phtml"}}
This block can then be added to the category pages as required.
In Magento 2, I have tried what I believe to be required, which is replicating the file structure and adding phtml files to this, so the template file now resides in:
/app/code/<supplier>/<module>/view/frontend/templates/mypage.phtml
Adding to the content editor the following:
{{block type="<supplier>/<module>" template="mypage.phtml"}}
Unfortunately, this does not display the intended page (element). It doesn't display the calling "{{block" entry either, which usually happens when the line is invalid, so I can only assume that I'm missing something with the link to this template.
If anyone can offer some assistance with this, I would be most grateful.
EDIT:
Continued research on this has led me to the following assumptions:
Magento 2 requires more than just a new .phtml page, even for simple customizations.
I'm still missing something.....
Having gone through 3 different tutorials on creating new modules for Magento 2, each providing slightly different methods, but fundamentally being the same thing, I now have what I believe should be all the code elements to make a new .phtml template for display in a static block.
This has led to an additional problem though.
While I have the required code, I cannot add the module. Adding the module to etc/config.php, as suggested in 2 out of the 3 tutorials, simply crashed M2, both admin and frontend when you try to clear the cache. This is the case after manually clearing cache folders in the var directory.
Also, still unable to add the .phtml template file to a static block or page using content editor.
Not much hair left to pull out here, so looking for help! Thanks in advance
There are a few samples on GitHub, including https://github.com/magento/magento2-samples/tree/master/sample-module-newpage which shows a module adding a new page with a very simple PHTML template file. This example does not use CMS content editing however - it is a sample based on using layout files.
You mentioned you were getting crashes. Would need more details to help on that one. If you got it solved, could you update this question and accept a response to close it out? Thx!
You Should try "class" instead of "type". So your code should look like.
{{block class="<package>\<module>\Block\MyBlock" template="mypage.phtml"}}
You Should try "VenderName_Modulename::myelement/mypage.phtml" instead of "myelement/mypage.phtml". So your code should look like.
{{block class="VenderNameModulename\Block\MyBlock" template="VenderName_Modulename::myelement/mypage.phtml"}}

How can I get Javascript results to show up in the Order Review section of the Onepage Checkout?

Hello I'm having trouble getting <script type="text/javascript"></script> display in the template/checkout/onepage/review/review.phtml or even the template/checkout/onepage/review/info.phtml. In fact the only place I can get a script tag to display is in the template/checkout/onepage/onepage.phtml.
Can anyone explain to me what I can do to get script tags to show up in the Order Review section? I need to add these scripts so I can tag orders for tracking.
Thanks in advance!
Magento will not strip out script tags so it is quite possible that you are editing the wrong template. Turn on template path hints to get the right file then insert the script tag.
Your template must have been overriden by some other modules template files.
BTW script tags are not written in template files. This causes many issues some of which I have personally faced
Include script tag in layout.xml using addJs in head or footer reference
But if you still want to include script in js see the current template file from the template path shown by fkim

Place static javascript code on all pages

Im new to Magento. I would like to know how can I place static javascript code across all pages of the magento site. The JS code does some initilization and includes another hosted js file. Also, I would like to add this code in footer of all pages.
Any guidance/docs/codes welcomed.
Thnx in advance...
The fastest way is to create a new file in the "js" folder in the root
of your website. To include the Javascript file in the code, go to
System -> Configuration -> Design -> Footer -> Miscellaneous Scripts
And add your script there like you would normally do.
There are other ways, but this is the easiest way to do it.
Edit: Changed HTML head to Footer, thanks dagfr
- Edit -
The above example is not what he meant, he wants to add JS to the footer, so when he distributes the module, the JS will also be in the footer.
Answer
You can use the layout .xml file for your module to add a JS file.
To do this, you can add the following code:
<action method="addItem"><type>js</type><name>script_name_here.js</name></action>
In order to place it in the footer, you will have to make a new block, which is explained in the following article.

Magento : CMS upload image fail silently

I am trying to figure out why the tinyMCE WYSIWYG editor in the CMS module of Magento will not upload images. I can create/delete folders but any file will simply not get uploaded, and there seems to be no message as to why the file is not successfully written on the server.
Anyone may have an idea why?
** Update **
I'm using Magento 1.6.2. I have tried to track down the problem and it seems that the controller never gets executed. I have added a line to log the arguments in the uploadAction() action (in Mage_Adminhtml_Cms_Wysiwyg_ImagesController) and nothing gets logged.
This is project inherited from someone else, and was modified to some extend, but nothing seems to point out that this part of Magento would have been touched in anyway by the modifications.
** EDIT**
The project associated with this question has been dropped and I no longer can provide an answer to this question. If anyone can confirm a working answer (as this problem was apparantly common with Magento), I will gladly mark that answer as "accepted".
Otherwise, I will flag this question for removal for the aformentioned reasons.
Thank you.
Other than solutions provided here, it may occur when you use a CDN (or a different domain) for your javascript and media files in admin panel. If you use CDN, use it for your website(s) scope and use your own domain for default scope. It will make your website(s) media and javascript files to be loaded from CDN, and backend's media and javascript files to be loaded from your own domain. This will solve your problem.
There are some known issues with flash image uploader on Magento. Unfortunately when it falls, it falls silently. Here are some cases when smth can break it:
if you try to use it with secured connection using open ssl certificate
if you're using it on server with apache authentication
on some Magento versions with prototype 1.7
I think the latter is your best bet. Maybe you should try to apply the patch from here: http://www.magentocommerce.com/boards/viewthread/4348/P45/#t327010
In my case it was a cross domain problem, and one quite hard to find if you ask me...
What was puzzling me was that the uploader for product images was working like a charm but the one in the CMS section was failing completely silently. We are serving the skin folder from an Amazon S3 bucket, and the flash uploader lives under that folder.
Interestingly enough, our version of Magento (1.7.0.2) is using two different methods to calculate the path to the SWF file, depending whether you are under CMS or Product update.
The CMS file (app/design/adminhtml/default/default/template/cms/browser/content/uploader.phtml) is using the following method to embed the Flash Uploader:
<?php echo $this->getSkinUrl('media/uploader.swf') ?>
While the Product image uploader is using:
<?php echo $this->getUploaderUrl('media/uploader.swf') ?>
In our case, the first one resolves to the AWS S3 url, obviously in a separate domain, while the second one will still reference the local domain's url.
So yeah, the quick, dirty fix would be to replace getSkinUrl for getUploaderUrl in app/design/adminhtml/default/default/template/cms/browser/content/uploader.phtml. Alternatively you can extend the core to load a different template in which you would have replaced that method.
I hope this helps somebody... I wish I had found something like this five days ago when I first stumbled upon the issue :-)
Are you using flash uploader with https? If so, is your secure address in differente domain (usually used in shareds ssl)?
I got some trouble with this. I solved by installing a flash uploader disabler plugin.
You can download the plugin with this downloader key:
http://connect20.magentocommerce.com/community/Dull_Uploader
I hope it helps.

Resources