Jump to content
kymation

[Addon} Modular Front Page

Recommended Posts

Check that you edited the right part of the page. The Modular Front Page edits replace a chunk of code near the bottom of the page. If you made those edits to the section above that....

 

Edit: If you didn't revert the index.php your front page should be blank. The center part anyway.

 

Regards

Jim

Edited by kymation

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

Share this post


Link to post
Share on other sites

OK, like I said - the index.php is not the same as in your documentation.  I had to guess where to put it.  Maybe I should've copied more of the code and you can tell how it is different (at least I think so): 

<?php// optional Product List Filter    if (PRODUCT_LIST_FILTER > 0) {      if (isset($HTTP_GET_VARS['manufacturers_id']) && !empty($HTTP_GET_VARS['manufacturers_id'])) {        $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";      } else {        $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";      }      $filterlist_query = tep_db_query($filterlist_sql);      if (tep_db_num_rows($filterlist_query) > 1) {        echo '<div>' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . '<p align="right">' . TEXT_SHOW . ' ';        if (isset($HTTP_GET_VARS['manufacturers_id']) && !empty($HTTP_GET_VARS['manufacturers_id'])) {          echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);          $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));        } else {          echo tep_draw_hidden_field('cPath', $cPath);          $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));        }        echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);        while ($filterlist = tep_db_fetch_array($filterlist_query)) {          $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);        }        echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');        echo tep_hide_session_id() . '</p></form></div>' . "\n";      }    }    include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);?></div>
<?php  } else { // default page?><h1><?php echo HEADING_TITLE; ?></h1><div class="contentContainer">  <div class="contentText">    <?php echo tep_customer_greeting(); ?>  </div><?php    if (tep_not_null(TEXT_MAIN)) {?>  <div class="contentText">    <?php echo TEXT_MAIN; ?>  </div><?php    }    include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);    include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);?></div><?php  // Start Modular Front Page?><div class="contentContainer"><?php echo $oscTemplate->getBlocks('front_page'); ?></div><?php  // End Modular Front Page  }  require(DIR_WS_INCLUDES . 'template_bottom.php');  require(DIR_WS_INCLUDES . 'application_bottom.php');?>

Here is the index.php included in the Modular Front Page add-on:

 

<?php
// optional Product List Filter
    if (PRODUCT_LIST_FILTER > 0) {
      if (isset($HTTP_GET_VARS['manufacturers_id'])) {
        $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";
      } else {
        $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";
      }
      $filterlist_query = tep_db_query($filterlist_sql);
      if (tep_db_num_rows($filterlist_query) > 1) {
        echo '<div>' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . '<p align="right">' . TEXT_SHOW . ' ';
        if (isset($HTTP_GET_VARS['manufacturers_id'])) {
          echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
          $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
        } else {
          echo tep_draw_hidden_field('cPath', $cPath);
          $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));
        }
        echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
        while ($filterlist = tep_db_fetch_array($filterlist_query)) {
          $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
        }
        echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');
        echo tep_hide_session_id() . '</p></form></div>' . "\n";
      }
    }

    include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING);
?>

</div>

 

<?php
  } else { // default page
  // Start Modular Front Page
?>

<div class="contentContainer">

<?php echo $oscTemplate->getBlocks('front_page'); ?>

</div>

<?php
  // End Modular Front Page
  }

  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

 

 

EDIT: I included the "<?php
// optional Product List Filter"

section to give you context that the files were the same until after that section.

Edited by TomB01

Share this post


Link to post
Share on other sites

This is the key part to look for:

 

 

<?php
  } else { // default page
?>

 

The changes for Modular Front Page go just after those lines. It looks like you got that right, although you didn't delete all the lines you should have. I'm still puzzled about this one.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

So you're saying I should've deleted these lines:

 

 

<h1><?php echo HEADING_TITLE; ?></h1>

<div class="contentContainer">
  <div class="contentText">
    <?php echo tep_customer_greeting(); ?>
  </div>

<?php
    if (tep_not_null(TEXT_MAIN)) {
?>

  <div class="contentText">
    <?php echo TEXT_MAIN; ?>
  </div>

<?php
    }

    include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);
    include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);
?>

</div>
??

Share this post


Link to post
Share on other sites

Yes, all of that. But leaving it in still wouldn't cause the problem you described. That database error might have, if it meant that your database got corrupted with module installs. Uninstalling the modules should have fixed that anyway.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

