Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Option Types v2


Zappo

Recommended Posts

RE: Message Stack Not Working

 

Hi.

 

I installed this contribution around 6 months ago and it has worked like a charm so far for what I have needed - its a fantastic contribution.

 

However now I want to use the "upload image" function so that customers can upload image files for engraving. Everything seems to work fine - the images upload OK to the image upload directory, but the problem is that none of the message stack errors (or successes) show up at all, so that from the customer's point of view, it is a bit confusing as to whether the image has uploaded or not.

 

The main message I need to show is the "SUCCESS_FILE_SAVED_SUCCESSFULLY" one, preferably on the shopping cart once the image is uploaded.

 

I have searched high and low and been through the code from scratch to check that I've installed it correctly and it seems OK - I just can't work out why none of the messagestack messages show. Maybe there is something missing from my "header.php" or "application_top.php" file but I can't work out what.

 

I hope someone can help!

 

Thanks

Link to comment
Share on other sites

Hello,

I just tried to install "Option Type" of osc 2.3 and I come to ask your help here because I'm stuck on two issues:

After edit / catalog / shopping_cart.php I can add a product to the cart but if I view the cart again the image of the product is no longer displayed

The second problem is that the "remove" button does not work at all, the quantity of products in the basket does not change, for account "update" work properly.

This /catalog/shopping_cart.php

 

  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
    reset($products[$i]['attributes']);
    while (list($option, $value) = each($products[$i]['attributes'])) {
// 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;
	  $image_link1 = '';
	  $image_link2 = '';
	  if (file_exists($imageDir.$products[$i][$option]['products_options_values_name'])) {
	    $image_link1 = '<a href="' . $imageDir . $products[$i][$option]['products_options_values_name'] . '" target="_blank">';
	    $image_link2 = tep_image(DIR_WS_ICONS . 'view.gif') . '</a>';
	  }
	  $Option_Price = ($products[$i][$option]['options_values_price'] != '0') ? ' - (' . $products[$i][$option]['price_prefix'] . $currencies->display_price($products[$i][$option]['options_values_price'], tep_get_tax_rate($products[$i]['tax_class_id'])) . ')' : '';
   $products_Options .= '<small>- ' . $products[$i][$option]['products_options_name'] . ': <i>' . $image_link1 . $products[$i][$option]['products_options_values_name'] . $image_link2 . '</i>' . $Option_Price . '</small><br>';
    }
  }

  $products_Options .= '<br /><br />' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) .' '. tep_draw_button(IMAGE_BUTTON_UPDATE, 'refresh') . ' '. tep_draw_button(IMAGE_BUTTON_DELETE, 'trash',tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id'] . '&action=remove_product'));

  $products_Options .= '    </td>' .
				    '  </tr>' .
				    '</table>';
  echo '	    <td valign="top">' . $products_Options . '</td>' .
	   '	    <td align="right" valign="top"><strong>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</strong></td>' .
	   '	  </tr>';
   }

Thanks

Link to comment
Share on other sites

  • 3 weeks later...

did anyone ever resolve the issue with not being able to add products with text options to the shopping cart for version 2.3.1? if so would be really grateful to know how you fixed it.

 

For the life of me I just cannot understand why it wont add it.

 

I have tested it, with select options it adds ok, but if I change those to txt it doesnt.

Link to comment
Share on other sites

I did get the shopping cart to work with the update/remove etc, the one I installed on the 2.3.1 didnt have that but I used the drop on top then modded it to layout how I wanted.

 

<?php
/*
 $Id$
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2010 osCommerce
 Released under the GNU General Public License
*/
 require("includes/application_top.php");
 if ($cart->count_contents() > 0) {
   include(DIR_WS_CLASSES . 'payment.php');
   $payment_modules = new payment;
 }
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);
 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));
 require(DIR_WS_INCLUDES . 'template_top.php');
