Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Option Types v2


Zappo

Recommended Posts

I've installed this contribution and I am unable to add a file upload option to products. All it does is add a dropdown menu to the product I am working on. I think the problem is that when I go to the products_attributes.php page via the admin, I get this error at the bottom of the page:

 

ontent"> Product Name   Option Name   Option Value   Value Price   Prefix   Sort Order   Action  1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #75' at line 1

Resource id #75

[TEP STOP]

 

Any help is greatly appreciated!

Link to comment
Share on other sites

ontent"> Product Name   Option Name   Option Value   Value Price   Prefix   Sort Order   Action  1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #75' at line 1

Resource id #75

[TEP STOP]

 

Any help is greatly appreciated!

You probably missed something while installing...

The error occurs if you get something from the database (tep_db_query), and don't "convert" it to an array (tep_db_fetch_array)

So you're missing some lines of code, or merged things wrongly...

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

2) in modules/option_types.php, a variable is counted up for every upload available on the page ($number_of_uploads)

You can use that variable to add/change the button on the product_info.php page: (around line 250 is the in_cart button)

if ($number_of_uploads >= 1) {

CHANGE/ADD BUTTON CODE

}

 

3) If you download the new release I brought out yesterday, and read this post you already have a perfectly neat solution!!!

You can set the sort order of the desired default option to the highest value, and you're good to go!

zappo,

thanks for the suggestion. this is the code i added. pehaps you can consider updating your contribution by adding this code to it too. it works for shops that have some items where upload is required and some where upload is not required:

<?php

if ($number_of_uploads >= 1) {

echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart_upload.gif', IMAGE_BUTTON_IN_CARD_UPLOAD);

}else {

echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);

 

}

?></td>

all i need now is to get some uploading progress bar integrated

if you have a suggestion for this i would appreciate very much. it should work as the buton is pressed the count starts. can be used ajax since in most shops it is already installed

thanks again

valerif

Link to comment
Share on other sites

zappo,

thanks for the suggestion.

all i need now is to get some uploading progress bar integrated

thanks again

valerif

Yeah...

An Upload Progress bar WOULD be nice...

Of course I thought of that too, but it looked like quite a task to integrate...

This HAS to be done with AJAX, because you'd have to add an extra page between product_info and shopping_cart if you wanted to do it elsewise...

Edited by Zappo

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

Yeah...

An Upload Progress bar WOULD be nice...

Of course I thought of that too, but it looked like quite a task to integrate...

This HAS to be done with AJAX, because you'd have to add an extra page between product_info and shopping_cart if you wanted to do it elsewise...

what i am thinking is something simple,

 

at the present i have the code in a way that when there is upload option for a product instead of "Add to Cart" button the user is presented with "Add to Cart & Upload Image" button. they both do the same job. its only more user friendly for them to know that to upload the image they need to click this button

 

what i am thinking is this. as soon as the user clicks the Add to Cart (Add to Cart & Upload Image) button they will be presented with new page (or stay on the same page) showing a progress bar or something like this just to show to the user they have to wait. this code can include also cancel upload option.

 

in particular this is important when the image is larger one and takes some time to upload

 

as soon as the upload has been completed the user is moved to shoping_cart.php

 

i was looking for ajax progress bar but to be honest i am not good at coding and struggle to integrate it

 

anyway i will keep on trying

 

cheers

valeri

Link to comment
Share on other sites

Apologies - this was the first contribution over a brand new version of OScommerce. I copied the files over the OSC files. I have not installed any contributions that have touched the shopping_cart.php file at all, so it is the one from the contribution.

 

Dont worry about it - Before I FTP my new shop up, I will get a client of mine to look at it and will post the results here.

 

Hi.

 

I am having the same problem. I have installed it (OptionTypes) twice on a new installation (nothing else added) and I the same error as FourPaws. I am sure I copied all the files across.

 

Any ideas?

Link to comment
Share on other sites

Is anyone still having this issue?!?

I can't replicate the result, and need more info to investigate!

- Change the attribute? What, where and how? (using Attribute Manager? Updating attribute, but changing what?, any other contribs installed?)

Thanx for the reply!

 

Hello Zappo and everybody

 

I can confirm the issue with error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /admin/includes/functions/database.php on line 99

 

Warning: Cannot modify header information - headers already sent by (output started at /admin/includes/functions/database.php:99) in /admin/includes/functions/general.php on line 22

 

The error happens in "product options" for option types "file", "text" and "textarea" when editing the "product option" , ie changing the "value length" for "text", after pressing "update"

When inserting a new "product option" everything goes fine

When editing, you need to get the error pressing "update", then go back in the browser, press "cancel", then the change is taken

 

It's the latest contribution version (v 2.1.2 of 2/10/09) installed on a virgin rc2a (contribution files copied over) running locally on xampp

 

Second issue: On the same installation, when I use the "image" product option everything works fine, except that the chosen option is not getting added to the cart. Both images appear correctly on product info page and change when switching the option there, but nothing gets added to the cart

Edited by multimixer
Link to comment
Share on other sites

Hello Zappo and everybody

 

I can confirm the issue with error

 

The error happens in "product options" for option types "file", "text" and "textarea" when editing the "product option" , ie changing the "value length" for "text", after pressing "update"

When inserting a new "product option" everything goes fine

When editing, you need to get the error pressing "update", then go back in the browser, press "cancel", then the change is taken

 

It's the latest contribution version (v 2.1.2 of 2/10/09) installed on a virgin rc2a (contribution files copied over) running locally on xampp

 

Second issue: On the same installation, when I use the "image" product option everything works fine, except that the chosen option is not getting added to the cart. Both images appear correctly on product info page and change when switching the option there, but nothing gets added to the cart

THANK YOU for a reply I can work with!!!

Somehow, everything works here @ my system, but I found the mistake (for the mysql_fetch_array() error)...

 

The mistake I made: in products_attributes.php, line 137 REPLACE:

$optionType_query

WITH:

$pov2po_query

 

Found the second issue too:

This was actually kinda intended, as the "image functionality" was added because of multiple requests of people who'd seen the functionality on my running Crystal Copy website. I re-used some code from my own site for this, and there it's used as FONT, so doesn't get added when no Text is added/entered...

I don't remember (yet) where I set up this "text-detection", so will get back to you about that...

Edited by Zappo

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

Found the second issue too:

This was actually kinda intended, as the "image functionality" was added because of multiple requests of people who'd seen the functionality on my running Crystal Copy website. I re-used some code from my own site for this, and there it's used as FONT, so doesn't get added when no Text is added/entered...

I don't remember (yet) where I set up this "text-detection", so will get back to you about that...

Ok, I was wrong about that one :blush:

This IS however a copy/past mistake:

in modules/option_types.php, line 141, REPLACE:

$Image_Dropdown_ID = 'id_' . $product_info['products_id'] . '[' . $ProdOpt_ID . ']';

WITH:

$Image_Dropdown_ID = 'id[' . $ProdOpt_ID . ']';

 

Strange that no-one seems to have mentioned this before (or did I miss something?)

 

I'll put out a new release a.s.a.p.

Thanks for the bug-report!

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

I've installed this contribution and I am unable to add a file upload option to products. All it does is add a dropdown menu to the product I am working on. I think the problem is that when I go to the products_attributes.php page via the admin, I get this error at the bottom of the page:

 

ontent"> Product Name   Option Name   Option Value   Value Price   Prefix   Sort Order   Action  1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #75' at line 1

Resource id #75

[TEP STOP]

 

Any help is greatly appreciated!

Just glanced over your post again, and if your error is EXACTLY ontent"> Product Name etc

That would suggest you broke the HTML code somewhere! (Maybe search for ontent">, as this should probable say: class="dataTableHeadingContent">

That gives you a start, but as I said before, it seems you merged things wrongly...

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

Thank you very much for this fast and effective response on a Sunday afternoon.

 

I don't know why nobody reported the images issue before, maybe nobody tried systematically?

 

Anyway, both issues are solved thanks to your engagement, I hope this 2 posts will help others too :)

Edited by multimixer
Link to comment
Share on other sites

Ok everyone...

Released: Option Types v2.1.3

* Fixed issue with products_attributes.php -> updating Text/Upload Options

* Fixed issue with Image Types not being added

* Went back to (Deprecated!!!) $HTTP_####_VARS (to avoid confusion)

 

Please report any bugs you may encouter!

 

 

P.S. I really don't have time to update the readme and/or installation guides...

Volunteers?!?!

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

I hate to post twice, but I also cannot seem to get AJAX to work with this option types. It will say CUSTOMER-INPUT in the attribute manager, but when I go to the product page it is simply a drop-down with the option of "CUSTOMER-INPUT".

Thanks.

 

I think the issue here is as follows:

 

1) If I have a product option defined via the regular products attributes page in admin, then I can use this on the product page on admin, using the ajax attributes manager. The option value appear as "customer input" and on the product info page on the storefrnt I get a nice text input field, everything ok!

 

2) If I DON'T have a product option defined and I do this directly on the product page in admin, I don't have a chance to choose the "option type". Whatever is not defined before (in regular atributes page) as an option type (text, radio etc) is geting the status "customer input" BUT appears on the front page as a "select" (default") option type. The only option to chose there is "customer input"

 

If, instead of accepting this "customer input" when inserting a new product option with ajax, I type in any text, it behaves like a normal "select" option type, taking my text as an option value

Link to comment
Share on other sites

I think the issue here is as follows:

 

1) .......

Correct. This is indeed a small bug... (Adding Options in Attribute Manager)

I don't have time to dig through the AttribManager code, so in short:

To add Options for Text, TextArea or Uploads (Customer-Input Option Types), add them in the "normal" Products Attributes page first! (or Products Options page)

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

Greetings Zappo -

 

First, thanks for putting together a great package!

 

I did a clean install and got everything working fine.

 

I have one issue, which is that the sort order doesn't

appear to be working. I've deleted and re-added, and re-set

the sort order, but the user sees things out of order.

 

The order given isn't alphabetical. I've logged off/logged

on, no difference.

 

Any idea what I might have missed?

 

Thanks again!

 

AD7

Link to comment
Share on other sites

The order given isn't alphabetical. I've logged off/logged

on, no difference.

 

Any idea what I might have missed?

Thanks again!

You should check the forum first!

The sort order is set via admin, per Product.

To sort things by alphabetical order, read this post

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

I am hoping someone can help me with this, have been trying to figure this out for days. I have a new store with STS and Option Types both installed. I have compared and Diffed the files multiple times. Basically the problem is that when I have STS enabled on product pages, it forces the product attribute to be a dropdown. No matter what I do I cannot get it to be a checkbox, or textarea, or text field even though that is what I have selected in the backend. As soon as I disable the template for the product page in STS, it works fine.

 

Please someone help!!!

Link to comment
Share on other sites

I am hoping someone can help me with this, have been trying to figure this out for days. I have a new store with STS and Option Types both installed. I have compared and Diffed the files multiple times. Basically the problem is that when I have STS enabled on product pages, it forces the product attribute to be a dropdown. No matter what I do I cannot get it to be a checkbox, or textarea, or text field even though that is what I have selected in the backend. As soon as I disable the template for the product page in STS, it works fine.

 

Please someone help!!!

Maybe you can look on STS forum topic for solutions on your problem.

Solutions regarding the "old" Option Types contribution can help you a great deal too! (Maybe check that forum topic as well)

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

Thanks Zappo, I have posted on there as well. Hopefully someone will see it and have a solution!! I have probably spent over 10 hours trying to figure out this one problem :(

Well, I CAN tell you, it probably has to do with the file modules/option_types.php not being included...

That's where all the option types are collected, identified, and "printed".

I don't know anything about STS, so I'm just guessing away here.

Like Eek said... It never hurts to help!
----------------------------------------

Link to comment
Share on other sites

[....] Basically the problem is that when I have STS enabled on product pages, it forces the product attribute to be a dropdown. [....]

 

I'm working on this since yesterday, hopefully something will come out :) Lets discuss the issue in the stsv4 forum, to keep things here related just to the contribution. Results will be posted here as well of course

Link to comment
Share on other sites

Is it possible in this contribution to embed an attribute within a attribute? say if there were two radio buttons

 

  • Upload image
  • Or enter web URL

 

If the user were to select 'upload image' an upload attribute would come into effect or if they were to select 'or enter web URL' a text box attribute would be revealed?

Link to comment
Share on other sites

You should check the forum first!

The sort order is set via admin, per Product.

To sort things by alphabetical order, read this post

 

Yes, I know that: ID, Option Name, Option Type, Sort Order, Value Length, Comment

are the fields.

 

I did actually read and search through many of these pages, as I actually

screwed up the install the first time around, and had to restart. I'm

thinking that I mistyped somewhere else.

 

I used to code in php, and still occasionally, and I know my way around

code in general, so this is puzzling to me. When I do a "select * from

products_options" the field appears to be "products_options_order",

but the result, from the user's perspective, doesn't match what's in

the table.

Link to comment
Share on other sites

I'm working on this since yesterday, hopefully something will come out :) Lets discuss the issue in the stsv4 forum, to keep things here related just to the contribution. Results will be posted here as well of course

 

Glad to hear im not the only one. I have a post up there as well. Let me know if you hear anything

Link to comment
Share on other sites

Yes, I know that: ID, Option Name, Option Type, Sort Order, Value Length, Comment

are the fields.

 

I did actually read and search through many of these pages, as I actually

screwed up the install the first time around, and had to restart. I'm

thinking that I mistyped somewhere else.

 

I used to code in php, and still occasionally, and I know my way around

code in general, so this is puzzling to me. When I do a "select * from

products_options" the field appears to be "products_options_order",

but the result, from the user's perspective, doesn't match what's in

the table.

 

Here's some additional detail. Weird behavior! But I think I have the

fix.

 

First:

 

mysql> select products_options_id, products_options_name, products_options_order from products_options order by products_options_order asc;

+---------------------+-----------------------+------------------------+

| products_options_id | products_options_name | products_options_order |

+---------------------+-----------------------+------------------------+

| 1 | First Name | 0 |

| 2 | Last Name | 1 |

| 11 | Medications | 10 |

| 13 | Blood type | 11 |

| 14 | Identifying Marks | 12 |

| 15 | School | 13 |

| 16 | Grade | 14 |

| 17 | Bus | 15 |

| 18 | Additional Notes | 16 |

| 19 | Weight | 17 |

| 3 | Age | 2 |

| 4 | Birth Date | 3 |

| 5 | Male | 4 |

| 6 | Female | 5 |

| 7 | Hair Color | 6 |

| 8 | Eye Color | 7 |

| 9 | Height | 8 |

| 10 | Allergies | 9 |

+---------------------+-----------------------+------------------------+

18 rows in set (0.00 sec)

 

mysql>

 

This is the typical characteristic of a character field, instead of an int() field.

So, I did an alter table:

 

mysql> alter table products_options modify products_options_order int(2);

 

Now it works right:

 

mysql> select products_options_id, products_options_name, products_options_order from products_options order by products_options_order asc;

+---------------------+-----------------------+------------------------+

| products_options_id | products_options_name | products_options_order |

+---------------------+-----------------------+------------------------+

| 1 | First Name | 0 |

| 2 | Last Name | 1 |

| 3 | Age | 2 |

| 4 | Birth Date | 3 |

| 5 | Male | 4 |

| 6 | Female | 5 |

| 7 | Hair Color | 6 |

| 8 | Eye Color | 7 |

| 9 | Height | 8 |

| 10 | Allergies | 9 |

| 11 | Medications | 10 |

| 13 | Blood type | 11 |

| 14 | Identifying Marks | 12 |

| 15 | School | 13 |

| 16 | Grade | 14 |

| 17 | Bus | 15 |

| 18 | Additional Notes | 16 |

| 19 | Weight | 17 |

+---------------------+-----------------------+------------------------+

18 rows in set (0.00 sec)

 

mysql>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...