MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] more efficient cart content display using SQL db



> I'm wondering if there is a simple/efficient way of retrieving information
> about the product that a user added to the shopping cart for displaying in a
> shopping cart page.
> 
> The product info that I want to show resides partically in a table (MySQL)
> called 'products' (product_id and product_name are there) and partially in
> another table called product_term (prices are there).
> 
> I know I could probably use something like this:
> 
> [if items]
> [then]
> [item-list]
> [sql type=list query="SELECT sub_length, sub_type, sub_newrenew,
> issues_per_year, sug_retail_price,
> our_retail_price,special_instructions_for_customers FROM product_term
> WHERE product_id = '[item-code]'"]
> ...
> ...
> 
> ...but I'm thinking that there may be a better, more efficient way of
> retrieving product info. Something that wouldn't require that I do this SQL
> SELECT statement again (because the same SQL is done when displaying product
> information using flypage).

  heheh... If I were to do this I'd pull down the basket (an array of hashes)
do a single query of all the product codes, and then push this info into those
hashes and put it back to the session. Only doing it again for cart items
that don't have the info set... however... this is NOT vanilla minivend :) 
I don't even think it follows the safe restrictions so you'd have to do it
with either the realperl tag (from a month or two ago) or with a globalsub.
Either way means overloading Mike's basket. 

  The other way, which would probably work as well... is to save this data 
somewhere in a session hash keyed off the item code. Something like
$Session{items}{[item-code]} = [ array or hash of interesting info ];
and then add stuff to the basket printout to read and display this.

  Probably the best place to put the cde for this is on the basket page just 
above the basket code itself.

					- Ant

-- 

Anthony Ball                                                ant@maine.com
MaineStreet Communications, Inc        208 Portland Road, Gray, ME  04039
tel:1.207.657.5078         fax:1.207.657.5048       http://www.maine.com/


Search for: Match: Format: Sort by: