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)
-   -   Seperate Thumbnail Image Uploads (https://forum.x-cart.com/showthread.php?t=9547)

deonya 09-24-2004 11:30 PM

Seperate Thumbnail Image Uploads
 
I have see a few people on the forum looking for a way to have a different image view from the thumbnail upload. Well I have something that might help them accomplish this.

In your <xcart_dir>/skin1/custom/main/product.tpl file, find the following part of code:

Code:

<TD valign="top" align="left" rowspan="2" width="100">
{include file="product_thumbnail.tpl" productid=$product.productid
image_x=$product.image_x image_y=$product.image_y product=$product.product
tmbn_url=$product.tmbn_url id="product_thumbnail"}
</TD>

and replace it with this:
Code:

<TD valign="top" align="left" rowspan="2">
{if $images.0.avail eq "Y"}
{if $images.0.tmbn_url}
[img]{$images.0.tmbn_url}[/img]
{else}
[img]{$xcart_web_dir}/product_image.php?imageid={$images.0.imageid}[/img]
{/if}
{else}
{include file="product_thumbnail.tpl" productid=$product.productid
image_x=$config.Appearance.thumbnail_width product=$product.product
tmbn_url=$product.tmbn_url id="product_thumbnail"}
{/if}
</TD>


This mod will make it so that on the product preview page instead of displaying the thumbnail again it will display the detailed image you upload. This will also create a small problem, your detailed image will be displayed on the page twice. To stop that from happening do this.

In your <xcart_dir>/skin1/modules/Detailed_Product_Images/product_images.tpl file replace the following:
Code:

{section name=image loop=$images}
with this
Code:

{section name=image loop=$images start=1}

Witch will make it skip over the first added detailed image and only display images added after the first.

If you decide not to upload a second detailed image the detailed image box will still appear with no content and you fix that by doing this.
In your <xcart_dir>/skin1/modules/Detailed_Product_Images/product_images.tpl file replace the following:
Code:

{if $images ne ""}
with this
Code:

{if $images ne "" and count($images) ne 1}

If done correctly when uploading a new product you can upload the thumbnail, then upload a detailed image to be displayed is the products main view, and you still have the ability to add more detailed images that will appear in the correct place.

I use this mod on my site now check it out the site is not compleat so theres only one product under logo templates.
http://www.pixellab.biz

Hope you all enjoy this as much as I did! :lol:

**MODERATOR EDIT - I have updated the code per the fix listed later in this post. Enjoy! - Padraic**

EnriqueHavoc 09-25-2004 12:13 AM

sweet! been looking for a way to do this for awhile, i will give it a try soon. very nice deonya!

deonya 09-25-2004 06:38 AM

Quote:

Originally Posted by EnriqueHavoc
sweet! been looking for a way to do this for awhile, i will give it a try soon. very nice deonya!


Glad to help!

mffowler 09-26-2004 09:49 AM

Deonya,

Thank you for providing this viable solution to the many workarounds. I have modified the tpls's with the code, but it receives a parse error when implementing:

Code:

{if $images ne ""}
with
Code:

{if $images ne "" and count($images) 1}

Quote:

Parse error: parse error, unexpected T_LNUMBER in /home/michael/public_html/store/templates_c/%%A2^A2B^A2BE44E9%%product_images.tpl.php on line 5

Ideas? Many thanks for your assistance.

- Mike

mffowler 11-03-2004 07:14 PM

Anyone know what the correct syntax of:

Code:

{if $images ne "" and count($images) 1}

I would love to be able to not have a blank detailed image box when there isn't a second one (per this post).
Thanks,

Mike.//

cotc2001 11-03-2004 11:09 PM

Very nice im going to try this , this mroning.

cotc2001 11-04-2004 12:16 AM

Bizzare, still just seems to show the thumbnail image, even though there is a detailed image uploaded (4.0.5)

mffowler 11-04-2004 05:51 AM

Works fine in all of my 4.x installs. Although without the image count code, you'll get a blank "Detailed Image" box when there is not a 2nd detailed image.

If you don't see anything, I suspect:

1. You product image is still scaling down to the desired thumbnail size or you only have 1 detailed image. You'll need three images for Deonya's code to be effective.

mike.//

cotc2001 11-04-2004 06:08 AM

K i'll try again.

Need to make it work with boomers tab mod as well

mustang 01-23-2005 06:35 PM

Quote:

Originally Posted by mffowler
Anyone know what the correct syntax of:

Code:

{if $images ne "" and count($images) 1}

I would love to be able to not have a blank detailed image box when there isn't a second one (per this post).
Thanks,

Mike.//


Deonya - Thanks! Works great!

One small error in the code is that last part that Mike noted above. The correct syntax of the last line should be
Code:

{if $images ne "" and count($images) ne 1}

(The last 'ne' was left out. :) )

