[Zen Cart] - Hack to Change G2 Description BBCode to HTML Tags for Zen Cart

Dayo

Joined: 2005-11-04
Posts: 1642
Posted: Sat, 2007-04-07 17:45

Just wanted to share an edit that some might find helpful. This edit will convert your G2 BBcode tags to HTML for ZenCart and will apply to new items added to your gallery.

We have the option to allow either raw HTML or BBCode in G2 and are advised to stick with BBCode for security reasons. However, if you use the Zen Cart Module, your BBCode Tags will appear in your description and titles as Zen Cart requires HTML Tags. This causes a pain as you have to edit each item in Zen Cart if you use BBCode in either your Item Title or Description.

To edit existing items, go into edit for that item and press save. Alternatively, you can try using the bulk captioning tool. Open this and press update for changes to be carried through to Zen Cart.

Go to GalleryZenCart.Class in modules/zencart/classes and carry out the following steps.

1) Replace all instances of

$description = $this->_zenCart->zen_db_input($description);

with

// Start code inserted to change BBCode to HTML
$description = str_replace("[", "<", $description);
$description = str_replace("]", ">", $description);
// End code inserted to change BBCode to HTML
$description = $this->_zenCart->zen_db_input($description);

2) Replace all instances of

$title = $this->_zenCart->zen_db_input($title);

with

// Start code inserted to change BBCode to HTML
$title = str_replace("[", "<", $title);
$title = str_replace("]", ">", $title);
// End code inserted to change BBCode to HTML
$title = $this->_zenCart->zen_db_input($title);

3) Replace all instances of

$name = $this->_zenCart->zen_db_input($name);

with

// Start code inserted to change BBCode to HTML
$name = str_replace("[", "<", $name);
$name = str_replace("]", ">", $name);
// End code inserted to change BBCode to HTML
$name = $this->_zenCart->zen_db_input($name);

Hope someone finds this useful

.
Gallery Version: 2.2.1
Gallery Theme: PGTheme 1.1.0 (RC01)
Web Site: http://dakanji.com