Jump to content
Zappo

[Contribution] Option Types v2

Recommended Posts

Hi,

 

Thanks for this contribution, I think it's really useful, just what I was looking for!

 

I installed it and it seems to be working fine. But I found a problem in the product information page: when I click on a product and the product page apears the right column gets misplaced, it apears under the left column. I know the problem is in the product_info.php file, but I can't find it. I went back to the pre-instalation file and remade all the changes step-by-step (saving and verifying the site after each step) and I know that it happens when I make the last 2 changes. But I can't see what can be done differently.

 

I also have "multi images add-on fancy pop-up" installed.

 

If anyone can help me I would be very thankful!

 

I'm quite new to php.

 

Thanks,

 

Maria

Share this post


Link to post
Share on other sites

Hi everyone,

 

BTW, I think this time Zappo is really somewhere in paradise drinking a cool pina colada

Yeah... I WISH :D

Just dropping a note to let y'all know this thread is not dead, and I still want to improve upon/support Option Types v2.

However, I run my own business, and it's hard to find the time.

 

PLEASE don't PM or email me for assistance.

I always receive an email when someone posts here, and if I don't reply on the forum it's because:

- I don't know the answer (I'm only a novice PHP programmer myself)

- I'm too busy

 

As is stated on this thread before, Option Types v2 works perfectly "out of the box", and any (or all) problems are caused by faulty merging, or a combination of other contributions.

It never hurts to help, but you'll all understand I'm not going to spend hours to solve your problems for you.

 

Now, for some answers:

@Maria Cafe: I think you should check all the <table> <tr> <td> tags, and see if they are opened/closed properly.

@Ibissen: I suspect the 500 error is caused by not being able to save the file on the server. Make sure the correct folders are in place, and that they are writable.

@DenominatorX: Don't know. Why not try it out, and see for yourself. (Please post results for future visitors)

@nutlog13: Best way to have fields as required would be some javascript. That way, you could have a message popup if the customer did not enter anything. Doing it with PHP is possible, but that will need a page-refresh for customers to discover they need to enter info... (which would be annoying IMO)

Also, I seem to remember somewhere in this thread someone also needed this, and found a script to do the job. Not sure though...

@amyburns: As the error states, the values you're trying to put in the Database do not match the number of colums in the database... I suspect you did not merge all the files correctly. (After the SQL command, you should have 7 columns in "products_attributes", and you're trying to input 6 values...) Check if you merged the file admin/products_attributes.php correctly...

 

And finally,

@MultiMixer: A big thanks for all the support you have given. (as only I seem to get all the thanks around here ;) )


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

Share this post


Link to post
Share on other sites

Hi Zappo,

 

Thank you so much for your help! I finally found the solution.

 

The problem was that in your instructions, when editing the product_info.php file, at the end you give the following instruction:

 

***FIND***


     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
 }


Add below: 

//BOF - Zappo - Option Types v2 - File Uploading: Hidden field passing number of uploads to next file
?>
       </td>
     </tr>
     <tr>
       <td><?php echo tep_draw_hidden_field('number_of_uploads', $number_of_uploads); ?></td>
     </tr>
   </table></form></td>
<?php
//EOF - Zappo - Option Types v2 - File Uploading: Hidden field passing number of uploads to next file

 

 

But the </td> and </tr> tags in the beginning of the code we're supposed to add are already in the file, so they get repeated. Well, I am a newbie, a really inexperient one, so I didn't see it.

 

Thank you again and keep up the good work!

 

Maria

Share this post


Link to post
Share on other sites

Dear Zappo,

 

thank you for your reply. But it is exactly the other way around:

 

If I use the original code of "option type", the file IS uploaded and the product IS not added to the basket, AND I get the 500 error by the application_top - add product - function.

 

In the meanwhile I de-installed the contributions STS and PWA, which couldn't be the reason.

Additionally I work with QPBPP (latest version), which requires a modification of the add_card function in application_top.php:

 

OPTION TYPE:
$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids))+1, $real_ids);
QPBPP:
$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids)) + $HTTP_POST_VARS['cart_quantity'], $real_ids);

 

But in my option this can't be responible for that error too ...

 

If comment out the following section (trail and error solution), I don't get an 500-error, the product (with attribut) is transfered to the basket, BUT the file wasn't uploaded:

//if (!($products_options_file->save())) {
//break 2;
//}
}
//else {
//break 2;
//}

 

If you or anyone else can help me with that problem - that would be great.

(I hope, it is not a stupid bracket thing ... I checked it at least twenty times)

 

Ibissen

Edited by Ibissen

Share this post


Link to post
Share on other sites

Hi everyone,

 

 

Yeah... I WISH :D

Just dropping a note to let y'all know this thread is not dead, and I still want to improve upon/support Option Types v2.

However, I run my own business, and it's hard to find the time.

 

PLEASE don't PM or email me for assistance.

I always receive an email when someone posts here, and if I don't reply on the forum it's because:

- I don't know the answer (I'm only a novice PHP programmer myself)

- I'm too busy

 

As is stated on this thread before, Option Types v2 works perfectly "out of the box", and any (or all) problems are caused by faulty merging, or a combination of other contributions.

It never hurts to help, but you'll all understand I'm not going to spend hours to solve your problems for you.

 

Now, for some answers:

@Maria Cafe: I think you should check all the <table> <tr> <td> tags, and see if they are opened/closed properly.

@Ibissen: I suspect the 500 error is caused by not being able to save the file on the server. Make sure the correct folders are in place, and that they are writable.

@DenominatorX: Don't know. Why not try it out, and see for yourself. (Please post results for future visitors)

@nutlog13: Best way to have fields as required would be some javascript. That way, you could have a message popup if the customer did not enter anything. Doing it with PHP is possible, but that will need a page-refresh for customers to discover they need to enter info... (which would be annoying IMO)

Also, I seem to remember somewhere in this thread someone also needed this, and found a script to do the job. Not sure though...

@amyburns: As the error states, the values you're trying to put in the Database do not match the number of colums in the database... I suspect you did not merge all the files correctly. (After the SQL command, you should have 7 columns in "products_attributes", and you're trying to input 6 values...) Check if you merged the file admin/products_attributes.php correctly...

 

And finally,

@MultiMixer: A big thanks for all the support you have given. (as only I seem to get all the thanks around here ;) )

Heyyyyyy Zappo:

 

Lols, just dropping by, to say hello and thanks again. I totally understand your points, I kind of imagined you were tied up some where. It's good that your busy, that means business is good :thumbsup: You should take the time to drink that pina colada someday though, ;) Just wanted to say once again I luvvvvv this contribution GREAT WORK!!!

 

Glenda


I Hate PHP, LoLssss

Visit My Site, Any constructive comments and suggestions Welcome :)

WARNING: IT'S STILL UNDER CONSTRUCTION, LOLS

Share this post


Link to post
Share on other sites

If I use the original code of "option type", the file IS uploaded and the product IS not added to the basket, AND I get the 500 error by the application_top - add product - function.

 

In the meanwhile I de-installed the contributions STS and PWA, which couldn't be the reason.

....

But in my option this can't be responible for that error too ...

 

If comment out the following section (trail and error solution), I don't get an 500-error, the product (with attribut) is transfered to the basket, BUT the file wasn't uploaded

Hmmm.... That IS strange...

And what happens if you only comment out the two break 2; lines?

Also, is the file (when it DOES upload) renamed, and is it renamed correctly?

Is there also a record of the upload in the database? (TABLE_FILES_UPLOADED)

The lines you are commenting out save the file to the new location with the new name, and should exit the code if this fails.

I'm thinking something is wrong with either the $TEMP_FILE or $insert_id variables...


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

Share this post


Link to post
Share on other sites

Hello!

 

In new product i get this message. I´ve checked the database and cant find the problem. What is 'order clause'

 

 

1054 - Unknown column 'products_options_order' in 'order clause'

 

select * from products_options where language_id='2' order by products_options_order

 

[TEP STOP]

Share this post


Link to post
Share on other sites

1054 - Unknown column 'products_options_order'

did you run the sql file?

You are missing the column 'products_options_order'...


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

Share this post


Link to post
Share on other sites

did you run the sql file?

You are missing the column 'products_options_order'...

 

My products_options table looks like this

product_options.JPG

Share this post


Link to post
Share on other sites

My products_options table looks like this

Well, that's obviously there...

The error means "can't find the column products_options_order" given in the "order by" command...

The query below the error (select * from products_options where language_id='2' order by products_options_order) seems to be OK too...


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

Share this post


Link to post
Share on other sites

Well, that's obviously there...

The error means "can't find the column products_options_order" given in the "order by" command...

The query below the error (select * from products_options where language_id='2' order by products_options_order) seems to be OK too...

 

so what can be the problem?

 

When i click add to cart in the frontend i also get this error

Warning: opendir(TMP_DIR): failed to open dir: No such file or directory in /hsphere/local/home/opusvist/shop.opusvista.nu/includes/application_top.php on line 374 Could not open TMP_DIR

Share this post


Link to post
Share on other sites

Well, exactly like the message says...

Can't find TEMP_DIR

 

I suggest you check your entire installation.

Those things have nothing to do with each other...

Edited by Zappo

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

Share this post


Link to post
Share on other sites

Finally everything works. Thanks for a wonderful contribution.

 

Is there a way to fix the size of the option image? i would like to us a thumbnail with a popup image.

Edited by OpusVista

Share this post


Link to post
Share on other sites

Hmmm.... That IS strange...

And what happens if you only comment out the two break 2; lines?

Also, is the file (when it DOES upload) renamed, and is it renamed correctly?

Is there also a record of the upload in the database? (TABLE_FILES_UPLOADED)

The lines you are commenting out save the file to the new location with the new name, and should exit the code if this fails.

I'm thinking something is wrong with either the $TEMP_FILE or $insert_id variables...

 

Hi Zappo,

 

thanks a lot for your help. Finally I found the mistake (which has nothing to do with the application_top.php):

It is a conflict between STS and Open Type in

include/function/html_output.php ca. line 78

// START STS v4.4:
global $sts; 
$sts->image($src); // Take image from template folder if exists.
// END STS v4.4

I comment this out, because I don't need images in the template folder.

Maybe this is helpful for somebody else ...

 

Tahnks,

Isbissen

Share this post


Link to post
Share on other sites

someone can help me about my problem? again not solved, i posted here, before

Apart from that it has something to do with images, I have no idea what the problem is.


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

Share this post


Link to post
Share on other sites

I´m having problem with the upload feature.

 

The coustomer can upload a file but it dosent show in the cart or order.

Share this post


Link to post
Share on other sites

