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)
-   -   Number of Products per Row changeable in admin (https://forum.x-cart.com/showthread.php?t=1868)

funkydunk 03-14-2003 03:04 AM

Number of Products per Row changeable in admin
 
Cos I'm in a good mood today, a little mod to give and option in admin to specify the number of products per row that are displayed.

SQL to insert:

Code:

INSERT into `xcart_config` VALUES ('products_per_row','Product per row','2','General','66','text')
New customer/main/products.tpl template
(Note that this includes the add to cart button)

Code:

{* $Id: products.tpl,v 1.21 2002/11/19 12:57:48 alfiya Exp $ and amended further by funkydunk.net*}
<table border=0 width=100% cellspacing=0 cellpadding=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>
<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 width=90%>
{$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/details.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>
{/section}
</tr>
</table>


You will then have an option in admin to specify the number of products per row that you want displayed. Obviously you will encounter problems with more than 3 in a row if you are using a three column layout for the shop.

Enjoy.

shan 03-14-2003 03:57 AM

Once again, nice work :wink:

davidgreenberg 03-14-2003 12:03 PM

Re: Number of Products per Row changeable in admin
 
[quote="funkydunk"]Cos I'm in a good mood today, a little mod to give and option in admin to specify the number of products per row that are displayed.

SQL to insert:

Code:

INSERT into `xcart_config` VALUES ('products_per_row','Product per row','2','General','66','text')

where do i insert SQL? waht does that mean? pardon my retardedness, but this looks like a cool feature

davidgreenberg 03-14-2003 12:12 PM

forget my last post. i figured out how to look in my database :roll:

eleven 03-14-2003 08:12 PM

products.tpl
 
thx 4 the mod. you did mean products.tpl right?

funkydunk 03-14-2003 10:23 PM

good spot eleven- just checking that you were paying attention :wink:

I have amended the previous post to avoid tripping people up.

Ian 03-17-2003 03:26 AM

Am I missing something here ? I don't have buttons/showdetail.tpl on my system. For me it throws that error and makes the screen width much bigger.

funkydunk 03-17-2003 03:33 AM

Sorry, that was a button that I created to show the details of the product.

You could do the same or remove it or use details.tpl instead.

Ian 03-17-2003 03:38 AM

Thanks I will try take it out for now and then if all works I can add my own.

Thanks again :D

movienett 03-17-2003 10:35 AM

great mod Mr Funky !!!!! (again)


All times are GMT -8. The time now is 03:58 PM.

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