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

how to get 4 products a row on products.tpl?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-19-2008, 03:34 PM
 
MOC MOC is offline
 

Senior Member
  
Join Date: Oct 2002
Posts: 171
 

Default how to get 4 products a row on products.tpl?

hi there,
i wanna display 4 products a row on products.tpl. (VERSION: 4.1.9)

i used this code, but it doesn't work for me. anyone who can tell me whats wrong with it?

Code:
<DIV class=product_records_container style="MARGIN-BOTTOM: 2px; BORDER-BOTTOM: #cccccc 1px dotted"> <TABLE cellSpacing=0 cellPadding=0 width=585 border=0> <TBODY> {section name=product loop=$products} {assign var="discount" value=0} {if %product.index% is div by 4} <tr> {/if} <TR> <TD> <TABLE id=ctl00_cpContentArea_dlProductRecords style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 border=0> <TBODY> <tr> <TD vAlign=top> <DIV class=prod_box> <A href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_page}"> {include file="product_thumbnail.tpl" productid=$products[product].productid image_x=130 image_y=130 product=$products[product].product tmbn_url=$products[product].tmbn_url}</a> {if $active_modules.Special_Offers ne "" and $products[product].have_offers} {include file="modules/Special_Offers/customer/product_offer_thumb.tpl" product=$products[product]} {/if} <IMG alt="" src="feature_exclusive.gif"> <P><SPAN class=prodname>{$products[product].product}</SPAN></P></A> <P class=shortdescription>{$products[product].descr}</P> <P class=instock>--extrafield-shipping--</P><IMG src="star50.gif"> <P class=prodprice>Our Price: {include file="currency.tpl" value=$products[product].price} ({include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price})</P></DIV></TD> </tr> </TBODY></TABLE></TD></TR>{/section}</TBODY></TABLE></DIV>
__________________
X-Cart Gold Version 3.5.14 (Live)
X-Cart Gold Version 4.1.10 (in dev)

Modification for 4.1.10
Run with 1 License, 1 Database up to 5 Shops with different domains, config, categories and more. click here for informations
Reply With Quote
  #2  
Old 04-19-2008, 03:56 PM
  kube's Avatar 
kube kube is offline
 

X-Adept
  
Join Date: Sep 2005
Location: London: a small place East of Wales
Posts: 529
 

Default Re: how to get 4 products a row on products.tpl?

I know this isn't directly answering your question but what about...

In admin > General Setting > Appearance Options...
admin/configuration.php?option=Appearance

Change "Display products list in multiple columns (1-3) (leave empty to use standard format):", to 4

