WP e-Commerce 3.8: Permission problems – You must update your database to import all of your products.

If you get a message to:

“You do not have sufficient permissions to access this page.”

after you clicked on the link to update from the message that appears on your admin pages like this:

“You must update your database to import all of your products.”

Here is the solution:

To get that beautiful window go to your console:

[code]pico +44 ./wp-e-commerce/wpsc-admin/display-update.page.php[/code]

and comment, add the line below, and save:

[code]//add_action( ‘admin_notices’, ‘wpsc_display_update_notice’ );
add_action( ‘admin_notices’, ‘wpsc_display_update_page’ );[/code]

Now go back to the link you were sent when you saw that message about upgrading your database and hit it again:

This is the link just in case:

http://…./wp-admin/admin.php?page=wpsc-update

Then you will update your database nicely!

I think WP e-Commerce has some admin pages and submenus, namely using add_submenu_page that are not really working.

WordPress Shopping Cart: View All Feature

The feature we want to implement is a link label “view all” that behaves in the same way http://www.sundancecataloge.com product page behaves.

The improvement will make it possible to display all the products of one category (or of all categories) in the same page where it usually is paginated.

There are at least two approaches:
1. hide the regular display of products with pagination and display all products
2. work on modifying the actual display of products function with pagination and tweak it so that it would receive a parameter acted by a form button “view all”

We solved with #2:

We modify the logic for the product queries. After some hard work I have come up with a solution that can be seen in action here


If you would like to get the patch for this feature it is available if you email me at cordoval@gmail.com with a donation of $17.

Your contribution will be used to develop more amazing improvements to the Shopping cart and I will post them on this blog.

Please encourage me to keep developing more patches for WPEC here: Donate HERE
Thanks!

Management Code Development 2

This is the second part in in our series of Code Management for Developers.
So recently I made some modifications for a new feature locally and then when deploying I asked myself how different was the code that was already on the server from the code base. In order to find out I had to download a copy of the remote file and do a diff:
[code]
diff -b local_file.txt remote_file.txt
[/code]
The output of the diff would indicate to me whether it was just my modifications that created the difference. In case it was so I just had to overwrite the files. In another case I had to merge the changes into one file and upload that file.
That was a tedious task doing it by hand. So a script was actually needed to download a local copy of the files that I had modified, compare them to my versions, merge them, and uploading them back. The first problem we encounter is to realize which files I had modified! I used the names of the branches. Master branch compared to the branch I was in that had the modifications.
To that the git diff command came to our rescue:
[code]
git diff master beatity_variations –stat
[/code]
This would list the files for me:
[code]
…/wp-e-commerce/transaction_result_functions.php | 10 ++++-
wp-content/plugins/wp-e-commerce/user-log.php | 37 +++++++++++——-
…/plugins/wp-e-commerce/widgets/luis_widget.php | 41 +++++++————
…/wp-e-commerce/wpsc-includes/cart.class.php | 38 ++++++++++++++++++
…/wpsc/themes/iShop/shopping_cart_page.php | 3 +-
5 files changed, 86 insertions(+), 43 deletions(-)
[/code]
With this information I was able to do the job however it was manual and I was asked once to restore to previous versions of the remote files after I modified them. This latter request called the support for an “unpatch” feature in to question.

Advantages for WordPress Development with Git

Lately I decided to play with git and WordPress development.
I modified this gist https://gist.github.com/444295 which is the .gitignore for a regular wordpress project.
This is my version:
[code]
# Ignore everything in the root except the "wp-content" directory.
/*
!.gitignore
!wp-content/

# Ignore everything in the "wp-content" directory, except the "plugins"
# and "themes" directories.
wp-content/*
!wp-content/plugins/
!wp-content/themes/
!wp-content/uploads/

# Ignore everything in the "plugins" directory, except the plugins you
# specify (see the commented-out examples for hints on how to do this.)
wp-content/plugins/*
!wp-content/plugins/wp-e-commerce/
# !wp-content/plugins/my-directory-plugin/

# Ignore everything in the "themes" directory, except the themes you
# specify (see the commented-out example for a hint on how to do this.)
wp-content/themes/*
!wp-content/themes/handmademujer/
wp-content/themes/handmademujer/images/*

# Ignore everything in the "uploads" directory, except the wpsc directory
# within the uploads only listen to upgrades and themes
# however within themes folder just listen to hmmujer
wp-content/uploads/*
!wp-content/uploads/wpsc/
wp-content/uploads/wpsc/*
!wp-content/uploads/wpsc/upgrades/
!wp-content/uploads/wpsc/themes/
wp-content/uploads/wpsc/themes/*
!wp-content/uploads/wpsc/themes/hmmujer/
[/code]

The main advantage I rapidly became aware of was that I could implement new features and if I messed up then I could come back to a point where I was absolutely confident on my code. Since it could be a live site, then I can rapidly switch between the current branch and the feature branch to watch how the changes look.

Of course I develop on a local server first, so that is good so I can test results on the browser immediately and branch other features as well.

Example:

1. I added two lines of code on the products_page.php for handmademujer site:

2. I come back to master branch git checkout master, refresh browser and get my site back:

Future Problems (Questions for Phil):
– how to work with upgrades on plugins? and how to do the merge with the latest version with my changes to it? Notice that if I have not updated my plugin for a while it could be like 1552 lines to update. How to manage that complexity with git?

– what to do in case the state of the database needs to be also restored, does git work or have some functionality for keeping also the state of the databases? what could the alternative be?

Conclusion:
I feel more secure now to explore other features and isolate independent advances that I can later on merge to make up a better site. We created a better .gitignore file that we can further tailor to work with wordpress, ecommerce or other important plugins that tend to change with time.

You can show appreciation by donating: http://bit.ly/donateforhelp
By donating you will be helping me to help others as yourself.