Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Attribute images are not showing.

Attribute images are not showing.

Locked

Views: 2,063

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
26 Jul 2008, 7:00 PM
#1
rweeks avatar

rweeks

New Zenner

Join Date:
Jul 2008
Location:
San Diego, CA
Posts:
45
Plugin Contributions:
0

Attribute images are not showing.

This seems really basic, but for the life of my I can't get them to display.
On the product, the radio buttons are showing, but not the images.
http://www.fabfotoframes.com/index.php?main_page=product_info&cPath=1_9&products_id=3

Here is my set up:
In Admin-> Enable Attribute images is set to TRUE
Option name: moulding
Option values: float1, float2, float3, float4,
Images names: Images are in Attribute folder
moulding_float1.jpg
moulding_float2.jpg
moulding_float3.jpg
moulding_float4.jpg

What am I missing to connect the images to the options???? :frusty:
Thanks

26 Jul 2008, 7:22 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images are not showing.

If you switch to Classic Template do the images appear?

26 Jul 2008, 8:38 PM
#3
rweeks avatar

rweeks

New Zenner

Join Date:
Jul 2008
Location:
San Diego, CA
Posts:
45
Plugin Contributions:
0

Re: Attribute images are not showing.

Don't know. I do not have the classic template uploaded. I removed it from the file structure.

26 Jul 2008, 8:59 PM
#4
rweeks avatar

rweeks

New Zenner

Join Date:
Jul 2008
Location:
San Diego, CA
Posts:
45
Plugin Contributions:
0

Re: Attribute images are not showing.

Added Classic back to offline/localhost site. Images still do not appear.
Here is screen captue of Attribute Controller (offline site).

Anything here look incorrect?

Thanks

26 Jul 2008, 9:10 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images are not showing.

Nope ... just the one icon ... if an image is on the Attribute you see the gold dot ... if no image then you see nothing ...

If your template has been altered and removed the attribute images then they will not show ...

26 Jul 2008, 9:41 PM
#6
rweeks avatar

rweeks

New Zenner

Join Date:
Jul 2008
Location:
San Diego, CA
Posts:
45
Plugin Contributions:
0

Re: Attribute images are not showing.

If I may start from the basics... How do I attach and image to an attribute?
Were should I check the template for the attribute image?

28 Jul 2008, 1:23 AM
#7
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images are not showing.

In the Attributes Controller ... when you Add or Edit an Attribute you will see it listed:

Attributes Image Swatch:
Attributes Image Directory:

If you do not see these, then look in the Configuration ... Attribute Settings ... and see what you have enabled or disabled and check:

Enable Attribute Images
Enable the Attributes Images.

true
false

28 Jul 2008, 9:52 PM
#8
rweeks avatar

rweeks

New Zenner

Join Date:
Jul 2008
Location:
San Diego, CA
Posts:
45
Plugin Contributions:
0

Re: Attribute images are not showing.

Bug in Attribute Controller?
I added the image names manually to the database
table: products_attributes
field: attributes_image

