X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   display names of hidden products? (https://forum.x-cart.com/showthread.php?t=61047)

plnewton 09-28-2011 06:17 PM

display names of hidden products?
 
Is there anyway to create another products_t.tpl, and somehow display products that are currently "hidden"? I want to make a list of these, and display them. Is that possible?

also, it needs to be linked via href and do a search and use SKU field as the search string. Is this possible?

cflsystems 09-29-2011 04:39 AM

Re: display names of hidden products?
 
Yes it is possible. It will require php and template changes. I can get this done for you, you can email me at the email in my signature

plnewton 09-29-2011 02:06 PM

Re: display names of hidden products?
 
instead of soliciting on this forum, do you mind helping a fellow programmer out?

cflsystems 09-29-2011 02:40 PM

Re: display names of hidden products?
 
Wow. Thank you very much. Now I almost don't wanna help you. You asked if it's possible, I answered - yes it is possible. You need to edit search.php and query the hidden products, assign the result so smarty and call the template you want to use to show result

plnewton 09-29-2011 03:03 PM

Re: display names of hidden products?
 
How do I go about listing the hidden products on say a products_t.tpl? What code would I use to display hidden products?

plnewton 09-29-2011 03:04 PM

Re: display names of hidden products?
 
How do I edit search.php to query the hidden products? Sorry, I'm new to this, and your response of hiring you once pretty quick. If you help me out, I'll be sure to turn to you for advice or hiring in the future. I hardly know this stuff yet.

totaltec 09-30-2011 01:43 AM

Re: display names of hidden products?
 
Don't piss Steve off, it will come back to haunt you.....:)

Do you want to do this in a category, or in featured products?

The logic here would be to query the database for the table xcart_products.
In your php file:
Code:

$newtons_query = "SELECT * FROM $sql_tbl[products] WHERE forsale = 'H' ";
$hidden_products = func_query($newtons_query);
//Assign the hidden_products variable (array)
$smarty->assign('hidden_products', $hidden_products);

--Untested

The best way to see what is getting included in your assigned variable is to use webmaster mode, in the variables view of the debug window.

plnewton 09-30-2011 12:26 PM

Re: display names of hidden products?
 
I'm wanting to duplicate products_t.tpl to say products_t_rightside.tpl, include this file into customer_manufacturer_products.tpl, and display those hidden products on products_t_rightside.tpl....


Then, when one of the hidden products is clicked on, I want it to run a search for the SKU number OF that hidden product that's shown and has a link for it. - Is this possible?

plnewton 09-30-2011 12:50 PM

Re: display names of hidden products?
 
Where do I paste this code? Which file? Search.php? ;
$newtons_query = "SELECT * FROM $sql_tbl[products] WHERE forsale = 'H' "; $hidden_products = func_query($newtons_query); //Assign the hidden_products variable (array) $smarty->assign('hidden_products', $hidden_products);

plnewton 09-30-2011 02:49 PM

Re: display names of hidden products?
 
I added ;
$newtons_query = "SELECT * FROM $sql_tbl[products] WHERE forsale = 'H' "; $hidden_products = func_query($newtons_query); //Assign the hidden_products variable (array) $smarty->assign('hidden_products', $hidden_products);

to manufacturer.php,

then i did {$hidden_products}, but all it's displaying is "Array". Am I doing this wrong? Please help!

plnewton 09-30-2011 03:08 PM

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.

plnewton 09-30-2011 05:15 PM

Re: display names of hidden products?
 
Actually, I want to display the hidden product's SKU. Can I do this?

plnewton 09-30-2011 05:19 PM

Re: display names of hidden products?
 
I tried using $hidden_products.productcode , but it does not seem to work, or display?

plnewton 09-30-2011 05:30 PM

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???

plnewton 10-01-2011 01:48 PM

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}

totaltec 10-03-2011 06:01 AM

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.

JWait 10-03-2011 06:54 AM

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.


All times are GMT -8. The time now is 12:56 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.