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)
-   -   Show manufacturer on products_t (https://forum.x-cart.com/showthread.php?t=67761)

digiscraps 09-15-2013 06:38 AM

Show manufacturer on products_t
 
Code:

{if $product.manufacturer ne ""}
Other products from <a href="manufacturers.php?manufacturerid={$product.manufacturerid}"><b>{$product.manufacturer}</b></a>
{/if}


I can use this code perfectly on my product_details page but not on my products_t page. Any ideas? I want to call up the manufacturer name automatically under the item name.

PhilJ 09-15-2013 07:50 AM

Re: Show manufacturer on products_t
 
It's been posted a few times, but here it is again...

products.php

Before...

Code:

$smarty->assign('cat_products',      isset($products) ? $products : array());

Insert...

Code:

# Get Product Manufacturer
if($products){
    foreach($products as $key=> $product)
        $products[$key]["manufacturerid"] = func_query_first_cell("SELECT manufacturerid FROM $sql_tbl[manufacturers] WHERE manufacturerid=" . $product["manufacturerid"]);
        $products[$key]["manufacturer"] = func_query_first_cell("SELECT manufacturer FROM $sql_tbl[manufacturers] WHERE manufacturerid=" . $product["manufacturerid"]);
}
# /Get Product Manufacturer


Then in...

skin/common_files/customer/main/products.tpl
skin/common_files/customer/main/products_t.tpl

Insert...

Code:

{if $product.manufacturer}
<p><a href="manufacturers.php?manufacturerid={$product.manufacturerid}">{$product.manufacturer}</a></p>
{/if}


You'll also need to add the PHP code to search.php

Before...

Code:

// Assign the current location line
$smarty->assign('location', $location);


digiscraps 09-15-2013 04:53 PM

Re: Show manufacturer on products_t
 
Thank you for posting this. It works... sort of. The manufacturer is only showing up on the last product on the page?

Also where should I be putting the {if statement in the products.tpl exactly? I've got it in place where I want it on the products_t.

If you go here: http://scrapseeds.com/shop/home.php?shopkey=975 then click "Alphas" at the top you will see what is happening.

Many thanks!!

digiscraps 09-16-2013 05:59 PM

Re: Show manufacturer on products_t
 
Any ideas? Our store is going live soon. Thanks!!

cherie 09-16-2013 07:17 PM

Re: Show manufacturer on products_t
 
Quote:

Originally Posted by PhilJ
PHP Code:

# Get Product Manufacturer
if($products){
    foreach(
$products as $key=> $product)
        
$products[$key]["manufacturerid"] = func_query_first_cell("SELECT manufacturerid FROM $sql_tbl[manufacturers] WHERE manufacturerid=" $product["manufacturerid"]);
        
$products[$key]["manufacturer"] = func_query_first_cell("SELECT manufacturer FROM $sql_tbl[manufacturers] WHERE manufacturerid=" $product["manufacturerid"]);
}
# /Get Product Manufacturer 


The above is not correct. This should work better:
PHP Code:

if($products)
    foreach(
$products as $key=> $product
        
$products[$key]['manufacturer'] = func_query_first_cell("SELECT manufacturer FROM $sql_tbl[manufacturers] WHERE manufacturerid=$product[manufacturerid]"); 

I believe you should already have the list of all manufacturers so there should be no need to do a query to get them. In theory:
PHP Code:

{if $product.manufacturerid}
  {foreach 
from=$manufacturers_menu item=m}
    {if 
$m.manufacturerid eq $product.manufacturerid}
      <
p><a href="manufacturers.php?manufacturerid={$product.manufacturerid}">{$m.manufacturer|amp}</a></p>
    {/if}
  {/foreach}
{/if} 


digiscraps 09-17-2013 07:17 PM

Re: Show manufacturer on products_t
 
Thank you once again cherie!! This worked great!


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

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