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)
-   -   Mfr. Image if No Product Image in Listing Results (https://forum.x-cart.com/showthread.php?t=21941)

B00MER 05-20-2006 07:28 AM

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}

jdedba 05-20-2006 11:06 AM

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.

carlisleglass 02-05-2007 02:06 AM

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

codyphobia 11-15-2008 07:35 AM

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


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

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