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)
-   -   help displaying hidden products SKU. (https://forum.x-cart.com/showthread.php?t=61073)

plnewton 09-30-2011 06:06 PM

help displaying hidden products SKU.
 
I've added this; {$hidden_products.productcode} to my customer_manufacturer_products.tpl , and inside manufacturers.php I have added this 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);



Can someone explain why this won't work? How can I display my hidden product's SKU's FOR THIS MANUFACTURER ONLY? Which files do I need to edit? What do I need to do? Someone, please help me! Thank you.

rogue 10-01-2011 06:37 AM

Re: help displaying hidden products SKU.
 
Then on the TPL where you want to show them you need something like:

{foreach from=$hidden_products.products item=v key=k)}
{$v<br>}
{/foreach}

cflsystems 10-01-2011 06:52 AM

Re: help displaying hidden products SKU.
 
In manufacturers.php before // Assign the current location line

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);

}


In the tpl where need to show result

Code:

{foreach from=$hidden_products item=i}
 
SKU: <a href="product.php?productid={$i.productid}">{$i.productcode}</a>
<br />
 
{/foreach}


Note that the way you started it this will work only if you go to any manufacturer page otherwise the code will just not execute and hidden_products array will be empty so nothign to show

plnewton 10-01-2011 01:46 PM

Re: help displaying hidden products SKU.
 
Very cool! I think I understand more about x-cart now. Thank you so much for your help!!!!!!!!!!!!!!


All times are GMT -8. The time now is 02:48 PM.

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