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)
-   -   Display manufacturer logo in product.tpl (https://forum.x-cart.com/showthread.php?t=22026)

chamberinternet 05-24-2006 02:49 AM

Display manufacturer logo in product.tpl
 
Hello ...

Is it possible to display the manufacturers logo within the product details page (product.tpl) for the selected product.

Thanks & Regards

Shafiq :sK

balinor 05-24-2006 02:50 AM

http://forum.x-cart.com/viewtopic.php?t=11767

chamberinternet 05-24-2006 07:22 AM

Thanks ...

I got around it .. but required a little tweaking for it to work in version 4.1.0:


Added the following code within product.php:
Quote:

$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]["manufacturer"]);
$smarty->assign("m_image_path", $manufacturer[0]["image_path"]);


And then added the following within product.tpl
Quote:

{if $m_image_path ne ""}
[img]{$m_image_path}[/img]{/if}
{/if}


Regards


Shafiq :sK

version 08-20-2008 03:38 AM

Re: Display manufacturer logo in product.tpl
 
can this be done easily in 4.1.10 ?

Is there a nice free module or some additional core function available?

Piotr M. 08-20-2008 04:00 AM

Re: Display manufacturer logo in product.tpl
 
Quote:

Originally Posted by version
can this be done easily in 4.1.10 ?

Is there a nice free module or some additional core function available?

Yes. This can be done in 4.1.10 the same way as shown above.

version 08-20-2008 04:21 AM

Re: Display manufacturer logo in product.tpl
 
Do you think it's not working for me because of the typo ?

$thisManufactorer <-

$thisManufacturer ?? how are we supposed to use code with variable variables?

Piotr M. 08-20-2008 04:38 AM

Re: Display manufacturer logo in product.tpl
 
Quote:

Originally Posted by version
Do you think it's not working for me because of the typo ?

$thisManufactorer <-

$thisManufacturer ?? how are we supposed to use code with variable variables?


There is the same variable name in SQL query.
But table name is case sensitive.
So right php code is
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]["manufacturer"]);
$smarty->assign("m_image_path"$manufacturer[0]["image_path"]); 


tpl code to show manufacturer logo
Code:

{if $m_image_path ne ""}
<img src="{$m_image_path}" />{/if}


version 08-20-2008 05:08 AM

Re: Display manufacturer logo in product.tpl
 
couldn't someone add a function to the core of X-Cart like:

get_manufacturers_image();

these functions are pretty standard in most free systems - eg wordpress, which is so easy to customise compared to X-Cart

why are these convenient functions noticably absent from x-cart?

also the manufacturers module is not really worthy of the term module is it?

shouldn't there be a few more options like:
• show manufacturers logo on product pages √
• show next / previous product navigation by same manufacturer √
• show related manufacturers √ (if part of same parent company)
• show plain word link below logo √
etc...

Where are these options? - why aren't they standard?

version 08-20-2008 05:58 AM

Re: Display manufacturer logo in product.tpl
 
I don't know much php but this looks like relevant code?

$manufacturer['image_path'] = func_get_image_url($manufacturerid, "M", $manufacturer['image_path']);


So can anyone tell me how to get the url to the manufacturer for a given product?

I've got the logo displaying - but i want it to be an active link (why wouldn't I????)

I just need to get the $manufacturerid variable to work (this example below is for a plain text link - not the logo version / but easily transferable)

HTML Code:

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

what am i doing wrong here?

Thanks

Piotr M. 08-20-2008 06:24 AM

Re: Display manufacturer logo in product.tpl
 
The code below shows manufacturer logo as active link. If there is no logo, it shows manufacturer name.
Modified PHP:
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"]); 

TPL
Code:

<a href="manufacturers.php?manufacturerid={$manufacturer.manufacturerid}">
{if $m_image_path ne ""}
<img src="{$m_image_path}" />{else}{$manufacturer.manufacturer}{/if}</a>


version 08-20-2008 06:05 PM

Re: Display manufacturer logo in product.tpl
 
{$manufacturer.manufacturerid}

I'm getting the first letter of the manufacturer instead of the ID

http://myshop.com/manufacturers.php?manufacturerid=C (wrong)

instead of:

http://myshop.com/manufacturers.php?manufacturerid=2 (correct)

any other ideas how to get the current manufacturers id?

these smarty functions are just not intuitive - even "Advanced Member"s get the basics wrong...
can we re-write them in plain php like wordpress does?

Piotr M. 08-20-2008 11:53 PM

Re: Display manufacturer logo in product.tpl
 
version,
check if you've modified php code according to my previous post.
Having first letter instead of manufacturerid takes place with code from post #7. Modified code is in post #10.

version 08-21-2008 12:10 AM

Re: Display manufacturer logo in product.tpl
 
thanks - works perfectly

version 08-23-2008 11:23 PM

Re: Display manufacturer logo in product.tpl
 
well almost perfect....

where can i specify the order?
at the moment it is by id
i would like it to be alphabetical

also what options do we have when the page get's full?
a few list display options in the module settings would be good:
- pagination
- anchor link list (by first letter)
- scroller/carousel

gotpump 11-09-2008 12:12 PM

Re: Display manufacturer logo in product.tpl
 
where in product.php should this code line be located

7thdesire 06-13-2010 01:16 AM

Re: Display manufacturer logo in product.tpl
 
i can confirm this code works in 4.3.2

but i used {$product.manufacturer} to display name if no image is there


All times are GMT -8. The time now is 05:17 AM.

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