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