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

Show manufacturer on products_t

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-15-2013, 06:38 AM
 
digiscraps digiscraps is offline
 

Member
  
Join Date: Sep 2013
Posts: 18
 

Default 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.
__________________
X-Cart 4.5.2 Pro

Mods:
AlteredCart Download Expander
AlteredCart On Sale
Reply With Quote
  #2  
Old 09-15-2013, 07:50 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default 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);
__________________
xcartmods.co.uk
Reply With Quote
  #3  
Old 09-15-2013, 04:53 PM
 
digiscraps digiscraps is offline
 

Member
  
Join Date: Sep 2013
Posts: 18
 

Default 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!!
__________________
X-Cart 4.5.2 Pro

Mods:
AlteredCart Download Expander
AlteredCart On Sale
Reply With Quote
  #4  
Old 09-16-2013, 05:59 PM
 
digiscraps digiscraps is offline
 

Member
  
Join Date: Sep 2013
Posts: 18
 

Default Re: Show manufacturer on products_t

Any ideas? Our store is going live soon. Thanks!!
__________________
X-Cart 4.5.2 Pro

Mods:
AlteredCart Download Expander
AlteredCart On Sale
Reply With Quote
  #5  
Old 09-16-2013, 07:17 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default 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} 
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote

The following user thanks cherie for this useful post:
PhilJ (09-18-2013)
  #6  
Old 09-17-2013, 07:17 PM
 
digiscraps digiscraps is offline
 

Member
  
Join Date: Sep 2013
Posts: 18
 

Default Re: Show manufacturer on products_t

Thank you once again cherie!! This worked great!
__________________
X-Cart 4.5.2 Pro

Mods:
AlteredCart Download Expander
AlteredCart On Sale
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 03:28 PM.

   

 
X-Cart forums © 2001-2020