?>
<h1><?php echo HEADING_TITLE; ?></h1>
<?php
 if ($cart->count_contents() > 0) {
?>
<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?>
<div class="contentContainer">
 <h2><?php echo TABLE_HEADING_PRODUCTS; ?></h2>
 <div class="contentText">
<?php
   $info_box_contents = array();

   $info_box_contents[0][] = array('params' => 'class="productListing-heading"',
							    'text' => TABLE_HEADING_PRODUCTS);
//BOF - Zappo - Option Types v2 - Added Options Column
   $info_box_contents[0][] = array('params' => 'class="productListing-heading"',
							    'text' => TABLE_HEADING_OPTIONS);
//EOF - Zappo - Option Types v2 - Added Options Column
   $info_box_contents[0][] = array('align' => 'center',
							    'params' => 'class="productListing-heading"',
							    'text' => TABLE_HEADING_QUANTITY);
$info_box_contents[0][] = array('align' => 'center',
							    'params' => 'class="productListing-heading"',
							    'text' => TABLE_HEADING_REMOVE);
   $info_box_contents[0][] = array('align' => 'right',
							    'params' => 'class="productListing-heading"',
							    'text' => TABLE_HEADING_TOTAL);
   $any_out_of_stock = 0;
   $products = $cart->get_products();
   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// Push all attributes information in an array
  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
    while (list($option, $value) = each($products[$i]['attributes'])) {
//BOF - Zappo - Option Types v2 - (Hidden field moved below)
	  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
								  from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
								  where pa.products_id = '" . (int)$products[$i]['id'] . "'
								   and pa.options_id = '" . (int)$option . "'
								   and pa.options_id = popt.products_options_id
								   and pa.options_values_id = '" . (int)$value . "'
								   and pa.options_values_id = poval.products_options_values_id
								   and popt.language_id = '" . (int)$languages_id . "'
								   and poval.language_id = '" . (int)$languages_id . "'");
	  $attributes_values = tep_db_fetch_array($attributes);
	  // - Zappo - Option Types v2 - If attrib is Text, assign to $attr_value temporarily (Here's that hidden field)
	  if ($value == OPTIONS_VALUE_TEXT_ID) {
	    echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']', $products[$i]['attributes_values'][$option]);
	    $attr_value = $products[$i]['attributes_values'][$option];
	  } else {
	    echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
	    $attr_value = $attributes_values['products_options_values_name'];
	  }
	  $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
	  $products[$i][$option]['options_values_id'] = $value;
	  $products[$i][$option]['products_options_values_name'] = $attr_value ;
//EOF - Zappo - Option Types v2 - (Line above Assigns $attr_value)
	  $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
	  $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
    }
  }
   }
   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
  if (($i/2) == floor($i/2)) {
    $info_box_contents[] = array('params' => 'class="productListing-even"');
  } else {
    $info_box_contents[] = array('params' => 'class="productListing-odd"');
  }
  $cur_row = sizeof($info_box_contents) - 1;
//BOF - Zappo - Option Types v2 - Rearanged Product(s) cart-listing, and added Options Column
// Rearanged products_name listing, and placed AFTER the Stock-Check (For displaying stock check next to Prod. Name
/*	  $products_name = '<table border="0" cellspacing="0" cellpadding="0">' .
				   '  <tr>' .
				   '    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
				   '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
*/
//EOF - Zappo - Option Types v2 - Rearanged Product(s) cart-listing, and added Options Column
  if (STOCK_CHECK == 'true') {
    $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);
    if (tep_not_null($stock_check)) {
	  $any_out_of_stock = 1;
//BOF - Zappo - Option Types v2 - Changed $stock_check to also be used when item is in Stock...
    }
  } else {
    $stock_check = '';
//EOF - Zappo - Option Types v2 - Changed $stock_check to also be used when item is in Stock...
  }
//BOF - Zappo - Option Types v2 - Rearanged Product(s) cart-listing, and added Options Column
  $products_name = '<table border="0" cellspacing="0" cellpadding="0">' .
				   '  <tr>' .
				   '    <td class="productListing-data" align="left" ><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b>' . $stock_check . '</a></td>' .
				   '  </tr>' .
				   '  <tr>' .
				   '    <td class="productListing-data" align="left"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
				   '  </tr>' .
				   '</table>';
  $products_Options = '<table border="0" cellspacing="0" cellpadding="0">' .
				   '  <tr>' .
				   '    <td class="productListing-data" >';
