Topic: FAQ - TRY HERE BEFORE POSTING

I have started this topic in order to list answers to common questions that keep coming up time after time.

Also, view Amanda Arias' phpShop 0.6.x Customization Manual For Beginners for many useful tips.


Please do not use this topic for discussions. It will be much more useful if it is limited to answers to FAQs.

Any posts that are not a useful Q&A will be deleted.

I and any other experienced users will post Q&A as we think of them.

If you notice any errors in a FAQ or think more information could be added, please send the poster a private message and let them know so they can edit it.

If you post a FAQ and are unable to edit it, please contact a moderator and ask them to do it for you.

John

If all else fails, read the instructions (or at least the FAQ)

My phpShop hacks and modules

Re: FAQ - TRY HERE BEFORE POSTING

setlocale() warning in the order list

Warning: setlocale() [function.setlocale]: Passing locale category name as string is deprecated. Use the LC_* -constants instead. in /home/[REMOVED]/public_html/phpshop/modules/order/html/order_list.ihtml on line 98

Fix:
In order/html/order_list.ihtml change the following:

setlocale("LC_TIME",strtolower($lang)."_".$lang);

to

setlocale(LC_TIME,strtolower($lang)."_".$lang);

The quotes are removed from around LC_TIME

John

If all else fails, read the instructions (or at least the FAQ)

My phpShop hacks and modules

Re: FAQ - TRY HERE BEFORE POSTING

How do I delete orders?

There is a delete function in ps_order.inc which removes everything to do
with the order.

Generate the following link in the loop that lists the orders in
order_list.ihtml

<A onClick="return confirm('Are you sure you want to delete this record?')" 
HREF="<?php $sess->purl(SECUREURL . 
"?page=order/order_list&func=orderDelete&order_id=".$db->f("order_id")); 
?>">delete</a> 

You could also put it on order_print.ihtml but you would need to change
$db->f("order_id") to $order_id

If you simply want to remove all test orders before going live, and won't be removing orders again, use your database management software to empty the following tables:
orders
order_item
order_payment

John

If all else fails, read the instructions (or at least the FAQ)

My phpShop hacks and modules

Re: FAQ - TRY HERE BEFORE POSTING

I forgot my admin username/password - what do I do?

Register as a shopper then, using phpMyAdmin or similar, go to the auth_user_md5 table of the database and change the perms for the new shopper to admin. This will provide you with an admin account which you can use to change the password of the previous one.

John

If all else fails, read the instructions (or at least the FAQ)

My phpShop hacks and modules

Re: FAQ - TRY HERE BEFORE POSTING

Images not showing in admin

The url for images in admin files (e.g. those for form buttons) is /ps_image/

This means it is looking for the ps_image folder in your root folder.

There are two ways to overcome this:
Either
1) Move the ps_image folder to the root folder
or
2) Go through all the files used in the administration section and change /ps_image/ to ps_image/

Files used in the adminstration section can be found in the admin, ISshipping, order, product, shopper, store, and tax folders. Not all files will need to be changed, only those with images. Go through the administration and when you come across a page with images missing, edit it.

John

If all else fails, read the instructions (or at least the FAQ)

My phpShop hacks and modules

Re: FAQ - TRY HERE BEFORE POSTING

Cannot modify header information - headers already sent

Problem:
This error shows up:
"Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxxxx/phpshop/etc/phpshop.cfg) in /home/xxxxxxxx/phpshop/modules/admin/lib/ps_session.inc on line 26"
or this error:
"Warning: Cannot send session cookie - headers already sent by (output started at /home/xxxxxxxx/phpshop/etc/phpshop.cfg) in /home/xxxxxxxx/phpshop/modules/admin/lib/ps_session.inc on line 22"

Solution:
Either you can track down and edit all of your files based on the file name and line number in the error code to make sure there is no whitespace at the end of final tags or you can buffer your output which will wait until the headers are sent before sending content (much easier method).

Easier solution:
The easiest way to buffer your output is change first line of index.php to:

<?php ob_start();


and change last line of index.php to:

ob_end_flush(); ?>

Note: There was also a contribution that stated that, if your version of PHP is 4.0.4 or above, the first line of index.php could be changed to:

<?php ob_start("ob_gzhandler");

and that the last line did not need to be changed.