Then in products.tpl locate...
Code:
{if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")}

and change the part $config.Appearance.products_per_row lt 4 to...

$config.Appearance.products_per_row lt 5

Hope this helps.
__________________
Doms
kube v4.1.9
Reply With Quote
  #3  
Old 04-19-2008, 04:43 PM
 
MOC MOC is offline
 

Senior Member
  
Join Date: Oct 2002
Posts: 171
 

Default Re: how to get 4 products a row on products.tpl?

would work normally, but i need it hardcoded
and besides if i use it, i need to change the template and regardless if i try my code above or i try to add the products_t.tpl code to my code, the products aren't in a row anymore
__________________
X-Cart Gold Version 3.5.14 (Live)
X-Cart Gold Version 4.1.10 (in dev)

Modification for 4.1.10
Run with 1 License, 1 Database up to 5 Shops with different domains, config, categories and more. click here for informations
Reply With Quote
  #4  
Old 04-19-2008, 05:18 PM
  kube's Avatar 
kube kube is offline
 

X-Adept
  
Join Date: Sep 2005
Location: London: a small place East of Wales
Posts: 529
 

Default Re: how to get 4 products a row on products.tpl?

ok understandable, then how about trying...

Code:
<DIV class=product_records_container style="MARGIN-BOTTOM: 2px; BORDER-BOTTOM: #cccccc 1px dotted"> <TABLE cellSpacing=0 cellPadding=0 width=585 border=0> <TBODY> <tr> {section name=product loop=$products} {assign var="discount" value=0} <TD> <TABLE id=ctl00_cpContentArea_dlProductRecords style="BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 border=0> <TBODY> <TR> <TD vAlign=top> <DIV class=prod_box> <A href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_page}"> {include file="product_thumbnail.tpl" productid=$products[product].productid image_x=130 image_y=130 product=$products[product].product tmbn_url=$products[product].tmbn_url}</a> {if $active_modules.Special_Offers ne "" and $products[product].have_offers} {include file="modules/Special_Offers/customer/product_offer_thumb.tpl" product=$products[product]} {/if} <IMG alt="" src="feature_exclusive.gif"> <P><SPAN class=prodname>{$products[product].product}</SPAN></P></A> <P class=shortdescription>{$products[product].descr}</P> <P class=instock>--extrafield-shipping--</P><IMG src="star50.gif"> <P class=prodprice>Our Price: {include file="currency.tpl" value=$products[product].price} ({include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price})</P></DIV></TD> </TR> </TBODY> </TABLE> </TD> {if ($smarty.section.product.iteration is div by 4) and not ($smarty.section.product.last)}</TR><TR>{/if} {/section} </tr> </TBODY> </TABLE> </DIV>

Hope this helps.
__________________
Doms
kube v4.1.9
Reply With Quote
  #5  
Old 04-19-2008, 05:28 PM
 
MOC MOC is offline
 

Senior Member
  
Join Date: Oct 2002
Posts: 171
 

Default Re: how to get 4 products a row on products.tpl?

Thanks Kube,
working great. thanks thanks thanks SASKIA
__________________
X-Cart Gold Version 3.5.14 (Live)
X-Cart Gold Version 4.1.10 (in dev)

Modification for 4.1.10
Run with 1 License, 1 Database up to 5 Shops with different domains, config, categories and more. click here for informations
Reply With Quote
  #6  
Old 04-19-2008, 05:53 PM
  kube's Avatar 
kube kube is offline
 

X-Adept
  
Join Date: Sep 2005
Location: London: a small place East of Wales
Posts: 529
 

Default Re: how to get 4 products a row on products.tpl?

Hi again MOC I just cleaned up the code for you. As my app was coming out with all sorts of validation errors. Becareful with using a css id more than once on the same page (for example, id="ctl00_cpContentArea_dlProductRecords")

Code:
<div class="product_records_container" style="margin-bottom: 2px; border-bottom: #cccccc 1px dotted;"> <table cellspacing="0" cellpadding="0" width="585" border="0"> <tbody> <tr> {section name=product loop=$products} {assign var="discount" value=0} <td> <table id="ctl00_cpContentArea_dlProductRecords" style="border-collapse: collapse;" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td valign="top"> <div class="prod_box"> <a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_page}"> {include file="product_thumbnail.tpl" productid=$products[product].productid image_x=130 image_y=130 product=$products[product].product tmbn_url=$products[product].tmbn_url}</a> {if $active_modules.special_offers ne "" and $products[product].have_offers} {include file="modules/special_offers/customer/product_offer_thumb.tpl" product=$products[product]} {/if} <img alt="" src="feature_exclusive.gif" /> <p><span class="prodname">{$products[product].product}</span></p> <p class="shortdescription">{$products[product].descr}</p> <p class="instock">--extrafield-shipping--<img src="star50.gif" alt="" /></p> <p class="prodprice">Our Price: {include file="currency.tpl" value=$products[product].price} ({include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price})</p></div></td> </tr> </tbody> </table> </td> {if ($smarty.section.product.iteration is div by 4) and not ($smarty.section.product.last)}</tr><tr>{/if} {/section} </tr> </tbody> </table> </div>

Just in case it helps, no ideas. I'm bored - I know ;D
__________________
Doms
kube v4.1.9
Reply With Quote
  #7  
Old 04-26-2008, 06:23 AM
 
merbay merbay is offline
 

Advanced Member
  
Join Date: Mar 2008
Posts: 42
 

Default Re: how to get 4 products a row on products.tpl?

Hi, I made the changes per post #2 and it worked perfectly for me and I am happy. Some don't line up, but that is a factor of the title and can be fixed-- had the same problem when I had 3 across. My question is, must I have things hardcoded, or am I ok this way? Thanks for your help!
__________________
merbay
4.1.9
Reply With Quote
  #8  
Old 04-26-2008, 07:04 AM
  kube's Avatar 
kube kube is offline
 

X-Adept
  
Join Date: Sep 2005
Location: London: a small place East of Wales
Posts: 529
 

Default Re: how to get 4 products a row on products.tpl?

Although I'm not 100% sure, I would say that to get more than 4 or more products per row would involve some level of hard coding considering the tpl looks for less-than-4.

The only other area I think it affects would be the featured products and I can't see it affecting invoices. However, there might be a few mods out there which require it.
__________________
Doms
kube v4.1.9
Reply With Quote
  #9  
Old 04-26-2008, 08:23 AM
 
merbay merbay is offline
 

Advanced Member
  
Join Date: Mar 2008
Posts: 42
 

Default Re: how to get 4 products a row on products.tpl?

I'm sorry to be such a pain, but I don't know where to put the coding in #6. I've looked in products.tpl and I don't see anything-- (also, I don't know if I'm replacing or adding)

I really like 4 across, so could you pls. give me more direction! Thanks.
__________________
merbay
4.1.9
Reply With Quote
  #10  
Old 04-26-2008, 08:39 AM
  kube's Avatar 
kube kube is offline
 

X-Adept
  
Join Date: Sep 2005
Location: London: a small place East of Wales
Posts: 529
 

Default Re: how to get 4 products a row on products.tpl?

#6 contains code that is specific to MOC's website such as images and id/classes which you will not have and makes it confusing to control. Plus, there's more hard coding which is not necessary.

In the products.tpl or products_t.tpl, (dependent on what you have chosen as products per row) you would swap the whole section {section name=product loop=$products}bla bla{/section} with the code from #6
__________________
Doms
kube v4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 06:04 AM.

   

 
X-Cart forums © 2001-2020