Jump to content
Latest News: (loading..)
Zappo

[Contribution] Option Types v2

Recommended Posts

Hi,

This is an attempt to give back to the community with regard to the Option Types coptribution

I have a successful OSC site running 2.2m.s2 with Option Types 2.1.3 running and extensively modified.

Lots of folks on the OSC Forum have advised me to upgrade to a newer version of OSC for better security and to avoid site failure when PHP is upgraded. I was unsure about this as Option Types is a “must have” contribution for my site.

I was advised by the community not to try to upgrade 2,2ms2 but to staet with a fresh copy of OSC. This I have done using OSC 2.3.1 as Option Types it has been modified by Dunweb to run on OSC 2.3.1

 

I installed OSC 2.3.1 in a clean directory on a spare domain name, this went with a hitch.

I then installed Option Types 2.3.1 by uploading all the “drop-on-top files” with the exception of

Includes/configure and

Admin/includes/configure

Which have to be modified for the DB variables.

Installing Option Types 2.3.1 was successful as far as I could tell at this stage

 

I then set about importing the data from my existing 2.2ms2 live site

I did this by making a “MySQL dump of the database which provides a long SQL script which can be used to modify the OSC 2.3.1 database.

I used HeidiSQL for this, but I am sure you can use PHPMyAdmin or Putty/MySQL

I imported the new data table by table

Categories, categories_description, products, products_description, products_tO_categories, etc, it is fairly obvious what tables are necessaro to get your products on to the new site

Everything went well and the products from my old site displayed on the new site as expected.

 

First problem: all option types defaulted to “select” (drop down menus). This turned out to be missing data in includes/configure.php. Option types needs to have the option types defined, select, radio, text, textarea, etc. Here is the code which needs to appear in includes/configure.php:

define('OPTIONS_TYPE_SELECT', 0);

define('OPTIONS_TYPE_TEXT', 1);

define('OPTIONS_TYPE_TEXTAREA', 2);

define('OPTIONS_TYPE_RADIO', 3);

define('OPTIONS_TYPE_CHECKBOX', 4);

define('OPTIONS_TYPE_FILE', 5);

define('OPTIONS_TYPE_IMAGE', 6);

define('TEXT_PREFIX', 'txt_');

define('UPLOAD_PREFIX', 'upload_');

define('TEXT_UPLOAD_NAME', 'CUSTOMER-INPUT');

define('OPTIONS_VALUE_TEXT_ID', 0);

this can be place anywhere before the ?> at the end of the file

 

Second problem: any product which featured a “textarea” or “text” option, when you click “add to cart” failed to put anything in the shopping cart. Don’t know the background to this problem but the cure is to overwrite includes/classes/shopping_cart.php with the same file from Option types 2.1.3 the original Zappo contribution.

 

I still have to test the “checkout” and payment (Paypal) and other features on the new site, and change the appearance.

 

At a later date with attempt to upgrade to OSC 2.3.4 or whatever is the latest.

 

Hope this info is of help to others. Thanks to Dunweb for Option Types 2.3.1.

Share this post


Link to post
Share on other sites

@@doon1947

 

Glad to hear you are getting there and the confirmation that with a bit of work it functions on 2.3...

 

Thank you for your update !

 

Regards

Joli

Edited by joli1811

To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Are you using the Paypal IPN module, if so it will produce the CUSTOMER-INPUT error

---------------

I'm using Option Types 2.1.3 and solved the problem as follows:

 

Integrating with other Contributions (Paypal IPN)

from Paypal IPN v2.3.3 install_guide_READ_ME.html

 

Note: Rule of thumb - whenever you make ANY change to checkout_process.php you MUST manually merge the change into paypal_ipn.php and ipn.php

 

The PayPal IPN works different from other payment modules and bypasses the checkout_process file. Which means that any contribution which modifies the checkout_process.php file will require some manual coding TLC in paypal_ipn.php and ipn.php.

 

From version 1.3 of this module, the PayPal IPN Payment Module is compatible with the Register Globals Patch v1.4 - you do not need to make any modifications for this.

 

