Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Addon} Modular Front Page


kymation

Recommended Posts

  • 3 weeks later...

I just entered some new text to Text Main this morning.  Now, I can't edit the text anymore.  When I select Edit, I no longer get the text field to edit anymore.  At the top of the Modules listing in Admin, this is the error message:

 

"Parse error: syntax error, unexpected T_STRING in /home1/tomb/public_html/catalog/tube4391/modules.php(251) : eval()'d code on line 3"

Link to comment
Share on other sites

I guess it was some sort of error in the HTML I used.  I wiped out the added text in PHPAdmin and carefully added new text with correct HTML (don't know what I did the first time).  Now, everything is fine.

Link to comment
Share on other sites

The most common cause is using a single quote/apostrophe. This causes problems with the code. Any single quote should be escaped with a backslash.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

  • 4 months later...

I've uploaded a new version that includes a set of Bootstrap modules for the latest osCommerce Responsive codebase. They should work with PHP 5.5, 5.6, and 7. The old modules are still there, in a separate folder, for those who need them.

 

The Bootstrap modules only include the standard set. I plan to release additional modules separately as I have the time to make them.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Updated the Responsive modules to add version numbers and fix some minor typos. If you have this installed already, no need to do anything unless you want to. If you do, replace the module files and then uninstall and reinstall to see the changes.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

And updated again. This one fixes bugs in the New Products and Upcoming Products modules. The previous versions did not display the products in the correct order. I suggest that you replace those two modules, or just replace all of them. There is no need to uninstall first.

 

More modules coming as soon as I can write them.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Anything is possible. You would need to modify the code to exclude your category. For example, in the module file find this code:

        where 
          c.parent_id = '0'
          and cd.language_id = '" . (int) $languages_id . "'

and add just after that

          and c.categories_id != '13'

That will prevent the category with an ID of 13 from showing in the Categories Images box.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I'm pretty sure there is no Addon to do that. That's a pretty specific -- and unusual -- request. There are several Addons that would hide a category everywhere, but you would have to modify the code of one of those to do what you want. This was the easiest way to do what you asked.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I've updated the Modular Front Page Bootstrap modules and the Categories Images module to add the Width parameter. This allows you to set a width for each module, so modules can be side-by-side. If you want to update an existing installation, uninstall your modules and then upload all of the modules directory (including the templates) and reinstall.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Another new Front Page module: This module shows a products box on the front page, similar to the stock New Products, but with the products selectable in the module admin. See: http://addons.oscommerce.com/info/9438

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I thought I would share the changes I made to allow you to hide a category from the front page but not the boxes

 

 

includes\modules\front_page\fp_categories_images.php

Find
and cd.language_id = '" . (int) $languages_id . "'
 
Add below
and c.hide != '1'
 
admin\Categories.php
Find
tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&pID=' . $HTTP_GET_VARS['pID']));
        break;
      case 'insert_category':
      case 'update_category':
        if (isset($HTTP_POST_VARS['categories_id'])) $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
        $sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);
 
Add below
$hide = tep_db_prepare_input($HTTP_POST_VARS['hide']);
 
Find
$sql_data_array = array('sort_order' => (int)$sort_order); 
 
        if ($action == 'insert_category') {
          $insert_sql_data = array('parent_id' => $current_category_id,
                                   'date_added' => 'now()');
 
Replace with
$sql_data_array = array('sort_order' => (int)$sort_order, 
'hide' => (int)$hide);
 
        if ($action == 'insert_category') {
          $insert_sql_data = array('parent_id' => $current_category_id,
                                   'date_added' => 'now()');
 
Find
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
    } else {
      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");
    }
    while ($categories = tep_db_fetch_array($categories_query)) {
      $categories_count++;
      $rows++;
 
Replace with
$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.hide, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
    } else {
      $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.hide, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");
    }
    while ($categories = tep_db_fetch_array($categories_query)) {
      $categories_count++;
      $rows++;
 
Find
$contents[] = array('text' => '<br />' . TEXT_CATEGORIES_NAME . $category_inputs_string);
        $contents[] = array('text' => '<br />' . TEXT_CATEGORIES_IMAGE . '<br />' . tep_draw_file_field('categories_image'));
        $contents[] = array('text' => '<br />' . TEXT_SORT_ORDER . '<br />' . tep_draw_input_field('sort_order', '', 'size="2"'));
        $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath)));
 
Replace with
$contents[] = array('text' => '<br />' . TEXT_CATEGORIES_NAME . $category_inputs_string);
        $contents[] = array('text' => '<br />' . TEXT_CATEGORIES_IMAGE . '<br />' . tep_draw_file_field('categories_image'));
        $contents[] = array('text' => '<br />' . TEXT_SORT_ORDER . '<br />' . tep_draw_input_field('sort_order', '', 'size="2"'));
$contents[] = array('text' => '<br />' . TEXT_CATEGORIES_HIDE . '<br />' . tep_draw_input_field('hide', '', 'size="2"'));
        $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath)));
 
Find
$contents[] = array('text' => '<br />' . TEXT_EDIT_CATEGORIES_NAME . $category_inputs_string);
        $contents[] = array('text' => '<br />' . tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $cInfo->categories_image, $cInfo->categories_name) . '<br />' . DIR_WS_CATALOG_IMAGES . '<br /><strong>' . $cInfo->categories_image . '</strong>');
        $contents[] = array('text' => '<br />' . TEXT_EDIT_CATEGORIES_IMAGE . '<br />' . tep_draw_file_field('categories_image'));
        $contents[] = array('text' => '<br />' . TEXT_EDIT_SORT_ORDER . '<br />' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'));
        $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id)));
 
Replace with
$contents[] = array('text' => '<br />' . TEXT_EDIT_CATEGORIES_NAME . $category_inputs_string);
        $contents[] = array('text' => '<br />' . tep_image(HTTP_CATALOG_SERVER . DIR_WS_CATALOG_IMAGES . $cInfo->categories_image, $cInfo->categories_name) . '<br />' . DIR_WS_CATALOG_IMAGES . '<br /><strong>' . $cInfo->categories_image . '</strong>');
        $contents[] = array('text' => '<br />' . TEXT_EDIT_CATEGORIES_IMAGE . '<br />' . tep_draw_file_field('categories_image'));
        $contents[] = array('text' => '<br />' . TEXT_EDIT_SORT_ORDER . '<br />' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'));
$contents[] = array('text' => '<br />' . TEXT_EDIT_CATEGORIES_HIDE . '<br />' . tep_draw_input_field('hide', $cInfo->hide, 'size="2"'));
        $contents[] = array('align' => 'center', 'text' => '<br />' . tep_draw_button(IMAGE_SAVE, 'disk', null, 'primary') . tep_draw_button(IMAGE_CANCEL, 'close', tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id)));
 
admin\includes\languages\english\categories.php
 
Add before final ?>
define('TEXT_EDIT_CATEGORIES_HIDE', 'Hide From Front Page: <p>(1 to hide, 0 to show)')
SQL Changes
ALTER TABLE `categories` ADD `hide` INT(3) NOT NULL AFTER `sort_order`;
Link to comment
Share on other sites

I thought I would share the changes I made to allow you to hide a category from the front page but not the boxes

i can see you have programmed this in the most flexible way, but I was just wondering if a configuration key with a comma separated list of categories ids to hide wouldn't have worked too, without the need to add a database field and amend the data entry for categories ...

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

i can see you have programmed this in the most flexible way, but I was just wondering if a configuration key with a comma separated list of categories ids to hide wouldn't have worked too, without the need to add a database field and amend the data entry for categories ...

It would have worked but this method makes it easy to add and remove categories from the front page.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...