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...