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

display names of hidden products?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 09-30-2011, 03:08 PM
 
plnewton plnewton is offline
 

Advanced Member
  
Join Date: Sep 2011
Posts: 65
 

Default Re: display names of hidden products?

I also pasted that query to products.php, edited products_t_menu.tpl and added {$hidden_products} , and {include file="customer/main/products_t_menu.tpl"} on the customer_manufacturer_products.tpl, but this way is causing most of my template to become white, and doesn't display anything, it seems.
__________________
Version 4.4.3
Reply With Quote
  #12  
Old 09-30-2011, 05:15 PM
 
plnewton plnewton is offline
 

Advanced Member
  
Join Date: Sep 2011
Posts: 65
 

Default Re: display names of hidden products?

Actually, I want to display the hidden product's SKU. Can I do this?
__________________
Version 4.4.3
Reply With Quote
  #13  
Old 09-30-2011, 05:19 PM
 
plnewton plnewton is offline
 

Advanced Member
  
Join Date: Sep 2011
Posts: 65
 

Default Re: display names of hidden products?

I tried using $hidden_products.productcode , but it does not seem to work, or display?
__________________
Version 4.4.3
Reply With Quote
  #14  
Old 09-30-2011, 05:30 PM
 
plnewton plnewton is offline
 

Advanced Member
  
Join Date: Sep 2011
Posts: 65
 

Default Re: display names of hidden products?

I tried doing this on products.php, inside customer_manufacturer template i linked to main/products_t_menu.tpl, and all i get is blank results.



What is the best way to display the hidden product's SKU's???
__________________
Version 4.4.3
Reply With Quote
  #15  
Old 10-01-2011, 01:48 PM
 
plnewton plnewton is offline
 

Advanced Member
  
Join Date: Sep 2011
Posts: 65
 

Default Re: display names of hidden products?

The trick was going to manufacturers.php , and before

the current // assign the current location, add this code;

if ($manufacturerid) { // get hidden products array $hidden_products = func_query("SELECT * FROM $sql_tbl[products] WHERE forsale = 'H' AND manufacturerid = '$manufacturerid'"); //Assign the hidden_products variable (array) to smarty $smarty->assign('hidden_products', $hidden_products); }

then on my products_t_menu.tpl, I used this code;

{foreach from=$hidden_products item=i} SKU: <a href="product.php?productid={$i.productid}">{$i.pr oductcode}</a> <br /> {/foreach}
__________________
Version 4.4.3
Reply With Quote
  #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
  #17  
Old 10-03-2011, 06:54 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: display names of hidden products?

Just curious, why do you want to do this? Usually products that are hidden are hidden for a reason. Since they are "available for sale" all anyone would have to do is search for the SKU listed and find the product page (provided you have search by SKU enabled, which you probably should).

Not only that, but be aware that if the product was "available for sale" and not hidden at any point it will most likely still be listed by any search engine that found it at that time since the product page is still accessible.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
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 06:45 AM.

   

 
X-Cart forums © 2001-2020