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

Mfr. Image if No Product Image in Listing Results

 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #1  
Old 05-20-2006, 07:28 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default Mfr. Image if No Product Image in Listing Results

First, this mod may need tweaking for the latest version (4.1.x) of X-Cart. It has been tested with latest (4.0.x) version however.

Within a product listing page, such as a Category page, or search results, etc. Attempt to use the products manufacturer's logo if no product thumbnail is found.

1) Edit include/search.php and locate:
Code:
$products[$k]["tmbn_url"] = func_get_thumbnail_url($v["productid"]);

2) Below the above found line add:
Code:
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # If no thumbnail found, attempt to use a manufacturer logo instead. # By Cart-Lab.com 5/20/2006 1:10AM # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= if($products[$k]["tmbn_url"]=="") { #$mfr = func_query_first("SELECT manufacturerid FROM xcart_products WHERE productid='$productid'"); $mfr = $products[$k]["manufacturerid"]; if($mfr) { $return = "mlogo.php?manufacturerid=".$mfr; $products[$k]["mfrthumb"] = $return; #return $return; } } # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

3) Edit skin1/product_thumbnail and replace its contents with:
Code:
{* $Id: product_thumbnail.tpl,v 1.14 2004/06/24 09:53:29 max Exp $ *} {if $config.Appearance.show_thumbnails eq "Y"} {** Cart-lab.com try to display mfr. thumb if no product image **} {if $mfrthumb && $tmbn_url eq ""}[img]{if $full_url}{$http_location}{else}{$xcart_web_dir}{/if}/{$mfrthumb}[/img] {else} {** Cart-lab.com try to display mfr. thumb if no product image **} [img]{if $tmbn_url}{$tmbn_url}{else}{if $full_url}{$http_location}{else}{$xcart_web_dir}{/if}/image.php?productid={$productid}{if $file_upload_data.file_path}&tmp=y{/if}{/if}[/img] {/if} {/if} {** Cart-lab.com try to display mfr. thumb if no product image **}

4) Next edit skin1/main/customer/products.tpl (or products_t.tpl) and locate:
Code:
{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url}

5) Replace the found code with:
Code:
{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url mfrthumb=$products[product].mfrthumb}
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #2  
Old 05-20-2006, 11:06 AM
 
jdedba jdedba is offline
 

Advanced Member
  
Join Date: Dec 2004
Posts: 96
 

Default

Thank you for the mod. I tested it in 4.1.1 and it did not work.

It seems to me that 4.1.1 does not have the mlogo.php file.
__________________
version 4.1.1
Reply With Quote
  #3  
Old 02-05-2007, 02:06 AM
  carlisleglass's Avatar 
carlisleglass carlisleglass is offline
 

eXpert
  
Join Date: Aug 2003
Location: Carlisle, UK
Posts: 316
 

Default Re: Mfr. Image if No Product Image in Listing Results

Here's the coding so it will work in v4.1.x branch (and its a lot easier, no need to edit any PHP files). I can confirm it works in v4.1.6 (Latest version).

1) Edit skin1/product_thumbnail.tpl and replace its contents with:
Code:
{* $Id: product_thumbnail.tpl,v 1.19 2005/11/17 06:55:36 max Exp $ *} {if $config.Appearance.show_thumbnails eq "Y"} {if $manufacturer && $tmbn_url eq ""}<img src="{if $full_url}{$http_location}{else}{$xcart_web_dir}{/if}/image.php?id={$manufacturer}&amp;type=M" {if $image_x ne 0} width="{$image_x}"{/if}{if $image_y ne 0} height="{$image_y}"{/if} alt="{$product|escape}"> {else} {if $thmb_url} <img src="{$tmbn_url}"> {else} <img {if $id ne ''} id="{$id}"{/if} src="{if $tmbn_url}{$tmbn_url}{else}{if $full_url}{$http_location}{else}{$xcart_web_dir}{/if}/image.php?type={$type|default:"T"}&amp;id={$productid}{/if}"{if $image_x ne 0} width="{$image_x}"{/if}{if $image_y ne 0} height="{$image_y}"{/if} alt="{$product|escape}" /> {/if} {/if} {/if}
2) In products.tpl add the following code just before the } at the end of the {include file="product_thumbnail.tpl" statement :
Code:
manufacturer=$products[product].manufacturers
__________________
Darren Kierman
Carlisle Glass (http://www.carlisleglass.co.uk/)
... running X-Cart Gold 4.4.5 [unix]
Reply With Quote
  #4  
Old 11-15-2008, 07:35 AM
 
codyphobia codyphobia is offline
 

Newbie
  
Join Date: Jun 2006
Location: Texas
Posts: 6
 

Default Re: Mfr. Image if No Product Image in Listing Results

Can this mod be edited to lookfor "productID.jpg" in a particular folder if the image doesnt exist instead of Man-Logo
__________________
Thanks,

Cody Riley
www.CodyRiley.com
www.KrazyElephant.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


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 06:19 AM.

   

 
X-Cart forums © 2001-2020