Home arrow My Blog arrow Multiple Vendors in Virtuemart
Multiple Vendors in Virtuemart Print E-mail
Well, since finishing Petspreferus.com we got a great order!  $138.00 or something close to that.  The problem is, I only had a shipping handler for the dog collars..  The big problem there,, well the products was 20lbs, which is like $29 buckeroos to ship.  So, today I'm devoting my time to fixing this issue.. Ultimately, I need to be able to assign a shipping method to each product OR each Vendor..  Vendor support is still in ALPHA, but I see nothing along these lines.. So, here goes.

Well, after a few hours of scowering the core PHP files, I have nothing.  I like any broken man, I've reverted to the VirtueMart Developer Documentation.
in the hope of finding my way.

Some Notes:

So, the reason I couldn't find my way: The damn functions are in the mySQL database!  It's a great idea.  I've just never run into that before.   

Array $cart The current cart contents. The array has the following structure:
[cart] # Array (
            [idx] # 1
            [0] # Array (
                     [quantity] # 1
                     [product_id] # 10
                     [description] # Size:big; Power:100W
                   )
           )

It turns out that a lot of the vars are kept in global $_SESSION array: $_SESSION['cart'] for example.  Makes sense.  I'll have to dig up an old helper class that I programmed many moons ago to debug global vars.  I think I called it "myEnv".

 Okay,, I found this in the documentation:

4.2.2. The Shipping API specification
The following is a list of all methods that must be implemented by a shipping module's class file.
    string list_rates( Array $d )
    Lists all available shipping rates.
Tip:
    The array $d contains the values for
    the cart total weight ($d['weight']) and
    the ID for the shipping address the user
    has selected ($d['ship_to_info_id']). The
    ship_to_info_id refers to the field user_info_id in the
    tables mos_users OR mos_vm_user_info. Check both
    for a matching entry!

So, If I can find a way to modify the string list_rates, I might be able associate a particular rate with each vendor.  Yeah, it's a bit of a hack,, but what do you expect?  An entire rewrite.  HA!

Here is a $_SESSION var dump using my debug helper class.

myEnv has been initiated below is the results:
::$_SESSION dump::

  1. cart=>Array (2)
    1. idx=>1
    2. 0=>Array (3)
      1. quantity=>1
      2. product_id=>22
      3. description=>Size:20LB
  2. ps_vendor_id=>1
  3. minimum_pov=>0.00
  4. vendor_currency=>USD
  5. auth=>Array (13)
    1. show_prices=>1
    2. user_id=>62
    3. username=>admin
    4. perms=>admin
    5. first_name=>Sean
    6. last_name=>Novak
    7. country=>USA
    8. zip=>33325
    9. shopper_group_id=>5
    10. shopper_group_discount=>0.00
    11. show_price_including_tax=>1
    12. default_shopper_group=>1
    13. is_registered_customer=>1
  6. session_userstate=>Array (6)
    1. product_id=>0
    2. category_id=>0
    3. keyword=>
    4. viewlistlimit=>30
    5. view8limitstart=>0
    6. view0limitstart=>0
  7. last_page=>checkout.index
  8. product_sess=>Array (19)
    1. 22=>Array (4)
      1. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202651914
      2. vendor_id=>2
      3. tax_rate=>0
      4. flypage=>shop.flypage
    2. 23=>Array (3)
      1. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650603
      2. vendor_id=>2
      3. tax_rate=>0
    3. 25=>Array (3)
      1. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650603
      2. vendor_id=>2
      3. tax_rate=>0
    4. 28=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650685
      3. vendor_id=>2
      4. tax_rate=>0
    5. 34=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650685
      3. vendor_id=>2
      4. tax_rate=>0
    6. 31=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650685
      3. vendor_id=>2
      4. tax_rate=>0
    7. 52=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650685
      3. vendor_id=>3
      4. tax_rate=>0
    8. 32=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650685
      3. vendor_id=>2
      4. tax_rate=>0
    9. 47=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650693
      3. vendor_id=>2
      4. tax_rate=>0
    10. 40=>Array (3)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650693
      3. vendor_id=>2
    11. 36=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650693
      3. vendor_id=>2
      4. tax_rate=>0
    12. 29=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650693
      3. vendor_id=>2
      4. tax_rate=>0
    13. 41=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650764
      3. vendor_id=>2
      4. tax_rate=>0
    14. 54=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650764
      3. vendor_id=>3
      4. tax_rate=>0
    15. 27=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650764
      3. vendor_id=>2
      4. tax_rate=>0
    16. 37=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650764
      3. vendor_id=>2
      4. tax_rate=>0
    17. 38=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650774
      3. vendor_id=>2
      4. tax_rate=>0
    18. 35=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650774
      3. vendor_id=>2
      4. tax_rate=>0
    19. 42=>Array (4)
      1. flypage=>shop.flypage
      2. discount_info=>Array (3)
        1. amount=>0
        2. is_percent=>0
        3. create_time=>1202650774
      3. vendor_id=>2
      4. tax_rate=>0
  9. flex%7CSTD%7CStandard+Shipping+over+25.00%7C12.206=>1
  10. standard_shipping%7CUSPS%7CMendota+Flat+Rate%7C5.00%7C23=>1

So, it looks like these last couple $_SESSION vars 9 and 10 are my shipping options, which look like booleans.  Hmm..
I'm going to have to either associate each vendor_id with a shipping method.  Or, each product with a shipping method.  Each option has it's up and down side associated.  If I choose the product route, the system might be more flexible.  If I go the vendor_id route, it might be easier for the admin as any product under a vendor_id is associated with a shipping method.

Another big issue, The user really won't be able to choose a perferred shipping method.  So, it might be wise to eliminate the option for the customer to elect a shipping method altogether. Which probably means modifying the functionality of the Virtuemart Core system. 
Yell Great.  It's probably best I look for a hack method first.. Trying to save time here.  I still have my Master's degree work to worry about here.

Okay,, idea.  If I write my own Shipping Module to make the association.. I don't have to hack the core nor mess with anyone else's Shipping Module.  Seems like the best solution.. Now.. how the hell do I do that


I'm goin in.


This project is now on hold!

 

 
Copyright © Sean Novak 2006
 

Main Menu
Home
Animation
Resume
Web Development
Tutorials
Press
Site Updates
News Feeds
Links
Contact
Ticker Farmer
My Blog
Sponsored Links
JoomlaWatch Stats 1.2.0


Instant Message: thesightsmith