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)
-   -   2-3 products per row viewing in product listing (https://forum.x-cart.com/showthread.php?t=213)

bkmdano 10-06-2002 11:16 PM

2-3 products per row viewing in product listing
 
I see that the new version has the option to list 2 or 3 products per row, but I have not gotten this thing to work. Anyone get this to show properly?
Once I do get this, I would like to do the same for like "related products" section. It is in bullets now, but I would like to show thumbnail along with short description. Showing at least 3 per row.

B00MER 10-07-2002 01:26 AM

What exactly are you refering to? :?

bkmdano 10-07-2002 06:35 PM

product display
 
Sorry if i wasn't clear. what i'm trying to do is to display 3 products per row win the main window. default now only displays 1 per row. The page i am talking about is the product listing page with the thumbnails.
how and what page do i need to modify to reflect this?

i would also like to do the same for the recommended list table. presently, it shows text only with link, but i would like to show a thumbnail 3 per row with a short description.

thanks in advance.

Funinc 10-10-2002 07:40 PM

Great Idea
 
I would also like to do the same. If you have a large number of products in each category, it would be nice to see 2 or 3 per row instead of just 1.

Anyone know how to achieve this?

B00MER 10-10-2002 10:05 PM

[skin1]/customer/main/products.tpl

Code:

<table border=0 width=100%><tr><td>

  <table border=0 width=100%>

  {section name=product loop=$products}
  {if $smarty.section.product.index is div by 2}
    </tr><tr valign="top">
  {/if}

  <td valign="top">

    <table border=0 width=100%><tr>
      <td width=90 align=center valign=top><a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=70 product=$products[product].product}
{ $lng.lbl_see_details }</a></td>
      <td valign=top>{$products[product].product|escape}</font> <font class=TableCenterProductTitleOrange></font><font size=1>

{$products[product].descr|truncate:100:"...":true}
</font><hr size=1 noshade width=130 align=left>
      {if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
      {include file="modules/Subscriptions/subscription_info_inlist.tpl"}
      {else}
      {if $products[product].price ne 0}
      {if $products[product].discount ne 0}
      <font class=MarketPrice>{$lng.lbl_market_price}: <s>{math equation="(price/(100-discount))*100" price=$products[product].price discount=$products[product].discount format="%d.00" assign=unformatted}{include file="currency.tpl" value=$unformatted}</s></font>

      {/if}
      <font class=TableCenterProductTitleOrange>{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].discount ne 0}, save {$products[product].discount}%{/if}
      {else}
      <font class=TableCenterProductTitleOrange>{$lng.lbl_enter_your_price}</font>
      {/if}
      {/if}
      </td></tr>
    </table>

  </td>

  {/section}

</td></tr></table>
</td></tr></table>


Change is div by 2 to adjust columns, I also truncated the description by 200 less charchters as well as adjusted the table size so 2-3 would fit, anyone going over that is going to get a horizontal scrollbar.

hth. :wink:

Funinc 10-11-2002 06:40 AM

Thanks works great....

You the MAN... :D

bkmdano 10-15-2002 08:18 PM

thanks! works fine here also
 
:lol:

matt 10-25-2002 10:16 PM

Dunno why I missed this post, but I'm glad I found it :lol:

seaCOAST 10-26-2002 03:57 AM

Quote:

Originally Posted by matt
Dunno why I missed this post, but I'm glad I found it :lol:


Same here!

In addition...if you want to make it look a little neater, you can adjust the border width. :)

japanchick 10-26-2002 07:18 AM

thanks ~!
 
Thanks boomer thats grrrreat!!!!!!!!!!!!!

nthan15 10-26-2002 03:57 PM

Thanks
 
Flawless!!!

B00MER 12-01-2002 01:49 PM

:!: Just a quick note, anyone who has setup their x-cart to run with product images NOT in the db, you'll need to modify:

Code:

{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=70 product=$products[product].product}

to reference your thumbnail correctly. :wink:

MMB 12-06-2002 01:08 AM

I am using this in my subcategories, i need the subcats that have icons to display in colums, and the other subcats with out icons i have them display in a row.

I have this working but when i go over 9 icons it list them in a row like the rest of the subcats.

Can someone please help me with this.

If it helps to see what i am doing here is the link. This is showing my subcats with icons, if you back up one subcat, it list in a row. if I add one more icon to this page it will list it in a row??

http://www.motorsport-depot.com/xcart/customer/home.php?cat=57


here is the code I am using.

Code:

{if $subcategories[cat_num].categoryid eq $icons}

<table border=0 width=100% align=center><tr><td>
    <table border=0 width=100% align=center>

 {section name=cat_num loop=$subcategories}
  {if $smarty.section.cat_num.index is div by 3}
    </tr><tr valign="top">
  {/if}