//EOF - Zappo - Option Types v2 - Rearanged Product(s) cart-listing, and added Options Column
  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
    reset($products[$i]['attributes']);
    while (list($option, $value) = each($products[$i]['attributes'])) {
//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;
	  //$image_link1 = '';
	 // $image_link2 = '';
	  //if (file_exists($imageDir.$products[$i][$option]['products_options_values_name'])) {
	   // $image_link1 = '<a href="' . $imageDir . $products[$i][$option]['products_options_values_name'] . '" target="_blank">';
	   // $image_link2 = tep_image(DIR_WS_ICONS . 'view.gif') . '</a>';
	 // }
	  $Option_Price = ($products[$i][$option]['options_values_price'] != '0') ? ' - (' . $products[$i][$option]['price_prefix'] . $currencies->display_price($products[$i][$option]['options_values_price'], tep_get_tax_rate($products[$i]['tax_class_id'])) . ')' : '';
	  $products_Options .= '<special>- ' . $products[$i][$option]['products_options_name'] . ': <i>' . $image_link1 . $products[$i][$option]['products_options_values_name'] . $image_link2 . '</i>' . $Option_Price . '</special><br>';
    }
  }
  $products_Options .= '    </td>' .
				    '  </tr>' .
				    '</table>';
  $info_box_contents[$cur_row][] = array('params' => 'class="productListing-data"',
										 'text' => $products_name);
  $info_box_contents[$cur_row][] = array('align' => 'left',
		  'params' => 'class="productListing-data"',
										 'text' => $products_Options);
//EOF - Zappo - Option Types v2 - Rearanged Product(s) cart-listing, added Options Column, Upload preview link, and added Prices to Attributes

  $info_box_contents[$cur_row][] = array('align' => 'center',
										 'params' => 'class="productListing-data" valign="top"',
										 'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

  $info_box_contents[$cur_row][] = array('align' => 'center',
										 'params' => 'class="productListing-data" valign="top"',
										 'text' => tep_draw_button(IMAGE_BUTTON_UPDATE, 'refresh') . '<br/>or<br/>' .
tep_draw_button(IMAGE_BUTTON_REMOVE, 'trash', tep_href_link(FILENAME_SHOPPING_CART, 'products_id=' . $products[$i]['id'] . '&action=remove_product'))
);
  $info_box_contents[$cur_row][] = array('align' => 'right',
										 'params' => 'class="productListing-data" valign="top"',
										 'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>');
   }
   new productListingBox($info_box_contents);
?>
   </table>
   <p align="right"><strong><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></strong></p>
<?php
   if ($any_out_of_stock == 1) {
  if (STOCK_ALLOW_CHECKOUT == 'true') {
?>
   <p class="stockWarning" align="center"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></p>
<?php
  } else {
?>
   <p class="stockWarning" align="center"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></p>
<?php
  }
   }
?>
 </div>
 <div class="buttonSet">
   <span class="buttonAction"><?php echo tep_draw_button(IMAGE_BUTTON_CHECKOUT, 'triangle-1-e', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'), 'primary'); ?></span>
 </div>
<?php
   $initialize_checkout_methods = $payment_modules->checkout_initialization_method();
   if (!empty($initialize_checkout_methods)) {
?>
 <p align="right" style="clear: both; padding: 15px 50px 0 0;"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></p>
<?php
  reset($initialize_checkout_methods);
  while (list(, $value) = each($initialize_checkout_methods)) {
?>
 <p align="right"><?php echo $value; ?></p>
<?php
  }
   }
?>
</div>
</form>
<?php
 } else {
?>
<div class="contentContainer">
 <div class="contentText">
   <?php echo TEXT_CART_EMPTY; ?>
   <p align="right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?></p>
 </div>
</div>
<?php
 }
 require(DIR_WS_INCLUDES . 'template_bottom.php');
 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
  • 1 month later...

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.

Link to comment
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.

 

Link to comment
Share on other sites

  • 1 month later...

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']);

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...

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

Link to comment
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.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
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.

 

Link to comment
Share on other sites

  • 4 weeks later...
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.

Link to comment
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

Link to comment
Share on other sites

  • 2 months later...

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
Link to comment
Share on other sites

  • 5 months later...

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.

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

  • 2 weeks later...
  • 6 months later...

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