Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezproduct.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezproduct.php 9895 2004-04-06 11:08:44Z br $
5 //
6 // Definition of eZProduct class
7 //
8 // Created on: <11-Sep-2000 22:10:06 bf>
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 //
30
54 // include_once( "classes/ezdb.php" );
55 // include_once( "classes/ezdatetime.php" );
56 // include_once( "classes/ezcurrency.php" );
57 // include_once( "classes/ezlocale.php" );
58
59 // include_once( "eztrade/classes/ezoption.php" );
60 // include_once( "eztrade/classes/ezproductcategory.php" );
61 // include_once( "ezimagecatalogue/classes/ezimage.php" );
62 // include_once( "eztrade/classes/ezproducttype.php" );
63 // include_once( "eztrade/classes/ezvattype.php" );
64 // include_once( "eztrade/classes/ezvoucher.php" );
65 // include_once( "eztrade/classes/ezvoucherinformation.php" );
66 // include_once( "eztrade/classes/ezproductcategory.php" );
67 // include_once( "eztrade/classes/ezshippinggroup.php" );
68 // include_once( "eztrade/classes/ezproductpricerange.php" );
69
70 class eZProduct
71 {
78 function __construct( $id="" )
79 {
80 $this->ExpiryTime = 0;
81 $this->FlatCombine = 0;
82 $this->Weight = 0;
83 $this->StockDate = 0;
84
85 if ( $id != "" )
86 {
87 $this->ID = $id;
88 $this->get( $this->ID );
89 }
90 else
91 {
92 // default verdier
93 $this->ShowPrice = true;
94 $this->ShowProduct = true;
95 $this->Discontinued = false;
96 }
97 }
98
102 function store()
103 {
104 $db =& eZDB::globalDatabase();
105 $db->begin();
106
107 if ( $this->ShowPrice == true )
108 $showPrice = 1;
109 else
110 $showPrice = 0;
111
112 if ( $this->ShowProduct == true )
113 $showProduct = 1;
114 else
115 $showProduct = 0;
116
117 if ( $this->Discontinued == true )
118 $discontinued = 1;
119 else
120 $discontinued = 0;
121
122 if ( isset( $this->Price ) and $this->Price != "" and is_numeric( $this->Price ) )
123 {
124 $price = "'$this->Price'";
125 }
126 else
127 {
128 $price = "NULL";
129 }
130
131 if ( isSet( $this->ListPrice ) and $this->ListPrice != "" and is_numeric( $this->ListPrice ) )
132 {
133 $listPrice = "'$this->ListPrice'";
134 }
135 else
136 {
137 $listPrice = "NULL";
138 }
139 if ( $this->FlatCombine == null )
140 {
141 $this->FlatCombine = 0;
142 }
143 if ( $this->StockDate == null )
144 {
145 $this->StockDate = 0;
146 }
147
148 $name = $db->escapeString( $this->Name );
149 $brief = $db->escapeString( $this->Brief );
150 $description = $db->escapeString( $this->Description );
151 $keywords = $db->escapeString( $this->Keywords );
152 $productNumber = $db->escapeString( $this->ProductNumber );
153 $contents = $db->escapeString( $this->Contents );
154
155 if ( !isset( $this->ID ) )
156 {
157 $timeStamp = (new eZDateTime())->timeStamp( true );
158 $db->lock( "eZTrade_Product" );
159 $nextID = $db->nextID( "eZTrade_Product", "ID" );
160 $query = "INSERT INTO eZTrade_Product
161 ( ID,
162 Name,
163 Contents,
164 Keywords,
165 ProductNumber,
166 Price,
167 ListPrice,
168 ShowPrice,
169 ShowProduct,
170 Discontinued,
171 ExternalLink,
172 RemoteID,
173 IsHotDeal,
174 Weight,
175 VATTypeID,
176 BoxTypeID,
177 ProductType,
178 ShippingGroupID,
179 Published,
180 ExpiryTime,
181 StockDate,
182 IncludesVAT,
183 FlatUPS,
184 FlatUSPS,
185 FlatCombine )
186 VALUES
187 ( '$nextID',
188 '$name',
189 '$contents',
190 '$keywords',
191 '$productNumber',
192 $price,
193 $listPrice,
194 '$showPrice',
195 '$showProduct',
196 '$discontinued',
197 '$this->ExternalLink',
198 '$this->RemoteID',
199 '$this->IsHotDeal',
200 '$this->Weight',
201 '$this->VATTypeID',
202 '$this->BoxTypeID',
203 '$this->ProductType',
204 '$this->ShippingGroupID',
205 '$timeStamp',
206 '$this->ExpiryTime',
207 '$this->StockDate',
208 '$this->IncludesVAT',
209 '$this->FlatUPS',
210 '$this->FlatUSPS',
211 '$this->FlatCombine' )";
212
213 $res = $db->query( $query );
214 $db->unlock();
215 $this->ID = $nextID;
216 }
217 else
218 {
219 $query = "UPDATE eZTrade_Product SET
220 Name='$name',
221 Contents='$contents',
222 Keywords='$keywords',
223 ProductNumber='$productNumber',
224 CatalogNumber='$catalogNumber',
225 Price=$price,
226 ListPrice=$listPrice,
227 ShowPrice='$showPrice',
228 ShowProduct='$showProduct',
229 Discontinued='$discontinued',
230 ExternalLink='$this->ExternalLink',
231 IsHotDeal='$this->IsHotDeal',
232 Weight='$this->Weight',
233 VATTypeID='$this->VATTypeID',
234 BoxTypeID='$this->BoxTypeID',
235 ShippingGroupID='$this->ShippingGroupID',
236 ProductType='$this->ProductType',
237 Published=Published,
238 ExpiryTime='$this->ExpiryTime',
239 StockDate='$this->StockDate',
240 IncludesVAT='$this->IncludesVAT',
241 FlatUPS='$this->FlatUPS',
242 FlatUSPS='$this->FlatUSPS',
243 FlatCombine='$this->FlatCombine'
244 WHERE ID='$this->ID'
245 ";
246
247 $res = $db->query( $query );
248 }
249
250 if ( $res == false )
251 {
252 $db->rollback( );
253 }
254 else
255 $db->commit();
256
257 return true;
258 }
259
263 function get( $id="", $categoryID = false )
264 {
265 $db =& eZDB::globalDatabase();
266 $ret = false;
267
268 if ( $id != "" )
269 {
270 $permissionTableSQL = "";
271 $permissionSQL = "";
272 if ( is_Numeric( $categoryID ) )
273 {
274 $permissionSQLArray = eZProductCategory::generatePermissionSQL( false );
275 $permissionTableSQL = $permissionSQLArray["TableSQL"];
276 $permissionSQL = $permissionSQLArray["SQL"];
277 }
278 $query = "SELECT eZTrade_Product.* FROM eZTrade_Product $permissionTableSQL WHERE $permissionSQL eZTrade_Product.ID='$id'";
279
280 $db->array_query( $category_array, $query );
281 if ( count( $category_array ) > 1 )
282 {
283 die( "Error: Category's with the same ID was found in the database. This shouldent happen." );
284 }
285 else if ( count( $category_array ) == 1 )
286 {
287 $this->ID =& $category_array[0][$db->fieldName( "ID" )];
288 $this->Name =& $category_array[0][$db->fieldName( "Name" )];
289 $this->Contents =& $category_array[0][$db->fieldName( "Contents" )];
290 $this->Keywords =& $category_array[0][$db->fieldName( "Keywords" )];
291 $this->ProductNumber =& $category_array[0][$db->fieldName( "ProductNumber" )];
292 $this->CatalogNumber =& $category_array[0][$db->fieldName( "CatalogNumber" )];
293 $this->ExternalLink =& $category_array[0][$db->fieldName( "ExternalLink" )];
294 $this->Price =& $category_array[0][$db->fieldName( "Price" )];
295 $this->ListPrice =& $category_array[0][$db->fieldName( "ListPrice" )];
296 $this->IsHotDeal =& $category_array[0][$db->fieldName( "IsHotDeal" )];
297 $this->Weight =& $category_array[0][$db->fieldName( "Weight" )];
298 $this->RemoteID =& $category_array[0][$db->fieldName( "RemoteID" )];
299 $this->VATTypeID =& $category_array[0][$db->fieldName( "VATTypeID" )];
300 $this->BoxTypeID =& $category_array[0][$db->fieldName( "BoxTypeID" )];
301 $this->ShippingGroupID =& $category_array[0][$db->fieldName( "ShippingGroupID" )];
302 $this->ProductType =& $category_array[0][$db->fieldName( "ProductType" )];
303 $this->ExpiryTime =& $category_array[0][$db->fieldName( "ExpiryTime" )];
304 $this->StockDate =& $category_array[0][$db->fieldName( "StockDate" )];
305 $this->IncludesVAT =& $category_array[0][$db->fieldName( "IncludesVAT" )];
306 $this->FlatUPS =& $category_array[0][$db->fieldName( "FlatUPS" )];
307 $this->FlatUSPS =& $category_array[0][$db->fieldName( "FlatUSPS" )];
308 $this->FlatCombine =& $category_array[0][$db->fieldName( "FlatCombine")];
309 if ( $this->Price == "NULL" )
310 unset( $this->Price );
311 if ( $this->ListPrice == "NULL" )
312 unset( $this->ListPrice );
313 if ( $category_array[0][ $db->fieldName( "ShowPrice" )] == 1 )
314 $this->ShowPrice = true;
315 else
316 $this->ShowPrice = false;
317
318 if ( $category_array[0][$db->fieldName( "ShowProduct" )] == 1 )
319 $this->ShowProduct = true;
320 else
321 $this->ShowProduct = false;
322
323 if ( $category_array[0][$db->fieldName( "Discontinued" )] == 1 )
324 $this->Discontinued = true;
325 else
326 $this->Discontinued = false;
327 $ret = true;
328 }
329 }
330 return $ret;
331 }
332
337 function delete()
338 {
339 $db = eZDB::globalDatabase();
340 $qry_array = array();
341 $db->begin();
342
343 if ( isset( $this->ID ) )
344 {
345 echo "Removing: ". $this->ID;
346 $res[] = $db->query( "DELETE FROM eZTrade_ProductTypeLink WHERE ProductID='$this->ID'" );
347 $res[] = $db->query( "DELETE FROM eZTrade_AttributeValue WHERE ProductID='$this->ID'" );
348
349 $res[] = $db->query( "DELETE FROM eZTrade_ProductCategoryLink WHERE ProductID='$this->ID'" );
350 $res[] = $db->query( "DELETE FROM eZTrade_ProductCategoryDefinition WHERE ProductID='$this->ID'" );
351
352 $res[] = $db->query( "DELETE FROM eZTrade_ProductImageLink WHERE ProductID='$this->ID'" );
353 $res[] = $db->query( "DELETE FROM eZTrade_ProductImageDefinition WHERE ProductID='$this->ID'" );
354 $res[] = $db->query( "DELETE FROM eZTrade_ProductForumLink WHERE ProductID='$this->ID'" );
355
356 $db->array_query( $qry_array, "SELECT QuantityID FROM eZTrade_ProductQuantityDict
357 WHERE ProductID='$this->ID'" );
358 foreach( $qry_array as $row )
359 {
360 $id = $row[$db->fieldName( "QuantityID" )];
361 $res[] = $db->query( "DELETE FROM eZTrade_Quantity WHERE ID='$id'" );
362 }
363 $res[] = $db->query( "DELETE FROM eZTrade_ProductQuantityDict WHERE ProductID='$this->ID'" );
364
365 $db->commit();
366 $db->begin();
367 $options = $this->options();
368 foreach ( $options as $option )
369 {
370 $option->delete();
371 }
372
373 $query = "DELETE FROM eZTrade_Product WHERE ID='$this->ID';";
374 $res[] = $db->query( $query );
375
376 if ( in_array( false, $res ) )
377 $db->rollback( );
378 else
379 $db->commit();
380 }
381 return true;
382 }
383
387 function id()
388 {
389 return $this->ID;
390 }
391
395 function name( )
396 {
397 // return htmlspecialchars( $this->Name );
398 return stripslashes( $this->Name );
399 }
400
404 function &remoteID( )
405 {
406 return $this->RemoteID;
407 }
408
409
413 function &price()
414 {
415 return $this->Price;
416 }
417
421 function &listPrice()
422 {
423 return $this->ListPrice;
424 }
425
429 function flatUps()
430 {
431 return $this->FlatUPS;
432 }
433
437 function flatUsps()
438 {
439 return $this->FlatUSPS;
440 }
441
445 function flatCombine()
446 {
447 return $this->FlatCombine;
448 }
453 function correctPrice( $calcVAT, $withPriceGroups = true )
454 {
455 $db =& eZDB::globalDatabase();
456 $inUser =& eZUser::currentUser();
457 $price = 0;
458
459 if ( is_a( $inUser, "eZUser" ) && $withPriceGroups == true )
460 {
461 $groups = eZPriceGroup::priceGroups( $inUser, false );
462
463 $priceIdArr = eZPriceGroup::prices( $this->ID );
464
465 for( $i=0; $i< count( $priceIdArr ); $i++ )
466 {
467 $priceId = $priceIdArr[$i][$db->fieldName( "PriceID" )];
468
469 if ( in_Array( $priceId, $groups ) )
470 {
471 $tmpPrice = eZPriceGroup::correctPrice( $this->ID, $priceId );
472
473 if ( $tmpPrice < $price || !$price )
474 $price = $tmpPrice;
475 }
476 }
477 }
478
479 if ( empty( $price ) || $price == 0 )
480 {
481 $price = $this->Price;
482 }
483
484 $vatType =& $this->vatType();
485
486 if ( $calcVAT == true )
487 {
488 if ( $this->excludedVAT() )
489 {
490 $vatType =& $this->vatType();
491 $vat = 0;
492
493 if ( $vatType )
494 {
495 $vat =& $vatType->value();
496 }
497
498 $price = ( $price * $vat / 100 ) + $price;
499 }
500 }
501 else
502 {
503 if ( $this->includesVAT() )
504 {
505 $vatType =& $this->vatType();
506 $vat = 0;
507
508 if ( $vatType )
509 {
510 $vat =& $vatType->value();
511 }
512
513 $price = $price - ( $price / ( $vat + 100 ) ) * $vat;
514
515 }
516 }
517 return $price;
518 }
519
523 function localeSavings( $calcVAT )
524 {
525 $inUser =& eZUser::currentUser();
526 $ini =& eZINI::instance( 'site.ini' );
527 $inLanguage = $ini->variable( "eZTradeMain", "Language" );
528
529 $locale = new eZLocale( $inLanguage );
530 $currency = new eZCurrency();
531
532 $price = $this->correctSavings( $calcVAT );
533 $currency->setValue( $price );
534 $returnString = $locale->format( $currency );
535
536 return $returnString;
537 }
538
543 function correctSavings( $calcVAT )
544 {
545 $db =& eZDB::globalDatabase();
546 $inUser =& eZUser::currentUser();
547 $maxPrice = 0;
548 $price = 0;
549
550 if ( is_a( $inUser, "eZUser" ) )
551 {
552 $groups = eZPriceGroup::priceGroups( $inUser, false );
553 $priceIdArr = eZPriceGroup::prices( $this->ID );
554
555 for( $i=0; $i< count( $priceIdArr ); $i++ )
556 {
557 $priceId = $priceIdArr[$i][$db->fieldName( "PriceID" )];
558 if ( in_Array( $priceId, $groups ) )
559 {
560 $tmpPrice = eZPriceGroup::correctPrice( $this->ID, $priceId );
561 if ( $tmpPrice < $price || !$price )
562 {
563 $price = $tmpPrice;
564 }
565 if ( $tmpPrice <= $maxPrice )
566 {
567 $maxPrice = $tmpPrice;
568 }
569 }
570 }
571 }
572
573 if ( empty( $price ) )
574 {
575 $price = $this->Price;
576 }
577
578 if ( $maxPrice <= $price )
579 {
580 $maxPrice = $this->Price;
581 }
582
583 if ( $maxPrice > $price )
584 {
585 $savings = $maxPrice - $price;
586 }
587 else
588 {
589 $savings = 0;
590 }
591
592 $vatType = $this->vatType();
593
594 if ( $calcVAT == true )
595 {
596 if ( $this->excludedVAT() )
597 {
598 $vatType = $this->vatType();
599 $vat = 0;
600
601 if ( $vatType )
602 {
603 $vat = $vatType->value();
604 }
605
606 $savings = ( $savings * $vat / 100 ) + $savings;
607 }
608 }
609 else
610 {
611 if ( $this->includesVAT() )
612 {
613 $vatType = $this->vatType();
614 $vat = 0;
615
616 if ( $vatType )
617 {
618 $vat = $vatType->value();
619 }
620
621 $savings = $savings - ( $savings / ( $vat + 100 ) ) * $vat;
622
623 }
624 }
625
626
627 return $savings;
628 }
629
634 function correctPriceRange( $calcVAT, $withPriceGroups = true )
635 {
636 $inUser =& eZUser::currentUser();
637
638 if ( !is_a( $inUser, "eZUser" ) )
639 {
640 $inUser = new eZUser();
641 }
642 if ( $withPriceGroups == true )
643 $groups = eZPriceGroup::priceGroups( $inUser, false );
644 else
645 $groups = array();
646
647 $options = $this->options();
648
649 $lowPrice = 0;
650 $maxPrice = 0;
651
652 foreach ( $options as $option )
653 {
654 $tmpLowPrice = eZPriceGroup::lowestPrice( $this->ID, $groups, $option->id() );
655 $tmpMaxPrice = eZPriceGroup::highestPrice( $this->ID, $groups, $option->id() );
656
657 $lowPrice += $tmpLowPrice;
658
659 $maxPrice += $tmpMaxPrice;
660 }
661
662 $vat = $this->vatPercentage();
663 $productHasVAT = $this->includesVAT();
664 if ( $calcVAT == true )
665 {
666 if ( $productHasVAT == false )
667 {
668 $lowPrice = ( $lowPrice * $vat / 100 ) + $lowPrice;
669 $maxPrice = ( $maxPrice * $vat / 100 ) + $maxPrice;
670 }
671 }
672 else
673 {
674 if ( $productHasVAT == true )
675 {
676 $lowPrice = $lowPrice - ( $lowPrice / ( $vat + 100 ) ) * $vat;
677 $maxPrice = $maxPrice - ( $maxPrice / ( $vat + 100 ) ) * $vat;
678 }
679
680 }
681
682
683 $lowPrice += $this->correctPrice( $calcVAT, $withPriceGroups );
684 $maxPrice += $this->correctPrice( $calcVAT, $withPriceGroups );
685
686 $price["max"] = $maxPrice;
687 $price["min"] = $lowPrice;
688 return $price;
689 }
690
694 function &localePrice( $calcVAT, $withPriceGroups = true )
695 {
696 $inUser =& eZUser::currentUser();
697 $ini =& eZINI::instance( 'site.ini' );
698 $inLanguage = $ini->variable( "eZTradeMain", "Language" );
699
700 $locale = new eZLocale( $inLanguage );
701 $currency = new eZCurrency();
702
703 if ( $this->hasOptions() )
704 {
705 $highCurrency = new eZCurrency();
706 $lowCurrency = new eZCurrency();
707
708 $prices = $this->correctPriceRange( $calcVAT, $withPriceGroups );
709 $highCurrency->setValue( $prices["max"] );
710 $lowCurrency->setValue( $prices["min"] );
711 if ( $prices["min"] != $prices["max"] )
712 $returnString = $locale->format( $lowCurrency ) . " - " .$locale->format( $highCurrency );
713 else
714 $returnString = $locale->format( $highCurrency );
715 }
716 else
717 {
718 $price = $this->correctPrice( $calcVAT, $withPriceGroups );
719 $currency->setValue( $price );
720 $returnString = $locale->format( $currency );
721 }
722
723 return $returnString;
724 }
725
729 function hasPrice()
730 {
731 return isset( $this->Price );
732 }
733
740 function &priceExVAT( $price="", $calcVAT = true )
741 {
742 if ( $price == "" )
743 {
744 $calcPrice = $this->Price;
745 }
746 else
747 {
748 $calcPrice = $price;
749 }
750
751 $vatType =& $this->vatType();
752
753 if ( $this->includesVAT() )
754 {
755 $vat = 0;
756
757 if ( $vatType )
758 {
759 $value =& $vatType->value();
760
761 $vat = ( $calcPrice / ( $value + 100 ) ) * $value;
762 }
763
764 $priceExVat = $calcPrice - $vat;
765 }
766
767
768 return $priceExVat;
769 }
770
777 function &priceIncVAT( $price="" )
778 {
779 if ( $price == "" )
780 {
781 $calcPrice = $this->Price;
782 }
783 else
784 {
785 $calcPrice = $price;
786 }
787
788 $vatType =& $this->vatType();
789
790 $vat = 0;
791
792 $priceExVat = $calcPrice;
793
794 if ( $this->excludedVAT() )
795 {
796 if ( $vatType )
797 {
798 $value =& $vatType->value();
799
800 $vat = $priceExVat / 100 * $value ;
801 }
802
803 }
804 else
805 {
806 if ( $vatType )
807 {
808 $value =& $vatType->value();
809 $vat = $calcPrice / ( 100 + $value ) * $value;
810 $priceExVat = $calcPrice - ( $calcPrice / ( 100 + $value ) * $value);
811 }
812 }
813 $returnArray = array( "Price" => $priceExVat, "VAT" => $vat );
814 return $returnArray;
815 }
816
820 function vatPercentage()
821 {
822 $vatType =& $this->vatType();
823 if ( $vatType )
824 return $vatType->value();
825 }
826
830 function &vat( $price="" )
831 {
832 return $this->extractVAT( $price );
833 }
834
835 function &extractVAT( $price="" )
836 {
837 if ( $price == "" )
838 {
839 $calcPrice = $this->Price;
840 }
841 else
842 {
843 $calcPrice = $price;
844 }
845
846 $vatType =& $this->vatType();
847 $vat = 0;
848 if ( $this->includesVAT() )
849 {
850 if ( $vatType )
851 {
852 $value =& $vatType->value();
853 $vat = ( $calcPrice / ( $value + 100 ) ) * $value;
854 }
855 }
856 else
857 {
858 if ( $vatType )
859 {
860 $value =& $vatType->value();
861 $vat = $calcPrice - ( $calcPrice / $value + 100 );
862 }
863 }
864 return $vat;
865 }
866
873 function &addVAT( $price="" )
874 {
875 if ( $price == "" )
876 {
877 $calcPrice = $this->Price;
878 }
879 else
880 {
881 $calcPrice = $price;
882 }
883
884 $vatType =& $this->vatType();
885 $vat = 0;
886 if ( $vatType )
887 {
888 $value =& $vatType->value();
889 $vat = ( $calcPrice * $value ) / 100;
890 }
891
892 return $vat;
893 }
894
901 function productType( $price="" )
902 {
903 return $this->ProductType;
904 }
905
909 function expiryTime()
910 {
911 return $this->ExpiryTime;
912 }
913
917 function stockDate()
918 {
919 return $this->StockDate;
920 }
921
928 function setProductType( $type=1 )
929 {
930 $this->ProductType = $type;
931 }
932
936 function setTotalQuantity( $quantity )
937 {
938 $id = $this->ID;
939 $db =& eZDB::globalDatabase();
940 $db->array_query( $qry_array,
941 "SELECT Q.ID
942 FROM eZTrade_Quantity AS Q, eZTrade_ProductQuantityDict AS PQD
943 WHERE Q.ID=PQD.QuantityID AND ProductID='$id'" );
944 $db->begin();
945 $res[] = $db->query( "DELETE FROM eZTrade_ProductQuantityDict WHERE ProductID='$id'" );
946
947 $db->commit();
948 $db->begin();
949 foreach( $qry_array as $row )
950 {
951 $q_id = $row[$db->fieldName( "ID" )];
952 $res[] = $db->query( "DELETE FROM eZTrade_Quantity WHERE ID='$q_id'" );
953 }
954 if ( is_bool( $quantity ) and !$quantity )
955 return;
956
957 $db->lock( "eZTrade_Quantity" );
958 $nextQuantityID = $db->nextID( "eZTrade_Quantity", "ID" );
959 $res[] = $db->query( "INSERT INTO eZTrade_Quantity ( ID, Quantity ) VALUES ('$nextQuantityID','$quantity')" );
960 $q_id = $nextQuantityID;
961 $db->lock( "eZTrade_ProductQuantityDict" );
962 $res[] = $db->query( "INSERT INTO eZTrade_ProductQuantityDict ( ProductID, QuantityID ) VALUES ('$id','$q_id')" );
963
964 $db->unlock();
965
966 if ( in_array( false, $res ) )
967 $db->rollback();
968 else
969 $db->commit();
970 }
971
975 function setExpiryTime( $time )
976 {
977 $this->ExpiryTime = $time;
978 }
979
983 function setStockDate( $time )
984 {
985 $this->StockDate = $time;
986 }
987
992 function totalQuantity( $id = false )
993 {
994 if ( !$id )
995 $id = $this->ID;
996 $db =& eZDB::globalDatabase();
997 $db->array_query( $qry_array,
998 "SELECT Q.Quantity
999 FROM eZTrade_Quantity AS Q, eZTrade_ProductQuantityDict AS PQD
1000 WHERE Q.ID=PQD.QuantityID AND ProductID='$id'" );
1001
1002 $quantity = 0;
1003 if ( count( $qry_array ) > 0 )
1004 {
1005 foreach( $qry_array as $row )
1006 {
1007 if ( $row[$db->fieldName( "Quantity" )] == "NULL" )
1008 return false;
1009 $quantity += $row[$db->fieldName( "Quantity" )];
1010 }
1011 }
1012 else
1013 return false;
1014 return $quantity;
1015 }
1016
1021 function hasQuantity( $require = true, $id = false )
1022 {
1023 if ( !$id )
1024 $id = $this->ID;
1025 $quantity = eZProduct::totalQuantity( $id );
1026
1027 if ( is_bool($quantity) or !$require or ( $require and $quantity > 0 ) )
1028 return true;
1029 return false;
1030 }
1031
1037 static public function namedQuantity( $quantity )
1038 {
1039 $db =& eZDB::globalDatabase();
1040 $name = false;
1041 if ( is_bool( $quantity ) and !$quantity )
1042 {
1043 $db->array_query( $qry_array, "SELECT Name FROM eZTrade_QuantityRange
1044 WHERE MaxRange=-1", array( "Limit" => 1 ), 1 );
1045
1046 if ( count( $qry_array ) == 1 )
1047 {
1048 $name = $qry_array[0][$db->fieldName( "Name" )];
1049 }
1050 }
1051 else
1052 {
1053 $db->array_query( $qry_array, "SELECT Name FROM eZTrade_QuantityRange
1054 WHERE MaxRange IS NOT NULL AND MaxRange>=$quantity
1055 ORDER BY MaxRange", array( "Limit" => 1 ), 1 );
1056 $name = "";
1057 if ( count( $qry_array ) == 1 )
1058 {
1059 $name = $qry_array[0][$db->fieldName( "Name" )];
1060 }
1061 else
1062 {
1063 $db->array_query( $qry_array, "SELECT Name FROM eZTrade_QuantityRange
1064 WHERE MaxRange IS NULL", array( "Limit" => 1 ), 1 );
1065 if ( count( $qry_array ) == 1 )
1066 $name = $qry_array[0][$db->fieldName( "Name" )];
1067 else
1068 $name = $quantity;
1069 }
1070 }
1071 return $name;
1072 }
1073
1077 function &keywords( )
1078 {
1079 if ( !is_null( $this->Keywords ) )
1080 return htmlspecialchars( $this->Keywords );
1081 else
1082 return false;
1083 }
1084
1088 function &productNumber( )
1089 {
1090 if ( !is_null( $this->ProductNumber ) )
1091 return htmlspecialchars( $this->ProductNumber );
1092 else
1093 return false;
1094
1095 }
1099 function &catalogNumber( )
1100 {
1101 if ( is_null( $this->CatalogNumber ) )
1102 return false;
1103
1104 return htmlspecialchars( string: $this->CatalogNumber );
1105 }
1109 function &contents( )
1110 {
1111 return stripslashes($this->Contents);
1112 }
1113
1114 // returns Box Type ID
1115 function &BoxTypeID( )
1116 {
1117 return $this->BoxTypeID;
1118 }
1119
1127 function &brief( )
1128 {
1129 // include_once( "ezarticle/classes/ezarticlerenderer.php" );
1130 $renderer = new eZArticleRenderer( $this );
1131 $articleContents = $renderer->renderPage( 0 );
1132
1133 return $articleContents[0];
1134 }
1135
1136 function &briefPlain( )
1137 {
1138 //include_once( "ezarticle/classes/ezarticlegenerator.php" );
1139 //include_once( "ezarticle/classes/ezarticlerenderer.php" );
1140
1141 // $renderer = new eZArticleRenderer( $this );
1142 // $articleContents = $renderer->renderPage( -1 );
1143 /*
1144 $generator = new eZArticleGenerator( );
1145 $articleContents =& $generator->decodeXML( $this->content);
1146
1147 $generator = new eZArticleGenerator();
1148 $contentsArray =& $generator->decodeXML( $product->contents() );
1149 */
1150 /*
1151 $renderer = new eZArticleRenderer( $this );
1152 $articleContents = $renderer->renderPage( -1 );
1153 */
1154
1155 $generator = new eZArticleGenerator();
1156 $articleContents =& $generator->decodeXML( $this->Contents );
1157
1158 // print_r($contentsArray); exit();
1159
1160 return $articleContents[0];
1161 }
1162
1166 function &description( )
1167 {
1168 // include_once( "ezarticle/classes/ezarticlerenderer.php" );
1169 $renderer = new eZArticleRenderer( $this );
1170 $articleContents = $renderer->renderPage( -1 );
1171
1172 return $articleContents[1];
1173 }
1174
1175 function &descriptionPlain( )
1176 {
1177 include_once( "ezarticle/classes/ezarticlegenerator.php" );
1178 include_once( "ezarticle/classes/ezarticlerenderer.php" );
1179
1180 // $renderer = new eZArticleRenderer( $this );
1181 // $articleContents = $renderer->renderPage( 0 );
1182 /*
1183 $generator = new eZArticleGenerator( );
1184 $articleContents =& $generator->decodeXML( $this->contents );
1185
1186 $renderer = new eZArticleRenderer( $this );
1187 $articleContents = $renderer->renderPage( -1 );
1188 */
1189
1190 $generator = new eZArticleGenerator();
1191 $articleContents =& $generator->decodeXML( $this->Contents );
1192
1193 return $articleContents[1];
1194 }
1195
1200 function showPrice()
1201 {
1202 return $this->ShowPrice;
1203 }
1204
1205
1209 function showProduct()
1210 {
1211 return $this->ShowProduct;
1212 }
1213
1217 function discontinued()
1218 {
1219 return $this->Discontinued;
1220 }
1221
1225 function externalLink()
1226 {
1227 if( $this->ExternalLink != "" )
1228 return htmlspecialchars( $this->ExternalLink );
1229 else
1230 return false;
1231 }
1232
1236 function weight()
1237 {
1238 $ini =& eZINI::instance( 'site.ini' );
1239 if ( $this->Weight != 0 )
1240 return $this->Weight;
1241 else return $ini->variable( "eZTradeMain", "DefaultWeight" );
1242 }
1243
1248 function isHotDeal()
1249 {
1250 $ret = false;
1251 if ( $this->IsHotDeal == 1 )
1252 {
1253 $ret = true;
1254 }
1255
1256 return $ret;
1257 }
1258
1259
1263 function setName( $value )
1264 {
1265 $this->Name =& $value;
1266 }
1267
1271 function setRemoteID( $remoteID )
1272 {
1273 $this->RemoteID = $remoteID;
1274 }
1275
1279 function setBrief( $value )
1280 {
1281 $this->Brief = $value;
1282 }
1283
1287 function setDescription( $value )
1288 {
1289 $this->Description = $value;
1290 }
1294 function setContents( $value )
1295 {
1296 $this->Contents = $value;
1297 }
1298
1302 function setKeywords( $value )
1303 {
1304 $this->Keywords = $value;
1305 }
1306
1310 function setProductNumber( $value )
1311 {
1312 $this->ProductNumber = $value;
1313 }
1314
1318 function setCatalogNumber( $value )
1319 {
1320 $this->CatalogNumber = $value;
1321 }
1322
1326 function setPrice( $value )
1327 {
1328 $this->Price = $value;
1329 setType( $this->Price, "double" );
1330
1331 }
1332
1336 function setListPrice( $value )
1337 {
1338 $this->ListPrice = $value;
1339 setType( $this->ListPrice, "double" );
1340
1341 }
1342
1346 function setShowPrice( $value )
1347 {
1348 $this->ShowPrice = $value;
1349 setType( $this->ShowPrice, "integer" );
1350 }
1351
1355 function setShowProduct( $value )
1356 {
1357 $this->ShowProduct = $value;
1358 settype( $this->ShowProduct, "integer" );
1359 }
1360
1365 function setDiscontinued( $value )
1366 {
1367 $this->Discontinued = $value;
1368 setType( $this->Discontinued, "integer" );
1369 }
1370
1374 function setExternalLink( $value )
1375 {
1376 $this->ExternalLink = $value;
1377 }
1378
1382 function setWeight( $value )
1383 {
1384 $this->Weight = $value;
1385 }
1386
1392 function setIsHotDeal( $value )
1393 {
1394 if ( $value == true )
1395 {
1396 $this->IsHotDeal = 1;
1397 }
1398 else
1399 {
1400 $this->IsHotDeal = 0;
1401 }
1402 }
1406 function setFlatUPS ( $value )
1407 {
1408 $this->FlatUPS = $value;
1409 }
1410
1414 function setFlatUSPS ( $value )
1415 {
1416 $this->FlatUSPS = $value;
1417 }
1418
1422 function setFlatCombine ( $value )
1423 {
1424 $this->FlatCombine = $value;
1425 }
1426
1430 function addOption( $value )
1431 {
1432 if ( is_a( $value, "eZOption" ) )
1433 {
1434 $optionID = $value->id();
1435 $value->store();
1436
1437 $db =& eZDB::globalDatabase();
1438 $db->begin();
1439 $db->lock( "eZTrade_ProductOptionLink" );
1440 $nextID = $db->nextID( "eZTrade_ProductOptionLink", "ID" );
1441 $res = $db->query( "delete from eZTrade_ProductOptionLink where ProductID='$this->ID' AND OptionID='$optionID'" );
1442 $res = $db->query( "INSERT INTO eZTrade_ProductOptionLink ( ID, ProductID, OptionID ) VALUES ( '$nextID', '$this->ID', '$optionID' )" );
1443 $db->unlock();
1444 if ( $res == false )
1445 {
1446 $db->rollback( );
1447 }
1448 else
1449 $db->commit();
1450 }
1451 }
1452
1456 function options()
1457 {
1458 $return_array = array();
1459 $option_array = array();
1460 $db =& eZDB::globalDatabase();
1461
1462 $db->array_query( $option_array, "SELECT OptionID FROM eZTrade_ProductOptionLink WHERE ProductID='$this->ID'" );
1463 for ( $i = 0; $i < count( $option_array ); $i++ )
1464 {
1465 $return_array[$i] = new eZOption( $option_array[$i][$db->fieldName( "OptionID" )], true );
1466 }
1467
1468 return $return_array;
1469 }
1470
1474 function hasOptions()
1475 {
1476 $return_value = false;
1477 $option_array = array();
1478 $db =& eZDB::globalDatabase();
1479
1480 $db->array_query( $option_array, "SELECT OptionID FROM eZTrade_ProductOptionLink WHERE ProductID='$this->ID'" );
1481
1482 if ( count( $option_array ) > 0 )
1483 {
1484 $return_value = true;
1485 }
1486
1487 return $return_value;
1488 }
1489
1493 function addImage( $value, $placement = false )
1494 {
1495 $db =& eZDB::globalDatabase();
1496 $image_array = array();
1497 $res = array();
1498
1499 if( is_a( $value, "eZImage" ) )
1500 $value = $value->id();
1501
1502 $db->query_single( $res, "SELECT count( * ) as Count FROM eZTrade_ProductImageLink WHERE ProductID='$this->ID' AND ImageID='$value'" );
1503 if( $res[$db->fieldName("Count")] == 0 )
1504 {
1505 $db->begin( );
1506
1507 $db->lock( "eZTrade_ProductImageLink" );
1508
1509 if ( is_bool( $placement ) )
1510 {
1511 $db->array_query( $image_array, "SELECT ID, ImageID, Placement, Created FROM eZTrade_ProductImageLink WHERE ProductID='$this->ID' ORDER BY Placement DESC" );
1512
1513
1514
1515 if ( $image_array[0][$db->fieldName("Placement")] == "0" )
1516 {
1517 $placement=1;
1518 for ( $i=0; $i < count($image_array); $i++ )
1519 {
1520 $imageLinkID = $image_array[$i][$db->fieldName("ID")];
1521 $db->query( "UPDATE eZTrade_ProductImageLink SET Placement='$placement' WHERE ID='$imageLinkID'" );
1522 $image_array[$i][$db->fieldName("Placement")] = $placement;
1523 $placement++;
1524 }
1525 }
1526 $placement = $image_array[0][$db->fieldName("Placement")] + 1;
1527 }
1528
1529 $nextID = $db->nextID( "eZTrade_ProductImageLink", "ID" );
1530 $timeStamp = (new eZDateTime())->timeStamp( true );
1531
1532 $res = $db->query( "INSERT INTO eZTrade_ProductImageLink
1533 ( ID, ProductID, ImageID, Created, Placement )
1534 VALUES
1535 ( '$nextID', '$this->ID', '$value', '$timeStamp', '$placement' )" );
1536
1537 $db->unlock();
1538
1539 if ( $res == false )
1540 $db->rollback( );
1541 else
1542 $db->commit();
1543 }
1544 }
1545
1551 function deleteImage( $value )
1552 {
1553 if( is_a( $value, "eZImage" ) )
1554 {
1555 $imageID = $value->id();
1556
1557 $db =& eZDB::globalDatabase();
1558 $db->begin();
1559 $res[] = $db->query( "DELETE FROM eZTrade_ProductImageLink WHERE ProductID='$this->ID' AND ImageID='$imageID'" );
1560 $res[] = $db->query( "DELETE FROM eZTrade_ProductImageDefinition WHERE ProductID='$this->ID' AND MainImageID='$imageID'" );
1561 $res[] = $db->query( "DELETE FROM eZTrade_ProductImageDefinition WHERE ProductID='$this->ID' AND ThumbnailImageID='$imageID'" );
1562 if ( in_array( false, $res ) )
1563 $db->rollback();
1564 else
1565 $db->commit();
1566 }
1567 }
1568
1572 function &images()
1573 {
1574 $return_array = array();
1575 $image_array = array();
1576
1577 $db =& eZDB::globalDatabase();
1578 $db->array_query( $image_array, "SELECT ID, ImageID, Placement FROM eZTrade_ProductImageLink WHERE ProductID='$this->ID' ORDER BY Created" );
1579
1580 // convert the database if placement is not set
1581 if ( count( $image_array ) > 0 )
1582 {
1583 if ( $image_array[0][$db->fieldName("Placement")] == "0" )
1584 {
1585 $placement=1;
1586 for ( $i=0; $i < count($image_array); $i++ )
1587 {
1588 $imageLinkID = $image_array[$i][$db->fieldName("ID")];
1589 $db->query( "UPDATE eZTrade_ProductImageLink SET Placement='$placement' WHERE ID='$imageLinkID'" );
1590
1591 $image_array[$i][$db->fieldName("Placement")] = $placement;
1592 $placement++;
1593 }
1594 }
1595 }
1596
1597 for ( $i=0; $i < count($image_array); $i++ )
1598 {
1599 $return_array[$i]["Image"] = new eZImage( $image_array[$i][$db->fieldName("ImageID")] );
1600 $return_array[$i]["Placement"] = $image_array[$i][$db->fieldName("Placement")];
1601 }
1602
1603 return $return_array;
1604 }
1605
1611 function setMainImage( $image )
1612 {
1613 $db =& eZDB::globalDatabase();
1614 $db->begin();
1615 if( is_a( $image, "eZImage" ) )
1616 {
1617 $imageID = $image->id();
1618
1619 $db->array_query( $res_array, "SELECT COUNT(*) AS Number FROM eZTrade_ProductImageDefinition
1620 WHERE
1621 ProductID='$this->ID'" );
1622
1623 if ( $res_array[0][$db->fieldName( "Number" )] == "1" )
1624 {
1625 $res[] = $db->query( "UPDATE eZTrade_ProductImageDefinition
1626 SET
1627 MainImageID='$imageID'
1628 WHERE
1629 ProductID='$this->ID'" );
1630 }
1631 else
1632 {
1633 $db->lock( "eZTrade_ProductImageDefinition" );
1634 $res[] = $db->query( "INSERT INTO eZTrade_ProductImageDefinition
1635 ( ProductID, MainImageID )
1636 VALUES ( '$this->ID', '$imageID' )
1637 " );
1638 $db->unlock();
1639 }
1640 }
1641 else if ( $image == false )
1642 {
1643 $db->array_query( $res_array, "SELECT COUNT(*) AS Number FROM eZTrade_ProductImageDefinition
1644 WHERE
1645 ProductID='$this->ID'" );
1646
1647 if ( $res_array[0][$db->fieldName( "Number" )] == "1" )
1648 {
1649 $res[] = $db->query( "UPDATE eZTrade_ProductImageDefinition
1650 SET
1651 MainImageID='0'
1652 WHERE
1653 ProductID='$this->ID'" );
1654 }
1655 }
1656
1657 if ( in_array( false, $res ) )
1658 $db->rollback( );
1659 else
1660 $db->commit();
1661 }
1662
1668 function setThumbnailImage( $image )
1669 {
1670 $db =& eZDB::globalDatabase();
1671 $db->begin();
1672
1673 if( is_a( $image, "eZImage" ) )
1674 {
1675 $imageID = $image->id();
1676
1677 $db->array_query( $res_array, "SELECT COUNT(*) AS Number FROM eZTrade_ProductImageDefinition
1678 WHERE
1679 ProductID='$this->ID'" );
1680
1681 if ( $res_array[0][$db->fieldName( "Number" )] == "1" )
1682 {
1683 $res[] = $db->query( "UPDATE eZTrade_ProductImageDefinition
1684 SET
1685 ThumbnailImageID='$imageID'
1686 WHERE
1687 ProductID='$this->ID'" );
1688 }
1689 else
1690 {
1691 $db->lock( "eZTrade_ProductImageDefinition" );
1692
1693 $res[] = $db->query( "INSERT INTO eZTrade_ProductImageDefinition
1694 ( ProductID, ThumbnailImageID )
1695 VALUES
1696 ( '$this->ID',
1697 '$imageID' )" ) ;
1698 $db->unlock();
1699 }
1700 }
1701 else if ( $image == false )
1702 {
1703 $db->array_query( $res_array, "SELECT COUNT(*) AS Number FROM eZTrade_ProductImageDefinition
1704 WHERE
1705 ProductID='$this->ID'" );
1706
1707 if ( $res_array[0][$db->fieldName( "Number" )] == "1" )
1708 {
1709 $res[] = $db->query( "UPDATE eZTrade_ProductImageDefinition
1710 SET
1711 ThumbnailImageID='0'
1712 WHERE
1713 ProductID='$this->ID'" );
1714 }
1715 }
1716
1717 if ( in_array( false, $res ) )
1718 $db->rollback( );
1719 else
1720 $db->commit();
1721 }
1722
1728 function mainImage( )
1729 {
1730 $db =& eZDB::globalDatabase();
1731 $ret = false;
1732 $res = $db->array_query( $res_array, "SELECT * FROM eZTrade_ProductImageDefinition
1733 WHERE
1734 ProductID='$this->ID'
1735 " );
1736
1737 if ( count( $res_array ) == 1 )
1738 {
1739 if ( $res_array[0][$db->fieldName( "MainImageID" )] != "NULL" )
1740 {
1741 $ret = new eZImage( $res_array[0][$db->fieldName( "MainImageID" )], false );
1742 }
1743 }
1744
1745 return $ret;
1746 }
1747
1751 function thumbnailImage( )
1752 {
1753 $db =& eZDB::globalDatabase();
1754 $ret = false;
1755
1756 $db->array_query( $res_array, "SELECT * FROM eZTrade_ProductImageDefinition
1757 WHERE
1758 ProductID='$this->ID'
1759 " );
1760
1761 if ( count( $res_array ) == 1 )
1762 {
1763 if ( is_numeric( $res_array[0][$db->fieldName( "ThumbnailImageID" )] ) )
1764 {
1765 $ret = new eZImage( $res_array[0][$db->fieldName( "ThumbnailImageID" )], false );
1766 }
1767 }
1768
1769 return $ret;
1770
1771 }
1772
1777 function activeProductSearch( $query=false, $offset=false, $limit=false , $active=TRUE, $sortMode="time")
1778 {
1779 $db =& eZDB::globalDatabase();
1780 $ret = array();
1781 $res_array = array();
1782
1783 if ( $active==FALSE )
1784 $activeText="";
1785 else
1786 $activeText=" ShowProduct='1' AND ";
1787
1788 // kracker: 6/12/2002: added sortMode to activeProductSearch, this creates a new paramiter dependancies for productsearch.
1789 // ps does this actualy even check active status ? better add the code to do it hommie!
1790
1791 switch( $sortMode )
1792 {
1793 case 1 :
1794 case "time" :
1795 {
1796 $OrderBy = "eZTrade_Product.Published DESC";
1797 }
1798 break;
1799
1800 case 2 :
1801 case "alpha" :
1802 {
1803 $OrderBy = "eZTrade_Product.Name ASC";
1804 }
1805 break;
1806
1807
1808 case 3 :
1809 case "alphadesc" :
1810 {
1811 $OrderBy = "eZTrade_Product.Name DESC";
1812 }
1813 break;
1814
1815 case 4 :
1816 case "absolute_placement" :
1817 {
1818 $OrderBy = "eZTrade_ProductCategoryLink.Placement ASC";
1819 }
1820 break;
1821
1822 default :
1823 {
1824 $OrderBy = "eZTrade_Product.Published DESC";
1825 }
1826 }
1827
1828
1829 $nonActiveCode = "";
1830 $discontinuedCode = "";
1831
1832 // This looks like hardcoded logic which should be abstracted, tisk tisk.
1833 $fetchNonActive = false;
1834 $fetchDiscontinued = false;
1835
1836 if ( $fetchNonActive == true && $fetchDiscontinued == true )
1837 {
1838 $nonActiveCode = "";
1839 $discontinuedCode = "";
1840 }
1841 elseif ( $fetchNonActive == false && $fetchDiscontinued == false)
1842 {
1843 $nonActiveCode = "AND ShowProduct='1'";
1844 $discontinuedCode = "AND Discontinued='0'";
1845 }
1846 elseif ( $fetchNonActive == false && $fetchDiscontinued == true)
1847 {
1848 $nonActiveCode = "AND ShowProduct='1'";
1849 $discontinuedCode = "AND Discontinued='1'";
1850 }
1851 elseif ( $fetchNonActive == true && $fetchDiscontinued == false)
1852 {
1853 $nonActiveCode = "";
1854 $discontinuedCode = "AND Discontinued='0'";
1855 }
1856 else
1857 {
1858 $nonActiveCode = "AND ShowProduct='1'";
1859 $discontinuedCode = "";
1860 }
1861 $query = "SELECT ID FROM eZTrade_Product
1862 WHERE
1863 Name LIKE '%$query%' OR
1864 Description LIKE '%$query%' OR
1865 ( ProductNumber LIKE '%$query%' ) OR
1866 ( CatalogNumber LIKE '%$query%' ) OR
1867 ( Keywords LIKE '%$query%' )
1868 $nonActiveCode
1869 $discontinuedCode
1870 ORDER BY $OrderBy";
1871
1872 $db->array_query( $res_array, $query,
1873 array( "Limit" => $limit, "Offset" => $offset ) );
1874
1875 // $db->array_query( $res_array, "SELECT ID FROM eZTrade_Product
1876 // WHERE
1877 // ( Name LIKE '%$query%' ) OR
1878 // ( Description LIKE '%$query%' ) OR
1879 // ( Keywords LIKE '%$query%' )",
1880 // array( "Limit" => $limit, "Offset" => $offset ) );
1881
1882 foreach ( $res_array as $product )
1883 {
1884 $ret[] = new eZProduct( $product[$db->fieldName( "ID" )] );
1885 }
1886
1887 return $ret;
1888 }
1889
1893 function activeProductSearchCount( $query, $active=TRUE )
1894 {
1895 $db =& eZDB::globalDatabase();
1896 $ret = array();
1897
1898 if ( $active==FALSE )
1899 $activeText="";
1900 else
1901 $activeText=" ShowProduct='1' AND ";
1902
1903 $db->array_query( $res_array, "SELECT count(ID) AS Count FROM eZTrade_Product
1904 WHERE
1905 $activeText
1906 (( Name LIKE '%$query%' ) OR
1907 ( Description LIKE '%$query%' ) OR
1908 ( ProductNumber LIKE '%$query%' ) OR
1909 ( Keywords LIKE '%$query%' ))
1910 " );
1911
1912 return $res_array[0][$db->fieldName( "Count" )];
1913 }
1914
1920 function extendedSearch( $priceLower, $priceHigher, $text, $offset=0, $limit=10, $categoryArrayID=array() )
1921 {
1922 $db =& eZDB::globalDatabase();
1923
1924 $products = array();
1925
1926 if ( is_numeric( $priceLower ) )
1927 {
1928 $price = " AND eZTrade_Product.Price > $priceLower";
1929 }
1930 if ( is_numeric( $priceHigher ) )
1931 {
1932 $price .= " AND eZTrade_Product.Price < $priceHigher";
1933 }
1934
1935 $text = trim( $text );
1936 if ( $text != "" )
1937 {
1938 $query = new eZQuery( array( "eZTrade_Product.Name", "eZTrade_Product.Keywords", "eZTrade_Product.Description" ), $text );
1939 if ( $price || $categorySQL )
1940 $text = "AND (" . $query->buildQuery() . ")";
1941 else
1942 $text = "AND (" . $query->buildQuery() . ")";
1943 }
1944
1945 $tables = array();
1946
1947 foreach ( $categoryArrayID as $cat )
1948 {
1949 $id = $cat[$db->fieldName( "id" )];
1950 $table = "eZTrade_ExtendedTemp$id";
1951 $tables[] = $table;
1952 $db->query( "CREATE TEMPORARY TABLE $table
1953 ( ProductID int(11) NOT NULL, PRIMARY KEY( ProductID ) )" );
1954 $cats =& $cat["categories"];
1955 $catSQL = "";
1956 $i = 0;
1957 foreach ( $cats as $cat_item )
1958 {
1959 if ( $i > 0 )
1960 $catSQL .= " OR ";
1961 $catSQL .= "eZTrade_ProductCategoryLink.CategoryID='$cat_item'";
1962 ++$i;
1963 }
1964 $db->query( "INSERT INTO $table(ProductID)
1965 SELECT eZTrade_Product.ID FROM eZTrade_Product, eZTrade_ProductCategoryLink
1966 WHERE eZTrade_Product.ID=eZTrade_ProductCategoryLink.ProductID AND ( $catSQL )
1967 GROUP BY eZTrade_Product.ID" );
1968 }
1969
1970 reset( $tables );
1971 list($key,$first_table) = each($tables);
1972 $i = 0;
1973 $table_sql = "";
1974 $table_from = ", $first_table";
1975 while( list($key,$table) = each($tables) )
1976 {
1977 if ( $i > 0 )
1978 $table_sql = " AND ";
1979 $table_sql .= "$first_table.ProductID=$table.ProductID";
1980 $table_from .= ", $table";
1981 ++$i;
1982 }
1983 if ( count( $tables ) > 0 )
1984 $table_sql = "( $table_sql )";
1985
1986 $queryString = "SELECT eZTrade_Product.ID as PID
1987 FROM eZTrade_Product, eZTrade_ProductCategoryLink $table_from
1988 WHERE $table_sql $price $text AND
1989 eZTrade_Product.ID = $first_table.ProductID GROUP BY PID LIMIT $offset, $limit";
1990
1991 $db->array_query( $res_array, $queryString );
1992
1993 if ( count ( $res_array ) > 0 )
1994 {
1995 foreach( $res_array as $productItem )
1996 {
1997 $products[] = new eZProduct( $productItem["PID"] );
1998 }
1999 }
2000
2001 foreach( $tables as $table )
2002 {
2003 $db->query( "DROP TABLE $table" );
2004 }
2005
2006 return $products;
2007 }
2008
2009
2013 function extendedSearchCount( $priceLower, $priceHigher, $text, $categoryArrayID=array() )
2014 {
2015 $db =& eZDB::globalDatabase();
2016
2017 $db->begin();
2018
2019 $products = array();
2020
2021 if ( is_numeric( $priceLower ) )
2022 {
2023 $price = " AND eZTrade_Product.Price > $priceLower";
2024 }
2025 if ( is_numeric( $priceHigher ) )
2026 {
2027 $price .= " AND eZTrade_Product.Price < $priceHigher";
2028 }
2029 $text = trim( $text );
2030 if ( $text != "" )
2031 {
2032 $query = new eZQuery( array( "eZTrade_Product.Name", "eZTrade_Product.Keywords", "eZTrade_Product.Description" ), $text );
2033 if ( $price || $categorySQL )
2034 $text = "AND (" . $query->buildQuery() . ")";
2035 else
2036 $text = "AND (" . $query->buildQuery() . ")";
2037 }
2038
2039 $tables = array();
2040
2041 foreach( $categoryArrayID as $cat )
2042 {
2043 $id = $cat[$db->fieldName( "id" )];
2044 $table = "eZTrade_ExtendedTemp$id";
2045 $tables[] = $table;
2046 $db->query( "CREATE TEMPORARY TABLE $table
2047 ( ProductID int(11) NOT NULL, PRIMARY KEY( ProductID ) )" );
2048 $cats =& $cat["categories"];
2049 $catSQL = "";
2050 $i = 0;
2051 foreach( $cats as $cat_item )
2052 {
2053 if ( $i > 0 )
2054 $catSQL .= " OR ";
2055 $catSQL .= "eZTrade_ProductCategoryLink.CategoryID='$cat_item'";
2056 ++$i;
2057 }
2058 $db->query( "INSERT INTO $table(ProductID)
2059 SELECT eZTrade_Product.ID FROM eZTrade_Product, eZTrade_ProductCategoryLink
2060 WHERE eZTrade_Product.ID=eZTrade_ProductCategoryLink.ProductID AND ( $catSQL )
2061 GROUP BY eZTrade_Product.ID" );
2062 }
2063
2064 reset( $tables );
2065 list($key,$first_table) = each($tables);
2066 $i = 0;
2067 $table_sql = "";
2068 $table_from = ", $first_table";
2069 while( list($key,$table) = each($tables) )
2070 {
2071 if ( $i > 0 )
2072 $table_sql = " AND ";
2073 $table_sql .= "$first_table.ProductID=$table.ProductID";
2074 $table_from .= ", $table";
2075 ++$i;
2076 }
2077 if ( count( $tables ) > 0 )
2078 $table_sql = "( $table_sql )";
2079
2080 $queryString = "SELECT count( DISTINCT eZTrade_Product.ID ) AS Count
2081 FROM eZTrade_Product, eZTrade_ProductCategoryLink $table_from
2082 WHERE $table_sql $price $text AND
2083 eZTrade_Product.ID = $first_table.ProductID";
2084 $db->query_single( $res_array, $queryString );
2085
2086 foreach( $tables as $table )
2087 {
2088 $db->query( "DROP TABLE $table" );
2089 }
2090
2091 return $res_array[$db->fieldName( "Count" )];
2092 }
2093
2094
2098 function &hotDealProducts( $limit = false )
2099 {
2100 $limit_text = '';
2101 if ( is_numeric( $limit ) and $limit >= 0 )
2102 {
2103 $limit_text = "array( \"Limit\" => $limit, \"Offset\" => 0 )";
2104 }
2105
2106 $permissionSQLArray = eZProductCategory::generatePermissionSQL( false );
2107 $permissionTableSQL = $permissionSQLArray["TableSQL"];
2108 $permissionSQL = $permissionSQLArray["SQL"];
2109
2110 $ret = array();
2111 $db =& eZDB::globalDatabase();
2112 $query = "SELECT eZTrade_Product.ID FROM eZTrade_Product $permissionTableSQL
2113 WHERE
2114 $permissionSQL IsHotDeal='1' ORDER BY Name";
2115 $db->array_query( $res_array, $query, $limit_text );
2116
2117 foreach ( $res_array as $product )
2118 {
2119 $ret[] = new eZProduct( $product[$db->fieldName( "ID" )] );
2120 }
2121
2122 return $ret;
2123
2124 }
2125
2129 function &findProductNumber( $id )
2130 {
2131 $db =& eZDB::globalDatabase();
2132
2133 $product = false;
2134
2135 $db->array_query( $res, "SELECT ID FROM
2136 eZTrade_Product
2137 WHERE ProductNumber='$id'" );
2138
2139 if ( count( $res ) == 1 )
2140 {
2141 $product = new eZProduct( $res[0][$db->fieldName( "ID" )] );
2142 }
2143
2144 return $product;
2145 }
2146
2147
2153 function categories( $as_object = true )
2154 {
2155 $db =& eZDB::globalDatabase();
2156
2157 $ret = array();
2158 $db->array_query( $category_array, "SELECT * FROM eZTrade_ProductCategoryLink WHERE ProductID='$this->ID'" );
2159
2160 if ( $as_object )
2161 {
2162 foreach ( $category_array as $category )
2163 {
2164 $ret[] = new eZProductCategory( $category[$db->fieldName( "CategoryID" )] );
2165 }
2166 }
2167 else
2168 {
2169 foreach ( $category_array as $category )
2170 {
2171 $ret[] = $category[$db->fieldName( "CategoryID" )];
2172 }
2173 }
2174
2175 return $ret;
2176 }
2177
2178
2182 function removeFromCategories()
2183 {
2184 $db =& eZDB::globalDatabase();
2185 $db->begin();
2186
2187 $res = $db->query( "DELETE FROM eZTrade_ProductCategoryLink WHERE ProductID='$this->ID'" );
2188 eZDB::finish( $res, $db );
2189
2190 }
2191
2196 function existsInCategory( $category )
2197 {
2198 $ret = false;
2199 if ( is_a( $category, "eZProductCategory" ) )
2200 {
2201 $db =& eZDB::globalDatabase();
2202 $catID = $category->id();
2203
2204 $db->array_query( $ret_array, "SELECT ID FROM eZTrade_ProductCategoryLink
2205 WHERE ProductID='$this->ID' AND CategoryID='$catID'" );
2206
2207 if ( count( $ret_array ) == 1 )
2208 {
2209 $ret = true;
2210 }
2211 }
2212 return $ret;
2213 }
2214
2219 function setCategoryDefinition( $value )
2220 {
2221 if ( is_a( $value, "eZProductCategory" ) )
2222 {
2223 $db =& eZDB::globalDatabase();
2224 $res = array();
2225 $db->begin();
2226
2227 $categoryID = $value->id();
2228
2229 $db->query( "DELETE FROM eZTrade_ProductCategoryDefinition
2230 WHERE ProductID='$this->ID'" );
2231
2232 $db->lock( "eZTrade_ProductCategoryDefinition" );
2233 $nextID = $db->nextID( "eZTrade_ProductCategoryDefinition", "ID" );
2234
2235 $query = "INSERT INTO eZTrade_ProductCategoryDefinition
2236 ( ID,
2237 CategoryID,
2238 ProductID )
2239 VALUES
2240 ( '$nextID',
2241 '$categoryID',
2242 '$this->ID' )";
2243
2244 $res[] = $db->query( $query );
2245
2246 $db->unlock();
2247 $db->commit();
2248
2249 return $res[0];
2250 }
2251 }
2252
2256 function categoryDefinition( $as_object = true )
2257 {
2258 $db =& eZDB::globalDatabase();
2259 $res = array();
2260
2261 $query = "SELECT CategoryID FROM
2262 eZTrade_ProductCategoryDefinition
2263 WHERE ProductID='$this->ID'";
2264
2265 $db->array_query( $res, $query );
2266 $category = false;
2267
2268 if ( count( $res ) == 1 )
2269 {
2270 if ( $as_object )
2271 $category = new eZProductCategory( $res[0][$db->fieldName( "CategoryID" )] );
2272 else
2273 $category = $res[0][$db->fieldName( "CategoryID" )];
2274 }
2275 else
2276 {
2277 print( "<br><b>Failed to fetch product category definition for ID $this->ID</b><br>" );
2278 debug_print_backtrace();
2279 }
2280
2281 return $category;
2282 }
2283
2287 function setType( $type )
2288 {
2289 if ( is_a( $type, "eZProductType" ) )
2290 {
2291 $db =& eZDB::globalDatabase();
2292 $db->begin();
2293
2294 $typeID = $type->id();
2295 $db->array_query( $typeArray, "SELECT ID FROM eZTrade_ProductTypeLink WHERE ProductID='$this->ID'" );
2296
2297 $res[] = $db->query( "DELETE FROM eZTrade_AttributeValue
2298 WHERE ProductID='$this->ID'" );
2299
2300 if ( count( $typeArray ) == 0 )
2301 {
2302 $db->lock( "eZTrade_ProductTypeLink" );
2303 $nextID = $db->nextID( "eZTrade_ProductTypeLink", "ID" );
2304 $query = "INSERT INTO eZTrade_ProductTypeLink
2305 ( ID,
2306 TypeID,
2307 ProductID )
2308 VALUES
2309 ( '$nextID',
2310 '$typeID',
2311 '$this->ID' )";
2312 $db->unlock();
2313 $res[] = $db->query( $query );
2314 }
2315 else
2316 {
2317 $res[] = $db->query( "UPDATE eZTrade_ProductTypeLink SET
2318 TypeID='$typeID',
2319 ProductID='$this->ID'
2320 WHERE ID='" . $typeArray[0][$db->fieldName( "ID" )] . "'" );
2321 }
2322
2323 eZDB::finish( $res, $db );
2324 }
2325 }
2326
2330 function type( )
2331 {
2332 $db =& eZDB::globalDatabase();
2333
2334 $db->array_query( $res, "SELECT TypeID FROM
2335 eZTrade_ProductTypeLink
2336 WHERE ProductID='$this->ID'" );
2337
2338 $type = false;
2339
2340 if ( count( $res ) == 1 )
2341 {
2342 $type = new eZProductType( $res[0][$db->fieldName( "TypeID" )] );
2343 }
2344
2345 return $type;
2346 }
2347
2351 function removeType()
2352 {
2353 $db =& eZDB::globalDatabase();
2354 $db->begin();
2355
2356 // delete values
2357 $res[] = $db->query( "DELETE FROM eZTrade_AttributeValue
2358 WHERE ProductID='$this->ID'" );
2359
2360 $res[] = $db->query( "DELETE FROM eZTrade_ProductTypeLink
2361 WHERE ProductID='$this->ID'" );
2362 eZDB::finish( $res, $db );
2363
2364 }
2365
2369 function getByRemoteID( $id )
2370 {
2371 $db =& eZDB::globalDatabase();
2372
2373 $product = false;
2374
2375 $db->array_query( $res, "SELECT ID FROM
2376 eZTrade_Product
2377 WHERE RemoteID='$id'" );
2378
2379 if ( count( $res ) == 1 )
2380 {
2381 $product = new eZProduct( $res[0][$db->fieldName( "ID" )] );
2382 }
2383
2384 return $product;
2385 }
2386
2390 function productName( $id )
2391 {
2392 $db =& eZDB::globalDatabase();
2393 $ret = false;
2394
2395 if ( $id != "" )
2396 {
2397 $db->array_query( $product_array, "SELECT * FROM eZTrade_Product WHERE ID='$id'" );
2398
2399 if( count( $product_array ) == 1 )
2400 {
2401 $ret =& $product_array[0][$db->fieldName( "Name" )];
2402 }
2403 }
2404
2405 return $ret;
2406 }
2407
2411 function setVATType( $type )
2412 {
2413 $db =& eZDB::globalDatabase();
2414
2415 if ( is_a( $type, "eZVATType" ) )
2416 {
2417 $this->VATTypeID = $type->id();
2418 }
2419 }
2420
2424 function setBoxType( $type )
2425 {
2426 $db =& eZDB::globalDatabase();
2427
2428 if ( get_class( $type ) == "ezboxtype" )
2429 {
2430 $this->BoxTypeID = $type->id();
2431 }
2432 elseif ($type="false")
2433 $this->BoxTypeID = -1;
2434 }
2435
2441 function boxType( )
2442 {
2443 $db =& eZDB::globalDatabase();
2444
2445 $ret = false;
2446 if ( is_numeric( $this->BoxTypeID ) and ( $this->BoxTypeID > 0 ) )
2447 {
2448 $ret = new eZBoxType( $this->BoxTypeID );
2449 }
2450 // else $ret = new eZBoxType( 1 );
2451
2452 return $ret;
2453 }
2454
2460 function vatType( )
2461 {
2462 $user =& eZUser::currentUser();
2463 $ret = new eZVATType();
2464
2465 $ini =& eZINI::instance( 'site.ini' );
2466 if ( $ini->variable( "eZTradeMain", "PricesIncVATBeforeLogin" ) == "enabled" )
2467 $useVAT = true;
2468 else
2469 $useVAT = false;
2470
2471 if ( $ini->variable( "eZTradeMain", "CountryVATDiscrimination" ) == "enabled" )
2472 $CountryDisc = true;
2473 else
2474 $CountryDisc = false;
2475
2476
2477 if ( is_a ( $user, "eZUser" ) && $CountryDisc == true )
2478 {
2479 $mainAddress = $user->mainAddress();
2480 if ( is_a ( $mainAddress, "eZAddress" ) )
2481 {
2482 $country = $mainAddress->country();
2483 if ( ( is_a ( $country, "eZCountry" ) ) and ( $country->hasVAT() == true ) )
2484 {
2485 $useVAT = true;
2486 }
2487 else
2488 {
2489 $useVAT = false;
2490 }
2491 }
2492
2493 }
2494
2495 if ( is_a( $user, "eZUser" ) && $CountryDisc == true )
2496 {
2497 $mainAddress = $user->mainAddress();
2498 if ( is_a( $mainAddress , "eZAddress" ) )
2499 {
2500 $region = $mainAddress->region();
2501 if ( ( is_a ( $region, "eZRegion" ) ) and ( $region->hasVAT() == true ) )
2502 {
2503 $useVAT = true;
2504 }
2505 else
2506 {
2507 $useVAT = false;
2508 }
2509 }
2510 }
2511
2512 if ( ( $useVAT == true ) and ( is_numeric( $this->VATTypeID ) ) and ( $this->VATTypeID > 0 ) )
2513 {
2514 $ret = new eZVATType( $this->VATTypeID );
2515 }
2516
2517 return $ret;
2518 }
2519
2523 function setShippingGroup( $group )
2524 {
2525 $db =& eZDB::globalDatabase();
2526
2527 if ( is_a( $group, "eZShippingGroup" ) )
2528 {
2529 $this->ShippingGroupID = $group->id();
2530 }
2531 }
2532
2533
2539 function &shippingGroup( )
2540 {
2541 $db =& eZDB::globalDatabase();
2542
2543 $ret = false;
2544 if ( is_numeric( $this->ShippingGroupID ) and ( $this->ShippingGroupID > 0 ) )
2545 {
2546 $ret = new eZShippingGroup( $this->ShippingGroupID );
2547 }
2548
2549 return $ret;
2550 }
2551
2552 function &priceRange( $id=false )
2553 {
2554 $db =& eZDB::globalDatabase();
2555
2556 if ( !$id )
2557 $id = $this->ID;
2558
2559 $db->query_single( $priceRange, "SELECT ID FROM eZTrade_ProductPriceRange WHERE ProductID='$id'" );
2560
2561 if ( isset( $priceRange[ (int) $db->fieldName( "ID" ) ] ) && is_numeric( $priceRange[ (int) $db->fieldName( "ID" ) ] ) )
2562 $ret = new eZProductPriceRange( $priceRange[ (int) $db->fieldName( "ID" ) ] );
2563 else
2564 $ret = new eZProductPriceRange();
2565
2566 return $ret;
2567 }
2568
2575 function setIncludesVAT( $inValue = true )
2576 {
2577 if ( $inValue == true )
2578 {
2579 $this->IncludesVAT = 1;
2580 }
2581 else
2582 {
2583 $this->IncludesVAT = 0;
2584 }
2585 }
2586
2590 function includesVAT()
2591 {
2592 $ret = false;
2593
2594 if ( $this->IncludesVAT == 1 )
2595 {
2596 $ret = true;
2597 }
2598
2599 return $ret;
2600 }
2601
2605 function excludedVAT()
2606 {
2607 $ret = false;
2608
2609 if ( $this->IncludesVAT == 0 )
2610 {
2611 $ret = true;
2612 }
2613
2614 return $ret;
2615 }
2616
2620 function deleteForms()
2621 {
2622 $db =& eZDB::globalDatabase();
2623
2624 $ProductID = $this->ID;
2625
2626 $query = "DELETE FROM eZTrade_ProductFormDict
2627 WHERE ProductID=$ProductID
2628 ";
2629 $db->query( $query );
2630 }
2631
2632
2636 function addForm( $form )
2637 {
2638 $db =& eZDB::globalDatabase();
2639
2640 if( is_a( $form, "eZForm" ) )
2641 {
2642 $ProductID = $this->ID;
2643 $FormID = $form->id();
2644
2645 $db->begin( );
2646
2647 $db->lock( "eZTrade_ProductFormDict" );
2648
2649 $nextID = $db->nextID( "eZTrade_ProductFormDict", "ID" );
2650
2651 $query = "INSERT INTO eZTrade_ProductFormDict
2652 ( ID, ProductID, FormID )
2653 VALUES ( '$nextID', '$ProductID', '$FormID' )
2654 ";
2655 $res = $db->query( $query );
2656
2657 $db->unlock();
2658
2659 if ( $res == false )
2660 $db->rollback( );
2661 else
2662 $db->commit();
2663
2664 }
2665 }
2666
2670 function forms( $as_object = true)
2671 {
2672 $db =& eZDB::globalDatabase();
2673
2674 // include_once( "ezform/classes/ezform.php" );
2675
2676 $ProductID = $this->ID;
2677
2678 $return_array = array();
2679
2680 $query = "SELECT FormID FROM eZTrade_ProductFormDict
2681 WHERE ProductID=$ProductID
2682 ";
2683
2684 $db->array_query( $ret_array, $query );
2685 $count = count( $ret_array );
2686 for( $i = 0; $i < $count; $i++ )
2687 {
2688 $id = $ret_array[$i][$db->fieldName("FormID")];
2689 $return_array[] = $as_object ? new eZForm( $id ) : $id;
2690 }
2691 return $return_array;
2692 }
2693
2697 function &activeProducts( $sortMode="time",
2698 $offset=0,
2699 $limit=50,
2700 $categoryID=false )
2701 {
2702 return $this->products( $sortMode, false, $offset, $limit, false, $categoryID );
2703 }
2704
2705
2709 function &products( $sortMode="time",
2710 $fetchNonActive=false,
2711 $offset=0,
2712 $limit=50,
2713 $fetchDiscontinued=false,
2714 $categoryID=false )
2715 {
2716 $db =& eZDB::globalDatabase();
2717
2718 switch( $sortMode )
2719 {
2720 case "time" :
2721 {
2722 $OrderBy = "eZTrade_Product.Published DESC";
2723 }
2724 break;
2725
2726 case "alpha" :
2727 {
2728 $OrderBy = "eZTrade_Product.Name ASC";
2729 }
2730 break;
2731
2732 case "alphadesc" :
2733 {
2734 $OrderBy = "eZTrade_Product.Name DESC";
2735 }
2736 break;
2737
2738 default :
2739 {
2740 $OrderBy = "eZTrade_Product.Published DESC";
2741 }
2742 }
2743
2744 $return_array = array();
2745 $product_array = array();
2746
2747 $user =& eZUser::currentUser();
2748 if ( $user )
2749 {
2750 $groups = $user->groups();
2751 }
2752 else
2753 {
2754 $groups = array();
2755 }
2756
2757 $permissionSQLArray = eZProductCategory::generatePermissionSQL( $categoryID );
2758 $permissionTableSQL = $permissionSQLArray["TableSQL"];
2759 $permissionSQL = $permissionSQLArray["SQL"];
2760
2761
2762 if ( $fetchNonActive == true )
2763 {
2764 $nonActiveCode = "";
2765 }
2766 else
2767 {
2768 $nonActiveCode = " eZTrade_Product.ShowProduct='1' AND";
2769 }
2770 $discontinuedCode = "";
2771 if ( !$fetchDiscontinued )
2772 $discontinuedCode = " eZTrade_Product.Discontinued='0'";
2773
2774 $query = "SELECT eZTrade_Product.ID AS ProductID, eZTrade_Product.Name
2775 FROM $permissionTableSQL eZTrade_Product
2776 WHERE
2777 $nonActiveCode
2778 $discontinuedCode
2779 $permissionSQL
2780 ORDER BY $OrderBy";
2781 $db->array_query( $product_array, $query, array( "Limit" => $limit, "Offset" => $offset ) );
2782
2783 for ( $i = 0; $i < count( $product_array ); $i++ )
2784 {
2785 $return_array[$i] = new eZProduct( $product_array[$i][$db->fieldName( "ProductID" )], false );
2786 }
2787 return $return_array;
2788 }
2789
2793 function voucher()
2794 {
2795 $db =& eZDB::globalDatabase();
2796
2797 $ProductID = $this->ID;
2798
2799 $ret = false;
2800
2801 $query = "SELECT ID FROM eZTrade_Voucher
2802 WHERE ProductID='$ProductID'
2803 ";
2804
2805 $db->query_single( $ret, $query );
2806
2807 if ( is_numeric ( $ret["ID"] ) )
2808 {
2809 $ret = new eZVoucher( $ret["ID"] );
2810 }
2811
2812 return $ret;
2813 }
2814
2818 function voucherInformation()
2819 {
2820 $db =& eZDB::globalDatabase();
2821
2822 $ProductID = $this->ID;
2823
2824 $ret = false;
2825
2826 $query = "SELECT ID FROM eZTrade_VoucherInformation
2827 WHERE ProductID='$ProductID'";
2828
2829 $db->query_single( $res, $query );
2830
2831 if ( isset( $res[$db->fieldName( "ID" )] ) )
2832 {
2833 $ret = new eZVoucherInformation( $res[$db->fieldName( "ID" )] );
2834 }
2835
2836 return $ret;
2837 }
2838
2839
2843 function forum( $as_object = true )
2844 {
2845 $ini =& eZINI::instance( 'site.ini' );
2846 $db =& eZDB::globalDatabase();
2847
2848 $db->array_query( $res, "SELECT ForumID FROM
2849 eZTrade_ProductForumLink
2850 WHERE ProductID='$this->ID'" );
2851 $forum = false;
2852 if ( count( $res ) == 1 )
2853 {
2854 if ( $as_object )
2855 $forum = new eZForum( $res[0][$db->fieldName( "ForumID" )] );
2856 else
2857 $forum = $res[0][$db->fieldName( "ForumID" )];
2858 }
2859 else
2860 {
2861 $forum = new eZForum();
2862 $forum->setName( $db->escapeString( $this->Name ) );
2863
2864 $forum->setIsModerated(true);
2865 $moderatorgroup = new eZUserGroup( 1 ); //should be a variable - administrator groupid
2866 $forum->setModerator( $moderatorgroup );
2867
2868 $forum->store();
2869
2870 $ini =& eZINI::instance( 'site.ini' );
2871 $linkModules = $ini->variable( "eZForumMain", "LinkModules" );
2872 $module_array = explode(',', $linkModules );
2873 unset ($linkModules);
2874 foreach ( $module_array as $module)
2875 {
2876 $moduleSubArray = explode( ':', $module );
2877 list($module_name, $forum_id) = $moduleSubArray;
2878 $linkModules[$module_name] = $forum_id;
2879 }
2880
2881 $category = new eZForumCategory( $linkModules['eZTrade'] ); //should be a variable - categoryid
2882 $category->addForum( $forum );
2883
2884 $forumID = $forum->id();
2885
2886 $db->begin( );
2887
2888 $db->lock( "eZTrade_ProductForumLink" );
2889
2890 $nextID = $db->nextID( "eZTrade_ProductForumLink", "ID" );
2891
2892 $res = $db->query( "INSERT INTO eZTrade_ProductForumLink
2893 ( ID, ProductID, ForumID )
2894 VALUES
2895 ( '$nextID', '$this->ID', '$forumID' )" );
2896
2897 $db->unlock();
2898
2899 if ( $res == false )
2900 $db->rollback( );
2901 else
2902 $db->commit();
2903
2904
2905 if ( $as_object )
2906 $forum = new eZForum( $forumID );
2907 else
2908 $forum = $forumID;
2909 /*
2910 //insert reverse-link post
2911 $postTemplate = new eZTemplate( "eztrade/user/" . $ini->variable( "eZTradeMain", "TemplateDir" ),
2912 "eztrade/user/intl", $this->Language, "posttemplate.php" );
2913
2914 $postTemplateIni = new eZINI( "eztrade/user/intl/" . $this->Language . "/posttemplate.php.ini", false );
2915 $postTemplate->set_file( "post_template_tpl", "posttemplate.tpl" );
2916 $postTemplate->setAllStrings();
2917
2918 $NewMessagePostedAt = htmlspecialchars( $ini->variable( "eZForumMain", "FutureDate" ) );
2919 $msg = new eZForumMessage();
2920 $msg->setForumID( $forumID );
2921 */
2922
2923 }
2924 return $forum;
2925 }
2926
2930 function productIDFromForum( $ForumID )
2931 {
2932 $db =& eZDB::globalDatabase();
2933
2934 $ProductID = 0;
2935
2936 $db->array_query( $result, "SELECT ProductID FROM
2937 eZTrade_ProductForumLink
2938 WHERE ForumID='$ForumID' GROUP BY ProductID" );
2939
2940 if( count( $result ) > 0 )
2941 {
2942 $ProductID = $result[0][$db->fieldName("ProductID")];
2943 }
2944
2945 return $ProductID;
2946 }
2947
2952 function addFile( $value )
2953 {
2954 if ( get_class( $value ) == "ezvirtualfile" )
2955 {
2956 $fileID = $value->id();
2957 }
2958 else
2959 $fileID = $value;
2960
2961 $db =& eZDB::globalDatabase();
2962
2963 $db->begin( );
2964
2965 $db->lock( "eZTrade_ProductFileLink" );
2966
2967 $nextID = $db->nextID( "eZTrade_ProductFileLink", "ID" );
2968
2969 $timeStamp = eZDateTime::timeStamp( true );
2970
2971 $res = $db->query( "INSERT INTO eZTrade_ProductFileLink
2972 ( ID, ProductID, FileID, Created ) VALUES ( '$nextID', '$this->ID', '$fileID', '$timeStamp' )" );
2973
2974 $db->unlock();
2975
2976 if ( $res == false )
2977 $db->rollback( );
2978 else
2979 $db->commit();
2980 }
2981
2988 function deleteFile( $value )
2989 {
2990 if ( get_class( $value ) == "ezvirtualfile" )
2991 {
2992 $fileID = $value->id();
2993
2994 }
2995 else
2996 $fileID = $value;
2997
2998 $db =& eZDB::globalDatabase();
2999 $db->query( "DELETE FROM eZTrade_ProductFileLink WHERE ProductID='$this->ID' AND FileID='$fileID'" );
3000 }
3001
3005 function files( $as_object = true )
3006 {
3007 $db =& eZDB::globalDatabase();
3008
3009 $return_array = array();
3010 $file_array = array();
3011
3012 $db->array_query( $file_array, "SELECT FileID, Created FROM eZTrade_ProductFileLink WHERE ProductID='$this->ID' ORDER BY Created" );
3013
3014 for ( $i=0; $i < count($file_array); $i++ )
3015 {
3016 $id = $file_array[$i][$db->fieldName("FileID")];
3017 $return_array[$i] = $as_object ? new eZVirtualFile( $id, false ) : $id;
3018 }
3019
3020 return $return_array;
3021 }
3022
3023
3024 var $ID;
3025 var $Name;
3026
3027 // XML of the product information.
3028 var $Contents;
3029 var $Brief;
3030 var $Description;
3031 var $Keywords;
3032 var $ProductNumber;
3033 var $CatalogNumber;
3034 var $ShowPrice;
3035 var $ShowProduct;
3036 var $Discontinued;
3037 var $ExternalLink;
3038 var $IsHotDeal;
3039 var $Weight;
3040 var $RemoteID;
3041 var $VATTypeID;
3042 var $BoxTypeID;
3043 var $ShippingGroupID;
3044 var $ProductType;
3045 var $Price;
3046 var $ListPrice;
3047 var $ExpiryTime;
3048 var $StockDate;
3049 var $IncludesVAT;
3050 var $FlatUPS;
3051 var $FlatUSPS;
3052 var $FlatDHL;
3053 var $FlatCombine;
3054 }
3055
3056 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$locale
$locale
Definition: admin/adlist.php:127
$i
$i
Definition: admin/adlist.php:91
$group
$group
Definition: admin/articleedit.php:799
$forum
$forum
Definition: admin/forumlist.php:50
$articleContents
$articleContents
Definition: articlepreview.php:81
$renderer
if(! $article->get( $ArticleID)) $renderer
Definition: articlepreview.php:76
eZArticleGenerator
Definition: ezarticlegenerator.php:40
eZArticleRenderer
Definition: ezarticlerenderer.php:36
eZBoxType
Definition: ezboxtype.php:40
eZCurrency
Definition: ezcurrency.php:46
eZDB\finish
static finish(&$resultArray, &$db)
Definition: ezdb.php:204
eZDB\globalDatabase
static & globalDatabase()
Definition: ezdb.php:134
eZDateTime
Definition: ezdatetime.php:55
eZDateTime\timeStamp
timeStamp( $returnNow=false)
Definition: ezdatetime.php:328
eZForm
Definition: ezform.php:42
eZForumCategory
Definition: ezforumcategory.php:44
eZForum
Definition: ezforum.php:44
eZImage
Definition: ezimage.php:95
eZLocale
Definition: ezlocale.php:119
eZOption
Definition: ezoption.php:82
eZPriceGroup\highestPrice
static highestPrice( $productid, $priceid, $optionid)
Definition: ezpricegroup.php:342
eZPriceGroup\correctPrice
static correctPrice( $productid, $priceid, $optionid=0, $valueid=0)
Definition: ezpricegroup.php:414
eZPriceGroup\prices
static prices( $productid, $optionid=0, $valueid=0)
Definition: ezpricegroup.php:461
eZPriceGroup\priceGroups
static & priceGroups( $inUser, $as_object=true)
Definition: ezpricegroup.php:161
eZPriceGroup\lowestPrice
static lowestPrice( $productid, $priceid, $optionid)
Definition: ezpricegroup.php:273
eZProductCategory
Definition: ezproductcategory.php:90
eZProductCategory\generatePermissionSQL
static generatePermissionSQL( $categoryID=false)
Definition: ezproductcategory.php:789
eZProductPriceRange
Definition: ezproductpricerange.php:48
eZProductType
Definition: ezproducttype.php:46
eZProduct
Definition: ezproduct.php:71
eZProduct\setDescription
setDescription( $value)
Definition: ezproduct.php:1287
eZProduct\vat
& vat( $price="")
Definition: ezproduct.php:830
eZProduct\setListPrice
setListPrice( $value)
Definition: ezproduct.php:1336
eZProduct\flatUsps
flatUsps()
Definition: ezproduct.php:437
eZProduct\price
& price()
Definition: ezproduct.php:413
eZProduct\existsInCategory
existsInCategory( $category)
Definition: ezproduct.php:2196
eZProduct\categories
categories( $as_object=true)
Definition: ezproduct.php:2153
eZProduct\flatUps
flatUps()
Definition: ezproduct.php:429
eZProduct\productIDFromForum
productIDFromForum( $ForumID)
Definition: ezproduct.php:2930
eZProduct\setRemoteID
setRemoteID( $remoteID)
Definition: ezproduct.php:1271
eZProduct\images
& images()
Definition: ezproduct.php:1572
eZProduct\$ListPrice
$ListPrice
Definition: ezproduct.php:3046
eZProduct\setExpiryTime
setExpiryTime( $time)
Definition: ezproduct.php:975
eZProduct\setBrief
setBrief( $value)
Definition: ezproduct.php:1279
eZProduct\BoxTypeID
& BoxTypeID()
Definition: ezproduct.php:1115
eZProduct\$CatalogNumber
$CatalogNumber
Definition: ezproduct.php:3033
eZProduct\localePrice
& localePrice( $calcVAT, $withPriceGroups=true)
Definition: ezproduct.php:694
eZProduct\$IsHotDeal
$IsHotDeal
Definition: ezproduct.php:3038
eZProduct\setDiscontinued
setDiscontinued( $value)
Definition: ezproduct.php:1365
eZProduct\setStockDate
setStockDate( $time)
Definition: ezproduct.php:983
eZProduct\keywords
& keywords()
Definition: ezproduct.php:1077
eZProduct\isHotDeal
isHotDeal()
Definition: ezproduct.php:1248
eZProduct\description
& description()
Definition: ezproduct.php:1166
eZProduct\$Contents
$Contents
Definition: ezproduct.php:3028
eZProduct\productType
productType( $price="")
Definition: ezproduct.php:901
eZProduct\forms
forms( $as_object=true)
Definition: ezproduct.php:2670
eZProduct\findProductNumber
& findProductNumber( $id)
Definition: ezproduct.php:2129
eZProduct\thumbnailImage
thumbnailImage()
Definition: ezproduct.php:1751
eZProduct\id
id()
Definition: ezproduct.php:387
eZProduct\setFlatCombine
setFlatCombine( $value)
Definition: ezproduct.php:1422
eZProduct\$FlatDHL
$FlatDHL
Definition: ezproduct.php:3052
eZProduct\voucher
voucher()
Definition: ezproduct.php:2793
eZProduct\namedQuantity
static namedQuantity( $quantity)
Definition: ezproduct.php:1037
eZProduct\setIsHotDeal
setIsHotDeal( $value)
Definition: ezproduct.php:1392
eZProduct\deleteImage
deleteImage( $value)
Definition: ezproduct.php:1551
eZProduct\setPrice
setPrice( $value)
Definition: ezproduct.php:1326
eZProduct\addOption
addOption( $value)
Definition: ezproduct.php:1430
eZProduct\categoryDefinition
categoryDefinition( $as_object=true)
Definition: ezproduct.php:2256
eZProduct\$ShowProduct
$ShowProduct
Definition: ezproduct.php:3035
eZProduct\name
name()
Definition: ezproduct.php:395
eZProduct\store
store()
Definition: ezproduct.php:102
eZProduct\$ShowPrice
$ShowPrice
Definition: ezproduct.php:3034
eZProduct\setCategoryDefinition
setCategoryDefinition( $value)
Definition: ezproduct.php:2219
eZProduct\$Name
$Name
Definition: ezproduct.php:3025
eZProduct\setKeywords
setKeywords( $value)
Definition: ezproduct.php:1302
eZProduct\$Weight
$Weight
Definition: ezproduct.php:3039
eZProduct\descriptionPlain
& descriptionPlain()
Definition: ezproduct.php:1175
eZProduct\activeProductSearchCount
activeProductSearchCount( $query, $active=TRUE)
Definition: ezproduct.php:1893
eZProduct\$Price
$Price
Definition: ezproduct.php:3045
eZProduct\correctSavings
correctSavings( $calcVAT)
Definition: ezproduct.php:543
eZProduct\setFlatUSPS
setFlatUSPS( $value)
Definition: ezproduct.php:1414
eZProduct\setVATType
setVATType( $type)
Definition: ezproduct.php:2411
eZProduct\setShowPrice
setShowPrice( $value)
Definition: ezproduct.php:1346
eZProduct\hotDealProducts
& hotDealProducts( $limit=false)
Definition: ezproduct.php:2098
eZProduct\$ProductNumber
$ProductNumber
Definition: ezproduct.php:3032
eZProduct\hasQuantity
hasQuantity( $require=true, $id=false)
Definition: ezproduct.php:1021
eZProduct\$ShippingGroupID
$ShippingGroupID
Definition: ezproduct.php:3043
eZProduct\$Discontinued
$Discontinued
Definition: ezproduct.php:3036
eZProduct\setType
setType( $type)
Definition: ezproduct.php:2287
eZProduct\boxType
boxType()
Definition: ezproduct.php:2441
eZProduct\setProductNumber
setProductNumber( $value)
Definition: ezproduct.php:1310
eZProduct\forum
forum( $as_object=true)
Definition: ezproduct.php:2843
eZProduct\addForm
addForm( $form)
Definition: ezproduct.php:2636
eZProduct\setThumbnailImage
setThumbnailImage( $image)
Definition: ezproduct.php:1668
eZProduct\deleteForms
deleteForms()
Definition: ezproduct.php:2620
eZProduct\priceRange
& priceRange( $id=false)
Definition: ezproduct.php:2552
eZProduct\extendedSearchCount
extendedSearchCount( $priceLower, $priceHigher, $text, $categoryArrayID=array())
Definition: ezproduct.php:2013
eZProduct\removeType
removeType()
Definition: ezproduct.php:2351
eZProduct\getByRemoteID
getByRemoteID( $id)
Definition: ezproduct.php:2369
eZProduct\voucherInformation
voucherInformation()
Definition: ezproduct.php:2818
eZProduct\stockDate
stockDate()
Definition: ezproduct.php:917
eZProduct\excludedVAT
excludedVAT()
Definition: ezproduct.php:2605
eZProduct\productNumber
& productNumber()
Definition: ezproduct.php:1088
eZProduct\hasPrice
hasPrice()
Definition: ezproduct.php:729
eZProduct\hasOptions
hasOptions()
Definition: ezproduct.php:1474
eZProduct\catalogNumber
& catalogNumber()
Definition: ezproduct.php:1099
eZProduct\addVAT
& addVAT( $price="")
Definition: ezproduct.php:873
eZProduct\$Description
$Description
Definition: ezproduct.php:3030
eZProduct\addImage
addImage( $value, $placement=false)
Definition: ezproduct.php:1493
eZProduct\setProductType
setProductType( $type=1)
Definition: ezproduct.php:928
eZProduct\$BoxTypeID
$BoxTypeID
Definition: ezproduct.php:3042
eZProduct\showProduct
showProduct()
Definition: ezproduct.php:1209
eZProduct\setMainImage
setMainImage( $image)
Definition: ezproduct.php:1611
eZProduct\brief
& brief()
Definition: ezproduct.php:1127
eZProduct\remoteID
& remoteID()
Definition: ezproduct.php:404
eZProduct\$ExternalLink
$ExternalLink
Definition: ezproduct.php:3037
eZProduct\listPrice
& listPrice()
Definition: ezproduct.php:421
eZProduct\setShippingGroup
setShippingGroup( $group)
Definition: ezproduct.php:2523
eZProduct\__construct
__construct( $id="")
Definition: ezproduct.php:78
eZProduct\setIncludesVAT
setIncludesVAT( $inValue=true)
Definition: ezproduct.php:2575
eZProduct\setFlatUPS
setFlatUPS( $value)
Definition: ezproduct.php:1406
eZProduct\$FlatUSPS
$FlatUSPS
Definition: ezproduct.php:3051
eZProduct\setTotalQuantity
setTotalQuantity( $quantity)
Definition: ezproduct.php:936
eZProduct\externalLink
externalLink()
Definition: ezproduct.php:1225
eZProduct\localeSavings
localeSavings( $calcVAT)
Definition: ezproduct.php:523
eZProduct\addFile
addFile( $value)
Definition: ezproduct.php:2952
eZProduct\files
files( $as_object=true)
Definition: ezproduct.php:3005
eZProduct\mainImage
mainImage()
Definition: ezproduct.php:1728
eZProduct\setBoxType
setBoxType( $type)
Definition: ezproduct.php:2424
eZProduct\$Keywords
$Keywords
Definition: ezproduct.php:3031
eZProduct\deleteFile
deleteFile( $value)
Definition: ezproduct.php:2988
eZProduct\setContents
setContents( $value)
Definition: ezproduct.php:1294
eZProduct\vatPercentage
vatPercentage()
Definition: ezproduct.php:820
eZProduct\$ID
$ID
Definition: ezproduct.php:3024
eZProduct\$ProductType
$ProductType
Definition: ezproduct.php:3044
eZProduct\setWeight
setWeight( $value)
Definition: ezproduct.php:1382
eZProduct\briefPlain
& briefPlain()
Definition: ezproduct.php:1136
eZProduct\removeFromCategories
removeFromCategories()
Definition: ezproduct.php:2182
eZProduct\$ExpiryTime
$ExpiryTime
Definition: ezproduct.php:3047
eZProduct\$IncludesVAT
$IncludesVAT
Definition: ezproduct.php:3049
eZProduct\productName
productName( $id)
Definition: ezproduct.php:2390
eZProduct\priceExVAT
& priceExVAT( $price="", $calcVAT=true)
Definition: ezproduct.php:740
eZProduct\discontinued
discontinued()
Definition: ezproduct.php:1217
eZProduct\type
type()
Definition: ezproduct.php:2330
eZProduct\extendedSearch
extendedSearch( $priceLower, $priceHigher, $text, $offset=0, $limit=10, $categoryArrayID=array())
Definition: ezproduct.php:1920
eZProduct\setShowProduct
setShowProduct( $value)
Definition: ezproduct.php:1355
eZProduct\$StockDate
$StockDate
Definition: ezproduct.php:3048
eZProduct\setExternalLink
setExternalLink( $value)
Definition: ezproduct.php:1374
eZProduct\extractVAT
& extractVAT( $price="")
Definition: ezproduct.php:835
eZProduct\setCatalogNumber
setCatalogNumber( $value)
Definition: ezproduct.php:1318
eZProduct\activeProductSearch
activeProductSearch( $query=false, $offset=false, $limit=false, $active=TRUE, $sortMode="time")
Definition: ezproduct.php:1777
eZProduct\activeProducts
& activeProducts( $sortMode="time", $offset=0, $limit=50, $categoryID=false)
Definition: ezproduct.php:2697
eZProduct\$VATTypeID
$VATTypeID
Definition: ezproduct.php:3041
eZProduct\correctPriceRange
correctPriceRange( $calcVAT, $withPriceGroups=true)
Definition: ezproduct.php:634
eZProduct\options
options()
Definition: ezproduct.php:1456
eZProduct\correctPrice
correctPrice( $calcVAT, $withPriceGroups=true)
Definition: ezproduct.php:453
eZProduct\setName
setName( $value)
Definition: ezproduct.php:1263
eZProduct\includesVAT
includesVAT()
Definition: ezproduct.php:2590
eZProduct\priceIncVAT
& priceIncVAT( $price="")
Definition: ezproduct.php:777
eZProduct\products
& products( $sortMode="time", $fetchNonActive=false, $offset=0, $limit=50, $fetchDiscontinued=false, $categoryID=false)
Definition: ezproduct.php:2709
eZProduct\$Brief
$Brief
Definition: ezproduct.php:3029
eZProduct\totalQuantity
totalQuantity( $id=false)
Definition: ezproduct.php:992
eZProduct\showPrice
showPrice()
Definition: ezproduct.php:1200
eZProduct\vatType
vatType()
Definition: ezproduct.php:2460
eZProduct\$FlatCombine
$FlatCombine
Definition: ezproduct.php:3053
eZProduct\expiryTime
expiryTime()
Definition: ezproduct.php:909
eZProduct\$FlatUPS
$FlatUPS
Definition: ezproduct.php:3050
eZProduct\shippingGroup
& shippingGroup()
Definition: ezproduct.php:2539
eZProduct\weight
weight()
Definition: ezproduct.php:1236
eZProduct\$RemoteID
$RemoteID
Definition: ezproduct.php:3040
eZProduct\contents
& contents()
Definition: ezproduct.php:1109
eZProduct\flatCombine
flatCombine()
Definition: ezproduct.php:445
eZQuery
Definition: ezquery.php:54
eZShippingGroup
Definition: ezshippinggroup.php:44
eZUserGroup
Definition: ezusergroup.php:66
eZUser
Definition: ezuser.php:76
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
eZVATType
Definition: ezvattype.php:41
eZVirtualFile
Definition: ezvirtualfile.php:42
eZVoucherInformation
Definition: ezvoucherinformation.php:55
eZVoucher
Definition: ezvoucher.php:54
$ini
$ini
Definition: classes/admin/linklist.php:64
$type
$type
Definition: classes/admin/linkselect.php:220
$module
$module
Definition: classes/admin/linkselect.php:219
$result
$result
Definition: companysearch.php:94
$name
$name
Definition: companytypelist.php:194
$id
$id
Definition: companytypelist.php:193
$currency
$currency
Definition: companyview.php:529
$query
if(isset( $Year) &&!is_numeric( $Year)||isset( $Month) &&!is_numeric( $Month)) $query
Definition: entryexitpages.php:65
$typeArray
$typeArray
Definition: ezarticle/admin/typeedit.php:166
$db
$db
Definition: ezarticle/user/authorlist.php:53
$contents
$contents
Definition: ezarticle/user/extendedsearch.php:52
$groups
if( $CategoryID !=0) $groups
Definition: ezbulkmail/admin/categoryedit.php:108
$categoryArrayID
$categoryArrayID
Definition: ezbulkmail/admin/mailedit.php:120
$row
$row
Definition: ezcalendar/user/dayview.php:403
$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
$res
$res
Definition: ezstats/admin/cron.php:45
$offset
$offset
Definition: ezstats/admin/cron.php:51
$priceRange
$priceRange
Definition: eztrade/user/extendedsearch.php:85
$form
$form
Definition: formedit.php:46
$product
$product
Definition: homepage.php:202
$time
$time
Definition: homepage.php:327
$count
$count
Definition: onlinetypelist.php:108
$options
$options
Definition: optionlist.php:56
$country
$country
Definition: paypal.php:46
$region
$region
Definition: paypal.php:45
$price
$price
Definition: pricegroupedit.php:39
$vat
foreach( $categoryArray as $catItem) $vat
Definition: productedit.php:1334
$categoryID
else $categoryID
Definition: productview.php:66
$OrderBy
$OrderBy
Definition: reciverpopup.php:21
Name
if($user) if(isset( $next) && $next)<?=isset($all_fields_error) &&$all_fields_error ?><?=isset($password_error) &&$password_error ?></p ><? endif;?>< form method="post">< table border="0" cellspacing="2" cellpadding="2" class="boxtext" style="font-size=13;">< tr >< td style="color:<?= isset( $error['first_name'] ) ?> First Name
Definition: step1.php:127
$mainAddress
$mainAddress
Definition: step2.php:32
$category_array
$category_array
Definition: todoedit.php:604
$user
$user
Definition: user/adlist.php:39
$image
$image
Definition: user/articlelist.php:242
$products
$products
Definition: user/imageview.php:142
$active
$active
Definition: user/pollist.php:57
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.