Jump to content

zebrax

Members
  • Content count

    19
  • Joined

  • Last visited

1 Follower

About zebrax

  • Birthday 01/26/1978

Profile Information

  1. zebrax

    Shipping advice needed

    I created a module that logs in to dhl.ca ( so you get your discount) and gets the shipping quote. I works great exept that DHL .ca seems to go down very regularly. My Module to too specific to my site release at this point but I was going to release it in the future. I am also talking the DHL to get an API, to make things that much easier.
  2. zebrax

    [Contribution]Paypal IPN - Devosc

    I need to supprt multiple bussiness ID (emails) as we have multiple email addresses confirured under one paypal account. Is this possible? Should I use a comma seperate list and loop through the emails at if (!$ipn->validateReceiverEmail(MODULE_PAYMENT_PAYPAL_ID,MODULE_PAYMENT_PAYPAL_BUSINESS_ID)) $ipn->dienice('500'); or in the validateReceiverEmail function Thanks
  3. zebrax

    [Contribution]Paypal IPN - Devosc

    I need to supprt multiple bussiness ID (emails) as we have multiple email addresses confirured under one paypal account. Is this possible? Should I use a comma seperate list and loop through the emails at if (!$ipn->validateReceiverEmail(MODULE_PAYMENT_PAYPAL_ID,MODULE_PAYMENT_PAYPAL_BUSINESS_ID)) $ipn->dienice('500'); or in the validateReceiverEmail function Thanks
  4. zebrax

    [Contribution]Paypal IPN - Devosc

    Thanks Greg for the great new version. Works great with AuctionBlox after a few changes. And I thank you for the great coding, it makes it so easy to find and change things.
  5. zebrax

    Multiple shipping addresses

    I don't know of one, but we are working on a module were a single order can come from multiple addresses. It can probably be adapted to do what you want. http://forums.oscommerce.com/index.php?showtopic=101973
  6. zebrax

    Multi_Vendor_Shipping new thread

    Well so far I have a working version of the multivendor shipping. There are a still alot of things I need to get working. Right now it gets aquote for each vendor for each module. It then adds the price of each method with the other methods, from different vendors. It then displays the quote. This all hinges on each vendor using the exact same modules, and the modules returning the same methods. here is my new class <?php /** * vendor_shipping.php * * @version $Id$ * @copyright 2004 */ require_once(DIR_WS_CLASSES . 'shipping.php'); define('USE_VENDOR_SHIPPING', 1); //configure in admin later class vendorShipping extends shipping { function quote($method = '', $module = '') { global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes, $cart, $origininfo; if (USE_VENDOR_SHIPPING == 1) { // vendor specific methodes $sortvendor = $this->sortProductsByVendor($cart->get_products()); if (is_array($this->modules)) { foreach($sortvendor as $vendor) { $origininfo = array(); $shipping_quoted = ''; $shipping_weight = ''; $shipping_num_boxes = 1; $shipping_weight = $vendor['weight']; $origininfo['zipcode'] = $vendor['vendors_ship_zip']; $origininfo['country'] = $vendor['vendors_ship_country']; $origininfo['state'] = $vendor['vendors_ship_state']; if (SHIPPING_BOX_WEIGHT >= $shipping_weight * SHIPPING_BOX_PADDING / 100) { $shipping_weight = $shipping_weight + SHIPPING_BOX_WEIGHT; } else { $shipping_weight = $shipping_weight + ($shipping_weight * SHIPPING_BOX_PADDING / 100); } if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes $shipping_num_boxes = ceil($shipping_weight / SHIPPING_MAX_WEIGHT); $shipping_weight = $shipping_weight / $shipping_num_boxes; } $include_quotes = array(); $include_quotes = $this->getValidVendorModules($vendor['vendors_id']); $size = sizeof($include_quotes); for ($i = 0; $i < $size; $i++) { $quotes = $GLOBALS[$include_quotes[$i]]->quote(''); if (is_array($quotes)) { $quotes_array[$vendor['vendors_id']][] = $quotes; } } } if (tep_not_null($method) && substr($module, 0, 6) == 'vendor') { $temp_quotes = $this->processQuotes($quotes_array); // $quotes_array = $quotes_array[$module][$method]; $key = array_search($module, $temp_quotes); foreach ($temp_quotes as $key => $quote) { if (array_search($module, $quote)) { $index = $key; foreach($quote['methods'] as $key3 => $value) { if (array_search($method, $value)) { $index2 = $key3; } } } } $quotes_array[0]['methods'][0] = $temp_quotes[$index]['methods'][$index2]; return $quotes_array; } } return $this->processQuotes($quotes_array); } else { return parent::quote($method, $module); } } function sortProductsByVendor($products) { foreach ($products as $product) { $sortvendor[$product['vendors_id']]['vendors_id'] = $product['vendors_id']; $sortvendor[$product['vendors_id']][] = $product; $sortvendor[$product['vendors_id']]['weight'] += $product['weight']; } foreach ($sortvendor as $vendor) { $vendor_info_query = tep_db_query("Select * from vendors where vendors_id='" . $vendor['vendors_id'] . "'"); $vendor_info = tep_db_fetch_array($vendor_info_query); // print_r($vendor_info); $sortvendor[$vendor['vendors_id']] = array_merge($sortvendor[$vendor['vendors_id']], $vendor_info); } return $sortvendor; } function getValidVendorModules($vendorid) { // returns the modules that the vendor ship with reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $include_quotes[] = $class; } } return $include_quotes; } function processQuotes($quotes) { $vendorlist = array_keys($quotes); $numvendors = count($vendorlist); for($i = 0;$i < $numvendors;$i++) { $numquotes = count($quotes[$vendorlist[$i]]); for($j = 0;$j < $numquotes;$j++) { $finalquote[$j]['id'] = 'vendor' . $j; $finalquote[$j]['module'] = $quotes[$vendorlist[$i]][$j]['module']; for($k = 0;$k < count($quotes[$vendorlist[$i]][$j]['methods']);$k++) { $finalquote[$j]['methods'][$k]['id'] = $quotes[$vendorlist[$i]][$j]['methods'][$k]['id']; $finalquote[$j]['methods'][$k]['title'] = $quotes[$vendorlist[$i]][$j]['methods'][$k]['title']; $finalquote[$j]['methods'][$k]['cost'] += $quotes[$vendorlist[$i]][$j]['methods'][$k]['cost']; } } } return $finalquote; } function _getCheapest($quotes) { for ($i = 0, $n = sizeof($quotes['methods']); $i < $n; $i++) { if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) { $rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'], 'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')', 'cost' => $quotes['methods'][$i]['cost']); } } $cheapest = false; for ($i = 0, $n = sizeof($rates); $i < $n; $i++) { if (is_array($cheapest)) { if ($rates[$i]['cost'] < $cheapest['cost']) { $cheapest = $rates[$i]; print_r($cheapest); echo '<br>'; } } else { $cheapest = $rates[$i]; } } return $cheapest; } } you have to change a checkout_shipping.php replace with I had to make a few changes, in other places but I can't remember where, I will have to do a diff at some point. This all depends on a few things, like the vendor id is attached to the product in the shopping cart. I put this code here mainly to help you guys get somewhere.
  7. zebrax

    Multi_Vendor_Shipping new thread

    I am working on a vendor shipping class that extends the original shipping class, I should have a semi working version in a day or 2. You can then see what my ideas are and it will include something like By making a variable "global" you can access from any function anywhere in the script , so this is what it is doing, changing a variable and then the including modules use the changed variable you could also use $GLOBALS['origininfo'] to get the info in the modules.
  8. zebrax

    Multi_Vendor_Shipping new thread

    Sessions are not used for the shipping cost until, a specific shipping method is picked. The method is picked on checkout_shipping.php page using an input variable with name=shipping and value in the form of "module_method" eg "fedex_express" When this info is posted back to chekout_shipping.php it calls the shipping module again and gets the value of "method" at that time it creates a session called shipping with the choosen method price and title,etc, it then redirects to checkout_payment.php. So at no time do we need to directly set the session with the shipping info, it should be done automaticly when the method is chosen. But this is where the problems start. We are using multiple modules and methods so the standard input of "module_method" will not work in our situation. we may have to change it to somethng like "vendor_number" where the number would be the quote that could consist of many modules and method prices added together. example 2 items from vendor A 1 item from vendor B Vendor A ships with UPS Vendor B ships with Fedex For 1 box from Vendor A would would have a few methods: Ground and express the same for box 2 from vendor B: ground and Express so now you have a quote 1 which is ups ground and fedex ground added together. and quote 2 for UPS express and Fedex express. now the customer would choose the shipping they want..normaly that would be posted as fedex_express or ups_ground but we could change that to vendor_1 so now the price for quote 1 get entered into the session with title "2 boxes fedex and UPS" and price "$" and the checkout process continues as normal. I understand that we could end up with multiple methods and multiple modules, and it could be very confusing. But we should be able to manage it.
  9. zebrax

    Multi_Vendor_Shipping new thread

    My shipping.php class contains this code in th quote function global $origininfo; $origininfo['zipcode']=$vendor['vendors_ship_zip']; $origininfo['country']=$vendor['vendors_ship_country']; $origininfo['state']=$vendor['vendors_ship_state']; then each module need to has code likethis also in the quote function. global $origininfo; $countries_array = tep_get_countries($origininfo['country'], true); $this->country = $countries_array['countries_iso_code_2']; $this->originZip=$origininfo['zipcode']; of coarse each module sets the zipcode and country in a different place. I set the top code in a loop for all of the vendors, which gives me a shipping quote for each vendor. I now have to combin the array and display the contents and have that quote get carried over to the next step of the checkout process, ( 1 quote can contain multiple quotes from different shipping companies) th current way will not work.
  10. zebrax

    Multi_Vendor_Shipping new thread

    Apparently you didn't read my posts on the second or third page, becuase when I follow what I have said, its amazing! I get quotes back using different postal codes. Now all I have to do is sort and display them. but apparently you don't want my help here, so BYE.
  11. zebrax

    Multi_Vendor_Shipping new thread

    I have already said how to pass the zip code to each module. You NEED to modify each module. Most modules use a contant SHIPPING_ORIGIN_ZIP for the zip code. This can't be changed. You need to use a global variable that can be changed. The whole concept of this thread isn't hard. When I get an extra hour I will show you that it can be done.
  12. zebrax

    Multi_Vendor_Shipping new thread

    I am already using a higly modified vendors mod. The becuase of my situation each product can only have 1 vendor. We actualy have 2 different locations and sell the same stuff on one website. Because we have a lot of local customers to both locations ve need to alow customer to search localy so they can pick up there items. The cart load the vendor id with each product , so that is why I created the code above, becuase I did know the vendor id. I am going to code for my situation and you guys can have a look at it and change things as needed.
  13. zebrax

    Multi_Vendor_Shipping new thread

    I started to code this now, so far I have this $prodvendors=$cart->get_products(); foreach ($prodvendors as $product){ $sortvendor[$product['vendors_id']]['vendors_id']=$product['vendors_id']; $sortvendor[$product['vendors_id']][]=$product; $sortvendor[$product['vendors_id']]['weight']+=$product['weight']; } foreach ($sortvendor as $vendor){ $vendor_info_query=tep_db_query("Select * from vendors where vendors_id='".$vendor['vendors_id']."'"); $vendor_info=tep_db_fetch_array($vendor_info_query); $sortvendor[$vendor['vendors_id']]=array_merge($sortvendor[$vendor['vendors_id']],$vendor_info); } You end up with an array of all the products order grouped by vendor with the vendor infomation in an array
  14. zebrax

    Multi_Vendor_Shipping new thread

    I am using 3 different shipping modules that use dimensions ,Fedex,DHL and Canada post. I have had to modify all of my shipping modules to reflect my stiuation. The dimensions can either be retreived via the cart or passed via a global array. I have changed all my modules to give quotes for items that don't exist in the cart. We use shipping quote links on all our ebay auctions, that uses osc shipping modules to give a quote by passing the dimension and weight. I don't see any way of getting around modify ALL shipping modules to work with multiple vendors. But the change should only be a few line here or there. Adding a handling fee for large packages in not an option, we have tried it. Then we found out that sending large boxes uses the dimensonal weight , so for certian size boxes if you were to fill it with feathers and it would be billed at 72 pounds!! If we had venders associated with the shipping compays they support then most default items would use those modules. But for special items they can be set to use specific modules and over ride the vendors defaults, say for large items going on a pallet. I don't think there is any variables in sessions that are needed, most are found in cart and order classes.
  15. zebrax

    Multi_Vendor_Shipping new thread

    Each shipping module is going to need some code change since most use a constant to get the origin zip. in the modules I have looked at, it should only be 2 line change. $country_name = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true); $this->_Origin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']); changed to global $origininfo; $country_name = tep_get_countries($origininfo['country'], true); $this->_Origin($origininfo['zipcode'], $country_name['countries_iso_code_2']); the key here is rewriting the shipping class to change the value of $origininfo before calling each need module. the shipping class uses the cart class to get the products and coresponding vendors, it sorts the items by vendor, adds up the weights and calls the valid shipping modules for each vendor. it then returns the totals of all the different items and methods. Now if I just had some time I would code it....
×