-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathicfaq.sdf
2149 lines (1569 loc) · 73.5 KB
/
icfaq.sdf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!init OPT_LOOK="icdevgroup"; OPT_STYLE="manual"
# $Id: icfaq.sdf,v 1.23 2004-05-05 15:22:30 jon Exp $
!define DOC_NAME "Frequently Asked Questions"
!define DOC_TYPE ""
!define DOC_CODE "icfaq"
!define DOC_VERSION substr('$Revision: 1.23 $',11, -2)
!define DOC_STATUS "Draft"
!define DOC_PROJECT "Interchange"
!define DOC_URL "http://www.icdevgroup.org/doc/icfaq.html"
!build_title
H1: How does Interchange work?
H2: Where are the pages?
Interchange pages are not kept in normal HTML space. Look in the catalog subdirectory pages. The pages are always filtered through the Interchange daemon before being delivered.
H2: Where are the images?
Interchange is a CGI program, and if relative image paths are used, IMG tags
like the following will occur:
<IMG SRC="/cgi-bin/simple/../whatever.jpg">
Interchange, by default, uses an C<ImageDir> for a prefix. In the demo, image
specs that have no absolute path information are prefixed with
C</simple/images/>.
In an Interchange page, this tag:
!block example
<IMG SRC="ordernow.gif">
!endblock
will become this:
!block example
<IMG SRC="/simple/images/ordernow.gif">
!endblock
This tag:
!block example
<IMG SRC="items/00-0011.jpg">
!endblock
will become this:
!block example
<IMG SRC="/simple/images/items/00-0011.jpg">
!endblock
Absolute image paths are not affected. An image such as
C</other/images/whatever.gif> will not be changed.
H1: INSTALLATION
H2: Configuration Problems
Most Interchange configuration and setup problems are due to one of the following:
LI1: Wrong information given to makecat program.
.{{B:This is by far the most common problem.}} To install a working demo,
Interchange needs to know what the C<DocumentRoot> is and how to run CGI
programs. Details of this setup are server- and site-specific, which may
require some research.
.Re-run the configuration again, and pay close attention to the prompts
given. There are examples given which apply to most systems.
.If the web server is Apache or NCSA, Interchange will try and parse its
C<httpd.conf> file to help you along, but many ISPs don't allow users to
read these and it may fail.
LI1: Too-low version of Perl.
.If you have a Perl earlier than 5.005, Interchange will not work. Don't
even try an earlier version.
LI1: Perl compiled with USE_THREADS.
.Run C<perl -V>. If you see -DUSE_THREADS in the compilation definition,
you might run into problems with Interchange.
.B<NOTE>: You cannot run the Interchange software as C<root>.
If you are setting Interchange up for the entire machine, and not just
as a virtual host user, it is usual to create a special C<interch> user
to run the daemon and the link program. This means the directory listing
for your cgi-bin should be something like:
!block example
-rwsr-xr-x 1 interchange users 6312 Dec 30 11:39 cgi-bin/simple
!endblock
and for the socket file it should be:
!block example
srw------- 1 interchange users 0 Dec 30 11:41 etc/socket
!endblock
Once you have set up the software, you can easily install catalogs as root B<as long as your C<umask> is set to 2 or 22>.
(The following assumes you have made the Interchange software owned and run by the special user C<interchange> and that each user has a Interchange catalogs directory C</home/user/catalogs>).
The best way to set permissions on a multi-user system is to make all
files group readable and writable (660 or 664 mode). If you have a
system setup that places each user in their own group, make
C<interchange> a member of each user's group and set ownership and
permissions with:
!block example
find /home/user/catalogs -print | xargs chown user
find /home/user/catalogs -print | xargs chgrp user
find /home/user/catalogs -print | xargs chmod g+rw
!endblock
For best results, set the user's default umask to 2, so that they will,
by default, create files that have the proper permissions. If you have
all users in the same group, the above is not secure. You should put
C<interchange> in a group of which no user is a member (perhaps
interchange would be a good choice) and set all files owned by the group
interchange and all directories to mode 2770:
This will make files default to the proper group when created (on most
UNIX versions, anyway).
!block example
find /home/user/catalogs -print | xargs chown user
find /home/user/catalogs -print | xargs chgrp interchange
find /home/user/catalogs -print | xargs chmod g+rw
find /home/user/catalogs -type d -print | xargs chmod g+s
!endblock
If you are on a virtual hosting system, the procedure varies. Making the
program setuid should work for most systems. If your setup uses CGI-WRAP or
another setuid scheme, it should still work. However, you may have to unset the
setuid bit with C<chmod u-s cgi-bin/simple> or the like. If you have a
non-standard CGI setup, as some virtual host systems do, you will need to know
something about UNIX and the web or engage a consultant to properly set up the
paths. Usually switching to TLINK/INET mode is the easiest thing to do, though
with Iserver and a few others it may take more than that.
If you used the C<makecat> program to build the catalog, it should have warned
you if it was not able to make the link program setuid. To set the program (in
the file C<cgi-bin/simple> in this example) to be setuid, use the command:
!block example
chmod u+s cgi-bin/simple
!endblock
H2: Error -- the Interchange server was not running...
This indicates that the link CGI is not communicating with the Interchange
server. {{B:Important note:}} The server should always be started by the same
user ID which owns the suid vlink program. (This does not apply to TLINK/INET
mode.)
The server must be running, first of all. If you didn't start it, you can do so
by going to the Interchange home directory and typing:
!block example
bin/interchange -restart
!endblock
You can check to see if your server is running by typing:
!block example
Linux, BSD: ps -ax | grep interchange
Most other systems: ps -elf | grep interchange
!endblock
Note: Solaris and IRIX truncate the string, and don't allow setting of the $0
parameter. You may have to grep for 'perl' instead.
If the server is not running, it may have failed due to another process
occupying the TCP socket 7786. If using VLINK, try starting Interchange with
C<start -u>, which will not monitor the internet-domain socket.
If VLINK is not communicating with the server, there are a number of possible
reasons. First, if you are trying to run Interchange on an ISP, go to the
section about ISP problems. It is probably one of those. If you are running
Interchange on a single machine, it is probably one of:
!block example
1. Permissions problems
2. Interchange on NFS-mounted file system
!endblock
Check the error_log file for your HTTP server -- it will almost always
tell you what the problem is, unless there is a simple permissions
problem.
Permissions are easy. If starting Interchange like this works:
!block example
interchange -r SocketPerms=666
!endblock
then you have a socket permission problem. Try restarting interchange
without the above adjustment of SocketPerms=666, and then try accessing
it again with each of these mode changes:
!block example
chmod u+s cgi-bin/storename
chmod u-s cgi-bin/storename
cgi-bin/storename = path to your executable
!endblock
If neither of those work, either the UID the program is owned by is wrong,
or your HTTP server is interfering in some fashion.
If you are running Interchange on an NFS-mounted file system, it cannot run in
server mode because UNIX-domain sockets don't work on NFS. You will need to
change to static mode from server mode, or better yet, put Interchange on a
file system that is directly mounted.
You can use Interchange in INET mode along with the tlink.c program to allow
running across NFS boundaries. If you have not changed the configured defaults,
and still it will not communicate, you should try setting the LINK_HOST and
LINK_PORT directives in tlink.c and recompiling.
H2: I get messages like 'Config.pm not found.' What does it mean?
This means your Perl is not properly installed, or that Interchange is not
using the proper Perl binary. On UNIX, try reinstalling Interchange and using
the standard Perl installation sequence:
!block example
/complete/path/to/proper/perl Makefile.PL
make
make test
make install
!endblock
Otherwise, contact your system administrator.
H2: Can't locate lib.pm in @INC. BEGIN failed--compilation aborted.
Again, your Perl is not properly installed. Someone has put a Perl up on your system,
then either moved or removed the library directory. Contact your system
administrator and request that Perl be re-installed.
H2: Segmentation fault or other core dump.
If this happens when you run the Interchange test or server, it is always Perl
that has a problem. Not sometimes, always. A proper Perl should never have a
segmentation violation, period. And it should not dump core (unless you passed
it a C<-u> option somehow).
You will need to either update Perl or report the bug to the proper personnel.
Depending on your situation and technical ability, this may be your system
admin, ISP, or the Perl porters.
H2: Configuring catalog whatever...Use of uninitialized value at Config.pm line 1614, <CONFIG> chunk 322.
This is a warning from Perl indicating that an empty value was found where one is expected. The warning is left in so that you know that something is missing. Whatever it is, it can be found at the specified "chunk," or line, of catalog.cfg. If you use the include capability, it would have to be factored in as well.
The usual reason is that a file is specified in one of the directives (usually one of Help, SearchProfile, OrderProfile, Buttonbars, or UpsZoneFile) and does not exist. See the documentation for the directive on how the file name should be specified.
H2: Why isn't the above error more enlightening?
Because Perl won't tell us what exactly went wrong. See its FAQ for why.
H2: XXXXXX.pm does not match executable version.
This is a Perl which does not have the right Perl library installed. It usually
results from a naive system administrator who thinks they can bypass the 'make
install' for Perl and just copy the Perl binary or directories.
If you installed Bundle::Interchange locally in your Interchange directory,
it may mean that your system administrator updated Perl and failed to select
the binary compatibility option.
H2: Can I run Interchange on the Macintosh or Windows?
Interchange will not run on a MacOS 7, 8, or 9 operating system. It will run on
Mac OS X and other PowerPC Unix variants.
Interchange's *files* can be manipulated by any computer. As long as
uploads/downloads of database source, pages, and configuration files are done
in ASCII mode, there is no reason why they can't be edited on a Mac. And with
MySQL or other ODBC databases on your UNIX-based ISP, you can even directly
interface to the database you use with Interchange provided you have the scarce
ODBC middleware needed for the Mac.
Interchange can be run on Windows with the Cygwin tool set (1.3.2 or higher)
available from http://www.cygwin.com/, but there are numerous anomalies and it may be difficult
to get operating reliably. It is never recommended that you run a production
catalog on a Windows system; if you do get it working you should only use
for catalog development.
H2: Error -- 'make: command not found'
The error is caused when the system you are installing on does not have the program called "make". It is recommended that you install make as well as a C compiler ("cc" or "gcc") for the installation of Interchange. If you are unsure of how to do this for your operating system, it may help to ask a mailing list related to your operating system.
H2: Templates aren't showing, only the center content of the page itself
Example question: "All that's showing up is the center section of the template. This happened after ____: (moving my site to a new host, or uploading a new catalog.cfg or theme.cfg file, or restarting interchange)."
This can happen if:
* The files were uploaded in binary instead of ASCII (when using FTP)
* Windows-style carriage returns were put in the file by a windows editor or file transfer program
From unix, do an octal dump on some of the files to see if you have cr chars:
!block example
od -a templates/foundation/theme.cfg | grep cr
od -a catalog.cfg | grep cr
!endblock
If something appears on the screen, then your file needs to be cleaned. Among the other 10-million ways to clean it, here is one:
!block example
perl -pi -e 's/\r\n/\n/g' < old_file.cfg > new_file.cfg
!endblock
Also, if you are using FTP to transfer the files from a Windows machine, try using ASCII mode instead of binary mode.
H2: When I try to install the RPM, I get "failed dependencies" errors
There are two easy solutions to this problem:
* Install the modules manually, then use the --nodeps RPM option.
!block example
perl -MCPAN -e "install Bundle::Interchange"
!endblock
* Install RPM modules to satisfy the dependencies.
Some modules are available from {{URL:http://ftp.icdevgroup.org/perl/}}
while others can be found on rpmfind.net.
H1: SSL problems
H2: Shopping cart is dropped when using SSL.
If you are using a separate secure and non-secure domain, this is due
to the cookies from the user not matching as well as the session ID not
being able to be transferred due to differing source IP addresses.
.B<NOTE>: Interchange does not support this configuration. You may be able to get
it to work in some circumstances, but it is not supported. See the next
set of questions for help on how you may be able to get it to work to some
extent in your configuration. It will not work in every circumstance with
every feature.
This is sometimes due to the HostnameLookups (Stronghold/Apache parameter) not
matching for the two servers, secure and non-secure. It can also be caused by
the user having different web proxy addresses for HTTP and HTTPS. If it still
does not work, try changing some of the appropriate configuration parameters in
interchange.cfg:
!block example
DomainTail No
IpHead Yes
!endblock
If you still are having problems, try this combination in catalog.cfg, the catalog configuration file:
!block example
SessionExpire 10 minutes
WideOpen Yes
!endblock
The above setting will typically make Interchange work when it is possible to
work. Sometimes when you have multiple Interchange servers sharing the same
secure server, you will have problems after accessing the second one. (The
first one issues a session ID cookie, and that causes problems).
H2: I have a different secure server domain. Why does the shopping cart get dropped?
First of all, it is questionable business practice to not certify your
secure server. Besides violating the terms of use of many certificate
issuers, customers notice the changed domain and it is proven by user
surveys and long experience that you will receive fewer orders as a
result. Certs can be obtained for $125 US per year, less than the
typical cost of one hour of a top consultant's time. Do your business
a favor -- spend the money to get a cert.
If you insist on doing it anyway, probably driven by the fact that
you need a dedicated IP address for a secure server, you can use the
solutions in the previous FAQ question and get some relief.
But by far the best way is to have all orders and shopping cart calls go
only to the secure domain. Your users may get a different session when
browsing the non-secure catalog pages, but it will matter little.
To do this on the Foundation demo, place in catalog.cfg:
AlwaysSecure order ord/basket ord/checkout
A more complete list might be:
!block example
AlwaysSecure <<EOF
account
change_password
customerservice
login
logout
new_account
ord/basket
ord/checkout
order
process
query/check_orders
query/order_detail
query/order_return
returns
saved_carts
ship_addresses
EOF
!endblock
Add pages of your own that need to be sure of coherent session information.
For all *forms* to be secure, make sure "process" is on that list. (Your search
forms will still be non-secure if you use "[process-search]" to produce
the form ACTION.)
To make individual order links secure, use this instead of "[order]":
<A HREF="[area
href=order
secure=1
form='mv_order_item=SKU_OF_ITEM'
]">Order it</A>
To make a form-based order button secure, use "[process secure=1]" as
the ACTION.
H2: My images aren't there on the secure server!!!
You have a different document root, or the permissions are not such
that you can access them. You can set a different base URL for images
with:
!block example
ImageDirSecure https://your.secure.server/somewhere/images
!endblock
Don't try to set it to an http:// URL -- images will be broken anyway.
H2: My secure pages fail when the browser is MSIE.
MSIE has several SSL bugs, particularly in V5.01. See the C<Apache-SSL>
or C<mod_ssl> FAQ. You can sometimes fix this with an httpd.conf change:
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
H1: ISP Problems
The great majority of ISPs provide some CGI service, and more and more
run systems that are compatible with Interchange. The new catalog
configurator for Interchange makes setup much easier. A word of warning:
if you chose your ISP mostly on price, you can expect problems. The
low-cost providers typically have heavily-loaded machines and many
domains. The more domains and the more load the unhappier you will be
with Interchange. Interchange works best on a fast machine with plenty
of memory.
A few Internet Service Provider (ISP) systems still have difficulty with one or
the other aspect of running Interchange. A few cannot (or will not) run
Interchange at all. On top of that, many times ISP personnel are too busy to
help, won't help, or don't know enough to help. Some are secretive about
details of the setup of their systems.
All in all, you can have a fair amount of confidence that your ISP can run
Interchange. Or, you can get one who will. 8-)
H2: No shell access allowed on my ISP.
Generally it is a waste of time to try to use Interchange without shell access.
H2: We're sorry, the Interchange server is unavailable...
(The following assumes that you were able to start the Interchange server.)
This could be almost anything, but with a properly configured Interchange it is
almost undoubtedly due to your cgi-bin and/or your Interchange directory being
located on a different filesystem than the actua machine that is executing the
program. VLINK uses UNIX-domain sockets, which don't work on NFS-mounted
filesystems.
Iserver.com and other systems which use chroot HTTP servers require quite a bit
of extra configuration to get going. If you have not been careful to set
permissions properly when running in VLINK/UNIX mode, the link CGI will not be
able to communicate with the Interchange server. Please read the documentation
that covers this in detail.
You can run in INET mode with the C<tlink> link program to prevent those
problems.
H2: Document contains no data or premature end of script headers (especially on BSDI or FreeBSD).
This usually means that your HTTP server ran out of resources during the
execution of the link program. It couldn't create more sockets, is unable to
create a process, or can't open any more files.
This usually happens in frames catalogs, when Interchange is sending more than
one page simultaneously. And even more especially on FreeBSD and BSDI, which
are often distributed with the kernel parameters SOMAXCONN and CHILD_MAX set to
levels unsuitable for serving the web.
Go to <http://www.deja.com> and try searching for MAXUSERS. This should give
you plenty of pointers on how to set these parameters properly.
H2: Interchange server only runs for a while, then dies.
Many ISPs don't allow your user ID to run a program unless it is logged in! The
moment a watchdog program notices a daemon running with a non-logged-in UID, it
terminates the program. Or, it terminates programs that haven't been active for
XX minutes. Contact your ISP about this. They may be able to do something for
you.
H2: My entire home directory is in HTML document space.
If working with an ISP where all of the files are in HTML document space,
disable all access to the Interchange catalog directory with the proper HTTP
access restrictions. Normally that is done by creating a .htaccess file like
this:
!block example
<Limit GET POST>
order allow,deny
deny from all
</Limit>
!endblock
If unable to do this, do not run Interchange unless file permissions can be set
such that files will not be served. However, security will be a problem and
customers' personal information could be placed at risk.
H1: SYSTEM CONFIGURATION
H2: Can I run multiple catalogs on one server?
Yes. Interchange supports multiple independent catalogs. There are users who
run more than 500 catalogs on a single machine. The capacity is usually a
function of how busy the catalogs are and how much memory and processor speed
your system has.
H2: How do I start Interchange when I reboot?
Use the standard facility on your operating system. For BSD-style systems, the
file is usually called rc.local (in the /etc directory).
On SVR4 systems, it is quite a bit more complex. Look for the /etc/rc.d
directory and see what other programs do. Often the file is called S99startup
or something similar.
{{B:Important note:}} Interchange must not run as root, which is the user
identity that the startup file executes. (Interchange will refuse to start
if executed as root.) The technique to start up depends on
the facility of your su(1) command. This should work on most operating systems:
!block example
su interchange <<EOF
/your/interchange/dir/bin/restart
EOF
!endblock
The B<EOF> must be the only thing on the line (no leading or trailing
whitespace). If your su(1) command has a C<-c> option (as most System 5 UNIXes
do), you can just set:
!block example
su -c /your/interchange/dir/bin/restart interchange
!endblock
Interchange supplies a C<restart> script which tries to do the above portably.
It works on many operating systems.
H2: I installed the Interchange RPM, and I can't restart.
This usually means that you tried to run /usr/lib/interchange/bin/interchange,
which fails to take into account the Linux Standard Base (LSB) file setup. Instead,
run
/etc/rc.d/init.d/interchange restart
or
/usr/sbin/interchange -r
H2: How do I set up a mall?
Interchange can share product databases, session files, and any other
databases. It has many features which support mall building. You can easily
build separate and mostly identical catalogs which you link to via HTML. But
building a mall is as much an exercise in data and process as in software.
Consider the following questions:
+Who will be clearing payment?
+What happens if everyone doesn't have the same tax rate?
+How will you clear orders to multiple vendors?
+How will you bring together multiple types of shipping?
+How will the vendors get product data (including images) to you?
If you cannot answer those questions and visualize how to build a mall, you
probably should not try.
H1: PRODUCT OPTIONS
H2: Can I attach a size or color to a product?
Interchange has product modifiers, or attributes, which can be carried around with the product. Inside an item list or the product page (flypage), the [item-options] tag will automatically place suitable widgets on an HTML form, and "remember" what should be selected. See the Interchange documentation for B<Item Options>.
You can use the C<SeparateItems> directive or set the C<mv_separate_items> variable
on the order form to cause ordered items to be put on separate lines in the
shopping basket. (This is the default in the demo catalogs.)
H2: Can I change the price based on size or color (or other attribute)?
Yes. Use the Interchange UI to set up your product options. It operates on
the C<options> database table to set up options that can effect price. Or
see the next question.
H2: How are simple product options structured?
Interchange has three types of options; I<simple>, I<matrix>, and I<modular>.
They are based on the C<options> database table.
To enable options for a product, it needs to have a master record in "options"
with the SKU as the key. The only fields that matter in the master record are:
!block example
code The SKU of the item
o_master Indicates not a product, but an option for a product in another database
o_enable Options enabled for that item
o_matrix Set to 1 for all-in-one widgets, 2 for separate widgets
o_modular Modular options (alpha)
!endblock
If o_enable is set, but neither o_matrix or o_modular are, the item
is using simple options.
For the option itself in simple mode, the following fields apply:
!block example
code Arbitrary key
sku SKU this option applies to
o_group The attribute name of the option
o_label The label the widget for the option will bear
o_value The options, in IC option format
o_widget The widget type used to display
o_height The widget height (if any)
o_width The widget width (if any)
price Price adjustment
!endblock
Here are the fields for an item with a simple size option:
!block example
code:os28009
o_master:1
o_enable:1
o_matrix:0
o_modular:0
#
code:os28009-size
sku:os28009
o_group:size
o_label:Size
o_value:S=Small,M=Medium,L=Large,XL=Extra Large
o_widget:select
o_height:
o_width:
price:S=-1.00,XL=1.00
#
!endblock
The price field accepts option modifiers based on the option value;
for example, to adjust the price of an S down 1.00 and the price
of an XL up 1.00, you use the values shown above. This works in
conjunction with the special ==:options atom in CommonAdjust. To
activate the pricing adjustment, you must have something like
this for your C<CommonAdjust> setting:
!block example
CommonAdjust :sale_price, ;:price, ==:options
!endblock
The actual names of the fields used for these can be changed with
the Variable MV_OPTION_TABLE_MAP, i.e.
!block example
Variable MV_OPTION_TABLE_MAP <<EOM
o_widget widget
o_value value
EOM
!endblock
That would allow you to use "widget" and "value" in place of o_widget
and o_value as field names.
H2: But what do these options do? Where do they live?
If you know Perl, you know what a hash reference is. An Interchange shopping
cart consists of an I<array of hash references>. If you dump the structure
of the C<main> shopping cart you would see something like:
!block example
[
{
mv_ip => '0',
price_group => 'general',
mv_ib => 'products',
code => 'os28080',
quantity => '1',
},
{
mv_ip => '1',
price_group => 'general',
mv_ib => 'products',
code => 'os28080',
size => 'L',
color => 'black',
quantity => '1',
},
]
!endblock
Each key of the hash is an attribute. There are a number of
special attributes:
!block table; colvaligns="TT"
Attribute|Description
code|The item SKU
sku|The SKU of the base item (in the case of matrix options)
mv_ip|The line number of the shopping cart (minus 1)
mv_ib|The database table the product was ordered from
quantity|The number on order
group|The order group for a master item or subitem
mv_si|Subitem indicator
mv_mi|Master item code
mv_mp|Modular item
mv_price|Price of the item (to directly set pricing)
mv_order_route|Special order route for this item
!endblock
Any attribute besides the above is a product I<option> or I<modifier>, and can
be displayed with C<[item-modifier attribute_name]>.
H1: ENCRYPTION
H2: PGP encryption -- Server Error
As always, check the error log. The most common problem is something like:
!block example
akopia.com 3Ex5lvta:akopia.com - [01/Sep/1997:09:08:43] simple /cgi-bin/simple
> Encryption error:
>
!endblock
Also, check the C<ScratchDir> (usually tmp/) for C<.err> files; they will
contain PGP or GPG's error output.
Probable causes:
LI1: Interchange user ID doesn't have keyring
.You must have a C<.pgp> or C<.gnupg> directory in the home directory of the
user running Interchange. It is also possible to set an environment variable
(variously PGPPATH or GNUPGHOME) to orient the program correctly.
LI1: EncryptProgram directive set wrong
.In Interchange 4.7.7 and above, you only need specify "gpg", "pgp", or
"pgpe". The key is set in C<EncryptKey>. If you don't set a value for
EncryptProgram, Interchange will look for C<gpg> first, then C<pgpe>, then
finally C<pgp>, using the first it finds. If it can't find one of those,
it is set to none and encryption can't be done. You can specify a full
path to the program in the directive, but no arguments need be set. NOTE: old values in EncryptProgram will still work, just are not needed.
H2: PGP encryption -- What do I do now that it is working?
This depends on what you do with orders once you receive them by email.
Some PC mail agents (notably Eudora) will decrypt the PGP message
embedded within the message text. In that case, you can simply embed
the C<[value mv_credit_card_info]> call right in the message and be
done with it.
If your mailer will not decrypt on the fly, the best way to read the
credit card number is to set up MIME encoding of the order email. To do
this, find the order report you are using. In the standard demos it is
C<pages/ord/report.html> or C<etc/report>.
Set up two MIME regions in that file. First, at the top of the file:
!block example
[tag mime type TEXT/PLAIN; CHARSET=US-ASCII][/tag]
[tag mime Order Text]
ORDER DATE: [calc]localtime[/calc]
ORDER NUMBER: [value mv_order_number]
Name: [value name]
Company: [value company]
(Rest of order text, including item list)
[/tag]
!endblock
Then, at the bottom of the report.html file, put the credit card info:
!block example
[if value mv_credit_card_info]
[tag mime type application/pgp-encrypted][/tag]
[tag mime Credit Card Information]
[value mv_credit_card_info]
[/tag]
[/if]
!endblock
Once this is done, you can read mail using your PGP client as a helper
application to decode the MIME attachment. This does not require a fancy
setup -- you can use the standard MIT PGP 2.6.2 if desired. If you are
using UNIX, set up as the helper for the MIME type
B<application/pgp-encrypted>:
!block example
xterm -e pgp -m %s
!endblock
More automated or user-friendly setups are left as an exercise for the user.
H1: How do I....
H2: How do I get the number of items in a shopping cart?
If it is simply the total number, extended according to quantity, you can use the [nitems] tag. If you need this number for use in an embedded Perl script, you can use:
!block example
$number = $Tag->nitems();
!endblock
If it is the number of line items you need, then you can use a Perl script:
!block example
[perl]
return scalar @{$Carts->{main}};
[/perl]
!endblock
(The 'main' refers to the main shopping cart.)
If you have SeparateItems in effect, and need the number of unique items, you could use:
!block example
[perl]
my $cart = $Carts->{main};
foreach my $item (@$cart) {
@items = split /\|/, $items;
$count = 0;
for (@items) {
$count++ unless $seen{$_}++;
}
$count;
[/perl]
!endblock
H2: How do I delete an item from the cart in Perl?
(Answered by Racke)
!block example
[calc] @$Items = grep {$_->{code} ne '123.456.789'} @$Items [/calc]
!endblock
H2: The demo doesn't do ... (pick one)
That is because it is a demo. It is not intended to be a finished catalog, just
a starting point.
That being said, you should think long and hard before abandoning the
checkout schema. Years of experience have led to the production of the
userdb, transactions, and orderline tables, and the structure of the
checkout page. Any changes to the data structure should be thoroughly
tested before deployment, as obscure errors can cause major problems in
order logging.
H2: How can I trace the source of a purchase and run a partners program?
Interchange has a facility that adds a parameter called I<source> to the session database for that user. You should give your partners a source code, which must contain at least one letter character (A-Za-z only). It is placed in the sourcing URL as a query string of:
!block example
mv_pc=Source1
!endblock
If this is appended to the URL with which the user calls Interchange,
it will then be placed in the session identifier C<source>.
This URL:
E:http://yourcatalog.com/cgi-in/yourcat/sp_offer?mv_pc=Source1
will yield C<Source1> from the Interchange tag [data session source].
The Minivend 3 idiom C<?;;Source1> continues to be supported, so existing partner sites should work without change.
H2: How can I send an email copy of the receipt to a user?
There are several ways, but this is a more complex question than it may seem like it is. You will have to deal with bad email addresses, deciding which
information to send, showing delivery times, etc. You also have to be very careful with credit card information. If you have not taken the proper security measures (by enabling PGP credit card encryption or using CyberCash), you might just mail them their own unencrypted credit card number!
This is supported in Interchange via a UserTag, [email ...]. See the "simple" and "basic" demos.
H2: How do I display Euro pricing?
You can use Interchange's II8N facilty via the Locale directive. In catalog.cfg:
!block example
# to define the euro-Settings (PriceDivide is for converting from DM)
Locale eur_EUR PriceDivide 1.95583
Locale eur_EUR p_cs_precedes 0
# this is great - you can even use HTML-Tags to display an euro-image
Locale eur_EUR currency_symbol "<IMG src="/path/to/image/euro.gif">"
Locale eur_EUR p_sep_by_space 2
Locale eur_EUR mon_decimal_point ,
# and the DM
Locale de_DE
Locale de_DE p_cs_precedes 0
Locale de_DE p_sep_by_space 2
!endblock
Note: Be sure to use the latest exchange rates when you establish your catalog.
On your pages (this is from a search results page, the [item-.... ...] notation may be different depending on your context):
!block example
[item-price]<br><!-- german is default -->
[setlocale eur_EUR]
[currency convert=1][item-field price][/currency]<br><!-- the euro -->
[setlocale]
!endblock
Any questions? Read the docs about "Internationalization."
H2: How do I empty the shopping cart?
N: Here are three examples of ways to empty/drop/clear the shopping cart contents.
H3: Empty shopping cart
!block example
[calc]
@{$Carts->{$CGI->{mv_cartname} || 'main'}} = ();
[/calc]
!endblock
H3: Empty shopping cart
!block example
[set clear_basket]
[calc]
@{$Carts->{$CGI->{mv_cartname} || 'main'}} = ();
[/calc]
[/set]
[button
text="Clear Basket"
src="clear_basket.gif"
hidetext=1
form=basket
]
mv_todo=refresh
mv_click=clear_basket
[/button]
!endblock
H3: Erase the user session (includes shopping cart)
!block example
[button
text="Clear Basket"
src="clear_basket.gif"
hidetext=1
form=basket
]
mv_todo=cancel
mv_nextpage=index
[/button]
!endblock
H2: How do I e-mail credit card numbers in plain text?
(Answered by Mike Heins)
The position of ICDEVGROUP is that we will not tell you what you can and
cannot do, but that we simply will not help you send unencrypted CC