Thanks again Deonya!

Khar 02-04-2005 06:08 PM

This is great mod. Thanks

I would love to move my description under my image if possible. As of now it shows up on the left and crunches my discription on the right.

Ryano 06-03-2005 10:41 PM

Excellent Mod! Thanks a lot for sharing it. The one thing I noticed that is important for the search engines is that the alt tags that use to show up with the thumbnail image no longer will show up with the detailed image. Anyone know what code can be put into perhaps the modules/Detailed_Product_Images/product_images.tpl so that the alt tags come up when the mouse goes over the detailed image?

DVDirect 09-12-2005 11:16 PM

Product Description under image
 
Hi I was reading through this Post and saw the request to have the product page display the Product description under the Image therefore the text does not get shoved across to the right of the page. This is espically great if you have wider than reccomended images.

Infact this allows you have wider than recomended images.


Here is the code that I am using in my store.
Modify /customer/main/product.tpl

Code:

{* $Id: product.tpl,v 1.96.2.16 2004/12/10 13:14:52 max Exp $ *}
{if $active_modules.Special_Offers}
        {include file="modules/Special_Offers/customer/product_offers_short_list.tpl" product=$product}
{/if}
{include file="form_validation_js.tpl"}
{if $product.product_type eq "C"}
        {include file="modules/Product_Configurator/pconf_customer_product.tpl"}
{else}
        {capture name=dialog}
        <TABLE border="0" width="100%" cellpadding="0" cellspacing="0">
        <FORM name="orderform" method="post" action="cart.php?mode=add" onsubmit="javascript: return FormValidation();">
        <TR>
                <TD valign="top" align="left" colspan="2" width="100">
                        {include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.image_x image_y=$product.image_y product=$product.product tmbn_url=$product.tmbn_url id="product_thumbnail"}
                </TD>
        </TR>
        <TR>
                <TD valign="top">
                        <SPAN class=>
                                {if $product.fulldescr ne ""}{$product.fulldescr}{else}{$product.descr}{/if}
                        </SPAN>
                       


                        <TABLE width="100%" cellpadding="0" cellspacing="0" border="0">
                                <TR><TD colspan="2"><FONT class="ProductDetailsTitle">{$lng.lbl_details}</FONT></TD></TR>
                                <TR><TD class="Line" height="1" colspan="2">[img]{$ImagesDir}/spacer.gif[/img]</TD></TR>
                                <TR><TD colspan="2"></TD></TR>
                                {if $config.Appearance.show_in_stock eq "Y" and $config.General.unlimited_products ne "Y" and $product.distribution eq ""}
                                        <TR>
                                                <TD width="30%">{$lng.lbl_quantity}</TD>
                                                <TD nowrap><SPAN id="product_avail_txt">{if $product.avail gt 0}{$product.avail}</SPAN>{else}{$lng.txt_no}
                                {/if}
                                {$lng.txt_items_available}
                </TD>
        </TR>
{/if}
{if $product.weight ne "0.00"}
        <TR>
                <TD width="30%">{$lng.lbl_weight}</TD>
                <TD nowrap><SPAN id="product_weight">{$product.weight}</SPAN> {$config.General.weight_symbol}</TD>
        </TR>
{/if}
{if $active_modules.Extra_Fields ne ""}
        {include file="modules/Extra_Fields/product.tpl"}
{/if}
{if $active_modules.Feature_Comparison ne ""}
        {include file="modules/Feature_Comparison/product.tpl"}
{/if}
{if $active_modules.Subscriptions ne "" and $subscription}
        {include file="modules/Subscriptions/subscription_info.tpl"}
{else}
        <TR><TD class="ProductPriceConverting" valign="top">{$lng.lbl_price}:</TD>
        <TD valign="top">
        {if $product.taxed_price ne 0 || $variants ne ''}
                <FONT class="ProductDetailsTitle"><SPAN id="product_price">{include file="currency.tpl" value=$product.taxed_price}</SPAN></FONT><FONT class="MarketPrice"> <SPAN id="product_alt_price">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$product.taxed_price}</SPAN></FONT>
                {if $product.taxes}
{include file="customer/main/taxed_price.tpl" taxes=$product.taxes}{/if}
        {else}
                <INPUT type="text" size="7" name="price">
        {/if}
        </TD>
        </TR>
{/if}
</TABLE>



