Jump to content

Zappo

Members
  • Content count

    201
  • Joined

  • Last visited

Posts posted by Zappo


  1. I have this issue and have looked and relooked the shopping cart class. Anyone want to take a stab at it?

    You just proved some of my earlier comments:

    1) Problems occur when merging contributions

    2) Problems occur by not merging the files correctly

    3) You should use a 3-way compare program to compare: Original osC file, Edited file, File to Add (You would have easily picked up the mistake(s) you made)

     

    Don't know if this will solve the problem, but below the line:

    //BOF - Zappo - Option Types v2 - Because of Text and Upload options, $option AND $value don't have to be numeric!

    You should comment out the entire check! (reason: exactly like the comment says)

     

    This stood out when I scrolled down the page, and I did not check for any other mistakes or faults...

     

    I recommend using kDiff3 when merging files. That program saved me a lot of headaches!


  2. PLEASE stop posting those giant blocks of code, and entire files here!!!

    I can't see Anyone reading through all that stuff to find some mistake you made, or solve your problems for you.

     

    To fan4chevy (Big Stumper):

    1) Post code on this forum using the <code> tags

    2) If Find and Replace is over your head, you shouldn't be doing this stuff! Educate yourself!


  3. Hi people.

     

    There are news about merging SPPC and Option Types v2. I have it working!

    Great work MultiMixer! :thumbsup:

    When I can find the time, I'll clean up your code (make it more elegant) and create a sub-release for OptionTypes v2 (as a lot of people will want to use both contributions, including myself)

    Again, Nicely done!


  4. Though if you have another contribution(s) installed it may effect it differently.

    That does seem to be the main problem for most users at this moment.

    Like my signature says, it never hurts to help, but I'm no miracle worker...

    As far as I can tell, the contribution works (almost?) flawlessly "out of the box", and any problems with it come from merging with other contributions, or not correctly merging all the provided files.

     

    For the people who have problems with CUSTOMER-INPUT after logging in, I suggest re-checking the file catalog/includes/classes/shopping_cart.php

    The "temporary cart" get's converted (and put in the Database) from there...


  5. Sorry about that.

     

    This code obviously wouldnt need the progress bar, which would simplify things a little. I would also need to create the $tmp_html variable, how would I best integrate the java script into this?

    No worries :thumbsup:

     

    Adding the Javascript should be done in product_info.php. (Link to the Admin directory if you don't copy the script to catalog/includes/javascript!!!)

    However, I don't know how the calendar javascript works... The code below just shows WHERE to put the new code. You'll still have to edit the "var dateAvailable = " line for your specific purpose.

    I added some original code to show where to put the new code:

    <link rel="stylesheet" type="text/css" href="stylesheet.css">
    <link rel="stylesheet" type="text/css" href="admin/includes/javascript/spiffyCal/spiffyCal_v2_1.css">
    <script language="Javascript" src="admin/includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
    <script language="javascript"><!--
    function popupWindow(url) {
     window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
    }
    
     var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_product", "products_date_available","btnDate1","<?php echo $pInfo->products_date_available; ?>",scBTNMODE_CUSTOMBLUE);
    
    // BOF - Zappo - Option Types v2 - Added for Form Field Progress Bar 
    function textCounter(field,counter,maxlimit,linecounter) {
    etc, etc, etc....

    The first 2 lines you gave (with the locations of the css and js files) do not have to be changed. They just include the needed files.

    The other line however, contains variables that are passed to the calendar script. You'll have to find out what variables to pass, and how to use them...


  6. In catalog/includes/application_top.php the instruction call for identifying the following code;

    Any advice you can give me would be much appreciated!

    Hi Peter.

    PLEASE use the CODE tags on the forum when posting lines of code.

    I'm not going to waste my time reading through all those lines of code, searching for a mistake...

    Look at Multimixer's post. See how that's A LOT more readable than what you posted?

     

    However, you stated you replaced the entire "case 'add_product'" code, when the first line should be kept in place.

    Like I said in my previous post, I REALLY recommend using kDiff (or another merging software) to merge files.

    Using a software like that will greatly simplify finding the differences between files, and minimize mistakes when merging them!


  7. Any ideas on where to look?

    Uuuhm...

    Could be a lot of things, but I'd start with application_top (the case 'add_product' part) and/or maybe the shopping cart class...

    Did you use a tool to merge the files (kDiff or sumptin'), or did you merge them by hand?

    (I REALLY recommend using kDiff to check the differences between Original, Project, and new Addon files)


  8. Hello Zappo

    I was trying to find how you merged the "older" version of option types, but I couldn't find anything.

    Any link will be appreciated :)

    Hi "Blender" :-"

    Actually, those files are only located on my running webshop, and my home computer. :P

    And with "older version", I mean another contribution (the one Option Types v2 is based upon)

    I was only trying to say that I did it with THAT contribution (which mostly works the same way), and so it is possible with this one. There is no specific coding available...

    However, I do have a few pointers (and some code from the "older Merging"):

    - I never succeeded in merging SPPC with the Attribute manager. I'd leave that one alone for now...

    - You'll have to get the Admin side merged first, so you can save the SPPC-Group prices

    - You'll have to get the Attributes_id (If not done already): Add (in product_info.php, in the $products_options_name_query) patrib.products_attributes_id

    - Add the SPPC attribute-pricing code to the Queries in option_types.php ($products_attribs_query & $products_options_query)

    - The code from the queries should become something like:

    "select distinct pa.options_values_id, pag.options_values_price, pag.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " pag where pa.products_attributes_id = " . $products_options_name['products_attributes_id'] . " and pa.products_attributes_id = pag.products_attributes_id and pag.customers_group_id = '" . $customer_group_id . "'"

     

    I think this should get you on your way...


  9. Thinking about date and time and the many different options there are for things like format etc. osCommerce has a routine in the main language file (catalog/includes/language/english.php) that sets the format, so providing the date and time option types call and use the same routine, they should both work in unison with the other date and time fields within the system. The other benefit being that if someone wants to change from mm/dd/yy to dd/mm/yy or vice versa, they only need make the change in one place.

     

    Maybe this could become an option in the config section of the admin area, as currently there is no such option! I can't believe that one was missed, but it certainly appears to have been!

     

    Thinking about it there is already a function in OSC that brings up a calendar for people to select the date they want from, as in the catalog section of the admin area, when someone sets the date effective from field on a product, if they click the button next to the field, it launches a little calendar box, maybe I could look at the code and see if I can call that function in the option type code.

     

    The way I see it working is the customer has the ability to either enter a date range in which they would be happy to take their training or they can click a check availability button and select an actual date and time that is available and confirm their booking there and then.

    It would probably be wise to store the date and time they selected somewhere and only confirm the booking in the calendar once they complete the checkout process.

     

    What do you think?

    I agree.

     

    osCommerce IS missing a date format option in Admin. The way it works now, is that it's set on a per-language basis (through the main language files)

    Also, you are correct on the calendar thing. I think it's sensible to re-use that code (Why re-invent the wheel?)

     

    About storing the date and time "Somewhere", I'd use the Shopping Cart object for that. It's Perfect for the job!

    After checkout, the cart is emptied, stock products are subtracted, and (in your case) the date and time are booked.


  10. Firstly, There are a number of great attribute types already included, but how difficult would it be to add a couple more attribute types, one being date and the other being time.

     

    Later on perhaps if there was an attribute (button) on the product_info page for the training product that would allow the customer to check availability by linking into a calendar on an MS Exchange server and displaying and making selectable the available time slots by a selectable view of day/week/month.

     

    It would also be great if this sort of function could be used for both booking training and workshop time for rebuilds and repairs etc.

    Hi Peter,

     

    I can't instantly think of a way of adding Time/Date as an attribute (Let alone an Exchange server link), HOWEVER...

    Option Types v2 is made to fairly easily add new Option types.

    After installing, you'll only have to add the coding for the Time/Date Type to includes/modules/option_types.php! (and then some references for your new OptionType, to have it show up in Admin --> We'll get to that when you have the Option set up)

    I don't know your programming skills, but in my view, with novice/intermediate knowledge you should be able to get it done.

    I suggest you first have a look at the option_types.php file, and see how it is setup.

    If you have a test installation to try stuff out, I advise to REPLACE an existing OptionType (OPTIONS_TYPE_TEXT) to try your Date/Time code, and add the final version after your test install is working.

    Also, because Date and Time will have A LOT of different options, I advise to collect the Date and Time as a Text value, and pass it in the same way as Text options (although this will add some more files to edit, you can search for OPTIONS_TYPE_TEXT, and do the same thing for your Date/Time option - The only NEW code will be in option_types.php, the rest can be copied from OPTIONS_TYPE_TEXT)

    One other note though: If you want to add a price to the Time or Date selection, I can't think of a way to calculate, let alone set the price for those attributes... (It will only have 1 price for the Time and/or Date selection)

     

    I hope this will get you on your way.

     

    -EDIT-

    Just thought of some other things:

    The code for checking your Exchange server, could just be added to your new Option Type's code (IF buttonpress -> check server, then IF not available -> display message (Or even disable selection))

    OR

    BEFORE loading the option, maybe add some code to disable the dates and times that are not available...

     

    P.S.

    If you have the Option Type setup, you can use it over & over again on any product you like.


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

    Thanks David!

    Good work.

    Nice to see people getting involved, to improve Option Types v2!


  12. Dear Zappo,

     

    I need a little help if possible.

    Try something like this:

    	if ((isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ProdOpt_ID]) && ($products_options_array['products_options_values_id'] == $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$ProdOpt_ID])) || empty($checked)) {
    	$checked = true;
    } else {
    	$checked = false;
    }
    

    Notice that I switched the true/false. (It should be in this order originally)

    Haven't tried this, but as this should set the first attribute that's pulled from database as selected (OR the attribute that's also stored in cart with the same product), it should work...


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

    Hi David. Nice site you have there!

    I believe you are correct. It seems like Lightbox automatically detects the Image links, to add a zoom effect.

    However, I don't believe I inserted any lightbox (or other "popup") javascript... (did I?!?)

    The only thing I can think of to (quickly and easily) fix this, is to change the sort order, to make sure the uploads are never added to the end of the link.

    You can also remove the image from the link (or the entire attributes stuff), as it is only used for filling the selected fields with the previous values... (in product_info.php)

     

    This IS a bug however, and SHOULD be fixed in the future...

    I'll add it to my ToDo list...


  14. Thanks, Zappo. Yes, there are other contributions installed. Here is the section of code that I believe may be firing only if a drop-down is used. Could you give me any hints as to the section you think is requiring a drop-down:

    Hmmm... some strange things in there...

    Fist off, I'd remove: " && ($HTTP_POST_VARS['products_id']==(int)$HTTP_POST_VARS['products_id'])"

    seems pretty useless...

    Furthermore, you seem to be using QTPro, and I don't know in how many ways QTPro can conflict with Option Types...

    Anyway, the line: "if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val)" seems to check for posted attributes, and filter out only the Numeric keys and values... (and text is not numeric nor an integer (if you want to allow only numbers, remove the (int))

    Here too I find the double check for numeric values very strange!!! (is_numeric() is the same as (int))

    You haven't added Option Types code. You don't need uploads, or what?


  15. If I have only text-input fields on a product, the entered info does not carry over to the shopping cart... BUT... if I have text-input fields on a product that ALSO has a drop-down of any sort, then all the entered info carries over to the shopping cart correctly.

    I'm guessing you have another contrib installed...

    Can't reproduce the error, and don't see how this could occur elsewhise.

    I suggest you check your application_top.php

    That's where the Text attributes are handled, and added to cart.

    There's a line in there: if ($HTTP_POST_VARS['number_of_uploads'] > 0) {, and I'm thinking that line only get's fired when a "normal" attribute is added...

    Let me know how it works out.


  16. The install.txt file, I have to do an insane amount of file edits.

     

    Or, am I going to feel really dumb here realizing that all the files, ARE the already edited files?

     

    SQL query:
    
    # Add products_options type, length (txt fields), and comment to options
    ALTER TABLE products_options ADD products_options_type INT( 2 ) NOT NULL ,
    ADD products_options_length INT( 2 ) DEFAULT '32' NOT NULL ,
    ADD products_options_order VARCHAR( 32 ) DEFAULT '1' NOT NULL ,
    ADD products_options_comment VARCHAR( 32 ) AFTER products_options_name;
    
    MySQL said: Documentation
    #1060 - Duplicate column name 'products_options_comment' 
    

    I get that error when I import/run the .SQL

    install.txt??? There's no install.txt...

     

    Read the error!!!

    Duplicate column. You already have a products_options_comment column. (already ran (part of) the SQL?)


  17. Ok so I'm having some issues with the textarea option type. I have put in 100 for it's value but only 32 characters show up in the shopping cart and consequently on the packing slip/invoice/orders.php on the admin side. I'm not sure if this is a setting I need to change somewhere or it's a setting in option types? Any suggestions? It's one of those things where I keep looking for it but just cannot see.

    Don't know yet, but doesn't seem to be in the programming.

    I'm guessing somewhere the database fields don't allow enough characters...


  18. I think yes, you need to take the file from the uploads folder.

     

    File types are specified in file includes/classes/upload.php

    Correct.

    I mostly use the "preview" link (I only allow Image Uploads), to download the upload to my system.

    Sending the file in the email is a good idea though... (Or maybe just a download link to the file's location)


  19. I'm also trying to do a form validation. I already added an onsubmit in the form that will call a function to validate the form fields. Ideally, some fields should not be empty. When I tried it it's not loading the alert box. It is still being added to the shopping cart.

     

    Can you suggest some ways on how should I go about it? Thanks :)

    Well, seems you've got the basics covered...

    There must be some fault in your Javascript, as IT should show the alert, and prevent the form from being submitted.

    Where and how did you add the onSubmit?

    Also, let's see that validation function...


  20. Hi friends.

     

    I get the following error when I try to add an item to my cart from the Product page (the "Add to Cart" button):

    Warning: opendir(images/temp/) [function.opendir]: failed to open dir: No such file or directory in /[www path]/public_html/catalog/includes/application_top.php on line 371

    Could not open images/temp/

     

    I checked my folder structure and the the directory does exist. Anyone know what the issue is?

     

    Thanks!

    I believe that should be a complete path, e.g. /[www path]/public_html/catalog/images/temp/

    Also, check if the folder is writeable


  21. Sorry everyone for not following this thread, but Linked Products had so much troubles, I started rewriting a lot of code, and it's all quite a mess right now...

    I'll have to find the time to re-engage this contribution, and for the time being I have to advise against using this contribution in a Live installation...

×