Reason:
Technically, this is a PHP problem, not a PhpShop problem. PHP is a little picky about the way it sends output. Cookies and session information must be sent before any other characters and "any other characters" includes whitespace (spaces, tabs, carriage returns, line feeds, non-displayable characters, etc). You may not see whitespace at the end of files but PHP does. If any of those characters get sent, the PHP interpreter assumes you don't want to send any more header information. Then, when you do send header information, PHP reports this error.

That which is, is; that which is not, is not; that which is, is not that which is not; that which is not, is not that which is.

Re: FAQ - TRY HERE BEFORE POSTING

Making 'United States' (or any other country) the first/default country in dropdown list

Problem:
'Country' dropdown list is alphabetical and can be easily modified to put your country first or make it pre-selected. You can do either or both solutions.

Solution #1 - Changing list order:
(This is taken from Amanda's customization Manual at http://phpshop.ariaswebhosting.com/#country .)

Step 1.) Change 'database country_id' in the MySQL database (this is where PhpMyAdmin would come in handy) to the number you want.
Example: Change USA to 1 if you want it to appear first on the drop down list.

Step 2.) Edit 'function list_country' in 'admin/lib/ps_html.inc' to:

function list_country($list_name, $value="") { 
$db = new ps_DB; 

$q = "SELECT * from country ORDER BY country_id ASC"; 
$db->query($q); 
echo "<SELECT NAME=$list_name>n"; 
echo "<OPTION VALUE=""> - </OPTION>n"; 
while ($db->next_record()) { 
echo "<OPTION VALUE=" . $db->f("country_id"); 
if ($value == $db->f("country_id")) { 
echo " SELECTED"; 
} 
echo ">" . $db->f("country_name") . "</OPTION>n"; 
} 
echo "</SELECT>n"; 
return True; 
}

Solution #2 - Making USA default:
Edit 'list_country' declaration line in modules/admin/lib/ps_html.inc  to:

