Retrieving product fields by using SKU?

General ShopSite user discussion

Retrieving product fields by using SKU?

Postby CarolA » Sat Feb 09, 2008 9:56 pm

Hi. I'm converting my store from Mercantec SoftCart to ShopSite. In SoftCart you could retrieve associated values for a product such as price, description, etc by using a tag with the SKU. I know how to get the product price using PRODUCT.Price, but that is within the ShopSite generated loop that's displaying all the products assigned to that page. I want to be able to place a link to a product on any page, and pull the item's price automatically from the database, not hard-code it. Something like using the variable sku1.price to get the current price for item sku1. Can you do this in ShopSite? I've looked everywhere in the documentation and don't find anything...

If you want to know "why", I want to have complete control over the pages that contain a list of items with item name, price and thumbnail image - that links to the more info page. I need to control what order the items list in, by the type of item - pants together, shorts together, etc, without placing them on separate pages. But I'd like to just use the SKU, and then grab the associated data and image for that SKU. So, if I change that information in the database such as item name, price, picture, I don't have to change my page too. Does that make sense?

Thanks in advance.
CarolA
 
Posts: 70
Joined: Thu Nov 29, 2007 2:59 pm
Location: Utah

Postby Jim » Sat Feb 09, 2008 10:53 pm

There is no built in way to pull product information based on sku. Internally all reference to product data during page generation are done based on the product database record number. So when you assign a product to a page only the product record number is kept in the page table that is used to display the items on that page, it won't know what the SKU for the product is.

In the Pro level of ShopSite you can sort products (Pages > Edit Page Layout > Page Arrangement Settings ) on the page based on SKU. So if your SKUs are in some sort of sequence for pants, shorts, etc then using the sort by SKU would put all the related items together on the page.

You could also use one of the Extra product fields to contain a descriptor of the product type (i.e. pants, shorts, etc) and in the page template do multiple Loop Product sections using a VAR to set the section type and check for the descriptor for that section of the page and only output the products that match.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby CarolA » Sun Feb 10, 2008 7:16 am

Thanks Jim! I will be using Pro. Unfortunately, the SKU's weren't named to accommodate that sorting and we already have a large # of items, all in our backend database too.

I like your last loop idea - that would work. But, before I completely give up on what I'm used to doing - you mention ShopSite using record number in your first paragraph. Is record# accessible for me to use instead of SKU to access item information?
CarolA
 
Posts: 70
Joined: Thu Nov 29, 2007 2:59 pm
Location: Utah

Postby Jim » Mon Feb 11, 2008 10:17 am

You can get the record number by downloading the products in either a tab delimited format or xml format and looking at the Product ID value .

I don't think there is any easy way to use that value when generating pages though unless you are doing them all by hand.

The "Custom Pages" (not Custom Templates) functionality in ShopSite did use the record number for pulling information from the database but you had to manually create all the pages and specify the record number for what products where where on the page. This functionality is no longer being developed and is replaced by Custom Templates which were introduced in ShopSite 6 or so. It is still in the product under Merchandizing > Custom Page and may work but I have not tested it with the later version of ShopSite.

You can have complete control over the look and placement of products using Custom Templates so I would strongly encourage you to go that way instead of trying to manually create all of your pages. It does take a little time to get custom templates developed but once they are done it eliminates the need to hand code pages in your store.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby CarolA » Mon Feb 11, 2008 1:09 pm

Thanks Jim.
CarolA
 
Posts: 70
Joined: Thu Nov 29, 2007 2:59 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: No registered users and 76 guests