Monthly Archives: April 2009


Prestashop “an error occurred while updating object cms”

A blank error could appear when you use the CMS editor in PrestaShop. It says “an error occurred while updating object cms ()”.

error

Apparently they filter certain words to prevent SQL injection, which is a good idea, but what I don’t understand is why it needs to be in the  of Prestashop. I can understand if it were a comments box or something on the front end, which really doesn’t need to be a rich text editor, but on the back end? I suppose if somebody got into the  of your store this would help, but either way they’d be doing a lot of damage by just pointing and clicking.

If you get this error, check your content for the following words and replace them with something different: union, load_file, outfile, dumpfile, escaped, terminated, cascade, infile, x509, trigger, revoke


PHP Invalid character at XML input 2

I wrote up a tool that uses PEAR’s xml serializer to convert product objects into XML and save it as a file.  My other supplement stores read the file and insert or update the products as necessary.  I ran into problem after problem with the error “Invalid character at XML input” and then some line and character number was included, which usually pointed at nothing or white space in the file.   I tried putting everything in cdata and that didn’t solve the issue.  I implemented iconv to strip out all non UTF-8 characters on a couple fields like the product description, which may contain any number of crap characters.  This worked for those fields and lead to the solution of either applying iconv to every text field that could possibly have a special character or apply it to the whole XML doc as a variable before it’s written.  The code below did the trick.

$xml = htmlentities(iconv('UTF-8', 'UTF-8//IGNORE', $xml));

Prestashop Combinations Suck 11

There are a lot of great features with Prestshop, but as of version 1.1 their idea of product options and values, attributes, or combinations (whatever you want to call them) is not good.  If you have five or six different options with four or five option values each, you cannot use this solution.  Why?  Let me show you….

Use the “generator” to assign attributes to a product.  Below is the full screenshot of all the attributes assigned so far.  Notice the green box at the top that says “4900” products created.  I don’t know why they call it “products” b/c it’s really some sort of product/attribute combination.

untitled-1

The attribute tables in the database contain a ton of records!

db-1

Add another option with two values.

untitled-31

And the table record counts jump to 9800 and 58802!  How the can this be?  I only added one more option and two values?!?!

db-2

Add one more option value and things go boom.  It’s broke.

untitled-4

The database says…

db-3

What happened?  Prestashop was successful at increasing the number of rows in the product attribute table again by 50%, but when it tries to insert 117,000 records into the product_attribute_combination table things don’t work.

I used my debugger and stepped though the code in of the generator page in attempt to figure out the problem.  The code loops through all the records and builds an array of objects with 18 properties each for all the combinations, except that the array contained well over 100000 objects!  This took forever and locked up my machine.  Additionally, when you have this many combinations, the product detail page that the customers use takes about 15 seconds to load.

Why would you attempt to store every possible combination of a product and all its options and all its values in the database?????  This is not using a relational database as it is supposed to be used!  You build relationships, not just store data!  Prestashop is great in many ways and “had” a lot of potential… until this.  Prestashop product combinations suck!


Prestashop Review 9

Prestashop, unlike Magento, is the new open source ecommerce solution that any seasoned developer can pick up and modify to their needs.  It’s still very new and there aren’t very many payment or shipping modules yet.  I’ve had the opportunity to work with Prestashop for my employer this past week and will share my experience. I chose Prestashop over Magento, oscommerce, zencart, and xcart based on the customizations we needed.

Pros:

1. Good use of object oriented PHP

2. Smarty templates for the view layer

3. Easy to customize code

4. Tableless design that uses a lot of CSS

5. “Block” content that can be edited via the admin by point and click.

Cons:

1. Poor design of attribute combinations

2. Little to no comments within the code

Download or try the online demo at http://www.prestashop.com .


Reset admin password in prestashop 50

If you’re like me and you tried the “lost password” link on prestashop’s backend and never received the email, you might try this solution if you have access to the database.  Look in config/settings.inc.php for the _COOKIE_KEY_ value as you’ll need that. Run the following SQL and replace the <> variables with your information.

UPDATE employee SET passwd = md5(“<_COOKIE_KEY_ value><yourNewPassword>”) WHERE email = “youremailaddress”;

hope that helps