Alright, I apologize for this.  I got antsy and re-installed everything with a clean index.php.  The banner was my fault.  Turns out, I had installed an image rotator for my store logo and it reads from the banner directory.  So, it was randomly sequencing through the images, including the test banners.  Sorry about that.

 

Now, everything worked until I got back to the SQL error when I install the Featured Products module:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') order by rand() limit ' at line 13

select p.products_id, p.products_image, pd.products_name from products p join products_description pd on pd.products_id = p.products_id where p.products_status = '1' and pd.language_id = '1' and p.products_id in () order by rand() limit 20

[TEP STOP]

 

I am trying to reference the Featured Products into the Scroller.

Edited by TomB01

Share this post


Link to post
Share on other sites

A logo rotator. That's a new one. Must remember that....

 

The Featured Products module needs to have some featured products set. Well, at least one. Otherwise it throws that error. I could fix that, but then people would complain that it's not showing any products. You can't win at this game.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

Well, I have 7 6 products filled into the Featured Products module.  The scroller blows up with the SQL error when I attempt to change Products Shown to "featured."  It works when I change it back to "all."

Edited by TomB01

Share this post


Link to post
Share on other sites

The scroller has it's own Featured Products list. These are supposed to be independent modules, so you could have a different set of products in each one.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

OK, I feel like I'm trashing this thread with my mistakes, but here goes.  The reason I loaded the Featured Products module is because I get nothing when I change the Scroller's "Products Shown" to "featured."  There is no "Scroller Products" that is in the admin configuration as mentioned in the documentation.  I thought maybe this might appear when selecting "featured," but it doesn't.  So, I loaded the Featured Products module thinking that might be the connection.

 

post-195714-0-24540800-1411268872_thumb.jpg

 

 

Share this post


Link to post
Share on other sites

That's really weird. Are you using version 1.4 of this Addon? Mine looks like the attached image.

 

Regards

Jim

 

 

post-14259-0-38879100-1411270406_thumb.png


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

Share this post


Link to post
Share on other sites

That's what I was afraid of - I have none of those Scroller Product # lines.  Mine stops at "Products Order."

 

Your excellent-as-always documentation PDF says, "Version 1.4, May 2013."

 

It's probably something else I have messed up.  Let's see:

1. Made the 960gs fluid 

2. Installed Theme Switcher

3. USPS Shipping

4. UPS Shipping

5. Stripe Credit Card

6. Comments on Invoice

7. Order Editor

8. FedEx Shipping

9. Random Header (logo rotator I mentioned)

10. Generic Box - used to display SSL graphic and another generic_box_2 installed for info text

11. Modded footer to show counter and date

12. Modular Front Page

 

I think that's about it - there's some miscellaneous stuff I did to show some preferred images I have, etc., but not much more.  The actual store is running and accepting orders/payments/calculating shipping, etc.  The Modular Front Page is just loaded on the sandbox so far.

Edited by TomB01

Share this post


Link to post
Share on other sites

Look in the fp_scroller.php module. You should find this code:

    function keys() {
      $keys = array ();
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_SORT_ORDER';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_STATUS';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_MODULE_HEIGHT';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_IMAGE_PADDING';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_AUTOSCROLL';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_AUTOSCROLL_DIRECTION';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_HOTSPOTS_VISIBLE';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_HOTSPOTS_VISIBLE_TIME';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_AUTOSCROLL_STEP';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_AUTOSCROLL_INTERVAL';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_MANUAL_SCROLL_STEP';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_MANUAL_SCROLL_INTERVAL';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_MOUSEDOWN_SPEED';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_MAX_DISPLAY';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_PRODUCTS_TYPE';
      $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_PRODUCTS_ORDER';

If that code exists, the lines that I showed have to exist. Nothing else that you have installed should be able to interfere with this module.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

I'm not understanding because I can't see how those lines you posted would produce ten headings of "Scroller Product # ."  Those lines are absolutely in the fp_scroller.php on my server (in catalog/includes/modules/front_page), but shouldn't you have a for i=1 to 10 loop or something similar at the end to cycle through "Scroller Product #" + i ?  I'm not fluent in php, but

 

You'd need this:

for ($id = 1; $id <= $this->featured_products; $id++) {        $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_PRODUCT_' . $id;      }      return $keys;

which happens to be in my file, also.  How is the variable "featured_products" set?  Could that be the problem?  

Share this post


Link to post
Share on other sites

Yeah, I accidentally left out the next four lines:


      for ($id = 1; $id <= $this->featured_products; $id++) {
        $keys[] = 'MODULE_FRONT_PAGE_SCROLLER_PRODUCT_' . $id;
      }

The featured products are selected in the constant MODULE_FRONT_PAGE_SCROLLER_PRODUCTS_TYPE, which is one of the constants stored in the database in the install() method and the keys() method. I only showed the keys() constants because they are easier to read than the long install() strings.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

Well, it's a weird one, for sure.  I completely agree with you that there's no reason it shouldn't print out in the admin config screen.  However, just checking my database - there are no fields at all in the "configuration" table for "MODULE_FRONT_PAGE_SCROLLER_PRODUCT_id"  The "configuration" table ends just as the admin config screen does, with the field, "MODULE_FRONT_PAGE_SCROLLER_PRODUCTS_ORDER."

 

Where is the install()method kicked off?  Could I check that to see why the "... SCROLLER_PRODUCT_id" fields don't get created?

Share this post


Link to post
Share on other sites

The install() method runs in admin/modules.php. I see no reason why it would install part of the module and not all of it. Perhaps it's throwing an error part of the way through, and then stopping? I have no idea why that would happen.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

The install() method runs in admin/modules.php. I see no reason why it would install part of the module and not all of it. Perhaps it's throwing an error part of the way through, and then stopping? I have no idea why that would happen.

 

Regards

Jim

 

Well remember that you're working with a dummy. ;)   I noticed some posts earlier in the thread about "featured products."  If that value was NULL, seems to me it wouldn't even go through the do loop to create the database entries.  Is there some other place I'm not aware of in OsC 2.3.4. where a category/value/section/whatever defines something called "featured products?"  If I was missing that, would it not explain what's going on?  I notice that the catalog has a place to define "Products Expected."  (I'm not using it right now.) Is that where your module "Upcoming Products" gets its info and could the same thing be happening for "Featured Products?"  When I've tried loading "Upcoming Products" I can't seem to tell how it gets filled with information. 

 

Just stabbing in the dark, here ...

Share this post


Link to post
Share on other sites

Upcoming Products is filled with the expected products according to the database timestamp on each product.

 

Featured Products depends on $featured_products which is defined ... nowhere. What? Why is my copy working? Something is missing. Find this code in fp_scroller.php:

  class scroller {
    var $code = 'scroller';
    var $group = 'front_page';
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;
    var $count;

and add this after:

    // Set the number in the following line to the number of featured products desired.
    var $featured_products = 10;

I have no idea why that code disappeared. You'll need to uninstall and reinstall the module after uploading the changes. Thanks for making me look at this; I'll fix the master and upload a new version.

 

Actually, I should make a new version anyway, now that the Content module feature has been added to osCommerce. But it looks like V. 2.4 of osC will have some of these modules anyway, so I can just wait and add the ones they don't -- like this scroller.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

In the last version modular_front_page_1.4    the code is there

 

catalog/includes/modules/front_page/fp_featured.php

  class fp_featured {
    var $code = 'fp_featured';
    var $group = 'front_page';
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;
    var $count;
    // Set the number of featured products in case the constant is not defined
    var $featured_products = 10;

@@TomB01

 

are you sure you are using the latest version??

 

Regards

Joli


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

Brilliant!  Works like a charm, now.  Maybe I'm not such a dummy after all. ;)

 

Many thanks for this, Jim!  Half my add-ons (Theme Switcher, Generic Box, Modular Front Page) are yours or ones you support (USPS Shipping).  Your support is impeccable, too - a real credit to the community.

Share this post


Link to post
Share on other sites

@Joli - what I downloaded and loaded is "modular_front_page_1.4.tar.gz"  my fp_scroller.php does not have those lines.

 

The file itself says, "$Id: fp_scroller.php v1.1 20130513 Kymation $"

Share this post


Link to post
Share on other sites

@@joli1811  It's not there in my master copy, and it's not there in the copy of 1.4 I just downloaded. I don't know where you got it, but yours is right.

 

@@TomB01  I try. These addons are my work, and I like to see people using them.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

modular_front_page_1.4  just downloaded again

 

http://addons.oscommerce.com/info/7626

 

is ok ??

 

Now that is weird we are talking about

 

/modular_front_page_1.4/catalog/includes/modules/front_page/fp_featured.php

 

??

fp_featured.php


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
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

×