Forums / Setting Up Categories, Products, Attributes / attaching an image to each option value

attaching an image to each option value

Locked

Views: 1,080

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
30 Jun 2010, 11:07 AM
#1
haostaff avatar

haostaff

Zen Follower

Join Date:
Oct 2007
Location:
Hong Kong
Posts:
112
Plugin Contributions:
0

attaching an image to each option value

I have tried to attach a small icon to each option value. I have done this by adding a <img ...> tag to the option value names.

It works great as can be seen here: http://haostaff.com/store/index.php?main_page=product_info&products_id=2

However, if one adds the product to the cart, the shopping_cart page does not display the icon images, but the <img> tag instead.

The checkout_confirmation page (two steps further), however, can properly display the icon images. My guess is that there is a simple trick in the codes to show the images. But it is not obvious when I opened the tpl_shopping_cart_default.php file, and compared it with other relevant files.

Could the Zen masters give me a pointer, please? I'd be grateful.

Best regards,
Jeff

1 Jul 2010, 1:55 AM
#3
haostaff avatar

haostaff

Zen Follower

Join Date:
Oct 2007
Location:
Hong Kong
Posts:
112
Plugin Contributions:
0

Re: attaching an image to each option value

Thanks. Tried. It is different. I am seeking a "shortcut", where I don't have to revise each product. It would be perfect if the <img> pdf/winrar icons can just show in the shopping_cart page as they already do on the product_info page and checkout_confirmation page.

PHP code pointer (should be some simple magic on the file includes/templates/templates_default/templates/tpl_shopping_cart.php) still needed.

1 Jul 2010, 8:20 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: attaching an image to each option value

You are using a creative approach to managing the attribute images ...

Unfortunately, the option values are being protected to prevent issues on text inputs ...

Let me look into this further and see if this can be customized to only protect the products_options_values_name when it is a text attribute vs all attributes ...

Do you use TEXT attributes on your site?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Jul 2010, 11:22 AM
#5
haostaff avatar

haostaff

Zen Follower

Join Date:
Oct 2007
Location:
Hong Kong
Posts:
112
Plugin Contributions:
0

Re: attaching an image to each option value

Hi, Linda!

I know I am in good hand now. So far, for every product, I have chosen "no" for "required for TEXT" in the attributes controller. But I actually don't know what "TEXT attribute" means, and have not found its meaning running through the long threads about attributes, and witnessing the tremendous work you did in this area from way back. Perhaps it is buried somewhere, but please do explain again for me what TEXT means in the context :).

Yes, it is a shortcut method I dreamed up to suit my own need. I guess it might be useful to others, too. But apart from showing the images in the checkout pages, I just found that there are a couple of other perhaps related issues, one of them being vital for the workability of this method. They may be the same issue, which may trace back to the "protection" that you are talking about.

Issue 1: In Admin area (Option Value Manager), after I save the Option Value with an <img> tag plus text, the same tag+text are not seen again. When you open it for editing again, only some partial codes are left in the field. I guess the tag+text are properly saved in database, because they are clearly working on web pages, as seen on my live site. This would have posed no problem to me, unless it is related to the following issue, which may be a killer for me.

Issue 2: I cannot add or edit a product attribute anymore, if that attribute has an Option Value that consists of tag+text. I just found out about this today when I tried to add new products. The error message I get: "Attribute Option and Option Value Do NOT Match - Attribute was not changed - : TEXT".

Anyway, I hope these can all be easily solved with removing "the protection", assuming that protection is not necessary in my case :).

Sorry about the wordy post :)

Cheers,
Jeff

2 Jul 2010, 3:19 AM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: attaching an image to each option value

What I meant by TEXT Attribute is that there is actually an Option Name type for TEXT input from the customer on a Product ...

These need to be cleaned for security purposes and the cleaning method used to protect them is what is causing your problem on on the shopping_cart page ...

This protection is applied to all option values, even if you are not using the TEXT attribute ...

I have not had time to run through the code to see what the affects would be if it only did the protection on the TEXT options values and not on all option values ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

2 Jul 2010, 3:09 PM
#7
haostaff avatar

haostaff

Zen Follower

Join Date:
Oct 2007
Location:
Hong Kong
Posts:
112
Plugin Contributions:
0

Re: attaching an image to each option value

Linda, just to let you know that I have removed the protection on the shopping cart display from the file includes\modules\pages\shopping_cart\header_php.php, and the icon images are showing as intended now.

I guess the critical issue of my earlier post (not being able to insert download file names from Attribute Controller) is a complex one. Right now, I have decided to manually insert them in the database table 'products_attributes_download', using SQL commands.

So I am more or less ok now. But it there is a more elegant fix, I would be more than grateful to hear.

Best regards,
Jeff

2 Jul 2010, 3:14 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: attaching an image to each option value

That will make this work for you, but be careful as that function was put in to manage XSS security vulnerabilities ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!