I've been having image order issues with any place where you upload the images on the back-end (IE Product pages, Banner Slideshow etc)
I resolved the issue for the Product Pages (or atleast I think so haven't gotten to try the new code change yet) (found the answer here - just in case someone needs it) but I can't find anything on how to fix the same issue with the Banner Slideshows and I need the images in a certain order.
Also is there a way to make it so when someone clicks a banner that leads to an outside site that it will open in a new window instead of taking them off my site and on to the other?
Any help with either issue would be greatly appreciated! Thanks so much!
I resolved the issue for the Product Pages (or atleast I think so haven't gotten to try the new code change yet) (found the answer here - just in case someone needs it) but I can't find anything on how to fix the same issue with the Banner Slideshows and I need the images in a certain order.
Also is there a way to make it so when someone clicks a banner that leads to an outside site that it will open in a new window instead of taking them off my site and on to the other?
Any help with either issue would be greatly appreciated! Thanks so much!
Last edited by ann0314 on Sun Sep 25, 2011 6:18 am, edited 1 time in total.
for images to be in a certain order, you should add the last image first and work your way backwards. i found this problem also.
for opening an external link when you click the image, yes you can do this. there should be an area where you can add an external link under the banner image settings, im sure i remember seing it.
To make it open a new window. edit catalog/view/theme/yourtheme/template/module/banner.tpl
find
replace with
for opening an external link when you click the image, yes you can do this. there should be an area where you can add an external link under the banner image settings, im sure i remember seing it.
To make it open a new window. edit catalog/view/theme/yourtheme/template/module/banner.tpl
find
Code: Select all
<div><a href="<?php echo $banner['link']; ?>"><img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" title="<?php echo $banner['title']; ?>" /></a></div>
Code: Select all
<div><a href="<?php echo $banner['link']; ?>" target="_blank"><img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" title="<?php echo $banner['title']; ?>" /></a></div>
Thanks for the code! That solves one issue As for the other, I did notice ordering them backwards will work but then if you have to change one and hit save again on the back end it scatters them all around and you basically have to delete them all and put them all back in again or you cant get your order back I was hoping maybe there was some cool coding way to do it. I tried to take the code for the product pages that I linked to above and use that but it brought up an error so I'm thinking that the coding would need to be a bit different just not sure how
Had the problem with not being able to order the slideshow images. So I did a little digging. This works on ver 1.5.0 - this solution is working on my site, http://www.prairiepassions.net, where I am able to keep the welcome banner the first banner the customer sees.
in
/catalog/model/design/banner.php
I added the ORDER BY image ASC at the end of the long line.
I suspect that this will get overwritten with each system upgrade?
The way I order my images is to start by tens... 10_img.jpg, 20_img.jpg, 30_img.jpg etc. Then if I want I can add a file in the middle, say 15_img.jpg, without having to rename all the files.
I suspect this could also be made to sort by the banner description that is in the backend, allowing for easier control of the slideshow, but I find this easy and logical enough.
in
/catalog/model/design/banner.php
Code: Select all
<?php
class ModelDesignBanner extends Model {
public function getBanner($banner_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "banner_image bi LEFT JOIN " . DB_PREFIX . "banner_image_description bid ON (bi.banner_image_id = bid.banner_image_id) WHERE bi.banner_id = '" . (int)$banner_id . "' AND bid.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY image ASC");
return $query->rows;
}
}
?>
I suspect that this will get overwritten with each system upgrade?
The way I order my images is to start by tens... 10_img.jpg, 20_img.jpg, 30_img.jpg etc. Then if I want I can add a file in the middle, say 15_img.jpg, without having to rename all the files.
I suspect this could also be made to sort by the banner description that is in the backend, allowing for easier control of the slideshow, but I find this easy and logical enough.
I'll have to give this a try! Thanks so much for sharing. I fiddled some with it but couldn't seem to sort anything out on my own I'll let you know how it fairs for me. I'm hopeful it works though cuz that sure is annoying lol.
As for your question, looking at which file you modified here, yes you would need to keep track and redo this addition in other releases if this file changes since it isn't in the templates folders where it is semi protected
As for your question, looking at which file you modified here, yes you would need to keep track and redo this addition in other releases if this file changes since it isn't in the templates folders where it is semi protected
This worked for me to.
Thanks for the code dpfavand!
I made it into a vqmod so that you don't have to change the code again after an upgrade.
Thanks for the code dpfavand!
I made it into a vqmod so that you don't have to change the code again after an upgrade.
Use it? Like it? Want to support it but don't know how? Send a donation to show your appreciation.
Daniel's PayPal address - donate@opencart.com
Qphoria's Paypal address - qphoria@gmail.com
Brilliant stuff guys!
It would be good if this was added to the core or ideally some form of ordering which can be specified from the slideshow/banner module.
It would be good if this was added to the core or ideally some form of ordering which can be specified from the slideshow/banner module.
Hi Guys,
With regards to opening a link from the banner in a new window - is it possible to apply this to only one banner image and all the others open in the same window?
Thanks !
With regards to opening a link from the banner in a new window - is it possible to apply this to only one banner image and all the others open in the same window?
Thanks !
Don't know about anyone else, but sorting by "Title" was going to work out better for me. Changed "image" to "title" and now I don't have to rename images, just edit the title for re-arranging.
- Toby
"The only way to get to the top is to get off your bottom." - Fortune Cookie
I sort on image title by putting this in banner.php: ORDER BY title ASC
Then you don't have to name your images, just fill in titles just like '01 first picture' and '02 next picture'...
Then you don't have to name your images, just fill in titles just like '01 first picture' and '02 next picture'...
Thanks Guys,
Also sorted my slideshow order problem by using the ASC in:
Also sorted my slideshow order problem by using the ASC in:
Code: Select all
<?php
class ModelDesignBanner extends Model {
public function getBanner($banner_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "banner_image bi LEFT JOIN " . DB_PREFIX . "banner_image_description bid ON (bi.banner_image_id = bid.banner_image_id) WHERE bi.banner_id = '" . (int)$banner_id . "' AND bid.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY image ASC");
return $query->rows;
}
}
?>
I just called the banner Titles, the first column, banner1, banner2, banner3, etc and they came up in the correct order as dictated by the Title column.. not sure why that works but it does.
Hope that helps
Hope that helps
To sort banner images by title on the admin screen as well, do the following
open admin/model/design/banner.php
find public function getBannerImages
Last line of that function should be
return $banner_image_data;
Just before that line add this
open admin/model/design/banner.php
find public function getBannerImages
Last line of that function should be
return $banner_image_data;
Just before that line add this
Code: Select all
function sort_images_by_name($a, $b) {
return $a['banner_image_description'][1]['title'] > $b['banner_image_description'][1]['title'] ? 1 : -1;
}
usort($banner_image_data, "sort_images_by_name");
one other thing I noticed that may help is if you change a picture when you go back the sort order is reverse, if you just open the menu with the list of banners in it again, and its listed in the reverse order just click save again and it straightens it all out. At least on the cart I am currently working on.
To sort by banner title, I modified the code above posted by swazemarket by changing "ORDER BY image ASC" to "ORDER BY title ASC". I also noticed if banner titles are only numeric they don't sort properly. I solved this by naming banner titles: AD1, AD2, AD3, etc. and it works like a charm. Titles that were just numbers (like: 10, 20, 30) didn't work.
Code: Select all
<?php
class ModelDesignBanner extends Model {
public function getBanner($banner_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "banner_image bi LEFT JOIN " . DB_PREFIX . "banner_image_description bid ON (bi.banner_image_id = bid.banner_image_id) WHERE bi.banner_id = '" . (int)$banner_id . "' AND bid.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY title ASC");
return $query->rows;
}
}
?>
Web Studio West
Phoenix Website Design
Who is online
Users browsing this forum: No registered users and 34 guests