Changing main image source on product page in magento - php

I need to change the way main image on product page is loaded (there is only one image) and make it be loaded from external url.
Now: image is loaded from media folder on my server.
Need: image is loaded from external url without being saved on my server
I have created an additional attribute "externalimg". Its value is eg "https://images.otto.de/is/image/mmo/12489608?$001PICT30$"
I tried editing media.php file which for some reason deliver no changes at all, even if I delete it from server. I use a custom theme.
I did this with catalog images and it worked fine. All products have different images, so changing base media path didn't work.
Thanks in advance.
UPDATE: I have now found out that with default magento theme changing media.phtml works fine. With my theme "yummy" it does not work. Any changes in media.phtml are just ignored.

You should be able to override /app/design/frontend/yournamespace/yourtheme/template/catalog/product/view/media.phtml
If it doesn't exist, copy it from base into your theme folder at the correct path.
However, your theme may also use an extension that is over-writing this default template file. You should be able to use something like https://github.com/AOEpeople/Aoe_TemplateHints to find the correct template, or simply find some specific HTML around the product image and then search your source code to find the relevant section to alter.

Related

X-cart css and categories image is not changing

I was working on one of the client's site, using x-cart 4.7 version, the template is Reboot. I change their CSS file, but the site style is not changing.
I tried couple method, but still not changing, here's what I tried:
Rename the var/template_c to regenerate the cache. (<- template support suggest)
Uncheck Do not check if templates are changed, it's already unchecked.
I can't use http://www.yoursite.com/xcart/cleanup.php to clear cache. No folder and path found.
I was thinking should use X-cart admin/template-name/template-clean up/ Clear templates/X-Cart cache
Will this method delete a lot of things? Because can't back up the site and database, and I not really familiar with this platform.
Question2: Trying to change categories default image, I changed the setting/Images location/categories-icon(or Banner System images
)it's not changing anything, but Product thumbnails/image is working.
I even change the file name in FTP still working, so I so confused where those image pulling from.
Thank you for all the help.
Q1: Try locating which CSS file is loading on the page. Use web-dev-console for that or just view the page's source code. Temporarily untick the 'Use speed-up tool for CSS' checkbox on the 'Main page :: General settings :: General' before that.
Q2: There are 2 types of category images.
http://demo.x-cart.com/demo_goldplus/Computer-hardware/
1. Temporarily disable the 'Flyout Menus' module to localize the problem with category's menu icon.
2. The same solution as for Q1. Find out which path is used for the category image in the source code.

how to make a product image clickable and redirect to product details site in wordpress/woocommenrce/uncode theme

I couldn't find a tutorial or hint regarding making a product image in the wordpress theme "uncode" clickable. when clicking on the product image, it only opens the image in full size but doesnt rather redirect to the details page.
I assume it isn't a big thing that needs to be changed/added, but finding it seems quite difficult, as I have no experience regarding this theme at all.
thanks upfront!
EDIT: What I am trying to find out, is how to make this (tutorial for another theme https://slocumthemes.com/2015/10/how-to-make-woocommerce-thumbnails-clickable/) for my theme, uncode.
can anybody help? I think I found the line of code in one of the php files, but I have no proper experience of php
You can override woocommerce template.
Create a folder named woocommerce in your uncode theme and further corresponding folders where relevant file is added in woocommmerce plugin. e.g woocommerce/templates/single-product/product-image.php.
In that overridden file you can customize the HTML i.e link your image.

Unable to Display Products in Magento

Our client is using custom search i.e., Searchperience at present they want to remove the custom search and enable the default magento search. While removing AOE_Searchperience related folders Products are not displaying at all. How can be this solved?
Perhaps you have not removed all the files and there is an XML file that is pointing to a template that doesn't exist.
Are you concerned with the category page or the product page or both?
If everything is displaying on the category page except the products then I suggest you add a quick echo('products would be here'); as the first line of code in the file /app/design/frontend/[your theme or base]/catalog/product/list.phtml
if you can see that string in your shop you know you have identified the correct phtml file and you should check to see if the product collection is populated.
if you do not see the string then you need to work out which list.phtml is being called by Magento. I would search my files for list.phtml but turning on Magento's system->configuration->developer->debug->template path hints (and add block names to hints) will expose which .phtml file is being called and what its block class is - that will help you flesh out if the wrong .phtml file is being used or if it is of the wrong class.
If the correct list.phtml is being called but the product collection is empty then there is something funny going on.
To remedy Magento behaving funny:
log out of the admin area and log back into the admin area
turn compilation off
turn compilation back on
re-index everything
refresh all the Magento caches including the Magento cache and the cache storage
refresh any external caches
try to refresh the page and see if that helped.
If that didn't help, switch to the default Magento theme and repeat the steps above. If the product still aren't there even in the default theme then it suggests there are still some module files getting in the way or maybe the core files have been changed but that would be very odd. Start with the .phtml and the block class (discerned from the debug hints mentioned above and follow the code back until you figure out why the category page has an empty product collection)
If the default Magento theme does display the product then you know your fault is theme specific so turn your theme back on and study the file local.xml very very carefully.

Change product view magento

We have a magento store with the magestore auction module installed.
When we click a category it still loads the theme/catalog/product/list.phtml instead of theme/auction/list.phtml
I have tried copy pasting the code from the auction template to another , this didn't suffice since it still got it's _productCollection from the Local/Mage/Catalog/Block/List.php instead of Local/MageStore/Auction/Block/List.php ... which doesn't have the right filters etc.
Any idea how i should solve this ?
How are your theme directories structured? In case it looks like app/design/frontend//default or so and your Auction extensions design files are not in base, you may need to copy some of its contents to your template directory.
Try first copying the following directories to your theme folder:
app/design/frontend/default/default/layout/auction-extension.xml
This file takes care of showing theme/auction/list.phtml instead of theme/catalog/product/list.phtml
app/design/frontend/default/default/template/auction-extension
The reason why it just displays the default list.phtml instead of your auction's list.phtml

How to add PHP or Javascript code to a custom content type

I am working with Drupal 7.17.
I have a custom content type I created called Sidebar Ad (machine name sidebar_ad) that I want to add Javascript and PHP to. From what I understand, in the templates directory of the theme I am working with, I need to create a file called 'page--sidebar_ad.tpl.php' and I can put PHP and Javascript code in there, and it will only run in blocks and pages that contain the custom content type Sidebar Ad.
I am trying this out with one of the stock themes, Bartik, and it is not working for me. I tried it by copying the page.tpl.php file, renaming it page--sidebar_ad.tpl.php, and adding a bit of text in a few places - at the top of the php file, and in the content div. But I don't see anything change on the pages on my site that contain that custom content type.
Is there something I am missing?
Most likely the thing you're missing is flushing Drupal's cache...any time you add a hook or template file, you need to flush the cache so the various registries can pick it up.
In the case of an overridden page template file you also need a copy of the standard page.tpl.php file in your theme. Same goes for the node template and most likely others, you need the original in there for the overrides to work.

Categories