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
  #1  
Old 12-09-2002, 09:09 AM
 
funkydunk funkydunk is offline
 

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

Default list all products

Anyone know how to put an extra page in that lists all products from all categories?

Cheers
__________________
ex x-cart guru
Reply With Quote
  #2  
Old 12-09-2002, 04:11 PM
 
okdpminc okdpminc is offline
 

Advanced Member
  
Join Date: Nov 2002
Posts: 74
 

Default

Hey, that would be great! We could also use that to create a .PDF catalog of all our items. Hope somebody replies.
__________________
- okdpm

X-Cart Gold Version: 3.5.1

Things are more like they are now than they have ever been before...
Reply With Quote
  #3  
Old 12-09-2002, 04:59 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

Hate to sound like an idiot, but can you be a bit more specific?
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #4  
Old 12-09-2002, 10:44 PM
 
funkydunk funkydunk is offline
 

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

Default

Quote:
Originally Posted by B00MER
Hate to sound like an idiot, but can you be a bit more specific?

Hi Boomer,

I am building a shop and they require one page that lists all products, no matter what category the product is in. Ideally this would have a few other details as follows:

SKU | Item Description | Category | Link to view | Add to Cart ??

I know someone did something like this for a printable product list but could find it on the forum.

Thanks
__________________
ex x-cart guru
Reply With Quote
  #5  
Old 12-09-2002, 11:08 PM
 
cyberactive cyberactive is offline
 

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

Default

Here's my php code to create a product list.

I've made a seperate php file for this. But I don't know how to integrate it into the look and feel of X-cart....

Code:
<TABLE ALIGN=CENTER VALIGN=TOP WIDTH=100%> <? $db = mysql_connect("address","username","password"); mysql_select_db("datasename",$db); $cats = mysql_query("SELECT * FROM xcart_categories order by category"); while ($row1 = mysql_fetch_array($cats)) { $currentcat = $row1["category"]; echo " <tr> <td> </td> </tr> <tr> <td width=\"300\"> <font face=\"arial\">$currentcat:</font> </td> </tr> "; $result = mysql_query("SELECT xcart_categories.category, xcart_pricing.price, xcart_products.product, xcart_products.descr FROM (xcart_categories INNER JOIN xcart_products ON xcart_categories.categoryid=xcart_products.categoryid) INNER JOIN xcart_pricing ON xcart_pricing.productid=xcart_products.productid WHERE xcart_categories.category = \"$currentcat\""); while ($myrow = mysql_fetch_array($result)) { $product = $myrow["product"]; $prijs = $myrow["price"]; $desc = $myrow["desc"]; echo " <tr> <td> <font face=\"arial\">$product</font> </td> <td width=\"100\" align=\"right\"> <font face=\"arial\">$prijs</font> </td> </tr> "; } } ?> </table>
__________________
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
  #6  
Old 12-09-2002, 11:14 PM
 
funkydunk funkydunk is offline
 

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

Default

Thankyou.

I will be able to sort this now - cheers for the code.
__________________
ex x-cart guru
Reply With Quote
  #7  
Old 12-10-2002, 12:46 AM
 
funkydunk funkydunk is offline
 

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

Default

Sorted.

Had to create a new php file based upon home.php. I called it list_all.php

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"); ?>

This includes another file based upon products.php
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"; $products = func_search_products($search_query, $user_account['membership']); $smarty->assign("products",$products); $smarty->assign("navigation_script","total_list.php?main=listall"); ?>

It also includes a template customer/list_all.tpl which is identical to home.tpl except that I hard coded the page title.

customer/home_main.tpl was amended by adding:

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

and creating a template as customer/main/show_all.tpl
This is effectively the original product listing in customer/main/product.tpl but I split it out so that I could show additional columns such as the category name and also to add the dialog box. I could be bothered to fully integrate this part. You will see what I mean when you run it.


__________________
ex x-cart guru
Reply With Quote
  #8  
Old 12-10-2002, 12:48 AM
 
funkydunk funkydunk is offline
 

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

Default

forgot to say that the file is called by going to yourdomain.com/total_list.php?main=listall

Also that I have sorted it by category name but this can be changed by amending the sql order by code in all_products.php.
__________________
ex x-cart guru
Reply With Quote
  #9  
Old 12-10-2002, 01:02 AM
 
cyberactive cyberactive is offline
 

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

Default

Wow Funkydunk.

You've completed the script.
Now I'll try to implement it....

Cool :P
__________________
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
  #10  
Old 12-10-2002, 01:05 AM
 
funkydunk funkydunk is offline
 

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

Default

cyberactive,

It doesnt split by category like your list did but it is integrated.
__________________
ex x-cart guru
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 03:54 PM.

   

 
X-Cart forums © 2001-2020