View Single Post
  #16  
Old 10-03-2011, 06:01 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: display names of hidden products?

If it's displaying "Array" that is a good sign! It means that your data is being found, and that the variable &hidden_products is initialized.

You need to search the web for some understanding of arrays in php, and how to access those arrays through smarty.

Lets look at the query: SELECT *

This means select everything. So it when it finds a row in the DB table xcart_products WHERE the column forsale = H it is going to add the contents of that row into your array. Array are indexed automatically using numbers.

A simple array would just have one row's contents in it, ie {$hidden_products.product} would correspond to the contents of the porduct column in the DB table. What this query is creating is a multidimensional array because there are multiple rows. The first row of a multidimensional array is usually 0 then 1,2,3 etc.

Now to get data from the multidimensional array we need to loop through each row.
Code:
{foreach from=$hidden_products item=$hproducts} Name ={$hproducts.product} Sku ={$hproducts.productcode} {/foreach}

HTH,
-Mike

EDIT: oops it looks like you got it, I was responding to your PM, and didn't read further in the thread.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote