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

Manufacturer Name in products_list.tpl

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-10-2011, 11:58 AM
 
jeremyScott jeremyScott is offline
 

Advanced Member
  
Join Date: Dec 2008
Posts: 39
 

Default Manufacturer Name in products_list.tpl

Hello, I'm trying to display the manufacturer name in products_list.tpl
I am able to grab the manufacturer id using:
PHP Code:
{$product.manufacturerid
But the manufacturers name isn't a part of that array.


Using this:
PHP Code:
{$manufacturer[$product.manufacturerid].manufacturer
I'm able to grab a manufacturer name, its just not the correct name because manufacturerid is static and the manufacturer array is index based on your admin sort settings.


**Note, this is for a 'Category' page or 'Search Result' page. I have access to the manufacturer name when I click on one of the 'Manufacturer' links in the side panel using:
PHP Code:
{$manufacturer.manufacturer
__________________
X-Cart version 4.3.2
Reply With Quote
  #2  
Old 03-12-2011, 06:35 AM
 
7thdesire 7thdesire is offline
 

Senior Member
  
Join Date: Sep 2006
Posts: 115
 

Default Re: Manufacturer Name in products_list.tpl

use

product.php add

$thisManufactorer = $product_info["manufacturerid"];
$manufacturer = func_query("SELECT * FROM $sql_tbl[manufacturers] WHERE manufacturerid = $thisManufactorer");
$smarty->assign("manufacturer", $manufacturer[0]["manufacturer"]);

in template use
{$product.manufacturer}


in 4.3 i am not sure if you need todo the php anymore but this works for me on tacksales
__________________
X-cart - 4.3.2 loads of mods and custom code
Reply With Quote
  #3  
Old 03-12-2011, 12:14 PM
 
jeremyScott jeremyScott is offline
 

Advanced Member
  
Join Date: Dec 2008
Posts: 39
 

Default Re: Manufacturer Name in products_list.tpl

hmmm, tried that with no luck.
I realized that I have a table prefix of xcart_ on all of my tables, so I made the change in the 2nd line of your code, but still haven't had any luck.

PHP Code:
$thisManufactorer $product_info["manufacturerid"];
$manufacturer func_query("SELECT * FROM $sql_tbl[xcart_manufacturer] WHERE manufacturerid = $thisManufactorer");
$smarty->assign("manufacturer"$manufacturer[0]["manufacturer"]); 

Also, I wasn't getting any sort of feedback that this was even working until I put this code in 'products.php' not 'product.php'. When I put it in products.php I was getting this error;
Code:
INVALID SQL: 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE manufacturerid = ''' at line 1 SQL QUERY FAILURE:SELECT * FROM WHERE manufacturerid = ''

I tried wrapping $thisManufactorer in quotes but that didn't help either.
__________________
X-Cart version 4.3.2
Reply With Quote
  #4  
Old 03-12-2011, 12:39 PM
 
7thdesire 7thdesire is offline
 

Senior Member
  
Join Date: Sep 2006
Posts: 115
 

Default Re: Manufacturer Name in products_list.tpl

okay use the following

BEFORE in Product.php

PHP Code:
# Assign the current location line
$smarty->assign("location"$location); 

ADD

PHP Code:
$thisManufactorer $product_info["manufacturerid"];  
$manufacturer func_query("SELECT xcart_manufacturers.*, xcart_images_M.image_path, xcart_images_M.filename FROM xcart_manufacturers, xcart_images_M WHERE xcart_manufacturers.manufacturerid = xcart_images_M.id AND manufacturerid = $thisManufactorer");  
$smarty->assign("manufacturer"$manufacturer[0]);  
$smarty->assign("m_image_path"$manufacturer[0]["image_path"]); 


and the following in you template

PHP Code:
{$manufacturer.manufacturer


to show logo and link to manu in product page add the following to the template (extra option)

PHP Code:
<a href="manufacturers.php?manufacturerid={$product.manufacturerid}"> <img src="image.php?id={$product.manufacturerid}&type=M " alt="{$manufacturer}/></a
__________________
X-cart - 4.3.2 loads of mods and custom code
Reply With Quote

The following user thanks 7thdesire for this useful post:
yehudah (08-04-2011)
  #5  
Old 03-12-2011, 02:06 PM
 
jeremyScott jeremyScott is offline
 

Advanced Member
  
Join Date: Dec 2008
Posts: 39
 

Default Re: Manufacturer Name in products_list.tpl

Still not working, I tried changing everything up that I could and still nothing.

{$manufacuter.manufacturer} was working on the manufacturer page, but it was always working on that, so I don't think it was any different.
I tried assigning to a different variable name like {$manufacuter.man1} and wasn't getting any data returned.
__________________
X-Cart version 4.3.2
Reply With Quote
  #6  
Old 03-12-2011, 02:44 PM
 
7thdesire 7thdesire is offline
 

Senior Member
  
Join Date: Sep 2006
Posts: 115
 

Default Re: Manufacturer Name in products_list.tpl

i have

{$manufacturer.manufacturer}{$product.manufacturer }

in my products_t this allows me to show the name in manufacturer and products
__________________
X-cart - 4.3.2 loads of mods and custom code
Reply With Quote
  #7  
Old 11-13-2011, 04:50 PM
  XCart4Life's Avatar 
XCart4Life XCart4Life is offline
 

Advanced Member
  
Join Date: Feb 2010
Posts: 62
 

Default Re: Manufacturer Name in products_list.tpl

I found a solution for X-Cart 4.4.4 and posted it here: http://forum.x-cart.com/showthread.php?t=61592
__________________
X-Cart Pro v4.2.2 [Win]
X-Cart Pro v4.2.3 [Win]
X-Cart Pro v4.4.4 [Win]
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 01:28 AM.

   

 
X-Cart forums © 2001-2020