WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Bakery Shop => Topic started by: mikal42 on October 18, 2010, 05:05:58 PM

Title: Cannot change name of bakery folder
Post by: mikal42 on October 18, 2010, 05:05:58 PM
I would like to change the name of the Bakery Pages Directory from 'bakery' to something like 'shop' of 'sales'. The word 'bakery' in the url seems a little odd if the cart is not for a bakery. My client noticed this and asked me if it could be changed.

In the Bakery general settings, there is a place where you can apparently  "name" the directory that the bakery pages originate from, in a similar manner to the main Website Baker settings.

The only way to access these settings as far as I know is to create a bakery page first. When I tried to change it to 'shop'  and saved it,  it came up as 'Rename unsuccessfull'.  I tried putting a folder called 'shop' in the pages directory and it came up 'folder already exists'.

It seems that it needs to be changed BEFORE making a page, which does make sense as once a page is made it will be in the 'bakery' folder, but there seems to be no way of accessing the general settings page in Bakery before doing so.

Does anyone know how to do this, it is the only real down point in what is otherwise an excellent module...
Title: Re: Cannot change name of bakery folder
Post by: instantflorian on October 18, 2010, 06:56:06 PM
Hi,

you have to add one article in the newly created bakery page, then you can change the bakery directory name.

BR
-instantflorian.
Title: Re: Cannot change name of bakery folder
Post by: mikal42 on October 18, 2010, 07:03:52 PM
I have tried this but it always comes up as 'Rename unsuccessfull'.
Title: Re: Cannot change name of bakery folder
Post by: mjm4842 on October 19, 2010, 07:37:54 PM
Hi mikal42,

According to https://forum.WebsiteBaker.org/index.php/topic,18426.msg130029.html#msg130029,in order to rename the bakery folder/directory, you should simply need to do a search and replace across all bakery files BEFORE you install the module into Website Baker. I have tried one of Snoork's modified versions of Bakery and it seems to work fine. I actually have a site where I now have two independent copies of bakery running at the same time.

Note: Trying to change the "bakery" directory name after the module is installed is MUCH more complicated as you then need to also modify the database tables and their contents.

Here are the recommended steps:

1) Unzip the bakery module locally.

There are three instances of the word Bakery that you will need to search and replace across all of the files and folders. For example:

2) Search for "bakery" and replace it with "shop".
3) Search for "Bakery" and replace it with "Shop".
4) Search for "BAKERY" and replace it with "SHOP".

And finally...

5) Zip up the files back up and install the module.

TIP: Dreamweaver has the ability to perform a search and replace across all files in a folder and subfolder. If you don't have Dreamweaver, you can also give Replace Text (formerly BK Replace Em) a try. It's available from http://www.ecobyte.com/replacetext/ . I have been using BK Replace Em for years. It's not he simples tool to use but I like it's ability to search and replace blocks of lines. Note that it may also have compatibility issues with Windows 7. You can find other alternatives at http://www.snapfiles.com/freeware/productivity/fwwordprocessing.html .

Hope this helps! Let us know if you run into any problems or you would like to amend the above instructions to make it easier for others.

With best regards,

Michael Milette
Title: Re: Cannot change name of bakery folder
Post by: Argos on October 27, 2010, 12:35:00 PM
Great info, thanks! Although this is really a silly bug that need to be fixed by the Bakery author, your instructions are the way to go for now.

Note: when doing a search & replace please switch on the "Match Case" switch in DreamWeaver or another editor. Only then the replacing will be done right.
Title: Re: Change name of bakery folder
Post by: mjm4842 on October 27, 2010, 03:29:28 PM
Glad it worked for you Argos.

Note that renaming the bakery folder is only esthetic for the site administrator since it's address never actually appears in the URL for the end user, at least it doesn't for me. Can you tell me at which point it does show up in the URL?

Renaming everything else is only useful if you want to have multiple independant copies of bakery instealled.

Unfortunately there is no easy way to just rename the folder.

With best regards,

          Michael
Title: Re: Cannot change name of bakery folder
Post by: instantflorian on October 27, 2010, 06:31:48 PM
Hi Michael,

the bakery path is displayed when openig a bakery product detail page (see 1st attachment).

But I wonder why the easy way of changing the bakery path did not work, because the way I described in my earlier post worked for me (see 2nd screenshot, which shows an url where I changed the path from "bakery" to "portfolio").

BR
-instantflorian

[gelöscht durch Administrator]
Title: Re: Cannot change name of bakery folder
Post by: mjm4842 on October 27, 2010, 07:42:27 PM
Hi instantflorian,

It didn't work because there are hard coded references to the bakery folder in the source code and possibly in the database too. Once the module is installed, it gets really complicated to find all of the right spots. That's why it's better to make the changes before you install it.

Doing a search and replace for the uppercase of "BAKERY" is probably not necessary. Based on my quick scan, it seems to only be used for $MOD_BAKERY variables but I could be wrong.

The mixed case "Bakery" is typically only used to refer to the name of the Bakery module itself. Again, you can probably get away with not changing this except in the "info.php" file where you must if you want to specify a separate installation of Bakery if you are going to change the database prefix and run multiple copies of Bakery. This affects the name of the page type when you are creating a new page.

Where it gets more complicated is when it comes to the lowercase "bakery". Unfortunately this string is used in many situations including but not necessarily limited to the folder name and the database table prefixes.

For example, I just did a search for "modules/bakery" throughout all of the files and found that 63 of the bakery module files included that specific string alone. The folder name also appears in "info.php". If I search for just lowercase "bakery", it shows up in 135 files which obviously includes those found in the modules/bakery search above.

It would be nice to replace all this with one variable in the info.php file and be able to easily modify it in just one place. This would make it easier to change the folder name.

While we are at it, it would also be nice to have a variable for the database table prefix. This would allow us to have more than one instances of the bakery module installed at a time.

Keep in mind that I spent a total of about 5 minutes doing this research so I may have missed a few things along the way. If you use this information, your mileage may vary. If you do try your hand at it, let us know what worked, what didn't for you.

As usual, take what makes sense to you and forget the rest.

With best regards,

Michael
Title: Re: Cannot change name of bakery folder
Post by: mikal42 on November 04, 2010, 08:09:32 PM
Thanks for posting up that info mjm4842.
The funny thing is that I had concluded that this is the only way it would work and had done this!!
I then find your post and it confirmed it, it definitely needs to be sorted as this is THE major obstacle in the module.

I was on the verge of using a different CMS until I tried this as my client was really unhappy about the word bakery being in the url for her skincare products, and quite rightly so...
Title: Re: Cannot change name of bakery folder
Post by: mjm4842 on November 04, 2010, 09:38:12 PM
See https://forum.WebsiteBaker.org/index.php/topic,18426.msg133522.html#msg133522

With best regards,

Michael Milette