Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Number of Products per Row changeable in admin

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 03-14-2003, 03:04 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default 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.
__________________
ex x-cart guru
Reply With Quote

The following user thanks funkydunk for this useful post:
Julius La-as (10-28-2014)
  #2  
Old 03-14-2003, 03:57 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

Once again, nice work
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #3  
Old 03-14-2003, 12:03 PM
 
davidgreenberg davidgreenberg is offline
 

Member
  
Join Date: Jan 2003
Posts: 15
 

Default 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
Reply With Quote
  #4  
Old 03-14-2003, 12:12 PM
 
davidgreenberg davidgreenberg is offline
 

Member
  
Join Date: Jan 2003
Posts: 15
 

Default

forget my last post. i figured out how to look in my database
Reply With Quote
  #5  
Old 03-14-2003, 08:12 PM
 
eleven eleven is offline
 

Senior Member
  
Join Date: Nov 2002
Location: Charlotte, NC, USA
Posts: 118
 

Default products.tpl

thx 4 the mod. you did mean products.tpl right?
__________________
|| E L E V E N ||
Reply With Quote
  #6  
Old 03-14-2003, 10:23 PM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

good spot eleven- just checking that you were paying attention

I have amended the previous post to avoid tripping people up.
__________________
ex x-cart guru
Reply With Quote
  #7  
Old 03-17-2003, 03:26 AM
 
Ian Ian is offline
 

Senior Member
  
Join Date: Sep 2002
Location: Adelaide, South Australia
Posts: 127
 

Default

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.
__________________
_____________________________________

4.6.6 Gold Plus
and 4.7.4 Gold
MySQL server 5.6.29
PHP 5.5.34
Reply With Quote
  #8  
Old 03-17-2003, 03:33 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

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.
__________________
ex x-cart guru
Reply With Quote
  #9  
Old 03-17-2003, 03:38 AM
 
Ian Ian is offline
 

Senior Member
  
Join Date: Sep 2002
Location: Adelaide, South Australia
Posts: 127
 

Default

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

Thanks again
__________________
_____________________________________

4.6.6 Gold Plus
and 4.7.4 Gold
MySQL server 5.6.29
PHP 5.5.34
Reply With Quote
  #10  
Old 03-17-2003, 10:35 AM
 
movienett movienett is offline
 

Member
  
Join Date: Feb 2003
Location: Norway
Posts: 27
 

Default

great mod Mr Funky !!!!! (again)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:59 AM.

   

 
X-Cart forums © 2001-2020