-
Attribute image replaces main product image on select [Support Thread]
Has anyone managed to get this working with Dropdown attributes, rather than Radio/Check Boxes??
https://www.zen-cart.com/downloads.php?do=file&id=699
The file in question that would need altering would be:
includes/modules/custom_template/attributes.php
Can anyone offer any suggestions?
-
Re: Attribute image replaces main product image on selecting attribute
Has anyone got this working? I can't get it to work I would like to see an example website that this is working on. I installed it on a version Zen Cart 1.3.8a even though the mod is for version v1.3.7 could this be the problem?
Thank you
-
Re: Attribute image replaces main product image on selecting attribute
I had it working on 1.3.7... Worked perfectly with Radio Boxes, but I need it for Dropdowns.. Anyone?
-
Re: Attribute image replaces main product image on selecting attribute
I am using 1.3.7 and can't get it to work on radio or check boxes.
I have attributes working except when I select 6 in the attribute style. At this point I see the attribute name but do not have any radio buttons or check boxes. No images either.
I reset the attribute style to any number 0 - 5 and the attribute displays properly and works normally.
I would prefer a dropdown box as well but need this module to simply work before moving forward.
-
Re: Attribute image replaces main product image on selecting attribute
I would like this for dropdowns too! Anyone contacted the original creator?
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
CJ Internet Sales
I am using 1.3.7 and can't get it to work on radio or check boxes.
I have attributes working except when I select 6 in the attribute style. At this point I see the attribute name but do not have any radio buttons or check boxes. No images either.
I reset the attribute style to any number 0 - 5 and the attribute displays properly and works normally.
I'm having this same problem. The only difference is that I'm using 1.3.8a. This seems like a great idea but I just can't get it going.
Has anyone got this working properly?
Thanks
Nancy
-
Re: Attribute image replaces main product image on selecting attribute
has anyone found a solution to this yet? I am using 1.3.8a as well and when i select style 6, images and everything disappears but if I select any style 0-5 it looks perfect.
Thanks!
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
exoticcorpse
Has anyone managed to get
this working with Dropdown attributes, rather than Radio/Check Boxes??
The file in question that would need altering would be:
includes/modules/custom_template/attributes.php
Can anyone offer any suggestions?
I'm looking for this exact thing currently myself and I got the latest version of Zencart as well. I've seen this done on some online stores before and would love to have that as it saves up "space" in product information pages.
-
Re: Attribute image replaces main product image on selecting attribute
Is this an option that was ever figured out? I am in desperate need of this option and would like to know very much. Any help appreciated. Thanks
-
Re: Attribute image replaces main product image on selecting attribute
Yes, it works on 1.3.8
I did it on dropdown and it works the same.
Click "Edit" next to the option name you already have in there.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
SHokuf
Yes, it works on 1.3.8
I did it on dropdown and it works the same.
Click "Edit" next to the option name you already have in there.
Did you choose any other option when you set it to 6? I can't get this to work. I am using Zen Cart 1.3.8a Has anyone else got this to work in V1.3.8a??
-
Re: Attribute image replaces main product image on selecting attribute
Has anyone got this to work with drop down boxes?
Also, where does the file attrib_prod_info.php go?
-
Re: Attribute image replaces main product image on selecting attribute
I am using Zen Cart 1.3.8.
-
Re: Attribute image replaces main product image on selecting attribute
This mod does not seem to follow the proper override structure, i.e. it replaces some of the core zen cart files without using an override. So the next time you upgrade, you are going to have big headaches if you use this mod.
I have not installed the mod for this reason, although I think it is a very good idea.
-
Re: Attribute image replaces main product image on selecting attribute
I have managed to get this to work on 1.3.8p3.
Looking at the instructions I think English ( or even American English) is not the first language of the developer.
This is not his fault but it does make the instructions a bit more tricky :)
Before adding anything I changed a couple of directory names
I changed /admin/ to /ADMIN_OVERRIDE_NAME/ - ie what I have for my admin directory
and includes/modules/custom_template to includes/modules/TEMPLATE_OVERRIDE_NAME/ ie what I have for my template name
Also in attrib_prod_info.php I changed line 23 from
PHP Code:
<?php echo '<a href="javascript:popupWindow(\'' . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'products_image_large_additional=' . 'images/'.$attributes_image) . '\')">' . $image . '<br /><span class="imgLink">' . zen_image('images/bigger_picture.jpg', 'larger image', '140', '44') . '</span></a>'; ?>
to
PHP Code:
<?php echo '<a href="javascript:popupWindow(\'' . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'products_image_large_additional=' . 'images/'.$attributes_image) . '\')">' . $image . '<br /><span class="imgLink">' . TEXT_CLICK_TO_ENLARGE . '</span></a>'; ?>
ie removed the ref to images/bigger_picture.jpg which doesn't exist and so was getting a 404
I ftp'd up the files and applied the sql patch - I must admit I was a bit concerned that I had to add a file at the root of the zen cart install (attrib_prod_info.php) as this does not seem the correct place for it - however since I need the functionality I have put up with it for now
I then went into the attributes controller and added large images for the attributes - I could not point them to the path I wanted as it would only allow me 1 level of nesting - that is probably just a zen cart thing though
The end result is it works - though I can't say it works well out of the box -
To improve it I would wish better integration with Image Handler 2 and better use of overrides. - just my 2p worth
To end I would like to say I am a zen cart newbie so take what I say with a pinch of salt - as always before trying something you are unsure of back up your database and your site before applying any changes
Cheers
T
-
Re: Attribute image replaces main product image on selecting attribute
Thanks for the info Taranis. I think you did it the right way by putting things in override folders.
I don't understand your comment "I changed /admin/ to /ADMIN_OVERRIDE_NAME/ - ie what I have for my admin directory"
Do you mean that you created an OVERRIDE_NAME folder inside of your regular admin folder? So instead of putting the files inside /admin/ you put them into /admin/OVERRIDE_NAME/ instead?
-
Re: Attribute image replaces main product image on selecting attribute
No, this is referring to the very important security recommendation that every Zen Cart installation should have its /admin/ folder renamed to something hard to guess (and appropriate file references changed accordingly), so that hackers have a harder time finding it.
See the link at the top of the "Concerns about hack attempts" forum for more info.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
gjh42
No, this is referring to the very important security recommendation that every Zen Cart installation should have its /admin/ folder renamed to something hard to guess (and appropriate file references changed accordingly), so that hackers have a harder time finding it.
OK, thanks. I did that a long time ago.
I am always wondering about the override system...would it be possible to add a folder inside /admin/ that would act as an override folder? e.g. /admin/mytemplatename/ ? Or could I do the same in any other folder where no current override is setup?
-
Re: Attribute image replaces main product image on selecting attribute
You would have to build the override functionality in the PHP code to use override folders; just adding folders would do nothing.
-
Re: Attribute image replaces main product image on selecting attribute
OK, thanks. that's what I suspected, but always wanted to ask.
For the benefit of other readers interested in this mod, I have installed it according to the original instructions and it works perfectly for me on zen cart version 1.3.8a.
I have not come across any problems except, as Taranis mentioned, the instructions are a little hard to decipher. I also have not noticed any problem that Taranis mentioned about "images/bigger_picture.jpg", but maybe I will notice that when I play around with it some more.
I am still worried that future zen cart updates will break the functionality of this mod (since it does not seem to use an override system), but I may be wrong about that. We'll see. The good news is that it is pretty easy to re-install if it does have problems in the future.
-
Re: Attribute image replaces main product image on selecting attribute
Do the files replace core files? if not, they will be safe even if they are in core folders. Are they in folders that have overrides available?
V1.3.9 will only have bug/security fixes for v1.3.8a, so it shouldn't be hard to merge any files as long as you keep good records of what you have. V2.0 will require all mods to be rebuilt anyway, so the structure of this mod will become irrelevant.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
thomasw98
For the benefit of other readers interested in this mod, I have installed it according to the original instructions and it works perfectly for me on zen cart version 1.3.8a
I'm using the same version, and cannot get this module to perform as it should.
If I select "radio button" as the option type, my option values disappear on the front end. Also happens when I uses "check box". I haven't tried to set the option type to anything other than those two, other than "Drop Down"...which is what I really need to use.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
Dollfayce
I'm using the same version, and cannot get this module to perform as it should.
If I select "radio button" as the option type, my option values disappear on the front end. Also happens when I uses "check box". I haven't tried to set the option type to anything other than those two, other than "Drop Down"...which is what I really need to use.
In the instructions given with this mod, you have to edit the option name and select option 6 under image styles to get the images to switch.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
MsHutch
In the instructions given with this mod, you have to edit the option name and select option 6 under image styles to get the images to switch.
Yes, as per the instructions...I did do that. I've checked and double checked that I've followed instructions to the "t."
-
Re: Attribute image replaces main product image on selecting attribute
I am having the same problem as Dollfayce and many others in this thread. I have installed this add-on EXACTLY as the instructions (obviously English is not strong for the writer of the instructions) say but I also am having the same exact results. I am using Zen Cart 1.3.8a.
If I select "radio button" or "check box" as the option type and 6 as the Attribute Style for Radio Buttons/Checkbox, my option values disappear on the front end. There is a place on the Item page that shows "Please Choose" and the name of the option but there are no choices to select from.
Can someone who has gotten this to work show us a working store to prove it and also detailed instructions on how to get this up and running?
-
1 Attachment(s)
Re: Attribute image replaces main product image on selecting attribute
i did get this up and running on 1.3.8a(had to edit some files)
im attatching the files here
the instructions are pretty straight forward,
just make sure you have value 6 in option name manager (edit an option name)
it does work for dropdowns
PROOF:
http://southcrystals.com/index.php?m...products_id=22
select color Extra fine, image changes from purple stone to orange
I will not leave this up forever, so please respond when you have seen proof
-
Re: Attribute image replaces main product image on selecting attribute
Thank you to AmandaGero for posting a link to an actual working site with this add-on functioning so that I could have proof that it does work. I found the problem that I am sure is what is causing everyone else headaches with getting this to function properly.
The problem is that the distribution has one file in the wrong folder.
/includes/modules/custom_template/attributes.php
should be placed into your site at this location
/includes/modules/attributes.php
My guess is that the location of this file changed in the standard distribution of Zen Cart somewhere between v1.3.7 and 1.3.8a.
I did this and got it working on the site I am building. Maybe someone could fix this in the distribution in the ZC add-on downloads so other people don't continue to have problems with this.
-
Re: Attribute image replaces main product image on selecting attribute
No, the folder location given is correct; you do need to change the generic "/custom_template/" to whatever your template name is. If you didn't change this name, the file would be orphaned and have no effect.
Since the /includes/modules/custom_template/attributes.php file replaces the function of the standard /includes/modules/attributes.php file, you need to keep it in an override location so it will be safe from erasure during an upgrade.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
gjh42
No, the folder location given is correct; you do need to change the generic "/custom_template/" to whatever your template name is. If you didn't change this name, the file would be orphaned and have no effect.
Since the /includes/modules/custom_template/attributes.php file replaces the function of the standard /includes/modules/attributes.php file, you need to keep it in an override location so it will be safe from erasure during an upgrade.
It might help people trying to use this if they knew that. That is not explained in the limited documentation and it was also never mentioned on this thread or anywhere on the forum until you posted that. Thanks for enlightening all of us as to what the solution to the problem was.
I hope, for the sake of future users, that someone will update this contribution's documentation so that it explains how to use it better.
-
Re: Attribute image replaces main product image on selecting attribute
Good mod documentation always includes a note to change /your_template/ or whatever foldernames to the user's custom foldername, if applicable. It has been stated innumerable times in the forum in response to applicable situations as well. It is also stated in the tutorials in regard to making your own edits to template files.
It would be good for someone (preferably the mod's author) to update its docs with the information.
-
Re: Attribute image replaces main product image on selecting attribute
This ALMOST works.
Was able to install it and getting working with v1.3.9d.
However;
1. It removes the attribute images from the page, you can then only see them if you select them one at a time from the drop down.
2. Even though you can then click on the attribute it will bring up a window with the same size image. (It will not bring up a "larger" image)
3. It does replace several files that may be "core", I'm not sure. i.e. options_name_manager.php
This would be a highly desired mod if those issues could be addressed. Any of you coding guru's up to it? :flex: :smile:
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
Nineve
This ALMOST works.
Was able to install it and getting working with v1.3.9d.
However;
1. It removes the attribute images from the page, you can then only see them if you select them one at a time from the drop down.
2. Even though you can then click on the attribute it will bring up a window with the same size image. (It will not bring up a "larger" image)
3. It does replace several files that may be "core", I'm not sure. i.e. options_name_manager.php
This would be a highly desired mod if those issues could be addressed. Any of you coding guru's up to it? :flex: :smile:
Hi there Gir.. This is very interesting to me. I'm rather new to Zen-cart and this is my first post. I have spent a couple of weeks playing with zen-cart after using oscommerce previously.
I have installed version v1.3.9d, image handler 2, coen uri mapping, google base feeder and all work fine. This brings me to a couple of questions..
How the hell did you get this plugin working? Will it work with image handler 2 installed?
I want to achieve something similar to the product page of prestashop ideally, and thought this plugin might help me. Shall I just not bother with this plugin? Thanks in advance for any advice :)
-
Re: Attribute image replaces main product image on selecting attribute
I ended up not using it because it did not make sense for the site I am making to only be able to view the attributes one at a time when the visitor selects one in the pull down menu. :no:
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
gjh42
No, the folder location given is correct; you do need to change the generic "/custom_template/" to whatever your template name is. If you didn't change this name, the file would be orphaned and have no effect.
Since the /includes/modules/custom_template/attributes.php file replaces the function of the standard /includes/modules/attributes.php file, you need to keep it in an override location so it will be safe from erasure during an upgrade.
Thanks! This is all I had to do.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
WillyWanka666
Thanks! This is all I had to do.
Uh...I'm facing what most likely is something small and easy, but as usual very troublesome. I got the attribute replaces main image working properly until I added another module. I think the two are conflicting somehow.
http://www.zen-cart.com/index.php?ma...roducts_id=994
and
DPUv2 found here:
http://chrome.me.uk/index.php?page=zen_cart_modules
Any thoughts? Thanks as always.
-
Re: Attribute image replaces main product image on selecting attribute
Since they both operate on the product info page and attributes, they likely use one or more of the same files. You will need to examine the files in both mods and merge the customizations from any that overlap.
It would be a service to the community if you then posted at least which files overlap, if not what code to merge.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
gjh42
Since they both operate on the product info page and attributes, they likely use one or more of the same files. You will need to examine the files in both mods and merge the customizations from any that overlap.
It would be a service to the community if you then posted at least which files overlap, if not what code to merge.
PHP is almost completely alien to me, and I go :blink: pretty quick. I was hoping the author of one of the two mods would point me in the right direction. I will most certainly post my results in all three threads that I'm subscribed to as soon as I find the answer.
-
Re: Attribute image replaces main product image on selecting attribute
If you start by comparing the lists of files in each mod, that will narrow the field quickly. Then use Winmerge or the like on each file versus the original version of it and make notes, then compare the mod file versions against each other. If the mod changes are to different lines in the file, you can probably winmerge them into one file easily enough. If the two mods both alter the same line(s), that will require skillful editing. Let us know what you find and we may be able to help if needed.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
gjh42
If you start by comparing the lists of files in each mod, that will narrow the field quickly. Then use Winmerge or the like on each file versus the original version of it and make notes, then compare the mod file versions against each other. If the mod changes are to different lines in the file, you can probably winmerge them into one file easily enough. If the two mods both alter the same line(s), that will require skillful editing. Let us know what you find and we may be able to help if needed.
I'll give it a try this weekend. The only thing is that I'll be looking blindly, in hopes of stumbling across a constant. If any advanced users that know php feel like helping the zen community figure this out, it'd be GREATLY appreciated.
-
Re: Attribute image replaces main product image on selecting attribute
You won't "stumble across a constant". If there are differences, you will see them in winmerge.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
gjh42
You won't "stumble across a constant". If there are differences, you will see them in winmerge.
Oh, Sorry. I'm still a little new to the eCommerce. I didn't bother even researching winmerge, before I replied. I guess I am a typical American at times. It looks pretty cool. I assumed it was for just comparing identical files, as there are no duplicate files in the two modules. This looks to be a great tool for examining module files before you install them. Don't know if I'll be able to wait till the weekend for this. Looks like I'll be up late the next few nights. Thanks again. :clap:
-
Re: Attribute image replaces main product image on selecting attribute
For examining single files, there is an even better tool: a file editing utility like Notepad++ (not Notepad). It's also free from Sourceforge, and it will read the file extension and give appropriate syntax highlighting so you can see the different kinds of elements in a statement (much like the PHP and HTML code boxes in the forum).
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
gjh42
For examining single files, there is an even better tool: a file editing utility like Notepad++ (not Notepad). It's also free from Sourceforge, and it will read the file extension and give appropriate syntax highlighting so you can see the different kinds of elements in a statement (much like the PHP and HTML code boxes in the forum).
COOL! Thanks again. I've been tasked with wedding invitations this weekend, so I'll probably have to put this off for a short while :blush:. I'll keep everyone updated as soon as I find a result, and hopefully a solution.
-
Re: Attribute image replaces main product image on selecting attribute
Hi All,
I have been using Zen Lightbox, with ih2 happily for ages and they are all up to date.
I want to integrate the 'attribute replaces main image' addon and am trying to get zen Lightbox to work in the same way it does with additional and main images.
I think the file i need to alter is below where i have tried to copy the code from tpl_modules_main_product_image.php. I think my problem is with the java script. If i dont include the documment.write script part it returns the larger image fine. If i add as below (and in tpl_modules_main_product_image.php) The image is not there (or the ability to clisk it obviously)
Code in file
Code:
...
<?php
echo '<script language="javascript" type="text/javascript"><!--
document.write(\'<a href="' . zen_lightbox('images/'.$attributes_image, $alt, LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT) . '" rel="lightbox[gallery]" >' . $image . '<br /><span class="imgLink">' . zen_image('images/bigger_picture.jpg', 'larger image', '140', '44') . '</span></a>\')//--></script>';
?>
...
HTML result
HTML Code:
<script language="javascript" type="text/javascript"><!--
document.write('<a href="images/attributes/PMXA-67RS.png" rel="lightbox[gallery]" ><img src="bmz_cache/4/4f1f33407f5f2208814e35797be58f8f.image.145x200.png" alt="" width="145" height="200" /><br /><span class="imgLink"><img src="images/bigger_picture.jpg" alt="larger image" title=" larger image " width="100" height="100" /></span></a>')//--></script>
But no actual code to make it happen
Any help is appreciated :blush:
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
Nineve
This ALMOST works.
Was able to install it and getting working with v1.3.9d.
However;
1. It removes the attribute images from the page, you can then only see them if you select them one at a time from the drop down.
2. Even though you can then click on the attribute it will bring up a window with the same size image. (It will not bring up a "larger" image)
3. It does replace several files that may be "core", I'm not sure. i.e. options_name_manager.php
This would be a highly desired mod if those issues could be addressed. Any of you coding guru's up to it? :flex: :smile:
I have the same experience and find the add-on useless due to this.
-
Re: Attribute image replaces main product image on selecting attribute
LOL! I tried using winmerge and had know idea what I was looking for, or which file to replace or alter, if at all. The only two files that have the same name is the attribute.php file. Those two files are in two different directories. I think winmerge is more suited for comparing two files that are trying to accomplish the same task(s). I'm going to start looking for an alternative and report back my findings. If anyone else knows of how to update the displayed price upon selection of an attribute, PLEASE let us know. I'm truly baffled by the idea that this is not a preexisting function of zencart. I'm sure that one or more files for each module, is using one or more of the same core file(s). Maybe that's where the conflict is. I'll give notepad++ a try next. Maybe it can help me find which core file(s) these modules are both using.
-
Re: Attribute image replaces main product image on selecting attribute
I know this hasn't been read for a long time but has anyone actually managed to get this working in 1.3.9h? Im desperately trying to get this working (using IH2 as well) and for the life of me, i cant seem to get the images to swap with a dropdown?
Anyone? Please? HELLLLPPPPP!!!!!
-
Re: Attribute image replaces main product image on selecting attribute
I am also using stock by attributes and dynamic dropdowns for stock with attributes......
Really need to get this working asap... Please help!
-
Re: Attribute image replaces main product image on selecting attribute
Google "product attribute pictures"
Nick is the guy you want to talk to. He was more than happy to help. I got everything I ask for and more. I regularly refer to what he provided me as, "Too damn useful not to have." He also offers customization to fit individual specifics.
-
Re: Attribute image replaces main product image on selecting attribute
I had a chat with Nic, and as helpful as he was, the problem is that I'm no coder :( so whilst i do understand some php... his terminology and suggestions wont help :(
The other problem is that he only really does things when he is paid to do so, and as a result he doesn't use this contribution, he doesn't even know much about it.
If there is anyone out there who can try help me without charging me for it, I'd really appreciate it.
-
Re: Attribute image replaces main product image on selecting attribute
In response to your question, I really don't know much of anything about the mechanics of this mod. And it doesn't matter how long it has been since I posted in a thread, if it comes up again I will see it and take a look.
-
Re: Attribute image replaces main product image on selecting attribute
It's highly doubtful you'll find someone to help out with PHP for free. I thought his prices were more than fair. He actually DID do a couple of little tweaks free of charge. The point is, that it was well worth the cost. I spent close to a month sifting through this file and that one, all to no avail. I'm a novice with PHP as well. I guess it just boils down to how much is your time worth. :unsure:
-
Re: Attribute image replaces main product image on selecting attribute
Willywanka, you're missing out on the fact that this addon has been supplied to the community for free. At the same time, there has to be someone who has managed to get it up and running or someone who has something similar up and running.
I see no point in paying $100 for the exact same script with one or two changes that actually make it work when all I actually need is a little bit of help from someone to get this script working.
If there wasn't something like this mod or an alternative, then yeah i'd probably do what you did and pay $100... but until such time as I have confirmed that there is no way to do it without paying someone, I'll just keep trying.
But thanks anyway, hopefully once i've come up with a solution i'll be able to help guys who were in my position for free.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
shiff
Willywanka, you're missing out on the fact that this addon has been supplied to the community for free. At the same time, there has to be someone who has managed to get it up and running or someone who has something similar up and running.
I see no point in paying $100 for the exact same script with one or two changes that actually make it work when all I actually need is a little bit of help from someone to get this script working.
If there wasn't something like this mod or an alternative, then yeah i'd probably do what you did and pay $100... but until such time as I have confirmed that there is no way to do it without paying someone, I'll just keep trying.
But thanks anyway, hopefully once i've come up with a solution i'll be able to help guys who were in my position for free.
Cool! Good luck. We all hope to hear from you when you find the solution.
-
Re: Attribute image replaces main product image on selecting attribute
# Zencart v1.3.9h
# Apache/2.2.14 (Fedora)
# MySQL client version: 5.0.88
# PHP extension: mysql
I have a fair understanding of zen cart and mod installation. This mod installed and I have the additional attribute styles #6 and #7 displayed in the attribute options page.
I select #6 for my item attribute (color).
From here I'm a bit stumped. Where do I associate an image with an attribute? I cannot see where (expectantly in the attributes controller page) I upload and associate an image with the attribute color.
Please advise and thanks in advance for your help.
-
Re: Attribute image replaces main product image on selecting attribute
Look for "Swatch" in Attributes Controller.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
gjh42
Look for "Swatch" in Attributes Controller.
I just wanted to document the fix for this, so others understood.
If found that you cannot apply an image to an existing attribute. If I attempted to add an image to an existing attribute (say color blue) it would bark and error that it cannot add image since the attribute existed (Duplicate Attribute).
I removed the attribute (blue) and re-added it and used the swatch image upload feature at the bottom of the page.
Thanks,
-
Re: Attribute image replaces main product image on selecting attribute
I just successfully added an image swatch to an existing attribute that had no image in my local test install. Did you try to select the option name and option value in the boxes to get the attribute to add the image to? That would be creating a new attribute that was the same as an existing one for the product, and would fail.
Edit the attribute in the list of attributes the product already has.
-
Re: Attribute image replaces main product image on selecting attribute
I have this working with an Image zoomer. The image zoomer works upon initially loading the page but when the attribute changes and the image switches the image zoomer no longer works. I think it may have something to do with the new image that's being loaded or the order of the scripts being called but I'm not sure. Let me know if you any ideas or need any additional information to solve this problem.
-
Re: Attribute image replaces main product image on selecting attribute
Is there any way to switch the additional images that show when the new main image is loaded? e.g. when a blue attribute is loaded, the additional images for that model comes up.
-
Re: Attribute image replaces main product image on selecting attribute
Not without new custom coding. I don't think any existing mod covers that situation.
-
Re: Attribute image replaces main product image on selecting attribute
Yeah I figured, how difficult do you think it would be. I'm alright with coding, but I've never written an app for my self outside of a few log in scripts.
The other thing that I wanted to know is how to update the cart so that it shows the attribute image that was selected when it was added to the cart. this is really only noticeable for an attribute like color but currently it shows the image of the original.
-
Re: Attribute image replaces main product image on selecting attribute
I'd like to add a note about this add-on.
It works with Image Handler 3, as long as you EXPLICITLY specify both medium image width & medium image height. Also, this add-on is dependent upon your main product image img tag being wrapped in a div with ID="productImageMain" because the javascript replaces the elements within the container of that ID name.
If you don't want to specify a width or height for image handler (in admin config>images) for whatever reason (I didn't want to specify medium heights because I only wanted the width defined for height to auto-size proportionally), just alter the attributes.php..
find this line:
PHP Code:
$parameters=' onchange="getattribimage('.'\'id[' . $products_options_names->fields['products_options_id'] . ']\''.','. MEDIUM_IMAGE_WIDTH.', '.MEDIUM_IMAGE_HEIGHT.',' this.value,'.$_GET['products_id'].');"';
change to:
PHP Code:
$parameters=' onchange="getattribimage('.'\'id[' . $products_options_names->fields['products_options_id'] . ']\''.', height, width, this.value,'.$_GET['products_id'].');"';
...where height is the pixel height WITHOUT a "px" suffix and width in the same format. the point is that both width and height must be specified or else this won't work. and to reiterate, the image must be wrapped in a container with ID of productMainImage
One more thing.. the image doesn't revert to the default main image once you select an attribute and it gets replaced. You must create a default attribute (for example, if the image base is white in color) and assign an image to the "default" attribute, regardless of if its the same as your main product image.
-
Re: Attribute image replaces main product image on selecting attribute
Does anyone know how to get this working with Lightbox? The main image comes up in the lightbox, but once the images swap, the new images just come up in a regular popup box.
-
Re: Attribute image replaces main product image on selecting attribute
I couldn't get past the SQL query...
SQL query:
INSERT INTO `products_options_types` VALUES (6, 'Link');
MySQL said: Documentation
#1062 - Duplicate entry '6' for key 'PRIMARY'
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
lrfowler24
I couldn't get past the SQL query...
SQL query:
INSERT INTO `products_options_types` VALUES (6, 'Link');
MySQL said: Documentation
#1062 - Duplicate entry '6' for key 'PRIMARY'
Just came across this message. Yeah, the sql in the sql_run.txt file is not written with the concept of other products_options_types having been added or any other flexibility and it is provided with an existing table prefix which if applied within the tools->install sql patches window will more than likely cause errors.
May I suggest the following sql for first time installation. If run a second time, it will attempt to add another products_options_types_id with the same name which would be a problem so if there is a problem with running this install script, I suggest following up with the uninstall script before attempting to install again. Oh wait, I just realized that there is not an uninstall script... I include that below as well.. :/
Install script to be placed in admin->tools->install sql patches:
Code:
SELECT @products_options_types_id := pot.products_options_types_id+1
FROM `products_options_types` pot
order by pot.products_options_types_id desc limit 1;
INSERT INTO `products_options_types` (products_options_types_id, products_options_types_name) VALUES (@products_options_type_id, 'Link');
INSERT INTO `configuration` (configuration_title, configuration_key, configuration_value,
configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function) VALUES ('Link product option type', 'PRODUCTS_OPTIONS_TYPE_LINK', @products_options_type_id, 'Numeric value of the link product option type', 6, 0, now(), NULL, NULL);
Removal sql also to be placed in admin->tools->install sql patches (if removal is desired or if attempting to rerun the above install sql):
Code:
DELETE FROM `products_options_types` WHERE products_options_types_name = 'Link';
DELETE FROM `configuration` WHERE configuration_key = 'PRODUCTS_OPTIONS_TYPE_LINK';
If run within phpmyadmin, the table(s) need to be prefaced with the DB_PREFIX value found in includes/configure.php and admin/includes/configure.php (should be the same in both). The table name is identified by the text immediately after FROM and the text immediately after INTO. The backquotes on the table names are unnecessary, but were maintained as the original author had used them.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
mc12345678
Just came across this message. Yeah, the sql in the sql_run.txt file is not written with the concept of other products_options_types having been added or any other flexibility and it is provided with an existing table prefix which if applied within the tools->install sql patches window will more than likely cause errors.
May I suggest the following sql for first time installation. If run a second time, it will attempt to add another products_options_types_id with the same name which would be a problem so if there is a problem with running this install script, I suggest following up with the uninstall script before attempting to install again. Oh wait, I just realized that there is not an uninstall script... I include that below as well.. :/
Install script to be placed in admin->tools->install sql patches:
Code:
SELECT @products_options_types_id := pot.products_options_types_id+1
FROM `products_options_types` pot
order by pot.products_options_types_id desc limit 1;
INSERT INTO `products_options_types` (products_options_types_id, products_options_types_name) VALUES (@products_options_type_id, 'Link');
INSERT INTO `configuration` (configuration_title, configuration_key, configuration_value,
configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function) VALUES ('Link product option type', 'PRODUCTS_OPTIONS_TYPE_LINK', @products_options_type_id, 'Numeric value of the link product option type', 6, 0, now(), NULL, NULL);
Removal sql also to be placed in admin->tools->install sql patches (if removal is desired or if attempting to rerun the above install sql):
Code:
DELETE FROM `products_options_types` WHERE products_options_types_name = 'Link';
DELETE FROM `configuration` WHERE configuration_key = 'PRODUCTS_OPTIONS_TYPE_LINK';
If run within phpmyadmin, the table(s) need to be prefaced with the DB_PREFIX value found in includes/configure.php and admin/includes/configure.php (should be the same in both). The table name is identified by the text immediately after FROM and the text immediately after INTO. The backquotes on the table names are unnecessary, but were maintained as the original author had used them.
..........I wasn't able to run the first code......I got an error................. so then I ran the uninstall code............ and I ran the first code and still got an error. Can you do a teamviewer session?
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
lrfowler24
..........I wasn't able to run the first code......I got an error................. so then I ran the uninstall code............ and I ran the first code and still got an error. Can you do a teamviewer session?
the error - WARNING: An Error occurred, please refresh the page and try again.
-
Re: Attribute image replaces main product image on selecting attribute
so.....first I tried doing this code in phpmyadmin (I forgot about admin - Tools)....
INSERT INTO `zen_products_options_types` VALUES (6, 'Link');
INSERT INTO `zen_configuration` VALUES ('','Link product option type', 'PRODUCTS_OPTIONS_TYPE_LINK', '6', 'Numeric value of the link product option type', 6, 0, NULL, '', NULL, NULL);
.......but..........I noticed there was no `zen_products_options_types` ......so I changed it to INSERT INTO `products_options_types` VALUES (6, 'Link');
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
lrfowler24
the error - WARNING: An Error occurred, please refresh the page and try again.
Sorry, there was a typo in the original query (@products_options_type_id should have been @products_options_types_id) :
Code:
SELECT @products_options_types_id := pot.products_options_types_id+1
FROM `products_options_types` pot
order by pot.products_options_types_id desc limit 1;
INSERT INTO `products_options_types` (products_options_types_id, products_options_types_name) VALUES (@products_options_types_id, 'Link');
INSERT INTO `configuration` (configuration_title, configuration_key, configuration_value,
configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function) VALUES ('Link product option type', 'PRODUCTS_OPTIONS_TYPE_LINK', @products_options_types_id, 'Numeric value of the link product option type', 6, 0, now(), NULL, NULL);
I don't know why an error occurred with the removal as I just ran it (twice) to see if I would get an error...
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
mc12345678
Sorry, there was a typo in the original query (@products_options_type_id should have been @products_options_type
s_id) :
Code:
SELECT @products_options_types_id := pot.products_options_types_id+1
FROM `products_options_types` pot
order by pot.products_options_types_id desc limit 1;
INSERT INTO `products_options_types` (products_options_types_id, products_options_types_name) VALUES (@products_options_types_id, 'Link');
INSERT INTO `configuration` (configuration_title, configuration_key, configuration_value,
configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function) VALUES ('Link product option type', 'PRODUCTS_OPTIONS_TYPE_LINK', @products_options_types_id, 'Numeric value of the link product option type', 6, 0, now(), NULL, NULL);
I don't know why an error occurred with the removal as I just ran it (twice) to see if I would get an error...
THAT WORKED!....so does it work with drop-down boxes?
-
Re: Attribute image replaces main product image on selecting attribute
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
lrfowler24
THAT WORKED!....so does it work with drop-down boxes?
Wish I could answer this. I just happened to take a look at the thread because it had popped up in my recent messages a few times and I was curious about the plugin. Seeing related posts and the query with which you were having difficulty I realized what the likely problem was and so tried to provide a solution to that. Beyond that I am not familiar with the operation nor what is necessary for it to "work". I did see a few other "issues" with the provided attribute.php file which should be placed in one's override folder rather (includes/modules/YOUR_TEMPLATE) instead of in the "core" path as provided. Further with the way ZC 1.5.5 has modified the attributes.php file, there is an improved way to implement what this does that doesn't/shouldn't require modifying the in-store version of that file.
Quote:
Originally Posted by
lrfowler24
Again, at the moment unsure what is needed to make it work, perhaps someone familiar with the plugin will chime in. Suggestion would be to look back at the recent posts on issues identified and also providing more information about your setup (ie. ZC version).
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
lrfowler24
Because this plugin likely uses javascript (or equivalent) to swap the images, I ran that page through an html validator (https://validator.w3.org/check?uri=h...nline&group=0) and had 47 errors. I don't know if that is a factor in the lack of operation, but certainly want your pages to validate to ensure javascript operations and for your pages to be looked upon favorably.
-
Re: Attribute image replaces main product image on selecting attribute
I've gotten this to work as well as updated it to use ajax.php instead of the provided additional root file. Also, have moved the attributes.php related code primarily out of attributes file and into an observer file. Just thought about something more that I could do to further remove the code out a little. Having looked through the remainder of this thread am considering what would be necessary to incorporate changes made by other plugins like colorbox. Oh, and two other things incorporated as discussed in here is the switch back to the default image in absence of an attribute defined image and bypassing the "bigger_image" load if such an image is not present in the system as well as other ZC standardization such as using DIR_WS_IMAGES for the images directory, moving the jscript_main code into its own file, and properly sequencing the javascript to provide appropriate javascript "validation".
I've attempted to contact the most recent author/updater and haven't heard anything yet, but as soon as I complete the remaining items I want to address, I will post the changes made to support updating this plugin.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
mc12345678
I've gotten this to work as well as updated it to use ajax.php instead of the provided additional root file. Also, have moved the attributes.php related code primarily out of attributes file and into an observer file. Just thought about something more that I could do to further remove the code out a little. Having looked through the remainder of this thread am considering what would be necessary to incorporate changes made by other plugins like colorbox. Oh, and two other things incorporated as discussed in here is the switch back to the default image in absence of an attribute defined image and bypassing the "bigger_image" load if such an image is not present in the system as well as other ZC standardization such as using DIR_WS_IMAGES for the images directory, moving the jscript_main code into its own file, and properly sequencing the javascript to provide appropriate javascript "validation".
I've attempted to contact the most recent author/updater and haven't heard anything yet, but as soon as I complete the remaining items I want to address, I will post the changes made to support updating this plugin.
Just uploaded version 1.5.6 of this plugin.
Writeup was:
Quote:
- Modified approach to display the swapped attribute image to use ZC's ajax method instead of an additional file from this plugin.- Updated the install SQL to account for other products_options_types having been added.
- Used POST related transfer of data rather than the URL to improve on security.
- Added that if an attribute selected does not have an image associated with it that the default/main product's image would be displayed.
- Added javascript to load the attribute image if the product information page is displayed with the attribute(s) already selected.
- Incorporated the module main_product_image.php code to support Image Handler operation on the attribute file.
- Moved added attributes related code into an observer file with minor modifications made to the provided attributes.php file associated with ZC 1.5.5's version of the file. Additional effort would be needed to completely remove all modifications and instead use more of a javascript insertion/modification.
- Modified/expanded the readme instructions.
- Added a SQL query to be run if determined necessary because of not updating to ZC 1.5.5 and missing database records.
- Modified code to use ZC standard defined variables/constants rather than hard-coded (i.e. DIR_WS_IMAGES instead of 'images/')
- Made use of an image such as bigger_picture.jpg optional where the standard 'larger image' (TEXT_CLICK_TO_ENLARGE) text will be shown if the file does not exist.
- Resequenced the javascript so that expected variables/data would be in scope, minimizing the processing needed to display/correct the javascript code.
- Reduced the amount of code that needed to be merged versus added by pulling the javascript code added by this module out of jscript_main.php and putting it into its own jscript_ file.
- Moved an extra function demonstrated to be called only by this plugin into the observer class, although the code that calls the zen_link function doesn't provide all of the data necessary to use the function to its maximum extent. The code remains intact, but does not appear to provide the intended operation/capability.
- As compared to the previous version, the additional attribute images will be displayed if the attribute image style is selected to be 6, but will be removed if set as 7. In both conditions 6 and 7, the attribute image will be swapped with the main product image upon selection.
It should be available from the location identified in post 1 of this thread which is here when it has been reviewed and approved by one of the ZC volunteers. (ie. please be patient while the code undergoes the necessary review cycle prior to being made available here.)
-
Re: Attribute image replaces main product image on selecting attribute
Hello there,
Thanks for all your efforts in updating this module. I am not currently using attribute images, but I just had a query as to whether using this module, if it would cause the slight slowdown in zencart that is talked about in the optimisation page for zencart? Currently I have the option set to false in the config, as recommended. But it would be interesting to know if this module ignores that.
Regards,
James
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
HeathenMagic
Hello there,
Thanks for all your efforts in updating this module. I am not currently using attribute images, but I just had a query as to whether using this module, if it would cause the slight slowdown in zencart that is talked about in the optimisation page for zencart? Currently I have the option set to false in the config, as recommended. But it would be interesting to know if this module ignores that.
Regards,
James
Could you please elaborate on the above? Which article, which setting?
From observation I did see the possibility of change response time possibly being slow, but it didn't prevent me as a user from moving on to the next action, whether it was to change attribute selections again or to carry on with add-to-cart. The delay was completely dependent on the data transfer/response speed. I could for example use one device and have lightening response, and another slow as molasses, but the slow device was slow in everything not just image swap.
-
Re: Attribute image replaces main product image on selecting attribute
https://www.zen-cart.com/content.php...eed-up-my-site
Quote:
. In Admin->Configuration->Attribute Settings, there are a few switches which, if turned off, will reduce the number of queries used to calculate and display product information:
- Enable Downloads -- If you're not doing downloads on your site, turn this off.
- Enable Price Factor -- If you're not using price-by-attributes support, turn this off to stop those calculations and the related queries
- Enable Qty Price Discount -- If you're not doing quantity discounts, turn this off
- Enable Attribute Images -- If you're not adding images to your attributes, turn this off
I understand it won't be possible to make it have no impact when attribute images are being used.
Regards,
James
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
HeathenMagic
If the image setting for the option name isn't 6 or 7, then no swap will occur nor be attempted and the javascript will load waiting to be activated, but not do anything and therefore there would be no slowdown related to the attributes image specifically, just the additional javascript associated with possibly loading.
It does not currently respect those settings though, ie. if the attribute image style is set to 6 or 7, it will still "inquire" about the presence of attribute image information and if found associated with the product/attribute combination will move forward with the next action (which would be to pull the same image as already on screen and try to update it to be the same as it was for each selected attribute that doesn't have an alternate image selected...)
Can look to see what efficiencies can be obtained by inspecting that setting. Seems that basically everything "front facing" would be disabled/bypassed as none of the javascript would apply and therefore not need to be pushed to the browser at least that which is pertinent to the plugin. (There's a few JS functions present that are not called by this plugin, but they seem to be one of those, hey someone added it, used it, and expects it... things but it doesn't do anything for this software.)
So effectively it seems that the slowdown would all be in querying the database and returning the base image on every selection if it is even possible for the attribute's image setting to be identified as 6 or 7. Though I guess more could be done with the javascript to identify the last image loaded and if different than the current/new image then to pass the information rather than to pass it on every attribute selection change. (ie. A little further JS refinement possible.)
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
mc12345678
Just uploaded version 1.5.6 of this plugin.
Writeup was:
It should be available from the location identified in
post 1 of this thread which is
here when it has been reviewed and approved by one of the ZC volunteers. (ie. please be patient while the code undergoes the necessary review cycle prior to being made available here.)
Version 1.5.6 of this plugin is available here.
-
Re: Attribute image replaces main product image on selecting attribute
Submitted version 1.5.7 based on questions asked above and some concepts applied/discussed below:
- Added "Removal" of most of the javascript code if the admin option to not display attribute images is set to true. This
is expected to have a positive impact on load speed for such conditions.
- Modified the approach to the image swap, but left behind the previous code with it commented out. The reason is that
now instead of returning a newly formatted image (which requires more device communication), the original image is
"restored" if there is no attribute image assigned.
- Added some console logging of debug information if the attempt to execute the initialization code fails.
Upon review, acceptance, and posting should be downloadable from here.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
mc12345678
Submitted version 1.5.7 based on questions asked above and some concepts applied/discussed below:
- Added "Removal" of most of the javascript code if the admin option to not display attribute images is set to true. This
is expected to have a positive impact on load speed for such conditions.
- Modified the approach to the image swap, but left behind the previous code with it commented out. The reason is that
now instead of returning a newly formatted image (which requires more device communication), the original image is
"restored" if there is no attribute image assigned.
- Added some console logging of debug information if the attempt to execute the initialization code fails.
Upon review, acceptance, and posting should be downloadable from
here.
Version 1.5.7 is now available from here.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
mc12345678
Version 1.5.7 is now available from
here.
I'm using Zen Cart 1.5.5e - does this module actually work? Can't make head or tail of the installation. Seems a bit messy and nothing happens after installation.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
Nick1973
I'm using Zen Cart 1.5.5e - does this module actually work? Can't make head or tail of the installation. Seems a bit messy and nothing happens after installation.
It does work on ZC 1.5.5e responsive template or not. Looking over the instructions again, they certainly could be clearer and the few lines modified in the admin/options_name_manager.php file could possibly be commented considering how little was changed/added there. For the image swap, there is no SQL necessary. There was some "link" code that was incorporated at one point; however, its design and intent are/were not clear but the code/SQL remained available for anyone that had discovered the "secret" behind it.
What "happen" is expected? What has been done to assign/designate an image to an attribute that is to take the place of the main image? What other javascript is involved? What other image related plugins are installed? What conflicts have been identified?
Basically, other than the few lines of code to be added to the admin/options_name_manager.php, associated language file, and the template override of the attributes.php file to ensure the use/availability of necessary notifiers, for a ZC 1.5.5e system there should be no other override or file replacement. In fact if no other plugin has modified the admin/options_name_manager.php file as provided in ZC 1.5.5e, then the provided file could replace it, with the same said of the admin/includes/languages/english/options_name_manager.php file.
The ajax.php file provided in this plugin should not overwrite the ajax.php file provided in versions of ZC 1.5.5c or above (currently is the same as provided in ZC 1.5.5e), but was what was available at the time of distribution and provided improved operation over the previous ajax related file.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
mc12345678
It does work on ZC 1.5.5e responsive template or not. Looking over the instructions again, they certainly could be clearer and the few lines modified in the admin/options_name_manager.php file could possibly be commented considering how little was changed/added there. For the image swap, there is no SQL necessary. There was some "link" code that was incorporated at one point; however, its design and intent are/were not clear but the code/SQL remained available for anyone that had discovered the "secret" behind it.
What "happen" is expected? What has been done to assign/designate an image to an attribute that is to take the place of the main image? What other javascript is involved? What other image related plugins are installed? What conflicts have been identified?
Basically, other than the few lines of code to be added to the admin/options_name_manager.php, associated language file, and the template override of the attributes.php file to ensure the use/availability of necessary notifiers, for a ZC 1.5.5e system there should be no other override or file replacement. In fact if no other plugin has modified the admin/options_name_manager.php file as provided in ZC 1.5.5e, then the provided file could replace it, with the same said of the admin/includes/languages/english/options_name_manager.php file.
The ajax.php file provided in this plugin should not overwrite the ajax.php file provided in versions of ZC 1.5.5c or above (currently is the same as provided in ZC 1.5.5e), but was what was available at the time of distribution and provided improved operation over the previous ajax related file.
I think the installation has been made into a banquet, not a meal. I just need an image swap facility on attributes. There are sunglasses, each one has different colours, so requires an image swatch of the actual glasses in that colour. That swatch would change the colour of the main product image on either mouseover, tickbox selection, or radio button selection.
Thats all I need :-)
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
Nick1973
I think the installation has been made into a banquet, not a meal. I just need an image swap facility on attributes. There are sunglasses, each one has different colours, so requires an image swatch of the actual glasses in that colour. That swatch would change the colour of the main product image on either mouseover, tickbox selection, or radio button selection.
Thats all I need :-)
This plugin will take the image that is loaded in the attributes controller and make it the main product image in the following conditions:
From options name manager, edit an option name
in: Attribute Style for Radio Buttons/Checkbox: set a value of 6
option name types supported are: checkbox, radio, and dropdown (select).
In the attributes controller for the product, whatever image is provided for a given attribute, that image will replace the main image when the attribute is selected.
Then if an attribute that is selected does not have an image assigned to it the main image is to return back to what it was upon "page load".
If wanted to adapt to an "onhover" or other related javascript action, then that could be incorporated into includes\classes\observers\auto.attrib_image_swap.php file primarily within the function updateNotifyAttributesModuleStartOptionsLoop to use some other event for which to listen. Of course that would also primarily make the on_load file nearly needless if the action requires user to directly interact rather than for a selection to "exist". (Ie. if a product is added to the cart, the cart visited and then the product selected from the cart to return to the product info page, upon return to the product info page, one might expect the image to "match" what was selected without further selecting an option.)
-
Re: Attribute image replaces main product image on selecting attribute
Yes but it didn't work for me.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
Nick1973
Yes but it didn't work for me.
While at the moment I have limited resources to test against the site, perhaps could identify the path to a product where the functionality is expected, including which attribute(s) are to change the look and can get back to you with what is identified.
Basically the review would be to step through the javascript as it was executing (can be done by pressing f12 on a PC keyboard and navigating to the debug related section of the browser) and see what, if any error is being caused, and/or data being transferred to/from the server. As said there may be some other image related plugin that is having a conflict or some other javascript code that is negating the operation of the plugin. It otherwise is a relatively simple bit of code that is involved.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
mc12345678
While at the moment I have limited resources to test against the site, perhaps could identify the path to a product where the functionality is expected, including which attribute(s) are to change the look and can get back to you with what is identified.
Basically the review would be to step through the javascript as it was executing (can be done by pressing f12 on a PC keyboard and navigating to the debug related section of the browser) and see what, if any error is being caused, and/or data being transferred to/from the server. As said there may be some other image related plugin that is having a conflict or some other javascript code that is negating the operation of the plugin. It otherwise is a relatively simple bit of code that is involved.
Unless you want to have a go at installing it yourself? I'm happy to give you FTP access etc through a PM. I may have installed it incorrectly for all I know.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
Nick1973
Unless you want to have a go at installing it yourself? I'm happy to give you FTP access etc through a PM. I may have installed it incorrectly for all I know.
Same "timing" issue applies, but let me know as much detail as can about path or land me as close to the "root" of the store/catalog as possible. :)
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
mc12345678
Same "timing" issue applies, but let me know as much detail as can about path or land me as close to the "root" of the store/catalog as possible. :)
Shall I PM you then?
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
Nick1973
Shall I PM you then?
It's ok I have it working, I will PM you the URL for you to see it as it contains my server IP.
However will try to remember to put a link here when it goes live.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
Nick1973
It's ok I have it working, I will PM you the URL for you to see it as it contains my server IP.
However will try to remember to put a link here when it goes live.
Could you elaborate for the other readers about either the issue or what had to be done to "make it work"?
The answer to the other previous question would have been yes. :) But would still be glad to take a look.
On my sample site, I also have the same "issue" that with dropdowns, the possible attribute image(s) remain below the select (dropdown) option. There are ways to make that either more of a feature or to at least have it removed automatically if so desired.
In includes/classes/observers/auto.attrib_image_swap.php if you find this section:
Code:
// NOTIFY_ATTRIBUTES_MODULE_OPTION_BUILT
function updateNotifyAttributesModuleOptionBuilt(&$callingClass, $notifier, $products_options_names_fields, &$options_name, &$options_menu, &$options_comment, &$options_comment_position, &$options_html_id, &$options_attributes_image)
{
global $products_options;
if ($products_options->RecordCount() == 1 && $products_options_names_fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_LINK) {
array_pop($options_name);
array_pop($options_menu);
array_pop($options_comment);
array_pop($options_comment_position);
array_pop($options_html_id);
//array_pop($options_attributes_image); // This may need to be commented out because the $options_attributes_image variable is not addressed in the below called function and if it should remain associated with this attribute assignment as part of displaying the information.
// With testing, (grid product having a single option value for each of a single option name, one single option value and one multiple option values and in conjunction with another non-grid attribute that displayed a picture.) it didn't seem to matter one way or the other.
// Flow pushes the attribute image to the $options_attributes_image array before coming to this notifier and does so for all attribute types.
// That said, it would seem that if the single option value option type were called upon and that images are in other ways addressed by the below code, then this array item should be popped off the set as well.
// This could maybe be commented out for 2 reasons: 1) images are not addressed in the below called function, and 2) if they need to be cleared they will below.
$this->updateNotifyAttributesModuleDefaultSwitch($callingClass, $notifier, $products_options_names_fields, $options_name, $options_menu, $options_comment, $options_comment_position, $options_html_id);
}
if ($products_options_names_fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_SELECT) {
array_pop($options_attributes_image); // This may need to be commented out because the $options_attributes_image variable is not addressed in the below called function and if it should remain associated with this attribute assignment as part of displaying the information.
// With testing, (grid product having a single option value for each of a single option name, one single option value and one multiple option values and in conjunction with another non-grid attribute that displayed a picture.) it didn't seem to matter one way or the other.
// Flow pushes the attribute image to the $options_attributes_image array before coming to this notifier and does so for all attribute types.
// That said, it would seem that if the single option value option type were called upon and that images are in other ways addressed by the below code, then this array item should be popped off the set as well.
// This could maybe be commented out for 2 reasons: 1) images are not addressed in the below called function, and 2) if they need to be cleared they will below.
}
}
Adding the code in blue above will remove the options_attributes_image "row" from all select lists... Ideally there might be a "switch" added to the configuration window (or another option name selection) that would make that possible or I guess the code could be modified to treat option 7 as allowing image swap in all cases, but not to show the attribute image adjacent to the attribute which would require a little bit of a rewrite to the code besides just modifying the above. (Basically I think it would be to remove all existing cases of '7' from within the observer and in the above check to see if 7 is set and if so, then remove the attribute image from the above selections such that each attribute would know what image to present, but only an image swap would occur..) Maybe that was the original point of those settings... It certainly wasn't clear (to me) before and didn't seem to work in a way that made sense.
-
2 Attachment(s)
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
mc12345678
Could you elaborate for the other readers about either the issue or what had to be done to "make it work"?
The answer to the other previous question would have been yes. :) But would still be glad to take a look.
On my sample site, I also have the same "issue" that with dropdowns, the possible attribute image(s) remain below the select (dropdown) option. There are ways to make that either more of a feature or to at least have it removed automatically if so desired.
In includes/classes/observers/auto.attrib_image_swap.php if you find this section:
Code:
// NOTIFY_ATTRIBUTES_MODULE_OPTION_BUILT
function updateNotifyAttributesModuleOptionBuilt(&$callingClass, $notifier, $products_options_names_fields, &$options_name, &$options_menu, &$options_comment, &$options_comment_position, &$options_html_id, &$options_attributes_image)
{
global $products_options;
if ($products_options->RecordCount() == 1 && $products_options_names_fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_LINK) {
array_pop($options_name);
array_pop($options_menu);
array_pop($options_comment);
array_pop($options_comment_position);
array_pop($options_html_id);
//array_pop($options_attributes_image); // This may need to be commented out because the $options_attributes_image variable is not addressed in the below called function and if it should remain associated with this attribute assignment as part of displaying the information.
// With testing, (grid product having a single option value for each of a single option name, one single option value and one multiple option values and in conjunction with another non-grid attribute that displayed a picture.) it didn't seem to matter one way or the other.
// Flow pushes the attribute image to the $options_attributes_image array before coming to this notifier and does so for all attribute types.
// That said, it would seem that if the single option value option type were called upon and that images are in other ways addressed by the below code, then this array item should be popped off the set as well.
// This could maybe be commented out for 2 reasons: 1) images are not addressed in the below called function, and 2) if they need to be cleared they will below.
$this->updateNotifyAttributesModuleDefaultSwitch($callingClass, $notifier, $products_options_names_fields, $options_name, $options_menu, $options_comment, $options_comment_position, $options_html_id);
}
if ($products_options_names_fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_SELECT) {
array_pop($options_attributes_image); // This may need to be commented out because the $options_attributes_image variable is not addressed in the below called function and if it should remain associated with this attribute assignment as part of displaying the information.
// With testing, (grid product having a single option value for each of a single option name, one single option value and one multiple option values and in conjunction with another non-grid attribute that displayed a picture.) it didn't seem to matter one way or the other.
// Flow pushes the attribute image to the $options_attributes_image array before coming to this notifier and does so for all attribute types.
// That said, it would seem that if the single option value option type were called upon and that images are in other ways addressed by the below code, then this array item should be popped off the set as well.
// This could maybe be commented out for 2 reasons: 1) images are not addressed in the below called function, and 2) if they need to be cleared they will below.
}
}
Adding the code in blue above will remove the options_attributes_image "row" from all select lists... Ideally there might be a "switch" added to the configuration window (or another option name selection) that would make that possible or I guess the code could be modified to treat option 7 as allowing image swap in all cases, but not to show the attribute image adjacent to the attribute which would require a little bit of a rewrite to the code besides just modifying the above. (Basically I think it would be to remove all existing cases of '7' from within the observer and in the above check to see if 7 is set and if so, then remove the attribute image from the above selections such that each attribute would know what image to present, but only an image swap would occur..) Maybe that was the original point of those settings... It certainly wasn't clear (to me) before and didn't seem to work in a way that made sense.
In all honesty I had just installed it incorrectly. I uploaded the files in the instructions but couldn't see any change admin side, however I missed the bit that says 'Attribute Style for Radio Buttons/Checkbox: set a value of 6' - this is in 'Catalog > Option Name Manager'
Attachment 17085
Find the Option Name you want to Edit, then Click 'Edit'
You will then arrive at this screen:
Attachment 17086
From here select: 6= Attribute Image Replaces Main Product Image
I have this working now and for anybody thats interested, if you don't want an attributes image to show next to your Attributes Select Menu, just add the code as described by mc12345678 thats highlighted in blue on the previous post.
I also went a step further, I did not want the 'Larger Image' link so I went and edited zcAttrib_prod_info.php
If you also want to do the same, look in the above file by doing a 'find' or 'search' in the above file for:
$image_return = '<a href="javascript:popupWindow(\'' . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, 'products_image_large_additional=' . $products_image_large) . '\')">' . $image . '<br /><span class="imgLink">' . $larger_text . '</span></a>';
and change to:
$image_return = '' . $image . '';
} else { // mc12345678 Used to assign an indicate to return to the original image.
$image_return = "";
this will stop the image from linking to a larger image.
-
Re: Attribute image replaces main product image on selecting attribute
Is this module supposed to show the popup image when clicked? For me it's showing "no image".
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
ideasgirl
Is this module supposed to show the popup image when clicked? For me it's showing "no image".
The file: includes/classes/ajax/zcAttrib_prod_info.php
attempts to load the template override version of the module file typically named: main_product_image.php (referenced by the constant FILENAME_MAIN_PRODUCT_IMAGE) and also provides a link for the file that is referenced/identified by the $products_image_large name. It was verified to work with even Image Handler 4. Now the latest version (under review) also supports the latest version of the ZC plugin called Zen color box and will offer the ability to see the swapped image as a popup as intended via color box.
Plugins that modify associated files may provide different results. Following the guidance of the posting tips when further attempting to address the discrepancy will help to narrow down the source of the issue.
-
Re: Attribute image replaces main product image on selecting attribute
Yes, but never worked. I gave up.
-
Re: Attribute image replaces main product image on selecting attribute
Quote:
Originally Posted by
ideasgirl
Yes, but never worked. I gave up.
Too bad... Haven't been able to get to a computer to possibly review the site, I remember looking at a page from my mobile, but can't remember what link I followed to get there. Also, without knowing anything about the setup, it is not possible to even suggest what may be going on or wrong. So, if there is/was a desire to make it work or identify why it wasn't working in the particular setup, but it worked in a vanilla install of ZC 1.5.5e, then more effort is needed.
-
Re: Attribute image replaces main product image on selecting attribute
Yes, don't worry. I was looking for an alternative to my "attributes image popup" since it stopped showing the thumbnails. But I updated the script and now I have it back (which I prefer because the images for attributes will display where they belong).
I really don't know why it didn't work because I don't think there's anything else that could be affecting it.
Keep up the good work! :smartalec: