Archive for category PHP
osCommerce Slashes acumelating in product name and description fields.
Posted by Jorge Fernandez in osCommerce on May 28th, 2010
I recently ran into an issue in osCommerce 2.2RC2. In the admin area when adding, editing a product everything is fine but when you hit back on the the on the preview screen your product name and description have a bunch of extra slashes in it. This happens because osCommerce is escaping the quote you put into the name and description and not removing them on the way back.
Heres a quick fix
Go to “admin/categories.php” and find the following line
<td><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? $products_name[$languages[$i]['id']] : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>
and replace it with
<td><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : stripslashes(tep_get_products_name($pInfo->products_id, $languages[$i]['id'])))); ?></td>
Then replace this line :
<td><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>
with:
<td><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : stripslashes(tep_get_products_description($pInfo->products_id, $languages[$i]['id'])))); ?></td>
Thats it its as easy as that.
Codeigniter: My PHP framework of choice
Posted by Jorge Fernandez in Codeigniter, PHP on April 21st, 2009
Lately I’ve been looking for ways to organize my code and be more productive. As i was reading my RSS feeds I stumbled upon an article that linked to the Codeigniter web site. After reading up on the benefits of Codeigniter I decided that I should look at other PHP frameworks and compare to see which ones I liked. I reviewed Zend, CakePHP, and Codeigniter because they use the MVC model that i find is a logical and effective way to organize my code.
While downloading Zend the first thing I realized was how heavy it was it was 24 MB zipped i didn’t even continue with the download. 24MB is way too much and it still doesn’t have the application in it so without even downloading it
i crossed Zend out.
Next was CakePHP, Cakes download size is much more decent at just under 700kb once I downloaded it I started to read through the documentation. While looking at the way that Cake’s classes are organized I found them to be sort of a hassle to work with. Also even though there is good documentation I found that some of it I had to read 2 or 3 time to actually get a full grasp of what a function or class does. At this point i hadn’t ruled out Cake but i wasn’t convinced that it was for me.
Finally I went back and reviewed Codeigniter. Codeigniter is a little heavier than Cake at 900kb but it is still a very reasonable size. The first thing I noticed about Codeigniter(CI) is its user guide I it took no more that 5 min to understand how CI implemented the MVC model. Almost immediately i fell in love with CI I find it super easy to use and it takes care of all the little things easily. Its DB class implements the Active Record Pattern which makes thing so easy. I don’t have to worry about where i missed the quote in a 10 line SQL statement and I don’t have to worry about escaping characters since it’s all take care of.
All in all I think Codeigniter takes care of all the simple things that take up most of your time. Take a look at CI here.