<td valign=top>

 { if %cat_num.first% }
{/if}

<table border=0 width=125 height=100% cellspacing=0 cellpadding=5 align=center>
<tr><td align=center>
<a href="home.php?cat={ $subcategories[cat_num].categoryid }">[img]../icon.php?categoryid={$subcategories[cat_num].categoryid}[/img]

<font class="TableCenterSubCategoryListTitleBlue">{ $subcategories[cat_num].category|escape }</font></a>



</td></tr>
{ if %cat_num.last% }
{/if}
</table>

</td>
{/section}

</td></tr></table>
</td></tr></table>


{else}


{section name=cat_num loop=$subcategories}
{ if %cat_num.first% }
<table border=0 cellspacing=5>
{/if}
<tr><td align=left nowrap width=95%>
<font class="TableCenterSubCategoryListTitleBlue">{ $subcategories[cat_num].category|escape }</font>

</td>

</tr>
{ if %cat_num.last% }
</table>
{/if}
{/section}

{/if}


MMB 12-06-2002 05:39 PM

OK i fuggered out that it is only letting list the same number of icons as there are top categories.

anyone know how i can write this if statement so that it will list my selected icons/subcats in the colums and if no icons are selected list the subcats in a row?

{if $subcategories[cat_num].categoryid eq $icons}

shirtshop 01-03-2003 07:08 AM

errormessage
 
Quote:

Originally Posted by B00MER
:!: Just a quick note, anyone who has setup their x-cart to run with product images NOT in the db, you'll need to modify:

Code:

{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=70 product=$products[product].product}

to reference your thumbnail correctly. :wink:


Hello Boome

I also add youre pice of script into the products.tpl file but i get this errormessage

Warning: Smarty error: unable to read template resource: "customer/main/product.tpl" in C:\www\shirtshop.nl\testroot\Smarty-2.1.1\Smarty.class.php on line 546

This will appear when i click on the products for selecting
Do you what's get wrong?

Regards
Henk

guytje 02-06-2003 03:27 AM

Hi,

I can't find the code you guys are using... mine looks like this:





Code:

{* $Id: products.tpl,v 1.16 2002/09/25 10:12:05 zorg Exp $ *}
{section name=product loop=$products}
<table border=0 width=100%>
<tr><td width=90 align=center valign=top>
<a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=70 product=$products[product].product}
{ $lng.lbl_see_details }</a>
</td>
<td valign=top>
{$products[product].product|escape}</font> <font class=TableCenterProductTitleOrange></font>
<font size=1>




{$products[product].descr|truncate:300:"...":true}


</font>
<hr size=1 noshade width=230 align=left>
{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $products[product].price ne 0}
{if $products[product].discount ne 0}
<font class=MarketPrice>{$lng.lbl_market_price}: <s>{math equation="(price/(100-discount))*100" price=$products[product].price discount=$products[product].discount format="%d.00" assign=unformatted}{include file="currency.tpl" value=$unformatted}</s></font>

{/if}
<font class=TableCenterProductTitleOrange>{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].discount ne 0}, save {$products[product].discount}%{/if}
{else}
<font class=TableCenterProductTitleOrange>{$lng.lbl_enter_your_price}</font>
{/if}
{/if}
</td></tr>
</table>






{/section}


What should I change to make my products list in 2 columns?

Thanks,
Guy

greggo 02-08-2003 02:23 PM

not working for me
 
I can't make this work either. I'm using 3.3.1 is that the problem?

funkydunk 02-08-2003 11:51 PM

This works fine in 3.3.1

My code for this is:
Code:

{* $Id: products.tpl,v 1.21 2002/11/19 12:57:48 alfiya Exp $ *}
<table border=0 width=100% cellspacing=0 cellpadding=0>
<tr valign="top">

{section name=product loop=$products}
<td valign="top">

<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=100 rowspan="2" align=left valign=top>
<a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=100 product=$products[product].product}</a>
</td>
<td valign=top>
{$products[product].product|escape}</font>
<font class="ProductDetails">


{$products[product].descr|truncate:300:"...":true}


</font>
{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $products[product].price ne 0}
{if $products[product].discount ne 0}
<font class=MarketPrice>{$lng.lbl_market_price}: <s>
{math equation="price/(1-(discount/100))" price=$products[product].price discount=$products[product].discount format="%d.00" assign=unformatted}{include file="currency.tpl" value=$unformatted}
</s></font>

