Jump to content

mucter

Members
  • Content count

    16
  • Joined

  • Last visited

Profile Information

  • Real Name
    Jay Mallison
  1. mucter

    Level 2 Google Checkout (development)

    just curious, how far away (time wise) do you think you are from having something worth sharing for the Level 2 checkout? And is there anything I can do to help?
  2. mucter

    google checkout

    and ... wil this work with multi vendor shipping???
  3. mucter

    New UPS XML Shipping Module available

    yeah, its probably the XML at this point that is so slow. The code probably isn't a real issue, but I'm just skiddish about slowing things down at this point, since, to me, the XML portion takes an eternity. Yeah its only like 3 or 4 seconds, but when I'm used to all of the other pages in OSC opening in under a second, it just makes me nervous (I'm editing and hosting everything in house over a LAN)... occasionally though it will time out while trying to get a quote...
  4. mucter

    New UPS XML Shipping Module available

    yeah I knew it wasn't the be all-end all... we're working with an imperfect science here, and I'm just trying to narrow down the number of completely freakish quotes this thing can spew out... lol. I agree it would be nice to have code to repackage based on fitting things in the smallest box they can fit in if they can't go in a bigger box with something else... but at the same time. We're running into big speed issues, at least I am. This module is slooooooowwww as mud for me. I just use it because I have no choice. If there were a way to speed it up, I'd be on it like a fat boy on a milkshake. B)
  5. mucter

    New UPS XML Shipping Module available

    Ok.... so this problem with the dimensional support putting things in the wrong boxes got out of hand on my clients site... this problem may not be as noticeable on most sites because you probably don't ship stuff that is of the same mass as my client. At any rate... here's my interpretation of the problem and my version of the solution, please feel free to take this and put it in the code tree if you like. I've hacked my copy of the file apart so much I don't really want to pollute the tree with it at this point. The issue is that if you have items that are of different weights and dimensions in the shopping cart. The "fitProductsInBox" function will end up trying to put most of the small items into the largest packages you have defined. This happens when the smaller items are listed in the cart before the larger items, and what the function tries to do, is fit as many products into a box as possible, so in its attempt to fit the larger item in the box with the smaller items, it will place the smaller items in the biggest box available, and then figure out that it still won't fit. But instead of using the smallest box that those smaller items can fit into, it will keep them in the largest box. Thus totally skewing the dimensions/quote. Now. Since I didn't write the fitProductsInBox function, and I'm crunched for time right now in my development cycle, I couldn't really make sense of what exactly I should add/change to that function to make it work properly. So instead, I came up with this workaround. Currently the $productsRemaining array gets sorted to put the ready_to_ship items first so that it can get those out of the way. So what I did was seperate the while clause that does the packing into 2 while clauses, one doing the ready_to_ship items and the other doing the rest. I then have the $productsRemaining array resorted by weight, highest to lowest, so the things that are big get packed in their big boxes first and the small stuff can't end up stuck in a big box because of a big item. I then run the while clause for the fitProductsInBox function using the resorted array. At this point this seems to be working. JanZ you may find a flaw with this, and I may too, but if it works for now, that is what I need... Oh and by the way, this will only work properly if you keep the packages_query ordered by volume... So here is the code breakdown. Currently you have this section of the packProducts function: // make sure the products that did not fit the largest box and are now set as ready-to-ship // are out of the way as soon as possible usort($productsRemaining, ready_to_shipCmp); // Worst case, you'll need as many boxes as products ordered. while (count($productsRemaining)) { // Immediately set aside products that are already packed and ready. if ($productsRemaining[0]['ready_to_ship'] == '1') { $packedBoxesArray[] = array ( 'length' => $productsRemaining[0]['length'], 'width' => $productsRemaining[0]['width'], 'height' => $productsRemaining[0]['height'], 'price' => $productsRemaining[0]['price'], 'current_weight' => $productsRemaining[0]['weight']); $productsRemaining = array_slice($productsRemaining, 1); continue; } //Cycle through boxes, increasing box size if all doesn't fit. if (count($emptyBoxesArray) == 0) { print("ERROR: No boxes to ship unpackaged product<br />\n"); break; } for ($b = 0; $b < count($emptyBoxesArray) && tep_not_null($productsRemaining); $b++) { $result = $this->fitProductsInBox($productsRemaining, $emptyBoxesArray[$b], $packedBoxesArray, $b, count($emptyBoxesArray) -1 ); $packedBoxesArray = $result['packed_boxes']; $productsRemaining = $result['remaining']; } } // end while return $packedBoxesArray; Which I changed to this: // make sure the products that did not fit the largest box and are now set as ready-to-ship // are out of the way as soon as possible usort($productsRemaining, ready_to_shipCmp); while (count($productsRemaining)) { // Immediately set aside products that are already packed and ready. if ($productsRemaining[0]['ready_to_ship'] == '1') { $packedBoxesArray[] = array ( 'length' => $productsRemaining[0]['length'], 'width' => $productsRemaining[0]['width'], 'height' => $productsRemaining[0]['height'], 'price' => $productsRemaining[0]['price'], 'current_weight' => $productsRemaining[0]['weight']); $productsRemaining = array_slice($productsRemaining, 1); continue; } else { break; } } // end while usort($productsRemaining, weightCmp); // Worst case, you'll need as many boxes as products ordered. while (count($productsRemaining)) { //Cycle through boxes, increasing box size if all doesn't fit. if (count($emptyBoxesArray) == 0) { print("ERROR: No boxes to ship unpackaged product<br />\n"); break; } for ($b = 0; $b < count($emptyBoxesArray) && tep_not_null($productsRemaining); $b++) { $result = $this->fitProductsInBox($productsRemaining, $emptyBoxesArray[$b], $packedBoxesArray, $b, count($emptyBoxesArray) -1 ); $packedBoxesArray = $result['packed_boxes']; $productsRemaining = $result['remaining']; } } // end while return $packedBoxesArray; Then down at the bottom of the file I just added another comparison function next to the ready_to_shipCmp one: //****************************** function ready_to_shipCmp( $a, $b) { if ( $a['ready_to_ship'] == $b['ready_to_ship'] ) return 0; if ( $a['ready_to_ship'] > $b['ready_to_ship'] ) return -1; return 1; } function weightCmp( $a, $b) { if ( $a['weight'] == $b['weight'] ) return 0; if ( $a['weight'] > $b['weight'] ) return -1; return 1; } At this point it is working for me... YMMV good luck!!! Jay
  6. mucter

    Country-State Selector

    Hey Steve, Just wanted to take a second to thank you for setting up such an excellent contrib. So many of the contribs on this site are coded poorly and impossible to read. I found your instructions and code to be excellent and this was very easy to install. Its just sad that functionality that I feel should be one of the most basic things to be included in oscommerce from the get go would have to be added via contrib... Cheers :thumbsup: Jay
  7. mucter

    New UPS XML Shipping Module available

    Funny, thats exactly where I ended up putting something, great minds think alike... lol :thumbsup:
  8. mucter

    New UPS XML Shipping Module available

    JanZ, I was wondering if you had any suggestions for an easy way to have a particular product be packaged in 2 boxes. For example, my client has a couple products that weigh 224lbs, in order to ship one of those products they ship them in 2 boxes each weighing 112lbs. There currently is no way in OSC to tell it that there are multiple packages for 1 product. I looked into the master/slave packages contrib, but I didn't like how drastically I had to change the code to make that work when it is waayyy overkill for what I need, and really it is too complicated for my client to deal with. Thanks for any input.
  9. mucter

    New UPS XML Shipping Module available

    so, I was adding the estimated shipping contrib, and it work fine, only thing is, it won't return the EDD from time in transit. Now the estimated shipping just goes off the country code and the zip code to return the shipping quotes. I looked at the time in transit documentation and it claims that time in transit should work with just the destination country and zip, but I looked at the XML returned and it is just straight up missing the time in transit estimations... am I missing something? The only things not being sent to the server in the xml are PoliticalDivision2 and PoliticalDivision1, but again the documentation from UPS says that those aren't required. Is it incorrect? If I remove them from the xml document generated in upsxml.php, time in transit doesn't work on the normal shipping page either... ugh >_<
  10. mucter

    New UPS XML Shipping Module available

    JanZ, I uploaded a new version of upsxml.php to the contrib, adding a couple features and fixing one bug I found. - added the ability to choose the time in transit display being either the raw style or the more readable version from the admin tool instead of having to edit the code. - created a workaround for when the total weight of all boxes is greater than the maximum weight for time in transit in either lbs (150) or kgs (70). It will limit the weight to the maximum just for time in transit (will not affect shipping wieght). - Added the ability to define handling fee as either a Flat Fee or a Percentage through the admin screen.
  11. mucter

    New UPS XML Shipping Module available

    did you install it with or without the dimensional/packaging support? and uncommenting that line about CURLOPT_SSL_VERIFYPEER should fix the ssl error you were getting on your local machine, thats why I suggested it.\ is CURL working on the servers that you are trying this on... nothing will work if its not enabled.
  12. mucter

    New UPS XML Shipping Module available

    find these lines in upsxml.php: curl_setopt($ch, CURLOPT_URL, $url); // uncomment the next line if you get curl error 60: error setting certificate verify locations curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // uncommenting the next line is most likely not necessary in case of error 60 // curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlRequest); curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout); you probably need to uncomment this line: curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); I had to as I was having a similar problem.
  13. mucter

    New UPS XML Shipping Module available

    JanZ, WoW, this is working much better for me so far, took me a while to figure out where exactly to put the if (MODULE_SHIPPING_UPSXML_DIMENSIONS_SUPPORT == 'Ready-to-ship only') { $this->dimensions_support = 1; } elseif (MODULE_SHIPPING_UPSXML_DIMENSIONS_SUPPORT == 'With product dimensions') { $this->dimensions_support = 2; } else { $this->dimensions_support = 0; } part and then I added the appropriate configuration value to the db along with tep_cfg_select_option(array('With product dimensions', 'Ready-to-ship only', 'No Dimensional Support'), in the set_function field to add it to the admin page, that is working beautifully now. One thing you missed which was keeping it from displaying the total weight was: // EOF Time In Transit $upsQuote = $this->_upsGetQuote(); if ((is_array($upsQuote)) && (sizeof($upsQuote) > 0)) { if ($this->dimensions_support != 0) { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $this->boxCount . ($this->boxCount > 1 ? ' pkg(s), ' : ' pkg, ') . $totalWeight . ' ' . strtolower($this->unit_weight) . ' total)'); } else { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ($this->boxCount > 1 ? ' pkg(s) x ' : ' pkg x ') . $shipping_weight . ' ' . strtolower($this->unit_weight) . ' total)'); } $methods = array(); had to add " if ($this->dimensions_support != 0) {" to make that part work right. All in all a MAJOR improvement. Thanks so much for working on this. You get a big THUMBS UP :thumbsup:
  14. mucter

    New UPS XML Shipping Module available

    JanZ, I eagerly await your update to the Packaging algorithm. I have been fighting with it over the last week, trying to improve it, but to no avail. It is just so freaking broken in its current state. >_< How soon do you think you'll have something ready to share with us? ;) Thanks!
×