Version 2.0 introduces a new code base so any fixes posted for versions 1.x probably won't work without modification.

---------------------

I had to modify /includes/modules/payment/paypal_ipn.php

At line 249 (a single line change only)

to match change in checkout_process.php line 230 which was changed by Option Types 2.1.3 contribution.

 

as follows:

 

$sql_data_array = array('orders_id' => $insert_id,

'orders_products_id' => $order_products_id,

'products_options' => $attributes_values['products_options_name'],

// BOF - Zappo - Option Types v2 - ONE LINE - Update insert query. changed to use value from $order->products.

'products_options_values' => $order->products[$i]['attributes'][$j]['value'],

// EOF change added by ADM

'options_values_price' => $attributes_values['options_values_price'],

'price_prefix' => $attributes_values['price_prefix']);

 

for those still struggling with this you can change line ~427 in the /includes/modules/payment/paypal_ipn.php

from

$parameters['os' . $j . '_' . $item] = $attributes_values['products_options_values_name'];

 

to

$parameters['os' . $j . '_' . $item] =  tep_decode_specialchars($order->products[$i]['attributes'][$j]['value']);

Share this post


Link to post
Share on other sites

HI,

 

I have been strggling to get this contribution working.

My two issues are the add to cart button does not work when there is and attribute on that product and

when I went to check on the attributes, I recieve the error below.

 

Fatal error: Call to undefined function translate_type_to_name() in /home/mobiles7/public_html/MST2011!/products_attributes.php on line 442

 

I came up with one thing that said it's because the sessions are set right in php.ini

I don't even know where that is or if I have access to it.

 

the site is

mobilespraytechnology.com

any help would be appreciated, even if it's just pointing me in the right direction. Typically I can work my way through the issues, but this one has me stumped for whatever reason.

Thanks in advance

oh

oscommere v2.2 rc2

I used Option Types 2.3.1

 

Regards,

Deb

Share this post


Link to post
Share on other sites

@@dillig Generaly speaking, you can't use an addon meant for a 2.3 shop in an RC2 shop. It can be done but you would need to make some edits not usually mentioned in the install file. I haven't installed this addon using the 2.3 version so perhaps there are instructions for adding it to a non-2.3 shop. But just looking at the introduction for it, it seems a mess has been made since they decided for you that other addons should be installed (always a mistake). And since it has not been updated in two years and then only once, I would stay away from that version (just my opinion). You may want to look at this version instead.

Share this post


Link to post
Share on other sites

Anyone wanting to test a beta version for 2.3.3.4 are welcome to the drop on top files

 

Option types v2 plus attribute manager working with all functions and giving no errors

 

On the to do list is write the install instruction :wacko: , extra stylesheet to give a more modern look, jquery cart update ( if possible) and adding choice for options price to be calculated per item (once) or per unit

 

PM for files if you want to test.

 

Regards

Joli


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites
I was wondering if anyone had experience with using multiple image selectors on a page.

 

I am working to rebuild this page (http://www.canvasgnome.com/3-4-standard-canvas-wrap/) in OSCommerce. It's my brother's site. We are working to move the site to a new cart to allow more functionality.

 

As you can see, we have 2 sets of image options. I've made some changes to the code, adding js, changing the structure. But I'm stuck on how to separate the two selectors. The first one works fine. The second one has all of the options from both.

 

This is my objective {

 

First Set:

Option A:1

Option A:2

Option A:3

 

Second set:

Option B:1

Option B:2

}

 

This is what I'm getting {

First Set:

Option A:1

Option A:2

Option A:3

 

Second Set:

Option A:1

Option A:2

Option A:3

Option B:1 //javascript gives "undefined"

Option B:2 //javascript gives "undefined"

}

 

The query fetches the correct information, without the extra options.

 

I think the problem lies in one (or several) of these vars:

$ImageText

$ImageDropdown

$product_options

$First_ImageText

 

I've tried unset() on the variables after the case: statement, as well as emptying them by redeclaring the arrays, and setting the keys to '' since they are appended to in the script rather than reinitialized.

 