{/if}
<font class=ProductPrice>{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].discount ne 0}, save {$products[product].discount}%{/if}{if $config.General.use_vat eq "Y"}, including VAT {$products[product].vat}%{/if}
{else}
<font class=ProductPrice>{$lng.lbl_enter_your_price}</font>
{/if}
{/if}
</td>
</tr>
<tr>
  <td valign=top>
    <table width="80" border="0" cellspacing="0" cellpadding="2">
      <tr valign="top">
        <td><a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include
          file="buttons/showdetail.tpl"}</a></td>
        <td><form name=orderform_{%product.index%} method=post action="cart.php?mode=add">
          <a href="javascript: document.orderform_{%product.index%}.submit()"> {include
          file="buttons/add_to_cart.tpl"}</a>
          <input type=hidden name=amount value=1>
          <input type=hidden name=mode value=add>
          <input type=hidden name=productid value="{$products[product].productid}">
          <input type=hidden name=cat value="{$smarty.get.cat}">
          <input type=hidden name=page value="{$smarty.get.page}">
        </form></td>
      </tr>
    </table></td>
</tr>
</table>
</td>

{if $smarty.section.product.index is odd}
</tr><tr valign="top">
{/if}
{/section}
</tr>
</table>


HTH

deb 02-09-2003 08:43 AM

I'll echo funky - I use the same logic for rows in my featured products, and it's working great.

deb

funkydunk 02-09-2003 09:07 AM

The thing to remember with this 'is odd' thing is that the first item index is 0.

greggo 02-09-2003 05:46 PM

got it
 
Thanks.

toonarific 07-06-2003 10:37 AM

here is the error I get

Parse error: parse error, unexpected T_ELSE in W:\www-toonarific\xcart\templates_c\%%-13\%%-1366895660\products.tpl.php on line 140


can be found at

http://www.toonarific.com/xcart/customer/home.php

funkydunk 07-06-2003 10:53 AM

This isn't needed in v3.4.x onwards.

You error comes from the smarty text being incorrect -can you paste your code?

toonarific 07-06-2003 11:32 AM

Code:

{* $Id: products.tpl,v 1.21 2002/11/19 12:57:48 alfiya Exp $ *}
<table border=0 width=100% cellspacing=0 cellpadding=0>
<tr valign="top">

{section name=product loop=$products}
<td valign="top">

<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=100 rowspan="2" align=left valign=top>
<a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=100 product=$products[product].product}</a>
</td>
<td valign=top>
{$products[product].product|escape}</font>
<font class="ProductDetails">

 
{$products[product].descr|truncate:300:"...":true}

 
</font>
{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $products[product].price ne 0}
{if $products[product].discount ne 0}
<font class=MarketPrice>{$lng.lbl_market_price}: <s>
{math equation="price/(1-(discount/100))" price=$products[product].price discount=$products[product].discount format="%d.00" assign=unformatted}{include file="currency.tpl" value=$unformatted}
</s></font>
 
{/if}
<font class=ProductPrice>{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].discount ne 0}, save {$products[product].discount}%{/if}{if $config.General.use_vat eq "Y"}, including VAT {$products[product].vat}%{/if}
{else}
<font class=ProductPrice>{$lng.lbl_enter_your_price}</font>
{/if}
{/if}
</td>
</tr>
<tr>
  <td valign=top>
    <table width="80" border="0" cellspacing="0" cellpadding="2">
      <tr valign="top">
        <td><a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include
          file="buttons/showdetail.tpl"}</a></td>
        <td><form name=orderform_{%product.index%} method=post action="cart.php?mode=add">
          <a href="javascript: document.orderform_{%product.index%}.submit()"> {include
          file="buttons/add_to_cart.tpl"}</a>
          <input type=hidden name=amount value=1>
          <input type=hidden name=mode value=add>
          <input type=hidden name=productid value="{$products[product].productid}">
          <input type=hidden name=cat value="{$smarty.get.cat}">
          <input type=hidden name=page value="{$smarty.get.page}">
        </form></td>
      </tr>
    </table></td>
</tr>
</table>
</td>

{if $smarty.section.product.index is odd}
</tr><tr valign="top">
{/if}
{/section}
</tr>
</table>

{else}
{$lng.lbl_no_products_found}
{/if}
{/if}


toonarific 07-07-2003 12:45 AM

did you get a chance to review the code yet?

wallachee 07-24-2003 10:39 AM

Gap In Listings
 
The code provided earlier in this thread works great for me except for anyone using Internet Explorer. For some reason there is a huge gap in the poduct listings. You can see my site at: http://www.powerbookmedic.com/xcart1/

I'm using version 3.3.5, and my products.tpl code is below. What is causing this gap?

Code:


<table border=0 width=100% <tr> <td>   
  <table border=0 width=100% >

{section name=product loop=$products}
 б═ {if $smarty.section.product.index is div by 2}
</tr> <tr valign="top">
б═ б═  б═ {/if}
  <td valign="top"> 
 б═ б═ <table border=0 width=70%> <tr>
 б═ б═ б═<td width="20%" align=center valign=top><a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=70 product=$products[product].product}
{ $lng.lbl_see_details }</a></td>
 б═ б═ б═ <td valign=top width=100% >{$products[product].product|escape}</font> <font class=TableCenterProductTitleOrange></font><font size=1>

