
----------------
PgMarket FAQs...
----------------

----------------------------------------------------------------------

Question-LanguageVariablesInApplicationdotincdotphp
application-??.inc.php contains some language dependent variables,
like $myday[] and $mymonth[], that should go into locale/??/global.inc.php

Answer-LanguageVariablesInApplicationdotincdotphp
Wrong.
Please note that the generic customer chooses his preferred language
while browsing the shop and that different customers make different
language choices (that's why PgMarket is multi-lingual ;)
but the shop administrator prefers always the same language,
and he wants that all orders related informations are stored
in the same language, for all customers.

----------------------------------------------------------------------

Question-OtherLanguagesTranslations
What is it needed to add another language to PgMarket ?

Answer-OtherLanguagesTranslations
- a file completely analogous to it.php and us.php
- the flag image is very likely already available (I'm using flags provided
  in phpLang)
- an application-??.inc.php analogous to application-it.php
  and application-us.php
- locale/??/global.inc.php obtained as a translation of locale/us/global.inc.php
- the translation of all */templates/*.ihtml files
- some little modifications to templates/header.ihtml
  and to admin/templates/header.ihtml to provide another flag to be clicked :)

----------------------------------------------------------------------

Question-UploadImagesAndThumbs
I don't succeed in uploading images and thumbs: the "products"
directory remains empty :(

Answer-UploadImagesAndThumbs
Check for the permissions: the user id executing the web server process
must have the write right into the "products" directory.
Maybe, for wise security reasons, you have restricted too much
the permissions on the "products" directory, which are set
to 777 (drwxrwxrwx) in the released tarball (ARGH ! ;)
to maximize the probability of success in a "fast" installation
intended only to see PgMarket in action.

----------------------------------------------------------------------

Question-ThumbsGeneration
Which programs need to be installed for automatic thumbnails generation ?
And where can I find them ?

Answer-ThumbsGeneration
giftopnm, djpeg, pngtopnm, pnmscale, cjpeg
Red Hat Linux 6.2:
libgr-progs (giftopnm, pngtopnm, pnmscale) and libjpeg (djpeg, cjpeg)
Red Hat Linux 7.1:
netpbm-progs (giftopnm, pngtopnm, pnmscale) and libjpeg (djpeg, cjpeg)
Debian GNU/Linux 2.2:
graphics/netpbm (giftopnm, pnmscale), graphics/pnmtopng (pngtopnm),
graphics/libjpeg-progs (cjpeg, djpeg)
On the mentioned Linux distributions, the path is /usr/bin
for all these programs, hence the corresponding default setting
in application-??.inc.php is OK.

----------------------------------------------------------------------

Question-ZeroSizeThumbFiles
The thumbnail images come out in size 0 bytes.  Which is the problem ?

Answer-ZeroSizeThumbFiles
It is very likely related to the programs above.
Maybe you haven't installed all them, or maybe they are not in /usr/bin,
or maybe they are not all in the same place... check if they are installed
and, if yes, where they are installed.

----------------------------------------------------------------------

Question-ImagesIntoDatabase
Why don't you modify PgMarket to put images into the database ?

Answer-ImagesIntoDatabase
Because I'm too slack, and now everything works pretty well ;)
Apart of joking... mainly for easier support of more than one
Data Base Management System :)

----------------------------------------------------------------------

Question-ProductsWithoutImages
Some of the products to be inserted in the shop don't have any image
associated with.  How can I specify this when inserting the product ?

Answer-ProductsWithoutImages
You haven't to specify anything; simply do not select any image when
you add the product.
The product informations will be shown without any image throughout
the e-shop; if you subsequently want to add an image, edit the product
and then specify an image; if you subsequently want to remove the image,
edit the product and check the corresponding box to remove it.
That's all, and it's simple, isn't it ? :)

----------------------------------------------------------------------

Question-ReloadImageWhenUpdatingAProduct
I am bored for having to upload the same image each time I edit some product
properties !  What can you do for me ?!

Answer-ReloadImageWhenUpdatingAProduct
Nothing :)  You don't have to upload the image each time; you have to upload it
only the first time; the next times, you can remove that image through
the suited check box, or you can replace the old image uploading a new image;
but, if you do not remove the old image and you do not specify a new image,
the old image is preserved (and the corresponding thumb is preserved, too).

----------------------------------------------------------------------

Question-FullSizeImages
I suggest to provide a configuration variable to specify a fixed size
for the full size image; this may be useful if you have
high resolution pictures that would be very big for the customers
to look at and if the shop administrator doesn't want to bother himself
in shrinking the pictures before uploading

Answer-FullSizeImage
If you really need such a feature, you can look in admin/products.php
for the code that generates thumbs on the fly (hint: search for the "system"
pattern) and do something similar for full size images.
However, I do not recommend to do this, as the image shrinking is applied
after conversion to a different image format.
As an example, giftopnm is used for GIF images; hence, the layers structure
of the image is lost (think to a transparent background...)
Currently, to my knowledge, there aren't freeware tools that can scale
GIF images preserving all the original image features
(maybe some well chosen parts of the GIMP source code could afford such tasks ?)
Hence, if you want a good quality and scaled image, use something like GIMP...
If you are not using a true Operating System (as an example, if you are
using m$ windows), well, to my knowledge, scanners, photocams, webcams,
and so on, are sold bundled with drivers and with an elementary photo
retouching program that easily allows image resizing also to non-expert
computer users... furthermore, also the m$ windows porting of GIMP
(whose installation is really straightforward) can be used...
Finally, to forbid the upload of too much big pictures, you can customize
the maximum upload size in application.inc.php through the suited parameter.

----------------------------------------------------------------------

Question-ImportingOfImagesArchives
I have seen that also products images can be imported through archives.
Which are the requirements for such archives ?

Answer-ImportingOfImagesArchives
You have to upload a .tar.gz, .tgz, or .zip archive of images;
the filename of the generic image has to be such that the part
preceding the first "." is equal (case sensitively) to the corresponding
product id; the remaining part of the filename is ignored; the image type
is detected on the server side, where ".gif", ".jpg", ".png" extensions
will be selected.

----------------------------------------------------------------------

Question-ImportToEdit
Can the import features be used for editing rather than inserting ?

Answer-ImportToEdit
Yes.  They can also be used for both inserting and editing at the same time.
However, keep in mind that this is not true if you want to edit
the category a product belongs to; in such a case, after importing,
the product characteristics will be edited ("overwritten")
and the product will belong *also* to the newly indicated category.
Look at the products.txt import file for a smart example.

----------------------------------------------------------------------

Question-ImportMiscellanea
Which order should be followed in importing files ?
How has to be formed the file to be imported ?
Is the import code "idiot-proof" and providing all possible data validations ?

Answer-ImportMiscellanea
You should follow the same order of the tables provided in the example
spreadsheet that can be found in the IMPORTS directory, which should
be the same order suggested by the navigation bar in the administration section.
See the .txt files to understand how to prepare a file to be imported:
no chars around fields contents, "TAB" as separator; chr(13) is stripped away
from some lines of code labeled as "Microsoft Stupidity Suppression",
hence you can prepare them also on m$ windows.
The import code is *absolutely not* "idiot-proof"; please, be careful
and pay much attention to avoid typos.
Also keep in mind that the import features are conceived to rapidly add
large amounts of data, not to replicate the full functionality
of the other administration interface sections (which should be
rather "idiot-proof" ;).

----------------------------------------------------------------------

Question-ProductIDs
The product ID should not be something the shop administrator has to deal with.
An autoincrement int field would be simpler and cleaner.

Answer-ProductIDs
It is not difficult to modify the PgMarket code in this way.
However, I do not recommend it in most cases.
First of all, because usually, in non-web catalogs, products have IDs
associated with.
Furthermore, to convince yourself that such IDs are useful, please perform
the following steps:
- insert some products with IDs 1,2,3,4, and so on;
- buy products with IDs, say, 1,3,5
- as the shop administrator, remove from the catalog the product with ID=3
- look at the order details... is the ID "3" sufficiently self-explanatory
  to allow you to remember which product was associated with ID=3 ?
  And if ID=3 was not your choice, as it was an automatic choice ?

----------------------------------------------------------------------

Question-Dumps
How can I use the provided dump files ?

Answer-Dumps
Of course, database username and password may need to be modified
according to your access rights to the database server :)
The simplest cases are addressed in the following.
With PostgreSQL, if authentication is of "trust" type:
createdb pgmarket -U postgres
psql pgmarket -U postgres < pgmarket.start.dump
psql pgmarket -U postgres < pgmarket.demo_data.dump
With MySQL: as an example, you can copy from the dumps and paste
to the mysql prompt; as a further example, you can do as in the following:
mysql -u root -p
give to the mysql prompt the first three commands of mysql.start.dump
(CREATE..., USE..., GRANT...), then exit from the mysql prompt
and edit mysql.start.dump deleting (or commenting with "#")
the first three commands; finally
cat mysql.start.dump | mysql pgmarket -u root -p
cat mysql.demo_data.dump | mysql pgmarket -u root -p
Anyway, if in doubt, please consult the PostgreSQL and/or MySQL documentation
w.r.t. importing dumps :)
Both for PostgreSQL and MySQL: if you haven't a "command line" access right
to "psql" or "mysql" on your database server, simply embed into a .php script
the queries provided by the dumps, use connection parameters,
username and password suited to your database server,
upload the .php script to the server, and load it into your browser.

----------------------------------------------------------------------

Question-PointAndClickSetup
The installation and setup process could be much easier; for example:
unpack everything in the right directory, point your browser
to the corresponding location, wwwroot and dirroot are automatically detected,
username and password for the database user are provided on the setup
interface, and a final click will create the database, the tables,
the initial contents, and so on.

Answer-PointAndClickSetup
Sorry, currently I have no time to write and maintain the corresponding code...
Furthermore, IMHO, it is not so painful to create the database
and import a dump with 2 commands to be issued on the shell,
and to customize some well commented parameters in application.inc.php
(Maybe I have this opinion because I use almost only VIM and MC... ;)

----------------------------------------------------------------------

Question-GraphicalCustomization
How can I customize the web shop look ?

Answer-GraphicalCustomization
A large portion of the look may be modified through the cascaded style sheet.
In the "styles" directory there are some examples.
Maybe you can choose one of the proposed .css files
and then go on customizing it.
You can also easily extend the .css file and use other constructs
in the PgMarket templates.
I strongly recommend to use .css to easily maintain a coherent look
throughout the shop.
Maybe it can be a good idea to choose different .css files for
the catalog and for the administration pages, to reduce the risk
of errors due to distraction of the shop administrator ;)
Further look customization can be obtained modifying the templates,
i.e. the .ihtml files.
Obviously, a larger HTML knowledge (and of what is PHP code and not HTML ;)
implies a stronger capacity to customize the look.
It should not be needed to modify .php files; however, if you know what you do,
you can modify also the .php to obtain a further customization of the product.

----------------------------------------------------------------------

Question-AdministratorEverywhere
ARGH !
I have installed two copies of PgMarket to implement two e-shops.
But... if I login as the shop admin on the shop 1, and then I browse
the shop 2, well, I am recognized as the shop admin of shop 2, too.
But... the passwords are not the same on the two shops !!!

Answer-AdministratorEverywhere
Evidently, you have installed the two shops on the same domain;
as an example:
http://www.yourdomain.com/pgmarket1
http://www.yourdomain.com/pgmarket2
Well, then you have to change the pattern "SESSION" inside all the files
of at least one of the two shops.
As an example, you can change "SESSION" --> "SESSION2" in the second shop.
This is not the only way, but it is IMHO a simple way.
It is also easy as some languages can be used to do automatically
this pattern substitution.
(another possible solution: maybe you can add another argument
to the "SESSION" array... do you want to transform PgMarket in a multi-shop
e-commerce product ? :)

----------------------------------------------------------------------

Question-PasswordNotShownAfterSignup
When a user signs up successfully, the program shows only the users name,
the password is not shown.
Inside the file signup_success.ihtml, there is a section
to show the password, maybe it doesn't work ?
Could you please help me to get the password to show ?
It would make life easier for the customer....

Answer-PasswordNotShownAfterSignup
The mentioned section doesn't work mainly because it is commented out :)
The password cannot be shown simply because PgMarket doesn't use any
clear text password exchange between the browser and the server:
for security reasons, passwords are md5'ed on the client side
through JavaScript... it is not necessary to use https with PgMarket :)
Hence, the server does not know the password submitted during the signup
procedure, but only its md5 hash... which wouldn't be so much useful
to your new subscriber :)
If you want, you can easily suppress the use of md5() from the PgMarket
code; then, if you don't want that password are exchanged as "clear text",
you can use https instead of http.

----------------------------------------------------------------------

Question-WhyNotPHPMD5
Why do you evaluate the md5 hash of passwords through JavaScript
and not through the PHP md5() function ?
PgMarket should be written mainly in PHP... or not ?

Answer-WhyNotPHPMD5
Because JavaScript is used on the client side,
while PHP is used on the server side.
If you evaluate the md5 hash on the server side, then passwords
are exchanged as clear text between the client and the server.
Instead, if you use JavaScript for this purpose, the client and the server
exchange the md5 hash of the passwords, and the md5 hash is practically
not invertible...

----------------------------------------------------------------------

Question-NoEmptyPasswords
In the change_password.php file you are checking the md5 hash
of the password against "d41d8cd98f00b204e9800998ecf8427e".
Why ?

Answer-NoEmptyPasswords
Simply because
md5("") = d41d8cd98f00b204e9800998ecf8427e :)

----------------------------------------------------------------------

Question-ANewDataBaseField
What is it needed to add another field ?
As an example, what is it needed to add another descriptive field for products ?

Answer-ANewDataBaseField
See the CODING-RULES

----------------------------------------------------------------------

Question-NewFeatures
Will this interesting feature (that I need and that is lacking in PgMarket)
be implemented in future releases of PgMarket ?

Answer-NewFeatures
Maybe; if it is already planned (look into the TODO), you only have to wait;
if it is not planned, I can consider your request,
especially if also other persons ask me for the same feature.

----------------------------------------------------------------------

--
Marco Pratesi
http://www.telug.it
pratesi@telug.it

