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)
-   -   list all products (https://forum.x-cart.com/showthread.php?t=910)

cyberactive 12-12-2002 04:12 AM

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

funkydunk 12-12-2002 04:38 AM

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 :wink:

cyberactive 12-12-2002 07:26 AM

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

funkydunk 12-12-2002 07:28 AM

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

Will have to have a rethink. :(

cyberactive 12-12-2002 07:31 AM

Aha....:)

Well, it's about 800 products.

Let's think about it. :(

Jon 12-23-2002 03:27 PM

Would you not then need a template: customer/main/show_all.tpl ?

funkydunk 12-24-2002 12:21 AM

good spot Jon.

Just testing to see if anyone is reading the code :wink:

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>


okdpminc 03-28-2003 10:25 AM

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

Thank you,

funkydunk 04-02-2003 01:29 AM

pm'd you with the link :D

okdpminc 04-02-2003 01:52 PM

Thank you! :)


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

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