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

list all products

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 12-12-2002, 04:12 AM
 
cyberactive cyberactive is offline
 

Senior Member
  
Join Date: Sep 2002
Location: The Netherlands
Posts: 115
 

Default

I'm not a programmer, and I've tried the above code....

But I realy don't understand what to do and which files to create....
Please give me some more details on this....
__________________
Dennis

Shop @ http://www.cyberlease.nl
Version shop: 3.4.4 (shop is NOT life anymore)
Mods:
- Dutch language
- Changed payment methods and shipping methods
- Package tracking system for Dutch TPGpost.
Reply With Quote
  #12  
Old 12-12-2002, 04:38 AM
 
funkydunk funkydunk is offline
 

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

Default

ok here goes...

total_list.php in the customer directory (not under skin1)
Code:
<? require "../smarty.php"; require "../config.php"; @include "./https.php"; require "./auth.php"; require "../include/categories.php"; require "./all_products.php"; # # Assign Smarty variables and show template # $smarty->assign("main","listall"); $smarty->assign("location",$location); $smarty->display("customer/list_all.tpl"); ?>

all_products.php in the same directory
Code:
<? # # Get products data for all categories and store it into $products array # $search_query = "($sql_tbl[products].categoryid='%' or $sql_tbl[products].categoryid1='%' or $sql_tbl[products].categoryid2='%' or $sql_tbl[products].categoryid3='%') and $sql_tbl[products].forsale='Y' group by $sql_tbl[products].productid order by $sql_tbl[categories].category asc"; // $search_query = "($sql_tbl[products].forsale='Y' group by $sql_tbl[products].productid order by $sql_tbl[products].orderby ".($config["General"]["product_order_reversed"]=="Y"?"desc":"asc")."; $products = func_search_products($search_query, $user_account['membership']); $smarty->assign("products",$products); $smarty->assign("navigation_script","total_list.php?main=listall"); ?>


list_all.tpl in skin1/customer/ to:
Code:
{* $Id: list_all.tpl,v 1.2.2.1 2002/10/03 10:21:19 zorg Exp $ *} { config_load file="$skin_config" } <html> <head> <title>{$lng.txt_site_title} :: All of Our Products</title> { include file="meta.tpl" } <link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}"> </head> <body class="background"> { include file="rectangle_top.tpl" } { include file="head.tpl" } <table border=0 width=100% cellpadding=0 cellspacing=0 align="center"> <tr> <td class=TableLeft width=150 valign=top> { include file="customer/categories.tpl" } {if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu eq "Y"} { include file="modules/Bestsellers/menu_bestsellers.tpl" } {/if} { include file="customer/menu_cart.tpl" } {if $login eq "" } {else} { include file="authbox.tpl" } {/if} {if $login eq "" } { include file="auth.tpl" } {else} { include file="menu_profile.tpl" } {/if} { include file="help.tpl" } { include file="poweredby.tpl" } </td> <td width=20></td> <td valign=top> {include file="customer/home_main.tpl"} </td> <td width=20></td> </tr> <tr> <td class=TableLeft></td> <td></td> <td>{ include file="copyright.tpl" } </td> <td></td> <td></td> </tr> </table> { include file="rectangle_bottom.tpl" } </body> </html>

and add the following code into home_main.tpl in skin1/customer above where it says:
{else}
{include file="common_templates.tpl"}
{/if}

Code:
{elseif $main eq "listall"} {include file="customer/main/show_all.tpl"}

There is probably an easier way to do this but this worked for me.

Enjoy
__________________
ex x-cart guru
Reply With Quote
  #13  
Old 12-12-2002, 07:26 AM
 
cyberactive cyberactive is offline
 

Senior Member
  
Join Date: Sep 2002
Location: The Netherlands
Posts: 115
 

Default

Thanks for the quick reply.

Now something is happening

