Forums / Setting Up Categories, Products, Attributes / Image upload not working on new product type

Image upload not working on new product type

Locked

Views: 6,315

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
3 Aug 2007, 6:32 PM
#1
benr avatar

benr

New Zenner

Join Date:
Jun 2007
Posts:
13
Plugin Contributions:
0

Image upload not working on new product type

Hello everyone.

I'm fairly new to zen-cart but I've worked through the music product type tutorial and created my own product type which includes some extra fields and such. Everything seems to work great both admin side as well as front end display. The only problem I'm having now is that the image upload portion is no longer working. I'm able to select the image file but it's lost once I hit save, it's not even showing up on the preview page.

I've compared the regular product files to my custom product type files and I don't see any differences when it comes to image handling. I tried working through the image upload part of it and I don't even really understand how it's done. In what file is the image file moved? What file is the image name stored in the database?

Any help would be greatly appreciated. Thank you!

Ben

:frusty:

4 Aug 2007, 3:09 PM
#2
brandtim avatar

brandtim

Zen Follower

Join Date:
Apr 2006
Posts:
250
Plugin Contributions:
0

Re: Image upload not working on new product type

Does the image upload work on a regular product? What are the permission settings for the images directory?

BrandTim

4 Aug 2007, 3:28 PM
#3
benr avatar

benr

New Zenner

Join Date:
Jun 2007
Posts:
13
Plugin Contributions:
0

Re: Image upload not working on new product type

The reguler product works fine. And the permissions are set to read/write/execute all. I haven't changed anything relating to the picture upload in the new product type. Thanks in advance for your help.

5 Aug 2007, 3:46 PM
#4
brandtim avatar

brandtim

Zen Follower

Join Date:
Apr 2006
Posts:
250
Plugin Contributions:
0

Re: Image upload not working on new product type

Ok, we can work through this one step at a time.

First, when you create a new product, preview it (even without the image), and hit 'insert', does the image file appear in the images directory?

BrandTim

6 Aug 2007, 1:29 PM
#5
benr avatar

benr

New Zenner

Join Date:
Jun 2007
Posts:
13
Plugin Contributions:
0

Re: Image upload not working on new product type

I tried it and no it does not move the image into the images folder. And this goes for both a new product insert as well as an existing product edit.

Like I said the process works fine when I use one of the default product types, but fails on the product type I created. Which leads me to believe it's not a permissions issue or anything like that, but rather something in the code. But again, I'm not familiar with how zen-cart handles image uploads so I don't know.

Thanks again for your help. Please let me know what the next step is in debugging this.

Take care.

Ben

8 Aug 2007, 10:26 PM
#6
brandtim avatar

brandtim

Zen Follower

Join Date:
Apr 2006
Posts:
250
Plugin Contributions:
0

Re: Image upload not working on new product type

Ok, next thing to check. In the database, in the products table, are the fields for products_image for your custom product type products blank or do they have the image file names?

BrandTim

9 Aug 2007, 2:01 PM
#7
benr avatar

benr

New Zenner

Join Date:
Jun 2007
Posts:
13
Plugin Contributions:
0

Re: Image upload not working on new product type

Blank in the db as well. Again just for the custom product-type.

Thanks!

Ben

10 Aug 2007, 8:30 PM
#8
brandtim avatar

brandtim

Zen Follower

Join Date:
Apr 2006
Posts:
250
Plugin Contributions:
0

Re: Image upload not working on new product type

Are you using a custom update_product.php file or using the default?

BrandTim

13 Aug 2007, 1:08 PM
#9
benr avatar

benr

New Zenner

Join Date:
Jun 2007
Posts:
13
Plugin Contributions:
0

Re: Image upload not working on new product type

I am using a custom update_product.php file. I copied from the music product type because I was following the tutorial. I only changed what's in between the following lines. I added some extra fields to a new table in the database.

///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC INSERTS HERE //////

  ////    *END OF PRODUCT-TYPE-SPECIFIC INSERTS* ////////
  ///////////////////////////////////////////////////////

The music product type does work fine.

Thanks again for your continued help.

Ben

14 Aug 2007, 4:44 PM
#10
brandtim avatar

brandtim

Zen Follower

Join Date:
Apr 2006
Posts:
250
Plugin Contributions:
0

Re: Image upload not working on new product type

Ok, next step.

Using the Live HTTP Headers extension for FireFox, capture your outgoing header when you click 'preview' when adding a new product.

Post the POST data here so we can take a look and see if it's correct at that point in the process.

BrandTim

14 Aug 2007, 4:56 PM
#11
benr avatar

benr

New Zenner

Join Date:
Jun 2007
Posts:
13
Plugin Contributions:
0

Re: Image upload not working on new product type

Here is its:

 POST /svn_site/admin/product_hearing_aid.php?cPath=1&product_type=6&pID=8&action=new_product_preview&page=1 HTTP/1.1
Host: localhost:8888
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8888/svn_site/admin/product_hearing_aid.php?page=1&product_type=6&cPath=1&pID=8&action=new_product
Cookie: style=null; zenAdminID=d426ab0668fc1583411f73a65393a272; zenid=9ea76272b5f502ef9b29f0305993c060
Content-Type: multipart/form-data; boundary=---------------------------1292073477524289475607802684
Content-Length: 16369
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_date_added"

2007-08-13 09:32:51
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="master_categories_id"

1
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_discount_type"

0
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_discount_type_from"

0
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_price_sorter"

1799.0000
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_status"

1
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_date_available"


-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="manufacturers_id"


-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_name[1]"

Test Product
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="product_is_free"

0
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="product_is_call"

0
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_priced_by_attribute"

0
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_tax_class_id"

0
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_price"

1799.0000
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_price_gross"

1799
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_virtual"

0
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="product_is_always_free_shipping"

0
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_qty_box_status"

1
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_quantity_order_min"

1
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_quantity_order_max"

0
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_quantity_order_units"

1
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_quantity_mixed"

1
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_description[1]"

<p>content for product description</p>
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="top_our_rating"

Five stars for being awesome.
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="top_for_who"

Anyone who wants to be awesome.
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="top_features"

Cutting edge technology with style to boot.
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="our_review"


-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="tech_specs"


-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="features"

<p>content for features</p>
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_quantity"

0
-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_model"


-----------------------------1292073477524289475607802684
Content-Disposition: form-data; name="products_image"; filename="logo02.gif"
Content-Type: image/gif
```It looks like the image is getting past in the POST variable.  But it's not getting processed from there.  Thanks for your continued help.
15 Aug 2007, 5:37 PM
#12
brandtim avatar

brandtim

Zen Follower

Join Date:
Apr 2006
Posts:
250
Plugin Contributions:
0

Re: Image upload not working on new product type

Are you using a custom new_product_preview.php file?

BrandTim

26 Sep 2007, 3:38 PM
#13
benr avatar

benr

New Zenner

Join Date:
Jun 2007
Posts:
13
Plugin Contributions:
0

Re: Image upload not working on new product type

brandtim:

Are you using a custom new_product_preview.php file?

BrandTim
brandtim: you were absolutely correct.

Somehow I had a custom new_product_preview.php file in my new product type folder and it was blank. I guess I forgot to copy and paste over the code for that. Alas, there is the mysterious file upload code and if it's in there it actually works. ;)

Thanks.

Ben