So i set up the banners as if they were normal desktop banner images through the admin.
Then in 'catalog/controller/module/slideshow.php' i added a mobile value so that i can add the following data attributes to the img tag in 'slideshow.tpl':
- data-image-desktop | Which is the normal image that was added in the admin (product-banner.jpg)
- data-image-mobile | Which is the same name as the desktop image with -mobile added to it (product-banner-mobile.jpg) Also the resizing of the image is done in 'catalog/controller/module/slideshow.php'.
So now that i have both image paths its just a case of using javascript to determine if its on mobile or not and and then loading the correct data attribute into the src of the img tag.
Little snag is that when adding the normal desktop banner the person adding them needs to remember to add the mobile version, i did say it was a bit hacky but it does the job. Ideally i would do it so that in the admin you can select the mobile version but I am a little pressed for time in the office so this was an agreed solution.
Anyways, hope this helps someone down the road and I did this in opencart version 2.0.3.1
I am coping withe the same problem... Well, almost.. I want to serve different sizes of the images for mobile/desktop... With html is srcset, but with php i am totally lost... I got the idea, but i dont know what to put in php, to make different images load if the screen is, for example, less then 900px...
Or any over ideas, how to speed thing up for mobile users in the slideshow? If using the default one!
Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk
You won't be hiding it completely. It will just be hidden on a mobile device and a different banner will appear in its place.
Opencart 1.5.6.5/OC Bootstrap Pro/VQMOD lover, user and geek.
Affordable Service £££ - Opencart Installs, Fixing, Development and Upgrades
Plus Ecommerce, Marketing, Mailing List Management and More
FREE Guidance and Advice at https://www.ecommerce-help.co.uk
with regards to speeding it up, not really with the Opencart version. I have a light weight presentation which scales to best fit and some other features https://www.opencart.com/index.php?rout ... n_id=26852
DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.
https://www.youtube.com/watch?v=zXIxDoCRc84
Users browsing this forum: No registered users and 67 guests