Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

DavidPotter

Archived
  • Posts

    14
  • Joined

  • Last visited

About DavidPotter

  • Birthday 02/10/1963

Profile Information

DavidPotter's Achievements

  1. I think I've been able to remove the upload file name from the product id. It requires changes to three files - includes\application_top.php, shopping_cart.php, and includes\classes\shopping_cart.php. If you're using WP.osc like I am, then you'll make changes to includes\modules\module16.php instead of the first shopping_cart.php file. Basically what you do is use the id from the row in the file_uploads table as the value for the file upload attribute. There's some extra work to do if the user selected a file from the drop-down list instead of uploading a new one. Then in the two shopping cart scripts you use that id to look up the file name from the file_uploads table. I'm still testing this and I don't have time to post the full solution at the moment, but I'm pretty pleased with the results. I'll try to post my solution soon.
  2. I made a typo in the code above. Change this: $products_Options .= '<small>- ' . $attr_value . ': <i>' . $image_link1 . $attr_value . $image_link2 . '</i>' . $Option_Price . '</small><br>'; to this: $products_Options .= '<small>- ' . $products[$i][$option]['products_options_name'] . ': <i>' . $image_link1 . $attr_value . $image_link2 . '</i>' . $Option_Price . '</small><br>'; Sorry about that.
  3. I modified how file attributes are displayed in the cart so that attributes that are images would be displayed as a thumbnail. Here's the code change. Change this (around line 170): 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 .= '<small>- ' . $products[$i][$option]['products_options_name'] . ': <i>' . $image_link1 . $products[$i][$option]['products_options_values_name'] . $image_link2 . '</i>' . $Option_Price . '</small><br>'; } to this: $imageDir = (tep_session_is_registered('customer_id')) ? UPL_DIR : TMP_DIR; 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 $image_link1 = ''; $image_link2 = ''; $attr_value = $products[$i][$option]['products_options_values_name']; $full_file_path = $imageDir . $attr_value; if (file_exists($full_file_path)) { $image_link1 = '<a href="' . $full_file_path . '" target="_blank">'; // If the file is an image that can be displayed by most browsers, display it as one in the cart. if (in_array(strtolower(substr($attr_value, strrpos($attr_value, '.')+1)), array('jpg', 'jpeg', 'gif', 'png', 'bmp'))) { $image_link2 = '<br/><div style="text-align: center;">' . tep_image($full_file_path, $attr_value, '', SMALL_IMAGE_HEIGHT) . '</div></a>'; } else { $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>- ' . $attr_value . ': <i>' . $image_link1 . $attr_value . $image_link2 . '</i>' . $Option_Price . '</small><br>'; } The key part is where it sets the $image_link2 variable. Let me know if you see any problems with this or make improvements to it. Note: Please forgive any code reformatting. It should be minor. I've been debugging and I needed to understand it better and long lines just drive me batty. The one noticeable line that looks very different but should be exactly the same is the one that sets the $Option_Price variable. Thanks, David
  4. Thanks :) I'll take a look at that and see what I come up with. I have to fix it, so I'll let you know when I'm done. By the way, I forgot to mention one other thing I had to do to fix my problem with the file not making it to the cart. I had to make sure that all the hidden fields were placed before the submit button, including the one for number_of_uploads. I don't know if that is due to being merged into WP.osC or something else I did, but I wanted to mention it. As for the presence of lightbox, that was added by WP.osC. Pretty cool, except when it isn't :blink:
  5. I'm running into a problem with the link for an item in the cart when there is an image file as one of the options. When the user clicks either the product name link or the product image link, the window goes dark and a spinner is displayed as if it is going to display an image, but it never does. I'm wondering if that has something to do with the product id having an image name in it (e.g. id{2}1{1}18{txt_5}foo.png). This strikes me as a Javascript effect, but I don't know enough about all the lightbox stuff, etc. or Javascript to know where to go with it. Can someone? Check it out at http://test.gameshirtz.com/shop/ Thanks, David
  6. I found the problem. Some of it was my own fault during the merge, but there was one bug in the original contribution code I downloaded. In shopping_cart.php around line 172, look for this: $imageDir = (tep_session_registered) ? UPL_DIR : TMP_DIR; Replace it with this: $imageDir = (tep_session_is_registered('customer_id')) ? UPL_DIR : TMP_DIR; Works like a charm. Oh, I should also add that I found a debugging solution. I'm using PHPeclipse with Xdebug. It's a pretty buggy solution, but it's better than no debugger at all.
  7. I've been testing this contribution on WP.osC along with the smtp auth contribution and I have it mostly working. The most important feature for me is the file uploader, although I really appreciate the attribute and option management as well as image options. Here's where I'm at: I've never been able to get it to upload the file. It just fails silently making me think it did something. For a while the customer's file name path was being displayed in the shopping cart, but now that's not working either. I integrated the AJAX downloader posted a few messages back, but that doesn't help or hurt. I've removed that change and I still can't get the file to upload or, now, even be recognized. I know it's something I broke when I integrated it, but could someone give me a pointer to where to look? In case it matters, here is what I'm building this on: Windows Server 2008 R2 PHP 5.3.0 MySQL 5.1.40 WP.osC 1.0 RC2 (built on osCommerce 2.2RC2a) Option Types V2.1.3 I'm used to being able to debug through my code (C, C++, C#, etc.) and with PHP I don't have a decent debugger, so I feel like I'm flying blind. Even putting echo statements in doesn't help me see what's going on because often they don't show up. Any help you can give me would be great. I've literally been up all night trying to solve this problem. If you want to see it, you can go to test.gameshirtz.com/shop. Thanks, David PS I should also say how much I appreciate the contribution and how well it has been supported. Thanks, Zappo, as well as everyone else who has been helping on this. It's very much appreciated.
  8. I was able to get this to work with a few simple changes. You need to change ajaximage.php and product_info.php. If you're using WP.osC, you'll change ajaximage.php, head14.php, and module14.php. ajaximage.php Add the products_options_values_thumbnail field to the options query by changing this: $options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_thumbnail from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pov.products_options_values_id = '" .$id . "'"); to this: $options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_thumbnail, pov.products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pov.products_options_values_id = '" .$id . "'"); Next, copy the code from product_info.php (or module14.php if you're using WP.osC) that displays the image to ajaximage.php and modify it to display the option image instead. Here is what works for me. Replace this: echo "<a href='" . tep_href_link(FILENAME_OPTIONS_IMAGES_POPUP, "oID=" . $id) ."' target='blank'><img src=./images/options/".$options['products_options_values_thumbnail']." height=".OPTIONS_IMAGES_HEIGHT." width=".OPTIONS_IMAGES_WIDTH."></a>"; with this: $image_file = $options['products_options_values_thumbnail']; $image_title = $options['products_options_values_name']; echo '<div id="ngg-image-11111" class="ngg-gallery-thumbnail-box" ><div class="ngg-gallery-thumbnail" >'."\n"; echo '<a href="' . tep_href_link(DIR_WS_IMAGES . 'options/' . $image_file) . '" title="'.$image_title.'" rel="lightbox">' . tep_image(DIR_WS_IMAGES . 'options/' . $image_file, $image_title, '', 2*SMALL_IMAGE_HEIGHT, 'class="Thumb"').'</a>'; echo '</div></div>'. "\n"; product_info.php / head14.php Change the handleResponseSearch() function you added to the head section of product_info.php (or module14.php if you're using WP.osC) when you installed the add-on. Everywhere you see "zoek_resultaten" replace it with the id of the image div (ngg-image-1111 for me). I'm not sure what the div ID is for stock osCommerce, so you might have to root around a little bit. product_info.php / module14.php Remove the following code that you added as part of installing the add-on: if (OPTIONS_AS_IMAGES_ENABLED == 'true') { $page_content .= '<div id="zoek_resultaten"></div>'; } Issues with this solution There are (at least) two issues with this solution. It no longer uses the stored sizes for option images. This may not be that bad, though, since you're replacing the product image. The image transition is not very smooth. I'd love to fix this one. I'd be interested in hearing how others accomplish this to better results.
  9. How do I get the option image to be displayed when I enter the page? I'm only able to get an option image when I change the selection? Thanks, David
  10. I had trouble executing sql script. It was trying to set the configuration_id for multiple entries to 0. The solution is to specify all the column names and to not specify anything for the configuration_id column. Here is the updated script that solves the problem: ALTER TABLE `products_options_values` ADD `products_options_values_thumbnail` VARCHAR(60) NOT NULL ; INSERT INTO configuration_group VALUES (735, 'Options as Images', 'Configuration for the Options as Images Function', 20, 1); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Use Images for Product Options?', 'OPTIONS_AS_IMAGES_ENABLED', 'true', 'Do you wish to enable images for options?', 735, 1, '2003-08-18 22:19:45', '0000-00-00 00:00:00', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),'); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Options as Images - Image Width', 'OPTIONS_IMAGES_WIDTH', '80', 'Set width of option value images', 735, 2, '2003-08-20 12:55:16', '0000-00-00 00:00:00', NULL, NULL); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Options as Images - Image Height', 'OPTIONS_IMAGES_HEIGHT', '100', 'Options Images Height', 735, 3, '2003-08-20 12:55:22', '0000-00-00 00:00:00', NULL, NULL); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Click to Enlarge Function', 'OPTIONS_IMAGES_CLICK_ENLARGE', 'true', 'Do you wish to enable the Click to Enlarge Function?', 735, 4, '2003-08-21 12:59:58', '0000-00-00 00:00:00', NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),'); ALTER TABLE `products_options` ADD `products_options_images_enabled` VARCHAR(5) DEFAULT 'false' NOT NULL ; Hopefully this will help someone else as well.
×
×
  • Create New...