{$products[product].descr|truncate:100:"...":true}
</font><hr size=1 noshade width=130 align=left>
 б═ б═ б═ {if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
 б═ б═ б═ {include file="modules/Subscriptions/subscription_info_inlist.tpl"}
 б═ б═ б═ {else}
 б═ б═ б═ {if $products[product].price ne 0}
 б═ б═ б═ {if $products[product].discount ne 0}
 б═ б═ б═ 
<font class=MarketPrice>{$lng.lbl_market_price}: <s>{math equation="(price/(100-discount))*100" price=$products[product].price discount=$products[product].discount format="%d.00" assign=unformatted}{include file="currency.tpl" value=$unformatted}</s> </font>
 
 б═ б═ б═ {/if}
 б═<div align="left"> б═ б═
<font class=TableCenterProductTitleOrange>{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].discount ne 0}, save {$products[product].discount}%{/if}
 б═ б═ б═ {else}
 б═ б═ б═<div align="left">  <font class=TableCenterProductTitleOrange>{$lng.lbl_enter_your_price}</font>
 б═ б═ б═ {/if}
 б═ б═ б═ {/if}
 б═ б═ б═ </td></tr>
 б═ б═ </table>
 
 б═ </td>
 
 б═ {/section}
 
 </td></tr></table>
 </td></tr></table>


adpboss 07-24-2003 08:24 PM

Compare it with mine. Mine works perfect for my needs, but is a little more simplified than yours.

Code:

{* $Id: products.tpl,v 1.21 2002/11/19 12:57:48 alfiya Exp $ and amended further by funkydunk.netand ADPBoss*}
<table width=100% border=0 cellpadding=0 cellspacing=0>

{section name=product loop=$products}
{if $smarty.section.product.index is div by $config.General.products_per_row}
<tr valign="top">
{/if}
<td valign="top">
<table width=100% border=0 cellpadding=3 cellspacing=0>
<tr>
          <td width=100 rowspan="2" align=left valign=top> <div align="center"><a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include
              file="product_thumbnail.tpl" productid=$products[product].productid
              image_x=100 product=$products[product].product}</a>
              {if $products[product].avail le 0}<font color="#FF0000" size="3">Sold
              Out!</font>
{/if} </div></td>
<td valign=top width=90%>
{$products[product].product|escape}</font>

 

 
{if $active_modules.Subscriptions ne "" and $products[product].catalogprice}
{include file="modules/Subscriptions/subscription_info_inlist.tpl"}
{else}
{if $products[product].price ne 0}
{if $products[product].discount ne 0}
<font class=MarketPrice>{$lng.lbl_market_price}: <s>
{math equation="price/(1-(discount/100))" price=$products[product].price discount=$products[product].discount format="%d.00" assign=unformatted}{include file="currency.tpl" value=$unformatted}
</s></font>
 
{/if}
<font class=ProductPrice>{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].price}</font><font class=MarketPrice>{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].price}</font>{if $products[product].discount ne 0}, save {$products[product].discount}%{/if}{if $config.General.use_vat eq "Y"}, including VAT {$products[product].vat}%{/if}
{else}
<font class=ProductPrice>{$lng.lbl_enter_your_price}</font>
{/if}
{/if}
</td>
</tr>
<tr>
  <td valign=top>
    <table width="100%" border="0" cellspacing="0" cellpadding="2">
              <tr valign="top">
                <td><a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include
                  file="buttons/details1.tpl"}</a></td>
              </tr>
              {if $products[product].avail gt 0}
                          <tr valign="top">
                          <td><form name=orderform_{%product.index%} method=post action="cart.php?mode=add">
                    <a href="javascript: document.orderform_{%product.index%}.submit()">
                    {include file="buttons/add_to_cart1.tpl"}</a>
                    <input type=hidden name=amount value=1>
                    <input type=hidden name=mode value=add>
                    <input type=hidden name=productid value="{$products[product].productid}">
                    <input type=hidden name=cat value="{$smarty.get.cat}">
                    <input type=hidden name=page value="{$smarty.get.page}">
                  </form></td></tr>
                                  {else}<tar valign="top"><td></td></tr>{/if}
            </table></td>
</tr>
</table>
</td>
{/section}
</tr>
</table>


Visit http://www.adpmods.com/xcart to preview how it looks and works. NOTE: I do have some fancy inventory stuff going on with displaying out of stock conditions. Unless you desire the same effect, DO NOT copy my code verbatim.

Good Luck!

wallachee 07-24-2003 10:16 PM

You're the man. After a couple hours, I finally got it...I found out I had one too many </td> in my code. It was screwing everything up. Thanks for the help.

-Bradley


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

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