Unsetting them makes the first image reference (on page load) correct, but makes the selector for the first set not work properly (it tries to grab the images from the second set). It also does not fix the <select> <options>. They remain as above.

 

The option comes into the cart as an eye icon with a link to the images/uploads directory, rather than an option:value pair.

 

I have already made a variety of changes. I had to change the IDs to classes to make the js work properly and make a number of changes there. I am just stuck on getting the second selector to have the correct options.

 

I think I can work around it by rewriting that part of page with js after loading. But I'd rather have the script working. It seems like it should be a simple fix, but I'm not sure why I can't find the bug.

 

Sorry this is so long; I wanted to give you a full description.

 

If anyone has any ideas, I'd appreciate it.

Share this post


Link to post
Share on other sites

you are not 100% clear.

 

i see:

 

 First option = size of the canvas (does it work/not works?)

 Second option = Choose Edge Options (does it work/not works?)

 Third option =  Choose Canvas Style (does it work/not works?)

 

Assuming comments and file upload works.

 

To give anyone an idea it would be best to show a working part, for example when assume First option works , paste the code of how you pass the selected data.

So we now can see how you did it for a working part.

When we see that, we could might guide you to get the failing selected option(s).

 

Which one of the others does not work?

Edited by wHiTeHaT

Share this post


Link to post
Share on other sites

@@wHiTeHaT

 

Thanks for responding.

 

Please note the link I provided is not currently in OSC. I am building that site in OSC so that I can add more features.

 

All options work except Choose Canvas Style (option 3). Passing the data works well, the problem is with what is shown on the page.

 

The problem is that option three shows all of the choices from option 2 and option 3. It should have only 3 options, instead it has 7 options to choose from.

 

I hope that makes it more clear!

 

Thank you for your help.

Josiah

Share this post


Link to post
Share on other sites

File upload for OsC 2.3

 

The file upload option doesn't work in all cases with the actual code of the Add-On. I found a solution to get it to work with OsC 2.3 and would like to share it.

 

Problem:

When a file is uploaded by a guest it will be stored in the images/temp/directory and identified by its filename and the session ID.

When the guest logs into his account, the uploaded file should be moved to the images/upload/ directory and the customer ID added in the database to identify the file.

Now the original code uses the session ID to find the file in the temp folder and do this move. This works in OSC 2.2 due to the session ID keeps the same when the guest logs into his account.

Meanwhile in OsC 2.3 the session ID is changed when logging in for security reasons , I suppose. In consecuence of this, the file can't be found due to the actual session ID, after the login, is different from the stored session ID in the file upload table.

So I added an additional session parameter called "guestSessionID" which is stored when a guest adds a product with uploaded file to the shopping cart:

 

In catalog/includes/application_top.php

 

within the modified code in the shopping-cart actions, case 'add_product', find:

                                      //EOF - Zappo - Option Types v2 - Set Upload directory (Registered customers in Uploads, other in Temporary folder)
                                      if ($products_options_file->parse(TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i])) {
                                        if (tep_session_is_registered('customer_id')) {
                                          tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name, date) values('" . tep_session_id() . "', '" . $customer_id . "', '" . tep_db_input($products_options_file->filename) . "', '" . date("d-m-y") . "')");
                                        } else {
                                          tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name, date) values('" . tep_session_id() . "', '" . tep_db_input($products_options_file->filename) . "', '" . date("d-m-y") . "')");
                                       }

And Replace With:

                                      //EOF - Zappo - Option Types v2 - Set Upload directory (Registered customers in Uploads, other in Temporary folder)
                                      if ($products_options_file->parse(TEXT_PREFIX . $HTTP_POST_VARS[UPLOAD_PREFIX . $i])) {
                                        if (tep_session_is_registered('customer_id')) {
                                          tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name, date) values('" . tep_session_id() . "', '" . $customer_id . "', '" . tep_db_input($products_options_file->filename) . "', '" . date("d-m-y") . "')");
                                        } else {
                                          tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name, date) values('" . tep_session_id() . "', '" . tep_db_input($products_options_file->filename) . "', '" . date("d-m-y") . "')");
                                          // @raiwa added 2 lines for guest file upload compatibility with OsC 2.3.
                                          $guestSessionID = tep_session_id();
                                          if (!tep_session_is_registered('guestSessionID')) tep_session_register('guestSessionID');
                                        }

