VP-ASP :: Shopping Cart Software

Shopping Cart Software Solutions for anywhere in the World

US/Canada(Toll Free): +1 888 587 2278
Europe/UK: +44 (020) 7193 9408
Australia/New Zealand: +61 3 9016 4497

VP-Cart StoreFront Customer Forum

Home | Profile | Register | Active Topics | Members | Search | FAQ
Save Password
Forgot your Password?

 All Forums
 VPCart Forum
 How to pull the price of a product out of the DB
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

40 Posts

Posted - April 05 2010 :  16:42:10  Show Profile  Reply with Quote
We're trying to figure out how to pull the price from the database for a product that is being displayed in a content page but just can't figure it out. So basically just looking for the code to pull the price of a product so it's always up to date in case the price changes, this way we don't have to update multiple pages after a price change.

We're using VPASP v7.

Thanks for any help!

Senior Member

United Kingdom
1898 Posts

Posted - April 05 2010 :  22:03:59  Show Profile  Visit devshb's Homepage  Reply with Quote
We tried doing something similar to this a few months ago on a 6.5 site, and from what I can gather (although I might be wrong) I think v7 has the same difficulty/solution in how you'd go about doing it.

What we needed to do was to display a given set of products on a content page, with those product details being retrieved dynamically when you loaded the content page. For example, you have a "new line of plasma tvs now out" content page, and you want to display that list of products within the content page in a similar format to how the frontpage sections look etc. We also needed that list to be dynamic too (so that new products added to that category get added to the content page automatically without you having to alter/regenerate the content page/data).

In the end the way we did it was to create a new template-field for "display products using this where clause...", got that template-field to call our product-showcase function (byz093), added the template field to the content template, and then specified the where clause on the content record.

That exact solution will only work if you want to show the product info above or below your content's main-html though (although it may be possible to add the template-field within the actual content html; i'm unsure if vpasp will process things in a secondary way if doing that, it may well do). If the product info needs to be within the main content html itself (ie not above/below it), and if vpasp v7 can't handle/process template-fields within a template-field that's already being processed, then you could get round it by creating yet another template-field specifically for content which gets the content html, looks for a reserved string which is similar to a template-field format, and then decodes your reserved string into the relevant call.

If you only need to show the products above/below the main content html then byz093 is what you're after and will work as-is (you'd just install it, and then read/do the "Usage Instructions (Calling Products ShowCase Functions from Templates, eg in content pages) :" readme file which explains what to do)

Whether you're trying to just get/show the price for a single product, or to show multiple products with lots of details, the same kind of problem/solution would apply.

It's all possible to do with a bit of addon/tweaking etc, but as far as I know it's not something that you can easily do. Having the logic mentioned above is a bit of a pain to initially setup, but once you've got all the code in place to do it you can then show any products you want on any content page you want in any format, and have all that done dynamically at browse-time (our where clauses that we stamped onto content records were category where clauses, ie to show all products within a given category, but if using this logic you could use any where clause you want).

See also:
BYZ093 - Product ShowCase (Enhanced Front-Page) Functions for VP-ASP:
(which is now vpaspv7 compatible, and also compatible with 4.5 to 6.5)

Simon Barnaby
[email protected]
Follow us on Twitter: http://twitter.com/bigyellowzone
Web Design, Online Marketing and VPASP addons

Edited by - devshb on April 05 2010 22:12:52
Go to Top of Page

Starting Member

40 Posts

Posted - April 12 2010 :  12:23:11  Show Profile  Reply with Quote
Seems like a LOT of work to just be able to pull the price of a product from the DB. I've worked with other carts in the past and this was a fairly simple thing to do. We're currently converting from another cart to VPASP v7, in the old cart we just put <%= FormatCurrency(getProductInfo("br4184625", 8))%> and it pulled the current price right from the DB, isn't there some code that can just do this? We don't use a currency converter so I would think that would make it easier.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000