If i use 1 option image no problem, but if i use 2 o more options image i have problem, in first option work good, in second option, i see first and secondo value, and so way, :-(

Share this post


Link to post
Share on other sites

If i use 1 option image no problem, but if i use 2 o more options image i have problem, in first option work good, in second option, i see first and secondo value, and so way, :-(

 

In the image part of file option_types.php try to replace all instances of [$product_info['products_id']] with [$products_options_name['products_options_id']] , so the options can be separated according to product_options_id. I think the file is putting all option choices together because of the common product_id

 

Backup first

Share this post


Link to post
Share on other sites

i tried it,solved problem with dropmenu, now i see correct value in correct menu, but again problem with images. i see always same images, i haved fix in option_types.php

 

$Real_Image_Name = $Option_Name .'_'. $Image_Name . ((OPTIONS_TYPE_IMAGELANG == ..... 

 

with

 

$Real_Image_Name = $ProdOpt_Name .'_'. $Image_Name . ((OPTIONS_TYPE_IMAGELANG == 'Yes')...... 

 

so i can use different images for different option.

 

i tried also with original files.

 

when i open the page, i see in preview default correct image, but when first option i change value, see images from second option :-( :(

Share this post


Link to post
Share on other sites

Hello people

 

I found a small issue connected to the attribute manager: When adding a text option (or textarea, or file) via the attribute manager the option value is set as CUSTOMER-INPUT and has a value id of 0. A second or a 3rd option of the same sort gets exactly the same options_values_id (0) in table products_attributes.

 

Thats not a problem if you don't want to set prices to this attributes. If you do (again via the attribute manager) then the problem is that the same product and the same option value will have a different price and thats something the system don't like: You will be either not able to set the second price, or the second price will be the same as the first one.

 

For now, the solution I give is to insert any value (text, number, whatever) when adding such an option, just for the reason to force a new option_value_id to be set, and it works fine

 

It would be nicer to have the CUSTOMER-INPUT value to be "unique" getting something like "CUSTOMER-INPUT-234", maybe using the options id? Since this options "sigle value options", this would make them unique. Lets think about

Share this post


Link to post
Share on other sites

I found a small issue connected to the attribute manager:

Update to my yesterdays post: Setting a option value to text (and file) options, in order to force a unique option value id to be set in table product attributes, is not a good idea. The value need to be '0' (thats the OPTIONS_VALUE_TEXT_ID as set in admin/includes/local/configure.php) so that shopping_cart.php etc can separate this options properly and display the text (or link to the file) that the customer typed in.

 

The issue still remain: While when updating the price for text options (if having more than 1) via the regular attributes page everything goes correctly, when doing the same via the attribute manager all options become the same price written into the database (table product_attributes)

 

I suspect that this happens, because the attribute manager does not respect the options id when updating the price while the regular attributes do

Share this post


Link to post
Share on other sites

The value need to be '0' (thats the OPTIONS_VALUE_TEXT_ID as set in admin/includes/local/configure.php) so that shopping_cart.php etc can separate this options properly and display the text (or link to the file) that the customer typed in.

 

The issue still remain

Hi MultiMixer,

 

Thinking about it, I believe I also was struggling with some AttributeManager problems during development.

Javascript is just not my cup of tea.

I even thought about changing everything to not use OPTION_VALUE_TEXT_ID at all, but as I see it, we can't do without that value...

And because we want to change a VERY integrated part of the code, there can be quite some complications.

Integrating the "CUSTOMER-INPUT" as it, is was already a headache.

I wish an experienced Attribute Manager user would help us out with this one...

Edited by Zappo

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

Share this post


Link to post
Share on other sites

And because we want to change a VERY integrated part of the code, there can be quite some complications.

 

Hi Zappo

 

Right now I'm at the stage where I found out following: When updating a product attribute (ie the price)

 

1) in products_attributes.php we have

 
tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set products_id = '" . (int)$products_id . "', options_id = '" . (int)$options_id . "', options_values_id = '" . (int)$values_id . "', options_values_price = '" . (float)tep_db_input($value_price) . "', price_prefix = '" . tep_db_input($price_prefix) . "', products_options_sort_order = '" . tep_db_input($value_order) . "'  where products_attributes_id = '" . (int)$attribute_id . "'");

the important part is

where products_attributes_id = '" . (int)$attribute_id . "'")

 

2) in file attributeManagerInstant.class.php we have for the same case

		
amDB::perform(TABLE_PRODUCTS_ATTRIBUTES,$data, 'update',"products_id='$this->intPID' and options_id='$optionId' and options_values_id='$optionValueId'");

No word about the attribute id.

 

At the other hand it doesn't look to be necessary in the text options case because the combination option_id and products_id makes the line unique. So I don't understand why it mix up when it is using the option_id to separate

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×