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>



All times are GMT -8. The time now is 11:21 PM.

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