Latest News: (loading..)

zaaephod

Members
  • Content count

    15
  • Joined

  • Last visited

About zaaephod

Profile Information

  • Real Name
    zaaephod
  1. Hello all :) I've been working on a validation script for this addon. I've got it working perfectly using the script in the first code window below. Life would have been much easier had I been able to actually debug javascript instead of guessing >_< Anyway, the code below works, but I wanted to change it around so that instead of the alert coming up once for every unselected option button group, one alert would come up listing all of the errors at once. The code in the second code window has some preliminary testing code to see how things would work. My plan was to add text to my alertvar variable each time an error occurred, then at the end of the function, display the alert box with all changes needed. The problem is, for some reason, the code at the end of the function never triggers. if(errorvar==1){ alert(alertvar); return false; } If I move this above the final closing tag from the where statement, it triggers just fine, but of course it happens several times because of the loop. Why won't that code trigger if it's after the <?php } ?> at the end? Is it because the variable is losing its value when it shifts to php mode for the closing bracket? Thanks for looking, and Zappo, thanks for the contribution, it laid the groundwork for some very complex option setups. <script language="javascript"><!-- function validate_me(myform) { <?php // jeff added this stuff for radio button validation $products_verification_query = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " po where po.products_options_type='3'"); // loop through each option type that has radio buttons while ($products_verification_array = tep_db_fetch_array($products_verification_query)) { ?> myOption = -1; // loop through each element of the radio set for (i=cart_quantity.elements['<?php echo 'id[' . $products_verification_array['products_options_id'] . ']'; ?>'].length-1; i > -1; i--) { if (cart_quantity.elements['<?php echo 'id[' . $products_verification_array['products_options_id'] . ']'; ?>'][i].checked) { myOption = i; i = -1; } } if (myOption == -1) { cart_quantity.elements['<?php echo 'id[' . $products_verification_array['products_options_id'] . ']'; ?>'][0].focus(); var alertvar = "You must make a selection from the '<?php echo $products_verification_array['products_options_name'];?>' group."; alert(alertvar); return false; } <?php } ?> } //--></script> <script language="javascript"><!-- function validate_me(myform) { <?php // jeff added this stuff for radio button validation $products_verification_query = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " po where po.products_options_type='3'"); // loop through each option type that has radio buttons while ($products_verification_array = tep_db_fetch_array($products_verification_query)) { ?> myOption = -1; // loop through each element of the radio set for (i=cart_quantity.elements['<?php echo 'id[' . $products_verification_array['products_options_id'] . ']'; ?>'].length-1; i > -1; i--) { if (cart_quantity.elements['<?php echo 'id[' . $products_verification_array['products_options_id'] . ']'; ?>'][i].checked) { myOption = i; i = -1; } } if (myOption == -1) { cart_quantity.elements['<?php echo 'id[' . $products_verification_array['products_options_id'] . ']'; ?>'][0].focus(); var alertvar = "You must make a selection from the '<?php echo $products_verification_array['products_options_name'];?>' group."; errorvar = 1; } <?php } ?> if(errorvar==1){ alert(alertvar); return false; } } //--></script>
  2. On the image you had posted earlier, I can see the monarch butterfly image name in the shopping cart. If it's not showing up anywhere else, then it probably is an install problem. I'm using the same contribution on a semi-fresh install of OSC, and I can see the uploaded image name in my admin section under the order.
  3. I think he's talking about when the item is in the cart. If the customer has uploaded an image, there will be a little link with an eyeball that can be clicked to view the uploaded image. This will not appear if the customer is not logged in, is it not showing up even when logged in? Once the customer logs in, the image should be moved from the temp folder to uploads, and from then on, you should see the little eyeball. Being able to see the link when the customer isn't logged in is one of the things people have been hoping for, myself included.
  4. Multimixer, No, actually I didn't get the merge to work cleanly. PHP isn't my strongest language, but I managed to modify the surrounding code needed to make it work in the end, and it all seems to be working fine now. I suppose it would be best to see your copy of the file though, to make sure I didn't miss anything important. My file seemed to be different where the while statements that generated the values for $n simply didn't exist, and the variables containing the SQL results were only storing a single row of data, so I needed to turn them into arrays. I look forward to hearing your suggestion on the option sort on the shopping cart page. I've modified the code to show a thumbnail of the image the customer uploaded in the shopping cart page (and later found your post on how to do that step by step >.<). The problem is, now that image pushes all of the other options text around. I'd like to at least force the uploaded image option to the top, but it would be best if I could get them to follow the 'products_options_order' from the products_options table. Thanks for the help!
  5. Sorry to post yet again. I wish I could edit my old posts. Anyway, the next big thing on my list is to be able to control the sort order of the options on the items in the shopping cart. Is there any way to do this? The code for the contribution on the shopping cart page seems to be defeating me no matter which way I try to sort it.
  6. I think I've got this working just through brute force, but I'm still curious why my file was so different. I'm also interested in valerif's question too, I'm going to take a shot at that also.
  7. This post is directed towards MultiMixer. Sorry if this isn't where it should be, I couldn't find a thread about MM's modification to this contribution. I went through the modification for Per unit or Per item, and most of it went reasonably well, until I came to #12, includes/classes/shopping_cart.php The SQL queries for $attribute_price_query in my file didn't match the 'find' code you had included. In fact, many things in this file were different. The file was an unmodified copy from the Option Types v2.1.3 install. I also checked an old vanilla OSC 2v2rc2 install, and the file there doesn't match up either. I get the general idea of what is supposed to be happening there, but from what I can see, the code surrounding the changes to the attributes price section of the calculate function don't work with the code supplied in the directions. For example, $n is never used anywhere but in the replacement code, it's never assigned a value. I don't know if maybe I have a different version of the file, or what's going on. I've included a dropbox link below, if you'd like to take a peek at it, maybe you could shed some light on the problem. This is the condition the file was in before I tried to apply instruction #12. Thanks :) http://dl.dropbox.com/u/6365460/shopping_cart.php
  8. Thanks for all the help, everyone. I have one more question. One of the options I offer is custom artwork. I'd like this charge to only be applied once for each entry in the shopping cart. For example, if you order 1, the charge is $20, or if you order 100 identical items, the charge is still $20 extra, since the artwork only needs to be done once. I've had a look around in the code, but haven't found where I can change this. I remember reading about it somewhere too, but for the life of me I can't find it. Thanks :)
  9. Sure, I set the image folder and sub-folders to 755 and get a message in red at the top: Error Error: Destination not writeable. Error Error: Catalog images directory is not writeable: /data/websites/xxxxxxxxxxxxx.com/htdocs/oscommerce/catalog/images/ I presume this means I need to talk to my host about it, who I already called and left a message for the guy I was talking to the other day. I'm trying to work out exactly what I need to ask them to make them understand the problem. Edit: I need to see if they can set up Apache as a user that has permission to change file permissions, yes?
  10. Yep, I didn't mean to imply that the contribution had something to do with being hacked. I spent my morning reading the security threads, and was starting by renaming the admin, deleting file manager, etc. I had just got to the part about changing file permissions when I ran across the problem with the cart. I don't use any of the admin functions for product management though, all of that is done locally and uploaded via a heavily modified easypopulate and FTP for the images. Off to install some security addons now. I do wonder though, why is it that some hosts would, or would not allow these folders to be 755?
  11. Good morning, After installing Option Types V2 (which is awesome, btw), I came across some files in my image folder that looked like trouble, they began with goog1e#####, I expect they have been there for a while without me knowing. Among other security changes, following the directions I read, I set the file permissions in several folders to 755. After doing this, when adding an item to the shopping cart that has an UPLOAD file option, clicking 'add to cart' does nothing but refresh the page, and re-display the same item with all the option fields reset to blank. If I set the file permission for the image folder and all folders below that to 777, everything works again. I expect this is a security issue, and would like to correct it. Any ideas how to remedy this, or at lease minimize the risk? I'm writing in a bit of a rush, I hope this all makes sense. Thanks!