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)
-   -   Manufacturer Name in products_list.tpl (https://forum.x-cart.com/showthread.php?t=58418)

jeremyScott 03-10-2011 11:58 AM

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:


But the manufacturers name isn't a part of that array.

Using this:
PHP Code:


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:


7thdesire 03-12-2011 06:35 AM

Re: Manufacturer Name in products_list.tpl

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

in 4.3 i am not sure if you need todo the php anymore but this works for me on tacksales

jeremyScott 03-12-2011 12:14 PM

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

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;

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

I tried wrapping $thisManufactorer in quotes but that didn't help either.

7thdesire 03-12-2011 12:39 PM

Re: Manufacturer Name in products_list.tpl
okay use the following

BEFORE in Product.php

PHP Code:

# Assign the current location line


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

and the following in you template

PHP Code:


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

jeremyScott 03-12-2011 02:06 PM

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.

7thdesire 03-12-2011 02:44 PM

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

XCart4Life 11-13-2011 04:50 PM

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

All times are GMT -8. The time now is 02:44 AM.

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