<TABLE border="0" width="100%" cellpadding="0" cellspacing="0">
        <TR>
                <TD colspan="2">
                <FONT class="ProductDetailsTitle">{$lng.lbl_options}</FONT>
                </TD>
        </TR>
        <TR><TD class="Line" height="1" colspan="2">[img]{$ImagesDir}/spacer.gif[/img]</TD></TR>
        <TR><TD colspan="2"></TD></TR>
        {if $active_modules.Product_Options ne ""}
                { include file="modules/Product_Options/customer_options.tpl"}
        {/if}
        <TR>
                <TD height="25" width="30%">{$lng.lbl_quantity}{if $product.min_amount gt 1}
<FONT class="ProductDetailsTitle">{$lng.txt_need_min_amount} {$product.min_amount} {$lng.lbl_items}</FONT>{/if}</TD>
                <TD>
                        {if $config.General.unlimited_products eq "N" and ($product.avail le 0 or $product.avail lt $product.min_amount) and $variants eq ''}
<SCRIPT type="text/javascript" language="JavaScript 1.2">
var min_avail = 1;
var avail = 0;
var product_avail = 0;
</SCRIPT>
                                {$lng.txt_out_of_stock}
                        {else}
                                {if $config.General.unlimited_products eq "Y"}
                                        {math equation="x+1" assign="mq" x=$config.Appearance.max_select_quantity}
                                {else}
                                        {math equation="x/y" x=$config.Appearance.max_select_quantity y=$product.min_amount assign="tmp"}
                                        {if $tmp<2}
                                                {assign var="minamount" value=$product.min_amount}
                                        {else}
                                                {assign var="minamount" value=1}
                                        {/if}
                                        {math equation="min(maxquantity+minamount, productquantity+1)" assign="mq" maxquantity=$config.Appearance.max_select_quantity minamount=$minamount productquantity=$product.avail}
                        {/if}
                        {if $product.distribution eq ""}
                                {if $product.min_amount le 1}
                                        {assign var="start_quantity" value=1}
                                {else}
                                        {assign var="start_quantity" value=$product.min_amount}
                                {/if}
<SCRIPT type="text/javascript" language="JavaScript 1.2">
var min_avail = {$start_quantity|default:1};
var avail = {$mq|default:1}-1;
var product_avail = {$product.avail|default:"0"};
</SCRIPT>
                                <SELECT id="product_avail" name="amount"{if $active_modules.Product_Options ne '' && $product_options ne ''} onchange="check_wholesale(this.value);"{/if}>
                                        {section name=quantity loop=$mq start=$start_quantity}
                                                <OPTION value="{%quantity.index%}" {if $smarty.get.quantity eq %quantity.index%}selected{/if}>{%quantity.index%}</OPTION>
                                        {/section}
                                </SELECT>
                        {else}
                                <FONT class="ProductDetailsTitle">1</FONT><INPUT type="hidden" name="amount" value="1"> {$lng.txt_product_downloadable}
                        {/if}
                {/if}
                </TD>
        </TR>
        <TR>
                <TD colspan="2">
                        <INPUT type="hidden" name="mode" value="add">
                        {if $variants eq ''}
                                {include file="customer/main/product_prices.tpl"}
                        {/if}
                        {if $config.General.unlimited_products eq "Y" or ($product.avail gt 0 and $product.avail ge $product.min_amount)}
                                {if $js_enabled}
                                       

                                        {if $smarty.get.pconf ne ""}
                                                <INPUT type="hidden" name="slot" value="{$smarty.get.slot}">
                                                <INPUT type="hidden" name="addproductid" value="{$product.productid}">
                                                {include file="buttons/button.tpl" button_title=$lng.lbl_pconf_add_to_configuration style="button" href="javascript:if (FormValidation()) `$ldelim`document.orderform.productid.value='`$smarty.get.pconf`';document.orderform.action='pconf.php';document.orderform.submit()`$rdelim`"}
                                               


                                        {/if}
                                        {if $product.forsale ne "B"}
                                                {include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"}
                                               
                                                        {if $login ne "" and $active_modules.Wishlist ne ""}
                                                                {include file="customer/add2wl.tpl"}
                                                        {/if}
                                        {else}
                                                {$lng.txt_pconf_product_is_bundled}
                                        {/if}
                                {else}
                                        {include file="submit_wo_js.tpl" value=$lng.lbl_add_to_cart}
                                {/if}
                        {/if}
                        {if $active_modules.Feature_Comparison ne ""}
                                {include file="modules/Feature_Comparison/product_buttons.tpl"}
                        {/if}
                       
<INPUT type="image" src="{$ImagesDir}/null.gif" width="10" height="10" border="0" valign="top">

                </TD>
        </TR>
</TABLE>

</TD>
<TD align="right" valign="top" width="60">
{if $product.list_price gt 0 and $product.taxed_price lt $product.list_price}
        <TABLE border="0" width="60"><TR><TD width="55" height="56" class="SaveMoneyLabel" background="{$ImagesDir}/save_money.gif" align="center" valign="middle">
       

        {math equation="100-(price/lprice)*100" price=$product.taxed_price lprice=$product.list_price format="%d" assign=discount}
        <SPAN id="save_percent">{ $discount }</SPAN>%
        </TD></TR></TABLE>
{/if}
</TD>
</TR>
<INPUT type="hidden" name="productid" value="{$product.productid}">
<INPUT type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}">
<INPUT type="hidden" name="page" value="{$smarty.get.page|escape:"html"}">
</FORM>
</TABLE>
{/capture}
{include file="dialog.tpl" title=$product.producttitle content=$smarty.capture.dialog extra="width=100%"}
{/if}



{include file="customer/main/send_to_friend.tpl" }
{if $active_modules.Detailed_Product_Images ne ""}
       


        {include file="modules/Detailed_Product_Images/product_images.tpl" }
{/if}
{if $active_modules.Upselling_Products ne ""}
       


        {include file="modules/Upselling_Products/related_products.tpl" }
{/if}
{if $active_modules.Recommended_Products ne ""}
       


        {include file="modules/Recommended_Products/recommends.tpl" }
{/if}
{if $active_modules.Customer_Reviews ne ""}
       


        {include file="modules/Customer_Reviews/vote_reviews.tpl" }
{/if}
{if $active_modules.Product_Options ne '' && $product_options ne ''}
<SCRIPT type="text/javascript" language="JavaScript 1.2">
check_options();
</SCRIPT>
{/if}


Enjoy


All times are GMT -8. The time now is 07:18 AM.

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