This worked and the attribute images displayed (worked on both local and hosted sites).
However, when I then go to Attribute Controller and try to edit the image name, it does not change. When I delete the attribute and use insert to add attribute with image. The image does not save, but the rest of the information does (do doesn't appear to be a database permission issue).

Could there be a bug in the Attribute Controller?
I checked that attributes_controller.php has not been changed. File still has Date Modified as 4/8/2007.

Problem is same on local and hosted site. Happens with both IE and Firefox.

Once again, thanks for the great support :clap::clap:

29 Jul 2008, 3:07 AM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images are not showing.

Do you have the images directory set to the right permissions of 777? The default directory is:
/images/attributes

29 Jul 2008, 9:28 PM
#10
rweeks avatar

rweeks

New Zenner

Join Date:
Jul 2008
Location:
San Diego, CA
Posts:
45
Plugin Contributions:
0

Re: Attribute images are not showing.

I think it is much more basic than directory names and permissions.

From the Attributes controller, when using the Insert to add a new attribute, all the information writes to the database expect the attribute image name.

When I modify attributes_controller.php (in Admin) to remove the IF statements and get down to just the 2 lines that set the variable.
And then remove the attributes_image input and hardcode some text for the image file name.
Then the attributes_image field is written to in the database - and is what I would expect "attributes/filename.jpg".

Around line 227

//          if (isset($_POST['attributes_image']) && zen_not_null($_POST['attributes_image']) && ($_POST['attributes_image'] != 'none')) {
         [B]   $attributes_image = "filename.jpg"; [/B]//zen_db_prepare_input($_POST['attributes_image']);
 //         } else {
 //           $attributes_image = '';
 //         }

 //         $attributes_image = new upload('attributes_image');
 //         $attributes_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
 //         if ($attributes_image->parse() && $attributes_image->save($_POST['overwrite'])) {
[B]           $attributes_image_name = $_POST['img_dir'] . $attributes_image ->filename;[/B]
  //        } else {
   //         $attributes_image_name = (isset($_POST['attributes_previous_image']) ? $_POST['attributes_previous_image'] : '');
    //      }

I change one line from

$attributes_image = "filename.jpg"; //zen_db_prepare_input($_POST['attributes_image']);

TO:

$attributes_image zen_db_prepare_input($_POST['attributes_image']);

And the Attributes Image Swatch input in Admin Attribute Control no longer is inserted into the attributes_image filed.
What is in the field: "attributes/"
What is expected: "attributes/filename.jpg"

By the way, tried "Updating" versus "Inserting". The attributes_image field still does not change.

Working down through the commented sections of code. Nothing changes until I uncomment the last if statement:

        if ($attributes_image->parse() && $attributes_image->save($_POST['overwrite'])) {
           $attributes_image_name = $_POST['img_dir'] . $attributes_image->filename;
          } else {
            $attributes_image_name = (isset($_POST['attributes_previous_image']) ? $_POST['attributes_previous_image'] : '');
          }

With this code uncommented, nothing is written to the attributes_image field of the database. I had "overwrite" = NO

I think I am at my limit of figuring out the code. Any other ideas?

30 Jul 2008, 2:47 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images are not showing.

Restore the file and the I SEE line to the bottom of this:

// add - update as record exists
// attributes images
// when set to none remove from database
          if (isset($_POST['attributes_image']) && zen_not_null($_POST['attributes_image']) && ($_POST['attributes_image'] != 'none')) {
            $attributes_image = zen_db_prepare_input($_POST['attributes_image']);
          } else {
            $attributes_image = '';
          }

          $attributes_image = new upload('attributes_image');
          $attributes_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
          if ($attributes_image->parse() && $attributes_image->save($_POST['overwrite'])) {
            $attributes_image_name = $_POST['img_dir'] . $attributes_image->filename;
          } else {
            $attributes_image_name = (isset($_POST['attributes_previous_image']) ? $_POST['attributes_previous_image'] : '');
          }
die('I SEE image: ' . $attributes_image_name);

Now try to add an Attribute and the page will stop on the image name ... do you see it?

31 Jul 2008, 11:23 PM
#12
rweeks avatar

rweeks

New Zenner

Join Date:
Jul 2008
Location:
San Diego, CA
Posts:
45
Plugin Contributions:
0

Re: Attribute images are not showing.

Nope. The image name is not showing.
All I get is:

I SEE image:

1 Aug 2008, 3:25 PM
#13
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images are not showing.

And you had hit the browser to get an image for the attribute before saying insert?

1 Aug 2008, 6:03 PM
#14
rweeks avatar

rweeks

New Zenner

Join Date:
Jul 2008
Location:
San Diego, CA
Posts:
45
Plugin Contributions:
0

Re: Attribute images are not showing.

Interesting...
Yes when I use the browse to get file name it works!

Thanks for you patients and continued support – you’re awesome!:yes:

This is was not intuitive about how I thought the code would work.:wacko: When I browse for the file, the text that gets entered in to the field is: C:\xampp\htdocs\fff\images\attributes\moulding_float4.jpg
Yet the line in the database is just: attributes/moulding_float4.jpg (as expected).

When I was trying to manually enter the name I was entering just “moulding_float4.jpg” since the “attributes” prefix is added from the selection in the pull down menu (or left off if “Main Directory” is selected).

So it was not intuitive that it would not take the text entered and add the selected prefix and write that to the database.

Is the code checking for actual existence of the file? With “No” selected for “Overwrite existing image…” did not expect it to matter.

This was all done on local (PC) site. Quick check of published site, it also works. Browse to C:\xampp\htdocs\fff\images\attributes\moulding_float4.jpg.
Select “No” to “Overwrite existing image…”.

Thanks again…:clap::clap::clap:

1 Aug 2008, 7:00 PM
#15
ajeh avatar

ajeh

Oba-san

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

Re: Attribute images are not showing.

Thanks for the update ... :smile: