Jump to content

Creating a brand new theme from default theme - Fatal error: Call to undefined method stdClass::save


Recommended Posts

So.. I want to create a new theme, using the default-bootstrap theme files.

 

I did exactly like it's said in the documentation ( http://doc.prestashop.com/display/PS16/Themes+Preferences ). I quote:

 

The best way to create a new theme for PrestaShop is copy the files from the default theme, and start modifying its TPL and CSS file to make them your own. The reason is that a PrestaShop theme requires many files to be present: by starting from an existing theme instead of from scratch, you make sure that your own theme will not be missing any part.

You can do this directly on the web server, but PrestaShop makes it easy to copy the files from an installed theme and register your new theme in its system (a step you would have to do in any case).

All of this is done by clicking on the "Add new" button from the theme list (NOT the "Add new them" button at the top of screen!). It displays a creation form.

...

Fill-in its fields:

...

Click save, and PrestaShop will register this information for you: the theme appears in the theme list, and its preview image appears in the theme selector.

It is now up to you to change your theme's files in order to make it unique! On your local installation (not a production one!), select your new theme, and start working!
Once you are done with your designing and code it, go back to this setting page and change it accordingly: definitive preview image, default column, number of products, and responsiveness.

 

I hit save and get a blank screen with the following error:

 

Fatal error: Call to undefined method stdClass::save() in /hsphere/local/home/aaaaaa/aaaaaa.com/controllers/admin/AdminThemesController.php on line 583

 

Tried exporting the theme to then import it but looks like zipping is disabled by our host provider.

 

However would like to copy the theme using the first option.

 

Thanks for your help in advance :)

Link to comment
Share on other sites

  • 2 years later...

A couple of years later, but getting this error still, so hopefully this will help someone.

 

Traced it through the code, and it comes down to (currently) line 572 in /controllers/admin/AdminThemesController.php : 

            if (mkdir(_PS_ALL_THEMES_DIR_.$new_dir, Theme::$access_rights)) {
                $this->confirmations[] = $this->l('The directory was successfully created.');
            }
Your directory isn't being created, but instead of throwing any error there, it goes on to fail in the "add" function in classes/Theme.php .
 
For me (using a mac), the problem was that the folder permission for the themes folder was set at 755 instead of 775, which means it could not create the folder. However, in the installation instructions (http://doc.prestashop.com/display/PS16/Installing+PrestaShop?utm_source=html_installer), it does not mention /themes as one of the folders that needs to have write permissions. It only mentions 
 

Recursive write permission on~/themes/default/lang/
Recursive write permission on ~/themes/default/pdf/lang/

Recursive write permission on ~/themes/default/pdf/default/cache/

 
Get some write permissions on your themes folder and it should be fine.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...