Code:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 5 bytes) in /home/httpd/vhosts/computerzaak.net/httpdocs/include/func.php on line 26 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 134 bytes) in Unknown on line 0

Hmmm.....
I called /total_list.php?main=listall
__________________
Dennis

Shop @ http://www.cyberlease.nl
Version shop: 3.4.4 (shop is NOT life anymore)
Mods:
- Dutch language
- Changed payment methods and shipping methods
- Package tracking system for Dutch TPGpost.
Reply With Quote
  #14  
Old 12-12-2002, 07:28 AM
 
funkydunk funkydunk is offline
 

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

Default

I think that the products array is too big for it to handle.

Will have to have a rethink.
__________________
ex x-cart guru
Reply With Quote
  #15  
Old 12-12-2002, 07:31 AM
 
cyberactive cyberactive is offline
 

Senior Member
  
Join Date: Sep 2002
Location: The Netherlands
Posts: 115
 

Default

Aha....

Well, it's about 800 products.

Let's think about it.
__________________
Dennis

Shop @ http://www.cyberlease.nl
Version shop: 3.4.4 (shop is NOT life anymore)
Mods:
- Dutch language
- Changed payment methods and shipping methods
- Package tracking system for Dutch TPGpost.
Reply With Quote
  #16  
Old 12-23-2002, 03:27 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

Would you not then need a template: customer/main/show_all.tpl ?
Reply With Quote
  #17  
Old 12-24-2002, 12:21 AM
 
funkydunk funkydunk is offline
 

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

Default

good spot Jon.

Just testing to see if anyone is reading the code

Yes customer/main/show_all.tpl should be created aswell:

I have extensively modified this but the basic template to use is products.tpl just I hard coded some of the dialog.tpl stuff

Code:
{* $Id: show_all.tpl,v 1.16 2002/09/25 10:12:05 zorg Exp $ *} <font class="TableCenterNavigationPath">Shop Name</font>::<font class="TableCenterNavigationPath">All Products</font>:: This is the full list of products. <TABLE border=0 cellPadding=2 cellSpacing=0 width="100%"> <TR> <TD height="20" class=TableTop background="{$ImagesDir}/dialog_bg.gif" valign=bottom><FONT class=TableCenterPartnerPromotionTitleOrange>All Current Products</FONT></TD> </TR> <TR><TD class=DialogBorder><TABLE border=0 cellPadding=10 cellSpacing=0 width="100%"> <TR><TD bgColor=#FFFFFF> {section name=product loop=$products} <table border=0 width=100% cellpadding=2 cellspacing=0> <tr> <td width=10% align=center valign=top > {$products[product].category} </td> <td width=10% align=center valign=top > {$products[product].productcode} </td> <td valign=top width=40% > <font class=TableCenterProductTitleBlue>{$products[product].product|escape}</font>More.... </td> <td width=20% align=center> {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=grey>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=grey>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> <form name=orderform_{%product.index%} method=post action="cart.php?mode=add"> <td align=center width=20%><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}"> </td> </form> </tr> </table> {/section} </TD></TR> </TABLE></TD></TR> </TABLE>
__________________
ex x-cart guru
Reply With Quote
  #18  
Old 03-28-2003, 10:25 AM
 
okdpminc okdpminc is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 74
 

Default

Would someone please post a link to such a page so I can see the end result?

Thank you,
__________________
- okdpm

X-Cart Gold Version: 3.5.1

Things are more like they are now than they have ever been before...
Reply With Quote
  #19  
Old 04-02-2003, 01:29 AM
 
funkydunk funkydunk is offline
 

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

Default

pm'd you with the link
__________________
ex x-cart guru
Reply With Quote
  #20  
Old 04-02-2003, 01:52 PM
 
okdpminc okdpminc is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 74
 

Default

Thank you!
__________________
- okdpm

X-Cart Gold Version: 3.5.1

Things are more like they are now than they have ever been before...
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 12:38 AM.

   

 
X-Cart forums © 2001-2020