Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Access $product from Static Page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-05-2013, 10:09 AM
 
RLLC RLLC is offline
 

Newbie
  
Join Date: Jul 2007
Posts: 4
 

Default Access $product from Static Page

Hello,

What do I need to import to be able to access $product from a static page? More specifically, I'm trying to access the smarty tag variable {$product.productcode}...

Thanks!
__________________
X-Cart Gold 4.4.5
Reply With Quote
  #2  
Old 09-05-2013, 01:23 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Access $product from Static Page

You will need to query it in pages.php or you won't have access to it.
Reply With Quote
  #3  
Old 10-30-2013, 07:00 AM
 
cheap eyeglasses cheap eyeglasses is offline
 

Senior Member
  
Join Date: Oct 2010
Posts: 144
 

Default Re: Access $product from Static Page

how to do then? pls share your code here!
Reply With Quote
  #4  
Old 10-31-2013, 06:57 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

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

Default Re: Access $product from Static Page

To pull in a product array, I typically use the function func_search_products

Here is an example from a module I am building for a client, it refernces some non-standard x-cart tables so won;t work for you, but it should get the juices flowing and point you in th right direction:
PHP Code:
$product_kit_items func_search_products(
    array(
        
'fields'        => array("$sql_tbl[products].*""$sql_tbl[product_kit_items].*"),
        
'from_tbls'     => array('product_kit_items'=>''),
        
//'skip_tables'   => XCSearchProducts::getSkipTablesByTemplate(XCSearchProducts::SKIP_ALL_POSSIBLE),
        
'query'         => " AND $sql_tbl[products].productid = $sql_tbl[product_kit_items].productid AND $sql_tbl[product_kit_items].parentid = '$productid'",
    ),
    
$user_account['membershipid'],
    
"$sql_tbl[product_kit_items].orderby, product",
    
"",
    
false,
    
false,
    
true
); 
__________________
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
  #5  
Old 03-24-2014, 04:24 AM
 
sinobest sinobest is offline
 

X-Adept
  
Join Date: Nov 2009
Posts: 462
 

Default Re: Access $product from Static Page

how to add the above code, pls?
__________________
X-Cart Version: 4.7.12 GOLD
www.cheapglasses123.com prescription glasses online at discounted prices.
prescriptionglassesusa.com
www.loupesusa.com X-Cart Version: 4.7.11 GOLD PLUS
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:00 AM.

   

 
X-Cart forums © 2001-2020