Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Option Types v2


Zappo

Recommended Posts

I am having one issue:

In admin If i want to change the attribute it allows it - when I click the update button I get this error:

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

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!

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

Link to comment
Share on other sites

It worked out very well , but attributes disappearing when quantity is updated in shopping cart.

Hi Zoran,

Are you still having this problem?

I thought I solved this some time ago...

Please check if you updated the file includes/classes/shopping_cart.php correctly (and with latest version 2.1.1)

Again, let me know how it works out!

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

Link to comment
Share on other sites

Ok everyone, I found some time and:

Released: Option Types v2.1.2

* Added Product Attribute Sorting (Sort Dropdowns)

* Added option for "No Text Progress Bars"

* Applied Fixes discussed in this forum thread

The sorting of the dropdowns can also be used for the "Default Dropdown value". That'll be the attribute sorted as highest!

 

I included a file in the download named: Update from v2.1.x.txt

That's for the people who have installed Option Types v2.1.0 or v2.1.1 (with the Image Option Type), and want to add the new functionality. Just follow the instructions in that file when updating, so you won't have to copy over all of your files. (and change the Database manually)

 

Please report any bugs you may encouter!

Edited by Zappo

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

Link to comment
Share on other sites

You're both right, of course!

I don't really know why I didn't add that in the first place! (Think I was used to having the progress bar @ least with the TextArea, because that's how the "old" option types contribution works...)

Anyway, I don't have time for full updates 'n stuff, but thought I'd try and help some people out who posted here...

Thanks Zappo :lol:

Link to comment
Share on other sites

I am still having this error if I try and update an attribute. If I cancel the update it does the change.

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

 

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

Line 99 in database.php reads:

return mysql_fetch_array($db_query, MYSQL_ASSOC);

Line 22 in general.php reads:

}
Link to comment
Share on other sites

I am still having this error if I try and update an attribute. If I cancel the update it does the change.

Those errors are probably caused by classes/shopping_cart.php...

Information is gathered there, (not correctly) and handled by the files that throw the errors...

Did you re-check your includes/classes/shopping_cart.php file?

Do you have any other contributions installed, and which ones?

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

Link to comment
Share on other sites

1) I actually have been looking into that, but it's not at all easy to make!!! (It's very possible, but also pretty complicated...)

2) You could have a variable set @ uploads (variable will only exist if an upload is also shown), and then use that variable to display/hide the extra button... It's not very pretty, but should work like a charm... (can provide some code if needed)

3) That question was asked before, and we do need such functionality... Still looking into that (and the sort-order for attributes)

 

thanls for your answers.

 

2) it would be very helpful if you can provide some code suggestion on:

if upload option is available replace the checkout button with or add another button that will be UPLOAD AND CHECKOUT

 

3) perhaps could be an option when creating the options in admin a particular option can be set as a default selected always. this is not very flexible way but it can be a good start and will resolve the problem

 

thanks again

Link to comment
Share on other sites

2) it would be very helpful if you can provide some code suggestion on:

if upload option is available replace the checkout button with or add another button that will be UPLOAD AND CHECKOUT

 

3) perhaps could be an option when creating the options in admin a particular option can be set as a default selected always. this is not very flexible way but it can be a good start and will resolve the problem

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!

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

Link to comment
Share on other sites

Those errors are probably caused by classes/shopping_cart.php...

Information is gathered there, (not correctly) and handled by the files that throw the errors...

 

Did you re-check your includes/classes/shopping_cart.php file?

My shopping_cart.php file has not been modded.

 

Do you have any other contributions installed, and which ones?

About another 25. I have not installed anything that plays with the product attributes except what was included with the contribution.

It only does this if you try and "Edit" an attribute not when you first install one.

It also only does it when you select "Text" "TextArea" or "File" (The rest of the choices, as well as ones that dont make use of this contribution all work fine)

Link to comment
Share on other sites

My shopping_cart.php file has not been modded

Well There's your problem!!!

Why not?

You can't expect a contribution to work, if you don't apply all changes it involves!

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

Link to comment
Share on other sites

Well There's your problem!!!

Why not?

You can't expect a contribution to work, if you don't apply all changes it involves!

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.

Link to comment
Share on other sites

hi zappo,

 

thanks for the update and your replay on my questions

 

i started updating to the new version but noticed one difference on the new code for the product_attributes.php

 

for example in the old file i have: ($HTTP_GET_VARS['action'])

 

but in the new update: ($_GET['action']), and this is repeated through every _GET statement.

 

i stopped my update here because i wondered if this was deliberate change or some kind of typo

 

let me knmow please

 

thanks

valeri

Link to comment
Share on other sites

hi zappo,

 

thanks for the update and your replay on my questions

i started updating to the new version but noticed one difference on the new code for the product_attributes.php

for example in the old file i have: ($HTTP_GET_VARS['action'])

but in the new update: ($_GET['action']), and this is repeated through every _GET statement.

i stopped my update here because i wondered if this was deliberate change or some kind of typo

let me knmow please

thanks

valeri

Hi Valeri,

 

I'm sorry about that! Maybe I should have mentioned something...

 

$HTTP_POST_VARS actually is the old version of $_POST. (starting from PHP v4.1, and I can't imagine a Host having a lesser version than that)

In the future $HTTP_POST_VARS can (or rather will) be totally replaced by $_POST and at that time will stop working, and that's why my code (as of now) will probably always use the $_POST and $_GET etc instead of the $HTTP_POST_VARS and $HTTP_GET_VARS etc (shorter code too!!!)

This ensures that when my Host updates the PHP software, osCommerce won't stop working.

see PHP SuperGlobals for more information on this...

 

Now, what you can do:

I'm not entirely sure both can be used next to each other without problems, but they probably can...

To be sure however, I would either Replace all the $_POST's and $_GET's with $HTTP_POST_VARS and $HTTP_GET_VARS etc...

OR

(what I did) Replace ALL (with ALL I mean ALL osCommerce files, by search and replace in all folders) the $HTTP_POST_VARS with $_POST, $HTTP_GET_VARS with $_GET, $HTTP_SERVER_VARS with $_SERVER, $HTTP_POST_FILES with $_FILES, $HTTP_COOKIE_VARS with $_COOKIE, $HTTP_SESSION_VARS with $_SESSION, and $HTTP_ENV_VARS with $_ENV

(This can of course also be done later, when absolutely needed)

 

Hope this explains everything...

Edited by Zappo

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

Link to comment
Share on other sites

Ok everyone, I found some time and:

<!--sizeo:4--><span style="font-size:14pt;line-height:100%"><!--/sizeo--><b>Released: <a href="http://addons.oscommerce.com/info/6818/" target="_blank">Option Types v2.1.2</a></b><!--sizec--></span><!--/sizec-->

* Added <b>Product Attribute Sorting (Sort Dropdowns)</b>

* Added option for <b>"No Text Progress Bars"</b>

* <b>Applied Fixes</b> discussed in this forum thread

The sorting of the dropdowns can also be used for the <b>"Default Dropdown value"</b>. That'll be the attribute sorted as highest!

 

I included a file in the download named: Update from v2.1.x.txt

That's for the people who have installed Option Types v2.1.0 or v2.1.1 (with the Image Option Type), and want to add the new functionality. Just follow the instructions in that file when updating, so you won't have to copy over all of your files. (and change the Database manually)

 

Please report any bugs you may encouter!

 

Zappo

 

Thanks for your work. Am trying to follow the instructions for upgrading from V2.1.1 but run into a problem which is probably mine not yours.

 

In Section two of your instructions you say very clearly to find twice in admin/products_attributes.php

the following:

$price_prefix = tep_db_prepare_input($_POST['price_prefix']);

 

My admin/products_attributes.php file does not contain that exact line but does twice have the following:

 

$price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);

I find that in both my products_attributes.php file and the one in your V2.1.1 file at approximately lines 93 and 207. Are those the ones I should add below?

 

The same thing happens on the next section of your instructions also.

 

Thanks,

 

Norman

Link to comment
Share on other sites

Hi Valeri,

 

I'm sorry about that! Maybe I should have mentioned something...

 

$HTTP_POST_VARS actually is the old version of $_POST. (starting from PHP v4.1, and I can't imagine a Host having a lesser version than that)

In the future $HTTP_POST_VARS can (or rather will) be totally replaced by $_POST and at that time will stop working, and that's why my code (as of now) will probably always use the $_POST and $_GET etc instead of the $HTTP_POST_VARS and $HTTP_GET_VARS etc (shorter code too!!!)

This ensures that when my Host updates the PHP software, osCommerce won't stop working.

see PHP SuperGlobals for more information on this...

 

Now, what you can do:

I'm not entirely sure both can be used next to each other without problems, but they probably can...

To be sure however, I would either Replace all the $_POST's and $_GET's with $HTTP_POST_VARS and $HTTP_GET_VARS etc...

OR

(what I did) Replace ALL (with ALL I mean ALL osCommerce files, by search and replace in all folders) the $HTTP_POST_VARS with $_POST, $HTTP_GET_VARS with $_GET, $HTTP_SERVER_VARS with $_SERVER, $HTTP_POST_FILES with $_FILES, $HTTP_COOKIE_VARS with $_COOKIE, $HTTP_SESSION_VARS with $_SESSION, and $HTTP_ENV_VARS with $_ENV

(This can of course also be done later, when absolutely needed)

 

Hope this explains everything...

 

thanks for the explanation,

it clears it all. i installed the change as it is and works fine on my server fine

Link to comment
Share on other sites

Zappo

Thanks for your work. Am trying to follow the instructions for upgrading from V2.1.1 but run into a problem which is probably mine not yours.

 

$price_prefix = tep_db_prepare_input($_POST['price_prefix']);

$price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);

 

The same thing happens on the next section of your instructions also.

Thanks,

Norman

Hi Norman,

That's my bad...

See my previous Post

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

Link to comment
Share on other sites

Hi Norman,

That's my bad...

See my previous Post

Zappo

 

Thanks one more time. I have that working the way you intended but not exactly the way I hoped it would. With your sort method I have to input a number for each attribute corresponding with where I want it to appear in my dropdown list. If I add an attribute out of sequence then I have to redo the entire sort order to get it in the right place.

 

All I really need is to have my drop down options (attributes) appear in alphabetical order regardless of the order in which I input them. I was once able to accomplish this in osCMax by putting an order by at the end of a query in a file (maybe product_info?). If you understand what I am asking and you have the time could you please point me to the file where I can accomplish this.

 

Thanks,

 

Norman

Link to comment
Share on other sites

Zappo

 

Thanks one more time. I have that working the way you intended but not exactly the way I hoped it would. With your sort method I have to input a number for each attribute corresponding with where I want it to appear in my dropdown list. If I add an attribute out of sequence then I have to redo the entire sort order to get it in the right place.

 

All I really need is to have my drop down options (attributes) appear in alphabetical order regardless of the order in which I input them. I was once able to accomplish this in osCMax by putting an order by at the end of a query in a file (maybe product_info?). If you understand what I am asking and you have the time could you please point me to the file where I can accomplish this.

 

Thanks,

 

Norman

Hi Norman,

I think I know what you mean...

The Sort order as it works in the last update, is A LOT more user-friendly using the Attribute Manager (when adding Options, you set the sort order per product, just by clicking "Up or Down"...

 

To just sort the Option Values by Option Value Name, just do this (I can't test this right now, I just have the files):

Open up product_info.php, and find (around line 169):

order by pa.products_options_sort_order");

Replace that by:

order by pov.products_options_values_name");

Then, open includes/modules/option_types.php, and find (2x)(around line 96 AND line 132):

order by pa.products_options_sort_order");

and replace that by:

order by pov.products_options_values_name");

 

That should order the Product's Attributes (Products Values) by name.

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

Link to comment
Share on other sites

Hi Norman,

I think I know what you mean...

The Sort order as it works in the last update, is A LOT more user-friendly using the Attribute Manager (when adding Options, you set the sort order per product, just by clicking "Up or Down"...

 

To just sort the Option Values by Option Value Name, just do this (I can't test this right now, I just have the files):

Open up product_info.php, and find (around line 169):

order by pa.products_options_sort_order");

Replace that by:

order by pov.products_options_values_name");

Then, open includes/modules/option_types.php, and find (2x)(around line 96 AND line 132):

order by pa.products_options_sort_order");

and replace that by:

order by pov.products_options_values_name");

 

That should order the Product's Attributes (Products Values) by name.

 

 

Zappo

 

Yes you understood exactly and it worked perfectly! I guess I owe you two million thanks until you are better paid.

 

Thanks Again.

Link to comment
Share on other sites

Is this oscMax Compatible?

Dunno....

As osCMax is basically osCommerce with various attributions pre-installed, it should be able to implement it.

Try and find out...

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

Link to comment
Share on other sites

I saw this mentioned earlier in the thread, but little mention since. I am looking for a way to track stock levels of products with multiple attributes. For instance, I have a shirt with a logo on it. The shirt comes in four colors, and there are 5 or 6 sizes. That makes about 20-25 "actual" products that need to have their stock tracked. I have done plenty of research and still cannot find a solution. Maybe someone else has experience with a site selling apparel or similar and has dealt with this issue? I apologize if this is not the correct thread for this, but i cannot find a mention of this anywhere else. Help Please!

Edited by mrjoslin
Link to comment
Share on other sites

I saw this mentioned earlier in the thread, but little mention since. I am looking for a way to track stock levels of products with multiple attributes. For instance, I have a shirt with a logo on it. The shirt comes in four colors, and there are 5 or 6 sizes. That makes about 20-25 "actual" products that need to have their stock tracked. I have done plenty of research and still cannot find a solution. Maybe someone else has experience with a site selling apparel or similar and has dealt with this issue? I apologize if this is not the correct thread for this, but i cannot find a mention of this anywhere else. Help Please!

Nope.

That's actually not as easy as it seems...

I WAS developing a contribution to handle that kind of stuff (and a lot more) called Linked Products, but development has totally halted on that project. I only released a (buggy) Alpha version...

I will probably pick it up sometime in the future, but that'll be a long time from now...

 

I think the closest you'll get to such functionality, is with Quantaty Tracking Pro (QTPro)

 

Good Luck!

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

Link to comment
Share on other sites

I need to add a file upload to create_account.php and I tried using another contribution that actually allows admin to upload a pdf to a product. I changed it up a bit with bad results. The box is there on the edit customer page, but half the time I get a fatal error with "no file uploaded" and the other half the time, no file uploads or (obviously) has a visible filename in the box. All I want is to have the customer upload a file when they create an account. I really don't need all the ajax or sorting. Is there possibly another contribution or modified version of this one that I could use? I have tried google and searching contributions for "file upload" and I don't find much. Through the forum I have learned of this and some other contributions, but then again not exactly what I need (don't need 3 images, etc.). I'm a bit frustrated trying this through the typical osCommerce coding but would rather do that than add straight php or html. Any help would be much appreciated! Thanks! : )

☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆ ☆

Link to comment
Share on other sites

I need to add a file upload to create_account.php and I tried using another contribution that actually allows admin to upload a pdf to a product. I changed it up a bit with bad results. The box is there on the edit customer page, but half the time I get a fatal error with "no file uploaded" and the other half the time, no file uploads or (obviously) has a visible filename in the box. All I want is to have the customer upload a file when they create an account. I really don't need all the ajax or sorting. Is there possibly another contribution or modified version of this one that I could use? I have tried google and searching contributions for "file upload" and I don't find much. Through the forum I have learned of this and some other contributions, but then again not exactly what I need (don't need 3 images, etc.). I'm a bit frustrated trying this through the typical osCommerce coding but would rather do that than add straight php or html. Any help would be much appreciated! Thanks! : )

Well....

Uuuuhhhmmm....

This shouldn't be too hard, and I'm willing to help, but we'll have to do this together.

Don't install OptionTypes v2 (or any other contrib for that matter) to handle this. That won't do you any good, as what you want is entirely different from admin- or attribute- uploading...

 

1 ) depending on what you want to do with the upload(?), we'll have to decide IF and WHERE to add database fields

2 ) decide if you want an "on/off" feature(?). We'll have to add configuration-database fields, or a setting in configuration.php

 

a ) we'll have to handle the upload as if it were a "customer detail" (like "customer name" or whatnot)

b ) we're gonna re-use the upload script from Option Types v2 to do the actual upload handling

 

To start you off, create an upload field in create_account.php, and see that is has a proper name.

Let me know the name of your field, and the decisions on points 1 and 2, and we'll continue.

Edited by Zappo

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

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