Then we need to change the code in: catalog/includes/classes/shopping_cart.php where the uploaded file is moved from the temp to the upload directory after customer login:

 

In: catalog/includes/classes/shopping_cart.php we add the $guestSessionID to globals in the restore_contents() function

 

Find:

    function restore_contents() {
      global $customer_id;

And Replace with:

    function restore_contents() {
      global $customer_id, $guestSessionID; // @raiwa $guestSessionID added for guest file upload compatibility with OsC 2.3.

Then we change in the same function "tep_session_id()" to "$guestSessionID". The stored session parameter keeps the same and we can find the file:

 

Find:

//BOF - Zappo - Option Types v2 - Update query to include attribute value && Check for Uploads from customer and copy to Upload dir
              $uploads_query = tep_db_query("select files_uploaded_name from " . TABLE_FILES_UPLOADED . " where sesskey = '" . tep_session_id() . "'");
              while ($uploads_array = tep_db_fetch_array($uploads_query)) {
                if (file_exists(TMP_DIR . $uploads_array['files_uploaded_name'])) { // Customer upload found in TMP dir --> Copy to Upload Dir
                  @rename(TMP_DIR . $uploads_array['files_uploaded_name'], UPL_DIR . $uploads_array['files_uploaded_name']);
                  // Set Customer_ID for the files that are found
                  tep_db_query("update " . TABLE_FILES_UPLOADED . " set customers_id = '" . (int)$customer_id . "' where sesskey = '" . tep_session_id() . "' and files_uploaded_name = '" . $uploads_array['files_uploaded_name'] . "'");

And Replace With:

//BOF - Zappo - Option Types v2 - Update query to include attribute value && Check for Uploads from customer and copy to Upload dir
// @raiwa tep_session_id() changed to $guestSessionID for guest file upload compatibility with OsC 2.3.
              $uploads_query = tep_db_query("select files_uploaded_name from " . TABLE_FILES_UPLOADED . " where sesskey = '" . $guestSessionID . "'");
              while ($uploads_array = tep_db_fetch_array($uploads_query)) {
                if (file_exists(TMP_DIR . $uploads_array['files_uploaded_name'])) { // Customer upload found in TMP dir --> Copy to Upload Dir
                  @rename(TMP_DIR . $uploads_array['files_uploaded_name'], UPL_DIR . $uploads_array['files_uploaded_name']);
                  // Set Customer_ID for the files that are found
                  // @raiwa tep_session_id() changed to $guestSessionID for guest file upload compatibility with OsC 2.3.
                  tep_db_query("update " . TABLE_FILES_UPLOADED . " set customers_id = '" . (int)$customer_id . "' where sesskey = '" . $guestSessionID . "' and files_uploaded_name = '" . $uploads_array['files_uploaded_name'] . "'");

That's it

 

 

Another small bug fix for all versions in: catalog/shopping_cart.php

 

Find:

//BOF - Zappo - Option Types v2 - Rearanged Product(s) cart-listing, added Options Column, Upload preview link, and added Prices to Attributes
          $imageDir = (tep_session_registered) ? UPL_DIR : TMP_DIR;

And Replace With:

//BOF - Zappo - Option Types v2 - Rearanged Product(s) cart-listing, added Options Column, Upload preview link, and added Prices to Attributes
          $imageDir = (tep_session_is_registered('customer_id'))? UPL_DIR : TMP_DIR;

The preview for an uploaded image didn't show for guests due to the directory switch to the temp dir didn't work.

 

Hope this helps

 

Kind regards

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

has anyone succesfully installed option types v2 on osc 2.3.4? i am new to this and i have problems with the installation. thanks!

Share this post


Link to post
Share on other sites

has anyone succesfully installed option types v2 on osc 2.3.4? i am new to this and i have problems with the installation. thanks!

@@seb999,

 

It should work with the above mentioned modifications for file upload. However the documantation is not the best and it's not easy to install. If you have no experience it may be better to ask someone for help.

Share this post


Link to post
Share on other sites

I have a problem in my 2.3.4 store when entering text in to a text field on the product info page.

 

After many hours modifying the 2012 v2.3.1 version I have got it working as far as being able to input text in to the text box on the product_info page. When it is put in to the buyers cart the text is missing from the shopping cart page and any attribute price is not added. When viewing the page source there is a hidden field as I would expect and the text is present in that hidden field. I have uploaded the includes -> classes -> shopping_cart.php file as advised in a previous post.

 

I can paste any copies of my priduct_info or shopping_cart files if needed but haven't done it yet to save pasting lots of unecessary code.

 

any ideas greatly received.

Andy

Share this post


Link to post
Share on other sites

still looking for help with getting this excellent add on to work on my 2.3.4 store. A text area product attribute will not display in my shopping cart and the attribute price is not added to the item cost.

Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites

This is one of the Addons that is very challenging to install and that only because there is no clear and good install instructions for 2.3.4. Many have tried to install this and have failed and eventually given up or hired someone to fix it.

Sadly there was not one person that got it running and shared an install manual or any kind of .zip package till today except for jolie1811 which unfortunately past away. (R.I.P. John :( ).

He mentioned in post #932 that he has a package ready and would share it if you PM him. I was going through my older USB sticks and I found that package! Before John past away he tried to get it to work and was fine tuning it for some customers website. Burt, me and few others I think helped him bug hunting and getting the final pieces together.

This is a very difficult to install Addon and not recommended for beginners. It also requires you to change a lot core code which is something osC is trying to get away from but to change the options function core code must be amended. (here again, if YOU know a better way...please share.)

 

The past few days I was installing and testing his package with osC 2.3.4 and I think I got everything ready now. I updated the install manual and added Raiwas File Upload fix.

I think John would have wanted this to be shared. Unfortunately I cannot upload it here because of the 300KB file limit so if anyone wants this PM me. If my PM box should be full and you can't reach me just post here in this thread.

Edited by Tsimi

When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

Unfortunately I cannot upload it here because of the 300KB file limit so if anyone wants this PM me. If my PM box should be full and you can't reach me just post here in this thread.

 

Why don't you upload it to the add ons area?

Share this post


Link to post
Share on other sites

I have a problem with product options being added twice to the database when order is placed and also showing twice in confirmation email, order details, invoices, etc. like this:

Product Name
- Options: Option #1 (+$1.50)
- Options: Option #1 (+$1.50)

I can't figure out what can be a problem here. Any help will be appreciated.

Thanks.

Share this post


Link to post
Share on other sites

@@Irin

 

What version of osCommerce are you using?

Which version of Option Types did you install?

Edited by Tsimi

When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

@@Irin

 

Try to download the latest version of Option Types v2 (http://addons.oscommerce.com/info/6818) which includes an install manual for osC 2.3.4.

Take a look at it and compare it with your files see if the changes are the same. Version 2.3.1 was not perfectly working on a osC 2.3.4 shop.

application_top.php is maybe a good place to start.


When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

Option Types BS now available!

 

http://addons.oscommerce.com/info/9367

 

NOTE: This version is not compatible with normal osC 2.3.4!


When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

Share this post


Link to post
Share on other sites

I compared my files with the ones from the contribution, and they seem to be very similar. I have no idea why product options double and where to look for a solution.

Share this post


Link to post
Share on other sites

...and they seem to be very similar...

 

very similar is not same. Why don't you use pastebin.com and show us for starters your application_top.php file. There are many files that need to be changed for this Addon to run and to bug hunt something like you have is not an easy task without looking at the code at least or better touching your files.

 

P.S. When you use pastebin make sure it is setup to "unlisted", "no expire date" and coding language PHP.

Once you uploaded your code it will provide you with an URL to that code, that URL you post here.

Edited by Tsimi

When you ask for help/support:

  • Always state your osCommerce version
  • If possible, list up installed add-ons
  • 3rd party templates are not supported in the forum

Latest osC: osCommerce CE (Community Edition aka. v2.3.4.1 Frozen)

 

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

×