View Single Post
  #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