Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezproductsupplier.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezarticlesupplier.php,v 1.4 2001/07/19 12:19:21 jakobn Exp $
5 //
6 // Definition of eZArticleSupplier class
7 //
8 // Created on: <04-May-2001 17:14:30 amos>
9 //
10 // This source file is part of Exponential Basic, publishing software.
11 //
12 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
31
35 class eZProductSupplier
36 {
37 function eZProductSupplier()
38 {
39 }
40
44 function &urlTypes()
45 {
46 return $this->UrlTypes;
47 }
48
52 function moduleName()
53 {
54 return "eZTrade";
55 }
56
60 function &urlList( $type, $category = 0, $offset = 0 )
61 {
62 $ini =& eZINI::instance( 'site.ini' );
63 $ret = false;
64 switch( $type )
65 {
66 case "product":
67 {
68 include_once( "eztrade/classes/ezproduct.php" );
69 include_once( "eztrade/classes/ezproductcategory.php" );
70 $limit = $ini->variable( "eZTradeMain", "ProductLimit" );
71 $cat = new eZProductCategory( $category );
72 $categories = $cat->getByParent( $cat );
73 $products = $cat->products( "alpha", false, $offset, $limit );
74 $num_products = $cat->productCount( $cat->sortMode(), true );
75 $path = $cat->path( $category );
76 $category_path = array();
77 foreach( $path as $path_item )
78 {
79 $category_path[] = array( "id" => $path_item[0],
80 "name" => $path_item[1] );
81 }
82 $category_array = array();
83 $category_url = "/trade/categorylist";
84 foreach( $categories as $category )
85 {
86 $id = $category->id();
87 $url = "$category_url/$id";
88 $category_array[] = array( "name" => $category->name(),
89 "id" => $id,
90 "url" => $url );
91 }
92 $product_array = array();
93 $product_url = "/trade/productview";
94 foreach( $products as $product )
95 {
96 $id = $product->id();
97 $cat = $product->categoryDefinition();
98 $cat = $cat->id();
99 $url = "$product_url/$id";
100 $product_array[] = array( "name" => $product->name(),
101 "id" => $id,
102 "url" => $url );
103 }
104 $ret = array();
105 $ret["path"] = $category_path;
106 $ret["categories"] = $category_array;
107 $ret["items"] = $product_array;
108 $ret["item_total_count"] = $num_products;
109 $ret["max_items_shown"] = $limit;
110 break;
111 }
112 }
113 return $ret;
114 }
115
116 function &item( $type, $id, $is_category )
117 {
118 $ret = false;
119 switch( $type )
120 {
121 case "product":
122 {
123 if ( $is_category )
124 {
125 include_once( "eztrade/classes/ezproductcategory.php" );
126 $category = new eZProductCategory( $id );
127 $category_url = "/trade/productlist";
128 $url = "$category_url/$id";
129 $ret = array( "name" => $category->name(),
130 "id" => $id,
131 "url" => $url );
132 }
133 else
134 {
135 include_once( "eztrade/classes/ezproduct.php" );
136 $product = new eZProduct( $id );
137 $product_url = "/trade/productview";
138 $cat = $product->categoryDefinition();
139 $cat = $cat->id();
140 $url = "$product_url/$id";
141 $ret = array( "name" => $product->name(),
142 "id" => $id,
143 "url" => $url );
144 }
145 }
146 }
147 return $ret;
148 }
149
150 var $UrlTypes = array( "product" => "{intl-product}" );
151 }
152
153 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
eZProductCategory
Definition: ezproductcategory.php:90
eZProductSupplier
Definition: ezproductsupplier.php:36
eZProductSupplier\$UrlTypes
$UrlTypes
Definition: ezproductsupplier.php:150
eZProductSupplier\item
& item( $type, $id, $is_category)
Definition: ezproductsupplier.php:116
eZProductSupplier\moduleName
moduleName()
Definition: ezproductsupplier.php:52
eZProductSupplier\urlList
& urlList( $type, $category=0, $offset=0)
Definition: ezproductsupplier.php:60
eZProductSupplier\eZProductSupplier
eZProductSupplier()
Definition: ezproductsupplier.php:37
eZProductSupplier\urlTypes
& urlTypes()
Definition: ezproductsupplier.php:44
eZProduct
Definition: ezproduct.php:71
$ini
$ini
Definition: classes/admin/linklist.php:64
$type
$type
Definition: classes/admin/linkselect.php:220
$id
$id
Definition: companytypelist.php:193
$categories
$categories
Definition: ezarticle/admin/categoryedit.php:636
$cat
if(isset( $DeleteCategories)) $cat
Definition: ezforum/admin/categoryedit.php:49
$limit
$limit
Definition: ezimagecatalogue/admin/imagelist.php:312
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
$offset
$offset
Definition: ezstats/admin/cron.php:51
$product
$product
Definition: homepage.php:202
$url
$url
Definition: messagereviewlist.php:153
$category_array
$category_array
Definition: todoedit.php:604
$products
$products
Definition: user/imageview.php:142
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.