function list_country($list_name, $value="USA") {
That which is, is; that which is not, is not; that which is, is not that which is not; that which is not, is not that which is.

Re: FAQ - TRY HERE BEFORE POSTING

Editing a product changes its category

Problem:
When an administrator edits a product, sometimes the product changes out of the category it was previously in.

Reason:
For some reason, PHP is interpreting strings that contain only numbers as numbers instead of strings. These solutions will keep the data type correct. You can do either or both.

Solution #1:
Edit 'list_tree' function declaration in ps_product_category.inc from:
[code]function list_tree($category_id="",$cid=0,$level=0) {[/code]to:[code]function list_tree($category_id="",$cid="0",$level=0) {[/code]

Solution #2:
Edit 'list_tree' function in ps_product_category.inc line ~ 497 from:[code]

That which is, is; that which is not, is not; that which is, is not that which is not; that which is not, is not that which is.

Re: FAQ - TRY HERE BEFORE POSTING

Why do subcategories use the secure url?

Subcategory links are generated by the print_child_list() function in product/lib/ps_product_category.inc

In the default phpShop, the function uses the SECUREURL constant in the link url.

To use the regular url for your subcategory links, simply change SECUREURL to URL.

John

If all else fails, read the instructions (or at least the FAQ)

My phpShop hacks and modules

Re: FAQ - TRY HERE BEFORE POSTING

PHP error.log contains "Warning: undefined variable...", etc

Short answer:
You can ignore these (and most) warnings in the error.log . If you want to make them not show up, apply the solution below.

Reason:
Generally speaking, there are 3 types of "error messages" that a PHP script can generate: notice, warning, and error.

Notice means that something is a little strange but might happen normally in the course of a script. Everything will behave normally and the script will continue.

Warning means that something happened that might affect your script. The script will continue but behavior that you expect may not happen the way you want it. One major cause of this message is trying to use a variable without any value; most scripts should accomodate this anyway. phpShop will behave normally with a few 'undefined variable' errors.

Error means that there is a fatal error in the script and execution has stopped. Fix these errors immediately.

Solution:
If you do not want warning and noticemessages to show up in your error.log, change the php.ini variable 'error_reporting' to 'E_ALL & ~E_NOTICE & ~E_WARNING'.

Further clarification is on the PHP manual at:
http://www.php.net/manual/en/ref.errorfunc.php

That which is, is; that which is not, is not; that which is, is not that which is not; that which is not, is not that which is.

Re: FAQ - TRY HERE BEFORE POSTING

Module Not Registered  ...  not a valid phpShop module.

Some critical files are missing that are preventing phpShop from working.

If this is a new, unchanged installation, make sure the directory structure is correct. Under the modules directory, all of the modules should be listed as separate directories. Within each of those directories, make sure you have a directory named lib.  Inside that directory, make sure you have at least these two files: lang_eng.inc and ps_include.inc .  On a Unix/Linux server, case is important so make sure all of those directories and file names are lower case.

If you have changed the native language of your shop through the administrative interface, make sure each of the lib directories contain a file named lang_***.inc where *** represents the three-letter abbreviation of the language you set your shop to.

If you've added a module or directory for more functionality, make sure you've included the files and structure that is listed above. Also, go into the administrative section of your shop, click Admin on the top menu, then Add Module from the left menu, and fill out the form with these values:

Module Name: [name of new module/directory]
Module Perms: none
Module Header: header.ihtml
Module Footer: footer.ihtml
Module Menu: no
Display Order: 99
Module Description: [short descriptive phrase]

That which is, is; that which is not, is not; that which is, is not that which is not; that which is not, is not that which is.

Re: FAQ - TRY HERE BEFORE POSTING

Where is Amanda's Customization Manual?

Amanda Arias is a web designer who posted several FAQs and wrote a small customization manual for PhpShop. The manual has not been updated since July 2002 but is still very useful.There are several references to this manual is these forums. Unfortunately, many of the references contain broken links to places the manual no longer resides.

When she was webhosting, she placed it on her site but when she sold the business, the new owner inadvertantly deleted the manual. It has since been restored.   

The current home of Amanda's Customization Manual is:
http://phpshop.ariaswebhosting.com

Please update any bookmarks.

That which is, is; that which is not, is not; that which is, is not that which is not; that which is not, is not that which is.

Re: FAQ - TRY HERE BEFORE POSTING

PHPshop does not display featured items or items on special

Right now, the featured items as the standard install does not work autormatically.  Each item is shown through a call to the show_snapshot() function.  You have to explicitly indicate what items you want by putting the SKU into the function. 

Or you can use something similar to JohnS's contribution at http://www.webme.co.nz/freestuff.php  , specifically, http://www.webme.co.nz/stores/downloads … _items.txt .

Jeff Rader

Re: FAQ - TRY HERE BEFORE POSTING

Can inventory items for sale be placed into more than one category/subcategory?

For example, I am working on a sports site that sells collectibles, apparel and sports cards.

Some items can be categorized by
Sport, Team, Player Name, Item Type, etc. In other words they can fit into more than one category or subcategory.

Does this shopping cart handle this?

For example, I have a Wayne Gretzky Edmonton Oilers Jersey that is Autographed for sale.

It would fit into any of these categories
Jersey
Wayne Gretzkey
Hockey
Edmonton Oilers (Team)

If some is searching for Gretzky items I would like it to come up... or if they are searching for hockey items I would like this to come up... etc.

by search I mean either by drilling down a hierarchy menu or through a search engine type search....

Thanks
Eric

Re: FAQ - TRY HERE BEFORE POSTING

http://forums.phpshop.org/index.php?showtopic=2185
This is a pretty complete discussion about this mod.  Realize it was not developed for 0.8.0 and may require some additional work.

Jeff Rader

Re: FAQ - TRY HERE BEFORE POSTING

Thumb/Larger image is of course good, but I need to be able to switch from different colors images. Can this script do that?

Re: FAQ - TRY HERE BEFORE POSTING

ExtraB wrote:

Can inventory items for sale be placed into more than one category/subcategory?

For example, I am working on a sports site that sells collectibles, apparel and sports cards.

Some items can be categorized by
Sport, Team, Player Name, Item Type, etc. In other words they can fit into more than one category or subcategory.

Does this shopping cart handle this?

For example, I have a Wayne Gretzky Edmonton Oilers Jersey that is Autographed for sale.

It would fit into any of these categories
Jersey
Wayne Gretzkey
Hockey
Edmonton Oilers (Team)

If some is searching for Gretzky items I would like it to come up... or if they are searching for hockey items I would like this to come up... etc.

by search I mean either by drilling down a hierarchy menu or through a search engine type search....

Thanks
Eric

Yes, this is possible. RTFM

Re: FAQ - TRY HERE BEFORE POSTING

HI I m kinda new to this stuff.... I need some help, I ve installed phpshop in my site, but I cant log in, i got a Forbidden 403 error...... please help