X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   get manufacture in products.php (https://forum.x-cart.com/showthread.php?t=10007)

august 05-15-2005 12:56 PM

Ok I got it:
instead of

Quote:

[img]mlogo.php?manufacturerid={$manufacturerid.manufact urerid}[/img]

It should be:

Quote:

[img]{$xcart_web_dir}/mlogo.php?manufacturerid={$product.manufacturerid} [/img]


dmr8448 05-15-2005 04:59 PM

Manfacturer Name and Link in Products List
 
I am trying to get the manfucturer name to display on the products listing page. I have done the following:

==========================================

Make a new function in func.php
Code:
function func_get_manufacturers($manufacturerid) {
global $sql_tbl;

return func_query("SELECT $sql_tbl[manufacturers].* FROM $sql_tbl[manufacturers] WHERE manufacturerid='$manufacturerid'");
}


In products.php
Code:
if ($products) {
foreach ($products as $k => $v)
$manufacturers[] = func_get_manufacturers($v["manufacturerid"]);
}

$smarty->assign("manufacturers", $manufacturers);


In products.tpl just use
Code:
{*** ########## Lines below to display manufacture name ########## ***}
{assign var="manid" value=$products[product].manufacturerid}
{if $manufacturers[$manid].manufacturerid ne "0"}
<FONT class="ItemsList">{$manufacturers[$manid].manufacturer}</FONT>

{/if}
{*** ########## End display manufacture name ########## ***}

==========================================

The problem I am having is the the link shows the incorrect manufacturer name, but when I click on the link it takes me to the correct manufacturer page.

Thanks
David

X-Cart version 4.0.12
PHP 4.3.10
MySQL server 4.0.23-nt-max
MySQL client 3.23.49
Web server Microsoft-IIS/6.0
Operation system Windows
XML parser (expat) 1.95.6

august 05-15-2005 07:36 PM

This is the way it works for me:

In product.php before the smarty assigns

Quote:

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


In product.tpl you have to play different positions that you'll like to see it display
You can use this one:
Quote:

<tr><TD align="left" valign="top">
Producer:

</td>
<TD align="left" valign="top">
{$manufacturer}
<font size=1 face=Arial>(click to get all products from this brand)</font>

</td>
</tr>


or you can use yours.

Forget about the func.php

davros 05-16-2005 07:08 AM

Hello
I've been working my way through this thread and managed to get the manufacturer displaying items on the product page (product.tpl) and the product list (products.tpl) - thanks very much to pmstudios and jds580s for that. You've helped me get my head round xcart quite a bit with your posts.

However, I can only get the manufacturer to display per product. In fact I want to display all the products for a manufacturer. I think this might need to be done in products_t.tpl but I can't really work out what's going on in there.

In fact I really want the manufacturer to be a subcategory but that doesn't seem to be an option. Any help with this would be greatly appreciated.

Davros

august 05-16-2005 09:12 AM

You mean:
http://www.your-domain.com/manufacturers.php

davros 05-16-2005 09:54 AM

No - manufacturers.php just gives a list of _all_ manufacturers. I want to list the items by manufacturer for each category.
So when I go to home.php?cat=1
I want
Category 1
Manufacturer 1
item 1
item 3
Manufacturer 2
item 2
item 4
item 5
etc

At the moment I get
Category 1
item 1 - manufacturer 1
item 2 - manufacturer 2
item 3 - manufacturer 1
item 4 - manufacturer 2
item 5 - manufacturer 2

Does that make sense?

august 05-17-2005 01:06 PM

You can do that manually, you create the category, your subcategories will be the name of the manufacturers or brands, and then you assign the products to each one, also you can put a logo to each of the subcategories(brands). Also you can use one of the mod's that handle subcategories for your products presentation.
Hope this help.

finestshops 05-25-2005 07:39 AM

Re: Manfacturer Name and Link in Products List
 
Quote:

Originally Posted by dmr8448
The problem I am having is the the link shows the incorrect manufacturer name, but when I click on the link it takes me to the correct manufacturer page.


Just a summary of things we did to show manufacturer name in the list of products (thanks to pmstudios and jds580s)

add to include/func.php

Code:

#
# Function to get manufacturers into product list
#
function func_get_manufacturers($manufacturerid) {
global $sql_tbl;

return func_query("SELECT $sql_tbl[manufacturers].* FROM $sql_tbl[manufacturers] WHERE manufacturerid='$manufacturerid'");
}



in products.php

before this line:

Code:

$smarty->assign("products",$products);

add

Code:

#
# Get products manufacturers
#
if ($products) {
foreach ($products as $k => $v)
$manufacturers[] = func_get_manufacturers($v["manufacturerid"]);
}
$smarty->assign("manufacturers", $manufacturers);
#
# Get products manufacturers



in customer/main/products.tpl or customer/main/products_t.tpl:

after

Code:

<FONT class="ProductTitle">{$products[product].product}</FONT></A>

add

Code:

{* show Manufacturer name *}


<FONT class="sitesmall">Manufacturer:
{assign var="manid" value=$products[product].manufacturerid}
{if $manufacturers[$manid].manufacturerid ne "0"}
{$manufacturers[$manid].manufacturer}
{/if}
{* show Manufacturer name *}


Example is here:

http://www.reach4life.com/store/home.php?cat=554

august 05-26-2005 01:35 PM

Hey 27stars, I'm glad that you convinced them to change to x-cart. I used to have their old shopping cart too.

btomasie 06-26-2005 06:15 PM

I cannot get this code to work for me. I have followed all the different variations that many of you have placed in this thread, but can't any of them to work.

Here is my thread, any help would be appreciated!
http://forum.x-cart.com/viewtopic.php?t=20524

Brian


All times are GMT -8. The time now is 11:46 AM.

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