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)
-   -   Provider username as a variable - working but won't display in product list? (https://forum.x-cart.com/showthread.php?t=65086)

loopsound 10-10-2012 06:36 AM

Provider username as a variable - working but won't display in product list?
 
Thanks to PhilJ I am now able to use the provider username as a variable in my product information however I am stuck when it comes to how to get it to display in the product list.

In product.php

Code:

$product_owner = addslashes($product_info['provider']);
if (!empty($product_owner)) {
    $provider_info = func_query_first("SELECT id, login, title, firstname, lastname FROM $sql_tbl[customers] WHERE id='$product_owner' AND usertype IN ('P','A')");
    $smarty->assign('provider_info', $provider_info);
}



then in product.tpl and products.tpl

Code:

{$provider_info.login}


But nothing displays in the product list only the product pages? Anyone know how adapt the following to make it display in the products list? I have contacted PhilJ but I am aware he is very busy at the moment

PhilJ 10-10-2012 07:10 AM

Re: Provider username as a variable - working but won't display in product list?
 
See below...

loopsound 10-10-2012 07:35 AM

Re: Provider username as a variable - working but won't display in product list?
 
Sorry Phil,

Placed code in products.php and {$product.login} in products_t.tpl and products_audio.tpl and the value returned just says "Array" ?

Anything else, I can try? Seems strange that X-Cart don't have this by default anyway.

PhilJ 10-10-2012 07:41 AM

Re: Provider username as a variable - working but won't display in product list?
 
ok, use...

Quote:

if($products) {
foreach($products as $key=> $product)
$products[$key]["login"] = func_query_first_cell("SELECT login FROM $sql_tbl[customers] WHERE id=".$product["provider"]);
}

And use {$product.login}

Tested and working.

loopsound 10-10-2012 07:55 AM

Re: Provider username as a variable - working but won't display in product list?
 
You star! Perfect! And now everyone will get the benefits of this :-)

Thanks so much


All times are GMT -8. The time now is 03:33 PM.

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